container_of equivalent in gdb-python script
Tom Tromey
tromey@redhat.com
Wed Jun 10 21:42:00 GMT 2009
>>>>> "Jan" == Jan Kiszka <jan.kiszka@web.de> writes:
Daniel> It's typical to do this the same way folks do in C: Create a null
Daniel> pointer of the right type.
Jan> You can't do that with the current upstream python interface, but the
Jan> parse_and_eval solves this nicely.
Actually, for constants you can:
(gdb) python print gdb.Value(0)
0
(gdb) python print type(gdb.Value(0))
<type 'gdb.Value'>
(gdb) python print gdb.Value(0).cast(gdb.lookup_type('char').pointer())
0x0
Whoops, this seems to be undocumented.
Tom
More information about the Gdb
mailing list