Skip to content

Commit

Permalink
Merge pull request #436 from JuliaDebug/teh/fix_nightly
Browse files Browse the repository at this point in the history
Various fixes on nightly
  • Loading branch information
timholy authored Oct 19, 2020
2 parents 2f5f800 + bc2968f commit f72931e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/breakpoints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ macro breakpoint(call_expr, args...)
end
args = Base.tail(args)
end
condexpr = condition === nothing ? nothing : Expr(:quote, condition)
condexpr = condition === nothing ? nothing : esc(Expr(:quote, condition))
if haveline
return quote
local method = $whichexpr
Expand Down
8 changes: 4 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,19 @@ function firstline(ex::Expr)
end

"""
loc = whereis(frame, pc=frame.pc)
loc = whereis(frame, pc::Int=frame.pc)
Return the file and line number for `frame` at `pc`. If this cannot be
determined, `loc == nothing`. Otherwise `loc == (filepath, line)`.
"""
function CodeTracking.whereis(framecode::FrameCode, pc)
function CodeTracking.whereis(framecode::FrameCode, pc::Int)
codeloc = codelocation(framecode.src, pc)
codeloc == 0 && return nothing
lineinfo = linetable(framecode, codeloc)
return isa(framecode.scope, Method) ?
whereis(lineinfo, framecode.scope) : (getfile(lineinfo), getline(lineinfo))
end
CodeTracking.whereis(frame::Frame, pc=frame.pc) = whereis(frame.framecode, pc)
CodeTracking.whereis(frame::Frame, pc::Int=frame.pc) = whereis(frame.framecode, pc)

"""
line = linenumber(framecode, pc)
Expand All @@ -345,7 +345,7 @@ function getfile(framecode::FrameCode, pc)
end
getfile(frame::Frame, pc=frame.pc) = getfile(frame.framecode, pc)

function codelocation(code::CodeInfo, idx)
function codelocation(code::CodeInfo, idx::Int)
codeloc = codelocs(code)[idx]
while codeloc == 0 && (code.code[idx] === nothing || isexpr(code.code[idx], :meta)) && idx < length(code.code)
idx += 1
Expand Down
6 changes: 4 additions & 2 deletions test/debug.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using JuliaInterpreter, Test
using CodeTracking, JuliaInterpreter, Test
using JuliaInterpreter: enter_call, enter_call_expr, get_return, @lookup
using Base.Meta: isexpr
include("utils.jl")

const ALL_COMMANDS = (:n, :s, :c, :finish, :nc, :se, :si, :until)

Expand Down Expand Up @@ -143,7 +144,8 @@ end
frame = enter_call_expr(:($(callgenerated)()))
f, pc = debug_command(frame, :sg)
# Aside: generators can have `Expr(:line, ...)` in their line tables, test that this is OK
@test isexpr(JuliaInterpreter.linetable(f, 2), :line)
lt = JuliaInterpreter.linetable(f, 2)
@test isexpr(lt, :line) || isa(lt, Core.LineInfoNode)
@test isa(pc, BreakpointRef)
@test JuliaInterpreter.scopeof(f).name == :generatedfoo
stmt = JuliaInterpreter.pc_expr(f)
Expand Down

0 comments on commit f72931e

Please sign in to comment.