A reliable and extensible macos .NET Core native crash handler.
Add a ProjectReference to sig_handler in your project and import its target.
<Import Project="../sig_handler/sig_handler.targets" />
<PropertyGroup>
<AppName>test_app</AppName>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\sig_handler\sig_handler.csproj"/>
</ItemGroup>
Call setup method
using Sig8;
var sig = new SigHandler("MYAPPNAME", "/System/Applications/Calculator.app");
This will open the calculator on segfault. You can replace calculator with your own crash handler app. In the crash handler app
you can use SigHandler.RetrieveCurrentCrash()
to get information about the current crash and SigHandler.RetrievePreviousCrashes()
to get information about all previous crashes next time the app is launched.
Crashes are logged in /Users//Library/Application Support/FML/<app_name>/<crash_id>/...
- Optional. Ensure that the sampler has exited before the crash app reads the sample log file. Maybe by creating a
done
file in the crash. Or we could just wait 3s. - Implement RetrieveCurrentCrash.
- Implement RetrievePreviousCrashes
- Signal re-rentrancy. What happens if this signal handler is interrupted by a second signal? Should we block all signals?