NativeAOT createdump fork/exec for crash dump generation (#89203)
authorMike McLaughlin <mikem@microsoft.com>
Fri, 28 Jul 2023 01:58:42 +0000 (18:58 -0700)
committerGitHub <noreply@github.com>
Fri, 28 Jul 2023 01:58:42 +0000 (18:58 -0700)
commit8ae79d2ccda84edb49a75ead1434ea951d87808c
treec0e04406ba990e70b838bdd945b231d794ee8466
parent5832fed631d3f3a0bd1e02cf552378417872d5ad
NativeAOT createdump fork/exec for crash dump generation (#89203)

* NativeAOT createdump fork/exec for crash dump generation

Port the .NET Core createdump fork/exec code to NativeAOT.

Add src/native/inc/generatedumpflags.h. Remove dup definitions of this enum.

Move and port clrconfignocache.h from src/coreclr/inc to src/native/inc/.

* Add building more command line arguments for signal number, etc.

Fix some build problems.

* Code review feedback - use RhConfig instead of clrconfignocache.h

* Fix string buffer length

* Fix nativeaot test failures. Added crash buffer address to debug header contract

* Generate a core dump on unhandled SIGSEGV/SIGFPE

Add PalCreateDump.h with all the public functions.

* Build and pass an EXCEPTION_RECORD for Linux like it was done for Windows. The next step is to pass the address of it to createdump.

* Pass exception record address to createdump

* Add special diagnostic info memory region

Contains the exception record address for Native AOT crashes.
31 files changed:
src/coreclr/CMakeLists.txt
src/coreclr/debug/createdump/crashinfo.cpp
src/coreclr/debug/createdump/crashinfo.h
src/coreclr/debug/createdump/createdump.h
src/coreclr/debug/createdump/createdumpmain.cpp
src/coreclr/debug/createdump/dumpwriter.cpp
src/coreclr/debug/createdump/dumpwriterelf.cpp
src/coreclr/debug/createdump/dumpwriterelf.h
src/coreclr/debug/createdump/dumpwritermacho.cpp
src/coreclr/debug/createdump/dumpwritermacho.h
src/coreclr/debug/createdump/specialdiaginfo.h [new file with mode: 0644]
src/coreclr/nativeaot/Runtime/CMakeLists.txt
src/coreclr/nativeaot/Runtime/DebugHeader.cpp
src/coreclr/nativeaot/Runtime/RuntimeInstance.cpp
src/coreclr/nativeaot/Runtime/eventpipe/ds-rt-aot.cpp
src/coreclr/nativeaot/Runtime/eventpipe/ds-rt-aot.h
src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp
src/coreclr/nativeaot/Runtime/unix/PalCreateDump.cpp [new file with mode: 0644]
src/coreclr/nativeaot/Runtime/unix/PalCreateDump.h [new file with mode: 0644]
src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
src/coreclr/nativeaot/Runtime/unix/config.h.in
src/coreclr/nativeaot/Runtime/unix/configure.cmake
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeExceptionHelpers.cs
src/coreclr/pal/inc/pal.h
src/coreclr/pal/src/thread/process.cpp
src/coreclr/vm/eventing/eventpipe/ds-rt-coreclr.h
src/coreclr/vm/excep.h
src/coreclr/vm/gcenv.ee.cpp
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.RaiseFailFastException.cs
src/native/inc/generatedumpflags.h [new file with mode: 0644]