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>
diff --git a/dm/DM.cpp b/dm/DM.cpp
index b0d8642..28369e9 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -268,7 +268,10 @@
     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 @@
         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);