This release is my first shot at a minimal debugger. I’m hoping it’s mostly self-explanatory :-)
Anyway, here’s how it works:
Breakpoints
In the controls palette (at the bottom) there are two new blocks, both named DEBUG
: a command and a reporter that takes an argument.
These blocks represent breakpoints. When a breakpoint gets evaluated all threads are paused and a little modeless Debugger dialog opens on the following block, i.e., you can edit anywhere and switch between sprites while the Debugger is open and threads are paused.
Inspecting
The Debugger focuses on letting you inspect the stuff that’s normally invisible inside a custom block definition, i.e.:
- a picture of the current block and its following ones,
- script variables and variable frames (in case of recursion or closures)
- return values (of reporter blocks)
If there are any values that can be inspected a button named “variables” is shown. Pressing it invokes a menu on all inspectable values. Hovering over the variable names displays their value in speech bubbles next to the menu. Clicking a menu item simply closes the menu. The Debugger can be resized to better view very big blocks. Its title shows either the name of the sprite the inspected block refers to, or the name of an “invisible” variable in case of getters/setter to temporaries or block vars.
Stepping
The Debugger currently has three buttons for navigation:
⟩
- resumes all threads
⟩|
- resumes all threads and again pauses at the next block in the current thread
⟩
- resumes all threads, run the next complete command (e.g., an entire repeated loop) without pausing, then pause at the following command.
Reporter blocks are stepped through twice: When entering and when exiting the block. Exiting the block is indicated by the ^
sign next to the Debugger’s window label.
Command blocks only trigger a single step.
Overriding
Breakpoints are ignored in presentation mode. That way you can debug in edit mode and test in presentation mode without having to remove all breakpoints and put them back in again.
Pressing the Stop sign also closes the Debugger. If you’re inside a loop and want to stop debugging, just press stop :-)
Needless to say this is all very experimental and in flux. Therefore I
did not yet localize those strings.