Debug function call macro

Playing around with it, dbg seems to be able to do this, after I run Application.put_env(:elixir, :dbg_callback, {Macro, :dbg, []}). Though if I may segue a bit into using the Elixir debugger:

The reason I want to avoid actually doing a breakpoint is because I don’t know how to work around IEx breakpoints forgetting values. E.g.

Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.14.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> x = 123 # open some hardware
123
iex(2)> dbg(IO.inspect(1) + IO.inspect(2))
Break reached: iex:2
pry(1)> cont
warning: variable "cont" does not exist and is being expanded to "cont()", please use parentheses to remove the ambiguity or change the variable name
  iex:1

** (CompileError) iex:1: undefined function cont/0 (there is no such import)
    (elixir 1.14.3) src/elixir.erl:376: :elixir.quoted_to_erl/4
    (elixir 1.14.3) src/elixir.erl:277: :elixir.eval_forms/4
    (elixir 1.14.3) lib/module/parallel_checker.ex:110: Module.ParallelChecker.verify/1
    (iex 1.14.3) lib/iex/evaluator.ex:329: IEx.Evaluator.eval_and_inspect/3
    (iex 1.14.3) lib/iex/evaluator.ex:303: IEx.Evaluator.eval_and_inspect_parsed/3
    (iex 1.14.3) lib/iex/evaluator.ex:292: IEx.Evaluator.parse_eval_inspect/3
    (iex 1.14.3) lib/iex/evaluator.ex:187: IEx.Evaluator.loop/1
pry(1)> continue
1
2
IO.inspect(1) + IO.inspect(2) #=> 3

3

Interactive Elixir (1.14.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> x
warning: variable "x" does not exist and is being expanded to "x()", please use parentheses to remove the ambiguity or change the variable name
  iex:1

** (CompileError) iex:1: undefined function x/0 (there is no such import)
    (elixir 1.14.3) src/elixir.erl:376: :elixir.quoted_to_erl/4
    (elixir 1.14.3) src/elixir.erl:277: :elixir.eval_forms/4
    (elixir 1.14.3) lib/module/parallel_checker.ex:110: Module.ParallelChecker.verify/1
    (iex 1.14.3) lib/iex/evaluator.ex:329: IEx.Evaluator.eval_and_inspect/3
    (iex 1.14.3) lib/iex/evaluator.ex:303: IEx.Evaluator.eval_and_inspect_parsed/3
    (iex 1.14.3) lib/iex/evaluator.ex:292: IEx.Evaluator.parse_eval_inspect/3
    (iex 1.14.3) lib/iex/evaluator.ex:187: IEx.Evaluator.loop/1

Is there a way to avoid IEx not forgetting my variables after a breakpoint? It is a big problem when the variable it forgets is some device I have opened (which seems to stay open in the background so I can’t even open it again).

And if I can ask something else, is there a way to add hooks to breakpoints? I.e. to execute a command when the breakpoint gets triggered, and then continue instead of waiting for user input.