Why are breakpoints caught by the runtime?

Maxim Fomin via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 15 08:59:31 PDT 2014


On Sunday, 15 June 2014 at 14:50:30 UTC, Trass3r wrote:
> void main()
> {
> 	asm { int 3; }
> }
>
> object.Error: Breakpoint
> ----------------
> 0x00402013 in _Dmain at bptest.d(6)
> 0x00402314 in void rt.dmain2._d_run_main(int, char**, extern 
> (C) int function(char[][])*).runAll().void __lambda1()
> 0x004022E7 in void rt.dmain2._d_run_main(int, char**, extern 
> (C) int function(char[][])*).runAll()
> 0x00402200 in _d_run_main
>
>
> Is there any good reason to catch that?
> I really want the debugger to fire up.

It is default windows runtime behavior and unless it provides 
some interface to adjust it, you can not fix it (except patching 
and rebuilding runtime, of course). Or, perhaps, you can bypass 
runtime behavior by using windows api directly to adjust the 
behavior to your needs.

By the way, judging by that runtime catches windows exceptions 
and rethrows them as errors (object.Error: Breakpoint), you are 
not encouraged to catch them.


More information about the Digitalmars-d mailing list