00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "typeinfo"
00032 #include "exception"
00033 #include <cstdlib>
00034 #include "unwind-cxx.h"
00035 #include "exception_defines.h"
00036
00037 using namespace __cxxabiv1;
00038
00039
00040 std::terminate_handler __cxxabiv1::__terminate_handler = abort;
00041 std::unexpected_handler __cxxabiv1::__unexpected_handler = std::terminate;
00042
00043 void
00044 __cxxabiv1::__terminate (std::terminate_handler handler)
00045 {
00046 try {
00047 handler ();
00048 abort ();
00049 } catch (...) {
00050 abort ();
00051 }
00052 }
00053
00054 void
00055 std::terminate ()
00056 {
00057 __terminate (__terminate_handler);
00058 }
00059
00060 void
00061 __cxxabiv1::__unexpected (std::unexpected_handler handler)
00062 {
00063 handler();
00064 std::terminate ();
00065 }
00066
00067 void
00068 std::unexpected ()
00069 {
00070 __unexpected (__unexpected_handler);
00071 }
00072
00073 std::terminate_handler
00074 std::set_terminate (std::terminate_handler func) throw()
00075 {
00076 std::terminate_handler old = __terminate_handler;
00077 __terminate_handler = func;
00078 return old;
00079 }
00080
00081 std::unexpected_handler
00082 std::set_unexpected (std::unexpected_handler func) throw()
00083 {
00084 std::unexpected_handler old = __unexpected_handler;
00085 __unexpected_handler = func;
00086 return old;
00087 }