diff options
author | Tom de Vries <tdevries@suse.de> | 2024-10-08 12:27:20 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-10-08 12:27:20 +0200 |
commit | 42d385542f5f948e68db256b249662683057b288 (patch) | |
tree | 4f0afe17b4485ddd50da7a18ae1e77ce953d0529 /gdb/testsuite/gdb.dwarf2 | |
parent | e808bbbe37dda4a3ec5872ff990090cc746ad7ac (diff) | |
download | binutils-42d385542f5f948e68db256b249662683057b288.zip binutils-42d385542f5f948e68db256b249662683057b288.tar.gz binutils-42d385542f5f948e68db256b249662683057b288.tar.bz2 |
[gdb/symtab] Fix parent of enumerator
As mentioned in commit 489b82720f5 ('[gdb/symtab] Revert "Change handling of
DW_TAG_enumeration_type in DWARF scanner"'), when doing "maint print objfiles" in
test-case gdb.dwarf2/enum-type.exp, for val1 we get an entry without parent:
...
[27] ((cooked_index_entry *) 0x7fbbb4002ef0)
name: val1
canonical: val1
qualified: val1
DWARF tag: DW_TAG_enumerator
flags: 0x0 []
DIE offset: 0x124
parent: ((cooked_index_entry *) 0)
...
This happens here in cooked_indexer::index_dies:
...
info_ptr = recurse (reader, info_ptr,
is_enum_class ? this_entry : parent_entry,
fully);
...
when we're passing down a nullptr parent_entry, while the parent of this_entry
is deferred.
Fix this in cooked_indexer::index_dies by passing down a deffered parent
instead, such that we get:
...
[27] ((cooked_index_entry *) 0x7ff0e4002ef0)^M
name: val1^M
canonical: val1^M
qualified: ns::val1^M
DWARF tag: DW_TAG_enumerator^M
flags: 0x0 []^M
DIE offset: 0x124^M
parent: ((cooked_index_entry *) 0x7ff0e4002f20) [ns]^M
...
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2')
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/enum-type.exp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/enum-type.exp b/gdb/testsuite/gdb.dwarf2/enum-type.exp index b2b3dc6..ec12db5 100644 --- a/gdb/testsuite/gdb.dwarf2/enum-type.exp +++ b/gdb/testsuite/gdb.dwarf2/enum-type.exp @@ -114,3 +114,18 @@ gdb_test "ptype enum EU" "type = enum EU {TWO = 2}" \ gdb_test_no_output "set lang c++" gdb_test "ptype enum EU" "type = enum EU : unsigned int {TWO = 2}" \ "ptype EU in C++" + +gdb_test "p ns::val1" \ + " = ns::val1" + +require !readnow +require {string equal [have_index $binfile] ""} + +set re_ws "\[ \t\]" + +gdb_test_lines "maint print objfiles" \ + "val1 has a parent" \ + [multi_line \ + "" \ + "$re_ws+qualified:$re_ws+ns::val1" \ + ".*"] |