Debugging Beyond Visual Studio – WinDbg

Posted Javi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Debugging Beyond Visual Studio – WinDbg相关的知识,希望对你有一定的参考价值。

Getting started with WinDbg:

1. Download the Debugging Tools for Windows from the Microsoft website

We recommend you install WinDbg Preview as it offers more modern visuals, faster windows, a full-fledged scripting experience, built with extensible debugger data model front and center.

技术分享图片

2. When clicking Download from the Microsoft Store, a prompt will appear, select “Get”

技术分享图片

3. Windows will start the download and installation process. A prompt will confirm installation status.

技术分享图片

4. Select to “Pin to Start,” close windows by clicking “X” on the top right of Window.

技术分享图片

5. Set the Windows Symbol Server path in File > Settings > Symbol path (see example below)

技术分享图片

6. Go to your Start menu, select the WinDbg Preview to launch the application

7. The WinDbg initial view

技术分享图片

 

8. What is the difference between User Mode-Debugging and Kernel-Mode Debugging?

In User mode debugging, the code normally delegates to the system API’s to access hardware or memory. You typically are debugging a single executable, which is separated from other executables by the OS. Typical scenario is to isolate memory or application hang issues on Win32 desktop applications. In User mode, the debugger is running on the same system as the code being debugged.

In Kernel mode debugging, the code normally has unrestricted access to the hardware. Typical scenario is driver code developed for hardware devices. When debugging in Kernel mode you typically use two different systems. One system runs the code that is being debugged, and another runs the debugger, usually connected with a cable. Click here for additional information on Kernel mode debugging.

 

9. Advantages of WinDbg:

  • Extensive numbers of commands and extensions.
  • A useful tool to help understand OS and software running on the system being debugged.
  • Lightweight and can be used in production as it has no dependency, only require an executable (.exe) to run.
  • A useful tool to help isolate User or Kernel mode code that‘s difficult to troubleshoot on Windows.

 

10. Common User mode debugging commands:

.hh (Open WinDbg’s help)

技术分享图片

 

 

 

 

 

 

Vertaget (Get the version of the target computer)

技术分享图片

 

 

 

 

 

 

 

Symbol Path (Display or set symbol search path)

技术分享图片

 

Version (Dump version info of debugger and loaded extension DLLs)

技术分享图片

 

!ext.help(General extensions)

技术分享图片

!analyze -v (Display information about the current exception or bug check; verbose)

技术分享图片

 

 

 

 

11. Common Kernel mode debugging commands:

!analyze

技术分享图片

 

 

 

 

 

 

!error (plus error code, e.g. “!error c0000005)

技术分享图片

 

 

 

 

 

 

12. Useful links:

Debugging Using WinDbg Preview:

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-using-windbg-preview

Getting Started with WinDbg Microsoft Docs:

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/getting-started-with-windbg

 

Common WinDbg Commands:

http://windbg.info/doc/1-common-cmds.html

 

Elementary User-Mode Debugging:

https://microsoft.sharepoint.com/teams/bidpwiki/Pages1/Elementary%20User-Mode%20Debug.aspx

以上是关于Debugging Beyond Visual Studio – WinDbg的主要内容,如果未能解决你的问题,请参考以下文章

求助 remote debugging is not supported visual studio 2013

Paper Reading: Beyond Correlation Filters: Learning Continuous Convolution Operators for Visual Trac

使用Visual Studio调试用户模式进程(Debugging a User-Mode Process Using Visual Studio)

Visual Studio Code-使用Chrome Debugging for VS Code调试JS

Just-In-Time Debugging in Visual Studio 禁止VS在服务器上调试

VS 本地调试 x64 平台 “Visual Studio Remote Debugging Monitor 已停止工作” 问题解决