Open mikegazzaruso opened 1 year ago
This is normal behaviour. Your debugger will catch most 'exceptions' before user code.
abort()
and the like will typically emit a 'debug break' opcode, which will not be caught by your exception handler regardless.
Disable 'invalid access' exception handling in your debugger and try something like throw nullptr
. You can test this by having your handler emit something to stdout
and running your application from the command line/terminal.
This works for me:
SystemStats::setApplicationCrashHandler ([] (void*)
{
printf ("Caught crash!\n");});
});
Timer::callAfterDelay (1000, [] { throw nullptr; });
Detailed steps on how to reproduce the bug
Tested on both Standalone Plugin and Basic GUI Application.
1) Create JUCE App 2) Try to set a crash handler i.e. in MainComponent.cpp
3) Try to trigger a crash later in the code, i.e. when pressing a button:
Also tried different approaches to trigger the crash, like assigning a value to a nullptr, or raise(SIGILL) etc., no way. The code inside the handler is never called, and the IP will never stop on a breakpoint inside it.
What is the expected behaviour?
The Crash Handler is invoked and the crash handling code is executed.
Operating systems
Windows, macOS
What versions of the operating systems?
Windows 10, Mac OS 12
Architectures
x86_64, ARM, 64-bit
Stacktrace
No response
Plug-in formats (if applicable)
VST3, AUv3, Standalone
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the
develop
branchThe bug is present on the
develop
branchCode of Conduct