forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make SPMI collections work on crashes/assertion failures (dotnet#69494)
This changes SPMI to set up a PAL_TRY/PAL_FINALLY around the call to ICorJitCompiler::compileMethod and save the method context in the finally. To make this work we also need to pass COMPlus_JitThrowOnAssertionFailure=1 to avoid the failfast so that the PAL_FINALLY is actually invoked. To support hardware exceptions on non-Windows a little work was required: * On non-Windows we were not passing an exports file when linking superpmi-shim-collector leading to exporting the entire PAL and tons of unnecessary functions. This would additionally mean we were calling PAL_InitializeDll in two places: on load, the coreclr PAL loader would invoke PAL_RegisterModule that does initialization, and then we would call it manually again from jitStartup. While the double initialization was ok it made reasoning about initialization difficult (and different from clrjit). * We need to pass PAL_INITIALIZE_REGISTER_SIGNALS on initialization of the PAL make sure it properly attaches signal handlers that translates hardware exceptions to C++ exceptions. We cannot rely on the signal handler registered by coreclr as the different PALs have different CPalThread structures attached to the current thread. This means that coreclr's signal handler will not translate hardware exceptions occurring in the JIT even when we have a PAL_TRY in superpmi-shim-collector that tries to enable hardware exceptions. We need to define FEATURE_ENABLE_HARDWARE_EXCEPTIONS. In addition I have changed the recording to record contexts indiscriminately, even when we don't return CORJIT_OK. With these changes I have verified that collections generated when there are either JIT assertion failures or segfault/AV in JIT generates a collection that reproduces the problem on Windows, Ubuntu and macOS. Fixes dotnet#41649
- Loading branch information
1 parent
5734a23
commit 3436758
Showing
10 changed files
with
126 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.PAL.exports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
getJit | ||
jitStartup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters