[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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.
% asir [0] load("fac")$ [3] debug$ (debug) list factorial 1 def factorial(X) { 2 if ( !X ) 3 return 1; 4 else 5 return X * factorial(X - 1); 6 } 7 end$ (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 factorial(), line 5 in "./fac" up to 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;
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] |
This document was generated on October 6, 2024 using texi2html 5.0.