* Python debugging in gdb
[not found] <CA++fsGETsLexTGaaV3skfKi4znnsWBqYo-h4sothrkuREFnCxw@mail.gmail.com>
@ 2012-09-10 9:50 ` Dov Grobgeld
2012-09-10 15:05 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Dov Grobgeld @ 2012-09-10 9:50 UTC (permalink / raw)
To: gdb
I would like to write some glue functions that allow debugging python
code within gdb. We have an embedded environment that in the call
stack calls back and forth between C++ and python multiple times. It
would be great if it was possible to debug this system in a single
environment.
To do this, I would like to define the following gdb commands:
py-break : Create a break point at line in a python file.
py-step: Step the next python statement.
py-next : Run the next python statement.
py-finish: Finish the current python function.
In a way this would create a relationship between python and C similar
to the current difference between step and stepi, where the former
steps in the compiled language and the latter in assembler language.
So for python I would like to have one higher abstraction layer.
(It would make sense to create a dispatcher that does `py-break` on a
python file and `break` on a C++ file so you can always use the same
command to create break points.)
Is this feasible? Can someone give me some ideas and pointers of how
to go about implementing this?
Regards,
Dov
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Python debugging in gdb
2012-09-10 9:50 ` Python debugging in gdb Dov Grobgeld
@ 2012-09-10 15:05 ` Tom Tromey
2012-09-10 15:09 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2012-09-10 15:05 UTC (permalink / raw)
To: Dov Grobgeld; +Cc: gdb
>>>>> "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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Python debugging in gdb
2012-09-10 15:05 ` Tom Tromey
@ 2012-09-10 15:09 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2012-09-10 15:09 UTC (permalink / raw)
To: Tom Tromey; +Cc: Dov Grobgeld, gdb
> 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.
Wouldn't the "pdb" module already be doing what Dov is trying to do?
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-10 15:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CA++fsGETsLexTGaaV3skfKi4znnsWBqYo-h4sothrkuREFnCxw@mail.gmail.com>
2012-09-10 9:50 ` Python debugging in gdb Dov Grobgeld
2012-09-10 15:05 ` Tom Tromey
2012-09-10 15:09 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox