Debugger

Usage

use Debugger;

or

import Debugger;

Warning

The Debugger module is unstable due to its experimental behavior

Provides a collection of useful debugging utilities.

The Debugger module currently provides two functions: breakpoint and debugTrap. Both functions can be used to set breakpoints in your code when using a debugger. Users should prefer using the breakpoint function, as it is more portable and easier to use.

The debugTrap function is a lower-level function that raises a debug trap exception. This function is useful for testing purposes, but can crash the program if used and no debugger is attached.

proc breakpoint

Sets a breakpoint at this point in execution.

This only works if a breakpoint is set on the ‘debuggerBreakHere’ function with b debuggerBreakHere. If using --gdb or --lldb, this is done automatically.

config param disableDebugTraps = false

If disableDebugTraps is set to true, then the debugTrap function will not raise a debug trap exception.

This is useful for testing purposes, as it allows code to be left unchanged and still be able to run without a debugger attached.

proc debugTrap

Raises a debug trap exception. Using this function will cause the program automatically stop at a breakpoint if a debugger is attached. If no debugger is attached, the program will terminate with a message indicating that a debug trap was raised.