Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ cargo test --features parallel --manifest-path crates/tests/Cargo.toml
semver-relevant and worth calling out.
- Changes to emitted bytes should keep output deterministic and valid; the
fuzz targets in `fuzz/` exercise round-tripping.
- DWARF changes (`src/module/debug`) are checked by `walrus_tests_utils::dwarf`,
which compares each instruction's line, scopes and variable locations
before and after walrus. `dwarf_synthetic` runs it over every `round_trip`
and `valid` module, `dwarf_fixtures` over rustc and clang output in
`crates/tests/dwarf-fixtures` (rebuilt by its `build.sh`), and the `dwarf`
and `dwarf-raw` fuzz targets over generated and mutated modules.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ Released YYYY-MM-DD.
* Line rows stay on the instructions they describe. In a Rust -O0 build,
133 instructions whose row was line 0 were given other lines. `delegate`
also keeps its row now.
* With `generate_dwarf`, the local indices in the expressions of a DIE that
gives its code as `DW_AT_ranges`, rather than `DW_AT_low_pc`, are
remapped with the indices of the function that code is in. They were
remapped with its parent's function, usually dropping the location or
naming the wrong local. Code in several functions that number a local
differently gets a location list with the right local in each, and each
part of a location list entry spanning functions uses its own function's
indices. A `DW_LLE_default_location` can't be split, so it's dropped if
its locals differ between those functions.
* With `generate_dwarf`, DWARF that can't be read is dropped with a warning
instead of making `emit_wasm` panic. That includes a DWARF 4
`DW_LNE_define_file` with an empty name, or a `DW_LNS_advance_line` of
`i64::MIN`, which make gimli panic.
* With `generate_dwarf`, line programs are written with one byte per
instruction and one operation each, as Wasm has, whatever the input's
header said. A header with a minimum instruction length above 1, or a
line base and range that can't encode an advance, made `emit_wasm` panic.
* With `generate_dwarf`, an entry whose `DW_AT_low_pc` isn't an address, or
is the tombstone of discarded code with a `DW_AT_high_pc` that's neither a
size nor a tombstone, is written as removed code. Its attributes were
copied unchanged or mapped one at a time, so a discarded function could
get a range over live code.

### Security

Expand Down
4 changes: 4 additions & 0 deletions crates/tests-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ publish = false
[dependencies]
tempfile = "3.1.0"
anyhow = "1.0"
arbitrary = "1.0"
gimli = "0.34.0"
wasm-encoder = "0.245.1"
wasmparser = "0.245.1"

[target.'cfg(unix)'.dependencies]
libc = "0.2"
Loading
Loading