Webcentive RISC-V Reference

ebreak

Breakpoint exception

Extension
RV32I/RV64I base integer
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
ebreak
Length
32-bit

Encoding

31201976210
00000000000100000000000001110011

Match 0x00100073, mask 0xffffffff. Source: ebreak 31..20=0x001 19..7=0 6..2=0x1C 1..0=3 in riscv-opcodes/extensions/rv_i.

Description

The EBREAK instruction is used by debuggers to cause control to be transferred back to a debugging environment. Unless overridden by an external debug environment, EBREAK raises a breakpoint exception and performs no other operation.

Note: As described in the C Standaxd Extension for Compressed Instructions, the c.ebreak instruction performs the same operation as the EBREAK instruction.

EBREAK causes the receiving privilege mode's epc register to be set to the address of the EBREAK instruction itself, not the address of the following instruction. As EBREAK causes a synchronous exception, it is not considered to retire, and should not increment the minstret CSR.

Description from riscv-unified-db, reformatted.

Operation

if (TRAP_ON_EBREAK) {
  raise_precise(ExceptionCode::Breakpoint, mode(), $pc);
} else {
  eei_ebreak();
}

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages