debugger: disambiguate probe location binding#63286
Open
joyeecheung wants to merge 1 commit into
Open
Conversation
In probe mode, `--probe utils.js:10` can match multiple scripts
(e.g. `src/utils.js` and `lib/utils.js`) because the matcher uses
a path-separator-anchored URL suffix (similar to how e.g. gdb/lldb
behaves). Previously the report echoed only the user's request in
hit events, so a user seeing two hits at `utils.js:10` could not
tell which script each hit came from. In addition, previously
when the column was omitted we bound to 1 which was technically
different from how CDP binds omitted columns (to the first
executable column on the line).
This patch clarifies the semantics by tracking the scripts via
`Debugger.scriptParsed`, as recommended in the CDP docs, and
reports the actual execution location as `results[i].location`.
The same shape can be reused in the future for source maps or
additional events in attach mode.
This bumps the schema version because `target` is now
`{ suffix, line, column? }` instead of a positional array for
clarity. We picked `suffix` as the field name in case we
introduce other matching modes in the future. `column` is
omitted when the user did not supply one, and the actual
resolved column is reported in the hit event instead.
This patch also adds more tests for column-specific bindings,
multi-location resolution via require(cjs), and late script
binding via dynamic import(cjs) and require(esm).
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
Collaborator
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63286 +/- ##
========================================
Coverage 90.04% 90.05%
========================================
Files 713 714 +1
Lines 225003 225305 +302
Branches 42536 42584 +48
========================================
+ Hits 202606 202893 +287
- Misses 14177 14206 +29
+ Partials 8220 8206 -14
🚀 New features to boost your workflow:
|
hybrist
approved these changes
May 13, 2026
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.
In probe mode,
--probe utils.js:10can match multiple scripts (e.g.src/utils.jsandlib/utils.js) because the matcher uses a path-separator-anchored URL suffix (similar to how e.g. gdb/lldb behaves). Previously the report echoed only the user's request in hit events, so a user seeing two hits atutils.js:10could not tell which script each hit came from. In addition, previously when the column was omitted we bound to 1 which was technically different from how CDP binds omitted columns (to the first executable column on the line).This patch clarifies the semantics by tracking the scripts via
Debugger.scriptParsed, as recommended in the CDP docs, and reports the actual execution location asresults[i].location. The same shape can be reused in the future for source maps or additional events in attach mode.This bumps the schema version because
targetis now{ suffix, line, column? }instead of a positional array for clarity. We pickedsuffixas the field name in case we introduce other matching modes in the future.columnis omitted when the user did not supply one, and the actual resolved column is reported in the hit event instead.This patch also adds more tests for column-specific bindings, multi-location resolution via require(cjs), and late script binding via dynamic import(cjs) and require(esm).