Menu

Microsoft Debugging Tools for Windows is available in three different versions: a 32-bit package and two 64-bit packages. These packages can be installed from the Web.

Some Application Verifier actions can result in an exception being raised. The debugger must be set to catch these exceptions on the second chance, because Application Verifier itself will be handling the first chance exceptions.

The exceptions raised are of three types:

  • An access violation exception (0xC0000005) is generated if the heap option detects a heap buffer overrun. In some cases, the Check system path usage option can cause an access violation as well.

  • An invalid handle exception (0xC0000008) is generated when the Detect invalid handle usage option detects an invalid handle operation.

  • A stack overflow exception (0xC00000FD) is generated when the Check for adequate stack option detects that the initial stack was too short.

The easiest way to prepare for these events is to start the debugger on a command line as follows:

windbg�-xd�av�-xd�ch�-xd�sov�ApplicationCommandLine

or

cdb�-xd�av�-xd�ch�-xd�sov�ApplicationCommandLine

If you have already started the debugger, you can use the sxd�(Set Exceptions) command to catch all access violations, invalid handles, and stack overflows as second-chance exceptions:

0:000>�sxd�av�

0:000>�sxd�ch�

0:000>�sxd�sov�

Note��It is theoretically possible to control Application Verifier through a kernel debugger. However, this is not recommended � it requires frequent use of the .process and .pagein commands, yet it gives you no more power than using a user-mode debugger.

Installing from the Web

To download the latest version of the tools, go to the Debugging Tolls for Windows website (http://go.microsoft.com/fwlink/?linkid=8708) and follow the instructions. The tool package is updated frequently, so updating your tools from the website assures that you have the most powerful debugging tools possible.

Configuring Hardware for User-Mode Debugging

User-mode debugging is generally done on a single machine: the debugger is run on the same computer as the application that failed.

In this case, no specific hardware setup is required. Throughout this document, the terms host computer and target computer are interchangeable in this case.

Configuring Software for User-Mode Debugging

Basic User-Mode Configuration

Before you can begin user-mode debugging, you must install the necessary symbol files and set certain environment variables.

Installing the Symbol Files

You must install the symbol files for the user-mode process that is being debugged. If this is an application you have written, it should be built with full symbol files. If it is a commercial application, the symbol files may be on the product disk; if not, contact the manufacturer.

If possible, you should also install the symbol files for the version of Microsoft Windows on which the user-mode process is running.

If you are performing remote debugging, the symbol file location depends on the method you are using:

If you are performing remote debugging through the debugger, the symbol files should be on the computer with the debugging server.

If you are performing remote debugging through remote.exe, the symbol files should be on the computer with the debugger.

If you are performing remote debugging through a process server or a KD connection server, the symbol files should be on computer with the smart client.

If you are controlling the user-mode debugger from the kernel debugger, the symbol files need to be on both computers.

Configuring Environment Variables

The debugger uses a variety of environment variables to indicate a number of important settings.

For more information on debuggers, please visit http://go.microsoft.com/fwlink/?linkid=8708.

Configuring Application Verifier with the Debugger using the Command line

To configure Application Verifier you can use the CDB or NTSD command line.

Use the following command line:

cdb�OtherOptions�-vf:Flags�Target

Where Target is the name of the target application, and Flags specifies the desired Application Verifier options that are to be applied to this target.

Flags should be a sum of the bits representing the desired options. The individual bit values are as follows:

Flag value

Meaning

00000001

HEAP CHECKS

00000004

HANDLE CHECKS

00000008

LOW RESOURCE SIM CHECKS

00000020

TLS CHECKS

00000040

DIRTY STACKS

00000200

DANGEROUS APIS

00001000

EXCEPTION CHECKS

00002000

MEMORY CHECKS

00020000

MISCELLANEOUS CHECKS

00040000

LOCK CHECKS