Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Yogesh Mundada <yogesh.mundada@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Some help required with gdb-python scripting
Date: Mon, 29 Mar 2010 15:12:00 -0000	[thread overview]
Message-ID: <m3y6hb40xq.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1957618c1003270459v78686a64wcfe050bd24ff5742@mail.gmail.com> 	(Yogesh Mundada's message of "Sat, 27 Mar 2010 07:59:45 -0400")

>>>>> "Yogesh" == Yogesh Mundada <yogesh.mundada@gmail.com> writes:

Yogesh> 1. Is there any way to disable this 'more' type editor feature after
Yogesh> every few lines?

"set pagination off"

Inside gdb you can use the _unfiltered functions to bypass the
pagination.  These aren't exposed to Python, however.

In your particular case, you could avoid the use of `call', and not get
things printed out.  You could either do this by writing a new command
instead of a convenience function, or by simply having your breakpoint
commands invoke the Python directly using the 'python' command.

Yogesh> 2. How can I examine value of eax register in the function
Yogesh> call_profiler()?  I tried - fr.read_var('%eax'),
Yogesh> fr.read_var('$eax') and fr.read_var('eax') - but all of them
Yogesh> give me an error saying that the variable not found.

Try gdb.parse_and_eval('$eax')

Yogesh> 3. Is there any way to stop execution and give control back to the
Yogesh> user if some condition is true?

No.  I want to say "not yet" but I am not sure about that.

Yogesh> 4. Is there any way to make this process completely automated without
Yogesh> me ever requiring to set breakpoints or put commands for breakpoints?

I am not sure.

Maybe you could try gdb.execute with an argument containing newlines.
I don't know if that will work or not.

If not, then I don't think there is a very good way at present.
You can make a temporary file and source it -- yuck.

The archer-tromey-python branch has some more direct support for
breakpoints.  Maybe you can set the commands directly there; I don't
remember offhand.  Phil is in the process of merging this upstream.

Tom


      reply	other threads:[~2010-03-29 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-27 11:59 Yogesh Mundada
2010-03-29 15:12 ` Tom Tromey [this message]

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=m3y6hb40xq.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=yogesh.mundada@gmail.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