mercredi 29 mai 2019

Exceptions causes crash in application and not caught with sun studio C++ compiled application

I have an application which uses xerces 3.2.1. Everything works fine with sun C++ 5.8. We are moving to the latest compiler, Sun Studio 12.6, C++ 5.15. I compiled xerces and my application. All went well. When I run and throw exceptions from my application, it is not caught in xerces and the application crashes. There are no code changes which are working with the old compiler. Looks like after throwing the exception, the stack do not unwind. This is what I get -

terminate called after throwing an instance of 'xercesc_3_2::ParseException'
t@1 (l@1) signal ABRT (Abort) in __lwp_kill at 0xfa34ec9c
0xfa34ec9c: __lwp_kill+0x0008:  bcc,a,pt  %icc,__lwp_kill+0x18  ! 0xfa34ecac
Current function is CXmpXmlStudioParser::startElement
  421                                           throw ex;
(dbx) bt
current thread: t@1
dbx: can't find definition for symbol 'RefVectorOf<xercesc_3_2::XMLAttr>
  [1] __lwp_kill(0x0, 0x6, 0x0, 0x6, 0xffbffeff, 0x0), at 0xfa34ec9c
  [2] raise(0x6, 0x0, 0x0, 0xfa32e13c, 0xffffffff, 0x6), at 0xfa2e7b58
  [3] abort(0x69d578, 0x1, 0xf71fcce0, 0xffb40, 0xfa3c5518, 0x0), at 0xfa2c29c8
  [4] __gnu_cxx::__verbose_terminate_handler(0x69d5a8, 0x2, 0xf71b25e0, 0x57c800, 0xfdfd2d50, 0xfa3c758c), at 0xf71b58bc
  [5] 0xf71b2234(0xf71b5700, 0x1, 0x8, 0x0, 0x69d5a8, 0xffbfc564), at 0xf71b2234
  [6] std::terminate(0x0, 0x69d5c0, 0xb8b1aabc, 0xbcd4d500, 0x0, 0x0), at 0xf71b22d8
  [7] __cxa_throw(0x69d5c0, 0xfdfd2d18, 0xfddd9a80, 0xbcd4d500, 0x0, 0x69d5a8), at 0xf71b25e0
=>[8] CXmpXmlStudioParser::startElement(this = 0x4caf68, fFormatter = CLASS, name = 0x57c7d8 "data", attributes = CLASS), line 421 in "XmpXmlStudioParser.cpp"
  [9] COtlXmlParseHandler::startElement(this = 0x549e78, name = 0x57c7d8 "data", attributes = CLASS), line 240 in "OtlXmlParseHandler.cpp"
  [10] xercesc_3_2::SAXParser::startElement(this = 0x4c3ff0, elemDecl = CLASS, elemURLId = 1U, elemPrefix = 0x4c71e0 "", , line 990 in "SAXParser.cpp"
  [11] xercesc_3_2::IGXMLScanner::scanStartTagNS(this = 0x4c4e90, gotData = true), line 2640 in "IGXMLScanner.cpp"
  [12] xercesc_3_2::IGXMLScanner::scanContent(this = 0x4c4e90), line 890 in "IGXMLScanner.cpp"
  [13] xercesc_3_2::IGXMLScanner::scanDocument(this = 0x4c4e90, src = CLASS), line 217 in "IGXMLScanner.cpp"
  [14] xercesc_3_2::XMLScanner::scanDocument(this = 0x4c4e90, systemId = 0x497920 "./testDoc.xml"), line 402 in "XMLScanner.cpp"
  [15] xercesc_3_2::XMLScanner::scanDocument(this = 0x4c4e90, systemId = 0x3dffe8 "./testDoc.xml"), line 410 in "XMLScanner.cpp"
  [16] xercesc_3_2::SAXParser::parse(this = 0x4c3ff0, systemId = 0x3dffe8 "./testDoc.xml"), line 617 in "SAXParser.cpp"

Both application and xerces are using the correct libraries while linking and running. Not sure what is wrong. xerces is compiled with the following -

./configure CC=/opt/developerstudio12.6/bin/cc CXX=/opt/developerstudio12.6/bin/CC  CFLAGS="-O -m32"  CXXFLAGS="-O -m32 -std=c++11" LDFLAGS="-std=c++11 -L/opt/developerstudio12.6/lib/compilers/CC-gcc/lib"

Same options for the application used.

Exception is thrown like this -

ThrowXML(ParseException,XMLExcepts::NoError);

class ParseException : public XMLException

The code looks ok because its working with the old compiler. Something to do with C++11 option ? Anything I can try ?

Edit: LD_PRELOAD=/opt/developerstudio12.6/lib/compilers/CC-gcc/lib/libgcc_s.so.1 as some posts said but did not work.

Aucun commentaire:

Enregistrer un commentaire