异常会导致应用程序崩溃,并且无法被Sun Studio C ++编译的应用程序捕获

时间:2019-05-30 05:49:57

标签: c++ c++11 xerces-c solaris-studio

我有一个使用xerces 3.2.1的应用程序。在Sun C ++ 5.8上一切正常。我们正在使用最新的编译器Sun Studio 12.6,C ++ 5.15。我编译了xerces和我的应用程序。一切顺利。当我从应用程序运行并引发异常时,它不会陷入xerces中,并且应用程序崩溃。没有任何代码更改可用于旧编译器。 看起来在抛出异常之后,堆栈不会展开。 这就是我得到的-

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"

在链接和运行时,应用程序和xerces都使用正确的库。不知道出什么问题了。 xerces使用以下代码进行编译-

./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"

所用应用程序的相同选项。

像这样抛出异常-

ThrowXML(ParseException,XMLExcepts::NoError);

class ParseException : public XMLException

代码看起来不错,因为它可以与旧的编译器一起使用。与C ++ 11选项有关吗?有什么可以尝试的吗?

编辑:LD_PRELOAD=/opt/developerstudio12.6/lib/compilers/CC-gcc/lib/libgcc_s.so.1 如某些帖子所述,但没有用。

0 个答案:

没有答案