cfallin opened PR #12802 from cfallin:debug-pc-on-traps to bytecodealliance:main:
This was not exposed earlier by (i) lack of handling of trap events in the initial version of the gdbstub component in #12771, and (ii) lack of asserting some value for the PC on the top frame in the debug-event test for traps. We got the PC for the last opcode in the function body previously because, with no debug tags on the trapping path that calls raise() (sunk to the bottom of the machine code body as cold code), we scanned backward for the last tag metadata and found that instead. Adding metadata according to the current source location when emitting traps fixes this for all trapping events.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
cfallin requested alexcrichton for a review on PR #12802.
cfallin requested wasmtime-compiler-reviewers for a review on PR #12802.
cfallin requested wasmtime-core-reviewers for a review on PR #12802.
cfallin updated PR #12802.
alexcrichton submitted PR review.
alexcrichton added PR #12802 Debugging: add debug-tags to instrumented trap sites so we actually get PCs on traps. to the merge queue
alexcrichton merged PR #12802.
alexcrichton removed PR #12802 Debugging: add debug-tags to instrumented trap sites so we actually get PCs on traps. from the merge queue
Last updated: Mar 23 2026 at 16:19 UTC