dispatchrun / wasi-go

A Go implementation of the WebAssembly System Interface (WASI)
Apache License 2.0
124 stars 7 forks source link

tracer: make bytes truncation configurable #60

Closed chriso closed 1 year ago

chriso commented 1 year ago

To keep output reasonable when a program does large reads and writes, the tracer truncates strings after 32 bytes. This PR makes the truncation point configurable via a --tracer-string-size command-line option.

Example:

$ wasirun --trace hello.wasm
...
FDWrite(1, [1]IOVec{[14]byte("Hello, World!\n")}) => 14
...
$ wasirun --trace --tracer-string-size 5 hello.wasm
...
FDWrite(1, [1]IOVec{[14]byte("Hello"...)}) => 14
...

This is like strace's -s, --strsize option.