JuliaDebug / Infiltrator.jl

No-overhead breakpoints in Julia
MIT License
409 stars 22 forks source link

Exfiltrate deepcopy? #90

Open jw3126 opened 2 years ago

jw3126 commented 2 years ago

Is it possible to exfiltrate a deep copy of locals? For instance, suppose I have the following function and I suspect that its state is murky at iteration 1:

using Infiltrator

function f(x)
    out = []
    for i in x
        push!(out, 2i)
        if i == 1 
            @exfiltrate
        end
    end
end
f(1:10)
# Safehouse with 3 stored variables:
# - out::Vector{Any} = Any[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
# - i::Int64 = 1
# - x::UnitRange{Int64} = 1:10

Now out does not capture the state at iteration 1.

I am not proposing to change the default. I am just asking if there is/could be an option for deep copy.

pfitzseb commented 2 years ago

@exfiltrate deep=true or something similar seems like a good idea to me. Presumably this isn't particularly useful in the infil> REPL because you can just manually deepcopy whatever you want to exfiltrate.