Acrobat JavaScript Tools
Starting the Debugger
2
Listing Breakpoints
To view the list of all breakpoints set for the debugging session, select the
Breakpoints
option from the
Inspect
drop-down list. You may edit and delete breakpoints using the
button controls just beneath the
Inspect
details window, as shown above in
Figure 2.14.
Using Conditional Breakpoints
A conditional breakpoint causes the interpreter to stop the program and activate the
debugger only when a specified condition is true. Conditional breakpoints are useful for
stopping execution when conditions warrant doing so, and streamline the debugging
process by eliminating needless stepwise execution. For example, if you are only interested
in debugging after 100 iterations in a loop, you can set a breakpoint that only becomes
active when the looping index reaches the value of 100.
The condition is a JavaScript expression. If the expression evaluates to
true
, the
interpreter stops the program at the breakpoint. Otherwise, the interpreter does not stop
the program. An unconditional breakpoint, the default, always causes the interpreter to
stop the program and to activate the debugger when it reaches the breakpoint, because its
condition is always set to
true
.
To change a breakpoint condition, select
Breakpoint
from the
Inspect
drop-down list and
click
Edit.
A dialog appears, prompting you to change the breakpoint condition.
Starting the Debugger
There are four ways to invoke the Acrobat JavaScript Debugger. Two of these ways begin
the debugging session from the start of execution, and the other two begin the session
from a specified line of code.
Debugging From the Start of Execution
There are two ways to start the debugger from the start of execution. In either case, use the
button to proceed with the debugging session.
Debug From Start
Choose
Advanced > JavaScript
and, if the option is not already checked, click on
Debug
From Start.
This option causes the debugging session to begin at the start of execution of any new
script.
N
OTE
:
Debug From Start
does not turn off automatically. Be sure to turn off this option
when you have finished debugging, otherwise it continues to stop on every new
script you execute in Acrobat.
Acrobat JavaScript Scripting Guide
59