]> Savannah Git Hosting - gnulib.git/commitdiff
abort-debug: Document better.
authorBruno Haible <bruno@clisp.org>
Thu, 18 Jul 2024 20:40:07 +0000 (22:40 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 18 Jul 2024 20:40:07 +0000 (22:40 +0200)
Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00154.html>.

* lib/stdlib.in.h (abort): Add comment.
* doc/stack-trace.texi: Document what to do in signal handlers.

ChangeLog
doc/stack-trace.texi
lib/stdlib.in.h

index ee73f00cc8950748139377086ebd80090f946172..d1a64b687742589f46754db03a778dfa88c1e24f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-07-18  Bruno Haible  <bruno@clisp.org>
+
+       abort-debug: Document better.
+       Suggested by Paul Eggert in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00154.html>.
+       * lib/stdlib.in.h (abort): Add comment.
+       * doc/stack-trace.texi: Document what to do in signal handlers.
+
 2024-07-18  Alejandro Colomar  <alx@kernel.org>
 
        xstrtol: Strengthen sanity check.
index e7fc453d88e8674bed24fd8576418cd6545552c7..1b266c0cbddbf301ef3196245359e672b1a820d2 100644 (file)
@@ -65,3 +65,9 @@ it prints the stack trace of the current thread, before actually aborting.
 Thus, @code{abort ()} remains the idiom of choice
 for signaling a fatal situation that requires developer attention:
 it is useful both in debugging environments and production code.
+
+Note:
+While the original @code{abort} function is safe to call in signal handlers,
+the overridden @code{abort} function is not.
+In signal handlers, you will need to call the original @code{abort} function,
+by doing @code{#undef abort} first.
index 7c6daa58b8b33201943e6b8291f0853599e99538..d86b3ad53c6649728ce0fd0c50728b366db90c7f 100644 (file)
@@ -241,6 +241,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
 
 
 #if @GNULIB_ABORT_DEBUG@
+/* Terminates the current process with signal SIGABRT.
+   Note: While the original abort() function is safe to call in signal handlers,
+   the overridden abort() function is not.  */
 # if @REPLACE_ABORT@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef abort