diff options
author | Mike Klein <mtklein@google.com> | 2018-06-28 14:08:19 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-28 15:36:47 +0000 |
commit | 701a35812e86f6c64d916d87d69e42c304fb7be2 (patch) | |
tree | 4ffc6cad869237b26a1c7c128707d4b4405cc772 | |
parent | 2df9b45ab9d3115dcb5ed31b7db45a6d34983cbf (diff) |
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>
-rw-r--r-- | dm/DM.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -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); |