Changeset 238478 in webkit


Ignore:
Timestamp:
Nov 25, 2018 10:22:30 AM (5 years ago)
Author:
Michael Catanzaro
Message:

CRASH() should call abort() except on Darwin and in developer builds
https://bugs.webkit.org/show_bug.cgi?id=184408

Reviewed by Daniel Bates.

CRASH() should call abort() except on Darwin and in developer builds, as discussed on
webkit-dev. This should be slightly nicer than dereferencing 0xbadbeef.

On Darwin, CRASH() uses a breakpoint trap, which seems to corrupt the stack on Linux, so we
can't do that.

Continue to call WTFCrash() in developer mode, and make no changes to WTFCrash(), since it
is reportedly useful in nightmare scenarios where core dumps are unavailable.

We also have to define CRASH_UNDER_CONSTEXPR_CONTEXT(). It's a bit odd that it's possible to
use a non-constexpr function here, but it works. Currently this macro uses WTFCrash(), which
is also non-constexpr.

  • wtf/Assertions.h:
Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r238477 r238478  
     12018-11-25  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        CRASH() should call abort() except on Darwin and in developer builds
     4        https://bugs.webkit.org/show_bug.cgi?id=184408
     5
     6        Reviewed by Daniel Bates.
     7
     8        CRASH() should call abort() except on Darwin and in developer builds, as discussed on
     9        webkit-dev. This should be slightly nicer than dereferencing 0xbadbeef.
     10
     11        On Darwin, CRASH() uses a breakpoint trap, which seems to corrupt the stack on Linux, so we
     12        can't do that.
     13
     14        Continue to call WTFCrash() in developer mode, and make no changes to WTFCrash(), since it
     15        is reportedly useful in nightmare scenarios where core dumps are unavailable.
     16
     17        We also have to define CRASH_UNDER_CONSTEXPR_CONTEXT(). It's a bit odd that it's possible to
     18        use a non-constexpr function here, but it works. Currently this macro uses WTFCrash(), which
     19        is also non-constexpr.
     20
     21        * wtf/Assertions.h:
     22
    1232018-11-25  Michael Catanzaro  <mcatanzaro@igalia.com>
    224
  • trunk/Source/WTF/wtf/Assertions.h

    r238477 r238478  
    4545#include <stdbool.h>
    4646#include <stddef.h>
     47#include <stdlib.h>
    4748#include <wtf/ExportMacros.h>
    4849
     
    240241    __builtin_unreachable(); \
    241242} while (0)
     243#elif !ENABLE(DEVELOPER_MODE) && !OS(DARWIN)
     244#define CRASH() abort()
     245#define CRASH_UNDER_CONSTEXPR_CONTEXT() abort()
    242246#else
    243247#define CRASH() WTFCrash()
Note: See TracChangeset for help on using the changeset viewer.