std::breakpoint
(C++17)<debugging>
Unconditional breakpoint: Attempts to temporarily stop program execution and pass control to the debugger, regardless of whether the presence of a debugger can be detected. The behavior of this function is implementation-defined.
Contents
[edit] Notes
The intent of this function is allowing for runtime control of breakpoints beyond what might be available from a debugger while not causing the program to exit. For example, breaking when an infrequent non-critical condition is detected, allowing programmatic control with complex runtime sensitive conditions, breaking on user input to inspect context in interactive programs without needing to switch to the debugger application, etc.
This function standardizes many similar existing facilities: __builtin_debugtrap
from LLVM, __debugbreak
from Win32 API, debugger_break
from boost.test, assert (false), _asm { int 3 } (MSVC) and asm("int3") (GCC/clang) for x86 targets, etc.
Feature-test macro | Value | Std | Feature |
---|---|---|---|
__cpp_lib_debugging |
202311L |
(C++26) | Debugging support library |
202403L |
(C++26) | Replaceable std::is_debugger_present
|
[edit] Example
Reason: no example
[edit] See also
[edit] External links
__breakpoint
intrinsic
EASTL_DEBUG_BREAK
CATCH_TRAP
and CATCH_BREAK_INTO_DEBUGGER
DebugBreak
JUCE_BREAK_IN_DEBUGGER
IM_DEBUG_BREAK
aws_debug_break