Skip to content

Commit

Permalink
base on CodeTracking PR
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Mar 16, 2019
1 parent c6c1984 commit 03d2a2c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[CodeTracking]]
deps = ["Test", "UUIDs"]
git-tree-sha1 = "12aa4d41c7926afd7a71af5af603a4d8b94292c2"
deps = ["InteractiveUtils", "Test", "UUIDs"]
git-tree-sha1 = "983f5f7a57c604322917ab8bc5b86ba914d3c345"
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
version = "0.3.1"
version = "0.3.2"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
Expand Down
3 changes: 0 additions & 3 deletions src/JuliaInterpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ 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
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function truncate!(frame)
end

function Base.show(io::IO, frame::Frame)
frame_loc = replace(repr(scopeof(frame)), BUILDBOT_STDLIB_PATH => Sys.STDLIB)
frame_loc = CodeTracking.replace_buildbot_stdlibpath(repr(scopeof(frame)))
println(io, "Frame for ", frame_loc)
pc = frame.pc
ns = nstatements(frame.framecode)
Expand Down
13 changes: 2 additions & 11 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,8 @@ function lineoffset(framecode::FrameCode)
return offset
end

function maybe_find_stdlib_file(filepath)
if !isfile(filepath)
maybe_stdlib_filepath = replace(filepath, BUILDBOT_STDLIB_PATH => Sys.STDLIB)
isfile(maybe_stdlib_filepath) && return maybe_stdlib_filepath
end
return filepath
end

getline(ln) = isexpr(ln, :line) ? ln.args[1] : ln.line
getfile(ln) = maybe_find_stdlib_file(String(isexpr(ln, :line) ? ln.args[2] : ln.file))
getfile(ln) = CodeTracking.maybe_fixup_stdlib_path(String(isexpr(ln, :line) ? ln.args[2] : ln.file))

"""
loc = whereis(frame, pc=frame.pc)
Expand All @@ -175,9 +167,8 @@ function CodeTracking.whereis(framecode::FrameCode, pc)
codeloc = codelocation(framecode.src, pc)
codeloc == 0 && return nothing
lineinfo = framecode.src.linetable[codeloc]
filepath, line = isa(framecode.scope, Method) ?
return isa(framecode.scope, Method) ?
whereis(lineinfo, framecode.scope) : (getfile(lineinfo), getline(lineinfo))
return maybe_find_stdlib_file(filepath), line
end
CodeTracking.whereis(frame::Frame, pc=frame.pc) = whereis(frame.framecode, pc)

Expand Down

0 comments on commit 03d2a2c

Please sign in to comment.