August 17, 2012

Debugging Windows Exceptions with Adplus V7

A tool called Adplus can be used on Windows to get more information on unexpected exceptions, hangs and crashes. If one of these has been reported on a production machine then run Adplus in the background, monitoring that process, and check from dump files afterwards. The dump files should include information on that happened just before the exception, crash or hang. The dump files can be opened in Visual Studio or Windbg for example and ran as a debugging session.

There is a new version of Adplus available, Adplus V7, it's an exe where the old was a vbs. Adplus comes with the "Debugging Tools for Windows", google this to find the latest version.

First stop

To get a dump on an exe use the -sc switch with adplus (ensure this is the last switch on the command line) and point it to the full path of the exe. If adplus is working it will launch the exe in a separate window, if not then it hasn't found the exe.

To get a dump on a website running in IIS use the -iis switch.

For some brief information on the "differences between a mini and a full dump".

  1. Visual Studio 2010 is the most straight forward debugging tool I've seen to use when debugging dumps. Simply file open the dump file.
  2. Set the symbols path to the pdb location if there is one.
  3. Debug with mixed.
An alternative in Windbg, also provided with the Debugging Tools for Windows. This is not as intuitive.
Note that the sos will need to be loaded before debugging .NET code,

  1. Enter the command in the Windbg command box, the same command that you created the dump with e.g. .loadby sos clr.
  2. To show the stacktrace type !CLRStack -a. Scroll to the top of the list to see the last call in the stack, the objects can be seen here.
  3. To view the object type !do <object address>.