[Bug python/27510] Document gdb.Type string representations

jwakely.gcc at gmail dot com sourceware-bugzilla@sourceware.org
Thu Mar 4 14:28:00 GMT 2021


https://sourceware.org/bugzilla/show_bug.cgi?id=27510

--- Comment #2 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
But to make things more complicated ...

echo 'struct S { } s;' > test.C
g++ -g -c test.C -o test1.o
echo 'int main() { }' >> test.C
g++ -g -c test.C -o test2.o

gdb -q -ex 'py print(gdb.lookup_type("S"))' -ex q test1.o
Reading symbols from test1.o...
struct S

gdb -q -ex 'py print(gdb.lookup_type("S"))' -ex q test2.o
Reading symbols from test2.o...
S

WAT?

Whether str(gdb.Type) includes the "struct" class-head depends on whether
main() is defined in the same translation unit? How does that make sense?

It is at least consistent with 'whatis':

gdb -q -ex 'whatis s' -ex q test1.o
Reading symbols from test1.o...
type = struct S

gdb -q -ex 'whatis s' -ex q test2.o
Reading symbols from test2.o...
type = S

But ... why?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list