Skip to content

Commit

Permalink
also fixup frame printing
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Mar 15, 2019
1 parent da39fd7 commit d3ab668
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/JuliaInterpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ module CompiledCalls
# This module is for handling intrinsics that must be compiled (llvmcall)
end

# Just some way to get the path to the buildbot, which is used to workaround https://github.com/JuliaLang/julia/issues/26314
const BUILDBOT_STDLIB_PATH = dirname(abspath(joinpath(String((@which clipboard()).file), "..", "..", "..")))

const BUILTIN_FILE = joinpath(@__DIR__, "builtins-julia$(Int(VERSION.major)).$(Int(VERSION.minor)).jl")

@info "Generating builtins for this julia version..."
Expand Down
3 changes: 2 additions & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ function truncate!(frame)
end

function Base.show(io::IO, frame::Frame)
println(io, "Frame for ", scopeof(frame))
frame_loc = replace(repr(scopeof(frame)), BUILDBOT_STDLIB_PATH => Sys.STDLIB)
println(io, "Frame for ", frame_loc)
pc = frame.pc
ns = nstatements(frame.framecode)
range = get(io, :limit, false) ? (max(1, pc-2):min(ns, pc+2)) : (1:ns)
Expand Down
3 changes: 0 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ function lineoffset(framecode::FrameCode)
return offset
end

# Just some way to get the path to the buildbot
const BUILDBOT_STDLIB_PATH = dirname(abspath(joinpath(String((@which clipboard()).file), "..", "..", "..")))

function maybe_find_stdlib_file(filepath)
if !isfile(filepath)
maybe_stdlib_filepath = replace(filepath, BUILDBOT_STDLIB_PATH => Sys.STDLIB)
Expand Down
3 changes: 3 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ fr = JuliaInterpreter.enter_call(f)
file, line = JuliaInterpreter.whereis(fr)
@test file == @__FILE__
@test line == (@__LINE__() - 4)

# Test path to files in stdlib
fr = JuliaInterpreter.enter_call(Test.eval, 1)
file, line = JuliaInterpreter.whereis(fr)
@test isfile(file)
@test isfile(JuliaInterpreter.getfile(fr.framecode.src.linetable[1]))
@test occursin(Sys.STDLIB, repr(fr))

0 comments on commit d3ab668

Please sign in to comment.