Windows Debugger, WinDbg for short,.NET strongest analysis debugging tool. It can be used to:
- Debug kernel mode and user mode code
- Analysis of the Crash dump
- Analyze CPU register information during code execution
We can use WinDbg to debug the following specific problems:
- Thread block
- Memory leaks
- Analyze the query runtime thread stack and variables
- Analyze the cause of the process Crash
- Analyze the CPU consumption causes
- View and debug CLR exceptions
- …
So, first of all, we first download Windbg installation, configuration.
Download and install WinDbg and configure the debugging environment
- Recommended download link
Raw.githubusercontent.com/EasyDarwin/…
Or download the WingDbg Preview version from the Windows Store
Step by step after downloading can be installed
- Configuration debug symbol
The question is: Why configure debug symbols?
To use all the advanced features provided by WinDbg, you must load the appropriate symbols: we can debug, view, for example. NET CLR program stack, at which point the corresponding debug symbol is loaded.
Microsoft provides a unified debugging service server address:
1 http:/ / msdl.microsoft.com/download/symbols, will provide the debug symbols, the address download cache to the local, can use Windbg debugging.
1 srv*c:\symcache*http://msdl.microsoft.com/download/symbols; c:\symcache
Copy the code
3. Download and use the WinDbg debugger extension
Windbg debugger extension is the essence and core of Windbg debugging, so to speak, to master all kinds of Windbg debugger extension, you will master all kinds of debugging skills.
By default, WinDbg debugging instructions are limited, with a few WinDbg debugger extensions to make it easier. NET program debugging
SOS debug extension: along with. NET Framework installation, can be directly loaded:.load SOS CLR
Where is the SOS DLL (32-bit and 64-bit)?
4.0, 32-bit — > C:\Windows\Microsoft.NET\Framework\v4.0.30319 4.0, The 64 – bit \ Framework64 \ v4.0.30319 – > C:\Windows\Microsoft.NET
This extension is widely used by Microsoft Support Engineers in Troubleshooting process applications
Download: www.microsoft.com/en-us/downl…
Once the download is complete, copy the 32/64-bit Mex. DLL to the WinDBG installation directory
For example: C:\Program Files\Debugging Tools for Windows (X64)\ mex.dll
Detailed instructions: github.com/REhints/Win…
With Windbg downloaded, installed, and configured, let’s take a look at some basic debugging commands.
Two, the basic WinDbg debugging instructions
- WinDbg built-in debugging instructions
For more instructions, check out the link:
Docs.microsoft.com/zh-cn/windo… 2. SOS debugging extension common debugging commands
3. Mex debug extension common debugging commands
For more debugging instructions on Mex, see:Github.com/REhints/Win…