summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/sourcemap.js.txt2
-rw-r--r--test/fib-dbg.wasm.fromBinary3
-rw-r--r--test/lit/debug/source-map-smearing.wast22
-rw-r--r--test/lit/debug/source-map-stop.wast5
4 files changed, 30 insertions, 2 deletions
diff --git a/test/binaryen.js/sourcemap.js.txt b/test/binaryen.js/sourcemap.js.txt
index edb2d86a7..046ad029c 100644
--- a/test/binaryen.js/sourcemap.js.txt
+++ b/test/binaryen.js/sourcemap.js.txt
@@ -5,4 +5,4 @@ module.c
020: u r c e M a p p i n g U R L 0f m
030: o d u l e . w a s m . m a p
-{"version":3,"sources":["module.c"],"names":[],"mappings":"wBAAE"}
+{"version":3,"sources":["module.c"],"names":[],"mappings":"wBAAE,E"}
diff --git a/test/fib-dbg.wasm.fromBinary b/test/fib-dbg.wasm.fromBinary
index bc90702d3..f1b263234 100644
--- a/test/fib-dbg.wasm.fromBinary
+++ b/test/fib-dbg.wasm.fromBinary
@@ -209,11 +209,12 @@
(br $label$4)
)
)
+ ;;@ fib.c:8:0
(return
- ;;@ fib.c:8:0
(local.get $4)
)
)
+ ;;@ fib.c:8:0
)
(func $runPostSets
(local $0 i32)
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.