Expand description
Breakpoint stops: what a :bp marker does at runtime (§9.8).
A fault snapshot is taken while the stack is unwinding and is read after
every language frame has gone (see crate::crash_snapshot). A breakpoint is
the other case: the frames are still claimed, the program is still in the
middle of them, and the whole point is to go back afterwards. So this module
is deliberately not a second fault path — it is a call out to the host and a
return.
§The handler is given a snapshot and nothing else, and that is the design
BreakpointHandler takes a &BreakpointStop and no *mut RuntimeContext. It has no heap pointer, no allocator, no way to run
generated code — so it cannot trigger a collection, and that is a
structural fact rather than a rule a host has to remember.
That matters because of what the stop hands over. BreakpointStop::frames
is a deep copy of the live debug chain, and its GcRefs are only as valid as
the objects they name. Values below the debug stack’s top are ADR-106’s
weak arm — every collection clears the slots whose objects it reclaimed — so
at the instant the copy is taken every reference in it is live. Keeping it
that way for the duration of the stop needs one thing: that no collection
happens while the host is looking. Withholding the context is how that is
guaranteed, and it is why the snapshot does not need to be registered as a
root set the way a fault snapshot does (which the host holds across
restart, p EXPR and everything else that allocates).
§Detaching, and why there is no kill
Resume has two arms. Continue returns to the program. Detach returns
to the program and disarms every later stop, which is what “quit the
debugger” means from inside a live run.
There is no third arm that ends the program, because there is nothing sound to do with the frames: §9.2 forbids unwinding Rust through JIT frames, and the fault epilogue that can unwind them is reached by raising a fault — which would report the program as having failed when it did not. A host that wants the run over can exit the process from its handler; the language will not pretend a stop is a fault.
Structs§
- Breakpoint
Stop - One
:bpstop, as the host sees it.
Enums§
- Resume
- What the host wants done after a stop.
Functions§
- breakpoints_
detached - Whether a stop has detached (a
Resume::Detachanswer). The host’s way to tell a run the user walked away from apart from one that simply had no markers left. - clear_
breakpoint_ handler - Forget any installed handler, so every later
:bpis a no-op. - install_
breakpoint_ handler - Install the host’s breakpoint handler, armed and with a fresh hit count.
Type Aliases§
- Breakpoint
Handler - A host’s breakpoint handler: given a stop, answers what to do next.