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 7428e40 commit 55edf48
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 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
10 changes: 5 additions & 5 deletions docs/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 = "591b73b37c92ed7d55d3a14e266829c21aa3a7eb"
deps = ["InteractiveUtils", "Test", "UUIDs"]
git-tree-sha1 = "983f5f7a57c604322917ab8bc5b86ba914d3c345"
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
version = "0.3.0"
version = "0.3.2"

[[Dates]]
deps = ["Printf"]
Expand All @@ -19,9 +19,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[DocStringExtensions]]
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
git-tree-sha1 = "1df01539a1c952cef21f2d2d1c092c2bcf0177d7"
git-tree-sha1 = "4d30e889c9f106a51ffa4791a88ffd4765bf20c3"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.6.0"
version = "0.7.0"

[[Documenter]]
deps = ["Base64", "DocStringExtensions", "InteractiveUtils", "LibGit2", "Logging", "Markdown", "Pkg", "REPL", "Random", "Test", "Unicode"]
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 55edf48

Please sign in to comment.