summaryrefslogtreecommitdiff
path: root/test/lit/debug
diff options
context:
space:
mode:
authorJérôme Vouillon <jerome.vouillon@gmail.com>2024-05-02 14:09:15 -0400
committerGitHub <noreply@github.com>2024-05-02 11:09:15 -0700
commitd58c54643eb97e5c35f8c14a38f3bf549aee92f4 (patch)
treea5a2888446708bc6a4da1ef53f13b15bbe2a291d /test/lit/debug
parent58753f40d9ee51bbe5c3acb7656e0d4ab73d0f36 (diff)
downloadbinaryen-d58c54643eb97e5c35f8c14a38f3bf549aee92f4.tar.gz
binaryen-d58c54643eb97e5c35f8c14a38f3bf549aee92f4.tar.bz2
binaryen-d58c54643eb97e5c35f8c14a38f3bf549aee92f4.zip
Source map fixes (#6550)
* Keep debug locations at function start The `fn_prolog_epilog.debugInfo` test is failing otherwise, since there was debug information associated to the nop instruction at the beginning of the function. * Do not clear the debug information when reaching the end of the source map The last segment should extend to the end of the function. * Propagate debug location from the function prolog to its first instruction * Fix printing of epilogue location The text parser no longer propagates locations to the epilogue, so we should always print the location if there is one. * Fix debug location smearing The debug location of the last instruction should not smear into the function epilogue, and a debug location from a previous function should not smear into the prologue of the current function.
Diffstat (limited to 'test/lit/debug')
-rw-r--r--test/lit/debug/source-map-smearing.wast22
-rw-r--r--test/lit/debug/source-map-stop.wast5
2 files changed, 27 insertions, 0 deletions
diff --git a/test/lit/debug/source-map-smearing.wast b/test/lit/debug/source-map-smearing.wast
new file mode 100644
index 000000000..875bec9d3
--- /dev/null
+++ b/test/lit/debug/source-map-smearing.wast
@@ -0,0 +1,22 @@
+;; RUN: wasm-opt %s -g -o %t.wasm -osm %t.wasm.map
+;; RUN: echo >> %t.wasm.map
+;; RUN: cat %t.wasm.map | filecheck %s
+
+;; Also test with StackIR, which should have identical results.
+;;
+;; RUN: wasm-opt %s --generate-stack-ir -o %t.wasm -osm %t.map -g -q
+;; RUN: echo >> %t.wasm.map
+;; RUN: cat %t.wasm.map | filecheck %s
+
+;; Check that the debug locations do not smear beyond a function
+;; epilogue to the next function. The encoded segment 'C' means that
+;; the previous segment is indeed one-byte long.
+;; CHECK: {"version":3,"sources":["foo"],"names":[],"mappings":"yBAAC,C,GACC"}
+(module
+ (func $0
+ ;;@ foo:1:1
+ )
+ (func $1
+ ;;@ foo:2:2
+ )
+)
diff --git a/test/lit/debug/source-map-stop.wast b/test/lit/debug/source-map-stop.wast
index d075d5686..cdc06505e 100644
--- a/test/lit/debug/source-map-stop.wast
+++ b/test/lit/debug/source-map-stop.wast
@@ -3,6 +3,11 @@
;; RUN: wasm-opt %s -g -o %t.wasm -osm %t.wasm.map
;; RUN: wasm-opt %t.wasm -ism %t.wasm.map -S -o - | filecheck %s
+;; Also test with StackIR, which should have identical results.
+;;
+;; RUN: wasm-opt %s --generate-stack-ir -o %t.wasm -osm %t.map -g -q
+;; RUN: wasm-opt %t.wasm -ism %t.map -q -o - -S | filecheck %s
+
;; Verify that writing to a source map and reading it back does not "smear"
;; debug info across adjacent instructions. The debug info in the output should
;; be identical to the input.