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: passing gdb.Value pointers to ctypes function calls


Christoph Mathys <eraserix@gmail.com> writes:

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

If GDB ever crashes it is a bug.  Can you file a bug for this?  


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

It should, but without more concrete information it is difficult to
diagnose the issue.  I am concerned about the GDB crash though, that
should be fixed.

Cheers,

Phil


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