Skip to content

Commit

Permalink
Coredump: add local/stack value typing
Browse files Browse the repository at this point in the history
This change adds typing to local and stack values. Technically the type
isn't strictly necessary as DWARF should indicate how to interpret the values.

However, using types allows us to represent the lack of value, because
it has been optimized out and more complex values like reference types.

Closes WebAssembly#198
  • Loading branch information
xtuc committed Feb 8, 2023
1 parent 31165d1 commit bbd6ec8
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Coredump.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,26 @@ For each thread a [Custom section], called `corestack`, is used to store the
debugging information.

```
corestack ::= customsec(thread-info vec(frame))
corestack ::= customsec(thread-info vec(frame))
thread-info ::= 0x0 thread-name:name
frame ::= codeoffset:u32
locals:vec(u32)
stack:vec(u32)
locals:vec(value)
stack:vec(value)
reserved:u32
```

The `reserved` byte is decoded as an empty vector and reserved for future use.

Local and stack values are encoded using [Value Types] (valtype) followed by bytes
representing the actual value:
```
value ::= t:valtype x:t => x
| 0x01 => ∅
```

The special byte `0x01` is used to represent a missing value, usually because
it was optimized out by the WebAssembly engine.

## Memory

The process memory is captured in the [Data Section], either entirely as one
Expand Down Expand Up @@ -145,3 +155,4 @@ tooling: [demo].
[Memory Section]: https://webassembly.github.io/spec/core/binary/modules.html#binary-memsec
[instantiated]: https://webassembly.github.io/spec/core/exec/modules.html#instantiation
[Global Section]: https://webassembly.github.io/spec/core/binary/modules.html#binary-globalsec
[Value Types]: https://webassembly.github.io/spec/core/binary/types.html#binary-valtype

0 comments on commit bbd6ec8

Please sign in to comment.