Skip to content

Commit 300931d

Browse files
authored
Don't print custom section data with --skeleton (#1743)
Custom sections can be quite large with dwarf debugging information so print only `...` in `--skeleton` mode.
1 parent 2fdc2ed commit 300931d

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

crates/wasmprinter/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2756,7 +2756,11 @@ impl Printer<'_, '_> {
27562756
write!(self.result, " ({place})")?;
27572757
}
27582758
self.result.write_str(" ")?;
2759-
self.print_bytes(section.data())?;
2759+
if self.config.print_skeleton {
2760+
self.result.write_str("...")?;
2761+
} else {
2762+
self.print_bytes(section.data())?;
2763+
}
27602764
self.end_group()?;
27612765
Ok(())
27622766
}

tests/cli/print-skeleton.wat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
(data (i32.const 0) "1234")
77
(table 1 funcref)
88
(elem (i32.const 0) func $f)
9+
(@custom "hello" (after data) "data")
910
)

tests/cli/print-skeleton.wat.stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
(memory (;0;) 0)
66
(elem (;0;) (i32.const 0) ...)
77
(data (;0;) (i32.const 0) ...)
8+
(@custom "hello" (after data) ...)
89
)

0 commit comments

Comments
 (0)