Closed kdubau closed 3 years ago
Interestingly, if I run the whole program with LLDB, the clrstack
command works as expected - which leads me to suspect it's something with the file format createdump
is generating?
kylewhite@kywhi-mbp ~/Workspace/macson/src/Tests/testdump (kywhi/dev/net6) $ lldb /Users/kylewhite/.dotnet/tools/testdump exception -- --thread background
Added Microsoft public symbol server
(lldb) target create "/Users/kylewhite/.dotnet/tools/testdump"
Current executable set to '/Users/kylewhite/.dotnet/tools/testdump' (x86_64).
(lldb) settings set -- target.run-args "exception" "--thread" "background"
(lldb) run
Process 37035 launched: '/Users/kylewhite/.dotnet/tools/testdump' (x86_64)
Process ID: 37035
About to throw CrashyException...
Crashy Background Thread
Unhandled exception. testdump.CrashyException: It's a crash!
at testdump.CrashyClass.<>c.<Exception>b__1_0() in /Users/kylewhite/Workspace/macson/src/Tests/testdump/CrashyClass.cs:line 19
at testdump.CrashyClass.<>c__DisplayClass13_0.<RunActionInThread>b__0() in /Users/kylewhite/Workspace/macson/src/Tests/testdump/CrashyClass.cs:line 97
at System.Threading.Thread.StartCallback() in System.Private.CoreLib.dll:token 0x600272e+0xe
Gathering state for process 37035
Writing minidump with heap to file /Users/kylewhite/dumps/coredump.37035
Written 853672120 bytes (208416 pages) to core file
Dump successfully written
Process 37035 stopped
* thread #10, stop reason = signal SIGABRT
frame #0: 0x00007fff205e592e libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff205e592e <+10>: jae 0x7fff205e5938 ; <+20>
0x7fff205e5930 <+12>: movq %rax, %rdi
0x7fff205e5933 <+15>: jmp 0x7fff205dfad9 ; cerror_nocancel
0x7fff205e5938 <+20>: retq
Target 0: (testdump) stopped.
(lldb) thread list
Process 37035 stopped
thread #1: tid = 0xa09dfc, 0x00007fff205e1cde libsystem_kernel.dylib`__psynch_cvwait + 10, queue = 'com.apple.main-thread'
thread #2: tid = 0xa09e14, 0x00007fff205df2ba libsystem_kernel.dylib`mach_msg_trap + 10
thread #3: tid = 0xa09e15, 0x00007fff205e59ca libsystem_kernel.dylib`poll + 10
thread #4: tid = 0xa09e16, 0x00007fff205e59ca libsystem_kernel.dylib`poll + 10
thread #5: tid = 0xa09e17, 0x00007fff205dfb52 libsystem_kernel.dylib`__open + 10
thread #6: tid = 0xa09e18, 0x00007fff205e1cde libsystem_kernel.dylib`__psynch_cvwait + 10
thread #7: tid = 0xa09e19, 0x00007fff205e1cde libsystem_kernel.dylib`__psynch_cvwait + 10
thread #8: tid = 0xa09e1b, 0x00007fff205e1cde libsystem_kernel.dylib`__psynch_cvwait + 10
thread #9: tid = 0xa09e1d, 0x00007fff205dfcce libsystem_kernel.dylib`read + 10
* thread #10: tid = 0xa09e1f, 0x00007fff205e592e libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
(lldb) clrstack
OS Thread Id: 0xa09e1f (10)
Child SP IP Call Site
000070000B59AAF0 00007fff205e592e [HelperMethodFrame: 000070000b59aaf0]
000070000B59AC70 000000012155204D testdump.CrashyClass+<>c.<Exception>b__1_0() [/Users/kylewhite/Workspace/macson/src/Tests/testdump/CrashyClass.cs @ 19]
000070000B59ACA0 0000000121551FA4 testdump.CrashyClass+<>c__DisplayClass13_0.<RunActionInThread>b__0() [/Users/kylewhite/Workspace/macson/src/Tests/testdump/CrashyClass.cs @ 97]
000070000B59ACE0 00000001206BFECE System.Threading.Thread.StartCallback() [/_/src/coreclr/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs @ 105]
000070000B59AE98 000000010232c3c9 [DebuggerU2MCatchHandlerFrame: 000070000b59ae98]
Looks like you need a newer SOS than the released/published version:
dotnet tool uninstall -g dotnet-sos
dotnet tool install -g --version 5.0.0-preview.21366.1 --add-source https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet-tools/nuget/v3/index.json dotnet-sos
dotnet-sos install
Yep, that did the trick - thanks @mikem8361!
Description
When you load up a coredump generated on macOS (by using COMPlus_DbgEnableMiniDump=1) in LLDB, most of the SOS commands work, but
clrstack
doesn't and prints below message (even when it definitely is in a managed thread context):This works as expected if you cause the same crash on Windows and load it up in WinDbg.
I've generated a dump using this
testdump
tool https://github.com/xamarin/macson/tree/kywhi/dev/net6/src/Tests/testdumpConfiguration