Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Core dump on throwing exception

807575Jun 25 2004 — edited Jun 25 2004
Hi,

I am using an exception class derived from C++ standard exception class (MyException). In this, I am having a member variable of type std::string. I am using this in a DLL that is being used by Java application using JNI.

In my C++ code, I am catching exception following way:

catch(XException& exp)
{
.....
}

catch(MyException& exp)
{
......
}

catch(exception& exp)
{
......
}

If I am using std::string as member in MyException class, it results in a coredump whatever exception is thrown (MyException or any other unknown exception supposed to be caught in the standard exception class.). Note that this happens in release build of my dll and never repeatable in debug build.

This problem occurs only in Solaris (tested both in Solaris 7 and Solaris 8). It does not occur in Windows.

Now, if I use char array instead of std::string the problem does not occur!!!! Exceptions are caught properly.

If anyone can throw more light on why usage of std::string causes issues in exception handling in Solaris using CC 5.0 compiler, it shall be of help. I feel problem might be due to not updating the patches related to CC 5.0 exception handling. Also, is it a good practise to use std::string in exception handling classes?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2004
Added on Jun 25 2004
1 comment
400 views