forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backtrace support, part 3: Actually produce continuation-aware backtr…
…aces (#119) This PR finalizes the implementation of backtrace creation in the presence of wasmfx stack switching. The only piece missing after this PR is testing, which I'm adding in a separate PR. As of #117, it is already the case that each `CallThreadState` executing wasm stores a pointer to the underlying `Store`'s `StackChainCell`. This PR changes the existing creation of backtraces in `backtrace.rs` as follows: Previously, `trace_with_trap_state` would call call `trace_through_wasm` for the faulting program position plus all the entries in the current thread's `CallThreadState` chain. Now, instead of calling `trace_through_wasm` directly, `trace_with_trap_state` calls a new function `trace_through_continuations`. The latter takes an optional `StackChain` and iterates all the stacks (= continuation stacks + main stack) therein, calling `trace_through_wasm` for each such stack. If no such `StackChain` is given, it just behaves as before. Note that the invariant established in #117 ensures that only the most recent execution of wasm may actually be inside a continuation, while all previous `CallThreadState`s must be on the main stack. As a result, we only ever call `trace_through_wasm` such that the old invariants (which we had commented out at some point) hold again: Its parameters `trampoline_sp` and `fp` describe a continuous (!) sequence of stack memory, either on the main stack or inside a `Fiber` stack. Further, we have `trampoline_sp` > `fp` and following the frame pointer chain starting at `fp` eventually leads to a pointer past (= greater or equal than) `trampoline_sp`. --------- Co-authored-by: Daniel Hillerström <[email protected]>
- Loading branch information
1 parent
a496060
commit f6f7793
Showing
5 changed files
with
161 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters