WinDbg
Developer(s) | Microsoft |
---|---|
Stable release | 1.2402.24001.0 / February 1, 2024 (2024-02-01) |
Operating system | Microsoft Windows |
Type | Debugger |
License | Commercial |
Website | Debugging Tools at docs.microsoft.com |
WinDbg is a multipurpose debugger for the Microsoft Windows computer operating system, distributed by Microsoft.[1] Debugging is the process of finding and resolving errors in a system; in computing it also includes exploring the internal operation of software as a help to development. It can be used to debug user mode applications, device drivers, and the operating system itself in kernel mode.
Overview
Like the Visual Studio Debugger, WinDbg has a graphical user interface (GUI), but is more powerful and has little else in common. WinDbg can automatically load debugging symbol files (e.g., PDB files) from a server by using a unique ID embedded in the executable (using the "RSDS Guid"[2]) via SymSrv (SymSrv.dll),[3] instead of requiring users to manually find the files. If a private symbol server is configured, the symbols can be correlated with the source code for the binary. This eases the burden of debugging problems that have various versions of binaries installed on the debugging target by eliminating the need for finding and installing specific symbols version on the debug host. Microsoft has a public symbol server that has most of the public symbols for Windows 2000 and later versions of Windows (including service packs).[4]
WinDbg can also be used for debugging kernel-mode memory dumps, created after what is commonly called the Blue Screen of Death which occurs when a bug check is issued.[5] It can also be used to debug user-mode crash dumps. This is known as post-mortem debugging.[6]
WinDbg is distributed as a standalone package from the Windows Debugger Portal and via the Microsoft Store. The WinDBG Debugger Engine is the common debugging back-end between WinDbg and command line debugger front-ends like KD, CDB, and NTSD. Most commands can be used as is with all the included debugger front-ends.
In 2023 Microsoft released a new version of WinDbg which was announced in 2017 as WinDbg Preview (WinDbgX).[7] One of the most notable features is so called Time-Travel-Debugging (TTD).[8] TTD allows a user to record an actual live process (at a performance penalty) to later debug going back and forth in time. In addition, WinDbg has updated user interface, support for dark mode and keyboard navigation. It also allows writing scripts in the JavaScript language.[9][10]
Extensions
WinDbg allows the loading of extension DLLs[11] that can augment the debugger's supported commands and allow for help in debugging specific scenarios: for example, displaying an MSXML document given an IXMLDOMDocument, or debugging the Common Language Runtime (CLR).[12] These extensions are a large part of what makes WinDbg such a powerful debugger. WinDbg is used by the Microsoft Windows product team to build Windows, and everything needed to debug Windows is included in these extension DLLs.
Extension commands are always prefixed with !.
While some extensions are used only inside Microsoft, most of them are part of the public Debugging Tools for Windows package.
The extension model is documented in the help file included with the Debugging Tools for Windows.
Ext.dll
Ext is a standard Windows Debugger extension that ships with WinDBG and is loaded by default.
!analyze command
The most commonly used command is !analyze -v,[13] which analyzes the current state of the program being debugged and the machine/process state at the moment of crash or hang. This command is often able to debug the current problem in a completely automated fashion.
When used without any switches, !analyze simply returns the results of its analysis. The -v and -vv give further details about that analysis.
Wow6432exts.dll
Wow6432exts is a standard Windows Debugger extension that ships with WinDBG. It is used to debug processes running inside WoW64 (32-bit processes running in 64-bit Windows).[14]
SOS.dll
The SOS (Son of Strike)[15] Debugging Extension (SOS.dll) assists in debugging managed programs in Visual Studio and WinDbg by providing information about the internal common language runtime (CLR) environment. This tool requires a project to have unmanaged debugging enabled. SOS.dll is automatically installed with the .NET Framework. To use SOS.dll in Visual Studio, install the Windows Driver Kit (WDK).[16] To debug a process or memory dump, the sos.dll version must match the .NET Framework version. Psscor2 and Psscor4 are a superset of SOS.
Psscor2.dll
Psscor2 is the Windows Debugger Extension used to debug .NET Framework applications that use the .NET CLR version 2.0 (.NET Framework versions 2 through 3.5). Psscor2 was developed for internal use at Microsoft as part of their Product Support Services tools.[17] While Microsoft only released Psscor2 in 2010 [18] Microsoft had been publishing commands from the extension several years before,[19] causing difficulty for those who were trying to follow their processes.
Psscor4.dll
Psscor4 is a Windows Debugger extension used to debug .NET Framework 4 applications.
Coupling with virtual machines
WinDbg allows debugging a Microsoft Windows kernel running on a virtual machine by VMware, VPC or Parallels using a named pipe. This can be achieved by using a virtual COM port. In the case of VMware and VirtualBox, the VirtualKD extension adds native support for VM debugging to the Windows kernel, claiming to speed debugging by a factor of up to 45.[20] For Windows 8 and later, kernel debugging over network is allowed,[21] allowing fast kernel debugging without special configuration.
Protocol
The WinDbg protocol is not documented, but is supported by the IDA Pro and radare2 disassemblers.
See also
References
- ^ EliotSeattle. "Download the Windows Driver Kit (WDK)". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ "PE/COFF Specification Addendum". Retrieved 11 March 2024.
- ^ "Debugging with Symbols (Windows)". Support.microsoft.com. Retrieved 23 April 2018.
- ^ DOMARS. "Microsoft public symbol server". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ "How do I use WinDBG Debugger to troubleshoot a Blue Screen of Death?". TechRepublic. 18 December 2009. Retrieved 23 April 2018.
- ^ "Post-mortem debugging of .NET applications using WinDbg". Tewarid.github.io. 10 September 2010. Retrieved 23 April 2018.
- ^ "New WinDbg available in preview! – Debugging Tools for Windows". blogs.msdn.microsoft.com. Retrieved 2019-08-13.
- ^ "Leveraging the new WinDbgX and Time-Travel-Trace –Script to list all access to files – Rodney Viana's (MSFT) Blog". blogs.msdn.microsoft.com. Retrieved 2019-08-13.
- ^ "Easier WinDbg scripting with Javascript for malware research – Avar 2018". Retrieved 2019-08-13.
- ^ "What is WinDbg". Retrieved 2024-07-27.
- ^ DOMARS. ".load, .loadby (Load Extension DLL)". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ "MSDN Magazine Issues". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ DOMARS. "analyze". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ "Debugging WOW64 (Windows)". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ "SOS Debugging of the CLR, Part 1". Blogs.msdn.com. Archived from the original on 28 June 2010. Retrieved 23 April 2018.
- ^ mairaw. "SOS.dll (SOS Debugging Extension)". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ "New debugger extension for .NET (PSSCOR2)". Blogs.msdn.com. Retrieved 23 April 2018.
- ^ "New debugger extension for .NET, Psscor2, released". Blogs.msdn.com. Retrieved 23 April 2018.
- ^ "MSDN Magazine Issues". Msdn.microsoft.com. Retrieved 23 April 2018.
- ^ "VirtualKD - Windows Kernel Debugger Booster for Virtual Machines". Virtualkd.sysprogs.org. Retrieved 23 April 2018.
- ^ DOMARS. "Setting Up Kernel-Mode Debugging over a Network Cable Manually". Msdn.microsoft.com. Retrieved 23 April 2018.
External links
- Getting Started: Install Instructions, Part 1, Part 2
- Debugging Tools for Windows - information and free downloads
- WinDbg. From A to Z! - Theory and examples, 111 slides
- Common WinDbg Commands (Thematically Grouped)
- Tutorial on solving system crashes using WinDbg Archived 2007-10-12 at the Wayback Machine
- Symbols loading in WinDbg
- Windows Debuggers: Part 1: A WinDbg Tutorial
- KD extension for fast VMware and VirtualBox debugging
- SOS Debugging Extension (SOS.dll)
- psscor4 (.NET 4.0) or psscor2 (.NET 2.0-3.5) Replacement for SOS with a superset of commands
- [1] WinDBG v6.12.2.633 available via Windows Driver Kit Version 7.1.0
- Extension for python scripting (pykd)
- DbgKit: the first GUI extension for Debugging Tools for Windows
- v
- t
- e
environments
Visual Studio | |
---|---|
Others |
- Dynamics AX
- BASIC
- Visual Basic
- Bosque
- Visual C++
- C#
- C/AL
- Dafny
- Dexterity
- F#
- F*
- Visual FoxPro
- Java
- JavaScript
- IronPython
- IronRuby
- Lean
- P
- Power Fx
- PowerShell
- Project Verona
- Q#
- Small Basic
- VPL
- XAML
frameworks
Native | |
---|---|
.NET | |
Device drivers |
SQL Server | |
---|---|
SQL services | |
Other |
debugging
- CodeView
- OneFuzz
- Playwright
- Script Debugger
- WinDbg
- xUnit.net
![](http://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png)