sidkshatriya 3 days ago

rr has always worked with Python in the sense that it can record and replay Python programs.

However, when you try to debug the program you can only debug the C code the Python interpreter is written in.

I suppose you want to be able to debug the Python code itself. Here is something that could do this https://pypy.org/posts/2016/07/reverse-debugging-for-python-... . I don't think the project is active nowadays though. Also I haven't used it so can't say whether it is good or not.

It should be possible to built a Python reverse debugger on top of rr. I know this should be possible because I built something for PHP https://github.com/sidkshatriya/dontbug .

There are other fancy (and possibly better) things that are possible -- instead of building a Python debugger atop rr you can record the full trace of the Python program and then for e.g. store the values of important variables at each executed line of the Python program in a database. This would again use rr as the record/replay substrate but with a slightly different approach. This is an area which I've done some work internally but nothing public released yet :-) !

1
senkora 3 days ago

Do the gdb commands for printing information about python frames work with rr? E.g. py-bt, py-print, py-locals?

sidkshatriya 3 days ago

Any gdb integration scripts for Python to get stack frames etc. should work fine in rr and Software Counters Mode rr.

`rr replay` and (the software counters equivalent) `rr replay -W` invokes gdb.