Bug 761857 - Make MOZ_CRASH on Linux crash in such a way that an attached debugger will park on the line containing the assertion. r=ted
authorJeff Walden <jwalden@mit.edu>
Tue, 05 Jun 2012 16:49:19 -0700
changeset 98717 ca61695732aa7d2644c77acbda84c201295cefca
parent 98716 2b0ec0df160ca6c61592f9c113f3ad05fe524baf
child 98718 379e323cede98b5d030dea430d43046da91312a4
push id1729
push userlsblakk@mozilla.com
push dateMon, 16 Jul 2012 20:02:43 +0000
treeherdermozilla-aurora@f4e75e148951 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs761857
milestone16.0a1
Bug 761857 - Make MOZ_CRASH on Linux crash in such a way that an attached debugger will park on the line containing the assertion. r=ted
mfbt/Assertions.h
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -107,52 +107,43 @@ extern "C" {
 
 #if defined(WIN32)
    /*
     * We used to call DebugBreak() on Windows, but amazingly, it causes
     * the MSVS 2010 debugger not to be able to recover a call stack.
     */
 #  define MOZ_CRASH() \
      do { \
-       *((volatile int *) NULL) = 123; \
+       *((volatile int*) NULL) = 123; \
        exit(3); \
      } while (0)
 #elif defined(ANDROID)
    /*
     * On Android, raise(SIGABRT) is handled asynchronously. Seg fault now
     * so we crash immediately and capture the current call stack. We need
     * to specifically use the global namespace in the C++ case.
     */
 #  ifdef __cplusplus
 #    define MOZ_CRASH() \
        do { \
-         *((volatile int *) NULL) = 123; \
+         *((volatile int*) NULL) = 123; \
          ::abort(); \
        } while (0)
 #  else
 #    define MOZ_CRASH() \
        do { \
-         *((volatile int *) NULL) = 123; \
+         *((volatile int*) NULL) = 123; \
          abort(); \
        } while (0)
 #  endif
-#elif defined(__APPLE__)
-   /*
-    * On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
-    * trapped.
-    */
-#  define MOZ_CRASH() \
-     do { \
-       *((volatile int *) NULL) = 123; \
-       raise(SIGABRT);  /* In case above statement gets nixed by the optimizer. */ \
-     } while (0)
 #else
 #  define MOZ_CRASH() \
      do { \
-       raise(SIGABRT);  /* To continue from here in GDB: "signal 0". */ \
+       *((volatile int*) NULL) = 123; \
+       raise(SIGABRT);  /* In case above statement gets nixed by the optimizer. */ \
      } while (0)
 #endif
 
 
 extern MFBT_API(void)
 MOZ_Assert(const char* s, const char* file, int ln);
 
 static MOZ_ALWAYS_INLINE void
@@ -274,17 +265,17 @@ MOZ_OutputAssertMessage(const char* s, c
  */
 #if defined(__clang__)
 #  define MOZ_NOT_REACHED_MARKER() __builtin_unreachable()
 #elif defined(__GNUC__)
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #    define MOZ_NOT_REACHED_MARKER() __builtin_unreachable()
 #  endif
 #elif defined(_MSC_VER)
-# define MOZ_NOT_REACHED_MARKER() __assume(0)
+#  define MOZ_NOT_REACHED_MARKER() __assume(0)
 #endif
 
 /*
  * MOZ_NOT_REACHED(reason) indicates that the given point can't be reached
  * during execution: simply reaching that point in execution is a bug.  It takes
  * as an argument an error message indicating the reason why that point should
  * not have been reachable.
  *