Repository navigation
Look up the root frame before running a stepping command - #427
Open
KristofferC wants to merge 1 commit into
Open
KristofferC wants to merge 1 commit into
KristofferC wants to merge 1 commit into
Conversation
When a stepping command finishes the debugged call, `execute_command` read the result with `get_return(root(state.frame))`. By then JuliaInterpreter has recycled the finished frames, and the object in `state.frame` can already have been reused for a frame of another call tree, so the root found through it is not the root of the debugged call. For example, when the debugged code itself runs `JuliaInterpreter.@interpret`, `@run` returned the result of that inner call (`42` instead of `52` in the added test). The root is now looked up before calling `debug_command`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
When a stepping command finishes the debugged call,
execute_commandread the result withget_return(root(state.frame)). By then JuliaInterpreter has put the finished frames back in its reuse pool (junk_frames), and the object instate.framemay already have been reused.Frames reused inside the debugged call still walk up to the right root, so ordinary code is not affected. It breaks when, during the command, a frame is created outside the debugged call tree, e.g. when the debugged code itself uses JuliaInterpreter (
@interpret, or a package such as Revise that uses it internally). The recycled leaf then becomes the root of that other call, and@runreturns its result:The root is now looked up before calling
debug_command. This also makes Debugger independent of when JuliaInterpreter reuses frames.The added test fails without the fix (
42 == 52).🤖 Generated with Claude Code