Title: [196458] trunk/Source/WTF
Revision
196458
Author
[email protected]
Date
2016-02-11 16:59:11 -0800 (Thu, 11 Feb 2016)

Log Message

Need WTFCrash workaround for shipping SafariForWebKitDevelopment binaries.
https://bugs.webkit.org/show_bug.cgi?id=154125

Reviewed by Joseph Pecoraro.

Presently shipping SafariForWebKitDevelopment binaries still expect to link to a
WTFCrash function.  We need to provide this function as a workaround until we can
update SafariForWebKitDevelopment to use the new inlined version.

We do this by doing:
1. Make WTFCrashImpl() the sole function for implementing a crash.
   The CRASH() macro is now defined to be WTFCrashImpl() instead of WTFCrash().
2. Renamed the legacy WTFCrash() to WTFCrashImpl() for debug or non-Darwin builds.
   For (non-debug && OS(DARWIN)) builds, WTFCrashImpl() will be an inlined
   function with an asm statement that issues a breakpoint trap.
3. Implement WTFCrash() as a function that calls CRASH().
   This satisfies the need of shipping SafariForWebKitDevelopment binaries.
4. Change WTFCrashWithSecurityImplication() to call CRASH().
   This ensures that we have a consistent implementation of how we crash.
5. Changed WTFLogAlwaysAndCrash() to call CRASH() instead of WTFCrash().
   This is just to have consistency in that all code in the WebKit project
   now crashes by calling CRASH(), not WTFCrash().

* wtf/Assertions.cpp:
* wtf/Assertions.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (196457 => 196458)


--- trunk/Source/WTF/ChangeLog	2016-02-12 00:40:17 UTC (rev 196457)
+++ trunk/Source/WTF/ChangeLog	2016-02-12 00:59:11 UTC (rev 196458)
@@ -1,3 +1,31 @@
+2016-02-11  Mark Lam  <[email protected]>
+
+        Need WTFCrash workaround for shipping SafariForWebKitDevelopment binaries.
+        https://bugs.webkit.org/show_bug.cgi?id=154125
+
+        Reviewed by Joseph Pecoraro.
+
+        Presently shipping SafariForWebKitDevelopment binaries still expect to link to a
+        WTFCrash function.  We need to provide this function as a workaround until we can
+        update SafariForWebKitDevelopment to use the new inlined version.
+
+        We do this by doing:
+        1. Make WTFCrashImpl() the sole function for implementing a crash.
+           The CRASH() macro is now defined to be WTFCrashImpl() instead of WTFCrash().
+        2. Renamed the legacy WTFCrash() to WTFCrashImpl() for debug or non-Darwin builds.
+           For (non-debug && OS(DARWIN)) builds, WTFCrashImpl() will be an inlined
+           function with an asm statement that issues a breakpoint trap.
+        3. Implement WTFCrash() as a function that calls CRASH().
+           This satisfies the need of shipping SafariForWebKitDevelopment binaries.
+        4. Change WTFCrashWithSecurityImplication() to call CRASH().
+           This ensures that we have a consistent implementation of how we crash.
+        5. Changed WTFLogAlwaysAndCrash() to call CRASH() instead of WTFCrash().
+           This is just to have consistency in that all code in the WebKit project
+           now crashes by calling CRASH(), not WTFCrash().
+
+        * wtf/Assertions.cpp:
+        * wtf/Assertions.h:
+
 2016-02-09  Mark Lam  <[email protected]>
 
         Changed WTFCrash to not trash the crash site register state.

Modified: trunk/Source/WTF/wtf/Assertions.cpp (196457 => 196458)


--- trunk/Source/WTF/wtf/Assertions.cpp	2016-02-12 00:40:17 UTC (rev 196457)
+++ trunk/Source/WTF/wtf/Assertions.cpp	2016-02-12 00:59:11 UTC (rev 196458)
@@ -313,7 +313,7 @@
 }
 
 #if !defined(NDEBUG) || !OS(DARWIN)
-void WTFCrash()
+void WTFCrashImpl()
 {
     if (globalHook)
         globalHook();
@@ -329,18 +329,17 @@
 }
 #endif // !defined(NDEBUG) || !OS(DARWIN)
     
+// We need to keep WTFCrash() around (even on non-debug OS(DARWIN) builds) as a workaround
+// for presently shipping (circa early 2016) SafariForWebKitDevelopment binaries which still
+// expects to link to it.
+void WTFCrash()
+{
+    CRASH();
+}
+
 void WTFCrashWithSecurityImplication()
 {
-    if (globalHook)
-        globalHook();
-    WTFReportBacktrace();
-    *(int *)(uintptr_t)0xfbadbeef = 0;
-    // More reliable, but doesn't say fbadbeef.
-#if COMPILER(GCC_OR_CLANG)
-    __builtin_trap();
-#else
-    ((void(*)())0)();
-#endif
+    CRASH();
 }
 
 #if HAVE(SIGNAL_H)
@@ -456,7 +455,7 @@
     va_start(args, format);
     WTFLogAlwaysV(format, args);
     va_end(args);
-    WTFCrash();
+    CRASH();
 }
 
 WTFLogChannel* WTFLogChannelByName(WTFLogChannel* channels[], size_t count, const char* name)

Modified: trunk/Source/WTF/wtf/Assertions.h (196457 => 196458)


--- trunk/Source/WTF/wtf/Assertions.h	2016-02-12 00:40:17 UTC (rev 196457)
+++ trunk/Source/WTF/wtf/Assertions.h	2016-02-12 00:59:11 UTC (rev 196458)
@@ -151,19 +151,12 @@
 
 WTF_EXPORT_PRIVATE bool WTFIsDebuggerAttached();
 
-#ifdef __cplusplus
-}
-#endif
-
 #ifndef CRASH
-#define CRASH() WTFCrash()
+#define CRASH() WTFCrashImpl()
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
 #if defined(NDEBUG) && OS(DARWIN)
-ALWAYS_INLINE NO_RETURN_DUE_TO_CRASH void WTFCrash()
+ALWAYS_INLINE NO_RETURN_DUE_TO_CRASH void WTFCrashImpl()
 {
     // Crash with a SIGTRAP i.e EXC_BREAKPOINT.
     // We are not using __builtin_trap because it is only guaranteed to abort, but not necessarily
@@ -180,22 +173,18 @@
     __builtin_unreachable();
 }
 #else
-WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrash();
+WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashImpl();
 #endif
 
-#ifdef __cplusplus
-}
-#endif
+WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrash();
 
 #ifndef CRASH_WITH_SECURITY_IMPLICATION
 #define CRASH_WITH_SECURITY_IMPLICATION() WTFCrashWithSecurityImplication()
 #endif
 
+WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication();
+
 #ifdef __cplusplus
-extern "C" {
-#endif
-    WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication();
-#ifdef __cplusplus
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to