]> Savannah Git Hosting - gnulib.git/commitdiff
abort-debug: Export the print_stack_trace function.
authorBruno Haible <bruno@clisp.org>
Thu, 18 Jul 2024 01:07:30 +0000 (03:07 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 18 Jul 2024 01:07:30 +0000 (03:07 +0200)
* lib/stdlib.in.h (print_stack_trace): Renamed from _gl_pre_abort.
* lib/abort-debug.c (print_stack_trace_to): Renamed from
print_stack_trace.
(print_stack_trace): Renamed from _gl_pre_abort.
(rpl_abort): Update.
* tests/macros.h (ASSERT, ASSERT_NO_STDIO): Update.

ChangeLog
lib/abort-debug.c
lib/stdlib.in.h
tests/macros.h

index b80ca078d51920cdb3ae1298926bf3aafdf14347..7b39f40541ee67f9c1dfcfb2b508f9bf413ef623 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-07-17  Bruno Haible  <bruno@clisp.org>
+
+       abort-debug: Export the print_stack_trace function.
+       * lib/stdlib.in.h (print_stack_trace): Renamed from _gl_pre_abort.
+       * lib/abort-debug.c (print_stack_trace_to): Renamed from
+       print_stack_trace.
+       (print_stack_trace): Renamed from _gl_pre_abort.
+       (rpl_abort): Update.
+       * tests/macros.h (ASSERT, ASSERT_NO_STDIO): Update.
+
 2024-07-17  Bruno Haible  <bruno@clisp.org>
 
        doc: List library dependencies.
index 8252b66def899617ad9ab8144b49da537df4e017..641fceee2dc223423f513cd554baf3672bcd948a 100644 (file)
@@ -31,7 +31,7 @@ static inline void
 # if (__GNUC__ >= 3) || (__clang_major__ >= 4)
 __attribute__ ((always_inline))
 # endif
-print_stack_trace (FILE *stream)
+print_stack_trace_to (FILE *stream)
 {
   if (state == NULL)
     state = backtrace_create_state (NULL, 0, NULL, NULL);
@@ -50,7 +50,7 @@ static inline void
 # if (__GNUC__ >= 3) || (__clang_major__ >= 4)
 __attribute__ ((always_inline))
 # endif
-print_stack_trace (FILE *stream)
+print_stack_trace_to (FILE *stream)
 {
   void *buffer[100];
   int max_size = sizeof (buffer) / sizeof (buffer[0]);
@@ -75,23 +75,23 @@ print_stack_trace (FILE *stream)
 #endif
 
 void
-_gl_pre_abort (void)
+print_stack_trace (void)
 {
 #if HAVE_LIBBACKTRACE || HAVE_EXECINFO_H
-  print_stack_trace (stderr);
+  print_stack_trace_to (stderr);
 #endif
 }
 
 /*   rpl_abort ();
    is equivalent to
-     _gl_pre_abort ();
+     print_stack_trace ();
      original abort (); // i.e. raise (SIGABRT);
  */
 void
 rpl_abort (void)
 {
 #if HAVE_LIBBACKTRACE || HAVE_EXECINFO_H
-  print_stack_trace (stderr);
+  print_stack_trace_to (stderr);
 #endif
   raise (SIGABRT);
 }
index e42368eef270a1948173954ada321d26ccad9ce7..82e8dcd258cea9fb9ee353800032ed9b19413bad 100644 (file)
@@ -256,11 +256,11 @@ _GL_CXXALIASWARN (abort);
 # endif
 #endif
 #if @GNULIB_ABORT_DEBUG@ && @REPLACE_ABORT@
-_GL_EXTERN_C void _gl_pre_abort (void);
+_GL_EXTERN_C void print_stack_trace (void);
 #else
-# if !GNULIB_defined_gl_pre_abort
-#  define _gl_pre_abort() /* nothing */
-#  define GNULIB_defined_gl_pre_abort 1
+# if !GNULIB_defined_print_stack_trace
+#  define print_stack_trace() /* nothing */
+#  define GNULIB_defined_print_stack_trace 1
 # endif
 #endif
 
index 144905e031d3001ab11b2a2ff606d5b27fa0df75..3121b218203e1f97ed29931412d62232d87e9ac4 100644 (file)
@@ -82,7 +82,7 @@ int volatile test_exit_status = EXIT_SUCCESS;
           fflush (ASSERT_STREAM);                                            \
           if (CONTINUE_AFTER_ASSERT)                                         \
             {                                                                \
-              _gl_pre_abort ();                                              \
+              print_stack_trace ();                                          \
               test_exit_status = EXIT_FAILURE;                               \
             }                                                                \
           else                                                               \
@@ -106,7 +106,7 @@ int volatile test_exit_status = EXIT_SUCCESS;
           WRITE_TO_STDERR ("' failed\n");                   \
           if (CONTINUE_AFTER_ASSERT)                        \
             {                                               \
-              _gl_pre_abort ();                             \
+              print_stack_trace ();                         \
               test_exit_status = EXIT_FAILURE;              \
             }                                               \
           else                                              \