Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/breakpoint if debugging"

From cppreference.com
< cpp‎ | utility
(FTM update.)
m (fmt {{c multi}} block.)
Line 7: Line 7:
 
Conditional breakpoint: attempts to temporarily halt the execution of the program and transfer control to the debugger if it were able to determine that the debugger is present. Acts as a no-op otherwise.
 
Conditional breakpoint: attempts to temporarily halt the execution of the program and transfer control to the debugger if it were able to determine that the debugger is present. Acts as a no-op otherwise.
  
Formally, the behavior of this function is completely implementation-defined.
+
Formally, the behavior of this function is completely implementation-defined. Equivalent to
 
+
{{c multi|
Equivalent to {{c multi|if (std::is_debugger_present())|   std::breakpoint();}}.
+
if (std::is_debugger_present())|
 +
    std::breakpoint();
 +
}}.
  
 
===Notes===
 
===Notes===

Revision as of 14:49, 1 May 2024

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
Defined in header <debugging>
void breakpoint_if_debugging() noexcept;
(since C++26)

Conditional breakpoint: attempts to temporarily halt the execution of the program and transfer control to the debugger if it were able to determine that the debugger is present. Acts as a no-op otherwise.

Formally, the behavior of this function is completely implementation-defined. Equivalent to if (std::is_debugger_present())
    std::breakpoint();
.

Notes

Feature-test macro Value Std Feature
__cpp_lib_debugging 202311L (C++26) Debugging support library
202403L (C++26) Replaceable std::is_debugger_present

Example

See also

checks whether a program is running under the control of a debugger
(function) [edit]
pauses the running program when called
(function) [edit]