Commit 395d734d authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Store the compiland into the parse context.

parent 0d4a9757
...@@ -187,6 +187,7 @@ typedef struct dwarf2_parse_context_s ...@@ -187,6 +187,7 @@ typedef struct dwarf2_parse_context_s
unsigned section; unsigned section;
struct pool pool; struct pool pool;
struct module* module; struct module* module;
struct symt_compiland* compiland;
const struct elf_thunk_area*thunks; const struct elf_thunk_area*thunks;
struct sparse_array abbrev_table; struct sparse_array abbrev_table;
struct sparse_array debug_info_table; struct sparse_array debug_info_table;
...@@ -634,8 +635,7 @@ static BOOL dwarf2_find_attribute(const dwarf2_parse_context_t* ctx, ...@@ -634,8 +635,7 @@ static BOOL dwarf2_find_attribute(const dwarf2_parse_context_t* ctx,
return FALSE; return FALSE;
} }
static void dwarf2_load_one_entry(dwarf2_parse_context_t*, dwarf2_debug_info_t*, static void dwarf2_load_one_entry(dwarf2_parse_context_t*, dwarf2_debug_info_t*);
struct symt_compiland*);
#define Wine_DW_no_register 0x7FFFFFFF #define Wine_DW_no_register 0x7FFFFFFF
...@@ -946,7 +946,7 @@ static struct symt* dwarf2_lookup_type(dwarf2_parse_context_t* ctx, ...@@ -946,7 +946,7 @@ static struct symt* dwarf2_lookup_type(dwarf2_parse_context_t* ctx,
if (!type->symt) if (!type->symt)
{ {
/* load the debug info entity */ /* load the debug info entity */
dwarf2_load_one_entry(ctx, type, NULL); dwarf2_load_one_entry(ctx, type);
} }
return type->symt; return type->symt;
} }
...@@ -1501,7 +1501,6 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx, ...@@ -1501,7 +1501,6 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx,
typedef struct dwarf2_subprogram_s typedef struct dwarf2_subprogram_s
{ {
dwarf2_parse_context_t* ctx; dwarf2_parse_context_t* ctx;
struct symt_compiland* compiland;
struct symt_function* func; struct symt_function* func;
BOOL non_computed_variable; BOOL non_computed_variable;
struct location frame; struct location frame;
...@@ -1549,7 +1548,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, ...@@ -1549,7 +1548,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
if (!dwarf2_find_attribute(subpgm->ctx, di, DW_AT_external, &ext)) if (!dwarf2_find_attribute(subpgm->ctx, di, DW_AT_external, &ext))
ext.u.uvalue = 0; ext.u.uvalue = 0;
loc.offset += subpgm->ctx->load_offset; loc.offset += subpgm->ctx->load_offset;
symt_new_global_variable(subpgm->ctx->module, subpgm->compiland, symt_new_global_variable(subpgm->ctx->module, subpgm->ctx->compiland,
dwarf2_get_cpp_name(subpgm->ctx, di, name.u.string), !ext.u.uvalue, dwarf2_get_cpp_name(subpgm->ctx, di, name.u.string), !ext.u.uvalue,
loc, 0, param_type); loc, 0, param_type);
break; break;
...@@ -1625,7 +1624,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, ...@@ -1625,7 +1624,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
name.u.string, value.form); name.u.string, value.form);
v.n1.n2.vt = VT_EMPTY; v.n1.n2.vt = VT_EMPTY;
} }
di->symt = &symt_new_constant(subpgm->ctx->module, subpgm->compiland, di->symt = &symt_new_constant(subpgm->ctx->module, subpgm->ctx->compiland,
name.u.string, param_type, &v)->symt; name.u.string, param_type, &v)->symt;
} }
else else
...@@ -1797,8 +1796,7 @@ static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm, ...@@ -1797,8 +1796,7 @@ static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
} }
static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx, static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
dwarf2_debug_info_t* di, dwarf2_debug_info_t* di)
struct symt_compiland* compiland)
{ {
struct attribute name; struct attribute name;
unsigned long low_pc, high_pc; unsigned long low_pc, high_pc;
...@@ -1856,7 +1854,7 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx, ...@@ -1856,7 +1854,7 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
sig_type = symt_new_function_signature(ctx->module, ret_type, CV_CALL_FAR_C); sig_type = symt_new_function_signature(ctx->module, ret_type, CV_CALL_FAR_C);
if (!is_decl.u.uvalue || is_decl.gotten_from != attr_direct) if (!is_decl.u.uvalue || is_decl.gotten_from != attr_direct)
{ {
subpgm.func = symt_new_function(ctx->module, compiland, subpgm.func = symt_new_function(ctx->module, ctx->compiland,
dwarf2_get_cpp_name(ctx, di, name.u.string), dwarf2_get_cpp_name(ctx, di, name.u.string),
ctx->load_offset + low_pc, high_pc - low_pc, ctx->load_offset + low_pc, high_pc - low_pc,
&sig_type->symt); &sig_type->symt);
...@@ -1865,7 +1863,6 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx, ...@@ -1865,7 +1863,6 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
else subpgm.func = NULL; else subpgm.func = NULL;
subpgm.ctx = ctx; subpgm.ctx = ctx;
subpgm.compiland = compiland;
if (!dwarf2_compute_location_attr(ctx, di, DW_AT_frame_base, if (!dwarf2_compute_location_attr(ctx, di, DW_AT_frame_base,
&subpgm.frame, NULL)) &subpgm.frame, NULL))
{ {
...@@ -1972,8 +1969,7 @@ static struct symt* dwarf2_parse_subroutine_type(dwarf2_parse_context_t* ctx, ...@@ -1972,8 +1969,7 @@ static struct symt* dwarf2_parse_subroutine_type(dwarf2_parse_context_t* ctx,
} }
static void dwarf2_parse_namespace(dwarf2_parse_context_t* ctx, static void dwarf2_parse_namespace(dwarf2_parse_context_t* ctx,
dwarf2_debug_info_t* di, dwarf2_debug_info_t* di)
struct symt_compiland* compiland)
{ {
struct vector* children; struct vector* children;
dwarf2_debug_info_t* child; dwarf2_debug_info_t* child;
...@@ -1989,13 +1985,12 @@ static void dwarf2_parse_namespace(dwarf2_parse_context_t* ctx, ...@@ -1989,13 +1985,12 @@ static void dwarf2_parse_namespace(dwarf2_parse_context_t* ctx,
if (children) for (i = 0; i < vector_length(children); i++) if (children) for (i = 0; i < vector_length(children); i++)
{ {
child = *(dwarf2_debug_info_t**)vector_at(children, i); child = *(dwarf2_debug_info_t**)vector_at(children, i);
dwarf2_load_one_entry(ctx, child, compiland); dwarf2_load_one_entry(ctx, child);
} }
} }
static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx, static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx,
dwarf2_debug_info_t* di, dwarf2_debug_info_t* di)
struct symt_compiland* compiland)
{ {
switch (di->abbrev->tag) switch (di->abbrev->tag)
{ {
...@@ -2033,7 +2028,7 @@ static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx, ...@@ -2033,7 +2028,7 @@ static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx,
dwarf2_parse_enumeration_type(ctx, di); dwarf2_parse_enumeration_type(ctx, di);
break; break;
case DW_TAG_subprogram: case DW_TAG_subprogram:
dwarf2_parse_subprogram(ctx, di, compiland); dwarf2_parse_subprogram(ctx, di);
break; break;
case DW_TAG_subroutine_type: case DW_TAG_subroutine_type:
dwarf2_parse_subroutine_type(ctx, di); dwarf2_parse_subroutine_type(ctx, di);
...@@ -2043,7 +2038,6 @@ static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx, ...@@ -2043,7 +2038,6 @@ static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx,
dwarf2_subprogram_t subpgm; dwarf2_subprogram_t subpgm;
subpgm.ctx = ctx; subpgm.ctx = ctx;
subpgm.compiland = compiland;
subpgm.func = NULL; subpgm.func = NULL;
subpgm.frame.kind = loc_absolute; subpgm.frame.kind = loc_absolute;
subpgm.frame.offset = 0; subpgm.frame.offset = 0;
...@@ -2052,7 +2046,7 @@ static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx, ...@@ -2052,7 +2046,7 @@ static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx,
} }
break; break;
case DW_TAG_namespace: case DW_TAG_namespace:
dwarf2_parse_namespace(ctx, di, compiland); dwarf2_parse_namespace(ctx, di);
break; break;
/* silence a couple of C++ defines */ /* silence a couple of C++ defines */
case DW_TAG_imported_module: case DW_TAG_imported_module:
...@@ -2336,15 +2330,14 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections, ...@@ -2336,15 +2330,14 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
if (!dwarf2_find_attribute(&ctx, di, DW_AT_low_pc, &low_pc)) if (!dwarf2_find_attribute(&ctx, di, DW_AT_low_pc, &low_pc))
low_pc.u.uvalue = 0; low_pc.u.uvalue = 0;
di->symt = &symt_new_compiland(module, ctx.compiland = symt_new_compiland(module, ctx.load_offset + low_pc.u.uvalue,
ctx.load_offset + low_pc.u.uvalue, source_new(module, comp_dir.u.string, name.u.string));
source_new(module, comp_dir.u.string, name.u.string))->symt; di->symt = &ctx.compiland->symt;
children = dwarf2_get_di_children(&ctx, di); children = dwarf2_get_di_children(&ctx, di);
if (children) for (i = 0; i < vector_length(children); i++) if (children) for (i = 0; i < vector_length(children); i++)
{ {
child = *(dwarf2_debug_info_t**)vector_at(children, i); child = *(dwarf2_debug_info_t**)vector_at(children, i);
dwarf2_load_one_entry(&ctx, child, (struct symt_compiland*)di->symt); dwarf2_load_one_entry(&ctx, child);
} }
if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list)) if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment