i1 : stopIfError = false; debuggingMode = true; -- skip for live demo
|
i3 : get "debugger-demo.m2"
o3 = f := (x,y,z) -> (
m := x+y;
n := x^y;
1/z)
g = (r,s) -> (
print "entering g";
return 17 * f(r,s,0);
)
|
i4 : load "debugger-demo.m2"
|
i5 : g(2,100)
entering g
debugger-demo.m2:4:7:(2):[4]: division by zero
debugger-demo.m2:4:7:(2):[4]: --entering debugger--
-- useful debugger commands:
break -- leave the debugger, returning to top level
end -- abandon the code, enter debugger one level up
listLocalSymbols -- display local symbols and their values
listUserSymbols -- display user symbols and their values
continue -- execute the code and continue
continue n -- execute the code, stop after n microsteps
return -- bypass code, return 'null', and continue
return x -- bypass code, return 'x', and continue
value errorCode -- execute the code, returning its value
-- code just attempted: -- debugger-demo.m2:4
1/z)
|
ii6 : listLocalSymbols
oo6 = symbol class value location of symbol
------ ----- ----- ------------------
x : ZZ -- 2 debugger-demo.m2:1:6-1:6
y : ZZ -- 100 debugger-demo.m2:1:8-1:8
z : ZZ -- 0 debugger-demo.m2:1:10-1:10
m : ZZ -- 102 debugger-demo.m2:2:5-2:5
n : ZZ -- 1267650600228229401496703205376 debugger-demo.m2:3:5-3:5
f : FunctionClosure -- ... debugger-demo.m2:1:0-1:0
|
ii7 : listUserSymbols
oo7 = symbol class value location of symbol
------ ----- ----- ------------------
g : FunctionClosure -- g debugger-demo.m2:6:0-6:0
|
ii8 : code g
oo8 = -- debugger-demo.m2:6-9
g = (r,s) -> (
print "entering g";
return 17 * f(r,s,0);
)
|
ii9 : code f
oo9 = -- debugger-demo.m2:1-4
f := (x,y,z) -> (
m := x+y;
n := x^y;
1/z)
|
ii10 : value errorCode
debugger-demo.m2:4:7:(2):[0]: division by zero
stdio:5:1:(2):[0]: --back trace--
|
ii11 : z = 12345
oo11 = 12345
|
ii12 : value errorCode
1
oo12 = -----
12345
oo12 : QQ
|
ii13 : continue
--leaving debugger--
17
o13 = -----
12345
o13 : QQ
|