[ENH] Conditional halt

Michael Rueger Michael.Rueger.-ND at disney.com
Tue Jul 20 00:23:43 UTC 1999


Hi all,

attached is a tiny goodie which allows to insert breakpoints (halts)
which only fire when the shift key is pressed.

Michael


-- 

 "To improve is to change, to be perfect is to change often." 
                                            Winston Churchill
+------------------------------------------------------------+
| Michael Rueger                                             |
| Phone: ++1 (818) 623 3283        Fax:   ++1 (818) 623 3559 |
+--------Michael.Rueger.-ND at online.disney.com----------------+
"      NAME     ConditionalHalt
       AUTHOR   m.rueger at acm.org (Michael Rueger)
       URL      (none)
       FUNCTION Insert conditional breakpoints 
       KEYWORDS debug halt breakpoint
       ST-VERSIONS      Squeak
       PREREQUISITES    (none)
       CONFLICTS        (none known)
       DISTRIBUTION     world
       VERSION  0.0.1
       DATE     20-Jul-99

SUMMARY

Adds the two methods debug and debug: to Object's protocol.
Both methods act as breakpoints (a.k.a. halt) but only while the shift key is pressed.


                                Michael Rueger
"!

'From Squeak 2.4c of May 10, 1999 on 19 July 1999 at 5:00:46 pm'!

!Object methodsFor: 'error handling' stamp: 'mir 7/19/1999 16:58'!
debug
	"This is the typical message to use for conditional inserting breakpoints during 
	debugging. It behaves like halt, but only invokes the debugger, if the shift key is pressed"

	InputSensor default shiftPressed
		ifFalse: [^self].
	Debugger
		openContext: thisContext
		label: 'Conditional halt encountered.'
		contents: thisContext shortStack

	"nil debug."! !

!Object methodsFor: 'error handling' stamp: 'mir 7/19/1999 16:58'!
debug: aString 
	"This is the typical message to use for inserting conditional breakpoints during 
	debugging. It creates and schedules a Notifier with the argument, 
	aString, as the label."

	InputSensor default shiftPressed
		ifFalse: [^self].
	Debugger
		openContext: thisContext
		label: aString
		contents: thisContext shortStack

	"nil debug: 'Test of halt:.'."! !





More information about the Squeak-dev mailing list