std::breakpoint(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so this is the std::breakpoint(3) page from the C++ Standard Libary manual, and the NAME section is literally std::breakpoint - std::breakpoint. no extra notes, just iconic behavior πŸ’….

🧚 Synopsis 🧚

bestie, here’s the exact synopsis block, no cap:

Defined in header <debugging>
void breakpoint() noexcept;    (since C++26)

This is the unconditional breakpoint: it attempts to temporarily halt the execution of the program and transfer control to the debugger, whether or not it's not possible to determine if the debugger is present.

🚨 Formally, the behavior of this function is completely implementation-defined. 🚨

πŸ¦‹ 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

  • __cpp_lib_debugging β€” value 202311L β€” std (C++26) β€” feature: Debugging support library
  • __cpp_lib_debugging β€” value 202403L β€” std (C++26) β€” feature: Replaceable std::is_debugger_present

πŸ™ˆ Example πŸ™ˆ

This section is incomplete Reason: no example

πŸ‘€ See also πŸ‘€

  • is_debugger_present β€” checks whether a program is running under the control of a debugger β€” (C++26) (function)
  • breakpoint_if_debugging β€” calls std::breakpoint if std::is_debugger_present returns true β€” (C++26) (function)
  1. armKEIL: __breakpoint intrinsic
  2. Portable Snippets: Debugging assertions and traps
  3. EASTL: EASTL_DEBUG_BREAK
  4. Catch2: CATCH_TRAP and CATCH_BREAK_INTO_DEBUGGER
  5. Unreal Engine: DebugBreak
  6. JUCE: JUCE_BREAK_IN_DEBUGGER
  7. Dear ImGui: IM_DEBUG_BREAK
  8. AWS C Common: aws_debug_break

πŸ“ Category πŸ“

  • * Todo no example

πŸ’œ cute sign-off: source/version http://cppreference.com β€” date 2024.06.10 β€” page std::breakpoint(3) β€” mwah πŸ’œ

πŸ“¦ where this page comes from