This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: passing gdb.Value pointers to ctypes function calls
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Christoph Mathys <eraserix at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Tue, 12 Apr 2011 22:17:26 +0100
- Subject: Re: passing gdb.Value pointers to ctypes function calls
- References: <BANLkTimYpcNe63aXb7rabE-ziWaDrXN+kA@mail.gmail.com>
- Reply-to: pmuldoon at redhat dot com
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