Changeset 229338 in webkit


Ignore:
Timestamp:
Mar 6, 2018 12:53:52 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r229330.
https://bugs.webkit.org/show_bug.cgi?id=183379

Broke some Apple internal code (Requested by ap on #webkit).

Reverted changeset:

"Remove unused crash hook functionality"
https://bugs.webkit.org/show_bug.cgi?id=183369
https://trac.webkit.org/changeset/229330

Location:
trunk/Source/WTF
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r229330 r229338  
     12018-03-06  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r229330.
     4        https://bugs.webkit.org/show_bug.cgi?id=183379
     5
     6        Broke some Apple internal code (Requested by ap on #webkit).
     7
     8        Reverted changeset:
     9
     10        "Remove unused crash hook functionality"
     11        https://bugs.webkit.org/show_bug.cgi?id=183369
     12        https://trac.webkit.org/changeset/229330
     13
    1142018-03-06  Michael Catanzaro  <mcatanzaro@igalia.com>
    215
  • trunk/Source/WTF/wtf/Assertions.cpp

    r229330 r229338  
    252252}
    253253
     254static WTFCrashHookFunction globalHook = 0;
     255
     256void WTFSetCrashHook(WTFCrashHookFunction function)
     257{
     258    globalHook = function;
     259}
     260
    254261#if !defined(NDEBUG) || !OS(DARWIN)
    255262void WTFCrash()
    256263{
     264    if (globalHook)
     265        globalHook();
     266
    257267    WTFReportBacktrace();
    258268#if ASAN_ENABLED
     
    281291{
    282292    CRASH();
     293}
     294
     295#if HAVE(SIGNAL_H)
     296static NO_RETURN void dumpBacktraceSignalHandler(int sig)
     297{
     298    WTFReportBacktrace();
     299    exit(128 + sig);
     300}
     301
     302static void installSignalHandlersForFatalErrors(void (*handler)(int))
     303{
     304    signal(SIGILL, handler); //    4: illegal instruction (not reset when caught).
     305    signal(SIGTRAP, handler); //   5: trace trap (not reset when caught).
     306    signal(SIGFPE, handler); //    8: floating point exception.
     307    signal(SIGBUS, handler); //   10: bus error.
     308    signal(SIGSEGV, handler); //  11: segmentation violation.
     309    signal(SIGSYS, handler); //   12: bad argument to system call.
     310    signal(SIGPIPE, handler); //  13: write on a pipe with no reader.
     311    signal(SIGXCPU, handler); //  24: exceeded CPU time limit.
     312    signal(SIGXFSZ, handler); //  25: exceeded file size limit.
     313}
     314
     315static void resetSignalHandlersForFatalErrors()
     316{
     317    installSignalHandlersForFatalErrors(SIG_DFL);
     318}
     319#endif
     320
     321void WTFInstallReportBacktraceOnCrashHook()
     322{
     323#if HAVE(SIGNAL_H)
     324    // Needed otherwise we are going to dump the stack trace twice
     325    // in case we hit an assertion.
     326    WTFSetCrashHook(&resetSignalHandlersForFatalErrors);
     327    installSignalHandlersForFatalErrors(&dumpBacktraceSignalHandler);
     328#endif
    283329}
    284330
  • trunk/Source/WTF/wtf/Assertions.h

    r229330 r229338  
    201201WTF_EXPORT_PRIVATE void WTFPrintBacktrace(void** stack, int size);
    202202
     203typedef void (*WTFCrashHookFunction)(void);
     204WTF_EXPORT_PRIVATE void WTFSetCrashHook(WTFCrashHookFunction);
     205WTF_EXPORT_PRIVATE void WTFInstallReportBacktraceOnCrashHook(void);
     206
    203207WTF_EXPORT_PRIVATE bool WTFIsDebuggerAttached(void);
    204208
Note: See TracChangeset for help on using the changeset viewer.