8255741: Zero: print signal name in unhandled signal handler

Reviewed-by: stuefe
This commit is contained in:
Aleksey Shipilev 2020-11-03 07:28:06 +00:00
parent 15805741f1
commit aa2862ad86

View File

@ -240,9 +240,16 @@ JVM_handle_linux_signal(int sig,
}
#endif // !PRODUCT
char buf[64];
char buf[128];
char exc_buf[32];
sprintf(buf, "caught unhandled signal %d", sig);
if (os::exception_name(sig, exc_buf, sizeof(exc_buf))) {
bool sent_by_kill = (info != NULL && os::signal_sent_by_kill(info));
snprintf(buf, sizeof(buf), "caught unhandled signal: %s %s",
exc_buf, sent_by_kill ? "(sent by kill)" : "");
} else {
snprintf(buf, sizeof(buf), "caught unhandled signal: %d", sig);
}
// Silence -Wformat-security warning for fatal()
PRAGMA_DIAG_PUSH