public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Sinbad <sinbad.sinbad@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: gdb user defined function
Date: Tue, 17 Jan 2012 06:10:00 -0000	[thread overview]
Message-ID: <CAOCFqOt9LA_FzGkYaeLciwHRjDZKnSLQxQ7mL40O1Yuh=cHk9Q@mail.gmail.com> (raw)
In-Reply-To: <m3vcobml3x.fsf@fleche.redhat.com>

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 ;)

thanks


On Tue, Jan 17, 2012 at 2:16 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Sinbad" == Sinbad  <sinbad.sinbad@gmail.com> 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

  reply	other threads:[~2012-01-17  6:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15  2:51 Sinbad
2012-01-16 20:46 ` Tom Tromey
2012-01-17  6:10   ` Sinbad [this message]
2012-01-17 16:29     ` Tom Tromey
2012-01-17 16:31       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOCFqOt9LA_FzGkYaeLciwHRjDZKnSLQxQ7mL40O1Yuh=cHk9Q@mail.gmail.com' \
    --to=sinbad.sinbad@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).