fix(#464): redefine_classes re-resolves statement anchors against the new source - #485
Open
debugmcpdev wants to merge 1 commit into
Open
fix(#464): redefine_classes re-resolves statement anchors against the new source#485debugmcpdev wants to merge 1 commit into
debugmcpdev wants to merge 1 commit into
Conversation
… new source A hot-swap invalidates line numbers, but the replant was purely by line — a statement-anchored breakpoint silently rebound to whatever now lives at the old line, reporting verified:true. Content identities must be honored whenever lines are invalidated (restart_debugging already does). - After a successful redefine, reresolveAnchors (the restart machinery: fresh file read, nearLine proximity, #379 multi-candidate flagging, #271 stale-keeps-line) re-resolves every statement anchor, and the affected files are re-sent via setBreakpoints — ordered after vm.redefineClasses by construction, so the JDI replant binds moved lines against the new line table. - The response carries the same anchorResolution { moved, stale } shape restart_debugging returns, plus a warning when anchors went stale. - Bridge drive-by: replantedBreakpoints now counts re-planted function breakpoints too (the handleClassPreparedForFunctionBreakpoints return value was dropped). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #464.
A hot-swap invalidates line numbers, but the replant was purely by line — a
statement:-anchored breakpoint silently rebound to whatever now lives at the old line, reportingverified: true. Content identities must be honored whenever line numbers are invalidated, asrestart_debuggingalready does.Fix
redefinedCount > 0),reresolveAnchors— the restart machinery, with all its awkward parts already solved (fresh file read,nearLineproximity, Substring expectedContent silently weakens the 'cannot land on the wrong line' guarantee; docs still promise it #379 multi-candidate flagging, [FEATURE] Agent-native breakpoint addressing: expectedContent assertion, statement anchors, function breakpoints #271 stale-keeps-line) — re-resolves every statement anchor against the source on disk, and the affected files are re-sent via the existing per-filesetBreakpointssync. Ordered aftervm.redefineClassesby construction (it runs on the redefine response), so the JDI replant binds moved lines against the new line table — the "not a drop-in" part the issue called out.anchorResolution: { moved, stale }shaperestart_debuggingreturns, plus awarningwhen anchors went stale or a re-send failed.handleClassPreparedForFunctionBreakpointsnow returns its replant count andreplantBreakpointsAfterRedefineadds it in, soreplantedBreakpointsstops under-reporting (visible below: it reports 2 for 1 line + … well, 2 line bps here).Verification — the issue's literal repro, live
Breakpoint at line 19 + statement-anchored breakpoint on
System.out.println("val2 = " + val2);(line 23). Launch, pause at 19. Overwrite the source with the V2 file (statement shifts to 26),javac -g,redefine_classes:→ { redefinedCount: 1, replantedBreakpoints: 2, anchorResolution: { moved: [{ from: 23, to: 26, statement: "System.out.println(\"val2 = \" + val2);" }], stale: [] } } continue_execution → stops at RedefineTarget.main line 26 // previously: ran to completion evaluate val2 → "99" // the hot-swapped valuesetBreakpointsordering asserted), stale anchor + warning, nothing-redefined short-circuit.JdiDapServer.javacompiles clean; full unit suites 3221 passed.🤖 Generated with Claude Code