Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using windbg from Visual Studio

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.

like image 299
ngoozeff Avatar asked Aug 09 '10 08:08

ngoozeff


People also ask

Does Visual Studio use WinDbg?

WinDbg uses the Microsoft Visual Studio debug symbol formats for source-level debugging.

How do I connect to WinDbg?

On the remote computer, open WinDbg, and choose Connect to Remote Session from the File menu. Under Connection String, enter the following string. where YourHostComputer is the name of your host computer, which is running the debugging server. Select OK.

Where do I put WinDbg?

The WinDbg Preview debugger is available in the Microsoft Store. It requires Windows 10 Anniversary Update to install. To install it, open the Microsoft Store and search for "WinDbg Preview", or use the following link to navigate directly to WinDbg Preview. Once the app is a located, select it to download and install.


1 Answers

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.

like image 187
ferosekhanj Avatar answered Oct 28 '22 17:10

ferosekhanj