1Function: dbg_down
2Class: gp
3Section: programming/control
4C-Name: dbg_down
5Prototype: vD1,L,
6Help: dbg_down({n=1}): (break loop) go down n frames. Cancel a previous dbg_up.
7Doc: (In the break loop) go down n frames. This allows to cancel a previous
8 call to \kbd{dbg\_up}.
9 \bprog
10 ? x = 0;
11 ? g(x) = x-3;
12 ? f(x) = 1 / g(x+1);
13 ? for (x = 1, 5, f(x+1))
14    ***   at top-level: for(x=1,5,f(x+1))
15    ***                           ^-------
16    ***   in function f: 1/g(x+1)
17    ***                   ^-------
18    *** _/_: impossible inverse in gdiv: 0.
19    ***   Break loop: type 'break' to go back to GP prompt
20 break> dbg_up(3) \\ go up 3 frames
21   ***   at top-level: for(x=1,5,f(x+1))
22   ***                 ^-----------------
23 break> x
24 0
25 break> dbg_down()
26   ***   at top-level: for(x=1,5,f(x+1))
27   ***                           ^-------
28 break> x
29 1
30 break> dbg_down()
31   ***   at top-level: for(x=1,5,f(x+1))
32   ***                           ^-------
33 break> x
34 1
35 break> dbg_down()
36   ***   at top-level: for(x=1,5,f(x+1))
37   ***                           ^-------
38   ***   in function f: 1/g(x+1)
39   ***                   ^-------
40 break> x
41 2
42 @eprog\noindent The above example shows that the notion of GP frame is
43 finer than the usual stack of function calls (as given for instance by the
44 GDB \kbd{backtrace} command): GP frames are attached to variable scopes
45 and there are frames attached to control flow instructions such as a
46 \kbd{for} loop above.
47