* lib/stdlib.in.h (_gl_pre_abort): New declaration.
* lib/abort-debug.c (_gl_pre_abort): New function.
* tests/macros.h (ASSERT, ASSERT_NO_STDIO): If CONTINUE_AFTER_ASSERT
is 1 and the assertion fails, invoke _gl_pre_abort.
+2024-05-18 Bruno Haible <bruno@clisp.org>
+
+ abort-debug: Integrate with CONTINUE_AFTER_ASSERT.
+ * lib/stdlib.in.h (_gl_pre_abort): New declaration.
+ * lib/abort-debug.c (_gl_pre_abort): New function.
+ * tests/macros.h (ASSERT, ASSERT_NO_STDIO): If CONTINUE_AFTER_ASSERT
+ is 1 and the assertion fails, invoke _gl_pre_abort.
+
2024-05-18 Bruno Haible <bruno@clisp.org>
tests: Support showing all assertion failures, not just the first one.
#endif
+void
+_gl_pre_abort (void)
+{
+#if HAVE_EXECINFO_H
+ print_stack_trace (stderr);
+#endif
+}
+
+/* rpl_abort ();
+ is equivalent to
+ _gl_pre_abort ();
+ original abort (); // i.e. raise (SIGABRT);
+ */
void
rpl_abort (void)
{
_GL_CXXALIASWARN (abort);
# endif
#endif
+#if @GNULIB_ABORT_DEBUG@ && @REPLACE_ABORT@
+_GL_EXTERN_C void _gl_pre_abort (void);
+#else
+# if !GNULIB_defined_gl_pre_abort
+# define _gl_pre_abort() /* nothing */
+# define GNULIB_defined_gl_pre_abort 1
+# endif
+#endif
#if @GNULIB_FREE_POSIX@
__FILE__, __LINE__, #expr); \
fflush (ASSERT_STREAM); \
if (CONTINUE_AFTER_ASSERT) \
- test_exit_status = EXIT_FAILURE; \
+ { \
+ _gl_pre_abort (); \
+ test_exit_status = EXIT_FAILURE; \
+ } \
else \
abort (); \
} \
WRITE_TO_STDERR (#expr); \
WRITE_TO_STDERR ("' failed\n"); \
if (CONTINUE_AFTER_ASSERT) \
- test_exit_status = EXIT_FAILURE; \
+ { \
+ _gl_pre_abort (); \
+ test_exit_status = EXIT_FAILURE; \
+ } \
else \
abort (); \
} \