Home Manual Packages Global Index Keywords Quick Reference |
#### 1.3.7.2 How to respond to a runtime error When 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:
    ERROR (damped_wave) math library exception handler called
      LINE: 19  FILE: /home/icf/munro/damped.i
     To enter debug mode, type <RETURN> now (then dbexit to get out)
    > amplitude = damped_wave(theta, 2.5)
    >
    ERROR (damped_wave) math library exception handler called
      LINE: 19  FILE: /home/icf/munro/damped.i
     To enter debug mode, type <RETURN> now (then dbexit to get out)
    >
    dbug>
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:
    dbug> nu; 1-nu*nu
    2
    -3
    dbug>
As soon as possible, you should escape from debug mode using the `dbexit` function:
    dbug> dbexit
    >
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.