Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » debugging » breakpoint
next | previous | forward | backward | up | index | toc

breakpoint -- set a breakpoint to stop execution at a particular point in the code and enter the debugger

Description

Setting a breakpoint is a way to stop execution at a particular point in the code and enter the debugger. Then, commands like step continue finish and so on as in the following demonstration.

i1 : load "Macaulay2Doc/demos/demo2.m2"
i2 : code h

o2 = /home/m2user/work/passagemath/passagemath/local/var/tmp/sage/build/
     macaulay2-1.26.06/src/M2/Macaulay2/packages/Macaulay2Doc/demos/demo2.m2:
     28:4-33:1: --source code:
     h = t -> (
          x := 1;
          breakpoint y := t+1;
          z := 1/t;
          w := x+t;
     )
i3 : h 1 
${prefix}/share/Macaulay2/Macaulay2Doc/demos/demo2.m2:30:22:(3): entering debugger (enter 'help' to see commands)
/home/m2user/work/passagemath/passagemath/local/var/tmp/sage/build/macaulay2-
1.26.06/src/M2/Macaulay2/packages/Macaulay2Doc/demos/demo2.m2:30:16-30:24:
--source code:
     breakpoint y := t+1;
ii4 : step 
${prefix}/share/Macaulay2/Macaulay2Doc/demos/demo2.m2:30:22:(3):[2]: unhandled step command
${prefix}/share/Macaulay2/Macaulay2Doc/demos/demo2.m2:31:11:(3):[2]: --stepping limit reached
${prefix}/share/Macaulay2/Macaulay2Doc/demos/demo2.m2:31:11:(3): entering debugger (enter 'help' to see commands)
/home/m2user/work/passagemath/passagemath/local/var/tmp/sage/build/macaulay2-
1.26.06/src/M2/Macaulay2/packages/Macaulay2Doc/demos/demo2.m2:31:5-31:13:
--source code:
     z := 1/t;
ii5 : finish 
stdio:3:1:(3):[1]: --done stepping, returning to top level

See also

For the programmer

The object breakpoint is a keyword.


The source of this document is in Macaulay2Doc/ov_debugging.m2:626:0.