container_of equivalent in gdb-python script
Jan Kiszka
jan.kiszka@web.de
Wed Jun 10 21:06:00 GMT 2009
Tom Tromey wrote:
>>>>>> "Jan" == Jan Kiszka <jan.kiszka@web.de> writes:
>
> Jan> I meanwhile discovered (reading testcases and python-*.c)
> Jan> gdb.lookup_type() and Value.cast() to make this real. But you see, I
> Jan> still need an ugly synthetic Value object which must have a non-'None'
> Jan> address to do this calculation. Is there a cleaner, more generic way?
>
> Yeah, I think the missing piece is "gdb.parse_and_eval", which is on
> the archer python branch, but which we haven't pushed upstream into
> gdb CVS yet. This takes an expression (a string), parses it,
> evaluates it, and returns a Value. It is very convenient when
> implementing your own gdb commands.
Perfect, that solves the problem! Just checked out and tried successfully.
>
> I don't think there's any particular problem with submitting this,
> just somebody finding the time.
>
Hopefully before the next release. I would try to help, but I don't have
an FSF assignment.
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/gdb/attachments/20090610/9bae7a76/attachment.sig>
More information about the Gdb
mailing list