summaryrefslogtreecommitdiff
path: root/test/debugInfo.asm.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-02-07 11:24:57 -0800
committerGitHub <noreply@github.com>2017-02-07 11:24:57 -0800
commit76c8f82d5cf98171ff46ed4bf36791d3b891357f (patch)
treeab251df55b1274b053896b10b14faf2ac8e526cd /test/debugInfo.asm.js
parent985bcba6239792ebcb3808f1066ca6ea20ac5688 (diff)
downloadbinaryen-76c8f82d5cf98171ff46ed4bf36791d3b891357f.tar.gz
binaryen-76c8f82d5cf98171ff46ed4bf36791d3b891357f.tar.bz2
binaryen-76c8f82d5cf98171ff46ed4bf36791d3b891357f.zip
asm2wasm debuginfo (#895)
* parse file/line comments in asm.js into debug intrinsics * convert debug intrinsics into annotations, and print them * ignore --debuginfo if not emitting text, as wasm binaries don't support that yet * emit full debug info when -g and emitting text; when -g and emitting binary, all we can do is the Names section * update wasm.js
Diffstat (limited to 'test/debugInfo.asm.js')
-rw-r--r--test/debugInfo.asm.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/debugInfo.asm.js b/test/debugInfo.asm.js
new file mode 100644
index 000000000..929d79804
--- /dev/null
+++ b/test/debugInfo.asm.js
@@ -0,0 +1,26 @@
+function () {
+ "use asm";
+ function add(x, y) {
+ x = x | 0;
+ y = y | 0;
+ x = x; //@line 5 "tests/hello_world.c"
+ y = y; //@line 6 "tests/hello_world.c"
+ x = y; //@line 314159 "tests/other_file.cpp"
+ return x + y | 0;
+ }
+ function ret(x) {
+ x = x | 0;
+ x = x << 1; //@line 50 "return.cpp"
+ return x + 1 | 0; //@line 100 "return.cpp"
+ }
+ function opts(x, y) {
+ x = x | 0;
+ y = y | 0;
+ x = (x + y) | 0; //@line 1 "even-opted.cpp"
+ y = y >> x; //@line 2 "even-opted.cpp"
+ x = (x | 0) % (y | 0); //@line 3 "even-opted.cpp"
+ return x + y | 0;
+ }
+ return { add: add, ret: ret, opts: opts };
+}
+