*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 18 Aug 2000 22:23:06 +0200
changeset 950 36a030c8f949
parent 949 ee012345f8be
child 951 971345596471
*** empty log message ***
MessageTracer.st
--- a/MessageTracer.st	Thu Aug 17 11:56:10 2000 +0200
+++ b/MessageTracer.st	Fri Aug 18 22:23:06 2000 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libbasic3' }"
+
 Object subclass:#MessageTracer
 	instanceVariableNames:'traceDetail tracedBlock'
 	classVariableNames:'BreakpointSignal CallingLevel BreakBlock TraceSenderBlock
@@ -637,6 +639,32 @@
     "Modified: 22.10.1996 / 17:40:03 / cg"
 !
 
+trapMethod:aMethod if:conditionBlock
+    "arrange for the debugger to be entered when aMethod has been invoked and conditionBlock
+     evaluates to true.
+     The trap is enabled for any process.
+     Use unwrapMethod or untrapClass to remove this trap.
+     Be careful, to not place a trap on code needed in the debugger (i.e. on scrollBars etc.);
+     if there is a need to trap those, use the low-level wrap-methods, and put a check into the
+     entry/leave blocks."
+
+    ^ self wrapMethod:aMethod
+              onEntry:[:con | |conditionFires|
+
+                              conditionBlock numArgs == 1 ifTrue:[
+                                  conditionFires := conditionBlock value:con
+                              ] ifFalse:[
+                                  conditionFires := conditionBlock value:con value:aMethod
+                              ].
+                              conditionFires ifTrue:[
+                                BreakpointSignal raiseRequestWith:nil errorString:nil in:con
+                              ]  
+                      ]
+               onExit:LeaveBreakBlock.
+
+    "Created: / 18.8.2000 / 22:09:10 / cg"
+!
+
 trapMethod:aMethod inProcess:aProcess
     "arrange for the debugger to be entered when aMethod is about to be executed,
      but only, if executed in the current process.
@@ -2914,6 +2942,6 @@
 !MessageTracer class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.85 2000-03-21 11:15:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.86 2000-08-18 20:23:06 cg Exp $'
 ! !
 MessageTracer initialize!