image

Debug

image

Meet Script Debugger’s debug mode! Debugging a script is like running it, except that in debug mode your script can pause in the middle.

Debugging is a separate mode; it’s a feature of your script. A script is either in debug mode or it isn’t. To turn on debug mode for a script:

In debug mode, a script window’s appearance changes slightly:

image

NOTE: In the above screen shot, the toolbar icons are small and the names of the buttons have been removed, to save space.

In debug mode:

  1. The Debugging button in the toolbar says ON.

  2. The Step buttons (Trace, Step Over, Step Into, Step Out) and Breakpoints button appear in the toolbar (by default).

  3. The gutter is wider (in order to accomodate breakpoints and code coverage markers), and displays pause arrows next to every line of the script where it’s possible to set a breakpoint.

  4. In the Result & Variables tab, two additional panes appear: the call stack and the breakpoints inspector.

To turn off debug mode:

NOTE: You might have to stop your script (choose Script > Stop, or click Stop in the toolbar) before you can turn off debug mode. You can’t turn off debug mode if your script is running or paused.

Debug mode is a script feature; it is saved as part of a script file. It is also unique to Script Debugger. A script saved in debug mode is unusable except in Script Debugger. Therefore, when you’re finished debugging, you will probably want to save your script not in debug mode.

There is, however, one good reason for deliberately saving a script in debug mode and running it elsewhere — so that you can debug externally.

Debug mode gives your script (and you) many new powers.

If your script involves driving a scriptable application’s interface, it may help you to work in the Mini Debugger, where you can interact with breakpoints and pauses in your script while keeping the scriptable application frontmost.

Further Details:
  Pause
Execute When Debugging
Breakpoints
Step
Trace
Call Stack
Variables (Debug Mode)
Expressions
Exceptions
Code Coverage
External Debugging
The Mini Debugger


image
Run