mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Improve crash handler on XNU
This avoids an issue where a crash signal could cause the MacOS process to freeze and consume all CPU rather than dying as it rightfully should
This commit is contained in:
parent
0a51241f7a
commit
086d7006da
5 changed files with 53 additions and 9 deletions
|
@ -66,9 +66,10 @@
|
|||
#endif
|
||||
|
||||
#if (!defined(__llvm__) && !__has_builtin(__builtin_assume))
|
||||
#define __builtin_assume(x) \
|
||||
do { \
|
||||
if (!(x)) __builtin_unreachable(); \
|
||||
#define __builtin_assume(x) \
|
||||
do { \
|
||||
if (!(x)) \
|
||||
__builtin_unreachable(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
@ -598,10 +599,21 @@ typedef struct {
|
|||
|
||||
#ifdef __x86_64__
|
||||
#define DebugBreak() __asm__("int3")
|
||||
#elif defined(__aarch64__)
|
||||
#define DebugBreak() __asm__("brk\t#0x666")
|
||||
#else
|
||||
#define DebugBreak() __builtin_trap()
|
||||
#endif
|
||||
|
||||
#ifdef __aarch64__
|
||||
/* raise sigill (not sigtrap) like x86 does */
|
||||
#define __builtin_trap() \
|
||||
do { \
|
||||
__asm__("udf\t#0x666"); \
|
||||
__builtin_unreachable(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif /* _COSMO_SOURCE */
|
||||
|
||||
#define __veil(CONSTRAINT, EXPRESSION) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue