Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4f188b5
chore(javascript): the function-breakpoint bridge's source holds no r…
cynarlab Nov 16, 2026
aa178af
fix(javascript): the server steps through skipped code itself; js-deb…
cynarlab Nov 16, 2026
47fe60c
fix(javascript): a forked child steps through skipped code too; the s…
cynarlab Nov 16, 2026
483bd07
fix(javascript): a step-in issued inside a dependency walks on into t…
cynarlab Nov 16, 2026
753d884
test(javascript): the stepper against a real js-debug, in the integra…
cynarlab Nov 16, 2026
21001ac
docs(javascript): what a step does now, and what the server sets in y…
cynarlab Nov 16, 2026
54781f4
fix(javascript): a net never fails a step, and an awaiter is V8's to …
cynarlab Nov 16, 2026
153fd09
fix(javascript): an attach's child sessions keep js-debug's stepper o…
cynarlab Nov 16, 2026
55052ad
docs(javascript): what a step does, said as it is (#1130, #1161)
cynarlab Nov 16, 2026
5895a6d
fix(javascript): one rule for where a step is netted, applied in one …
cynarlab Nov 16, 2026
cd0e6bb
docs(javascript): the one rule for the temporary breakpoints, and fou…
cynarlab Nov 16, 2026
dfc7b85
fix(javascript): a net only where a hit proves the step came back (#1…
cynarlab Nov 16, 2026
f6d5265
docs(javascript): what the server rescues, and what it leaves to V8 (…
cynarlab Nov 16, 2026
6e1a665
fix(javascript): a net covers all of a function or none; headers read…
cynarlab Nov 16, 2026
0f4112d
fix(javascript): V8 says which frames come down only by returning; th…
cynarlab Nov 16, 2026
83b424f
fix(javascript): the stepper leaves the steps V8 loses to V8; no temp…
cynarlab Nov 18, 2026
a2db462
fix(javascript): a pause in program code is the landing; the walk has…
cynarlab Nov 18, 2026
bf05b71
fix(javascript): where a step lands is the program's to decide, never…
cynarlab Nov 18, 2026
51bd3e5
fix(javascript): a stop the program reaches while V8 answers the step…
cynarlab Nov 18, 2026
926f888
fix(javascript): what the stepper holds after a step's resume goes ou…
cynarlab Nov 18, 2026
f3fd50c
docs(changelog): the #1208 note in #1130's fragment names the issue only
cynarlab Nov 18, 2026
a8f1817
docs(javascript): V8 16.0 has the fix for the steps it loses; with it…
cynarlab Nov 20, 2026
fc75280
test(javascript): harden expectAtTheReturn and next-call assertions (…
cynarlab Nov 21, 2026
541ad96
Merge pull request #1210 from debugmcp/docs/1173-v8-fix-landed
debugmcpdev Nov 21, 2026
87f8562
fix(javascript): harden server stepper, child attach policy, and docs…
cynarlab Nov 21, 2026
a18de7a
Merge remote-tracking branch 'origin/main' into fix/js-server-stepper
cynarlab Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ tests/**/*.js.map
# negation, `git add` silently skips new fixtures (how PR #252 lost one)
!tests/fixtures/debug-scripts/*.js
!tests/fixtures/javascript/subprocess-tree/*.js
# The JavaScript stepper's bundle fixture (issue #1130): an esbuild bundle, its
# source map, and both of its sources, the dependency under node_modules/ where
# the bundler found it. Hand-written fixtures, not build output.
!tests/fixtures/javascript/step-skipped-code/bundle/node_modules/
!tests/fixtures/javascript/step-skipped-code/bundle/**/*.js
!tests/fixtures/javascript/step-skipped-code/bundle/**/*.js.map

# Package source compilation artifacts
packages/*/src/**/*.js
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1130.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**A JavaScript step lands where your code next runs, and is no longer lost in Node's own code.** `step_into` on a line that calls a Node builtin took about 6 s on a Linux host and answered `pending`, blaming "a long-running call"; on the first `console.log` of a process it never landed at all and the program ran to its end. js-debug's own "smart stepper" was deciding where such a step ends: while the step was in skipped code it stepped again by itself, one engine step per statement (131 for one `console.log`), with a flag that moves the step to a later task and loses it. That stepper is now off for every session, and the server steps through skipped code itself, over js-debug's raw CDP socket, for `step_into`, `step_over` and `step_out` alike. A `step_into` that lands in skipped code walks on, one engine step at a time, until your code is on top again or the walk has taken 512 engine steps; then it steps out. The walk has no time bound, so a step lands in the same place on every host. A `step_into` on a line that calls your own function through skipped code (an `on` or `once` event listener behind `emitter.emit`, an array callback, a route handler from inside express) lands in that function when the walk reaches it within 512 engine steps; on a line whose call stays in skipped code (`console.log`) it lands where the call returned, and when the walk took all 512 engine steps first, the step's answer says so (`Stepped into. step_into walked 512 engine steps into the call, its limit, and was still in skipped code … so it stepped out …`; on Linux such a walk answers `pending` first, and the `wait_for_stop` answer after it carries the sentence in `lastStop.text`) and that code of yours the call runs further in or only schedules did not stop the step; a pause in your code on the line the step started from is where it stops (the line's next statement, or a one-line loop's header in its first iteration); on a line that only starts a later task (`setTimeout`) it lands on the next line instead of inside the callback some time later. A `step_over` or `step_out` that returns into skipped code steps out to the nearest frame of your program below; when nothing of your program called or awaits the function (the last line of a request handler, a timer callback, a `.then` callback) the program is resumed rather than walked through the internals of later tasks (a callback of yours already queued behind a `.then` callback is where V8's own step stops), and the pending answer then says the step left its frame, on an attach with `smartStep: true` too (a step still executing, such as a `step_over` of a long call, gets no such sentence). What counts as skipped is still js-debug's own verdict, asked at every landing, so `justMyCode`, your `skipFiles` and source maps decide it as before, and in a bundle your own lines stay program code after a stop in a bundled dependency; `justMyCode: false` (or `smartStep: false`) still lands every step where V8 lands. A forked child steps the way its root session does, launched or attached. Changed on purpose: a pause asked for while a step is still pending is reported as the pause, where the program is, and is not stepped away from (one case is not yet so, #1208: when a `step_into` is pending because the program is blocked in native code or idle, the pause stops inside the expression the server evaluates to wake the program before a pause); and the sentence a pending step carries no longer mentions js-debug's stepper. On Linux every engine step costs about 44 ms whoever sends it (#1163): the steps land in the same places there, and a long walk answers `pending: true` first, with a sentence saying the stepper is walking through skipped code in place of the one that blamed "a long-running call", after which `wait_for_stop` answers where it lands (measured on an Ubuntu 24.04 host with 2 vCPUs under Node 22: the first `console.log` of a process lands on the next line after about 17 s, a later one after about 5.5 s; a custom `util.inspect` function behind `console.log` is entered at once, in about 4.7 s). Not fixed here: a `step_into` on a `require` line does not land where the call returned (Node's loader returns through `try … finally`, one of the steps V8 itself loses, #1161): the first load of a module of yours is lost, and in the measured cases of a built-in or already loaded module the step stops further down the same function, with the lines between run, as before; `step_over` on such a line lands on the next one. (#1130)
1 change: 1 addition & 0 deletions changelog.d/1173.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**The JavaScript guide says where V8's fix for the steps it loses stands.** V8 16.0 fixes the lost step out of a function that returns through `try … finally` (V8 issue 569814973); no Node release has it yet. On a runtime with it, these steps land in the caller, and a `step_over` off the end of a `finally` block first stops once more at the end of the `return`, with the value it returns. (#1173)
17 changes: 17 additions & 0 deletions docs/KNOWN_ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ pause on raised exceptions in Ruby — it will also stop on caught ones.
(Attach sessions never apply a language default; their `breakOnExceptions` default is
`"none"` for every language.)

## JavaScript: a step that leaves a function through `finally` is lost

V8 loses a step that leaves a function through a `return` that runs a `finally` first: a
`return` inside `try … finally`, a `return` out of a `for … of` loop, a function with a
`using` declaration, and every async generator (#1161; in `async` functions and generators,
#1174). That is a `step_out` of such a function, or a `step_over` / `step_into` off its last
statement; a step that crosses an `await` first is not lost. Measured on Node 22.23.2, 24.14.1
and 26.9.0 (Node 16.3.0 lands these steps, 16.4.0 and later do not). The step either never
lands, and the program runs on or ends (`pending: true`, or `Step completed as session
exited.`), or, for a `step_over` off the end of a `finally` block, can stop in the next call
of the same function instead of the caller. mcp-debugger does not rescue these steps.

Workaround: set a breakpoint on the line where you expect execution to come back, then
`continue_execution`. The fix is in V8 16.0 (V8 issue 569814973, tracked here as #1173). No
Node release has it yet: it reaches you only through a Node release whose V8 has it. See the
[JavaScript guide](./javascript/README.md).

## Dart/Flutter: what the SDK debug adapter does differently

The Dart adapter drives the SDK's own `dart debug_adapter` / `flutter debug-adapter`, so
Expand Down
Loading
Loading