API
Infiltration and exfiltration
Add @infiltrate to any function to start the infil> REPL mode when that line runs.
It's recommended to put Infiltrator.jl into your global environment and not into package environments for two reasons:
- Infiltrator.jl is intended as a development tool only and as such should not be shipped
- Any
@infiltrateinvocations in your package code will fail at compile-time, which prevents you from accidentally committing infiltrated code
This means that you'll need to use Revise.jl, inline evaluation in VS Code, or just plain old @eval to apply @infiltrate statements in your package code.
Infiltrator.@infiltrate — Macro
@infiltrate
@infiltrate condition::Bool@infiltrate sets an infiltration point (or breakpoint).
When the infiltration point is hit, it will drop you into an interactive REPL session that lets you inspect local variables and the call stack as well as execute arbitrary statements in the context of the current functions module.
This macro also accepts an optional argument cond that must evaluate to a boolean, and then this macro will serve as a "conditional breakpoint", which starts inspections only when its condition is true. For example:
@infiltrate false # does not infiltrateInfiltrator.@infiltry — Macro
@infiltry exprWraps expression in a try block, infiltrate if an exception is raised. Equivalent to:
try
expr
catch
@infiltrate
rethrow()
endIf expr is of the form x = f(...), we take x out of the scope
x = try
f(...)
catch
@infiltrate
rethrow()
endInfiltrator.infiltrate — Function
infiltrate(mod, locals, file, line)Function form of @infiltrate. Use this to conditionally infiltrate package code without using e.g. Revise (because this version is valid during precompilation).
This would typically be used as
if isdefined(Main, :Infiltrator)
Main.infiltrate(@__MODULE__, Base.@locals, @__FILE__, @__LINE__)
endInfiltrator.@exfiltrate — Macro
@exfiltrateAssigns all local variables into the global storage.
The safehouse
This is where all exfiltrated variables end up. You can either exfiltrate a variable explicitly with @exfiltrate or implicitly by assignment in the infil> REPL mode.
Infiltrator.safehouse — Constant
safehouse
exfiltrated
Infiltrator.storeGlobal storage for storing values while @infiltrateing or @exfiltrateing.
Also see clear_store!, set_store!, and @withstore for safehouse-related functionality.
Infiltrator.clear_store! — Function
clear_store!(s = safehouse)Reset the store used for global symbols.
Infiltrator.set_store! — Function
set_store!(s = safehouse, m::Module)Set the module backing the store s.
Infiltrator.@withstore — Macro
@withstore exEvaluates the expression ex in the context of the global store.
Mainly intended for interactive use, as changes to the store's state will not propagate into the returned expression.
Utility
Infiltrator.clear_disabled! — Function
clear_disabled!(s = safehouse)Clear all disabled infiltration points.
Infiltrator.end_session! — Function
end_session!(s = safehouse)End this infiltration session (reverts the effect of @exit in the debug> REPL).
Infiltrator.toggle_async_check — Function
toggle_async_check(enabled)Enable or disable the check for safe REPL mode switching. May result in a non-functional REPL.