aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-07-20 15:13:49 +0000
committerTom Tromey <tromey@redhat.com>2011-07-20 15:13:49 +0000
commit6c83ed5236196bc958718f86d547551f25592659 (patch)
treebdb4cc06944139cb5b45d907e03d0d32555be813 /gdb
parent PR symtab/12984: (diff)
downloadbinutils-gdb-6c83ed5236196bc958718f86d547551f25592659.tar.gz
binutils-gdb-6c83ed5236196bc958718f86d547551f25592659.tar.bz2
binutils-gdb-6c83ed5236196bc958718f86d547551f25592659.zip
* dwarf2read.c (process_enumeration_scope): Do not call new_symbol
in some declaration-only cases.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2read.c26
2 files changed, 31 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ca053d27f4f..aa5bdf10c5d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2011-07-20 Tom Tromey <tromey@redhat.com>
+ * dwarf2read.c (process_enumeration_scope): Do not call new_symbol
+ in some declaration-only cases.
+
+2011-07-18 Tom Tromey <tromey@redhat.com>
+
PR symtab/12984:
* dwarf2read.c (dwarf2_section_info_def): New typedef.
(struct dwarf2_per_objfile) <types>: Change to a VEC.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a373b09c62b..64325cbc2f5 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1207,6 +1207,11 @@ static struct die_info *follow_die_sig (struct die_info *,
struct attribute *,
struct dwarf2_cu **);
+static struct signatured_type *lookup_signatured_type_at_offset
+ (struct objfile *objfile,
+ struct dwarf2_section_info *section,
+ unsigned int offset);
+
static void read_signatured_type_at_offset (struct objfile *objfile,
struct dwarf2_section_info *sect,
unsigned int offset);
@@ -7730,6 +7735,27 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
TYPE_UNSIGNED (this_type) = 1;
}
+ /* If we are reading an enum from a .debug_types unit, and the enum
+ is a declaration, and the enum is not the signatured type in the
+ unit, then we do not want to add a symbol for it. Adding a
+ symbol would in some cases obscure the true definition of the
+ enum, giving users an incomplete type when the definition is
+ actually available. Note that we do not want to do this for all
+ enums which are just declarations, because C++0x allows forward
+ enum declarations. */
+ if (cu->per_cu->debug_type_section
+ && die_is_declaration (die, cu))
+ {
+ struct signatured_type *type_sig;
+
+ type_sig
+ = lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile,
+ cu->per_cu->debug_type_section,
+ cu->per_cu->offset);
+ if (type_sig->type_offset != die->offset)
+ return;
+ }
+
new_symbol (die, this_type, cu);
}