Debugging Tools for Windows

Exceptions

The Exceptions section enables you to customize the actions to be taken when a given exception breaks into the debugger. You can also define new custom exceptions to be monitored.

    <Exceptions>
        <!-- options act on all currently defined exceptions -->
       <Option>  FullDumpOnFirstChance  </Option>
       <Option>  MiniDumpOnSecondChance  </Option>
       <Option>  NoDumpOnFirstChance  </Option>
       <Option>  NoDumpOnSecondChance  </Option>

        <!-Defining new exceptions -->
       <NewException>
           <Code> ExceptionCode </Code>
           <Name> ExceptionName </Name>
       </NewException>

        <!-Configuring already defined exceptions -->
       <Config>
          <Code> { ExceptionCode | AllExceptions } </Code>
          <Actions1> Actions  </Actions1> 
          <CustomActions1> CustomActions  </CustomActions1> 
          <Actions2> Actions  </Actions2> 
          <CustomActions2> CustomActions  </CustomActions2> 
          <ReturnAction1> G | GN | GH | Q | QD } </ReturnAction1> 
          <ReturnAction2> G | GN | GH | Q | QD } </ReturnAction2> 
       </Config>  
    </Exceptions>

The <Option> tag enables you to set some global behavior options (FullDumpOnFirstChance, MiniDumpOnSecondChance, NoDumpOnFirstChance, and NoDumpOnSecondChance).

The <NewException> tag enables you to define a new exception by providing an exception code and an exception name. ExceptionCode should be a hexadecimal number or a short abbreviation that the debugger knows. ExceptionName should be short and not include spaces.

The following example shows ExceptionCode and ExceptionName.

           <Code> 0x80010005 </Code>
           <Name> My_Custom_Exception </Name>

The <Config> tag enables you to configure the behavior of already defined exceptions. You can configure a given exception by defining its code in the <Code> tag. If you use the AllExceptions keyword, the behavior applies to all defined exceptions. You can also define multiple exception codes separated by semicolons.

<Config> has the following parameters:

Actions
The Action parameters that are used in the <Actions1> and <Actions2> tags define the actions to be taken on first and second chance exceptions, respectively.

The actions can be a set of predefined actions, separated by semicolons.

<Actions1>MiniDump;Stack;Log;EventLog</Actions1>

If you do not want any actions, use the Void keyword.

<Actions1>Void</Actions1>

You can use the following case-sensitive actions:

Log
Adds a log entry that is related to the exception.
EventLog
Adds an event log that is related to the exception.
MiniDump
Creates a minidump.
FullDump
Creates a full dump.
MiniDumpOver
Creates a minidump and overwrites multiple instances for the same exception.
FullDumpOver
Creates a full dump and overwrites multiple instances for the same exception.
Stack
Lists the faulting call stack into the log.
Stacks
Lists all thread call stacks into the log.
LoadedModules
Lists all loaded modules.
MatchingSymbols
Lists all modules that have matching symbols.
Void
Does nothing.
CustomActions
The CustomAction parameters that are used in the <CustomActions1> and <CustomActions2> tags define additional actions to be taken on first and second chance exceptions, respectively. You can include any debugger commands that are available in CDB. You should separate multiple commands by semicolons, as follows.

<CustomActions1>!runaway;!heap</CustomActions1>

{ G | GN | GH | Q | QD }
Specifies how to return from the debugger after taking the specified actions. <ReturnAction1> and <ReturnAction2> are used after first and second chance exceptions, respectively. These actions work like the g, gn, gh, q, and qd debugger commands. QD is supported only in Microsoft Windows XP and later versions of Windows.

The following example shows a complete <Config> section.

<Config>
    <Code> AllExceptions    </Code>
    <Actions1>   Log;Stack     </Actions1>
    <Actions2>   Log;MiniDump     </Actions2>
    <CustomActions2>   !runaway     </CustomActions2>
    <ReturnAction1> GN   </ReturnAction1>
    <ReturnAction2> Q    </ReturnAction2>
</Config>
<Config>
    <Code> av   </Code>
    <Actions1>   Log;Stack;MiniDump    </Actions1>
    <Actions2>   Log;Stack;FullDump     </Actions2>
</Config>

The first part of this example configures all exceptions to create a log and list the faulting stack for a first chance exception and create a minidump and a log for a second chance. The second part configures the av exception to create a minidump on first chance and a full dump on second chance.

Build machine: CAPEBUILD