1.3.7.2 How to respond to a runtime errorWhen Yorick stops with a runtime error, you have a choice: You can either type the next statment you want to execute, or you can type a carriage return (that is, a blank line) to enter debug mode. The two possibilities would look like this:
In the second case, you have entered debug mode, and the dbug> prompt appears. In debug mode, Yorick leaves the function which was executing and its entire calling chain intact. You can type any Yorick statement; usually you will print some values or plot some arrays to try to determine what went wrong. When you reference or modify a variable which is local to the function, you will "see" its local value:
As soon as possible, you should escape from debug mode using the dbexit function:
You may also be able to repair the function's local variables and resume execution. To modify the value of a variable, simply redefine it with an ordinary Yorick statement. The dbcont function continues execution, beginning by re-executing the statement which failed to complete. Use the help function (see section 1.3.3 The help function) to learn about the other debugging functions; the help for the dbexit function describes them all. |