Using rr for python code/cpython interpreter?

Dima Kogan dima at
Fri Feb 1 17:06:07 UTC 2019

Robert O'Callahan <robert at> writes:

> The gdb python helper scripts should work under rr but as far as I
> know you can't do that with them. I don't know of any other Python
> debugging support that uses rr.

Right. The "normal" python debugging commands do things like py-bt,
py-locals, py-up, py-down. If you want something like "py-next" or
"py-rnext" or "py-finish", you'd need to place a breakpoint in the
python function-calling machinery. If you want a breakpoint on a
particular python line number, you'd need to make a gdb breakpoint with
a condition that looks at the line number.

I have a prototype implementation for python2.7 for things like
py-next,py-step,py-finish,py-rnext,py-rstep,py-rfinish and so on.
Clearly, the py-r... commands need rr. It works for me, but is somewhat
hoaky and unfinished, so I haven't yet released it. If you want to try
it or help improve it, let me know, and I'll point you to the
implementation. It's rough, so I'd rather not fully release it just yet.

More information about the rr-dev mailing list