From 6e3a4b5f1575ea73b490f85f5471731188e8c8f6 Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Thu, 13 Feb 2025 17:44:59 -0500 Subject: [PATCH 1/7] Re-word `breakpoint` to fix untrue statement-of-fact The note in `breakpoint` makes a statement of fact about the implementation-defined behaviour. The statement is actually one of intent. --- source/diagnostics.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 6d9ff60a47..2f4879ede1 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2447,10 +2447,10 @@ 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. \end{note} \end{itemdescr} From fe98e6e6c0f5dee553c58bb8d0d45b5077eda53b Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Thu, 13 Feb 2025 17:46:26 -0500 Subject: [PATCH 2/7] Case where resumption does not resume as if the function is invoked Regarding `breakpoint`: The specific claim that the debugger resumes execution of the program as if the function was not invoked is confusing considering that the debugger may effect side-effects or cause execution to resume from a different evaluation. Instead, the idea is that `breakpoint` is not responsible for causing the translation process to make special accomodations for resumption of execution other than in cases where the debugger was strictly used for observation only. --- source/diagnostics.tex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 2f4879ede1..73a7d99e44 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2450,7 +2450,9 @@ 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. +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. \end{note} \end{itemdescr} From d817067cb538ea152cc830232c1269ff310b6067 Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Thu, 13 Feb 2025 17:55:20 -0500 Subject: [PATCH 3/7] breakpoint when no debugger is present Describe the possibility of abend. --- source/diagnostics.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 73a7d99e44..3dfcccf132 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2452,7 +2452,7 @@ 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. +different manner. If there is no debugger present, the program can abend. \end{note} \end{itemdescr} From 4d24c660ccbec994fed4c82638a533c8b4bab014 Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Thu, 13 Feb 2025 18:14:12 -0500 Subject: [PATCH 4/7] is_debugger_present: Fix unsupported statement-of-fact The note in the description of `is_debugger_present` reads as a statement of fact about the normatively implementation-defined behaviour. Fix this to read as a statement of intent. --- source/diagnostics.tex | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 3dfcccf132..4e3c6745f9 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2493,12 +2493,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, when tracing the execution of a program with a debugger, an +implementation returns \tcode{true} with the use of an immediate query, as +needed, to determine if the program is being 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. \end{note} \end{itemdescr} From a5c7585b7badbc5cdec60a5afc1c001030abc624 Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Thu, 13 Feb 2025 18:30:38 -0500 Subject: [PATCH 5/7] is_debugger_present: ptrace is not POSIX; LSB uses "tracing process" The functionality ascribed to POSIX by the wording is not present in POSIX. Update to reference the LSB and to use the corresponding terminology. --- source/diagnostics.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 4e3c6745f9..0f6f06d687 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2497,9 +2497,9 @@ implementation returns \tcode{true} with the use of an immediate query, as needed, to determine if the program is being 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. +\tcode{::IsDebuggerPresent()} Win32 function. For systems compatible with +ISO/IEC 23360:2021, this can be achieved by checking for a tracing process, with +best effort determination that such a tracing process is a debugger. \end{note} \end{itemdescr} From 67706d2cba6aebc71c62b749d1d165542708d7e3 Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Thu, 13 Feb 2025 19:24:32 -0500 Subject: [PATCH 6/7] is_debugger_present: Clarify intent to avoid false positives The wording implies a preference to return `true` in case it is unknown whether a debugger is present. Add a critical "only" to fix that. --- source/diagnostics.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 0f6f06d687..d9053a90c0 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2493,13 +2493,13 @@ \impldef{default semantics of \tcode{is_debugger_present}}. \begin{note} -It is intended that, when tracing the execution of a program with a debugger, an -implementation returns \tcode{true} with the use of an immediate query, as -needed, to determine if the program is being traced by a debugger. On Windows or +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 -best effort determination that such a tracing process is a debugger. +a best-effort determination that such a tracing process is a debugger. \end{note} \end{itemdescr} From cb8fc3101345902b0b8f2000089a0d808e06c662 Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Fri, 14 Feb 2025 05:50:22 -0400 Subject: [PATCH 7/7] Replace newly added "abend" Address review feedback ("abend" is not a well-known term). --- source/diagnostics.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/diagnostics.tex b/source/diagnostics.tex index d9053a90c0..7ff6612054 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -2452,7 +2452,8 @@ 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, the program can abend. +different manner. If there is no debugger present, execution of the program can +end abnormally. \end{note} \end{itemdescr}