[Issue 15886] Add an uncaught exception handler

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 7 12:50:09 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15886

--- Comment #3 from Vladimir Panteleev <thecybershadow at gmail.com> ---
(In reply to Marenz from comment #1)
> > Currently, rt.dwarfeh calls terminate(__LINE__) which calls abort()
> 
> If abort() is called that will — outside of a debugger — create a core dump
> allowing you to investigate the memory state at the place where the
> exception was thrown. 
> 
> I don't see why you would need a hook here?

A hook is not *NEEDED* but it sure as heck will help. It's very difficult to
print the exception object from within abort()'s stack frame, because the
exception object may be optimized out and not easily available from the
debugger.

(In reply to Marenz from comment #2)
> The bigger problems I found are that you can't set rt_trapExceptions to 0
> from inside your program or through environment variables / command line
> parameters.

Yes, that would be nice (though it does not absolve my need for this
enhancement). It's trivial to set it from within gdb (break main / run / set
rt_trapExceptions=0 / continue).

It could probably also be made settable via environment variables or the
command line, like the GC tuning parameters.

> That's why I created 
> 
> https://github.com/D-Programming-Language/druntime/pull/1538
> 
> and 
> 
> https://github.com/D-Programming-Language/druntime/pull/1537

Nice.

--


More information about the Digitalmars-d-bugs mailing list