diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-04 00:54:06 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-04 00:54:06 (GMT) |
commit | 53285acbd3e480837b7544bd217767cf9dbfa530 (patch) | |
tree | fbdcefb64fe556069dc108381b7f4aa5b915122b /apps/uscxml-transform.cpp | |
parent | 5f86427032dbda9aedf5afa4a10fd57a2343eeaa (diff) | |
download | uscxml-53285acbd3e480837b7544bd217767cf9dbfa530.zip uscxml-53285acbd3e480837b7544bd217767cf9dbfa530.tar.gz uscxml-53285acbd3e480837b7544bd217767cf9dbfa530.tar.bz2 |
Stop registering a custom exception handler
Diffstat (limited to 'apps/uscxml-transform.cpp')
-rw-r--r-- | apps/uscxml-transform.cpp | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/apps/uscxml-transform.cpp b/apps/uscxml-transform.cpp index 3ee1f50..d0c3524 100644 --- a/apps/uscxml-transform.cpp +++ b/apps/uscxml-transform.cpp @@ -47,75 +47,6 @@ class VerboseMonitor : public uscxml::InterpreterMonitor { } }; -#ifdef CMAKE_BUILD_TYPE_DEBUG - -#ifdef HAS_EXECINFO_H -void printBacktrace(void** array, int size) { - char** messages = backtrace_symbols(array, size); - for (int i = 0; i < size && messages != NULL; ++i) { - std::cerr << "\t" << messages[i] << std::endl; - } - std::cerr << std::endl; - free(messages); -} - -#ifdef HAS_DLFCN_H -// see https://gist.github.com/nkuln/2020860 -typedef void (*cxa_throw_type)(void *, void *, void (*) (void *)); -cxa_throw_type orig_cxa_throw = 0; - -void load_orig_throw_code() { - orig_cxa_throw = (cxa_throw_type) dlsym(RTLD_NEXT, "__cxa_throw"); -} - -extern "C" -void __cxa_throw (void *thrown_exception, void *pvtinfo, void (*dest)(void *)) { - std::cerr << __FUNCTION__ << " will throw exception from " << std::endl; - if (orig_cxa_throw == 0) - load_orig_throw_code(); - - void *array[50]; - size_t size = backtrace(array, 50); - printBacktrace(array, size); - orig_cxa_throw(thrown_exception, pvtinfo, dest); -} -#endif -#endif - - -// see http://stackoverflow.com/questions/2443135/how-do-i-find-where-an-exception-was-thrown-in-c -void customTerminate() { - static bool tried_throw = false; - - try { - // try once to re-throw currently active exception - if (!tried_throw) { - tried_throw = true; - throw; - } else { - tried_throw = false; - } - } catch (const std::exception &e) { - std::cerr << __FUNCTION__ << " caught unhandled exception. what(): " - << e.what() << std::endl; - } catch (const uscxml::Event &e) { - std::cerr << __FUNCTION__ << " caught unhandled exception. Event: " - << e << std::endl; - } catch (...) { - std::cerr << __FUNCTION__ << " caught unknown/unhandled exception." - << std::endl; - } - -#ifdef HAS_EXECINFO_H - void * array[50]; - int size = backtrace(array, 50); - - printBacktrace(array, size); -#endif - abort(); -} -#endif - void printUsageAndExit(const char* progName) { // remove path from program name std::string progStr(progName); @@ -157,10 +88,6 @@ int main(int argc, char** argv) { signal(SIGPIPE, SIG_IGN); #endif -#ifdef CMAKE_BUILD_TYPE_DEBUG - std::set_terminate(customTerminate); -#endif - // setup logging google::LogToStderr(); google::InitGoogleLogging(argv[0]); |