22 General utilities library [utilities]

22.16 Debugging [debugging]

22.16.3 Utility [debugging.utility]

void breakpoint() noexcept;
The semantics of this function are implementation-defined.
[Note 1: 
When invoked, the execution of the program temporarily halts and execution is handed to the debugger until such a time as: The program is terminated by the debugger, or the debugger resumes execution of the program as if the function was not invoked.
— end note]
void breakpoint_if_debugging() noexcept;
Effects: Equivalent to: if (is_debugger_present()) breakpoint();
bool is_debugger_present() noexcept;
Replaceable: A C++ program may define a function with this function signature, and thereby displace the default version defined by the C++ standard library.
Required behavior: This function has no preconditions.
Default behavior: implementation-defined.
[Note 2: 
When tracing the execution of a program with a debugger, an implementation returns true.
An implementation performs an immediate query, as needed, to determine if the program is traced by a debugger.
On Windows or equivalent systems, this can be achieved by calling the ​::​IsDebuggerPresent() Win32 function.
On POSIX, this can be achieved by checking for a tracer parent process, with best effort determination that such a tracer parent process is a debugger.
— end note]