{"id":23725,"date":"2018-05-18T20:17:00","date_gmt":"2018-05-18T20:17:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/?p=23725"},"modified":"2019-04-11T05:28:27","modified_gmt":"2019-04-11T12:28:27","slug":"debugging-beyond-visual-studio-windbg","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/debugging-beyond-visual-studio-windbg\/","title":{"rendered":"Debugging Beyond Visual Studio &#8211; WinDbg"},"content":{"rendered":"<p>In this post, Sr. App Dev Managers Al Mata, Candice Lai, and Syed Mehdi gives a walkthrough of WinDbg.<\/p>\n<hr \/>\n<p>You\u2019re likely a developer and have used a code editor to debug and analyze your application failures. Few developers know or understand the \u201cold school\u201d way of troubleshooting to uncover additional details; enter the <strong>WinDbg<\/strong> debugger.<\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/debugger-download-tools\">WinDbg<\/a> is a general-purpose debugger for Windows operating system applications and code. It helps Developers find and resolve errors in their application, memory, system and drivers to name a few. This article introduces you to the WinDbg debugging concept and tool.<\/p>\n<h5><span style=\"font-size: large;\">Getting started with WinDbg:<\/span><\/h5>\n<p><strong>1. Download the Debugging Tools for Windows from the Microsoft <\/strong><a href=\"https:\/\/developer.microsoft.com\/en-us\/windows\/hardware\/download-windbg\"><strong>website<\/strong><\/a><\/p>\n<p>We recommend you install <strong>WinDbg Preview<\/strong> as it offers more modern visuals, faster windows, a full-fledged scripting experience, built with extensible debugger data model front and center.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0018.png\"><img decoding=\"async\" title=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image001_thumb7.png\" alt=\"clip_image001\" width=\"644\" height=\"449\" border=\"0\" \/><\/a><\/p>\n<p><b>2. <\/b><b>When clicking Download from the Microsoft Store, a prompt will appear, select \u201cGet\u201d<\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0035.jpg\"><img decoding=\"async\" title=\"clip_image003\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image003_thumb4.jpg\" alt=\"clip_image003\" width=\"644\" height=\"411\" border=\"0\" \/><\/a><\/p>\n<p><b>3. <\/b><b>Windows will start the download and installation process. A prompt will confirm installation status.<\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0045.png\"><img decoding=\"async\" title=\"clip_image004\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image004_thumb4.png\" alt=\"clip_image004\" width=\"644\" height=\"413\" border=\"0\" \/><\/a><\/p>\n<p><b>4. <\/b><b>Select to \u201cPin to Start,\u201d close windows by clicking \u201cX\u201d on the top right of Window.<\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image00615.jpg\"><img decoding=\"async\" title=\"clip_image006\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image006_thumb14.jpg\" alt=\"clip_image006\" width=\"644\" height=\"378\" border=\"0\" \/><\/a><\/p>\n<p><b>5. <\/b><b>Set the Windows Symbol Server path in File &gt; Settings &gt; Symbol path (see example below)<\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0089.jpg\"><img decoding=\"async\" title=\"clip_image008\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image008_thumb8.jpg\" alt=\"clip_image008\" width=\"621\" height=\"484\" border=\"0\" \/><\/a><\/p>\n<p><b>6. <\/b><b>Go to your Start menu, select the WinDbg Preview to launch the application<\/b><\/p>\n<p><b>7. <\/b><b>The WinDbg initial view<\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0107.jpg\"><img decoding=\"async\" title=\"clip_image010\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image010_thumb6.jpg\" alt=\"clip_image010\" width=\"620\" height=\"484\" border=\"0\" \/><\/a><\/p>\n<p><strong>\u00a0<\/strong><strong>8. What is the difference between User Mode-Debugging and Kernel-Mode Debugging?<\/strong><\/p>\n<p>In User mode debugging, the code normally delegates to the system API\u2019s 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.<\/p>\n<p>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 <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/windbg-kernel-mode-preview\">here<\/a> for additional information on Kernel mode debugging.<\/p>\n<p><strong>9. Advantages of WinDbg:<\/strong><\/p>\n<ul>\n<li>Extensive numbers of commands and extensions.<\/li>\n<li>A useful tool to help understand OS and software running on the system being debugged.<\/li>\n<li>Lightweight and can be used in production as it has no dependency, only require an executable (.exe) to run.<\/li>\n<li>A useful tool to help isolate User or Kernel mode code that&#8217;s difficult to troubleshoot on Windows.<\/li>\n<\/ul>\n<p><b>10. Common User mode debugging commands:<\/b><\/p>\n<p><b><i>.hh <\/i><\/b>(Open WinDbg\u2019s help)<b><i><\/i><\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0125.jpg\"><img decoding=\"async\" title=\"clip_image012\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image012_thumb5.jpg\" alt=\"clip_image012\" width=\"991\" height=\"772\" border=\"0\" \/><\/a><b><\/b><\/p>\n<p><b><i>Vertaget <\/i><\/b>(Get the version of the target computer)<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0145.jpg\"><img decoding=\"async\" title=\"clip_image014\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image014_thumb5.jpg\" alt=\"clip_image014\" width=\"720\" height=\"772\" border=\"0\" \/><\/a><b><\/b><\/p>\n<p><b><i>Symbol Path <\/i><\/b>(Display or set symbol search path)<b><i><\/i><\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0163.jpg\"><img decoding=\"async\" title=\"clip_image016\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image016_thumb3.jpg\" alt=\"clip_image016\" width=\"720\" height=\"772\" border=\"0\" \/><\/a><b><\/b><\/p>\n<p><b><i>Version <\/i><\/b>(Dump version info of debugger and loaded extension DLLs)<b><i><\/i><\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0181.png\"><img decoding=\"async\" title=\"clip_image018\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image018_thumb1.png\" alt=\"clip_image018\" width=\"1028\" height=\"663\" border=\"0\" \/><\/a><\/p>\n<p><b><i>!ext.help<\/i><\/b>(General extensions)<\/p>\n<p><b><i><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image020.png\"><img decoding=\"async\" title=\"clip_image020\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image020_thumb.png\" alt=\"clip_image020\" width=\"992\" height=\"772\" border=\"0\" \/><\/a><\/i><\/b><\/p>\n<p><b><i>!analyze -v (<\/i><\/b>Display information about the current exception or bug check; verbose)<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image022.png\"><img decoding=\"async\" title=\"clip_image022\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image022_thumb.png\" alt=\"clip_image022\" width=\"992\" height=\"772\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><b>11. Common Kernel mode debugging commands:<\/b><\/p>\n<p><b><i>!analyze<\/i><\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0242.jpg\"><img decoding=\"async\" title=\"clip_image024\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image024_thumb2.jpg\" alt=\"clip_image024\" width=\"720\" height=\"772\" border=\"0\" \/><\/a><b><\/b><\/p>\n<p><b><i>!error <\/i>(plus error code, e.g. \u201c!error c0000005)<i><\/i><\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0263.jpg\"><img decoding=\"async\" title=\"clip_image026\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image026_thumb3.jpg\" alt=\"clip_image026\" width=\"720\" height=\"772\" border=\"0\" \/><\/a><b><\/b><\/p>\n<p>&nbsp;<\/p>\n<p><b>12. Useful links:<\/b><\/p>\n<blockquote><p><span style=\"font-size: 10pt;\">Debugging Using WinDbg Preview:<\/span><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/debugging-using-windbg-preview\"><span style=\"font-size: small;\">https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/debugging-using-windbg-preview<\/span><\/a><\/p>\n<p><span style=\"font-size: 10pt;\">Getting Started with WinDbg Microsoft Docs<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/getting-started-with-windbg\">: <\/a><\/span><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/getting-started-with-windbg\"><span style=\"font-size: small;\">https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/getting-started-with-windbg<\/span><\/a><\/p>\n<p><span style=\"font-size: 10pt;\">Common WinDbg Commands:<\/span><\/p>\n<p><a href=\"http:\/\/windbg.info\/doc\/1-common-cmds.html\"><span style=\"font-size: small;\">http:\/\/windbg.info\/doc\/1-common-cmds.html<\/span><\/a><\/p>\n<p><span style=\"font-size: 10pt;\">WinDbg on Channel9:<\/span><\/p>\n<p><a href=\"https:\/\/channel9.msdn.com\/Tags\/windbg\">https:\/\/channel9.msdn.com\/Tags\/windbg<\/a><\/p><\/blockquote>\n<hr \/>\n<p><a href=\"https:\/\/blogs.msdn.com\/b\/premier_developer\/archive\/2014\/09\/15\/welcome.aspx\"><strong>Premier Support for Developers<\/strong><\/a> provides strategic technology guidance, critical support coverage, and a range of essential services to help teams optimize development lifecycles and improve software quality.\u00a0 Contact your Application Development Manager (ADM) or <a href=\"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/contact-us\/\">email us<\/a> to learn more about what we can do for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, Sr. App Dev Managers Al Mata, Candice Lai, and Syed Mehdi gives a walkthrough of WinDbg. You\u2019re likely a developer and have used a code editor to debug and analyze your application failures. Few developers know or understand the \u201cold school\u201d way of troubleshooting to uncover additional details; enter the WinDbg debugger. [&hellip;]<\/p>\n","protected":false},"author":582,"featured_media":37840,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[82,118],"class_list":["post-23725","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-permierdev","tag-debug","tag-debugging"],"acf":[],"blog_post_summary":"<p>In this post, Sr. App Dev Managers Al Mata, Candice Lai, and Syed Mehdi gives a walkthrough of WinDbg. You\u2019re likely a developer and have used a code editor to debug and analyze your application failures. Few developers know or understand the \u201cold school\u201d way of troubleshooting to uncover additional details; enter the WinDbg debugger. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/23725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=23725"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/23725\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/37840"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=23725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=23725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=23725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}