Skip to content

Follow-up to P2546, "Debugging Support" #7642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions source/diagnostics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2447,10 +2447,13 @@
The semantics of this function are \impldef{semantics of \tcode{breakpoint}}.

\begin{note}
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.
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. In particular, there is no
intent for a call to this function to accomodate resumption of the program in a
different manner. If there is no debugger present, execution of the program can
end abnormally.
\end{note}

\end{itemdescr}
Expand Down Expand Up @@ -2491,12 +2494,13 @@
\impldef{default semantics of \tcode{is_debugger_present}}.

\begin{note}
When tracing the execution of a program with a debugger, an implementation
returns \tcode{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 \tcode{::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.
It is intended that, using an immediate (uncached) query to determine if the
program is being traced by a debugger, an implementation returns \tcode{true}
only when tracing the execution of the program with a debugger. On Windows or
equivalent systems, this can be achieved by calling the
\tcode{::IsDebuggerPresent()} Win32 function. For systems compatible with
ISO/IEC 23360:2021, this can be achieved by checking for a tracing process, with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This replaces "POSIX" with "Linux Standard Base". Is there a particular reason for that? Does POSIX not cover the needed functionality?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although ptrace is present in most UNIX-like systems, it isn't part of POSIX. The LSB is a much narrower scope than POSIX, but it is a standard, unlike families like "BSD" or "SysV". So if we want a standard that includes ptrace, LSB makes sense.

However, the wording never mentions prrace it just talks about "tracing" and "a tracer parent process" which is still meaningful even in e.g. HP-UX which replaced ptrace with ttrace, and in Solaris through ptrace but also via procfs. So maybe it's OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, the wording never mentions prrace it just talks about "tracing" and "a tracer parent process" which is still meaningful even in e.g. HP-UX which replaced ptrace with ttrace, and in Solaris through ptrace but also via procfs. So maybe it's OK.

Using "POSIX" in conjunction with the handwaving implies that the handwaving is necessarily meaningful for all possible implementations of POSIX. That it is probably meaningful for extant implementations of POSIX does not make me feel any better about using "POSIX" without qualification.

a best-effort determination that such a tracing process is a debugger.
\end{note}

\end{itemdescr}