aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-05 13:30:14 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-03-05 13:30:14 -0800
commit5774e5d0cff190488bb9eec61d3aaa68d4450f21 (patch)
treed55fa3edc0bf4fc351c1984e363a1335a5792106
parentbaab492299fa9f2bd3717d55f98d3faa5e4ae4e8 (diff)
emscripten_debugger()
-rw-r--r--src/library.js4
-rw-r--r--system/include/emscripten/emscripten.h11
-rw-r--r--tests/core/test_inlinejs3.in1
3 files changed, 16 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index 62695ae7..2c3d5e03 100644
--- a/src/library.js
+++ b/src/library.js
@@ -9114,6 +9114,10 @@ LibraryManager.library = {
#endif
#endif
+ emscripten_debugger: function() {
+ debugger;
+ },
+
//============================
// emscripten vector ops
//============================
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h
index a3009936..4c1f7ad7 100644
--- a/system/include/emscripten/emscripten.h
+++ b/system/include/emscripten/emscripten.h
@@ -454,7 +454,18 @@ void emscripten_set_network_backend(int backend);
*/
int emscripten_get_compiler_setting(const char *name);
+/*
+ * Emits
+ * debugger;
+ * inline in the code, which tells the JS engine to invoke
+ * the debugger if it gets there.
+ */
+void emscripten_debugger();
+
+
+/* ===================================== */
/* Internal APIs. Be careful with these. */
+/* ===================================== */
/*
* Profiling tools.
diff --git a/tests/core/test_inlinejs3.in b/tests/core/test_inlinejs3.in
index 12e31007..da720a3d 100644
--- a/tests/core/test_inlinejs3.in
+++ b/tests/core/test_inlinejs3.in
@@ -4,6 +4,7 @@
int main(int argc, char **argv) {
EM_ASM(Module.print('hello dere1'));
EM_ASM("Module.print('hello dere2');");
+ emscripten_debugger(); // does nothing in shells; check for validation error though
for (int i = 0; i < 3; i++) {
EM_ASM(Module.print('hello dere3'); Module.print('hello dere' + 4););
}