Skip to content

Commit 641bc2d

Browse files
Kenopcjentsch
authored andcommitted
mac: Produce coredumps on segfault (JuliaLang#46157)
This changes the mach exception server to ignore fatal SIGSEGVs, letting regular kernel processing handle it (by performing POSIX signal delivery and then subsequently coredumping), rather than quitting the process directly. There's probably some way to induce the kernel to perform core dumping directly from the exception server, but I think it'll be less confusing all around to just have segfaults take the standard path. Hoping this will help debug JuliaLang#46152.
1 parent 7b84093 commit 641bc2d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/signals-mach.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ typedef arm_exception_state64_t host_exception_state_t;
167167
#define HOST_EXCEPTION_STATE_COUNT ARM_EXCEPTION_STATE64_COUNT
168168
#endif
169169

170+
#define MIG_DESTROY_REQUEST -309
171+
170172
static void jl_call_in_state(jl_ptls_t ptls2, host_thread_state_t *state,
171173
void (*fptr)(void))
172174
{
@@ -332,9 +334,7 @@ kern_return_t catch_mach_exception_raise(
332334
return KERN_SUCCESS;
333335
}
334336
else {
335-
thread0_exit_count++;
336-
jl_exit_thread0(128 + SIGSEGV, NULL, 0);
337-
return KERN_SUCCESS;
337+
return MIG_DESTROY_REQUEST;
338338
}
339339
}
340340

0 commit comments

Comments
 (0)