Skip to main content

breakpoint_handler

Attribute Macro breakpoint_handler 

Source
#[breakpoint_handler]
Expand description

Breakpoint handler.

The handler is invoked with a mutable reference to the trapped TrapFrame and must return a boolean indicating whether it has fully handled the trap:

  • true means the breakpoint has been handled and control should resume according to the state encoded in the trap frame.
  • false means the breakpoint was not handled and default processing (such as falling back to another mechanism or terminating) should occur.

When returning true, the handler is responsible for updating the saved program counter (or equivalent PC field) in the trap frame as required by the target architecture. In particular, the handler must ensure that, upon resuming from the trap, execution does not immediately re-trigger the same breakpoint instruction or condition, which could otherwise lead to an infinite trap loop. The exact way to advance or modify the PC is architecture-specific and depends on how TrapFrame encodes the saved context.