Closed foleblanc-ceridian closed 9 months ago
@foleblanc-ceridian I'm not seeing any specific problems with the Mach exception handler. I suspect you're using the POSIX handler.
As noted in the "Update: an alternative using a POSIX signal handler" section from the original article:
The biggest problem is straightforward: it won’t run with lldb attached since lldb catches the EXC_BAD_INSTRUCTION, preventing the SIGILL from ever occurring (you must run without a debugger attached). For my typical “testing from within Xcode” usage scenario (where I always run with lldb attached) this point alone entirely rules out the signal handler version.
If you're running the LLDB version, you'll need to edit your "Scheme" (Xcode menubar -> Product -> Scheme -> Edit Scheme) and select "Test" from the left and uncheck "Debug executable".
The unit tests that take advantage of the
catchBadInstruction
method run indefinitely using Xcode 15, making the IDE unresponsive (in some aspects* ). I am left having to force quit and try again.In the example below, "Reached point 1" prints to the console, but not the second one.
The expectation is for
result
to hold the exception thrown.