[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Uninformative stack traces
From: |
Moritz Borgmann |
Subject: |
Uninformative stack traces |
Date: |
Thu, 27 Mar 2008 22:13:35 +0100 |
Let's run the following little function:
===
function test_error()
do_fail(0);
do_fail(1);
do_fail(0);
function do_fail(x)
if(x == 1)
error('Failure!');
end
===
then MATLAB outputs
===
test_error
??? Error using ==> test_error>do_fail
Failure!
Error in ==> test_error at 4
do_fail(1);
===
from which it is easy to see where the error occurred. However, Octave outputs:
===
octave:1> test_error
error: Failure!
error: evaluating if command near line 10, column 1
error: called from `do_fail' in file `..../test_error.m'
error: called from `test_error' in file `..../test_error.m'
===
Here, it is impossible to tell whether the error was triggered by the
calls on line 3, 4, or 5. This makes debugging quite hard in many
cases. Is this a known problem? Or am I possibly even overlooking a
simple fix, like some Octave configuration?
OTOH, is it necessary to log all control structures in the stack
trace, wouldn't the function calls suffice?
Cheers,
Moritz
- Uninformative stack traces,
Moritz Borgmann <=