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 15, 2019
1 parent c6c1984 commit 8d1d0f0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 31 deletions.
20 changes: 4 additions & 16 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[CodeTracking]]
deps = ["Test", "UUIDs"]
git-tree-sha1 = "12aa4d41c7926afd7a71af5af603a4d8b94292c2"
deps = ["InteractiveUtils", "UUIDs"]
git-tree-sha1 = "7555b0ccf431ae75a339fd4362d6abda497757e8"
repo-rev = "kc/stdlib_buildbot"
repo-url = "https://github.com/KristofferC/CodeTracking.jl"
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
version = "0.3.1"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
Expand All @@ -34,13 +29,6 @@ uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
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 8d1d0f0

Please sign in to comment.