]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2003-01-07 David Carlton <carlton@math.stanford.edu>
authorDavid Carlton <carlton@bactrian.org>
Wed, 8 Jan 2003 00:32:10 +0000 (00:32 +0000)
committerDavid Carlton <carlton@bactrian.org>
Wed, 8 Jan 2003 00:32:10 +0000 (00:32 +0000)
* dwarf2read.c (add_partial_structure): New function.
(scan_partial_symbols): Call add_partial_structure.  New variable
info_ptr_updated.
* symtab.h (struct general_symbol_info): Make demangled_names
const char *.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/symtab.h

index 654bf4bfb04cf7278df2851f7282b4be17118771..a885af266dcfe7c1f190c1910f5f7a27fb8b89b7 100644 (file)
@@ -1,3 +1,11 @@
+2003-01-07  David Carlton  <carlton@math.stanford.edu>
+
+       * dwarf2read.c (add_partial_structure): New function.
+       (scan_partial_symbols): Call add_partial_structure.  New variable
+       info_ptr_updated.
+       * symtab.h (struct general_symbol_info): Make demangled_names
+       const char *.
+
 2003-01-06  David Carlton  <carlton@math.stanford.edu>
 
        * config/djgpp/fnchange.lst: Mention
index 8f26ac4a69dc6a756b206ec11955ad6bc2f1a7e5..0302563ce404325cf4ce3fc5c0d02b1fb9f46df8 100644 (file)
@@ -647,6 +647,12 @@ static char *add_partial_namespace (struct partial_die_info *pdi,
                                    const struct comp_unit_head *cu_header,
                                    const char *namespace);
 
+static char *add_partial_structure (struct partial_die_info *struct_pdi,
+                                   char *info_ptr,
+                                   struct objfile *objfile,
+                                   const struct comp_unit_head *cu_header,
+                                   const char *namespace);
+
 static char *add_partial_enumeration (struct partial_die_info *enum_pdi,
                                      char *info_ptr,
                                      struct objfile *objfile,
@@ -1304,6 +1310,10 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile,
 
   while (1)
     {
+      /* This flag tells whether or not info_ptr has gotten updated
+        inside the loop.  */
+      int info_ptr_updated = 0;
+
       info_ptr = read_partial_die (&pdi, abfd, info_ptr, cu_header);
 
       /* Anonymous namespaces have no name but have interesting
@@ -1334,12 +1344,20 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile,
              break;
            case DW_TAG_variable:
            case DW_TAG_typedef:
+             if (!pdi.is_declaration)
+               {
+                 add_partial_symbol (&pdi, objfile, cu_header, namespace);
+               }
+             break;
            case DW_TAG_class_type:
            case DW_TAG_structure_type:
            case DW_TAG_union_type:
              if (!pdi.is_declaration)
                {
-                 add_partial_symbol (&pdi, objfile, cu_header, namespace);
+                 info_ptr = add_partial_structure (&pdi, info_ptr,
+                                                   objfile, cu_header,
+                                                   namespace);
+                 info_ptr_updated = 1;
                }
              break;
            case DW_TAG_enumeration_type:
@@ -1348,6 +1366,7 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile,
                  info_ptr = add_partial_enumeration (&pdi, info_ptr,
                                                      objfile, cu_header,
                                                      namespace);
+                 info_ptr_updated = 1;
                }
              break;
            case DW_TAG_base_type:
@@ -1364,6 +1383,8 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile,
              info_ptr = add_partial_namespace (&pdi, info_ptr, objfile,
                                                lowpc, highpc, cu_header,
                                                namespace);
+             info_ptr_updated = 1;
+             break;
            default:
              break;
            }
@@ -1375,11 +1396,13 @@ scan_partial_symbols (char *info_ptr, struct objfile *objfile,
       /* If the die has a sibling, skip to the sibling, unless another
         function has already updated info_ptr for us.  */
 
-      if (pdi.tag != DW_TAG_enumeration_type
-         && pdi.tag != DW_TAG_namespace)
-       {
+      /* NOTE: carlton/2003-01-07: This is a bit hackish, but whether
+        or not we want to update this depends on enough stuff (not
+        only pdi.tag but also whether or not pdi.name is NULL) that
+        this seems like the easiest way to handle the issue.  */
+
+      if (!info_ptr_updated)
          info_ptr = locate_pdi_sibling (&pdi, info_ptr, abfd, cu_header);
-       }
     }
 
   return info_ptr;
@@ -1582,6 +1605,22 @@ add_partial_namespace (struct partial_die_info *pdi, char *info_ptr,
   return info_ptr;
 }
 
+/* Read a partial die corresponding to a non-enumeration compound data
+   structure type.  */
+
+static char *
+add_partial_structure (struct partial_die_info *struct_pdi, char *info_ptr,
+                      struct objfile *objfile,
+                      const struct comp_unit_head *cu_header,
+                      const char *namespace)
+{
+  bfd *abfd = objfile->obfd;
+
+  add_partial_symbol (struct_pdi, objfile, cu_header, namespace);
+
+  return locate_pdi_sibling (struct_pdi, info_ptr, abfd, cu_header);
+}
+
 /* Read a partial die corresponding to an enumeration type.  */
 
 static char *
index 99119ef2f3019b652dee2bfc6d1d6b26aeee8e43..11595cc82c2e0b91d1493eb605d33ec6d0692765 100644 (file)
@@ -90,12 +90,12 @@ struct general_symbol_info
     struct cplus_specific      /* For C++ */
       /*  and Java */
     {
-      char *demangled_name;
+      const char *demangled_name;
     }
     cplus_specific;
     struct objc_specific
     {
-      char *demangled_name;
+      const char *demangled_name;
     }
     objc_specific;
 #if 0