Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are debug consoles implemented in Python?

I've seen a couple of Python IDE's (e.g. PyDev Extensions, WingIDE) that provide a debug console - an interactive terminal that runs in the context of the method where the breakpoint is. This lets you print members, call other methods and see the results, and redefine methods to try to fix bugs. Cool.

Can anyone tell me how this is implemented? I know there's the Code module, which provides an InteractiveConsole class, but I don't know how this can be run in the context of currently loaded code. I'm quite new to Python, so gentle assistance would be appreciated!

like image 416
TarkaDaal Avatar asked Jan 14 '09 20:01

TarkaDaal


1 Answers

You could try looking at the python debugger pdb. It's like gdb in how you use it, but implemented in pure python. Have a look for pdb.py in your python install directory.

like image 121
John Fouhy Avatar answered Oct 04 '22 03:10

John Fouhy