[phobos] Calling abort() on unhandled exception

Leandro Lucarella luca at llucax.com.ar
Fri Jul 30 19:36:11 PDT 2010


Michel Fortin, el 30 de julio a las 21:38 me escribiste:
> Le 2010-07-30 à 20:38, Andrei Alexandrescu a écrit :
> 
> > Leandro Lucarella wrote:
> >> Calling abort() on Linux will simply print "Aborted". Do you think is
> >> that bad that worth being completely different than any other PL and
> >> making debug an uncaught exception almost imposible???
> > 
> > What is impossible about writing one try statement?
> 
> If you have a debugger hooked, abort() will cause the debugger to stop
> the program in the state it currently is. If an uncaught exception
> doesn't unwind the stack and instead calls abort(), the debugger will
> stop the program exactly in the state the exception was thrown, not in
> a state where everything has been cleaned up and no clues as to what
> happened are left.
> 
> It's like in the real world if you see a crime happen: don't clean up
> before calling the police, I guaranty the inspector won't appreciate.
> An uncaught exception is an error not expected by the programmer, it
> requires investigation to ensure the program's correctness. This
> investigation might not be worth it if it happens in a simple script,
> but to help debug a big program you shouldn't unwind the stack before
> calling abort().

Thanks, perfectly worded and excellent analogy.

And that's what you can't do in a try statement, calling abort() (or do
anything similar to "re-wind" the stack and go back to the past to the
original place where the exception was thrown).

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
<o_O> parakenotengobarraespaciadora
<o_O> aver
<o_O> estoyarreglandolabarraporkeserompiounapatita


More information about the phobos mailing list