diff mbox

[i-g-t] lib/igt_core: Print stacktrace when receiving one of the crash signals.

Message ID 1471707156-6683-1-git-send-email-marius.c.vlad@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marius Vlad Aug. 20, 2016, 3:32 p.m. UTC
While at it add SIGFPE as a crash signal.

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Chris Wilson Aug. 20, 2016, 6:23 p.m. UTC | #1
On Sat, Aug 20, 2016 at 06:32:36PM +0300, Marius Vlad wrote:
> While at it add SIGFPE as a crash signal.
> 
> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
> CC: Chris Wilson <chris@chris-wilson.co.uk>

Seems reasonable. Though did you check that print_backtrace() was
sigsafe? It doesn't use stdio, malloc, or any of the usual suspects?
-Chris
diff mbox

Patch

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 801f02f..67e1a4f 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1482,7 +1482,8 @@  static bool exit_handler_disabled;
 #define SILENT(x) { x, NULL, 0 }
 static const struct { int number; const char *name; size_t name_len; } handled_signals[] =
 	{ SILENT(SIGINT), SILENT(SIGHUP), SILENT(SIGTERM), SILENT(SIGQUIT),
-	  SILENT(SIGPIPE), SIGDEF(SIGABRT), SIGDEF(SIGSEGV), SIGDEF(SIGBUS) };
+	  SILENT(SIGPIPE), SIGDEF(SIGABRT), SIGDEF(SIGSEGV), SIGDEF(SIGBUS),
+	  SIGDEF(SIGFPE) };
 #undef SILENT
 #undef SIGDEF
 
@@ -1542,6 +1543,7 @@  static bool crash_signal(int sig)
 	switch (sig) {
 	case SIGILL:
 	case SIGBUS:
+	case SIGFPE:
 	case SIGSEGV:
 		return true;
 	default:
@@ -1571,7 +1573,7 @@  static void fatal_sig_handler(int sig)
 				igt_exitcode = 128 + sig;
 
 			failed_one = true;
-
+			print_backtrace();
 			exit_subtest("CRASH");
 		}
 		break;