summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-04 00:54:06 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-04 00:54:06 (GMT)
commit53285acbd3e480837b7544bd217767cf9dbfa530 (patch)
treefbdcefb64fe556069dc108381b7f4aa5b915122b /apps
parent5f86427032dbda9aedf5afa4a10fd57a2343eeaa (diff)
downloaduscxml-53285acbd3e480837b7544bd217767cf9dbfa530.zip
uscxml-53285acbd3e480837b7544bd217767cf9dbfa530.tar.gz
uscxml-53285acbd3e480837b7544bd217767cf9dbfa530.tar.bz2
Stop registering a custom exception handler
Diffstat (limited to 'apps')
-rw-r--r--apps/uscxml-browser.cpp2
-rw-r--r--apps/uscxml-transform.cpp73
2 files changed, 2 insertions, 73 deletions
diff --git a/apps/uscxml-browser.cpp b/apps/uscxml-browser.cpp
index 7efacf5..50b3202 100644
--- a/apps/uscxml-browser.cpp
+++ b/apps/uscxml-browser.cpp
@@ -56,6 +56,7 @@ void printBacktrace(void** array, int size) {
}
#ifdef HAS_DLFCN_H
+#if 0 // deactivated as we use exceptions to signal errors now
// see https://gist.github.com/nkuln/2020860
typedef void (*cxa_throw_type)(void *, void *, void (*) (void *));
cxa_throw_type orig_cxa_throw = 0;
@@ -77,6 +78,7 @@ void __cxa_throw (void *thrown_exception, void *pvtinfo, void (*dest)(void *)) {
}
#endif
#endif
+#endif
// see http://stackoverflow.com/questions/2443135/how-do-i-find-where-an-exception-was-thrown-in-c
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]);