Ignoring First Chance Exception in Windows Debuggers

 

A Debugger attached to a process may break frequently on first chance exceptions and if frequent, is very annoying. You can easily disable reporting of ay specific first chance exception using “sx” debugger command as below. SX stands for Set Exception.

Exceptions:

(27b4.fd8): Integer divide-by-zero – code c0000094 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
002900b9 f77dd8          idiv    eax,dword ptr [ebp-28h] ss:002b:003fedb8=00000000

or

(27b4.fd8): WOW64 breakpoint – code 4000001f (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
ntdll32!LdrpDoDebuggerBreak+0x2c:
77150995 cc              int     3

Handling:

0:000> sxi 4000001f
0:000> sxi c0000094

sx <i ignore | d disable> <exception code>

Use sxr to reset

You can make debugger ignore first chance exception and run a command

0:000> sxi -c ".echo Div by Zero" c0000094

0:000> g
Div by Zero
ntdll!ZwTerminateProcess+0xa:
00000000`76f2001a c3              ret

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s