dbghelp: In dwarf debug format, correctly manage the DW_AT_specification attribute.
This commit is contained in:
parent
0035d5df3f
commit
0d4a9757c2
|
@ -138,6 +138,7 @@ struct dwarf2_block
|
||||||
struct attribute
|
struct attribute
|
||||||
{
|
{
|
||||||
unsigned long form;
|
unsigned long form;
|
||||||
|
enum {attr_direct, attr_abstract_origin, attr_specification} gotten_from;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
unsigned long uvalue;
|
unsigned long uvalue;
|
||||||
|
@ -597,13 +598,14 @@ static BOOL dwarf2_find_attribute(const dwarf2_parse_context_t* ctx,
|
||||||
const dwarf2_debug_info_t* di,
|
const dwarf2_debug_info_t* di,
|
||||||
unsigned at, struct attribute* attr)
|
unsigned at, struct attribute* attr)
|
||||||
{
|
{
|
||||||
unsigned i, ai = 0;
|
unsigned i, refidx = 0;
|
||||||
dwarf2_abbrev_entry_attr_t* abbrev_attr;
|
dwarf2_abbrev_entry_attr_t* abbrev_attr;
|
||||||
dwarf2_abbrev_entry_attr_t* abstract_abbrev_attr;
|
dwarf2_abbrev_entry_attr_t* ref_abbrev_attr = NULL;
|
||||||
|
|
||||||
|
attr->gotten_from = attr_direct;
|
||||||
while (di)
|
while (di)
|
||||||
{
|
{
|
||||||
abstract_abbrev_attr = NULL;
|
ref_abbrev_attr = NULL;
|
||||||
for (i = 0, abbrev_attr = di->abbrev->attrs; abbrev_attr; i++, abbrev_attr = abbrev_attr->next)
|
for (i = 0, abbrev_attr = di->abbrev->attrs; abbrev_attr; i++, abbrev_attr = abbrev_attr->next)
|
||||||
{
|
{
|
||||||
if (abbrev_attr->attribute == at)
|
if (abbrev_attr->attribute == at)
|
||||||
|
@ -611,16 +613,21 @@ static BOOL dwarf2_find_attribute(const dwarf2_parse_context_t* ctx,
|
||||||
dwarf2_fill_attr(ctx, abbrev_attr, di->data[i], attr);
|
dwarf2_fill_attr(ctx, abbrev_attr, di->data[i], attr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (abbrev_attr->attribute == DW_AT_abstract_origin &&
|
if ((abbrev_attr->attribute == DW_AT_abstract_origin ||
|
||||||
|
abbrev_attr->attribute == DW_AT_specification) &&
|
||||||
at != DW_AT_sibling)
|
at != DW_AT_sibling)
|
||||||
{
|
{
|
||||||
abstract_abbrev_attr = abbrev_attr;
|
if (ref_abbrev_attr)
|
||||||
ai = i;
|
FIXME("two references %lx and %lx\n", ref_abbrev_attr->attribute, abbrev_attr->attribute);
|
||||||
|
ref_abbrev_attr = abbrev_attr;
|
||||||
|
refidx = i;
|
||||||
|
attr->gotten_from = (abbrev_attr->attribute == DW_AT_abstract_origin) ?
|
||||||
|
attr_abstract_origin : attr_specification;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* do we have an abstract origin debug entry to look into ? */
|
/* do we have either an abstract origin or a specification debug entry to look into ? */
|
||||||
if (!abstract_abbrev_attr) break;
|
if (!ref_abbrev_attr) break;
|
||||||
dwarf2_fill_attr(ctx, abstract_abbrev_attr, di->data[ai], attr);
|
dwarf2_fill_attr(ctx, ref_abbrev_attr, di->data[refidx], attr);
|
||||||
if (!(di = sparse_array_find(&ctx->debug_info_table, attr->u.uvalue)))
|
if (!(di = sparse_array_find(&ctx->debug_info_table, attr->u.uvalue)))
|
||||||
FIXME("Should have found the debug info entry\n");
|
FIXME("Should have found the debug info entry\n");
|
||||||
}
|
}
|
||||||
|
@ -1109,6 +1116,22 @@ static BOOL dwarf2_read_one_debug_info(dwarf2_parse_context_t* ctx,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct vector* dwarf2_get_di_children(dwarf2_parse_context_t* ctx,
|
||||||
|
dwarf2_debug_info_t* di)
|
||||||
|
{
|
||||||
|
struct attribute spec;
|
||||||
|
|
||||||
|
while (di)
|
||||||
|
{
|
||||||
|
if (di->abbrev->have_child)
|
||||||
|
return &di->children;
|
||||||
|
if (!dwarf2_find_attribute(ctx, di, DW_AT_specification, &spec)) break;
|
||||||
|
if (!(di = sparse_array_find(&ctx->debug_info_table, spec.u.uvalue)))
|
||||||
|
FIXME("Should have found the debug info entry\n");
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static struct symt* dwarf2_parse_base_type(dwarf2_parse_context_t* ctx,
|
static struct symt* dwarf2_parse_base_type(dwarf2_parse_context_t* ctx,
|
||||||
dwarf2_debug_info_t* di)
|
dwarf2_debug_info_t* di)
|
||||||
{
|
{
|
||||||
|
@ -1159,7 +1182,7 @@ static struct symt* dwarf2_parse_base_type(dwarf2_parse_context_t* ctx,
|
||||||
if (cache_idx != -1 && !ctx->symt_cache[cache_idx])
|
if (cache_idx != -1 && !ctx->symt_cache[cache_idx])
|
||||||
ctx->symt_cache[cache_idx] = di->symt;
|
ctx->symt_cache[cache_idx] = di->symt;
|
||||||
|
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
return di->symt;
|
return di->symt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,7 +1201,7 @@ static struct symt* dwarf2_parse_typedef(dwarf2_parse_context_t* ctx,
|
||||||
|
|
||||||
if (name.u.string)
|
if (name.u.string)
|
||||||
di->symt = &symt_new_typedef(ctx->module, ref_type, name.u.string)->symt;
|
di->symt = &symt_new_typedef(ctx->module, ref_type, name.u.string)->symt;
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
return di->symt;
|
return di->symt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1199,7 +1222,7 @@ static struct symt* dwarf2_parse_pointer_type(dwarf2_parse_context_t* ctx,
|
||||||
assert(ref_type);
|
assert(ref_type);
|
||||||
}
|
}
|
||||||
di->symt = &symt_new_pointer(ctx->module, ref_type, size.u.uvalue)->symt;
|
di->symt = &symt_new_pointer(ctx->module, ref_type, size.u.uvalue)->symt;
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
return di->symt;
|
return di->symt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,6 +1234,7 @@ static struct symt* dwarf2_parse_array_type(dwarf2_parse_context_t* ctx,
|
||||||
struct attribute min, max, cnt;
|
struct attribute min, max, cnt;
|
||||||
dwarf2_debug_info_t* child;
|
dwarf2_debug_info_t* child;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
const struct vector* children;
|
||||||
|
|
||||||
if (di->symt) return di->symt;
|
if (di->symt) return di->symt;
|
||||||
|
|
||||||
|
@ -1218,7 +1242,7 @@ static struct symt* dwarf2_parse_array_type(dwarf2_parse_context_t* ctx,
|
||||||
|
|
||||||
ref_type = dwarf2_lookup_type(ctx, di);
|
ref_type = dwarf2_lookup_type(ctx, di);
|
||||||
|
|
||||||
if (!di->abbrev->have_child)
|
if (!(children = dwarf2_get_di_children(ctx, di)))
|
||||||
{
|
{
|
||||||
/* fake an array with unknown size */
|
/* fake an array with unknown size */
|
||||||
/* FIXME: int4 even on 64bit machines??? */
|
/* FIXME: int4 even on 64bit machines??? */
|
||||||
|
@ -1226,9 +1250,9 @@ static struct symt* dwarf2_parse_array_type(dwarf2_parse_context_t* ctx,
|
||||||
min.u.uvalue = 0;
|
min.u.uvalue = 0;
|
||||||
max.u.uvalue = -1;
|
max.u.uvalue = -1;
|
||||||
}
|
}
|
||||||
else for (i = 0; i < vector_length(&di->children); i++)
|
else for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
switch (child->abbrev->tag)
|
switch (child->abbrev->tag)
|
||||||
{
|
{
|
||||||
case DW_TAG_subrange_type:
|
case DW_TAG_subrange_type:
|
||||||
|
@ -1260,7 +1284,7 @@ static struct symt* dwarf2_parse_const_type(dwarf2_parse_context_t* ctx,
|
||||||
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
||||||
|
|
||||||
ref_type = dwarf2_lookup_type(ctx, di);
|
ref_type = dwarf2_lookup_type(ctx, di);
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
di->symt = ref_type;
|
di->symt = ref_type;
|
||||||
|
|
||||||
return ref_type;
|
return ref_type;
|
||||||
|
@ -1276,7 +1300,7 @@ static struct symt* dwarf2_parse_volatile_type(dwarf2_parse_context_t* ctx,
|
||||||
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
||||||
|
|
||||||
ref_type = dwarf2_lookup_type(ctx, di);
|
ref_type = dwarf2_lookup_type(ctx, di);
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
di->symt = ref_type;
|
di->symt = ref_type;
|
||||||
|
|
||||||
return ref_type;
|
return ref_type;
|
||||||
|
@ -1295,13 +1319,13 @@ static struct symt* dwarf2_parse_reference_type(dwarf2_parse_context_t* ctx,
|
||||||
/* FIXME: for now, we hard-wire C++ references to pointers */
|
/* FIXME: for now, we hard-wire C++ references to pointers */
|
||||||
di->symt = &symt_new_pointer(ctx->module, ref_type, sizeof(void *))->symt;
|
di->symt = &symt_new_pointer(ctx->module, ref_type, sizeof(void *))->symt;
|
||||||
|
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
|
|
||||||
return di->symt;
|
return di->symt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dwarf2_parse_udt_member(dwarf2_parse_context_t* ctx,
|
static void dwarf2_parse_udt_member(dwarf2_parse_context_t* ctx,
|
||||||
const dwarf2_debug_info_t* di,
|
dwarf2_debug_info_t* di,
|
||||||
struct symt_udt* parent)
|
struct symt_udt* parent)
|
||||||
{
|
{
|
||||||
struct symt* elt_type;
|
struct symt* elt_type;
|
||||||
|
@ -1350,7 +1374,7 @@ static void dwarf2_parse_udt_member(dwarf2_parse_context_t* ctx,
|
||||||
(loc.offset << 3) + bit_offset.u.uvalue,
|
(loc.offset << 3) + bit_offset.u.uvalue,
|
||||||
bit_size.u.uvalue);
|
bit_size.u.uvalue);
|
||||||
|
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx,
|
static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx,
|
||||||
|
@ -1359,6 +1383,9 @@ static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx,
|
||||||
{
|
{
|
||||||
struct attribute name;
|
struct attribute name;
|
||||||
struct attribute size;
|
struct attribute size;
|
||||||
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t*child;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (di->symt) return di->symt;
|
if (di->symt) return di->symt;
|
||||||
|
|
||||||
|
@ -1370,14 +1397,10 @@ static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx,
|
||||||
di->symt = &symt_new_udt(ctx->module, dwarf2_get_cpp_name(ctx, di, name.u.string),
|
di->symt = &symt_new_udt(ctx->module, dwarf2_get_cpp_name(ctx, di, name.u.string),
|
||||||
size.u.uvalue, udt)->symt;
|
size.u.uvalue, udt)->symt;
|
||||||
|
|
||||||
if (di->abbrev->have_child) /** any interest to not have child ? */
|
children = dwarf2_get_di_children(ctx, di);
|
||||||
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
dwarf2_debug_info_t* child;
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i=0; i<vector_length(&di->children); i++)
|
|
||||||
{
|
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
|
||||||
|
|
||||||
switch (child->abbrev->tag)
|
switch (child->abbrev->tag)
|
||||||
{
|
{
|
||||||
|
@ -1408,13 +1431,12 @@ static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return di->symt;
|
return di->symt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dwarf2_parse_enumerator(dwarf2_parse_context_t* ctx,
|
static void dwarf2_parse_enumerator(dwarf2_parse_context_t* ctx,
|
||||||
const dwarf2_debug_info_t* di,
|
dwarf2_debug_info_t* di,
|
||||||
struct symt_enum* parent)
|
struct symt_enum* parent)
|
||||||
{
|
{
|
||||||
struct attribute name;
|
struct attribute name;
|
||||||
|
@ -1426,7 +1448,7 @@ static void dwarf2_parse_enumerator(dwarf2_parse_context_t* ctx,
|
||||||
if (!dwarf2_find_attribute(ctx, di, DW_AT_const_value, &value)) value.u.svalue = 0;
|
if (!dwarf2_find_attribute(ctx, di, DW_AT_const_value, &value)) value.u.svalue = 0;
|
||||||
symt_add_enum_element(ctx->module, parent, name.u.string, value.u.svalue);
|
symt_add_enum_element(ctx->module, parent, name.u.string, value.u.svalue);
|
||||||
|
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx,
|
static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx,
|
||||||
|
@ -1435,6 +1457,9 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx,
|
||||||
struct attribute name;
|
struct attribute name;
|
||||||
struct attribute size;
|
struct attribute size;
|
||||||
struct symt_basic* basetype;
|
struct symt_basic* basetype;
|
||||||
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t*child;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (di->symt) return di->symt;
|
if (di->symt) return di->symt;
|
||||||
|
|
||||||
|
@ -1453,15 +1478,11 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx,
|
||||||
|
|
||||||
di->symt = &symt_new_enum(ctx->module, name.u.string, &basetype->symt)->symt;
|
di->symt = &symt_new_enum(ctx->module, name.u.string, &basetype->symt)->symt;
|
||||||
|
|
||||||
if (di->abbrev->have_child) /* any interest to not have child ? */
|
children = dwarf2_get_di_children(ctx, di);
|
||||||
{
|
|
||||||
dwarf2_debug_info_t* child;
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
/* FIXME: should we use the sibling stuff ?? */
|
/* FIXME: should we use the sibling stuff ?? */
|
||||||
for (i=0; i<vector_length(&di->children); i++)
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
|
|
||||||
switch (child->abbrev->tag)
|
switch (child->abbrev->tag)
|
||||||
{
|
{
|
||||||
|
@ -1473,7 +1494,6 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx,
|
||||||
di->abbrev->tag, dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
di->abbrev->tag, dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return di->symt;
|
return di->symt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1629,7 +1649,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
|
||||||
(struct symt_function_signature*)subpgm->func->type,
|
(struct symt_function_signature*)subpgm->func->type,
|
||||||
param_type);
|
param_type);
|
||||||
|
|
||||||
if (di->abbrev->have_child) FIXME("Unsupported children\n");
|
if (dwarf2_get_di_children(subpgm->ctx, di)) FIXME("Unsupported children\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dwarf2_parse_subprogram_label(dwarf2_subprogram_t* subpgm,
|
static void dwarf2_parse_subprogram_label(dwarf2_subprogram_t* subpgm,
|
||||||
|
@ -1653,14 +1673,17 @@ static void dwarf2_parse_subprogram_label(dwarf2_subprogram_t* subpgm,
|
||||||
|
|
||||||
static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
|
static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
|
||||||
struct symt_block* parent_block,
|
struct symt_block* parent_block,
|
||||||
const dwarf2_debug_info_t* di);
|
dwarf2_debug_info_t* di);
|
||||||
|
|
||||||
static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
|
static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
|
||||||
struct symt_block* parent_block,
|
struct symt_block* parent_block,
|
||||||
const dwarf2_debug_info_t* di)
|
dwarf2_debug_info_t* di)
|
||||||
{
|
{
|
||||||
struct symt_block* block;
|
struct symt_block* block;
|
||||||
unsigned long low_pc, high_pc;
|
unsigned long low_pc, high_pc;
|
||||||
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t*child;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
TRACE("%s, for %s\n", dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
|
TRACE("%s, for %s\n", dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
|
||||||
|
|
||||||
|
@ -1674,14 +1697,10 @@ static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
|
||||||
subpgm->ctx->load_offset + low_pc - subpgm->func->address,
|
subpgm->ctx->load_offset + low_pc - subpgm->func->address,
|
||||||
high_pc - low_pc);
|
high_pc - low_pc);
|
||||||
|
|
||||||
if (di->abbrev->have_child) /** any interest to not have child ? */
|
children = dwarf2_get_di_children(subpgm->ctx, di);
|
||||||
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
dwarf2_debug_info_t* child;
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i=0; i<vector_length(&di->children); i++)
|
|
||||||
{
|
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
|
||||||
|
|
||||||
switch (child->abbrev->tag)
|
switch (child->abbrev->tag)
|
||||||
{
|
{
|
||||||
|
@ -1704,16 +1723,18 @@ static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
|
||||||
dwarf2_debug_di(di));
|
dwarf2_debug_di(di));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
symt_close_func_block(subpgm->ctx->module, subpgm->func, block, 0);
|
symt_close_func_block(subpgm->ctx->module, subpgm->func, block, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
|
static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
|
||||||
struct symt_block* parent_block,
|
struct symt_block* parent_block,
|
||||||
const dwarf2_debug_info_t* di)
|
dwarf2_debug_info_t* di)
|
||||||
{
|
{
|
||||||
struct symt_block* block;
|
struct symt_block* block;
|
||||||
unsigned long low_pc, high_pc;
|
unsigned long low_pc, high_pc;
|
||||||
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t*child;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
TRACE("%s, for %s\n", dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
|
TRACE("%s, for %s\n", dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
|
||||||
|
|
||||||
|
@ -1727,14 +1748,10 @@ static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
|
||||||
subpgm->ctx->load_offset + low_pc - subpgm->func->address,
|
subpgm->ctx->load_offset + low_pc - subpgm->func->address,
|
||||||
high_pc - low_pc);
|
high_pc - low_pc);
|
||||||
|
|
||||||
if (di->abbrev->have_child) /** any interest to not have child ? */
|
children = dwarf2_get_di_children(subpgm->ctx, di);
|
||||||
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
dwarf2_debug_info_t* child;
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i=0; i<vector_length(&di->children); i++)
|
|
||||||
{
|
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
|
||||||
|
|
||||||
switch (child->abbrev->tag)
|
switch (child->abbrev->tag)
|
||||||
{
|
{
|
||||||
|
@ -1775,7 +1792,6 @@ static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
|
||||||
child->abbrev->tag, dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
|
child->abbrev->tag, dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
symt_close_func_block(subpgm->ctx->module, subpgm->func, block, 0);
|
symt_close_func_block(subpgm->ctx->module, subpgm->func, block, 0);
|
||||||
}
|
}
|
||||||
|
@ -1791,6 +1807,9 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
|
||||||
struct symt* ret_type;
|
struct symt* ret_type;
|
||||||
struct symt_function_signature* sig_type;
|
struct symt_function_signature* sig_type;
|
||||||
dwarf2_subprogram_t subpgm;
|
dwarf2_subprogram_t subpgm;
|
||||||
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t* child;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (di->symt) return di->symt;
|
if (di->symt) return di->symt;
|
||||||
|
|
||||||
|
@ -1835,7 +1854,7 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
|
||||||
|
|
||||||
/* FIXME: assuming C source code */
|
/* FIXME: assuming C source code */
|
||||||
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)
|
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, compiland,
|
||||||
dwarf2_get_cpp_name(ctx, di, name.u.string),
|
dwarf2_get_cpp_name(ctx, di, name.u.string),
|
||||||
|
@ -1857,14 +1876,10 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
|
||||||
}
|
}
|
||||||
subpgm.non_computed_variable = FALSE;
|
subpgm.non_computed_variable = FALSE;
|
||||||
|
|
||||||
if (di->abbrev->have_child) /** any interest to not have child ? */
|
children = dwarf2_get_di_children(ctx, di);
|
||||||
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
dwarf2_debug_info_t* child;
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i=0; i<vector_length(&di->children); i++)
|
|
||||||
{
|
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
|
||||||
|
|
||||||
switch (child->abbrev->tag)
|
switch (child->abbrev->tag)
|
||||||
{
|
{
|
||||||
|
@ -1903,7 +1918,6 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
|
||||||
child->abbrev->tag, dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
child->abbrev->tag, dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (subpgm.non_computed_variable || subpgm.frame.kind >= loc_user)
|
if (subpgm.non_computed_variable || subpgm.frame.kind >= loc_user)
|
||||||
{
|
{
|
||||||
|
@ -1920,6 +1934,9 @@ static struct symt* dwarf2_parse_subroutine_type(dwarf2_parse_context_t* ctx,
|
||||||
{
|
{
|
||||||
struct symt* ret_type;
|
struct symt* ret_type;
|
||||||
struct symt_function_signature* sig_type;
|
struct symt_function_signature* sig_type;
|
||||||
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t* child;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (di->symt) return di->symt;
|
if (di->symt) return di->symt;
|
||||||
|
|
||||||
|
@ -1934,14 +1951,10 @@ static struct symt* dwarf2_parse_subroutine_type(dwarf2_parse_context_t* ctx,
|
||||||
/* FIXME: assuming C source code */
|
/* FIXME: assuming C source code */
|
||||||
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 (di->abbrev->have_child) /** any interest to not have child ? */
|
children = dwarf2_get_di_children(ctx, di);
|
||||||
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
dwarf2_debug_info_t* child;
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i=0; i<vector_length(&di->children); i++)
|
|
||||||
{
|
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
|
||||||
|
|
||||||
switch (child->abbrev->tag)
|
switch (child->abbrev->tag)
|
||||||
{
|
{
|
||||||
|
@ -1954,7 +1967,6 @@ static struct symt* dwarf2_parse_subroutine_type(dwarf2_parse_context_t* ctx,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return di->symt = &sig_type->symt;
|
return di->symt = &sig_type->symt;
|
||||||
}
|
}
|
||||||
|
@ -1963,23 +1975,23 @@ 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 symt_compiland* compiland)
|
||||||
{
|
{
|
||||||
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t* child;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (di->symt) return;
|
if (di->symt) return;
|
||||||
|
|
||||||
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
|
||||||
|
|
||||||
di->symt = ctx->symt_cache[sc_void];
|
di->symt = ctx->symt_cache[sc_void];
|
||||||
if (di->abbrev->have_child) /** any interest to not have child ? */
|
|
||||||
{
|
|
||||||
dwarf2_debug_info_t* child;
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < vector_length(&di->children); i++)
|
children = dwarf2_get_di_children(ctx, di);
|
||||||
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
child = *(dwarf2_debug_info_t**)vector_at(&di->children, i);
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
dwarf2_load_one_entry(ctx, child, compiland);
|
dwarf2_load_one_entry(ctx, child, compiland);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
||||||
|
@ -2309,7 +2321,9 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
|
||||||
if (di->abbrev->tag == DW_TAG_compile_unit)
|
if (di->abbrev->tag == DW_TAG_compile_unit)
|
||||||
{
|
{
|
||||||
struct attribute name;
|
struct attribute name;
|
||||||
dwarf2_debug_info_t** pdi = NULL;
|
struct vector* children;
|
||||||
|
dwarf2_debug_info_t* child = NULL;
|
||||||
|
unsigned int i;
|
||||||
struct attribute stmt_list, low_pc;
|
struct attribute stmt_list, low_pc;
|
||||||
struct attribute comp_dir;
|
struct attribute comp_dir;
|
||||||
|
|
||||||
|
@ -2326,14 +2340,11 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
|
||||||
ctx.load_offset + low_pc.u.uvalue,
|
ctx.load_offset + low_pc.u.uvalue,
|
||||||
source_new(module, comp_dir.u.string, name.u.string))->symt;
|
source_new(module, comp_dir.u.string, name.u.string))->symt;
|
||||||
|
|
||||||
if (di->abbrev->have_child)
|
children = dwarf2_get_di_children(&ctx, di);
|
||||||
|
if (children) for (i = 0; i < vector_length(children); i++)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
child = *(dwarf2_debug_info_t**)vector_at(children, i);
|
||||||
for (i=0; i<vector_length(&di->children); i++)
|
dwarf2_load_one_entry(&ctx, child, (struct symt_compiland*)di->symt);
|
||||||
{
|
|
||||||
pdi = vector_at(&di->children, i);
|
|
||||||
dwarf2_load_one_entry(&ctx, *pdi, (struct symt_compiland*)di->symt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list))
|
if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue