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@siemens.com> writes:

Jan> I'm at the point where I would apply a standard container_of()
Jan> macro in C: convert the list entry into a gdb.Value that
Jan> describes the containing object.

Jan> Of course, I can implement container_of as a gdb expression, print the
Jan> result and drag it in via gdb.history(). Done that already, basically
Jan> works. But it is fairly ugly as the print output will flood the screen.

I would say that the usual approach would be to reimplement the macro
in Python.  The Python Value API is reasonably robust and can usually
be used for this.  If you post the macro definition maybe I could help
with that.  More details wouldn't hurt, either... are you writing a
pretty-printer?  A new command?  A convenience function?

Tom


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