[wingide-users] Breakpoints with actions and auto-continue

Luc Bourhis luc_j_bourhis at mac.com
Mon Feb 8 14:54:28 MST 2010


> On 27 Jul 2007, at 17:12, Wingware Support wrote:
> 
>> Luc Bourhis wrote:
>>> the debate about the merits of logging and debuggers reminded me of two features I would love to see in Wing:
>>> (a) the ability to associate Python code with a breakpoint, the code being executed when the breakpoint is hit;
>>> (b) the possibility that the debugger does not stop after executing that code.

>>> Combined with the available conditional breakpoints, (a) and (b) are equivalent to inserting in the code
>>> 
>>> if (condition):
>>> 	do something
>>> 
>>> and that is the most general logging. But instead of cluttering the production code with such logging code which has to be removed/deactivated/you name it, it all stays at the breakpoint level and I find that very nice. I am using it all the time in XCode, the Apple IDE.
>> 
>> This is an interesting idea and I think you can already do it by specifying an expression for a conditional BP that always returns False and does whatever logging (or something else) that you want.
>> 
>> One potential problem is conditional BP tests are limited to expressions, though you could probably get creative.
> 
> True enough but that is a bit of a hackish creativeness here!
> 
>> It might also be possible to accept multiple lines in the BP test as long as there's a return statement.  It would be turned into a function with readonly access to variables available to the code if a return statement was present.
> 
> That would indeed already be useful. Note however that you have only address my point (a). My point (b) would need more changes, probably.

Resurrecting a rather old message. I would really love to see such features in Wing. 

To give a bit of context, I often need to debug some complex numerical algorithms where several imbricated loops are run hundreds of times. Setting a watchpoint, with an associated action pretty-printing some data conditionally at key point is invaluable. The classic Python pattern

if 1:
	if condition:
		do_something

works fine except that it is all too easy to forget to put back "if 0" before committing to the repository. I find it much easier to keep that debugging code outside of my production code, basically segregating it inside the development environment.

Luc Bourhis



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3681 bytes
Desc: not available
Url : /pipermail/wingide-users/attachments/20100208/0fe322f1/smime.bin


More information about the wingide-users mailing list