Commit 497b2e4e authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Be a bit more strict on where we do actually expect default names to be generated

(removed this feature for UDTs, structures' fields, enums, typedefs, compilands)
parent 96bfe9d0
...@@ -566,10 +566,14 @@ static void dwarf2_find_name(dwarf2_parse_context_t* ctx, ...@@ -566,10 +566,14 @@ static void dwarf2_find_name(dwarf2_parse_context_t* ctx,
if (!dwarf2_find_attribute(ctx, di, DW_AT_name, attr)) if (!dwarf2_find_attribute(ctx, di, DW_AT_name, attr))
{ {
if (pfx)
{
char* tmp = pool_alloc(&ctx->pool, strlen(pfx) + 16); char* tmp = pool_alloc(&ctx->pool, strlen(pfx) + 16);
if (tmp) sprintf(tmp, "%s_%d", pfx, index++); if (tmp) sprintf(tmp, "%s_%d", pfx, index++);
attr->u.string = tmp; attr->u.string = tmp;
} }
else attr->u.string = NULL;
}
} }
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*,
...@@ -915,7 +919,7 @@ static struct symt* dwarf2_parse_base_type(dwarf2_parse_context_t* ctx, ...@@ -915,7 +919,7 @@ static struct symt* dwarf2_parse_base_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));
dwarf2_find_name(ctx, di, &name, "base_type"); dwarf2_find_name(ctx, di, &name, NULL);
if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 0; if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 0;
if (!dwarf2_find_attribute(ctx, di, DW_AT_encoding, &encoding)) encoding.u.uvalue = DW_ATE_void; if (!dwarf2_find_attribute(ctx, di, DW_AT_encoding, &encoding)) encoding.u.uvalue = DW_ATE_void;
...@@ -947,13 +951,11 @@ static struct symt* dwarf2_parse_typedef(dwarf2_parse_context_t* ctx, ...@@ -947,13 +951,11 @@ static struct symt* dwarf2_parse_typedef(dwarf2_parse_context_t* ctx,
TRACE("%s, for %lu\n", dwarf2_debug_ctx(ctx), di->abbrev->entry_code); TRACE("%s, for %lu\n", dwarf2_debug_ctx(ctx), di->abbrev->entry_code);
dwarf2_find_name(ctx, di, &name, "typedef"); dwarf2_find_name(ctx, di, &name, NULL);
ref_type = dwarf2_lookup_type(ctx, di); ref_type = dwarf2_lookup_type(ctx, di);
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 (di->abbrev->have_child) FIXME("Unsupported children\n");
return di->symt; return di->symt;
} }
...@@ -1084,7 +1086,7 @@ static void dwarf2_parse_udt_member(dwarf2_parse_context_t* ctx, ...@@ -1084,7 +1086,7 @@ static void dwarf2_parse_udt_member(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));
dwarf2_find_name(ctx, di, &name, "udt_member"); dwarf2_find_name(ctx, di, &name, NULL);
elt_type = dwarf2_lookup_type(ctx, di); elt_type = dwarf2_lookup_type(ctx, di);
if (dwarf2_compute_location_attr(ctx, di, DW_AT_data_member_location, &loc, NULL)) if (dwarf2_compute_location_attr(ctx, di, DW_AT_data_member_location, &loc, NULL))
{ {
...@@ -1132,7 +1134,7 @@ static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx, ...@@ -1132,7 +1134,7 @@ static struct symt* dwarf2_parse_udt_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));
dwarf2_find_name(ctx, di, &name, "udt"); dwarf2_find_name(ctx, di, &name, NULL);
if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 0; if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 0;
di->symt = &symt_new_udt(ctx->module, name.u.string, size.u.uvalue, udt)->symt; di->symt = &symt_new_udt(ctx->module, name.u.string, size.u.uvalue, udt)->symt;
...@@ -1180,7 +1182,7 @@ static void dwarf2_parse_enumerator(dwarf2_parse_context_t* ctx, ...@@ -1180,7 +1182,7 @@ static void dwarf2_parse_enumerator(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));
dwarf2_find_name(ctx, di, &name, "enum_value"); dwarf2_find_name(ctx, di, &name, NULL);
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);
...@@ -1197,7 +1199,7 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx, ...@@ -1197,7 +1199,7 @@ static struct symt* dwarf2_parse_enumeration_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));
dwarf2_find_name(ctx, di, &name, "enum"); dwarf2_find_name(ctx, di, &name, NULL);
if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 0; if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 0;
di->symt = &symt_new_enum(ctx->module, name.u.string)->symt; di->symt = &symt_new_enum(ctx->module, name.u.string)->symt;
...@@ -1904,7 +1906,7 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections, ...@@ -1904,7 +1906,7 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
struct attribute stmt_list, low_pc; struct attribute stmt_list, low_pc;
struct attribute comp_dir; struct attribute comp_dir;
dwarf2_find_name(&ctx, di, &name, "compiland"); dwarf2_find_name(&ctx, di, &name, NULL);
/* get working directory of current compilation unit */ /* get working directory of current compilation unit */
if (!dwarf2_find_attribute(&ctx, di, DW_AT_comp_dir, &comp_dir)) if (!dwarf2_find_attribute(&ctx, di, DW_AT_comp_dir, &comp_dir))
......
...@@ -213,20 +213,23 @@ BOOL symt_add_udt_element(struct module* module, struct symt_udt* udt_type, ...@@ -213,20 +213,23 @@ BOOL symt_add_udt_element(struct module* module, struct symt_udt* udt_type,
assert(udt_type->symt.tag == SymTagUDT); assert(udt_type->symt.tag == SymTagUDT);
TRACE_(dbghelp_symt)("Adding %s to UDT %s\n", name, udt_type->hash_elt.name); TRACE_(dbghelp_symt)("Adding %s to UDT %s\n", name, udt_type->hash_elt.name);
if (name)
{
p = NULL; p = NULL;
while ((p = vector_iter_up(&udt_type->vchildren, p))) while ((p = vector_iter_up(&udt_type->vchildren, p)))
{ {
m = (struct symt_data*)*p; m = (struct symt_data*)*p;
assert(m); assert(m);
assert(m->symt.tag == SymTagData); assert(m->symt.tag == SymTagData);
if (m->hash_elt.name[0] == name[0] && strcmp(m->hash_elt.name, name) == 0) if (strcmp(m->hash_elt.name, name) == 0)
return TRUE; return TRUE;
} }
}
if ((m = pool_alloc(&module->pool, sizeof(*m))) == NULL) return FALSE; if ((m = pool_alloc(&module->pool, sizeof(*m))) == NULL) return FALSE;
memset(m, 0, sizeof(*m)); memset(m, 0, sizeof(*m));
m->symt.tag = SymTagData; m->symt.tag = SymTagData;
m->hash_elt.name = pool_strdup(&module->pool, name); m->hash_elt.name = name ? pool_strdup(&module->pool, name) : "";
m->hash_elt.next = NULL; m->hash_elt.next = NULL;
m->kind = DataIsMember; m->kind = DataIsMember;
......
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