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


On Tue, Apr 12, 2011 at 11:17 PM, Phil Muldoon <pmuldoon@redhat.com> wrote:
> Christoph Mathys <eraserix@gmail.com> 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 crash.py:
from ctypes import *

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

Fire up gdb and do: python execfile('crash.py'). 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.

Christoph


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