This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: container_of equivalent in gdb-python script


>>>>> "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.

I don't think there's any particular problem with submitting this,
just somebody finding the time.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]