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.