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

Sterling Augustine saugustine@google.com
Mon Mar 16 17:18:35 GMT 2020


[Updating Tom Tromey's address.]

On Mon, Mar 16, 2020 at 10:16 AM Sterling Augustine <saugustine@google.com>
wrote:

> 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)
>



More information about the Gdb mailing list