Changeset 196458 in webkit


Ignore:
Timestamp:
Feb 11, 2016 4:59:11 PM (8 years ago)
Author:
mark.lam@apple.com
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:
Location:
trunk/Source/WTF
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r196397 r196458  
     12016-02-11  Mark Lam  <mark.lam@apple.com>
     2
     3        Need WTFCrash workaround for shipping SafariForWebKitDevelopment binaries.
     4        https://bugs.webkit.org/show_bug.cgi?id=154125
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Presently shipping SafariForWebKitDevelopment binaries still expect to link to a
     9        WTFCrash function.  We need to provide this function as a workaround until we can
     10        update SafariForWebKitDevelopment to use the new inlined version.
     11
     12        We do this by doing:
     13        1. Make WTFCrashImpl() the sole function for implementing a crash.
     14           The CRASH() macro is now defined to be WTFCrashImpl() instead of WTFCrash().
     15        2. Renamed the legacy WTFCrash() to WTFCrashImpl() for debug or non-Darwin builds.
     16           For (non-debug && OS(DARWIN)) builds, WTFCrashImpl() will be an inlined
     17           function with an asm statement that issues a breakpoint trap.
     18        3. Implement WTFCrash() as a function that calls CRASH().
     19           This satisfies the need of shipping SafariForWebKitDevelopment binaries.
     20        4. Change WTFCrashWithSecurityImplication() to call CRASH().
     21           This ensures that we have a consistent implementation of how we crash.
     22        5. Changed WTFLogAlwaysAndCrash() to call CRASH() instead of WTFCrash().
     23           This is just to have consistency in that all code in the WebKit project
     24           now crashes by calling CRASH(), not WTFCrash().
     25
     26        * wtf/Assertions.cpp:
     27        * wtf/Assertions.h:
     28
    1292016-02-09  Mark Lam  <mark.lam@apple.com>
    230
  • trunk/Source/WTF/wtf/Assertions.cpp

    r196397 r196458  
    314314
    315315#if !defined(NDEBUG) || !OS(DARWIN)
    316 void WTFCrash()
     316void WTFCrashImpl()
    317317{
    318318    if (globalHook)
     
    330330#endif // !defined(NDEBUG) || !OS(DARWIN)
    331331   
     332// We need to keep WTFCrash() around (even on non-debug OS(DARWIN) builds) as a workaround
     333// for presently shipping (circa early 2016) SafariForWebKitDevelopment binaries which still
     334// expects to link to it.
     335void WTFCrash()
     336{
     337    CRASH();
     338}
     339
    332340void WTFCrashWithSecurityImplication()
    333341{
    334     if (globalHook)
    335         globalHook();
    336     WTFReportBacktrace();
    337     *(int *)(uintptr_t)0xfbadbeef = 0;
    338     // More reliable, but doesn't say fbadbeef.
    339 #if COMPILER(GCC_OR_CLANG)
    340     __builtin_trap();
    341 #else
    342     ((void(*)())0)();
    343 #endif
     342    CRASH();
    344343}
    345344
     
    457456    WTFLogAlwaysV(format, args);
    458457    va_end(args);
    459     WTFCrash();
     458    CRASH();
    460459}
    461460
  • trunk/Source/WTF/wtf/Assertions.h

    r196397 r196458  
    152152WTF_EXPORT_PRIVATE bool WTFIsDebuggerAttached();
    153153
    154 #ifdef __cplusplus
    155 }
    156 #endif
    157 
    158154#ifndef CRASH
    159 #define CRASH() WTFCrash()
    160 #endif
    161 
    162 #ifdef __cplusplus
    163 extern "C" {
    164 #endif
     155#define CRASH() WTFCrashImpl()
     156#endif
     157
    165158#if defined(NDEBUG) && OS(DARWIN)
    166 ALWAYS_INLINE NO_RETURN_DUE_TO_CRASH void WTFCrash()
     159ALWAYS_INLINE NO_RETURN_DUE_TO_CRASH void WTFCrashImpl()
    167160{
    168161    // Crash with a SIGTRAP i.e EXC_BREAKPOINT.
     
    181174}
    182175#else
     176WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashImpl();
     177#endif
     178
    183179WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrash();
    184 #endif
    185 
    186 #ifdef __cplusplus
    187 }
    188 #endif
    189180
    190181#ifndef CRASH_WITH_SECURITY_IMPLICATION
     
    192183#endif
    193184
    194 #ifdef __cplusplus
    195 extern "C" {
    196 #endif
    197     WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication();
     185WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication();
     186
    198187#ifdef __cplusplus
    199188}
Note: See TracChangeset for help on using the changeset viewer.