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]

container_of equivalent in gdb-python script


Hi,

I'm currently getting my feet wet with gdb's great python extension. My
first exercise is to walk a linked list of objects in a C inferior
(namely 'modules' of the Linux kernel) and evaluate the elements. I'm at
the point where I would apply a standard container_of() macro in C:
convert the list entry into a gdb.Value that describes the containing
object.

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

I'm probably overseeing some obvious path in the python extension, any
pointers welcome!

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


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