Skip to main content

Breakpoints

A powerful mechanism for debugging a program is to set breakpoints during the debugging session. The breakpoints are designated by a target variable name, a [module.]function name, or a MAL line number (#<number>).

The snippet below illustrates the reaction to set a break point on assignment to variable 'i'.

     mal>mdb.start();
     #end main;
     mdb>
     mal>user.test(1);
     #    user.test(1);
     mdb>break i
     breakpoint on 'i' not set
     mdb>n
     #    io.print(i);
     mdb>break i
     mdb>c
     [ 1 ]
     #    i := calc.*(i,2);
     mdb>

The breakpoints remain in effect over multiple function calls. They can be removed with the delete statement. A list of all remaining breakpoints is obtained with breakpoints.

The interpreter can be instructed to call the debugger as soon as an exception is raised. Simply add the instruction mdb.setCatch(true).