Using JuliaInterpreter breakpoints for custom code execution

The answer seems to be yes, with this code being the critical piece:

const JInterp = JuliaInterpreter

function return_and_continue_execution(fr::JInterp.Frame, return_value)
    # This assume the `fr` is the _calling_ frame, for whatever call was breaked on, and indeed,
    # this is the case for JInterp breakpoints.
    # This code is a slimmed down version of `JInterp.maybe_reset_frame!`
    @assert !JInterp.is_leaf(fr)

    # First, abort the call to the breakpointed function
    JInterp.recycle(fr.callee)
    fr.callee = nothing

    # Then assign the value and move on to the next instruction
    JInterp.maybe_assign!(fr, return_value)
    fr.pc += 1    # maybe_reset_frame! has more complicated logic, that I don't get, but git-blame
                  # suggests that it's for kwarg funs

    return JInterp.finish_and_return!(fr)  # continue execution
end

julia> using JuliaInterpreter

julia> sump7(x) = only(sum(x)) + 7
sump7 (generic function with 1 method)

julia> bp = @breakpoint sum([10,10]);

julia> frame, _ = @interpret sump7([100,100]);

julia> return_and_continue_execution(frame, 500)
507