Debug() inderstanding

After lots of internet search and reading, I have a lot of misinderstanding about debug() functionning.

1. Where debug() function search an executed function?

Sometimes debug() works, but often it don't works at all with the error:

debug> break SpPlot 5
debug> exec SpPlot()
Undefined variable: SpPlot

So, I wonder whether it looks for functions in the *.sce files of current folder, or in the currently open files in SciNotes, or somewhere else...

2. How to debug script file (not a function)?

All the examples show how to debug the simple function, but I can't apply it for entire script file.
How to put a break in the script file? How to execute the script file (under

Actually the single solution that I found is to wrap a script in the function,
but it isn't tidy (local variables transfer, etc.):


function Test()

3. How to debug the multifile scripts?

May be it will be clear from the responses to first 2 questions:
How to put a break in the underlying script?
How to run the higher level script during the underlying script debugging (e.g. for data acquision)?

Scilab 16-10-20, 8:02 p.m. WizKI

Log-in to answer to this question.