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

wasm2c: add hook to allow a custom trap handler #2042

Merged
merged 1 commit into from
Nov 7, 2022

Conversation

shravanrn
Copy link
Collaborator

In production use cases, unwinding the stack before reporting an error throws away valuable information such as the stack trace. This hook allows the host to implement an alternate error recovery/reporting mechanism

@shravanrn shravanrn requested a review from sbc100 November 5, 2022 23:01
@sbc100
Copy link
Member

sbc100 commented Nov 7, 2022

Can we have a test for this, and also add it to the README?

@shravanrn
Copy link
Collaborator Author

@sbc100 Hmm... I only see the wasm spec tests, and I think this test looks a little different as this testing the embedder API. Are there any existing tests for the embedder API, which I can use as an example?

@sbc100
Copy link
Member

sbc100 commented Nov 7, 2022

Good question. Maybe we don't have good way to test this right now. We have at least one other change outstanding that is also blocked on a good testing strategy: #2009.

I think change is pretty small and probably doesn't need to be blocked on coming up with a new way to test wasm2c features, but we should probably be thinking about this. @keithw did you have any ideas for wasm2c testing outside of the existing run-spec-wasm2c tests?

wasm2c/wasm-rt-impl.c Outdated Show resolved Hide resolved
@keithw
Copy link
Member

keithw commented Nov 7, 2022

@keithw did you have any ideas for wasm2c testing outside of the existing run-spec-wasm2c tests?

I think it's pretty doable (e.g. we could make an option to run-spec-wasm2c.py to have it accept an arbitrary main.c given on stdin, or something like that).

@shravanrn shravanrn force-pushed the trap-handler branch 2 times, most recently from 058a8dd to 12aad76 Compare November 7, 2022 23:16
In production use cases, unwinding the stack before reporting an error throws away valuable information such as the stack trace. This hook allows the host to implement an alternate error recovery/reporting mechanism
@shravanrn shravanrn merged commit d149463 into WebAssembly:main Nov 7, 2022
@shravanrn shravanrn deleted the trap-handler branch November 7, 2022 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants