83 lines
2.6 KiB
Markdown
83 lines
2.6 KiB
Markdown
[debugging.utility]
|
||
|
||
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
|
||
|
||
## 19.7 Debugging [[debugging]](debugging#utility)
|
||
|
||
### 19.7.3 Utility [debugging.utility]
|
||
|
||
[ð](#lib:breakpoint)
|
||
|
||
`void breakpoint() noexcept;
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2444)
|
||
|
||
The semantics of this function are implementation-defined[.](#1.sentence-1)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
It is intended that, when invoked with a debugger present, the execution of the
|
||
program temporarily halts and execution is handed to the debugger until the
|
||
program is either terminated by the debugger or the debugger resumes execution
|
||
of the program as if the function was not invoked[.](#1.sentence-2)
|
||
|
||
In particular, there is no
|
||
intent for a call to this function to accomodate resumption of the program in a
|
||
different manner[.](#1.sentence-3)
|
||
|
||
If there is no debugger present, execution of the program can
|
||
end abnormally[.](#1.sentence-4)
|
||
|
||
â *end note*]
|
||
|
||
[ð](#lib:breakpoint_if_debugging)
|
||
|
||
`void breakpoint_if_debugging() noexcept;
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2466)
|
||
|
||
*Effects*: Equivalent to:if (is_debugger_present()) breakpoint();
|
||
|
||
[ð](#lib:is_debugger_present)
|
||
|
||
`bool is_debugger_present() noexcept;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2481)
|
||
|
||
*Required behavior*: This function has no preconditions[.](#3.sentence-1)
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2485)
|
||
|
||
*Default behavior*: implementation-defined[.](#4.sentence-1)
|
||
|
||
[*Note [2](#note-2)*:
|
||
|
||
It is intended that, using an immediate (uncached) query to determine if the
|
||
program is being traced by a debugger, an implementation returns true only when tracing the execution of the program with a debugger[.](#4.sentence-2)
|
||
|
||
On Windows or
|
||
equivalent systems, this can be achieved by calling the::IsDebuggerPresent() Win32 function[.](#4.sentence-3)
|
||
|
||
For systems compatible with
|
||
ISO/IEC 23360:2021, this can be achieved by checking for a tracing process, with
|
||
a best-effort determination that such a tracing process is a debugger[.](#4.sentence-4)
|
||
|
||
â *end note*]
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L2499)
|
||
|
||
*Remarks*: This function is replaceable ([[dcl.fct.def.replace]](dcl.fct.def.replace#term.replaceable.function "9.6.5 Replaceable function definitions"))[.](#5.sentence-1)
|