gecko-dev/js/jsdj/classes/com/netscape/jsdebugging/jsdb/Documentation.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>&nbsp;</CENTER>
<H2>
Overview</H2>
JSDB is a command line debugger modeled after jdb.
<BR>&nbsp;
<H2>
Supported Commands</H2>
<H3>
Normal State:</H3>
&nbsp;
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" >
<TR>
<TD>load &lt;filename>&nbsp;</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 &lt;filename> &lt;line></TD>
<TD>Set a breakpoint. File doesn't have to be loaded yet.</TD>
</TR>
<TR>
<TD>clear at &lt;filename> &lt;line></TD>
<TD>Clear a breakpoint.</TD>
</TR>
<TR>
<TD>bp</TD>
<TD>List breakpoints.</TD>
</TR>
<TR>
<TD>list &lt;filename> &lt;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>
&nbsp;
<BR>&nbsp;
<H3>
Stopped State:</H3>
&nbsp;
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" >
<TR>
<TD>resume, exit&nbsp;</TD>
<TD>Resume execution.</TD>
</TR>
<TR>
<TD>stop at &lt;filename> &lt;line>&nbsp;</TD>
<TD>Set a breakpoint.</TD>
</TR>
<TR>
<TD>clear at &lt;filename> &lt;line></TD>
<TD>Clear a breakpoint.</TD>
</TR>
<TR>
<TD>bp</TD>
<TD>List breakpoints.</TD>
</TR>
<TR>
<TD>list [&lt;filename> &lt;line>]&nbsp;</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 &lt;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>
&nbsp;
<BR>&nbsp;
<BR>&nbsp;
<H2>
Example</H2>
sample.js:
<BR>______________________________________________________
<BR>a=1;
<BR>for (i=0; i&lt;10; i++){
<BR>&nbsp;&nbsp;&nbsp; a = inc (inc(a));
<BR>}
<P>c = a+2;
<P>// Increment function
<BR>function inc (b){
<BR>&nbsp;&nbsp;&nbsp; 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>&nbsp;
<BR>&nbsp;
<BR>&nbsp;
<BR>&nbsp;
<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>
&nbsp;
<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>
&nbsp;
<BR>&nbsp;
<BR>&nbsp;
<BR>&nbsp;
<P><B>Alex Rakhlin</B>
<BR><B><A HREF="mailto:rakhlin@netscape.com">rakhlin@netscape.com</A></B>
</BODY>
</HTML>