[phobos] Calling abort() on unhandled exception

Michel Fortin michel.fortin at michelf.com
Thu Jul 29 17:14:24 PDT 2010


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/





More information about the phobos mailing list