summaryrefslogtreecommitdiff
path: root/src/wasm-js.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-js.cpp')
-rw-r--r--src/wasm-js.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp
index 03eddd031..d978e4a2a 100644
--- a/src/wasm-js.cpp
+++ b/src/wasm-js.cpp
@@ -382,6 +382,18 @@ extern "C" void EMSCRIPTEN_KEEPALIVE instantiate() {
};
instance = new ModuleInstance(*module, new JSExternalInterface());
+
+ // stack trace hooks
+ EM_ASM({
+ Module['outside']['extraStackTrace'] = function() {
+ return Pointer_stringify(Module['_interpreter_stack_trace']());
+ };
+ });
+}
+
+extern "C" int EMSCRIPTEN_KEEPALIVE interpreter_stack_trace() {
+ std::string stack = instance->printFunctionStack();
+ return (int)strdup(stack.c_str()); // XXX leak
}
// Does a call from js into an export of the module.