Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Debugger - graphical breakpoints broken when docstring preceeds module #271

Closed
BioTurboNick opened this issue Mar 28, 2019 · 5 comments
Labels

Comments

@BioTurboNick
Copy link

Please search existing issues to avoid duplicates.

Details

  • Atom version: 1.35.1
  • Julia version: 1.1.0
  • OS: Windows 10 1809
  • Package versions:
    • Atom.jl: 0.8.2
    • julia-client: 0.8.1
    • ink: 0.10.1

Breakpoints fail to set in this code:

"""
Docstring
"""
module docstringtest
function foo()
    x = 4 + 5
end
end

But work in this code (after reloading with includet()):

"""
Docstring
"""

module docstringtest
function foo()
    x = 4 + 5
end
end
@timholy
Copy link
Contributor

timholy commented Mar 28, 2019

Interesting. It works if you do this:

julia> includet("/tmp/dsmod2.jl")

julia> breakpoint(docstringtest.foo)
1-element Array{JuliaInterpreter.BreakpointRef,1}:
 breakpoint(foo() in Main.docstringtest at /tmp/dsmod2.jl:6, line 6)

julia> using JuliaInterpreter

julia> @interpret docstringtest.foo()
(Frame for foo() in Main.docstringtest at /tmp/dsmod2.jl:6
b 1 6  1%1 = (+)(4, 5)
  2 6  │        x = %1
  3 6  └──      return %1, breakpoint(foo() in Main.docstringtest at /tmp/dsmod2.jl:6, line 6))

The fact that it paused (plust that b) shows that the breakpoint works. But it doesn't display in Juno, we get

julia> Juno.@run docstringtest.foo()
9                       

(without breaking), and indeed I see an error if I try to set the breakpoint graphically.

@pfitzseb
Copy link
Member

pfitzseb commented Mar 28, 2019

I can repro this with the latest JuliaInterpreter release (and also with master for JuliaInterpreter, Revise, and CodeTracking):

julia> using Revise

julia> using JuliaInterpreter

julia> includet("/home/pfitzseb/bptest.jl")

julia> breakpoint("/home/pfitzseb/bptest.jl", 7) # space between docstring and module
breakpoint(foo() in Main.docstringtest at /home/pfitzseb/bptest.jl:7, line 7)

julia> remove()

julia> breakpoint("/home/pfitzseb/bptest.jl", 6) # no space between docstring and module
ERROR: no signatures found at /home/pfitzseb/bptest.jl, 6 among the signatures Any[]
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] breakpoint(::String, ::Int64) at /home/pfitzseb/.julia/packages/JuliaInterpreter/8bMSs/src/breakpoints.jl:264
 [3] top-level scope at none:0

timholy added a commit to JuliaDebug/JuliaInterpreter.jl that referenced this issue Mar 28, 2019
Since we create modules incrementally as we advance through
`split_expressions!`, when we extract docstrings we need to avoid
duplicating the module definition itself.

Fixes JunoLab/Juno.jl#271
@timholy
Copy link
Contributor

timholy commented Mar 28, 2019

Thanks for finding the MWE, @pfitzseb! And for the report, @BioTurboNick.

timholy added a commit to JuliaDebug/JuliaInterpreter.jl that referenced this issue Mar 29, 2019
Since we create modules incrementally as we advance through
`split_expressions!`, when we extract docstrings we need to avoid
duplicating the module definition itself.

Fixes JunoLab/Juno.jl#271
@timholy
Copy link
Contributor

timholy commented Mar 29, 2019

This can now be closed.

@pfitzseb
Copy link
Member

Thanks for the quick fix! Can confirm this case works fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants