Home/Instructions/Environment Breakpoint
EBREAK

RISC-V EBREAK Instruction Details

Instruction ManualI-type

Unless overridden by an external debug environment, raise a breakpoint exception for debugger or execution-environment handling

Instruction Syntax

ebreak
Operand Breakdown
EBREAK has no explicit assembly operands; it is not an ordinary I-type computation with an rs1 operand or variable immediate.
Its fixed SYSTEM encoding is funct12=000000000001, rs1=x0, funct3=000, rd=x0, opcode=1110011; funct12 is an encoding selector, not an assembly immediate.
Unless overridden by an external debug environment, it raises a breakpoint exception; EPC records EBREAK itself, and subsequent handling depends on the execution environment and privilege configuration.
RV32IRV64ISystemTrap

Instruction Behavior

EBREAK is an RV32I/RV64I SYSTEM instruction encoded with funct12=000000000001, rs1=x0, funct3=000, rd=x0, and opcode=1110011. Unless overridden by an external debug environment, 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
EPC/cause not recorded
next EPC
if continuing after instruction: 0x0000000000002004

Assumes successful fetch, IALIGN=16 (16-bit instruction alignment), no H-extension virtualization, and no external-debug override of EBREAK. Only receiving-mode EPC/cause are illustrated; delegation, trap target address, and handler policy are outside this example.

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 returns control to a debugging environment. Unless overridden by an external debug environment, it raises a breakpoint exception; the receiving privilege mode records the current instruction address in EPC, without an integer-register write.

SYSTEM encoding: opcode=1110011, funct3=000, rs1=x0, rd=x0, funct12=000000000001.
Unless overridden by an external debug environment, EBREAK raises a breakpoint exception; EPC points to EBREAK 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 # breakpoint unless external debug overrides».

System & Privilege

Understand this scenario with real code like «ebreak # breakpoint unless external debug overrides».

Pre-Use Checklist

Syntax Check
  • There are no explicit register or immediate operands; rs1 and rd are fixed to x0, and funct12 is a fixed selector.
Semantic Check
  • Unless overridden by an external debug environment, EBREAK raises a breakpoint exception.
  • The receiving privilege mode records the current instruction address in EPC; PC+4 is only a handler resume-after-instruction example.

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?

Unless overridden by an external debug environment, EBREAK raises a breakpoint exception. Debug handling and trap-handler policy depend on the execution environment; the ISA does not define a fixed debugger-return flow.

How does EBREAK differ from ECALL in encoding?

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