Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a WasmBacktrace::new() constructor #5341

Merged
merged 3 commits into from
Dec 1, 2022

Conversation

alexcrichton
Copy link
Member

This commit adds a method of manually capturing a backtrace of WebAssembly frames within a Store. The new constructor can be called with any AsContext values, primarily &Store and &Caller, during host functions to inspect the calling state.

For now this does not respect the Config::wasm_backtrace option and instead unconditionally captures the backtrace. It's hoped that this can continue to adapt to needs of embedders by making it more configurable int he future if necessary.

Closes #5339

This commit adds a method of manually capturing a backtrace of
WebAssembly frames within a `Store`. The new constructor can be called
with any `AsContext` values, primarily `&Store` and `&Caller`, during
host functions to inspect the calling state.

For now this does not respect the `Config::wasm_backtrace` option and
instead unconditionally captures the backtrace. It's hoped that this can
continue to adapt to needs of embedders by making it more configurable
int he future if necessary.

Closes bytecodealliance#5339
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Nov 29, 2022
@github-actions
Copy link

Subscribe to Label Action

cc @peterhuene

This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@bjorn3
Copy link
Contributor

bjorn3 commented Nov 29, 2022

Maybe mirror std::backtrace::Backtrace? That is WasmBacktrace::capture() respecting Config::wasm_backtrace and WasmBacktrace::force_capture() not respecting it.

@alexcrichton alexcrichton requested a review from fitzgen December 1, 2022 19:38
crates/wasmtime/src/trap.rs Show resolved Hide resolved
crates/wasmtime/src/trap.rs Outdated Show resolved Hide resolved
@alexcrichton alexcrichton enabled auto-merge (squash) December 1, 2022 20:55
@alexcrichton alexcrichton merged commit ed67690 into bytecodealliance:main Dec 1, 2022
@alexcrichton alexcrichton deleted the manual-backtrace branch December 1, 2022 22:19
@jtenner
Copy link

jtenner commented Dec 6, 2022

Oh wait, did this get released with 3.0.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Obtain Current Stack Trace without a Trap
4 participants