diff options
author | Alon Zakai <azakai@google.com> | 2023-08-29 11:22:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-29 11:22:53 -0700 |
commit | b29cdd4e63bedcfbd357b0ad49ce4301cb94bb87 (patch) | |
tree | 7b3b33da6a00090f506d8fea7af110e86da391d7 /test/lit/debug | |
parent | 65eb4219396e32aa76fca59226f523b8dfe01bcb (diff) | |
download | binaryen-b29cdd4e63bedcfbd357b0ad49ce4301cb94bb87.tar.gz binaryen-b29cdd4e63bedcfbd357b0ad49ce4301cb94bb87.tar.bz2 binaryen-b29cdd4e63bedcfbd357b0ad49ce4301cb94bb87.zip |
Print all debug annotations when BINARYEN_PRINT_FULL (#5904)
In general, full print mode should print out all the things to avoid confusion. It
already did so for blocks (that the text format sometimes elides), types, etc. Doing
it for debug info can avoid confusion when debugging (in fact, this was one of the
main reasons I've been confused about how source maps work in Binaryen...).
Also add a comment to the code just landed in #5903
Diffstat (limited to 'test/lit/debug')
-rw-r--r-- | test/lit/debug/full.wat | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/test/lit/debug/full.wat b/test/lit/debug/full.wat new file mode 100644 index 000000000..e8e0b9a9b --- /dev/null +++ b/test/lit/debug/full.wat @@ -0,0 +1,67 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s -S -o - | filecheck %s --check-prefix=NRML +;; RUN: env BINARYEN_PRINT_FULL=1 wasm-opt %s -S -o - | filecheck %s --check-prefix=FULL + +;; +;; Compare normal text output with debug info to full mode. +;; +;; Full mode does not skip repeated debug info in some cases, see below. It also +;; annotates the type of each node. +;; + +(module + ;; NRML: (func $a + ;; NRML-NEXT: ;;@ src.cpp:1:2 + ;; NRML-NEXT: (block $block + ;; NRML-NEXT: (drop + ;; NRML-NEXT: (i32.const 0) + ;; NRML-NEXT: ) + ;; NRML-NEXT: ;;@ src.cpp:3:4 + ;; NRML-NEXT: (drop + ;; NRML-NEXT: (i32.const 1) + ;; NRML-NEXT: ) + ;; NRML-NEXT: ;;@ src.cpp:3:4 + ;; NRML-NEXT: (drop + ;; NRML-NEXT: (i32.const 2) + ;; NRML-NEXT: ) + ;; NRML-NEXT: ) + ;; NRML-NEXT: ;;@ src.cpp:1:2 + ;; NRML-NEXT: ) + ;; FULL: (func $a + ;; FULL-NEXT: [none] ;;@ src.cpp:1:2 + ;; FULL-NEXT: [none](block $block + ;; FULL-NEXT: [none] ;;@ src.cpp:1:2 + ;; FULL-NEXT: (drop + ;; FULL-NEXT: [i32] ;;@ src.cpp:1:2 + ;; FULL-NEXT: (i32.const 0) + ;; FULL-NEXT: ) + ;; FULL-NEXT: [none] ;;@ src.cpp:3:4 + ;; FULL-NEXT: (drop + ;; FULL-NEXT: [i32] ;;@ src.cpp:3:4 + ;; FULL-NEXT: (i32.const 1) + ;; FULL-NEXT: ) + ;; FULL-NEXT: [none] ;;@ src.cpp:3:4 + ;; FULL-NEXT: (drop + ;; FULL-NEXT: [i32] ;;@ src.cpp:3:4 + ;; FULL-NEXT: (i32.const 2) + ;; FULL-NEXT: ) + ;; FULL-NEXT: ) ;; end block block + ;; FULL-NEXT: ;;@ src.cpp:1:2 + ;; FULL-NEXT: ) + (func $a + ;;@ src.cpp:1:2 + (block $block + (drop (i32.const 0)) ;; this child has the same location as the parent + ;; block, and only in full mode will we print such + ;; repeating info, including on the const child of + ;; the drop + ;;@ src.cpp:3:4 + (drop (i32.const 1)) + (drop (i32.const 2)) ;; this child has the same location as the sibling + ;; before it, but we print it in normal mode as well + ;; as full mode (as that seems less confusing). in + ;; full mode, however, we also annotate the location + ;; of the const node children of the drops. + ) + ) +) |