unify term/crash handlers, include SIGINT
We print different things for crashes and for external termination signals, which is a waste. Might as well print the union for all. This adds SIGINT (Ctrl-C, signal 2, exit code 130) to the list too. (The flag to ignore sigint should still work.) Change-Id: I91db023eb68e4798eed15d1f4d76b20b52a174cc Reviewed-on: https://skia-review.googlesource.com/138160 Auto-Submit: Mike Klein <mtklein@google.com> Reviewed-by: Joe Gregorio <jcgregorio@google.com> Commit-Queue: Joe Gregorio <jcgregorio@google.com>
This commit is contained in:
parent
2df9b45ab9
commit
701a35812e
17
dm/DM.cpp
17
dm/DM.cpp
@ -268,7 +268,10 @@ static void find_culprit() {
|
||||
static void crash_handler(int sig) {
|
||||
SkAutoMutexAcquire lock(gMutex);
|
||||
|
||||
info("\nCaught signal %d [%s], was running:\n", sig, strsignal(sig));
|
||||
info("\nCaught signal %d [%s] (%dMB RAM, peak %dMB), was running:\n",
|
||||
sig, strsignal(sig),
|
||||
sk_tools::getCurrResidentSetSizeMB(), sk_tools::getMaxResidentSetSizeMB());
|
||||
|
||||
for (auto& task : gRunning) {
|
||||
task.dump();
|
||||
}
|
||||
@ -289,21 +292,11 @@ static void find_culprit() {
|
||||
raise(sig);
|
||||
}
|
||||
|
||||
static void term_handler(int sig) {
|
||||
info("\nWe have been politely asked to die by %s (%d)."
|
||||
"\nCurrently using %dMB RAM, peak %dMB.\n",
|
||||
strsignal(sig), sig,
|
||||
sk_tools::getCurrResidentSetSizeMB(), sk_tools::getMaxResidentSetSizeMB());
|
||||
signal(sig, previous_handler[sig]);
|
||||
raise(sig);
|
||||
}
|
||||
|
||||
static void setup_crash_handler() {
|
||||
const int kSignals[] = { SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGSEGV };
|
||||
const int kSignals[] = { SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM };
|
||||
for (int sig : kSignals) {
|
||||
previous_handler[sig] = signal(sig, crash_handler);
|
||||
}
|
||||
previous_handler[SIGTERM] = signal(SIGTERM, term_handler);
|
||||
|
||||
if (FLAGS_ignoreSigInt) {
|
||||
signal(SIGINT, SIG_IGN);
|
||||
|
Loading…
Reference in New Issue
Block a user