[BACK]Return to debug.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts

Diff for /OpenXM/src/asir-doc/parts/debug.texi between version 1.1 and 1.2

version 1.1, 1999/12/08 05:47:44 version 1.2, 1999/12/21 02:47:31
Line 1 
Line 1 
   @comment $OpenXM$
   \BJP
 @node $B%G%P%C%,(B,,, Top  @node $B%G%P%C%,(B,,, Top
 @chapter $B%G%P%C%,(B  @chapter $B%G%P%C%,(B
   \E
   \BEG
   @node Debugger,,, Top
   @chapter Debugger
   \E
   
 @menu  @menu
   \BJP
 * $B%G%P%C%,$H$O(B::  * $B%G%P%C%,$H$O(B::
 * $B%3%^%s%I$N2r@b(B::  * $B%3%^%s%I$N2r@b(B::
 * $B%G%P%C%,$N;HMQNc(B::  * $B%G%P%C%,$N;HMQNc(B::
 * $B%G%P%C%,$N=i4|2=%U%!%$%k$NNc(B::  * $B%G%P%C%,$N=i4|2=%U%!%$%k$NNc(B::
   \E
   \BEG
   * What is Debugger::
   * Debugger commands::
   * Execution example of debugger::
   * Sample file of initialization file for Debugger::
   \E
 @end menu  @end menu
   
   \BJP
 @node $B%G%P%C%,$H$O(B,,, $B%G%P%C%,(B  @node $B%G%P%C%,$H$O(B,,, $B%G%P%C%,(B
 @section $B%G%P%C%,$H$O(B  @section $B%G%P%C%,$H$O(B
   \E
   \BEG
   @node What is Debugger,,, Debugger
   @section What is Debugger
   \E
   
 @noindent  @noindent
   \BJP
 C $B8@8l$G=q$+$l$?%W%m%0%i%`$N$?$a$N%G%P%C%,(B @code{dbx}  C $B8@8l$G=q$+$l$?%W%m%0%i%`$N$?$a$N%G%P%C%,(B @code{dbx}
 $B$O(B, $B%=!<%9%l%Y%k$G$N%V%l!<%/%]%$%s%H$N@_Dj(B, $B%9%F%C(B  $B$O(B, $B%=!<%9%l%Y%k$G$N%V%l!<%/%]%$%s%H$N@_Dj(B, $B%9%F%C(B
 $B%W<B9T(B, $BJQ?t$N;2>H$J$I$,2DG=$J6/NO$J%G%P%C%,$G$"$k(B. @b{Asir} $B$G$O(B,  $B%W<B9T(B, $BJQ?t$N;2>H$J$I$,2DG=$J6/NO$J%G%P%C%,$G$"$k(B. @b{Asir} $B$G$O(B,
 @code{dbx} $BIw$N%G%P%C%,$rMQ0U$7$F$$$k(B. $B%G%P%C%0%b!<%I$KF~$k$K$O(B, $B%H%C(B  @code{dbx} $BIw$N%G%P%C%,$rMQ0U$7$F$$$k(B. $B%G%P%C%0%b!<%I$KF~$k$K$O(B, $B%H%C(B
 $B%W%l%Y%k$G(B @code{debug;} $B$HF~NO$9$k(B.  $B%W%l%Y%k$G(B @code{debug;} $B$HF~NO$9$k(B.
   \E
   \BEG
   A debugger @code{dbx} is available for C programs on @code{Sun},
   @code{VAX} etc.
   In @code{dbx}, one can use commands such as setting break-point on
   a source line, stepwise execution, inspecting a variable's value etc.
   @b{Asir} provides such a @code{dbx}-like debugger.
   In addition to such commands, we adopted several useful commands
   from @code{gdb}.
   In order to enter the debug-mode, type @code{debug;} at the top level
   of @b{Asir}.
   \E
   
 @example  @example
 [10] debug;  [10] debug;
 (debug)  (debug)
 @end example  @end example
   
 @noindent  @noindent
 $B$=$NB>(B, $B<!$NJ}K!(B, $B$"$k$$$O>u67$G%G%P%C%0%b!<%I$KF~$k(B.  \JP $B$=$NB>(B, $B<!$NJ}K!(B, $B$"$k$$$O>u67$G%G%P%C%0%b!<%I$KF~$k(B.
   \BEG
   @code{Asir} also enters the debug-mode by the following means or in the
   following situations.
   \E
   
 @itemize @bullet  @itemize @bullet
 @item  @item
 $B<B9TCf%V%l!<%/%]%$%s%H$KC#$7$?>l9g(B  \JP $B<B9TCf%V%l!<%/%]%$%s%H$KC#$7$?>l9g(B
   \EG When it reaches a break point while executing a program.
   
 @item  @item
 $B3d$j9~$_$G(B @samp{d} $B$rA*Br$7$?>l9g(B  \JP $B3d$j9~$_$G(B @samp{d} $B$rA*Br$7$?>l9g(B
   \EG When the @samp{d} option is selected at an interruption.
   
 @item  @item
 $B<B9TCf%(%i!<$r5/$3$7$?>l9g(B  \JP $B<B9TCf%(%i!<$r5/$3$7$?>l9g(B
   \EG When it detects errors while executing a program.
   
   \BJP
 $B$3$N>l9g(B, $B<B9T$N7QB3$OIT2DG=$G$"$k$,(B, $BD>@\$N%(%i!<$N860x$H$J$C$?(B  $B$3$N>l9g(B, $B<B9T$N7QB3$OIT2DG=$G$"$k$,(B, $BD>@\$N%(%i!<$N860x$H$J$C$?(B
 $B%f!<%6Dj5AH!?t$NJ8$rI=<($7$F%G%P%C%0%b!<%I$KF~$k$?$a(B, $B%(%i!<;~(B  $B%f!<%6Dj5AH!?t$NJ8$rI=<($7$F%G%P%C%0%b!<%I$KF~$k$?$a(B, $B%(%i!<;~(B
 $B$K$*$1$kJQ?t$NCM$r;2>H$G$-(B, $B%G%P%C%0$KLrN)$?$;$k$3$H$,$G$-$k(B.  $B$K$*$1$kJQ?t$NCM$r;2>H$G$-(B, $B%G%P%C%0$KLrN)$?$;$k$3$H$,$G$-$k(B.
   \E
   \BEG
   In this case, to continue the execution of the program is impossible.
   But because it reports the statement in the user defined function
   that caused the error, then enters the debug-mode, user can inspect
   the values of variables at the error state.  This helps to analyze
   the error and debug the program.
   \E
   
 @item  @item
 @code{error()} $B$,8F$S=P$5$l$?>l9g(B  \JP @code{error()} $B$,8F$S=P$5$l$?>l9g(B
   \EG When built-in function @code{error()} is called.
 @end itemize  @end itemize
   
   \BJP
 @node $B%3%^%s%I$N2r@b(B,,, $B%G%P%C%,(B  @node $B%3%^%s%I$N2r@b(B,,, $B%G%P%C%,(B
 @section $B%3%^%s%I$N2r@b(B  @section $B%3%^%s%I$N2r@b(B
   \E
   \BEG
   @node Debugger commands,,, Debugger
   @section Debugger commands
   \E
   
 @noindent  @noindent
   \BJP
 $B%3%^%s%I$O(B @code{dbx} $B$N%3%^%s%I$NFbI,MW:G>.8B$N$b$N$r:NMQ$7$?(B.  $B%3%^%s%I$O(B @code{dbx} $B$N%3%^%s%I$NFbI,MW:G>.8B$N$b$N$r:NMQ$7$?(B.
 $B99$K(B, @code{gdb} $B$N%3%^%s%I$+$i$b$$$/$D$+JXMx$J$b$N$r:NMQ$7$?(B.  $B99$K(B, @code{gdb} $B$N%3%^%s%I$+$i$b$$$/$D$+JXMx$J$b$N$r:NMQ$7$?(B.
 $B<B:]$N5!G=$O(B @code{dbx} $B$H$[$\F1MM$G$"$k$,(B, @code{step}, @code{next} $B$O(B,  $B<B:]$N5!G=$O(B @code{dbx} $B$H$[$\F1MM$G$"$k$,(B, @code{step}, @code{next} $B$O(B,
Line 55  C $B8@8l$G=q$+$l$?%W%m%0%i%`$N$?$a$N%G%P%C%,(B @code
Line 114  C $B8@8l$G=q$+$l$?%W%m%0%i%`$N$?$a$N%G%P%C%,(B @code
 $B$r<B9T$7$J$1$l$P<!$N9T$K?J$a$J$$(B. $B$^$?(B, @code{dbx} $B$HF1MM(B  $B$r<B9T$7$J$1$l$P<!$N9T$K?J$a$J$$(B. $B$^$?(B, @code{dbx} $B$HF1MM(B
 @file{.dbxinit} $B$rFI$_9~$`$N$G(B, @code{dbx} $B$HF1$8(B alias $B$r;H$&$3$H$,$G(B  @file{.dbxinit} $B$rFI$_9~$`$N$G(B, @code{dbx} $B$HF1$8(B alias $B$r;H$&$3$H$,$G(B
 $B$-$k(B.  $B$-$k(B.
   \E
   \BEG
   Only indispensable commands of @code{dbx} are supported
   in the current version.
   Generally, the effect of a command is the same as that of @code{dbx}.
   There are, however, slight differences:
   Commands @code{step} and @code{next} execute the next statement, but not
   the next line; therefore, if there are multiple statements in one line,
   one should issue such commands several times to proceed the next line.
   The debugger reads in @file{.dbxinit}, which allows the same aliases
   as is used in @code{dbx}.
   \E
   
 @table @code  @table @code
 @item step  @item step
 $B<!$NJ8$r<B9T$9$k(B. $B<!$NJ8$,H!?t$r4^$`$H$-(B, $B$=$NH!?t$KF~$k(B.  \JP $B<!$NJ8$r<B9T$9$k(B. $B<!$NJ8$,H!?t$r4^$`$H$-(B, $B$=$NH!?t$KF~$k(B.
   \BEG
   Executes the next statement; if the next statement contains a
   function call, then enters the function.
   \E
 @item next  @item next
 $B<!$NJ8$r<B9T$9$k(B.  \JP $B<!$NJ8$r<B9T$9$k(B.
   \EG Executes the next statement.
 @item finish  @item finish
   \BJP
 $B8=:_<B9TCf$NH!?t$N<B9T$,=*N;$7$?;~E@$G:F$S%G%P%C%0%b!<%I$KF~$k(B.  $B8=:_<B9TCf$NH!?t$N<B9T$,=*N;$7$?;~E@$G:F$S%G%P%C%0%b!<%I$KF~$k(B.
 $B8m$C$F(B @code{step} $B$r<B9T$7$?>l9g$KM-8z$G$"$k(B.  $B8m$C$F(B @code{step} $B$r<B9T$7$?>l9g$KM-8z$G$"$k(B.
   \E
   \BEG
   Enter the debug-mode again after finishing
   the execuction of the current function.
   This is useful when an unnecessary @code{step} has been executed.
   \E
 @item cont  @item cont
 @itemx quit  @itemx quit
 $B%G%P%C%0%b!<%I$+$iH4$1(B, $B<B9T$r7QB3$9$k(B.  \JP $B%G%P%C%0%b!<%I$+$iH4$1(B, $B<B9T$r7QB3$9$k(B.
   \EG Exits from the debug-mode and continues execution.
 @item up [@var{n}]  @item up [@var{n}]
   \BJP
 $B%9%?%C%/%U%l!<%`$r(B 1 $BCJ(B ($B0z?t(B @var{n} $B$,$"$k;~$O(B @var{n} $BCJ(B) $B>e$,$k(B.  $B%9%?%C%/%U%l!<%`$r(B 1 $BCJ(B ($B0z?t(B @var{n} $B$,$"$k;~$O(B @var{n} $BCJ(B) $B>e$,$k(B.
 $B$3$l$K$h$j(B, $B$=$N%9%?%C%/%U%l!<%`$KB0$9$kJQ?t$NCM$N;2>H(B, $BJQ99$,$G$-$k(B.  $B$3$l$K$h$j(B, $B$=$N%9%?%C%/%U%l!<%`$KB0$9$kJQ?t$NCM$N;2>H(B, $BJQ99$,$G$-$k(B.
   \E
   \BEG
   Move up the call stack one level.
   Move up the call stack @var{n} levels if @var{n} is specified.
   \E
 @item down [@var{n}]  @item down [@var{n}]
 $B%9%?%C%/%U%l!<%`$r(B 1 $BCJ(B ($B0z?t(B @var{n} $B$,$"$k;~$O(B @var{n} $BCJ(B) $B2<$,$k(B.  \JP $B%9%?%C%/%U%l!<%`$r(B 1 $BCJ(B ($B0z?t(B @var{n} $B$,$"$k;~$O(B @var{n} $BCJ(B) $B2<$,$k(B.
   \BEG
   Move down the call stack one level.
   Move down the call stack @var{n} levels if @var{n} is specified.
   \E
 @item frame [@var{n}]  @item frame [@var{n}]
   \BJP
 $B0z?t$,$J$$$H$-(B, $B8=:_<B9TCf$NH!?t$rI=<($9$k(B.  $B0z?t$,$J$$$H$-(B, $B8=:_<B9TCf$NH!?t$rI=<($9$k(B.
 $B0z?t$,$"$k$H$-(B, $B%9%?%C%/%U%l!<%`$rHV9f(B @var{n} $B$N$b$N$K@_Dj$9$k(B. $B$3$3$G(B  $B0z?t$,$"$k$H$-(B, $B%9%?%C%/%U%l!<%`$rHV9f(B @var{n} $B$N$b$N$K@_Dj$9$k(B. $B$3$3$G(B
 $B%9%?%C%/%U%l!<%`$NHV9f$H$O(B  $B%9%?%C%/%U%l!<%`$NHV9f$H$O(B
 @code{where} $B$K$h$jI=<($5$l$k8F$S=P$7Ns$K$*$$$F(B, $B@hF,$KI=<($5$l$kHV9f$N(B  @code{where} $B$K$h$jI=<($5$l$k8F$S=P$7Ns$K$*$$$F(B, $B@hF,$KI=<($5$l$kHV9f$N(B
 $B$3$H$G$"$k(B.  $B$3$H$G$"$k(B.
   \E
   \BEG
   Print the current stack frame with no argument. @var{n}
   specifies the stack frame number to be selected. Here the
   stack frame number is a number at the top of lines displayed
   by executing @code{where}.
   \E
 @item list [@var{startline}]  @item list [@var{startline}]
 @itemx list @var{function}  @itemx list @var{function}
   \BJP
 $B8=:_9T(B, $B$^$?$O(B @var{startline}, $B$^$?$O(B @var{function}$B$N@hF,$+$i(B 10 $B9T%=!<(B  $B8=:_9T(B, $B$^$?$O(B @var{startline}, $B$^$?$O(B @var{function}$B$N@hF,$+$i(B 10 $B9T%=!<(B
 $B%9%U%!%$%k$rI=<($9$k(B.  $B%9%U%!%$%k$rI=<($9$k(B.
   \E
   \BEG
   Displays ten lines in a source file from @var{startline},
   the current line if the @var{startline} is not specified,
   or from the top line of current target @var{function}.
   \E
 @item print @var{expr}  @item print @var{expr}
 @var{expr} $B$rI=<($9$k(B.  \JP @var{expr} $B$rI=<($9$k(B.
   \EG Displays @var{expr}.
 @item func @var{function}  @item func @var{function}
 $BBP>]H!?t$r(B @var{function} $B$K@_Dj$9$k(B.  \JP $BBP>]H!?t$r(B @var{function} $B$K@_Dj$9$k(B.
   \EG Set the target function to @var{function}.
 @item stop at @var{sourceline} [if @var{cond}]  @item stop at @var{sourceline} [if @var{cond}]
 @itemx stop in @var{function}  @itemx stop in @var{function}
   \BJP
 @var{sourceline}$B9TL\(B, $B$^$?$O(B @var{function} $B$N@hF,$K%V%l!<%/%]%$%s%H$r(B  @var{sourceline}$B9TL\(B, $B$^$?$O(B @var{function} $B$N@hF,$K%V%l!<%/%]%$%s%H$r(B
 $B@_Dj$9$k(B. $B%V%l!<%/%]%$%s%H$O(B, $BH!?t$,:FDj5A$5$l$?>l9g<+F0E*$K<h$j>C$5$l(B  $B@_Dj$9$k(B. $B%V%l!<%/%]%$%s%H$O(B, $BH!?t$,:FDj5A$5$l$?>l9g<+F0E*$K<h$j>C$5$l(B
 $B$k(B. @code{if} $B$,B3$/>l9g(B, @var{cond} $B$,I>2A$5$l(B, $B$=$l$,(B 0 $B$G$J$$>l9g$K(B  $B$k(B. @code{if} $B$,B3$/>l9g(B, @var{cond} $B$,I>2A$5$l(B, $B$=$l$,(B 0 $B$G$J$$>l9g$K(B
 $B<B9T$,CfCG$7(B, $B%G%P%C%0%b!<%I$KF~$k(B.  $B<B9T$,CfCG$7(B, $B%G%P%C%0%b!<%I$KF~$k(B.
   \E
   \BEG
   Set a break-point at the @var{sourceline}-th line of the source file,
   or at the top of the target function.
   Break-points are removed whenever the relevant function is redefined.
   When @code{if} statements are repeatedly encountered,
   @b{Asir} enters debug-mode only when the corresponding
   @var{cond} parts are evaluated to a non-zero value.
   \E
 @item trace @var{expr} at @var{sourceline} [if @var{cond}]  @item trace @var{expr} at @var{sourceline} [if @var{cond}]
 @item trace @var{expr} in @var{function}  @item trace @var{expr} in @var{function}
   \BJP
 @code{stop} $B$HF1MM$G$"$k$,(B, @code{trace} $B$G$OC1$K(B @var{expr} $B$rI=<($9$k(B  @code{stop} $B$HF1MM$G$"$k$,(B, @code{trace} $B$G$OC1$K(B @var{expr} $B$rI=<($9$k(B
 $B$N$_$G(B, $B%G%P%C%0%b!<%I$K$OF~$i$J$$(B.  $B$N$_$G(B, $B%G%P%C%0%b!<%I$K$OF~$i$J$$(B.
   \E
   \BEG
   These are similar to @code{stop}. @code{trace} simply displays the value
   of @var{expr} and without entering the debug-mode.
   \E
 @item delete @var{n}  @item delete @var{n}
 $B%V%l!<%/%]%$%s%H(B @var{n} $B$r<h$j>C$9(B.  \JP $B%V%l!<%/%]%$%s%H(B @var{n} $B$r<h$j>C$9(B.
   \BEG
   Remove the break point specified by a number @var{n}, which can be
   known by the @code{status} command.
   \E
 @item status  @item status
 $B%V%l!<%/%]%$%s%H$N0lMw$rI=<($9$k(B.  \JP $B%V%l!<%/%]%$%s%H$N0lMw$rI=<($9$k(B.
   \EG Displays a list of the break-points.
 @item where  @item where
 $B8=:_$NDd;_E@$^$G$N8F$S=P$7Ns$rI=<($9$k(B.  \JP $B8=:_$NDd;_E@$^$G$N8F$S=P$7Ns$rI=<($9$k(B.
   \BEG
   Displays the calling sequence of functions from the top level
   through the current level.
   \E
 @item alias @var{alias} @var{command}  @item alias @var{alias} @var{command}
 @var{command} $B$K(B @var{alias} $B$NJLL>$rM?$($k(B.  \JP @var{command} $B$K(B @var{alias} $B$NJLL>$rM?$($k(B.
   \EG Create an alias @var{alias} for @var{command}
 @end table  @end table
   
 @noindent  @noindent
   \BJP
 @code{print} $B$N0z?t$H$7$F(B, $B%H%C%W%l%Y%k$K$*$1$k$[$H$s$I$9$Y$F$N<0(B  @code{print} $B$N0z?t$H$7$F(B, $B%H%C%W%l%Y%k$K$*$1$k$[$H$s$I$9$Y$F$N<0(B
 $B$,$H$l$k(B. $BDL>o$O(B, $BJQ?t$NFbMF$NI=<($,<g$G$"$k$,(B, $BI,MW$K1~$8$F<!$N(B  $B$,$H$l$k(B. $BDL>o$O(B, $BJQ?t$NFbMF$NI=<($,<g$G$"$k$,(B, $BI,MW$K1~$8$F<!$N(B
 $B$h$&$J;H$$J}$,$G$-$k(B.  $B$h$&$J;H$$J}$,$G$-$k(B.
   \E
   \BEG
   The debugger command @code{print} can take almost all expressions
   as its argument.  The ordinary usage is to print the values of
   (programming) variables.  However, the following usage is worth to
   remember.
   \E
   
 @itemize @bullet  @itemize @bullet
 @item  @item
 @b{$BJQ?t$N=q$-49$((B}  \JP @b{$BJQ?t$N=q$-49$((B}
   \EG @b{overwriting the variable}
   
   \BJP
 $B<B9TCf$N%V%l!<%/%]%$%s%H$K$*$$$F(B, $BJQ?t$NCM$rJQ99$7$F<B9T$r7QB3$5$;$?$$(B  $B<B9TCf$N%V%l!<%/%]%$%s%H$K$*$$$F(B, $BJQ?t$NCM$rJQ99$7$F<B9T$r7QB3$5$;$?$$(B
 $B>l9g(B, $B<!$N$h$&$JA`:n$r9T$($P$h$$(B.  $B>l9g(B, $B<!$N$h$&$JA`:n$r9T$($P$h$$(B.
   \E
   \BEG
   One might sometimes wish to continue the execution with several values of
   variables modified.  For such an purpose, take the following procedure.
   \E
   
 @example  @example
 (debug) print A  (debug) print A
Line 129  A = 1
Line 281  A = 1
   
   
 @item  @item
 @b{$BH!?t$N8F$S=P$7(B}  \JP @b{$BH!?t$N8F$S=P$7(B}
   \EG @b{function call}
   
 $BH!?t8F$S=P$7$b<0$G$"$k$+$i(B, @code{print} $B$N0z?t$H$7$F$H$l$k(B.  \JP $BH!?t8F$S=P$7$b<0$G$"$k$+$i(B, @code{print} $B$N0z?t$H$7$F$H$l$k(B.
   \BEG
   A function call is also an expression, therefore, it can appear at
   the argument place of @code{print}.
   \E
   
 @example  @example
 (debug) print length(List)  (debug) print length(List)
 length(List) = 14  length(List) = 14
 @end example  @end example
   
   \BJP
 $B$3$NNc$G$O(B, $BJQ?t(B @code{List} $B$K3JG<$5$l$F$$$k%j%9%H$ND9$5$r(B @code{length()}  $B$3$NNc$G$O(B, $BJQ?t(B @code{List} $B$K3JG<$5$l$F$$$k%j%9%H$ND9$5$r(B @code{length()}
 $B$K$h$jD4$Y$F$$$k(B.  $B$K$h$jD4$Y$F$$$k(B.
   \E
   \BEG
   In this example, the length of the list assigned to the variable
   @code{List} is examined by a function @code{length()}.
   \E
   
 @example  @example
 (debug) print ctrl("cputime",1)  (debug) print ctrl("cputime",1)
 ctrl("cputime",1) = 1  ctrl("cputime",1) = 1
 @end example  @end example
   
   \BJP
 $B$3$NNc$O(B, $B7W;;3+;O;~$K(B CPU $B;~4V$NI=<($N;XDj$r$7K:$l$?>l9g$J$I$K(B, $B7W;;(B  $B$3$NNc$O(B, $B7W;;3+;O;~$K(B CPU $B;~4V$NI=<($N;XDj$r$7K:$l$?>l9g$J$I$K(B, $B7W;;(B
 $BESCf$G%G%P%C%0%b!<%I$+$i;XDj$r9T$($k$3$H$r<($7$F$$$k(B.  $BESCf$G%G%P%C%0%b!<%I$+$i;XDj$r9T$($k$3$H$r<($7$F$$$k(B.
   
 $B$^$?(B, $B;_$`$rF@$:7W;;$rCfCG$7$J$1$l$P$J$i$J$$>l9g(B, $B%G%P%C%0%b!<%I$+$i(B  $B$^$?(B, $B;_$`$rF@$:7W;;$rCfCG$7$J$1$l$P$J$i$J$$>l9g(B, $B%G%P%C%0%b!<%I$+$i(B
 @code{bsave()} $B$J$I$N%3%^%s%I$K$h$jESCf7k2L$r%U%!%$%k$KJ]B8$9$k$3$H$b(B  @code{bsave()} $B$J$I$N%3%^%s%I$K$h$jESCf7k2L$r%U%!%$%k$KJ]B8$9$k$3$H$b(B
 $B$G$-$k(B.  $B$G$-$k(B.
   \E
   \BEG
   This example shows such a usage where measuring CPU time is activated
   from within the debug-mode, even if one might have forgotten to specify
   the activation of CPU time measurement.
   
   It is also useful to save intermediate results to files from within
   the debug-mode by the built-in function @code{bsave()} when one is
   forced to quit the computation by any reason.
   \E
   
 @example  @example
 (debug) print bsave(A,"savefile")  (debug) print bsave(A,"savefile")
 bsave(A,"savefile") = 1  bsave(A,"savefile") = 1
 @end example  @end example
   
   \BJP
 $B%G%P%C%0%b!<%I$+$i$NH!?t8F$S=P$7$GCm0U$9$Y$-$3$H$O(B,  $B%G%P%C%0%b!<%I$+$i$NH!?t8F$S=P$7$GCm0U$9$Y$-$3$H$O(B,
 @code{print} $B$N0z?t$,%f!<%6Dj5AH!?t$N8F$S=P$7$r4^$`>l9g(B,  @code{print} $B$N0z?t$,%f!<%6Dj5AH!?t$N8F$S=P$7$r4^$`>l9g(B,
 $B$=$NH!?t8F$S=P$7$G%(%i!<$,5/$3$C$?>l9g$K85$NH!?t$N<B9T7QB3$,IT2DG=(B  $B$=$NH!?t8F$S=P$7$G%(%i!<$,5/$3$C$?>l9g$K85$NH!?t$N<B9T7QB3$,IT2DG=(B
 $B$K$J$k>l9g$,$"$k$H$$$&$3$H$G$"$k(B.  $B$K$J$k>l9g$,$"$k$H$$$&$3$H$G$"$k(B.
   \E
   \BEG
   Note that continuation of the parent function will be impossible if
   an error will occur in the function call from within the debug-mode.
   \E
 @end itemize  @end itemize
   
   \BJP
 @node $B%G%P%C%,$N;HMQNc(B,,, $B%G%P%C%,(B  @node $B%G%P%C%,$N;HMQNc(B,,, $B%G%P%C%,(B
 @section $B%G%P%C%,$N;HMQNc(B  @section $B%G%P%C%,$N;HMQNc(B
   \E
   \BEG
   @node Execution example of debugger,,, Debugger
   @section Execution example of debugger
   \E
   
 @noindent  @noindent
   \BJP
 $B$3$3$G$O(B, $B3,>h$r:F5"E*$K7W;;$5$;$k%f!<%6Dj5AH!?t$rNc$H$7$F(B, $B%G%P%C%,$N(B  $B$3$3$G$O(B, $B3,>h$r:F5"E*$K7W;;$5$;$k%f!<%6Dj5AH!?t$rNc$H$7$F(B, $B%G%P%C%,$N(B
 $B<B:]$N;HMQK!$r<($9(B.  $B<B:]$N;HMQK!$r<($9(B.
   \E
   \BEG
   Here, the usage of the Debugger is explained by showing an example
   for debugging a program which computes the integer factorial by a
   recursive definition.
   \E
   
 @example  @example
 % asir  % asir
Line 183  bsave(A,"savefile") = 1
Line 376  bsave(A,"savefile") = 1
 5           return X * factorial(X - 1);  5           return X * factorial(X - 1);
 6   @}  6   @}
 7   end$  7   end$
   \BJP
 (debug) stop at 5                     <-- $B%V%l!<%/%]%$%s%H$N@_Dj(B  (debug) stop at 5                     <-- $B%V%l!<%/%]%$%s%H$N@_Dj(B
 (0) stop at "./fac":5  (0) stop at "./fac":5
 (debug) quit                          <-- $B%G%P%C%0%b!<%I$rH4$1$k(B  (debug) quit                          <-- $B%G%P%C%0%b!<%I$rH4$1$k(B
Line 205  X = 5
Line 399  X = 5
 (debug) cont                          <-- $B<B9T7QB3(B  (debug) cont                          <-- $B<B9T7QB3(B
 720                                   <-- $B7k2L(B = 6!  720                                   <-- $B7k2L(B = 6!
 [5] quit;  [5] quit;
   \E
   \BEG
   (debug) stop at 5                     <-- setting a break point
   (0) stop at "./fac":5
   (debug) quit                          <-- leaving the debug-mode
   [4] factorial(6);                     <-- call for factorial(6)
   stopped in factorial at line 5 in file "./fac"
   5           return X * factorial(X - 1);
   (debug) where                         <-- display the calling sequence up to
   factorial(), line 5 in "./fac"            this break point
   (debug) print X                       <-- Display the value of X
   X = 6
   (debug) step                          <-- step execution (enters function)
   stopped in factorial at line 2 in file "./fac"
   2       if ( !X )
   (debug) where
   factorial(), line 2 in "./fac"
   factorial(), line 5 in "./fac"
   (debug) print X
   X = 5
   (debug) delete 0                      <-- delete the break point 0
   (debug) cont                          <-- continue execution
   720                                   <-- result = 6!
   [5] quit;
   \E
 @end example  @end example
   
   \BJP
 @node $B%G%P%C%,$N=i4|2=%U%!%$%k$NNc(B,,, $B%G%P%C%,(B  @node $B%G%P%C%,$N=i4|2=%U%!%$%k$NNc(B,,, $B%G%P%C%,(B
 @section $B%G%P%C%,$N=i4|2=%U%!%$%k$NNc(B  @section $B%G%P%C%,$N=i4|2=%U%!%$%k$NNc(B
   \E
   \BEG
   @node Sample file of initialization file for Debugger,,, Debugger
   @section Sample file of initialization file for Debugger
   \E
   
 @noindent  @noindent
   \BJP
 $BA0$K=R$Y$?DL$j(B, @b{Asir} $B$O(B, $B5/F0;~$K(B @samp{$HOME/.dbxinit} $B$rFI$_9~$`(B.  $BA0$K=R$Y$?DL$j(B, @b{Asir} $B$O(B, $B5/F0;~$K(B @samp{$HOME/.dbxinit} $B$rFI$_9~$`(B.
 $B$3$N%U%!%$%k$O(B, @code{dbx} $B$N$5$^$6$^$J=i4|@_DjMQ$N%3%^%s%I$r5-=R$7$F$*$/(B  $B$3$N%U%!%$%k$O(B, @code{dbx} $B$N$5$^$6$^$J=i4|@_DjMQ$N%3%^%s%I$r5-=R$7$F$*$/(B
 $B%U%!%$%k$G$"$k$,(B, @b{Asir} $B$O(B, @code{alias} $B9T$N$_$rG'<1$9$k(B. $BNc$($P(B,  $B%U%!%$%k$G$"$k$,(B, @b{Asir} $B$O(B, @code{alias} $B9T$N$_$rG'<1$9$k(B. $BNc$($P(B,
   \E
   \BEG
   As is previously mentioned, @b{Asir} reads in the file
   @samp{$HOME/.dbxinit} at its invocation.
   This file is originally used to define various initializing commands
   for @code{dbx} debugger, but @b{Asir} recognizes only @code{alias}
   lines. For example, by the setting
   \E
   
 @example  @example
 % cat ~/.dbxinit  % cat ~/.dbxinit
Line 228  alias q quit
Line 462  alias q quit
 @end example  @end example
   
 @noindent  @noindent
   \BJP
 $B$J$k@_Dj$K$h$j(B, @code{print}, @code{cont} $B$J$I(B, $B%G%P%C%0%b!<%I$K$*$$$F(B  $B$J$k@_Dj$K$h$j(B, @code{print}, @code{cont} $B$J$I(B, $B%G%P%C%0%b!<%I$K$*$$$F(B
 $BIQHK$KMQ$$$i$l$k%3%^%s%I$,(B, $B$=$l$>$l(B @code{p}, @code{c} $B$J$I(B, $BC;$$(B  $BIQHK$KMQ$$$i$l$k%3%^%s%I$,(B, $B$=$l$>$l(B @code{p}, @code{c} $B$J$I(B, $BC;$$(B
 $BJ8;zNs$GBeMQ$G$-$k(B. $B$^$?(B, $B%G%P%C%0%b!<%I$K$*$$$F(B, @code{alias} $B%3%^%s%I(B  $BJ8;zNs$GBeMQ$G$-$k(B. $B$^$?(B, $B%G%P%C%0%b!<%I$K$*$$$F(B, @code{alias} $B%3%^%s%I(B
 $B$K$h$j(B alias $B$NDI2C$,$G$-$k(B.  $B$K$h$j(B alias $B$NDI2C$,$G$-$k(B.
   \E
   \BEG
   one can use short aliases, e.g., @code{p}, @code{c} etc., for frequently
   used commands such as @code{print}, @code{cont} etc. One can create
   new aliases in the debug-mode during an execution.
   \E
   
 @example  @example
 lex_hensel(La,[a,b,c],0,[a,b,c],0);  lex_hensel(La,[a,b,c],0,[a,b,c],0);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>