JuliaDebug / JuliaDebug/Debugger.jl
Unexpected `n` behavior within `open(f, ...)`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 514
- Forks
- 50
- Avg merge
- 9d 9h
- Merged PRs (30d)
- 1
Description
When debugging code such as the following:
function wrapper()
mktempdir() do dir
open(joinpath(dir, "test.txt"), "w") do io
println(io, "data")
end
end
end
Using n to enter a do block does not work; I think this might be expected, but I wonder if the docs (which state that n means "step to the next line" should instead say something like "step to the next expression" if that is indeed what it is doing.)
The truly unexpected piece is when trying to navigate within open to get into the println(): after si'ing and so'ing my way until I'm in open(), I am greeted by the following:
1|debug> si
In open(f, args) at io.jl:296
295 function open(f::Function, args...; kwargs...)
>296 io = open(args...; kwargs...)
297 try
298 f(io)
299 finally
300 close(io)
About to run: (NamedTuple)()
I then hit n to attempt to jump down to the f(io), but when I hit n I get:
1|debug> n
In open(f, args) at io.jl:296
295 function open(f::Function, args...; kwargs...)
>296 io = open(args...; kwargs...)
297 try
298 f(io)
299 finally
300 close(io)
About to run: return
I have somehow just skipped to the end of the open() function, and continuing to step causes me to exit out.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the wrapper example and step through the open(f, args) entry point shown at io.jl:296 using si, so, and n. Compare the observed jumps with the documented meaning of n, then determine whether the stepping behavior or its documentation needs correction and verify the result with a focused debugger test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100