Import std.debug.debugger
std.debug.debugger
Breakpoints in code, and whether a debugger is attached.
Breakpoint and IsDebuggerAttached, for a program's own debugging: a breakpoint written in its code, which stops in the debugger that's attached, and asking whether one is. Each asks the OS through the runtime.
Examples
If IsDebuggerAttached() Then Print("a debugger is attached")
// Stops in a debugger, and does nothing without one.
Breakpoint()std/debug/debugger.fb
Functions
IsDebuggerAttached
function
Public Function IsDebuggerAttached(): Bool
Whether a debugger is attached to the program, as the OS says: Windows', macOS's, and Linux's tell it, and another's is always False.
Breakpoint
function
Public Function Breakpoint()
Stops in the debugger that's attached, as a breakpoint set there would, and does nothing when none is, so one left in a program that runs without a debugger doesn't end it, nor one that runs under a tracer that hands the trap back, as strace does.
Examples
// Stops here in a debugger, and goes on without one.
If IsDebuggerAttached() Then Breakpoint()Report an issue with this page or with FutureBlitz on GitHub.