mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 03:39:35 -10:00
* Add MachO dump writer to createdump Instead of the hacky ELF core dumps on MacOS now createdump generates true MachO dumps. Setting the COMPlus_DbgEnableElfDumpOnMacOS environment variable is no longer needed. Add special thread info memory region containing the OS thread ids missing from macho core dumps. This allows SOS to map the thread indexes to thread ids. The address (0x7fffffff00000000) of this special memory region is above the highest user address (0x0007FFFFFFFFF000) and below a kernel reserved address (0xffffff8000xxxxxx) which is kind of moot because dumps don't include any kernel regions. lldb seems just fine with this memory region. The changes include ARM64 support also, but since I don't have a M1 device I can't build/test them. I'm hoping Steve can at least review them. Add --verbose/TRACE_VERBOSE support to tone down all the macho dump generation spew. Issue: #48664 * Fix build problem * Update docs * Code review feedback Co-authored-by: Juan Sebastian Hoyos Ayala <[email protected]>
2.5 KiB
2.5 KiB
Debugging CoreFX on Unix
CoreFX can be debugged on unix using both lldb and visual studio code
Using lldb and SOS
- Install SOS and lldb. See https://github.com/dotnet/diagnostics/blob/main/documentation/sos.md and https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-sos for setup instructions.
- Run the test using msbuild at least once with
/t:Test.
Debugging core dumps with lldb
It is also possible to debug .NET crash dumps using lldb and SOS. In order to do this, you need all of the following:
- The crash dump file.
- On Linux, there is an utility called
createdump(see doc) that can be setup to generate core dumps when a managed app throws an unhandled exception or faults.'
There are instructions for installing lldb and SOS here.
Once you have everything listed above, you are ready to start debugging. You need to specify an extra parameter to lldb in order for it to correctly resolve the symbols for libcoreclr.so. Use a command like this:
lldb-3.9 -O "settings set target.exec-search-paths <runtime-path>" --core <core-file-path> <host-path>
<runtime-path>: The path containing libcoreclr.so.dbg, as well as the rest of the runtime and framework assemblies.<core-file-path>: The path to the core dump you are attempting to debug.<host-path>: The path to the dotnet or corerun executable, potentially in the<runtime-path>folder.
lldb should start debugging successfully at this point. You should see stacktraces with resolved symbols for libcoreclr.so. At this point you can begin using SOS commands provided you've set it up as described in the links.
Also see this link in the diagnostics repo.
Example
lldb-3.9 -O "settings set target.exec-search-paths /home/parallels/Downloads/System.Drawing.Common.Tests/home/helixbot/dotnetbuild/work/2a74cf82-3018-4e08-9e9a-744bb492869e/Payload/shared/Microsoft.NETCore.App/$(ProductVersion)/" --core /home/parallels/Downloads/System.Drawing.Common.Tests/home/helixbot/dotnetbuild/work/2a74cf82-3018-4e08-9e9a-744bb492869e/Work/f6414a62-9b41-4144-baed-756321e3e075/Unzip/core /home/parallels/Downloads/System.Drawing.Common.Tests/home/helixbot/dotnetbuild/work/2a74cf82-3018-4e08-9e9a-744bb492869e/Payload/shared/Microsoft.NETCore.App/$(ProductVersion)/dotnet