[PATCH 14/22] [DbgHelp]: dwarf & default names

Eric Pouech eric.pouech at wanadoo.fr
Fri Nov 24 15:18:16 CST 2006


- 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)

A+
---

 dlls/dbghelp/dwarf.c |   26 ++++++++++++++------------
 dlls/dbghelp/type.c  |   19 +++++++++++--------
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index bf91e09..a61c833 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -566,9 +566,13 @@ static void dwarf2_find_name(dwarf2_pars
 
     if (!dwarf2_find_attribute(ctx, di, DW_AT_name, attr))
     {
-        char* tmp = pool_alloc(&ctx->pool, strlen(pfx) + 16);
-        if (tmp) sprintf(tmp, "%s_%d", pfx, index++);
-        attr->u.string = tmp;
+        if (pfx)
+        {
+            char* tmp = pool_alloc(&ctx->pool, strlen(pfx) + 16);
+            if (tmp) sprintf(tmp, "%s_%d", pfx, index++);
+            attr->u.string = tmp;
+        }
+        else attr->u.string = NULL;
     }
 }
 
@@ -915,7 +919,7 @@ static struct symt* dwarf2_parse_base_ty
 
     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_encoding, &encoding)) encoding.u.uvalue = DW_ATE_void;
 
@@ -947,13 +951,11 @@ static struct symt* dwarf2_parse_typedef
 
     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);
 
     if (name.u.string)
-    {
         di->symt = &symt_new_typedef(ctx->module, ref_type, name.u.string)->symt;
-    }
     if (di->abbrev->have_child) FIXME("Unsupported children\n");
     return di->symt;
 }
@@ -1084,7 +1086,7 @@ static void dwarf2_parse_udt_member(dwar
 
     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);
     if (dwarf2_compute_location_attr(ctx, di, DW_AT_data_member_location, &loc, NULL))
     {
@@ -1132,7 +1134,7 @@ static struct symt* dwarf2_parse_udt_typ
 
     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;
 
     di->symt = &symt_new_udt(ctx->module, name.u.string, size.u.uvalue, udt)->symt;
@@ -1180,7 +1182,7 @@ static void dwarf2_parse_enumerator(dwar
 
     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;
     symt_add_enum_element(ctx->module, parent, name.u.string, value.u.svalue);
 
@@ -1197,7 +1199,7 @@ static struct symt* dwarf2_parse_enumera
 
     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;
 
     di->symt = &symt_new_enum(ctx->module, name.u.string)->symt;
@@ -1904,7 +1906,7 @@ static BOOL dwarf2_parse_compilation_uni
         struct attribute            stmt_list, low_pc;
         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 */
         if (!dwarf2_find_attribute(&ctx, di, DW_AT_comp_dir, &comp_dir))
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c
index e112ce9..d520414 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -213,20 +213,23 @@ BOOL symt_add_udt_element(struct module*
     assert(udt_type->symt.tag == SymTagUDT);
 
     TRACE_(dbghelp_symt)("Adding %s to UDT %s\n", name, udt_type->hash_elt.name);
-    p = NULL;
-    while ((p = vector_iter_up(&udt_type->vchildren, p)))
+    if (name)
     {
-        m = (struct symt_data*)*p;
-        assert(m);
-        assert(m->symt.tag == SymTagData);
-        if (m->hash_elt.name[0] == name[0] && strcmp(m->hash_elt.name, name) == 0)
-            return TRUE;
+        p = NULL;
+        while ((p = vector_iter_up(&udt_type->vchildren, p)))
+        {
+            m = (struct symt_data*)*p;
+            assert(m);
+            assert(m->symt.tag == SymTagData);
+            if (strcmp(m->hash_elt.name, name) == 0)
+                return TRUE;
+        }
     }
 
     if ((m = pool_alloc(&module->pool, sizeof(*m))) == NULL) return FALSE;
     memset(m, 0, sizeof(*m));
     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->kind            = DataIsMember;



More information about the wine-patches mailing list