Repository navigation
Debugging: Keep a component's breakpoints in the module they were set in - #15194
Open
sansmoraxz wants to merge 1 commit into
Open
sansmoraxz wants to merge 1 commit into
sansmoraxz wants to merge 1 commit into
Conversation
Single-stepping off re-patches each module's breakpoint sites by that module's breakpoints, telling its sites from other modules' by where they are in the shared code image. But code inlined from one module into another is in the other's code, so its breakpoints were decided by the wrong module, and lost. Record each breakpoint site's module (the innermost frame's, so inlined code keeps its own) in the frame table, and re-patch by that instead.
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #15182. A component's core modules share one code image and one frame table, and the frame table told breakpoint sites apart only by their module-relative Wasm PC, so the same PC in two modules was taken for the same site. There are two fixes, one per commit.
Keep inlined breakpoints when single-stepping ends. Since #15182, each module re-patches only the sites in its own range of the code. But with inlining, a function from one module can be inlined into a caller from another. Its sites are then in the caller's range, and were re-patched by the caller's module, so a breakpoint in the inlined function was lost. The frame table now records each site's module (the innermost frame's, so inlined code keeps its own), and re-patching goes by that. This removes the text-range accessors added in #15182: where a site is in the code says whose function it is in, not whose Wasm code it is, and once the frame table records the module the range isn't needed. Re-patching also gets cheaper: it walks only the module's own sites, found by a binary search.
Scope breakpoint lookups to one module. Adding, removing and slipping a breakpoint looked its sites up by PC alone, across all modules. So:
The sites are now sorted by module, then PC, and each lookup is scoped to one module.
FrameTable::breakpoint_patchesnow takes a module, andobjdumpuses the newall_breakpoint_patches.Tests:
component_inlined_breakpoint_survives_single_stepsets a breakpoint in a function called from another module, with inlining off and on.component_breakpoint_stays_in_its_moduleandcomponent_breakpoint_slips_within_its_modulewithout it, a breakpoint in one module also stops the other, and a breakpoint past module 0's code lands in module 1.TWO_MODULESnow has both functions at the same PCs; the old one, with padding, isTWO_MODULES_PADDED.