WebAssembly / WebAssembly/component-model

Idea: support post-trap call traces for guest interpreters

Open
#502 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
1.4k
Forks
130
Avg merge
2d 1h
Merged PRs (30d)
15

Description

While discussing this componentize-py issue, I realized it would be useful to allow a component to be entered one last time after it traps in order to get additional debug info.

For example, if a trap occurs while running Python code in the CPython interpreter, the guest stack trace produced by Wasmtime is usually pretty useless; what we really want is a Python-level stack trace, and that can only realistically be produced by executing guest code. More generally, it would be nice to be able to attach a Python-level debugger to the interpreter to do an interactive investigation; either way, we'd need to execute guest code.

One possible solution to this would be to allow the host to export a special on-trap function which the host may call after the trap happens, similar to how a signal handler would run after e.g. a SIGSEGV occurs. Presumably that function would be restricted from calling any imports and, in the simple case, take no parameters and return only a string containing a high-level call trace. Attaching a debugger would require a more sophisticated interface, of course, but we could start simple and expand from there.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing this proposal and the linked componentize-py issue 146; no source files, tests, or implementation entry points are named. Define and agree on the post-trap execution model, restrictions, return values, and debugger scope before implementation. Done means the Component Model behavior and its validation plan are specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.