Type-lookup by name for type in namespace fails with -fdebug-types-section after 93b8bea

Sterling Augustine via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAEG7qUyJaasvS+oWiM-xoHA5jG7SLE4TqDzKWnHN=ciV_jDxJw@mail.gmail.com>
Hi Tom,

We have found a strange error with -fdebug-types-section, and as best I can
tell, your commit 93b8bea4143cafae79076076c64aaa4c46a9b73c is the culprit,
although I don't understand how or why.

In any event, before this change, the test-case below works fine, and after
it, lookup of a type in a namespace by name fails. In particular, "ptype
hide::Bar" should find the type. But it fails both inside python with
gdb.lookup_type and with normal commands.

Any idea what is happening? Reproducer follows.

$ g++ -v
...
gcc version 9.2.1 20191102 (Debian 9.2.1-17)
$ cat b.cpp
namespace hide { struct Bar {  int y; }; }
struct Foo {  hide::Bar* b; };

inline void x() { hide::Bar b; }

static Foo aFoo;

void * f() {
  return aFoo.b;
}

int main() {
  f();
  return 0;
}
$ g++ -fdebug-types-section b.cpp -g
$ ./build/gdb/gdb -ex "b f" -ex run -ex "ptype hide::Bar" ./a.out
...
GNU gdb (GDB) 8.2.50.20180720-git
...
Reading symbols from ./a.out...done.
Breakpoint 1 at 0x1129: file b.cpp, line 11.
Starting program: /usr/local/google/home/saugustine/gdb/a.out

Breakpoint 1, Python Exception <type 'exceptions.NameError'> Installation
error: gdb.execute_unwinders function is missing:
f () at b.cpp:11
11  return aFoo.b;
No symbol "Bar" in namespace "hide".
(gdb)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.