Use this file to discover all available pages before exploring further.
The registers plugin provides access to CPU registers in angr states. Registers are stored in a flat memory region and can be accessed through state.registers or the convenient state.regs interface.
Registers in angr are stored as a special memory region with offsets defined by the architecture. The state.regs interface provides convenient property-based access to registers by name.
# Direct property accessrax = state.regs.raxrip = state.regs.ripeflags = state.regs.eflags# Prefix with underscore to disable inspect/actionsrax_silent = state.regs._rax # No SimInspect, no SimActions
Disabling Inspect and Actions
Prefixing a register name with _ (underscore) prevents:
SimInspect breakpoints from being triggered
SimActions from being created
Events from being logged
This is useful for internal operations that shouldn’t be visible to analysis plugins.
# Set to concrete valuestate.regs.rax = 0x1000# Set to symbolic valuesym_val = state.solver.BVS('input', 64)state.regs.rbx = sym_val# Set to another register's valuestate.regs.rcx = state.regs.rax# Silent store (no inspect/actions)state.regs._rdx = 0x2000
# Store by namestate.registers.store('rax', 0x1000)# Store symbolic valuestate.registers.store('rbx', state.solver.BVS('input', 64))# Store by offsetrax_offset = state.arch.registers['rax'][0]state.registers.store(rax_offset, 0x2000, size=8)
# x86/AMD64 - individual flag access depends on architectureeflags = state.regs.eflags# Check specific flags (requires manual bit manipulation)zf_mask = 1 << 6 # Zero flag is bit 6zf = (state.regs.eflags & zf_mask) != 0# Set a flagstate.regs.eflags = state.regs.eflags | zf_mask
# Get register offset and sizeoffset, size = state.arch.registers['rax']# Get register by offsetfor name, (offset, size) in state.arch.registers.items(): if offset == 0: print(f"Register at offset 0: {name}")
# Save all registerssaved_regs = {}for reg_name in state.arch.register_names: saved_regs[reg_name] = state.registers.load(reg_name)# Restore all registersfor reg_name, value in saved_regs.items(): state.registers.store(reg_name, value)
# Set up a function call following x86-64 calling conventionstate.regs.rdi = 0x1000 # First argumentstate.regs.rsi = 0x2000 # Second argumentstate.regs.rdx = 0x3000 # Third argumentstate.regs.rcx = 0x4000 # Fourth argument# Set return addressreturn_addr = 0x400500state.regs.rsp = state.regs.rsp - 8state.memory.store(state.regs.rsp, return_addr, 8)# Jump to functionstate.regs.rip = 0x401000
# Simulate conditional jump based on zero flageflags = state.regs.eflagszf_mask = 1 << 6# Check if zero flag is setzero_set = (eflags & zf_mask) != 0# Branch on zero flagif state.solver.is_true(zero_set): state.regs.rip = 0x401000 # Jump takenelse: state.regs.rip = 0x401010 # Fall through