passing gdb.Value pointers to ctypes function calls

Christoph Mathys
Wed Apr 13 07:22:00 GMT 2011

On Tue, Apr 12, 2011 at 11:17 PM, Phil Muldoon <> wrote:
> Christoph Mathys <> writes:
>> 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?

I don't mind filing a bug report, but I'm not sure what else gdb
should do considering what I'm doing: Accessing possibly invalid
memory inside gdb itself. The code below is what I think happens in my
script. The difference is that I have a more complicated way of
getting the wrong pointer and call a different C function.

This is in
from ctypes import *

ptr = c_void_p(1)
libc = CDLL('')
libc.printf('%s\n', ptr)

Fire up gdb and do: python execfile(''). For me, this crashes
gdb, but this is somewhat expected.

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

It was suggested that what I'm trying to do can't work. gdb lives in
another address space than my inferior, so pointers from my inferior
don't make sense to a library loaded into gdbs address space.


More information about the Gdb mailing list