[gjs] Remove SIGSEGV, SIGABRT handlers



commit 0c6194014672135804e2e502fef721181278f9cb
Author: Colin Walters <walters verbum org>
Date:   Fri Jul 22 16:25:08 2011 -0400

    Remove SIGSEGV, SIGABRT handlers
    
    It's possible for backtrace() to itself invoke malloc() in at least
    some versions of glibc.  Due to the fact that the malloc lock is not
    recursive, this will in turn deadlock if we got SIGSEGV inside malloc().
    
    Deadlocking is far worse than segfaulting, and most operating systems
    nowadays have some sort of systemwide crash catching facility, so let's
    just rely on that.

 test/gjs-tests.c |    1 -
 test/gjs-unit.c  |    1 -
 util/crash.c     |   32 --------------------------------
 util/crash.h     |    1 -
 4 files changed, 0 insertions(+), 35 deletions(-)
---
diff --git a/test/gjs-tests.c b/test/gjs-tests.c
index d75cf47..d73a7c5 100644
--- a/test/gjs-tests.c
+++ b/test/gjs-tests.c
@@ -39,7 +39,6 @@ main(int    argc,
     g_type_init ();
 
     gjs_crash_after_timeout(60*7); /* give the unit tests 7 minutes to complete */
-    gjs_init_sleep_on_crash();
 
     g_test_init(&argc, &argv, NULL);
 
diff --git a/test/gjs-unit.c b/test/gjs-unit.c
index a222d9d..1ab9dda 100644
--- a/test/gjs-unit.c
+++ b/test/gjs-unit.c
@@ -248,7 +248,6 @@ main(int argc, char **argv)
                 gjs_crash_after_timeout(timeout);
         }
     }
-    gjs_init_sleep_on_crash();
 
     setlocale(LC_ALL, "");
     g_test_init(&argc, &argv, NULL);
diff --git a/util/crash.c b/util/crash.c
index 101f094..342d945 100644
--- a/util/crash.c
+++ b/util/crash.c
@@ -96,38 +96,6 @@ gjs_print_backtrace(void)
 #endif
 }
 
-static void
-signal_handler(int num)
-{
-    const char *sleep_on_crash;
-
-    switch (num) {
-    case SIGSEGV:
-    case SIGABRT:
-        gjs_print_backtrace();
-
-        sleep_on_crash = g_getenv("GJS_SLEEP_ON_CRASH");
-
-        if (sleep_on_crash && !strcmp(sleep_on_crash, "1")) {
-            fprintf(stderr, "\n");
-            fprintf(stderr, "=== sleeping; attach debugger to PID %u\n", getpid());
-            fprintf(stderr, "\n");
-
-            sleep(1000);
-        }
-
-        exit(1);
-        break;
-    }
-}
-
-void
-gjs_init_sleep_on_crash(void)
-{
-    signal(SIGSEGV, signal_handler);
-    signal(SIGABRT, signal_handler);
-}
-
 /* Fork a process that waits the given time then
  * sends us ABRT
  */
diff --git a/util/crash.h b/util/crash.h
index 587ed32..1f46c0f 100644
--- a/util/crash.h
+++ b/util/crash.h
@@ -27,7 +27,6 @@
 
 G_BEGIN_DECLS
 
-void gjs_init_sleep_on_crash (void);
 void gjs_print_backtrace     (void);
 void gjs_crash_after_timeout (int seconds);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]