WebAssembly / tool-conventions

Conventions supporting interoperatibility between tools working with WebAssembly.
Artistic License 2.0
297 stars 65 forks source link

Coredumps: Allow truncating locals and operand stack vecs when all values are optimized away #210

Open fitzgen opened 1 year ago

fitzgen commented 1 year ago

In Wasmtime, we don't currently include locals or the operand stack in core dumps currently (although we intend to soon) and in fact have even lost all information about how many locals there were or the size of the operand stack. Therefore, we emit empty vecs for locals and the operand stack, rather than a vec of N missing values, because we don't even know N.

I think this is reasonable behavior for an optimizing compiler, but also something that we should probably explicitly document as acceptable so that coredump-consuming tools are given a heads up and consider this case.

I wanted to bounce this off folks before making a PR adding such language.

Thoughts?

cc @xtuc @dschuff @itsrainy

xtuc commented 1 year ago

I think it's acceptable to use an empty vector for missing/truncated locals, a debugger can refer to the source WebAssembly module for number/types of locals. Works with stack as well but has to be computed.

dschuff commented 1 year ago

Yeah, this makes sense to me too.