Next: , Previous: Errors and Warnings, Up: Top


13 Debugging

Octave includes a built-in debugger to aid in the development of scripts. This can be used to interrupt the execution of an Octave script at a certain point, or when certain conditions are met. Once execution has stopped, and debug mode is entered, the symbol table at the point where execution has stopped can be examined and modified to check for errors.

The normal commandline editing and history functions are available in debug mode. However, one limitation on the debug mode is that commands entered at the debug prompt are evaluated as strings, rather than being handled by the Octave parser. This means that all commands in debug mode must be contained on a single line. That is, it is alright to write

     debug> for i = 1:n, foo(i); endfor

in debug mode. However, writing the above in three lines will not be correctly evaluated. To leave the debug mode, you should simply type either quit, exit, return or dbcont.