Repository navigation
Give every top-level expression its file on Julia < 1.5 - #140
Merged
Merged
Conversation
Julia up to 1.4 records the file only in the first top-level line number of parsed code; every later one has `nothing` as its file. Lowering puts that `nothing` into the `Symbol`-typed `file` field of a `LineInfoNode`, so JuliaInterpreter reads garbage as the file of every top-level frame after the first. File breakpoints on top-level lines past the first expression were therefore never hit. Worse, once any file breakpoint is set, building such a frame matches the garbage name against the breakpoint's path; it is not absolute, so `find_source_file` runs Windows' `splitdrive` regex on it, which can read past the end and throw a `BoundsError` that kills the engine. That is what made the Windows x64 legs for Julia 1.3 and 1.4 fail intermittently since the paused-breakpoint tests were added: those are the first tests to set a file breakpoint and then reach a second top-level expression. The run now fills in the missing files before splitting the code. On Julia 1.5 and later the parser already sets them, so nothing changes there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Those versions parse top-level code without any line numbers, so a top-level frame has no line a file breakpoint could match, with or without the fix. 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.
Opened by Claude (Claude Code) at David's request, to fix the red CI legs on
main.What was red
Since #138 was merged,
mainhas failed CI on Windows x64, Julia 1.3.1 (both workflows) and 1.4.2 (JSON 0.20 workflow). The failure is intermittent: the 1.4.2 leg passed in the other workflow, and the PR's own run failed on a different one of the two new tests. In each case, one of #138's "a breakpoint added/removed while paused" testitems fails. The debug engine task dies with:Root cause
This is a real bug on old Julia that those tests were the first to exercise; it is not a test problem.
Base.parse_input_line(code; filename=...)puts the file only in the first top-levelLineNumberNode. Every later top-level one hasfile = nothing. 1.5+ sets it everywhere.nothingintoLineInfoNode.file, which is typedSymbol. JuliaInterpreter reads it as aSymbol, so every top-level frame after the first gets a garbage file name. Locally, on 1.4 with JuliaInterpreter 0.8.21, it came out as"Pb\t"`.find_source_fileruns Windows'splitdriveregex on the garbage bytes, which can read past the end and throw theBoundsErrorabove. Whether that happens depends on the garbage, which is why the failure is intermittent.Fix
Right after parsing,
runreplaces top-levelLineNumberNodes whose file isnothingwith ones that carry the debuggee's file name. On Julia ≥ 1.5 this changes nothing.There is a new testitem, "a breakpoint on a later top-level line is hit". It runs
x = 1; y = 2; z = 3with a breakpoint on line 2. It fails on every run on 1.3/1.4 without the fix (the run finishes without stopping), unlike #138's tests, which only catch the bug when the garbage happens to crash.The new test is skipped on Julia 1.0 and 1.1. Those versions parse top-level code without any line numbers, so a breakpoint on a top-level line has never been able to match there, with or without this fix. Making that work would mean re-parsing the file ourselves to recover line positions, which I left out of scope.
Verified locally
Separate issue noticed (not changed here)
A breakpoint that is hit at the start of a top-level expression is reported with
StopReasonStepinstead ofStopReasonBreakpointon every Julia version.our_debug_commandreturns the frame'spc, andrunmaps any number to a step. The new test therefore checks where the run stops, not the reason. I can fix that in a follow-up if wanted.🤖 Generated with Claude Code