Reputation: 21774
We have a large ASP.NET application that occasionally crashes due to StackOverflowException
s. Because these aren't handled very elegantly by .NET, we are reduced to post-mortem debugging without any of our normal exception logs and stack traces. Once we find where the issue is occurring it is generally quite easy to fix; the hard part is pin-pointing where in the codebase the error happens.
The process dump file that we get after the crash seems like it would help greatly in this effort, but thus far, we've been unable to figure out how to best use it. You can (very, very, slowly) "debug" the process using visual studio, but this basically takes forever loading up MSFT symbols and then won't load the symbols for our application DLLs (so you can't see the interesting parts of the call stack).
It seems like there must be a straightforward way to go from:
to the full managed call stack; can anyone can describe (or point to a tutorial) for doing this (using VS, WinDbg, or any other tool)?
Upvotes: 2
Views: 1180
Reputation: 59564
You should get quite far with this approach:
Make sure you have the correct symbols
.symfix d:\symbols
Load the .NET extension in WinDbg
.loadby sos clr
.loadby sos mscorwks
Select the thread with the exception
~#s
Print the exception
!pe
and the callstacks
!clrstack
!dumpstack
If you have trouble with the version of SOS or mscordacwks, because the dump is not from the same machine, get the correct version from the server using Mscordacwks Collector.
Also note that there is always one StackOverflowException pre-allocated, but not necessarily thrown. The output of a command like
!dumpheap -stat -type StackOverflowException
might be misleading.
Upvotes: 0
Reputation: 55760
Yes, there is a way to get the managed stack, and more..
What you are looking for is the SOS.dll debugger extension for WinDbg. The SOS.dll debugger extension is located in the same folder where the .NET framework is installed (ie. C:\Windows\Microsoft.NET\Framework\v4.0.30319\SOS.dll)
Once you load SOS.dll into WinDbg you can query for:
Here is a cheat-sheet with commands to get around using sos.dll.
Upvotes: 2