Last updated at 6:12 am UTC on 27 May 2019
Is it possible to set breakpoints or watch conditions in Squeak?
Yes. One can set breakpoints or open inspectors on the fly in Squeak. Breakpoints or Watchpoints may be unconditional, conditional or triggered by a counter. These methods are found in debugging category of Object class.
One normally simply inserts "self halt" where one wants a breakpoint. Similarly, for watch points one can use "aTestForWatchpoint ifTrue: [self halt]". This could certainly be set up to be "invisible" but it would make the code generated by a method not match the source code visible in the method.
When dealing with morphic, it is usually better to use "self haltOnce" or "anInstance inspectOnce" which, if it gets called more than once, only pops up one debugger or inspector. To arm the haltOnce mechanism, run "self setHaltOnce" or "Object setHaltOnce" in a workspace. Most things in morphic get called repeatedly, since there is a global event loop. This can result in a crashing image by putting it in a loop like this accidentally, resulting in infinite debugger windows.
See also Debugger