gdb user defined function

Tue Jan 17 06:10:00 GMT 2012

hi tom,

i've never used python with gdb or python at all. but i want to learn
enough of python to achieve the following. how do one use python
with gdb, will gdb become slow, can you give me some pointers
on how to achieve the following using python.

Please don't yell ;)


On Tue, Jan 17, 2012 at 2:16 AM, Tom Tromey <> wrote:
>>>>>> "Sinbad" == Sinbad  <> writes:
> Sinbad> i am trying to write a user-defined function in gdb.
> Sinbad> while analyzing the core is it possible to see if a
> Sinbad> pointer variable is accessible or not inside a gdb
> Sinbad> user-defined function. for example.
> Sinbad> (gdb) p *ptr
> Sinbad> cannot access memory at address 0x35336
> Sinbad> is there any way to find this inside a gdb function.
> Sinbad> i need something as follows
> Sinbad> define sub
> Sinbad>    is_accessible(ptr)
> Sinbad> end
> I can't think of an easy way to do this from the gdb CLI, but you can do
> it from Python by catching the exception.
> You could straightforwardly write a $is_valid function that examines a
> pointer for validity.
> Tom

More information about the Gdb mailing list