aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/abbrev.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-10-08 12:27:20 +0200
committerTom de Vries <tdevries@suse.de>2024-10-08 12:27:20 +0200
commit5ad960fcdb6732c805d2a235efc8a40df644e03e (patch)
tree068e495ad0cd75a2fd9740e5460d0d283ce10d93 /gdb/dwarf2/abbrev.c
parent42d385542f5f948e68db256b249662683057b288 (diff)
downloadgdb-5ad960fcdb6732c805d2a235efc8a40df644e03e.zip
gdb-5ad960fcdb6732c805d2a235efc8a40df644e03e.tar.gz
gdb-5ad960fcdb6732c805d2a235efc8a40df644e03e.tar.bz2
[gdb/symtab] Fix gdb.dwarf2/enum-type-c++.exp with cc-with-debug-types
When running test-case gdb.dwarf2/enum-type-c++.exp with target board cc-with-debug-types, we run into: ... (gdb) FAIL: gdb.dwarf2/enum-type-c++.exp: val1 has a parent ... because val1 has no parent: ... [31] ((cooked_index_entry *) 0x7efedc002e90) name: val1 canonical: val1 qualified: val1 DWARF tag: DW_TAG_enumerator flags: 0x0 [] DIE offset: 0xef parent: ((cooked_index_entry *) 0) ... [37] ((cooked_index_entry *) 0x38ffd280) name: val1 canonical: val1 qualified: val1 DWARF tag: DW_TAG_enumerator flags: 0x0 [] DIE offset: 0xef parent: ((cooked_index_entry *) 0) ... There are two entries, which seems to be an inefficiency, but for now let's focus on the correctness issue. The debug info for val1 looks like this: ... <1><cb>: Abbrev Number: 2 (DW_TAG_namespace) <cc> DW_AT_name : ns <cf> DW_AT_declaration : 1 <2><d3>: Abbrev Number: 12 (DW_TAG_class_type) <d4> DW_AT_name : A <d6> DW_AT_declaration : 1 <3><d6>: Abbrev Number: 13 (DW_TAG_enumeration_type) <db> DW_AT_declaration : 1 <1><dd>: Abbrev Number: 14 (DW_TAG_enumeration_type) <e7> DW_AT_specification: <0xd6> <2><ef>: Abbrev Number: 5 (DW_TAG_enumerator) <f0> DW_AT_name : val1 <f4> DW_AT_const_value : 1 ... Fix this by: - adding a cooked index entry for DIE 0xcb (and consequently for child DIE 0xd3), by marking it interesting, - making sure that the entry for DIE 0xcb has a name, and - using the entry for DIE 0xd3 as parent entry for DIE 0xdd. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/dwarf2/abbrev.c')
-rw-r--r--gdb/dwarf2/abbrev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c
index bae8d8b..c30db1e 100644
--- a/gdb/dwarf2/abbrev.c
+++ b/gdb/dwarf2/abbrev.c
@@ -276,7 +276,8 @@ abbrev_table::read (struct dwarf2_section_info *section,
}
else if ((cur_abbrev->tag == DW_TAG_structure_type
|| cur_abbrev->tag == DW_TAG_class_type
- || cur_abbrev->tag == DW_TAG_union_type)
+ || cur_abbrev->tag == DW_TAG_union_type
+ || cur_abbrev->tag == DW_TAG_namespace)
&& cur_abbrev->has_children)
{
/* We have to record this as interesting, regardless of how