简体   繁体   中英

.NET dump analysis using windbg

I am debugging a .NET 3.5 CLR dump using windbg and psscor2.dll extension. Code where exception happened looks like this:

try 
{
 ...
}
catch
{
 ...
}
catch
{
 ...
}
finally
{
 ...
 // exception I found in the dump happened here.
 ...
}

Ok, so with !pe command I have an exception. It is a null reference exception, but the real cause of the problem is somewhere above, in the try, or in one of the catches, and exception that happened there is masked by this one in the finally block. App crashed in the stress testing, so it is not easy to create a repro, so dump is everything I have.

So, question for the all windbg/.NET internals gurus out there. Do you have any idea how I can get exceptions that happened before this one in the finally block. I don't see anything useful on the stack ( !dso command) and that is more or less where my psscor2 knowledge ends :).

Thanks.

  1. Use windbg attatch to your process, execute "sxe clr" and wait for any null reference 1st chance exceptions and use !pe command to check callstack.
  2. You can use "!dumpheap -type Exception" to find the objects which name include word "Exception", and then find the NullReferenceException objects, use .foreach(ex {!dumpheap -short -mt }){!pe ex}
  3. You can find the parameters or local variables from !dso or !clrstack -a

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM