Skip to content

Commit 88201cf

Browse files
Profile: fix Compiler short path (JuliaLang#56515)
1 parent 4feca1f commit 88201cf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/Profile/src/Profile.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,11 @@ function flatten(data::Vector, lidict::LineInfoDict)
529529
end
530530

531531
const SRC_DIR = normpath(joinpath(Sys.BUILD_ROOT_PATH, "src"))
532+
const COMPILER_DIR = "././../usr/share/julia/Compiler/"
532533

533534
# Take a file-system path and try to form a concise representation of it
534535
# based on the package ecosystem
536+
# filenamecache is a dict of spath -> (fullpath or "" if !isfile, modulename, shortpath)
535537
function short_path(spath::Symbol, filenamecache::Dict{Symbol, Tuple{String,String,String}})
536538
return get!(filenamecache, spath) do
537539
path = Base.fixup_stdlib_path(string(spath))
@@ -544,6 +546,10 @@ function short_path(spath::Symbol, filenamecache::Dict{Symbol, Tuple{String,Stri
544546
elseif startswith(path_norm, lib_dir)
545547
remainder = only(split(path_norm, lib_dir, keepempty=false))
546548
return (isfile(path_norm) ? path_norm : ""), "@julialib", remainder
549+
elseif startswith(path, COMPILER_DIR)
550+
remainder = only(split(path, COMPILER_DIR, keepempty=false))
551+
possible_compiler_path = normpath(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "Compiler", remainder))
552+
return (isfile(possible_compiler_path) ? possible_compiler_path : ""), "@Compiler", remainder
547553
elseif isabspath(path)
548554
if ispath(path)
549555
# try to replace the file-system prefix with a short "@Module" one,

0 commit comments

Comments
 (0)