Created attachment 15758 [details] patch adding test-case gdb.dwarf2/dwz-2.exp I rebased this patch series ( https://sourceware.org/pipermail/gdb-patches/2023-December/205054.html ) on top of trunk, and was left with two patches, variants of: - [gdb/symtab] Recurse into c++ DW_TAG_subprogram DIEs for cooked index - [gdb/symtab] Keep track of all parents for cooked index Since the first one is in question (see PR30728), I tried to write a test-case for the second one that does not involve DW_TAG_inlined_subroutine. I managed to write a test-case, see attached patch. With gdb trunk, we get either: ... $ gdb -q -batch outputs/gdb.dwarf2/dwz-2/dwz-2 \ -ex "set lang c++" \ -ex "print ns::foo" \ -ex "print ns::bar" No symbol "foo" in namespace "ns". $1 = {int (void)} 0x4101b4 <ns::bar()> ... or: ... $ gdb -q -batch outputs/gdb.dwarf2/dwz-2/dwz-2 \ -ex "set lang c++" \ -ex "print ns::foo" \ -ex "print ns::bar" $1 = {int (void)} 0x4101ac <ns::foo()> No symbol "bar" in namespace "ns". ... With readnow: ... $ gdb -readnow -q -batch outputs/gdb.dwarf2/dwz-2/dwz-2 \ -ex "set lang c++" \ -ex "print ns::foo" \ -ex "print ns::bar" $1 = {int (void)} 0x4101ac <ns::foo()> $2 = {int (void)} 0x4101b4 <ns::bar()> ... Also, without the "set lang c++": ... $ gdb -q -batch dwz-2 -ex "print ns::foo" -ex "print ns::bar" $1 = {int (void)} 0x4101ac <ns::foo()> $2 = {int (void)} 0x4101b4 <ns::bar()> ... which is necessary because the dwarf assembly does not mention main and it's language. The original series does not seem to fix this either.
https://sourceware.org/pipermail/gdb-patches/2024-October/212593.html