Summary: | Document gdb.Type string representations | ||
---|---|---|---|
Product: | gdb | Reporter: | Jonathan Wakely <jwakely.gcc> |
Component: | python | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | hi-angel, ssbssa |
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | Patch for python.texi |
Description
Jonathan Wakely
2021-03-04 13:00:16 UTC
Created attachment 13283 [details]
Patch for python.texi
I think this addresses all my comments above, assuming I've understood the semantics correctly.
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? (In reply to Jonathan Wakely from comment #2) > 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? This behavior started with gdb-8.2, with 8.1.1 it says just 'S' for both. |