3.4 Debbuging

The simplest way to debug a Scilab function is to introduce a pause command in the function. When executed the function stops at this point and prompts -1-> which indicates a different ``level''; another pause gives -2-> ... At the level 1 the Scilab commands are analog to a different session but the user can display all the current variables present in Scilab, which are inside or outside the function i.e. local in the function or belonging to the calling environment. The execution of the function is resumed by the command return or resume (the variables used at the upper level are cleaned). The execution of the function can be interrupted by abort.

It is also possible to insert breakpoints in functions. See the commands setbpt, delbpt, disbpt. Finally, note that it is also possible to trap errors during the execution of a function: see the commands errclear and errcatch. Finally the experts in Scilab can use the function debug(i) where i=0,..,4 denotes a debugging level.