Notes I was given when the debugger was new.
No promises that the debugger hasn't changed in the years since.
==============
Some notes on the debugger buttons are linked to from the "Details" section of
http://reference.wolfram.com/mathematica/ref/menuitem/DebuggerControls.html
The code the instructions refer to is
Module[{a},
Do[
a = {i, Sin[i]},
{i, 100}]]
- the debugger is enabled by choosing Evaluation menu > Debugger from the menu bar.
- a palette will open
- select the code you are interested in examining (e.g., triple click on a variable)
- press the "Break at Selection" button in the debugger palette
- evaluate your example
- note that the evaluation pauses and the "a = ..." block is highlighted.
- click "Show Stack" in the debugger palette
- this brings up a window showing you what is evaluating
- in the stack window click the opener triangle labeled "Local Variables"
- here you can see that the variable does not yet have a value
- press the "Step" button in the debugger palette
- note that "a" now has the value {1, Sin[1]}
- press "Step" again
- note that "a" now has the value {2, Sin[2]}
- press "Continue" on the debugger palette a few times
- it will stop each time it hits the "a = ..." breakpoint
- click the "Show Breakpoints" button on the debugger palette
- delete the breakpoint
- press "Continue" on the debugger palette
- the evaluation will complete
The most common gotcha to the Mathematica debugger is that it works only for code which has been evaluated after the debugger has been enabled. You can't evaluate a function, turn on the debugger, then debug code which uses that function. You must first turn on the debugger, then evaluate all function definitions you wish to debug, then you can set working breakpoints and step through code.
==============