From 76c8f82d5cf98171ff46ed4bf36791d3b891357f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 7 Feb 2017 11:24:57 -0800 Subject: 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 --- test/debugInfo.asm.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/debugInfo.asm.js (limited to 'test/debugInfo.asm.js') 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 }; +} + -- cgit v1.2.3