C++ exception thrown and not caught under RTEMS.

Rosimildo daSilva rdasilva at connecttel.com
Thu Dec 7 20:32:39 UTC 2000


From: efren serra <efren.serra at eng.sun.com>
To: Rosimildo da Silva <rdasilva at connecttel.com>
Cc: Nick.SIMON at syntegra.bt.co.uk <Nick.SIMON at syntegra.bt.co.uk>;
rtems-users at oarcorp.com <rtems-users at oarcorp.com>;
Tom.WATSON at syntegra.bt.co.uk <Tom.WATSON at syntegra.bt.co.uk>;
Anthony.MCNULTY at syntegra.bt.co.uk <Anthony.MCNULTY at syntegra.bt.co.uk>
Date: Thursday, December 07, 2000 12:25 PM
Subject: Re: C++ exception thrown and not caught under RTEMS.


>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,

Thanks for this more complete explanation. I have never
seen people doing anything else, but terminating the application.
Maybe add something to log the callstack would be a nice thing.

Rosimildo.








More information about the users mailing list