October 12, 2008

How to raise an user break exception (int 3) dynamically in my code?

The embedded assembly code way:
_asm int 3

The Windows API way:
DebugBreak()

After raised an user break exception in your code, the program can be attached to a debugger. For some situation, this is a good way to debug your buggy problem.

Reference in MSDN:
http://msdn.microsoft.com/en-us/library/ms679297.aspx