C++ exception thrown and not caught under RTEMS.
efren serra
efren.serra at eng.sun.com
Thu Dec 7 18:22:42 UTC 2000
Rosimildo,
This is what the ANSI/ISO C++ Draft says:
Throwing an exception results in a call to `terminate':
* if the exception has no corresponding handler
* if the execution stack appears to be corructed
* if a destructor throws another exception along the way
The default behavior of `terminate' is to call `abort(),' declared in
<stdlib.h>. Any terminate handler you provide must not return to its
caller. And it probably should not do too much before it terminates
execution. But you can probably get away with a more orderly shutdown,
as
in:
#include <stdlib.h>
#include <iostream>
void _rtems_terminate()
{
cerr << "exception: " << ex.what() << endl;
exit(EXIT_FAILURE);
}
...
set_terminate(&_rtems_terminate);
-efren-
>
> Nick.SIMON at syntegra.bt.co.uk wrote:
> >
> > Excuse me asking this, I'd try it out but I can't get at a target for a few
> > days.
> >
> > If a C++ program throws an exception which is uncaught, the specified action
> > is that the program terminates. Under RTEMS, is this implemented by
> > terminating the offending task, or by exiting RTEMS? I can see either
> > would be reasonable. I've just found such a thing is possible in our app,
> > (sheepish <g>) and I'd like to know if it explains a problem we've seen
> > occasionally.
> >
>
> C++ standard knows nothing about threads/tasks. The action specified
> in the standard is to call terminate() that in all systems, terminates
> the
> process.
>
> --
> Rosimildo da Silva rdasilva at connectel.com
> ConnectTel, Inc. Austin, TX -- USA
> Phone : 512-338-1111 Fax : 512-918-0449
> Company Page: http://www.connecttel.com
> Home Page: http://members.nbci.com/rosimildo/
More information about the users
mailing list