Mainly Tech projects on Python and Electronic Design Automation.

Thursday, December 04, 2008

Debugging vs inserting print statements

After reading this blog entry from Corey Goldberg, you got some people saying use debuggers instead of print statements.

So why can't you put that same print statement in the debugger and have it show up as an inserted print statement in the source? Why can't you do that for any code to insert? Rather than a breakpoint appearing as a blob to the side, you should have the option of it appearing as inserted code, maybe made visually distinct via shading and containing the logic inherent in the breakpoint such as coded indication that it counts down and only fires on the 20'th pass and then executes this code without pausing the run (or not).

A debugger breakpoint that doesn't stop the simulation but prints some text and the value of a few variables could then look like the insertion of a print statement in your source.

If you could make the interface work the other-way round too, i.e. stick the IDE into Add Debug Text mode, then code added would automagically be turned into equivalent statements executed by the debugger, then you could really fight those pesky inserters of print statements for debugging purposes by giving them a debugger whose interface works that way anyway ;-)


1 comment:

  1. Python 2.5 added the 'commands' command to pdb. This lets you set actions to be performed when hitting a breakpoint, which can include printing a message and continuing.

    I don't know of any IDEs that support it, but then I never use IDEs for debugging.



Subscribe Now: google

Add to Google Reader or Homepage

Go deh too!

Blog Archive