diff options
author | David Carlton <carlton@bactrian.org> | 2003-01-08 00:32:10 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2003-01-08 00:32:10 +0000 |
commit | 2d67b8354fd8dec10bfc59464865a5d13ad95788 (patch) | |
tree | a0cd734fb26c25228e4bf4704b90755efe771947 /gdb | |
parent | 57852209eee94fadacb1e68710446540bbea4780 (diff) | |
download | gdb-2d67b8354fd8dec10bfc59464865a5d13ad95788.zip gdb-2d67b8354fd8dec10bfc59464865a5d13ad95788.tar.gz gdb-2d67b8354fd8dec10bfc59464865a5d13ad95788.tar.bz2 |
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 *.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 49 | ||||
-rw-r--r-- | gdb/symtab.h | 4 |
3 files changed, 54 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 654bf4b..a885af2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 8f26ac4..0302563 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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 * diff --git a/gdb/symtab.h b/gdb/symtab.h index 99119ef..11595cc 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -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 |