Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Dov Grobgeld <dov.grobgeld@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Python debugging in gdb
Date: Mon, 10 Sep 2012 15:05:00 -0000	[thread overview]
Message-ID: <87mx0xex6e.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CA++fsGFHEkO+qDTN6Q7c0uBxLOS9w2X+SYYuPfyLDuyEG-D75g@mail.gmail.com>	(Dov Grobgeld's message of "Mon, 10 Sep 2012 12:50:09 +0300")

>>>>> "Dov" == Dov Grobgeld <dov.grobgeld@gmail.com> writes:

Dov> To do this, I would like to define the following gdb commands:

Dov> py-break : Create a break point at line in a python file.
Dov> py-step:  Step the next python statement.
Dov> py-next : Run the next python statement.
Dov> py-finish: Finish the current python function.

Dov> (It would make sense to create a dispatcher that does `py-break` on a
Dov> python file and `break` on a C++ file so you can always use the same
Dov> command to create break points.)

Eventually I'd like to be able to extend the plain gdb commands like
"break" this way.

Dov> Is this feasible? Can someone give me some ideas and pointers of how
Dov> to go about implementing this?

It is definitely feasible.  There may still be some ugly parts; if so
please file bug reports, since this is something we would like to work
nicely.

I don't know exactly how you would implement each command -- a lot
depends on the details of the Python interpreter.

In general though I think each of the above commands would be written in
Python and would use gdb's Python Breakpoint API to set low-level
breakpoints at the appropriate points in the Python interpreter.  I
think much of the logic would be in the breakpoint's 'stop' method.  For
example, for py-next you would want to stop at a specific source line,
but only in the current frame, so the stop method would have to compare
frames.

Tom


  reply	other threads:[~2012-09-10 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA++fsGETsLexTGaaV3skfKi4znnsWBqYo-h4sothrkuREFnCxw@mail.gmail.com>
2012-09-10  9:50 ` Dov Grobgeld
2012-09-10 15:05   ` Tom Tromey [this message]
2012-09-10 15:09     ` Joel Brobecker

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=87mx0xex6e.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=dov.grobgeld@gmail.com \
    --cc=gdb@sourceware.org \
    /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