gdb, dwarf: Don't follow the parent of a subprogram to get a prefix.
During prefix resolution, if the parent is a subprogram, there is no need
to go to the parent of the subprogram. The DIE will be local.
For a program like:
~~~
class F1
{
public:
int a;
int
vvv ()
{
class F2
{
int f;
};
F2 abcd;
return 1;
}
};
~~~
The class F2 should not be seen as a member of F1.
Before:
~~~
(gdb) ptype abcd
type = class F1::F2 {
private:
int f;
}
~~~
After:
~~~
(gdb) ptype abcd
type = class F2 {
private:
int f;
}
~~~
gdb/ChangeLog:
2021-06-23 Felix Willgerodt <felix.willgerodt@intel.com>
* dwarf2/read.c (determine_prefix): Return an empty prefix if the
parent is a subprogram.
gdb/testsuite/ChangeLog:
2021-06-23 Felix Willgerodt <felix.willgerodt@intel.com>
* gdb.cp/nested-class-func-class.cc: New file.
* gdb.cp/nested-class-func-class.exp: New file.