gap
gap copied to clipboard
Bug in interaction of `DownEnv`, `UpEnv`, and `Where`
In a break loop, according to the manual DownEnv
and UpEnv
move through the function stack and Where
should adjust its output to where we are in the stack. However, the latter part currently does not work. This is what happens when I run the example from the manual in 6.5-1 DownEnv and UpEnv
(doc/ref/mloops.xml
), also I had to turn a Where(0);
into a Where();
since otherwise it doesn't show a trace at all:
gap> OnBreak := function() Where(); end;; # eliminate back-tracing on
gap> # entry to break loop
gap> test:= function( n )
> if n > 3 then Error( "!\n" ); fi; test( n+1 ); end;;
gap> test( 1 );
Error, !
at *stdin*:36 called from
test( n + 1 ); at *stdin*:36 called from
test( n + 1 ); at *stdin*:36 called from
test( n + 1 ); at *stdin*:36 called from
<function "test">( <arguments> )
called from read-eval loop at *stdin*:39
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> DownEnv(); n; Where();
3
test( n + 1 ); at *stdin*:36 called from
test( n + 1 ); at *stdin*:36 called from
test( n + 1 ); at *stdin*:36 called from
<function "test">( <arguments> )
called from read-eval loop at *errin*:1
brk> DownEnv(); n; Where();
2
test( n + 1 ); at *stdin*:36 called from
test( n + 1 ); at *stdin*:36 called from
test( n + 1 ); at *stdin*:36 called from
<function "test">( <arguments> )
called from read-eval loop at *errin*:2
Also, that example is a Log
and thus not run by the test suite. It should be changed into an Example
if possible.
This is not a regression in the sense of the label here, which is defined (see mouse over) as a bug that exists in the branch but not the previous release. But in fact the above behavior exists in GAP 4.5 and later.
However, this indeed does work correctly in GAP 4.4, so yeah, it used to be different, but a looong time ago.
Anyway, perhaps we could "fix" it, but what I'd really like to have is something like what I described here. And more (e.g. an easy way to see the full current frame, and in general more debugging features similar to what gdb and lldb offer, see issue #994)
This is not a regression in the sense of the label here, which is defined (see mouse over) as a bug that exists in the branch but not the previous release. But in fact the above behavior exists in GAP 4.5 and later.
Oh, really? I thought I tried it with a "recent" release and it worked, but then I'm probably misremembering.