Breakpoint Trap

Raise a debug exception so a debugger can take control.

System

Semantics

Generates a synchronous debug/breakpoint exception. This is the instruction a debugger patches into code to set a software breakpoint.

Architecture Instructions Expressed as How this architecture does it
x86 one instruction A deliberately one-byte encoding (0xCC) so a debugger can overwrite any instruction's first byte in place.
ARM one instruction BRK takes a 16-bit immediate that debuggers use to tag which breakpoint fired.
RISC-V one instruction The compressed C.EBREAK form exists so a breakpoint can be patched over a 16-bit instruction.
PowerISA one instruction The trap instructions are conditional: tw traps when a comparison holds, and the unconditional trap is the canonical debugger form.