Why are breakpoints caught by the runtime?

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 17 19:18:28 PDT 2014


"Trass3r"  wrote in message news:lonuiouwqmquoyrjhbcv at forum.dlang.org...

> So you can't even do something like
> extern extern (C) __gshared bool rt_trapExceptions;
> void main()
> {
> rt_trapExceptions = false;
> asm { int 3; }
> }
>

No, because rt_trapExceptions is checked before main is called, something 
like this:

int tryMain()
{
    void runMainAndStuff()
    {
        runModuleConstructors();
        main();
    }
    if (rt_trapExceptions)
    {
        try { runMainAndStuff(); } catch { ... }
    }
    else
        runMainAndStuff();
}

It might be possible to _replace_ the variable using some linker magic but I 
haven't managed to do that successfully. 



More information about the Digitalmars-d mailing list