Debugging a Program With dbx

Commands for Handling Exceptions

exception [-d | +d]

Use this command to display an exception's type. This variable can be used at any time during debugging. With --d, the derived type is shown; otherwise, the static type is shown. This command overwrites the dbxenv variable output_dynamic_type setting.

intercept [-a | -x | typename]

You can intercept, or catch, exceptions of a specific type before the stack has been unwound. Use this command with no arguments to list the types that are being intercepted. Use --a to intercepted all throws. Use typename to add a type to the intercept list. Use --x to exclude a particular type from being intercepted.

For example, to intercept all types except int, you could enter:


(dbx) intercept -a
(dbx) intercept -x int

unintercept [-a | -x | typename]

Use this command to remove exception types from the intercept list. Use this command with no arguments to list the types that are being intercepted (same as intercept). Use --a to remove all intercepted types from the list. Use typename to remove a type from the intercept list. Use --x to stop excluding a particular type from being intercepted.

whocatches typename

This command reports where, if at all, an exception of typename would be caught if thrown at the current point of execution. Use this command to find out what would happen if an exception were thrown from the top frame of the stack.

The line number, function name, and frame number of the catch clause that would catch typename is displayed.