Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
channel: ['1.6', '1.7', '1.8', '1.9', '1.10', '1.11']
channel: ['1.6', '1.7', '1.8', '1.9', '1.10', '1.11', '1.12']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
Expand Down
31 changes: 28 additions & 3 deletions src/Infiltrator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ function debugprompt(mod, locals, trace, terminal, repl, ex, bt; nostack = false
end
end
if !ok || !REPL.ends_with_semicolon(line)
REPL.print_response(repl, (result, !ok), true, true)
print_response(repl, (result, !ok), true, true)
end
else
try
Expand All @@ -749,7 +749,7 @@ function debugprompt(mod, locals, trace, terminal, repl, ex, bt; nostack = false
result = (err, nostack ? Any[] : crop_backtrace(catch_backtrace()))
end
if !ok || !REPL.ends_with_semicolon(line)
REPL.print_response(repl, ok ? result : result[1], ok ? nothing : result[2], true, true)
print_response(repl, ok ? result : result[1], ok ? nothing : result[2], true, true)
end
end
println(io)
Expand Down Expand Up @@ -828,6 +828,31 @@ function print_verbose_stackframe(io, sf::StackTraces.StackFrame, padding = 2, t
printstyled(io, normpath(file), ":", line, '\n', color=:light_black)
end

# with https://github.com/JuliaLang/julia/pull/57773, print_response will
# evaluate `display` on the REPL backend. We are however running all of Infiltrator
# on the REPL backend already, so that would cause a deadlock. Luckily we can pass
# nothing instead of the actual REPL backend to work around that.
@static if hasmethod(REPL.print_response, (IO, Any, Nothing, Bool, Bool, Union{AbstractDisplay,Nothing})) &&
isdefined(REPL, :eval_with_backend) &&
hasmethod(REPL.eval_with_backend, (Any, Nothing))

function print_response(repl, response, show_value, have_color)
repl.waserror = response[2]
REPL.with_repl_linfo(repl) do io
io = IOContext(io, :module => Base.active_module(repl)::Module)

REPL.print_response(io, response, nothing, show_value, have_color, REPL.specialdisplay(repl))
end

return nothing
end

else

print_response(args...) = REPL.print_response(args...)

end

# https://github.com/JuliaLang/julia/blob/1fb28ad8768cfdc077e968df7adf5716ae8eb9ab/base/methodshow.jl#L134-L148
function fixup_stdlib_path(path::String)
BUILD_STDLIB_PATH = isdefined(Sys, :BUILD_STDLIB_PATH) ?
Expand Down Expand Up @@ -914,7 +939,7 @@ function find_first_topelevel_scope(bt::Vector{<:Union{Base.InterpreterIP,Ptr{Cv
st = Base.StackTraces.lookup(ip)
ind = findfirst(st) do frame
linfo = frame.linfo
if linfo isa Core.CodeInfo
if linfo isa Core.CodeInfo && VERSION < v"1.12-"
@static if VERSION >= v"1.2" && hasfield(Core.CodeInfo, :debuginfo)
linfo.debuginfo.def === StackTraces.top_level_scope_sym && return true
else
Expand Down
5 changes: 3 additions & 2 deletions test/generate.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
for version in ["1.1", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11"]
for version in ["1.1", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "1.12"]
println("Generating outputs with Julia v$version")
run(addenv(`julia +$version --project=$(dirname(@__DIR__)) -e 'using Pkg; Pkg.test()'`, "INFILTRATOR_CREATE_TEST" => 1))
rm(joinpath(@__DIR__, "..", "Manifest.toml"))
run(addenv(`julia +$version --project=$(dirname(@__DIR__)) -e 'using Pkg; Pkg.instantiate(); Pkg.test()'`, "INFILTRATOR_CREATE_TEST" => 1))
end
42 changes: 42 additions & 0 deletions test/outputs/Julia_anon_1.12.multiout
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> aasdf
|3
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBCCCCC
|C
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> aasdf
|3
|
|infil> @exfiltrate aasdf
|Exfiltrating 1 local variable into the safehouse.
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBCCCCC
|C
|
|BBBBBBBCCCCCCCCCCCCCCCCC
|CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
|BBBBBBB
42 changes: 42 additions & 0 deletions test/outputs/Julia_compiler_1.12.multiout
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> x
|2
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBC
|C
|
|BBBBBBB
++++++++++++++++++++++++++++++++++++++++++++++++++
|Infiltrating <unknown>
|
|infil> x
|2
|
|infil> @exfiltrate
|Exfiltrating 1 local variable into the safehouse.
|
|infil>
--------------------------------------------------
|AAAAAAAAAAAAAAAAAAAAAA
|
|BBBBBBBC
|C
|
|BBBBBBBCCCCCCCCCCC
|CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
|
|BBBBBBB
Loading
Loading