Skip to content

Commit 1253184

Browse files
grafikrobottkoeppe
authored andcommitted
P2546R5 Debugging Support
Editorial notes: entries to the C++ headers table and the "new headers" compatibility statement have been added.
1 parent 31f4e1d commit 1253184

File tree

4 files changed

+91
-2
lines changed

4 files changed

+91
-2
lines changed

source/compatibility.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
New functionality.
8383
\effect
8484
The following \Cpp{} headers are new:
85+
\libheaderref{debugging},
8586
\libheaderrefx{hazard_pointer}{hazard.pointer.syn},
8687
\libheaderref{rcu}, and
8788
\libheaderrefx{text_encoding}{text.encoding.syn}.

source/lib-intro.tex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,15 +1132,16 @@
11321132
\tcode{<concepts>} \\
11331133
\tcode{<condition_variable>} \\
11341134
\tcode{<coroutine>} \\
1135+
\tcode{<debugging>} \\
11351136
\tcode{<deque>} \\
11361137
\tcode{<exception>} \\
11371138
\tcode{<execution>} \\
11381139
\tcode{<expected>} \\
11391140
\tcode{<filesystem>} \\
11401141
\tcode{<flat_map>} \\
11411142
\tcode{<flat_set>} \\
1142-
\tcode{<format>} \\
11431143
\columnbreak
1144+
\tcode{<format>} \\
11441145
\tcode{<forward_list>} \\
11451146
\tcode{<fstream>} \\
11461147
\tcode{<functional>} \\
@@ -1537,6 +1538,7 @@
15371538
\ref{algorithms} & Algorithms library & \tcode{<algorithm>}, \tcode{<numeric>} \\ \rowsep
15381539
\ref{c.math} & Mathematical functions for floating-point types & \tcode{<cmath>} \\ \rowsep
15391540
\ref{atomics} & Atomics & \tcode{<atomic>} \\ \rowsep
1541+
\ref{debugging} & Debugging & \tcode{<debugging>} \\ \rowsep
15401542
\end{libsumtab}
15411543

15421544
\pnum

source/support.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@
619619
// \libheader{deque}, \libheader{queue}, \libheader{stack}, \libheader{string}
620620
#define @\defnlibxname{cpp_lib_copyable_function}@ 202306L // also in \libheader{functional}
621621
#define @\defnlibxname{cpp_lib_coroutine}@ 201902L // also in \libheader{coroutine}
622+
#define @\defnlibxname{cpp_lib_debugging}@ 202311L // freestanding, also in \libheader{debugging}
622623
#define @\defnlibxname{cpp_lib_destroying_delete}@ 201806L // freestanding, also in \libheader{new}
623624
#define @\defnlibxname{cpp_lib_enable_shared_from_this}@ 201603L // also in \libheader{memory}
624625
#define @\defnlibxname{cpp_lib_endian}@ 201907L // freestanding, also in \libheader{bit}

source/utilities.tex

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
\ref{execpol} & Execution policies & \tcode{<execution>} \\ \rowsep
2424
\ref{charconv} & Primitive numeric conversions & \tcode{<charconv>} \\ \rowsep
2525
\ref{format} & Formatting & \tcode{<format>} \\ \rowsep
26-
\ref{bit} & Bit manipulation & \tcode{<bit>} \\
26+
\ref{bit} & Bit manipulation & \tcode{<bit>} \\ \rowsep
27+
\ref{debugging} & Debugging & \tcode{<debugging>} \\
2728
\end{libsumtab}
2829

2930
\rSec1[utility]{Utility components}
@@ -19170,3 +19171,87 @@
1917019171
Otherwise, \tcode{endian::native} is not equal
1917119172
to either \tcode{endian::big} or \tcode{endian::little}.
1917219173
\end{itemdescr}
19174+
19175+
\rSec1[debugging]{Debugging}
19176+
19177+
\rSec2[debugging.general]{General}
19178+
19179+
\pnum
19180+
Subclause \ref{debugging} describes functionality to introspect and
19181+
interact with the execution of the program.
19182+
19183+
\begin{note}
19184+
The facilities provided by the debugging functionality interact with a program
19185+
that could be tracing the execution of a \Cpp{} program, such as a debugger.
19186+
\end{note}
19187+
19188+
\rSec2[debugging.syn]{Header \tcode{<debugging>} synopsis}
19189+
19190+
\indexheader{debugging}%
19191+
\begin{codeblock}
19192+
// all freestanding
19193+
namespace std {
19194+
// \ref{debugging.utility}, utility
19195+
void breakpoint() noexcept;
19196+
void breakpoint_if_debugging() noexcept;
19197+
bool is_debugger_present() noexcept;
19198+
}
19199+
\end{codeblock}
19200+
19201+
\rSec2[debugging.utility]{Utility}
19202+
19203+
\indexlibraryglobal{breakpoint}%
19204+
\begin{itemdecl}
19205+
void breakpoint() noexcept;
19206+
\end{itemdecl}
19207+
19208+
\begin{itemdescr}
19209+
19210+
\pnum
19211+
The semantics of this function are \impldef{semantics of \tcode{breakpoint}}.
19212+
19213+
\begin{note}
19214+
When invoked, the execution of the program temporarily halts and execution is
19215+
handed to the debugger until such a time as: The program is terminated by the
19216+
debugger, or the debugger resumes execution of the program as if the function
19217+
was not invoked.
19218+
\end{note}
19219+
19220+
\end{itemdescr}
19221+
19222+
\indexlibraryglobal{breakpoint_if_debugging}%
19223+
\begin{itemdecl}
19224+
void breakpoint_if_debugging() noexcept;
19225+
\end{itemdecl}
19226+
19227+
\begin{itemdescr}
19228+
19229+
\pnum
19230+
\effects
19231+
Equivalent to:
19232+
\begin{codeblock}
19233+
if (is_debugger_present()) breakpoint();
19234+
\end{codeblock}
19235+
19236+
\end{itemdescr}
19237+
19238+
\indexlibraryglobal{is_debugger_present}%
19239+
\begin{itemdecl}
19240+
bool is_debugger_present() noexcept;
19241+
\end{itemdecl}
19242+
19243+
\begin{itemdescr}
19244+
19245+
\pnum
19246+
The semantics of this function are \impldef{semantics of \tcode{is_debugger_present}}.
19247+
19248+
\begin{note}
19249+
When tracing the execution of a program with a debugger, an implementation
19250+
returns \tcode{true}. An implementation performs an immediate query, as needed,
19251+
to determine if the program is traced by a debugger. On Windows or equivalent
19252+
systems, this can be achieved by calling the \tcode{::IsDebuggerPresent()} Win32
19253+
function. On POSIX, this can be achieved by checking for a tracer parent process,
19254+
with best effort determination that such a tracer parent process is a debugger.
19255+
\end{note}
19256+
19257+
\end{itemdescr}

0 commit comments

Comments
 (0)