#include <string.h>
#include <unistd.h>
#include <signal.h>
+#include <execinfo.h>
#include <sys/resource.h>
#include <sys/wait.h>
exit(3);
}
+static void
+dump_stack(void)
+{
+ static void *backbuf[50];
+ int levels;
+
+ levels = backtrace(backbuf, 50);
+ backtrace_symbols_fd(backbuf, levels, STDERR_FILENO);
+}
+
void
bt_test_case5(int (*test_fn)(void), const char *test_id, const char *dsc, int forked, int timeout)
{
if (sn == SIGALRM)
bt_log("Timeout expired");
else if (sn == SIGSEGV)
- bt_log("Segmentation fault");
+ {
+ bt_log("Segmentation fault:");
+ dump_stack();
+ }
else if (sn != SIGABRT)
bt_log("Signal %d received", sn);
}