aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2018-03-22 16:49:48 -0700
committerKeith Seitz <keiths@redhat.com>2018-03-23 11:58:32 -0700
commitb7fee5a3268c340975a1dddb131733abfd153d5e (patch)
treee395d189a6f96df9dbd1b7148ab303c7d6b4eece /gdb/dwarf2read.c
parent291158a341260e97125db5638cd47c1e9aea5e8f (diff)
downloadgdb-b7fee5a3268c340975a1dddb131733abfd153d5e.zip
gdb-b7fee5a3268c340975a1dddb131733abfd153d5e.tar.gz
gdb-b7fee5a3268c340975a1dddb131733abfd153d5e.tar.bz2
Add psymbols for nested types
c++/22968 involves the inability of ptype to find a type definition for a type defined inside another type. I recently added some additional support for nested type definitions, but I apparently overlooked psymbols. The user reports that using -readnow fixes the problem: $ gdb 22968 -ex "ptype Outer::Inner" There is no field named Inner $ gdb -readnow 22968 -ex "ptype Outer::Inner" type = struct Outer::Inner { <no data field> } We clearly did not find a psymbol for Outer::Inner because it was located in another CU. This patch addresses this problem by scanning structs for additional psymbols. Rust is already doing this. With this patch, the identical result to "-readnow" is given (without using `-readnow', of course). gdb/ChangeLog: PR c++/22968 * dwarf2read.c (scan_partial_symbols): Scan structs/classes for nested type definitions for C++, too. gdb/testsuite/ChangeLog: PR c++/22968 * gdb.cp/subtypes.exp: New file. * gdb.cp/subtypes.h: New file. * gdb.cp/subtypes.cc: New file. * gdb.cp/subtypes-2.cc: New file.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6100438..93ecf40 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9116,7 +9116,8 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
{
add_partial_symbol (pdi, cu);
}
- if (cu->language == language_rust && pdi->has_children)
+ if ((cu->language == language_rust
+ || cu->language == language_cplus) && pdi->has_children)
scan_partial_symbols (pdi->die_child, lowpc, highpc,
set_addrmap, cu);
break;