Windows Debugging tools Quick tutorial [WinDbg]

Published Sunday, May 17, 2009 11:42 PM

last week end we have faced memory leaks, we had no idea what was the cause of the problem. we were directed by microsoft to use the debugging tools.

this is a quickest possible startup tutorial for that tool.

[Warning] using this tool affects the performance of your applications dramatically please make sure you don’t run it on a production server unless there’s no other way.

    1. download link
      you are looking for “Install Debugging Tools for Windows xx-bit Version”
      you’ll be redirected to the download page u’ll need to look for the “current version”
    2. install the tool
      this is probably the only straight forward step in this tutorial
    3. Copy SOS.dll *
      u need to copy this dll from your framework folder
      usually %windir%\Microsoft.NET\Framework\v2.0.50727
      to your windbg folder
      usually %ProgramFiles%\Debugging Tools for Windows (x86)
    4. Open the WindDbgTool
      image
    5. Symbol data
      to view internals of assemblies you need symbol data the easiest way is to have it downloaded automatically. you can do that by
      image
      and typing in

      srv*c:\symbols\public*http://msdl.microsoft.com/download/symbols
       
      image

      just make sure you have internet connection so this can be downloaded.
    6. Get a Memory Dump of your application
      well this is another 3 step tutorial
      .
    7. Open the Dump
      ”File”->”Open Crash dump” (if prompted you don’t have to save.)
      select the file and wait for the application to be ready
      image 

      this is actually an option i like as attaching to the process causes the application to be extremely slow and you can always ask your client to create a dump and FTP it to you
    8. you need to load “SOS”
      in the previous window the text box in the bottom is where you’ll type in commands.
      the first you need is to load SOS

      so type in
      .load SOS
      AND NOTHING HAPPENS, yes there’s no confirmation that the thing was loaded.

    9. your first Command
      now there’s a whole bunch of commands that can be executed from the SOS you can list all these commands by typing in
      !sos.help
    10. need help
      and now you can explore the memory dump of your application on your own just consider the hints in the next box.

      //!SOS.help <methodName>
      
      !SOS.help DumpDomain
      
      !SOS.DumpDomain



This is just a quick help to get you started. if you need to understand what’s behind this please refer http://blogs.msdn.com/tess/  thank you Tess for the time

 

Filed under: , ,

Comments

# DotNetKicks.com said on Sunday, May 17, 2009 11:52 PM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Leave a Comment

(required) 
(required) 
(optional)
(required)