From 5c28a74920e6e4b383ba10e61628c5cb49a108a2 Mon Sep 17 00:00:00 2001 From: Roman Lavrov Date: Thu, 18 May 2023 19:20:56 -0400 Subject: [PATCH] Print signal to stdout before calling crash handler Doesn't fix anything but if deadlock described on the bug happens locally and stdout is piped to console (or line-buffered file), it's at least visible that a signal handler was invoked. Bug: angleproject:8080 Change-Id: I27e1b22cc269082682fd639ef087f1b8b14b26eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4544588 Reviewed-by: Amirali Abdolrashidi Auto-Submit: Roman Lavrov Commit-Queue: Amirali Abdolrashidi --- util/posix/crash_handler_posix.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/posix/crash_handler_posix.cpp b/util/posix/crash_handler_posix.cpp index 5070ac63e..ede12fd6e 100644 --- a/util/posix/crash_handler_posix.cpp +++ b/util/posix/crash_handler_posix.cpp @@ -126,12 +126,13 @@ void PrintStackBacktrace() static void Handler(int sig) { + printf("\nSignal %d:\n", sig); + if (gCrashHandlerCallback) { (*gCrashHandlerCallback)(); } - printf("\nSignal %d:\n", sig); PrintStackBacktrace(); // Exit NOW. Don't notify other threads, don't call anything registered with atexit(). @@ -645,12 +646,13 @@ void PrintStackBacktrace() static void Handler(int sig) { + printf("\nSignal %d [%s]:\n", sig, strsignal(sig)); + if (gCrashHandlerCallback) { (*gCrashHandlerCallback)(); } - printf("\nSignal %d [%s]:\n", sig, strsignal(sig)); PrintStackBacktrace(); // Exit NOW. Don't notify other threads, don't call anything registered with atexit().