зеркало из https://github.com/mozilla/gecko-dev.git
208 строки
3.4 KiB
HTML
208 строки
3.4 KiB
HTML
|
<HTML>
|
||
|
<HEAD>
|
||
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||
|
<META NAME="Author" CONTENT="Alex Rakhlin">
|
||
|
<META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en]C-NSCP (WinNT; U) [Netscape]">
|
||
|
<TITLE>Documentation</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
|
||
|
<CENTER>
|
||
|
<H1>
|
||
|
JSDB</H1></CENTER>
|
||
|
|
||
|
<CENTER> </CENTER>
|
||
|
|
||
|
<H2>
|
||
|
Overview</H2>
|
||
|
JSDB is a command line debugger modeled after jdb.
|
||
|
<BR>
|
||
|
<H2>
|
||
|
Supported Commands</H2>
|
||
|
|
||
|
<H3>
|
||
|
Normal State:</H3>
|
||
|
|
||
|
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" >
|
||
|
<TR>
|
||
|
<TD>load <filename> </TD>
|
||
|
|
||
|
<TD>Load and run a javascript file.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>suspend</TD>
|
||
|
|
||
|
<TD>Stop before first instruction is executed</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>stop at <filename> <line></TD>
|
||
|
|
||
|
<TD>Set a breakpoint. File doesn't have to be loaded yet.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>clear at <filename> <line></TD>
|
||
|
|
||
|
<TD>Clear a breakpoint.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>bp</TD>
|
||
|
|
||
|
<TD>List breakpoints.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>list <filename> <line></TD>
|
||
|
|
||
|
<TD>Print source code.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>scripts</TD>
|
||
|
|
||
|
<TD>List loaded scripts.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>quit, exit</TD>
|
||
|
|
||
|
<TD>Quit jsdb.</TD>
|
||
|
</TR>
|
||
|
</TABLE>
|
||
|
|
||
|
<BR>
|
||
|
<H3>
|
||
|
Stopped State:</H3>
|
||
|
|
||
|
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" >
|
||
|
<TR>
|
||
|
<TD>resume, exit </TD>
|
||
|
|
||
|
<TD>Resume execution.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>stop at <filename> <line> </TD>
|
||
|
|
||
|
<TD>Set a breakpoint.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>clear at <filename> <line></TD>
|
||
|
|
||
|
<TD>Clear a breakpoint.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>bp</TD>
|
||
|
|
||
|
<TD>List breakpoints.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>list [<filename> <line>] </TD>
|
||
|
|
||
|
<TD>Print source code. If filename is not specified, prints the current
|
||
|
line in the current stackframe.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>up</TD>
|
||
|
|
||
|
<TD>Move up the stack.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>down</TD>
|
||
|
|
||
|
<TD>Move down the stack.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>where</TD>
|
||
|
|
||
|
<TD>Dump stack.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>step</TD>
|
||
|
|
||
|
<TD>Execute current line.</TD>
|
||
|
</TR>
|
||
|
|
||
|
<TR>
|
||
|
<TD>eval <expr></TD>
|
||
|
|
||
|
<TD>Evaluate expression in current frame. <I>print()</I> function is supported,
|
||
|
so, for example, <I>eval print(a)</I> will print the value of variable
|
||
|
<I>a.</I></TD>
|
||
|
</TR>
|
||
|
</TABLE>
|
||
|
|
||
|
<BR>
|
||
|
<BR>
|
||
|
<H2>
|
||
|
Example</H2>
|
||
|
sample.js:
|
||
|
<BR>______________________________________________________
|
||
|
<BR>a=1;
|
||
|
<BR>for (i=0; i<10; i++){
|
||
|
<BR> a = inc (inc(a));
|
||
|
<BR>}
|
||
|
|
||
|
<P>c = a+2;
|
||
|
|
||
|
<P>// Increment function
|
||
|
<BR>function inc (b){
|
||
|
<BR> return b+1;
|
||
|
<BR>}
|
||
|
<BR>______________________________________________________
|
||
|
|
||
|
<P>A sample JSDB session could be:
|
||
|
|
||
|
<P><B>>stop at sample.js:6</B>
|
||
|
<BR>Script not loaded. Breakpoint will be set once the script is loaded
|
||
|
<BR><B>>load sample.js</B>
|
||
|
<BR>Set breakpoint at sample.js null 6
|
||
|
<BR>Stopped at 6
|
||
|
<BR><B>STOPPED >>list</B>
|
||
|
<BR>c = a+2;
|
||
|
<BR><B>STOPPED >>eval print (a)</B>
|
||
|
<BR>21
|
||
|
<BR><B>STOPPED >>resume</B>
|
||
|
<BR><B>></B>
|
||
|
<BR>
|
||
|
<BR>
|
||
|
<BR>
|
||
|
<BR>
|
||
|
<H2>
|
||
|
Notes</H2>
|
||
|
|
||
|
<UL>
|
||
|
<LI>
|
||
|
I didn't test JSDB much, so I'm sure that there are some bugs. If you find
|
||
|
one, or if you have a suggestion, please <A HREF="mailto:rakhlin@netscape.com">e-mail</A>
|
||
|
me.</LI>
|
||
|
</UL>
|
||
|
|
||
|
<H2>
|
||
|
Bugs and "features"</H2>
|
||
|
|
||
|
<UL>
|
||
|
<LI>
|
||
|
<B>Important</B>: JSDB crashes when executed with jits. Use <I>-nojit</I>
|
||
|
switch if you are using <I>jre.exe</I>.</LI>
|
||
|
</UL>
|
||
|
|
||
|
<BR>
|
||
|
<BR>
|
||
|
<BR>
|
||
|
|
||
|
<P><B>Alex Rakhlin</B>
|
||
|
<BR><B><A HREF="mailto:rakhlin@netscape.com">rakhlin@netscape.com</A></B>
|
||
|
</BODY>
|
||
|
</HTML>
|