diff options
author | Alon Zakai <azakai@google.com> | 2023-08-30 14:59:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-30 14:59:02 -0700 |
commit | e8adbdda08a138c697187cad13528e9082bf3ca4 (patch) | |
tree | b27eb2aada535ba4ef7aa62872da7e54ad0f1fef /test/binaryen.js | |
parent | 2cdc61f04ef33c5f2055f54d88dee68110a42850 (diff) | |
download | binaryen-e8adbdda08a138c697187cad13528e9082bf3ca4.tar.gz binaryen-e8adbdda08a138c697187cad13528e9082bf3ca4.tar.bz2 binaryen-e8adbdda08a138c697187cad13528e9082bf3ca4.zip |
Source maps: Fix locations without debug info between ones that do (#5906)
Previously we did nothing for instructions without debug info. So if we had one
that did, followed by one that didn't, the one that didn't could get "smeared" with
the debug info of the first. Source map locations are the start of segments,
apparently, and so if we say a location has info then all others after it will as well,
until the next segment.
To fix that, add support for source map entries with just one field, the binary
location. Such entries have no debug info (no file:line:col), and though the source
maps spec is not very clear on this, this seems like the right way to prevent this
problem: to stop a segment with debug info by starting a new one without, when
we know we don't want that info any more. That is, before this PR we could have
this:
;; file.cpp:10:1
(nop) ;; binary offset 5 in wasm
(nop) ;; binary offset 6 in wasm
and the second nop would get the same debug annotation, since we just have
one source map segment,
[5, file.cpp, 10, 1] // start at offset 5 in wasm
With this PR, we emit:
[5, file.cpp, 10, 1] // start at offset 5 in wasm; file.cpp:10:1
[6] // start at offset 6 in wasm; no debug info
This does add 7% to source map sizes, however, since we add those 1-length
segments now, but that seems unavoidable to fix this bug.
To implement this, add a new field that says if the next location in the source map
has debug info or not, and use that.
Diffstat (limited to 'test/binaryen.js')
0 files changed, 0 insertions, 0 deletions