• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
C++ exception results in SIGABRT
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ exception results in SIGABRT


  • Subject: C++ exception results in SIGABRT
  • From: Stefan Werner <email@hidden>
  • Date: Mon, 18 Feb 2008 14:07:25 +0100

Hi,

I'm in a situation where a C++ exception directly results in a SIGABRT, even though an exception handler is in place. The exception of type const char* is thrown and caught in the same dylib.

A little google magic pointed me to
http://www.dribin.org/dave/blog/archives/2006/02/10/gcc_exception_bug/
http://www.dribin.org/dave/blog/archives/2006/02/10/gcc_exception_bug_2/
and
http://gcc.gnu.org/wiki/Visibility

Following the advice of that page, I set GCC_SYMBOLS_PRIVATE_EXTERN = NO in the project building the dylib but that didn't help either. Finally, I tried building and linking it into my main app as a static lib, but still the same result. GCC_SYMBOLS_PRIVATE_EXTERN = NO is also set for the main application. Changing the code to throw an exception of type int didn't help either. GCC_ENABLE_CPP_EXCEPTIONS = YES is set too.

C++ exceptions in other parts of the same application work fine.

Here's the call stack of where the SIGABRT is received:

#0	0x941880ea in __kill
#1	0x941880dd in kill$UNIX2003
#2	0x941ff3f2 in raise
#3	0x9420e9af in abort
#4	0x912c0005 in __gnu_cxx::__verbose_terminate_handler
#5	0x912be10c in __gxx_personality_v0
#6	0x912be14b in std::terminate
#7	0x912be261 in __cxa_throw
#8	0x0296b261 in error_handler at PluginPNG.cpp:75
#9	0x029ee71d in png_error at Utilities.h:221
#10	0x029f5ad0 in png_read_end at pngread.c:1016
#11	0x0296c327 in Load at PluginPNG.cpp:582
#12	0x02958aa4 in FreeImage_LoadFromHandle at Plugin.cpp:362
#13	0x02958b3b in FreeImage_Load at Plugin.cpp:383

I am wondering if it has anything to do with pngread.c being compiled as C and not C++? Try/catch work fine when I put them directly around the throw statement in error_handler(), but when put in Load() (where they belong) it results in a SIGABRT. Shouldn't GCC_ENABLE_CPP_EXCEPTIONS = YES make sure that the exceptions nonetheless?

The source code for the dylib can be found at freeimage.sourceforge.net, although you will need a broken png file to see the error handling exception.

Thanks in advance for any help,
Stefan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: C++ exception results in SIGABRT
      • From: Howard Hinnant <email@hidden>
  • Prev by Date: Objective-C style formatter / prettyprinter
  • Next by Date: xcode and gsl linking problem
  • Previous by thread: Re: Objective-C style formatter / prettyprinter
  • Next by thread: Re: C++ exception results in SIGABRT
  • Index(es):
    • Date
    • Thread