[phobos] Calling abort() on unhandled exception
Sean Kelly
sean at invisibleduck.org
Thu Jul 29 18:17:07 PDT 2010
The error is still printed, I'm trying to create a core dump also.
Sent from my iPhone
On Jul 29, 2010, at 5:07 PM, Walter Bright <walter at digitalmars.com> wrote:
> Unhandled exceptions should print the error message associated with the exception. This is so that, for example, you can write a file copy program without paying any attention to error messages. If an error happens, the program will print the right error message.
>
> Getting a core dump instead would be most unattractive.
>
> Sean Kelly wrote:
>> (posted here because so few people read the druntime list)
>>
>> I've been working on allowing core dumps to be created when an unhandled exception is thrown in a D app. To avoid some weirdness that arises when an exception is thrown beyond the scope of (C) main() I'm calling abort() after terminating everything possible and reporting the exception. What I'm wondering is whether this is an acceptable way to terminate a D app in this situation or if I should do something else. I was looking at the Win32 docs for abort() and they're a bit weird:
>>
>> By default, the abort routine prints the message:
>>
>> "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information."
>>
>> It then calls raise(SIGABRT).
>>
>> Even on OSX I see an "Abort trap" message in the console when I exit an app in this way. I'm inclined to think that this isn't acceptable and that I should just try and sort out the weirdness that results from throwing an object outside of main(), but I thought I'd ask here for suggestions. As an alternative I could call asm HLT, but this may bypass too much C-level runtime stuff. Thoughts?
>>
>>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
More information about the phobos
mailing list