↑
Main Page
Breakpoints
Each function in the Loaded Scripts pane also has a certain level of control. By right-clicking on the func-
tion, a context menu similar to that of the file is presented. Under Function Options, you can click Don’t
Debug to force the debugger to ignore that one function instead of the entire file. This gives you an opti-
mal level of control over the debugging process.
Breakpoints
Among the several ways to set up breakpoints in Venkman, the fastest and easiest way is to double-click
on the file containing the script to debug. When that code shows up in the Source Code view, scroll
down to the line on which you want to set the breakpoint on and click the left margin next to the line
(a dash is next to any line where a breakpoint can be set). You see a
B
, meaning that a hard breakpoint
has been set, or an
F
, meaning that the debugger could only set a future breakpoint (see Figure 14-18).
A future breakpoint is created when the script has already been unloaded from memory, but it becomes
a hard breakpoint the next time the script is loaded (if you reload the browser, for example).
Figure 14-18
You can always create a future breakpoint by double-clicking in the left margin instead of single clicking,
but you cannot force a hard breakpoint if, after one click, a future breakpoint is set.
The second way to set a breakpoint or future breakpoint is to use the command-line interface and the
/break
command (to set a hard breakpoint) or
/fbreak
command (to set a future breakpoint). Both
commands take two arguments: the filename to set the breakpoint in and the line number to set the
breakpoint on. For example:
/break ThrowExample.htm 7
This command sets a breakpoint on line 7 in the file matching ThrowExample.htm. For the filename, you
don’t need to type in the full path or even the full filename. Just a few characters are needed to uniquely
identify the file among all the files that are loaded into Venkman. Just the first few letters of the filename
are usually enough:
/break Thr 7
After a breakpoint has been created (using either method), it is stored in the Breakpoints view under the
filename. Hard and future breakpoints are stored separately, so you may see two different entries for the
same file (as in Figure 14-19). Only hard breakpoints can be viewed by function name and line; future
breakpoints are listed only as filename and line number.
439
Error Handling
17_579088 ch14.qxd 3/28/05 11:41 AM Page 439
Free JavaScript Editor
Ajax Editor
©
→