Home/Instructions/Environment Breakpoint
EBREAK

RISC-V EBREAK Instruction Details

Instruction ManualI-type

Raise a breakpoint exception for debugger or execution-environment handling

Instruction Syntax

ebreak
Operand Breakdown
Destination rd: general-purpose register receiving the result.
Source rs1: register holding the first operand.
Immediate imm: 12-bit signed value, sign-extended before operation with rs1.
RV32ISystemPrivileged

Instruction Behavior

EBREAK is an RV32I/RV64I SYSTEM instruction encoded with funct12=000000000001, rs1=x0, funct3=000, rd=x0, and opcode=1110011. It raises a breakpoint exception, with the exception PC recording the EBREAK instruction itself; cause handling and debug behavior are governed by the privileged architecture, debug specification, and execution environment. EBREAK does not write an integer register and is not an ordinary function-call return mechanism.

EBREAK Decode And Trap Animation

Starts from the SYSTEM encoding, then shows fixed fields, execution context, synchronous exception, and EPC/cause state update.

no explicit operands
ebreakebreak
Execution Context
31..20
19..15
14..12
11..7
6..0
000000000001
funct12
00000
rs1=x0
000
funct3
00000
rd=x0
1110011
SYSTEM
instruction
0x00100073
opcode
1110011 -> SYSTEM
funct3
000
fixed
funct12=000000000001, rs1=x0, rd=x0
context
mode=M, pc=0x0000000000002000
exception
Breakpoint (code 3)
state
mepc=0x0000000000002000; mcause=3
next EPC
if continuing after instruction: 0x0000000000002004

This animation shows only ISA-visible synchronous exception and state recording; syscall ABI, debugger action, trap-handler policy, and timing are execution-environment or privileged-architecture matters.

Quick Understanding & Search Notes

EBREAK is an architectural marker that raises a breakpoint exception, not a register-writing or jump instruction. Focus on the fixed SYSTEM encoding, funct12=1, the exception PC recording the current instruction, and later handling by the execution or debug environment.

SYSTEM encoding: opcode=1110011, funct3=000, rs1=x0, rd=x0, funct12=000000000001.
EBREAK raises a breakpoint exception; the exception PC points to the EBREAK instruction itself.
EBREAK does not define debugger UI, semihosting ABI, or handler policy; those belong to the execution environment or debug specification.
EBREAK writes no integer register; continuing after it requires the handler to update EPC according to the architecture.

Common Usage Scenarios

Debug & Monitoring

Understand this scenario with real code like «ebreak # raise breakpoint exception».

System & Privilege

Understand this scenario with real code like «ebreak # raise breakpoint exception».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is I-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

EBREAK and ECALL are both SYSTEM instructions; the key encoding difference is funct12=1 versus funct12=0.
Breakpoint handling is defined by the execution environment, debug specification, and privilege configuration; do not treat it as a fixed debugger-return flow.
The exception PC records the EBREAK instruction itself; a handler that continues after it must adjust EPC according to the architecture rules.

FAQ

Does EBREAK directly jump to a debugger?

At the ISA level it raises a breakpoint exception. Whether that enters a debugger, monitor, or ordinary trap handler depends on the execution environment, debug specification, and privilege configuration.

How does EBREAK differ from ECALL in encoding?

They share opcode, funct3, rs1, and rd; EBREAK uses funct12=1, while ECALL uses funct12=0.