passing gdb.Value pointers to ctypes function calls

Christoph Mathys eraserix@gmail.com
Tue Apr 12 09:44:00 GMT 2011


Hello!

I'm trying to write a pretty printer for gdb 7.2 using python, to be
concrete I would like to print an Xml node (libxml2) as text. I've
managed to get the pointers to node and document. Now I'm trying to
call libxml using ctypes module, passing the pointer values as
c_void_p. But gdb keeps crashing on me. Is this supposed to work at
all? I allocate some buffer, pass it to libxml functions along with
some addresses I obtain from the debugged process using gdb, and as a
result I expect the string representation of the node in the buffer.

For converting between gdb.Value and ctypes usable stuff I use something like:
ptr = int(str(gdbValNode), 16)
c_void_p(ptr)

I'm attached to the running process. But as far as I understand, this
should work on the running process as well as the core file.

Thanks for insight!
Christoph



More information about the Gdb mailing list