views:

48

answers:

1

I'm trying to automate the process of opening crash dumps for managed applications and retrieving the stack trace. Windgb works sometimes, but getting it to load the correct version of sos.dll is a nightmare unless the machine processing the dump is practically identical to the machine where the dump occured.

Visual Studio, on the other hand, does the job simply. I open the dump, go to the immediate window, and type

.load \\<machine where dump occured>\c\windows\microsoft.net\framework\v2.0.50727\sos.dll

!clrtsack 

And eveything works just fine.

Can I script this process in visual studio? If not, is there a back end debugger used by visual studio that is the same as windbg?

A: 

Instead of passing the complete path to the .load command, you could use the .loadby command instead, to give WinDbg a hint about where the DLL should be located.
The command receives two arguments:

  1. The name of the DLL you want to load (in your case, SOS)
  2. The name of an already-loaded DLL, that should be contained in the same folder as the first, requested DLL (in your case, clr for .Net v4.0, or mscorwks for earlier versions).

For example:

// v4.0
>.loadby sos clr

// earlier versions
>.loadby sos mscorwks
Liran