|
|
|
|
|
by melvinroest
1202 days ago
|
|
> Conditional breakpoints are easier to work with if they can be directly included in the source code The following code (probably, haven't tested it) allows to create a conditional breakpoint only when a certain method is called by tracing down the call stack debuggerIsInMethod: aMethodName
ctx := GRPlatform current thisContext. "grab callstack"
[ctx isNotNil] whileTrue: [
(aMethodName asSymbol = ctx method selector) ifTrue: [ ^ true ].
ctx := ctx sender ] ].
^ false
So in another method you can send (call the method) that's deeper in the call stack by doing: someMethod
"do work"
debuggerIsInYourMethod: 'aMethodHigherUpTheCallStack' ifTrue: [ 1 halt ].
"do more work"
Use case: Suppose someMethod is being sent/called from everywhere, but you only want to debug it when aMethodHigherUpTheCallStack is sent/called. With this conditional breakpoint (in code), you can :) |
|