Awesome Conferences

See us live(rss)   

Introducing the Python Time Travel Debugger

Today I'm open sourcing a productivity tool that I've been very excited about: A time-travel extension to the Python Debugger (PDB).

Have you ever been using PDB to step through a program and suddenly realize you wish you could jump back in time and know what a variable used to contain?

This version of PDB adds the ability to jump back in time to the state of your program as it was in the past. You can examine variables and even continue execution from that point forward (though that is dangerous because it may harm the time space continuum.)

How it works:

As you know, time is the 4th dimension. Every moment is another universe. Pretty trippy, eh?

TTPDB simply records a pointer to the current universe before displaying the input prompt. As you step through your program, each step records a pointer to the past universes. The last 100 pointers are remembered. You can jump into any of those universes. Once in those universes you can examine variables. Heck you can do anything you want because you are really in that universe.

Once you are done with that universe you can "pop up" back to the universe you left thanks to our time portal technology.

I've released the source code. You can find it on Github:

https://github.com/TomOnTime/timetravelpdb


Enjoy!

--Tom Limoncelli

Posted by Tom Limoncelli in Python

No TrackBacks

TrackBack URL: http://everythingsysadmin.com/cgi-bin/mt-tb.cgi/1737

2 Comments | Leave a comment

This is awesome. I can't wait to have something similar in the Perl debugger!


:-)

Hey, this is actually pretty cool! Totally planning on messing with this more later.

I'm just gonna leave this here though, for anyone else who might need it ...

kill -SIGQUIT `ps -ef | grep "python2 -m timetravelpdb" | awk '{print $2}'`

(Thanks to http://oracleflash.com/20/How-to-kill-all-processes-with-one-command-in-Linux.html )

(Be a bit careful with that command by the way.)

Leave a comment