Reputation: 11
We are facing a problem in c++ code.When an exception is thrown the process is getting terminated,but my code has proper exception handling.
Core stack is below.
======================
#0 0xffffe410 in __kernel_vsyscall ()
#1 0x00489915 in raise () from /lib/tls/libc.so.6
#2 0x0048b379 in abort () from /lib/tls/libc.so.6
#3 0xf6a1fbdb in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/libstdc++.so.6
#4 0xf6a1d8f1 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.6
#5 0xf6a1d926 in std::terminate () from /usr/lib/libstdc++.so.6
#6 0xf6a1da6f in __cxa_throw () from /usr/lib/libstdc++.so.6
Some of the forums showing that this might occur when there is a stack unwinding or exception raised when handling other exception.
Can you please suggest here to fix the problem.
Upvotes: 1
Views: 10309
Reputation: 1080
Can also be caused if/when cannot allocate memory for a dependent exception object which would be thrown. (I imagine this is rare. But is possible reason the app would terminate abnormally.)
Upvotes: 0
Reputation: 2482
Are you throwing an exception in any of your object destructors? A call to terminate generally happens in *nix systems when a new exception is thrown before the current exception is caught.
When an exception gets thrown the objects in your stack frame get destroyed as the stack unwinds. If any of these objects were to throw an exception during destruction, it confuses the exception handling mechanism as it has now two exceptions to catch, the original exception and the new one which gets thrown during the destruction of the object on the stack. So it issues a terminate and aborts.
Upvotes: 4
Reputation: 264689
Terminate can be called if:
But your call stack also has unexpected
=>__cxa_call_unexpected ()
To me this is an indication that an exception specification has been violated.
This calls unexpected() which by default calls terminate().
Upvotes: 10