[phobos] Calling abort() on unhandled exception
Brad Roberts
braddr at puremagic.com
Thu Jul 29 18:57:20 PDT 2010
Asside from the stack trace (which I'm guessing comes from
_objc_terminate() in the stack below), that's what a c++ core file from
g++ would look like from an assert or uncaught exception. They both end
up in abort.
On Thu, 29 Jul 2010, Sean Kelly wrote:
> Date: Thu, 29 Jul 2010 18:52:47 -0700
> From: Sean Kelly <sean at invisibleduck.org>
> Reply-To: Discuss the phobos library for D <phobos at puremagic.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Cc: Discuss the phobos library for D <phobos at puremagic.com>
> Subject: Re: [phobos] Calling abort() on unhandled exception
>
> Huh, so the ObjC behavior is to print the exception and abort() too. Looks like good justification for doing it in D as well then.
>
> Sent from my iPhone
>
> On Jul 29, 2010, at 5:14 PM, Michel Fortin <michel.fortin at michelf.com> wrote:
>
> > Le 2010-07-29 ? 19:50, Sean Kelly a ?crit :
> >
> >> 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?
> >
> > To put things in perspective: on OSX, if I throw an Objective-C exception and it is unhandled, I get this output:
> >
> > 2010-07-29 20:08:50.818 Nib Preview Helper[1875:a0f] *** Terminating app due to uncaught exception 'hello', reason: 'test'
> > *** Call stack at first throw:
> > (
> > 0 CoreFoundation 0x00007fff810cecc4 __exceptionPreprocess + 180
> > 1 libobjc.A.dylib 0x00007fff80d0d0f3 objc_exception_throw + 45
> > 2 TestApplication 0x00000001000012c2 main + 162
> > 3 TestApplication 0x00000001000011f4 start + 52
> > 4 ??? 0x0000000000000001 0x0 + 1
> > )
> > terminate called after throwing an instance of 'NSException'
> > Program received signal: ?SIGABRT?.
> > sharedlibrary apply-load-rules all
> > (gdb) backtrace
> > #0 0x00007fff86e363d6 in __kill ()
> > #1 0x00007fff86ed6972 in abort ()
> > #2 0x00007fff83e315d2 in __gnu_cxx::__verbose_terminate_handler ()
> > #3 0x00007fff80d10d29 in _objc_terminate ()
> > #4 0x00007fff83e2fae1 in __cxxabiv1::__terminate ()
> > #5 0x00007fff83e2fb16 in std::terminate ()
> > #6 0x00007fff83e2fbfc in __cxa_throw ()
> > #7 0x00007fff80d0d192 in objc_exception_throw ()
> > #8 0x00000001000012c2 in main (argc=1, argv=0x7fff5fbff7c0) at main.m:28
> > (gdb)
> >
> > --
> > Michel Fortin
> > michel.fortin at michelf.com
> > http://michelf.com/
> >
> >
> >
> > _______________________________________________
> > phobos mailing list
> > phobos at puremagic.com
> > http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
More information about the phobos
mailing list