Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - 日本語 - Русский
Ajuda do Scilab >> Scilab > Debugging > debug


enters the Scilab debugger mode




debug enters the debug's mode for functions written in Scilab language. The prompt becomes debug>.

This mode allows you to manage breakpoints, launch execution with stop on error, execute a function step by step, ...

Commands available in debugging mode

h: Shows the debugger's help in the console.

help: In Scilab standard running mode (with GUIs), displays the debugger's help page in the help browser. Otherwise, displays the help in the console (as with "h").

(q)uit: Leaves the debug mode and returns to the normal Scilab mode.

(w)here or bt: Displays the callstack.

(e)xec or (r)un command : Executes the given Scilab command.

(d)isp var, or (p)rint var: Displays the value of the variable var.

(c)ontinue: Continues the execution.

(a)bort: Aborts the execution.

step(n)ext or next: Executes the next expression.

step(i)n or in: Executes the next expression in sub function.

step(o)ut or out: Executes the next expression in previous function.

(b)reakpoint or break: breakpoint function [line [condition]] : Adds a breakpoint in a function at line line. If a condition is specified, the breakpoint is enabled only if the condition is %t

(del)ete [n]: Removes all breakpoints. If n is specified: removes the breakpoint #n.

enable [n]: Enables all breakpoints. If n is specified: enables the breakpoint #n.

disable [n]: Disables all breakpoints. If n is specified: disables the breakpoint #n.

(s)how [n]: Shows all breakpoints information. If n is specified: shows the breakpoint #n.

How to debug a script

Debugging a series of Scilab instructions out of any function requires first to embed them in a dummy function. Example: We want to debug the following instructions

a = 1;
b = linspace(a, 3, 10);
c = exp(a + %i + c);

Then we must first rewrite them as

function script()
    a = 1;
    b = linspace(a, 3, 10);
    c = exp(a + %i + c);

and execute this code (in normal Scilab mode) in order to define script() in Scilab. Then breakpoints can be defined and handled within the script() function as for any other function.


//function to overload cosine on string
function v=%c_cos(val)
    printf("val : %s\n", val);
    v = cos(evstr(val));

function a=test_debug()
    b = cos("%pi");
    a = b * 3;

break test_debug
exec test_debug
disp val
function v=compute(val)
    v = 1;
    for i=1:val
        v = v * i;

break compute 4 "i == 5"
exec compute(10)
disp val
disp i
disp v


6.0.0 New version: console interface to Scilab 6 debugger.
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:35:18 CET 2022