summaryrefslogtreecommitdiffstats
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
parent5f86427032dbda9aedf5afa4a10fd57a2343eeaa (diff)
downloaduscxml-53285acbd3e480837b7544bd217767cf9dbfa530.zip
uscxml-53285acbd3e480837b7544bd217767cf9dbfa530.tar.gz
uscxml-53285acbd3e480837b7544bd217767cf9dbfa530.tar.bz2
Stop registering a custom exception handler
-rw-r--r--README.md9
-rw-r--r--apps/uscxml-browser.cpp2
-rw-r--r--apps/uscxml-transform.cpp73
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp10
-rw-r--r--test/src/test-w3c.cpp3
5 files changed, 19 insertions, 78 deletions
diff --git a/README.md b/README.md
index 0296163..144296b 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,15 @@ uSCXML still fails the following ecmascript tests:
<table>
<tr><th>Test#</th><th>Status</th><th>Description</th><th>Comment</th></tr>
<tr>
+ <td><tt>
+ <a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test326.scxml">326</a> /
+ <a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test326.scxml">329</a>
+ </tt></td>
+ <td><tt>Failed for v8</tt></td>
+ <td>"test that _ioprocessors stays bound till the session ends" / "test that none of the system variables can be modified"</td>
+ <td>The v8 implementation will return a new <tt>_ioprocessor</tt> object for each access.</td>
+ </tr>
+ <tr>
<td><tt><a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test579.scxml">579</a></tt></td>
<td><tt>Failed</tt></td>
<td>"Before the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, the SCXML processor MUST execute any executable content in the transition after the parent state's onentry content and any content in a possible initial transition."</td>
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]);
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index a995ec2..51a2167 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -618,15 +618,15 @@ void V8DataModel::assign(const Element<std::string>& assignElem,
throw Event("error.execution", Event::PLATFORM);
if (key.compare("_sessionid") == 0) // test 322
- throw Event("error.execution", Event::PLATFORM);
+ ERROR_EXECUTION_THROW("Cannot assign to _sessionId");
if (key.compare("_name") == 0)
- throw Event("error.execution", Event::PLATFORM);
+ ERROR_EXECUTION_THROW("Cannot assign to _name");
if (key.compare("_ioprocessors") == 0) // test 326
- throw Event("error.execution", Event::PLATFORM);
+ ERROR_EXECUTION_THROW("Cannot assign to _ioprocessors");
if (key.compare("_invokers") == 0)
- throw Event("error.execution", Event::PLATFORM);
+ ERROR_EXECUTION_THROW("Cannot assign to _invokers");
if (key.compare("_event") == 0)
- throw Event("error.execution", Event::PLATFORM);
+ ERROR_EXECUTION_THROW("Cannot assign to _event");
if (HAS_ATTR(assignElem, "expr")) {
evalAsValue(key + " = " + ATTR(assignElem, "expr"));
diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp
index 4d866c0..39862f4 100644
--- a/test/src/test-w3c.cpp
+++ b/test/src/test-w3c.cpp
@@ -39,6 +39,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;
@@ -47,6 +48,7 @@ void load_orig_throw_code() {
orig_cxa_throw = (cxa_throw_type) dlsym(RTLD_NEXT, "__cxa_throw");
}
+#if 0
extern "C"
void __cxa_throw (void *thrown_exception, void *pvtinfo, void (*dest)(void *)) {
std::cerr << __FUNCTION__ << " will throw exception from " << std::endl;
@@ -60,6 +62,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