[Python-Dev] playback debugging

Jack Diederich jack@performancedrivers.com
Wed, 8 Jan 2003 16:26:10 -0500


Would it be possible to save every function return/stack in a running
python program and then playback the results in a debugger?
The article linked from /. 
http://web.media.mit.edu/~lieber/Lieberary/Softviz/CACM-Debugging/CACM-Debugging-Intro.html#Intro

mentions that a lisp interpreter (Lisp stepper ZStep 95) did something
like this that then let you replay a program from the end back to the
beginning.

The idea would be that every function return replays the orignal return
even if the outcome is different.  core operations that call out to
C wouldn't actually make the call, so random() would always return the
same value that it orignally did at that spot.  Ditto for file.read().  
The pure python code would almost by definition do excatly the same thing,
b/c the inputs would always be identical.  If this isn't always possible a 
warning could be issued and the orignal value be returned regardless.

This would require work on the interpreter and the debugger,
but does anyone see a reason why this is technically impossible?

Async IO programs would be SOL.  And large or long running programs
would be infeasable.  I run everything under mod_python which essentially
means a series of very short one-off programs.  This would be a huge
win IMO.  I currently save the input parameters and can re-run them
outside of apache.  This is non-ideal as some server side state is lost,
but works most of the time.  A large number of python programs would
reap a huge reward from this, but please correct me if I'm missing
the obvious.

-jackdied

There is a fine line between being "The Man" and being "That Guy"