[phobos] Calling abort() on unhandled exception

Leandro Lucarella luca at llucax.com.ar
Fri Jul 30 08:45:24 PDT 2010



Steve Schveighoffer, el 30 de julio a las 07:54 me escribiste:
> > From: Sean Kelly <sean-m2zzWtmgR3jd0EmSfiOO99i2O/JbrIOy at public.gmane.org>
> > To: Discuss the phobos library for D <phobos-4o3eaN+cb9R8UrSeD/g0lQ at public.gmane.org>
> > Sent: Fri, July 30, 2010 10:46:38 AM
> > Subject: Re: [phobos] Calling abort() on unhandled exception
> > 
> > That's the thing.  With Leandro's proposed behavior, the stack isn't  unwound 
> >because the exception is effectively never caught.  The runtime can  still print 
> >the error message like it does now, it just works as if from a  signal handler.
> >
> 
> With stack trace?  I'd much rather have a stack trace than a core file.  A stack 
> trace can easily be read, is easy to email/attach to a bug report, and does not 
> require duplicating the entire environment to use.


Why this is SO hard to understand. Please, read it carefully:

abort() != core dump
abort() != not printing a stack trace

You can have it all. You can print just an error message as Walter and
Andrei wants (which I think is just sick), you can print a stack trace
as you want (the same for me, I don't mind it) and *after* that, call
abort() (this is the only thing I care about).

The let the OS do with the abort() whatever it want to do with it.
abort() *will* raise(SIGABRT) if the runtime is C99 (and POSIX)
compilant. That's the only thing guaranteed. On Linux, most
distributions are configured by default with ulimit -c 0, which WON'T
DUMP A CORE. You can enable core dumping by increasing the ulimit.

If you run the program from a debugger (at least GDB), the SIGABRT will
be caught by the debugger and will let you inspect the program at the
exact point the uncaught exception was thrown (regardless of whatever
you ulimit -c value is).

Please, confirm that you understand this and then let's have
a meaningful discussion.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Your success is measured by your ability to finish things



More information about the phobos mailing list