diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2010-03-26 18:05:46 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2010-03-26 18:05:46 +0000 |
commit | 907af001f77f9dee04ecb77a6cb0d21a55850033 (patch) | |
tree | d242574077c972d14788da2aba69e75bd2def63c /gdb/dwarf2read.c | |
parent | dde2d684b0d148d26ad0c7ea8765dc051cbf9a5b (diff) | |
download | gdb-907af001f77f9dee04ecb77a6cb0d21a55850033.zip gdb-907af001f77f9dee04ecb77a6cb0d21a55850033.tar.gz gdb-907af001f77f9dee04ecb77a6cb0d21a55850033.tar.bz2 |
ChangeLog:
* dwarf2read.c (dwarf2_name): Work around GCC bugzilla debug/41828 by
ignoring spurious DW_AT_name attributes for unnamed structs or unions.
* completer.c (add_struct_fields): Fix inverted logic.
testsuite/ChangeLog:
* gdb.cp/inherit.exp (test_ptype_si): XFAIL test for GCC versions
that do not provide the tagless_struct type name at all.
(test_print_anon_union): Do not check value of uninitialized
union member. Do not use cp_test_ptype_class, so we can accept
"long" as well as "long int".
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4de0797..2987039 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9187,6 +9187,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) /* These tags always have simple identifiers already; no need to canonicalize them. */ return DW_STRING (attr); + case DW_TAG_subprogram: /* Java constructors will all be named "<init>", so return the class name when we see this special case. */ @@ -9214,17 +9215,33 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) } while (die->tag != DW_TAG_compile_unit); } - /* fall through */ + break; + + case DW_TAG_class_type: + case DW_TAG_interface_type: + case DW_TAG_structure_type: + case DW_TAG_union_type: + /* Some GCC versions emit spurious DW_AT_name attributes for unnamed + structures or unions. These were of the form "._%d" in GCC 4.1, + or simply "<anonymous struct>" or "<anonymous union>" in GCC 4.3 + and GCC 4.4. We work around this problem by ignoring these. */ + if (strncmp (DW_STRING (attr), "._", 2) == 0 + || strncmp (DW_STRING (attr), "<anonymous", 10) == 0) + return NULL; + break; + default: - if (!DW_STRING_IS_CANONICAL (attr)) - { - DW_STRING (attr) - = dwarf2_canonicalize_name (DW_STRING (attr), cu, - &cu->objfile->objfile_obstack); - DW_STRING_IS_CANONICAL (attr) = 1; - } - return DW_STRING (attr); + break; + } + + if (!DW_STRING_IS_CANONICAL (attr)) + { + DW_STRING (attr) + = dwarf2_canonicalize_name (DW_STRING (attr), cu, + &cu->objfile->objfile_obstack); + DW_STRING_IS_CANONICAL (attr) = 1; } + return DW_STRING (attr); } /* Return the die that this die in an extension of, or NULL if there |