views:

56

answers:

1

Is it possible to use windbg commands like !locks and .loadby sos mscorwks from the Visual Studio command window (in a debug session)? I've noticed I can use eg k to print a stack trace, so I was wondering if there is some way to get access to the other commands.

+2  A: 

Yes you can do this.

  1. Attach Visual studio 2008 to your process for debugging.
  2. Break at some code.
  3. Go to immediate window
  4. type !load sos
  5. Now you are free to use any of the windbg commands like !EEHeap,!DumpHeap

There are some conditions. You need to enable unmanaged code debugging in your project properties. Normally in 64 bit version studio doesn't support this.

Have fun.

ferosekhanj
@ferosekhanj: cool, thanks for that. Any idea if I can get access to the unmanaged windbg calls like locks or analyze?
ngoozeff
@ngoozeff:I think only the sos commands are possible here!!Someone correct me if I am wrong
ferosekhanj
Sorry to be nitpicking here, but those are not WinDbg commands, but SOS commands. Unfortunately the regular WinDbg commands are not available from VS afaik, which makes it a bit harder to use SOS. Also, VS doesn't support all the necessary IDebugClient interfaces, so output from SOS is a bit noisy in VS.
Brian Rasmussen