struct Cradare2::Model::Registers

Overview

Represents CPU registers returned by radare2 drj. Provides architecture-agnostic helpers for instruction pointer and stack pointer, as well as named accessors for x86/x64/ARM registers.

Included Modules

Defined in:

cradare2/models/register.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]
def self.new(registers : Hash(String, UInt64) = Hash(String, UInt64).new) #

For direct instantiation in tests/mocks


[View source]
def self.new(*, __pull_for_json_serializable pull : JSON::PullParser) #

[View source]

Instance Method Detail

def [](name : String) : UInt64 #

Fetches any register by name (case-insensitive)


[View source]
def []?(name : String) : UInt64 | Nil #

Safe lookup returning nil if register is absent


[View source]
def a0 : UInt64 #

[View source]
def a1 : UInt64 #

[View source]
def a2 : UInt64 #

[View source]
def a3 : UInt64 #

[View source]
def all_registers : Hash(String, UInt64) #

Returns all captured registers


[View source]
def at : UInt64 #

[View source]
def bp : UInt64 #

Architecture-neutral Frame/Base Pointer (RBP on x64, EBP on x86, FP on ARM)


[View source]
def carry_flag? : Bool #

Carry Flag (CF, bit 0)


[View source]
def cf? : Bool #

[View source]
def diff(baseline : Registers) : Hash(String, Tuple(UInt64, UInt64)) #

Compares this register snapshot against a baseline, returning a mapping of register_name => {old_value, new_value} for only registers whose values changed.


[View source]
def eax : UInt64 #

[View source]
def ebp : UInt64 #

[View source]
def ebx : UInt64 #

[View source]
def ecx : UInt64 #

[View source]
def edi : UInt64 #

[View source]
def edx : UInt64 #

[View source]
def eflags : UInt64 #

Flags


[View source]
def eip : UInt64 #

x86 (32-bit) registers


[View source]
def esi : UInt64 #

[View source]
def esp : UInt64 #

[View source]
def gp : UInt64 #

[View source]
def hi : UInt64 #

[View source]
def if? : Bool #

[View source]
def interrupt_flag? : Bool #

Interrupt Flag (IF, bit 9)


[View source]
def lo : UInt64 #

[View source]
def lr : UInt64 #

ARM registers


[View source]
def of? : Bool #

[View source]
def overflow_flag? : Bool #

Overflow Flag (OF, bit 11)


[View source]
def parity_flag? : Bool #

Parity Flag (PF, bit 2)


[View source]
def pc : UInt64 #

Architecture-neutral Instruction Pointer (RIP on x64, EIP on x86, PC on ARM)


[View source]
def pf? : Bool #

[View source]
def r0 : UInt64 #

[View source]
def r1 : UInt64 #

[View source]
def r10 : UInt64 #

[View source]
def r11 : UInt64 #

[View source]
def r12 : UInt64 #

[View source]
def r13 : UInt64 #

[View source]
def r14 : UInt64 #

[View source]
def r15 : UInt64 #

[View source]
def r2 : UInt64 #

[View source]
def r3 : UInt64 #

[View source]
def r4 : UInt64 #

[View source]
def r5 : UInt64 #

[View source]
def r6 : UInt64 #

[View source]
def r7 : UInt64 #

[View source]
def r8 : UInt64 #

[View source]
def r9 : UInt64 #

[View source]
def ra : UInt64 #

[View source]
def rax : UInt64 #

[View source]
def rbp : UInt64 #

[View source]
def rbx : UInt64 #

[View source]
def rcx : UInt64 #

[View source]
def rdi : UInt64 #

[View source]
def rdx : UInt64 #

[View source]
def rip : UInt64 #

x86_64 registers with 32-bit and ARM fallbacks


[View source]
def rsi : UInt64 #

[View source]
def rsp : UInt64 #

[View source]
def s0 : UInt64 #

[View source]
def s1 : UInt64 #

[View source]
def s2 : UInt64 #

[View source]
def s3 : UInt64 #

[View source]
def s4 : UInt64 #

[View source]
def s5 : UInt64 #

[View source]
def s6 : UInt64 #

[View source]
def s7 : UInt64 #

[View source]
def sf? : Bool #

[View source]
def sign_flag? : Bool #

Sign Flag (SF, bit 7)


[View source]
def sp : UInt64 #

Architecture-neutral Stack Pointer (RSP on x64, ESP on x86, SP on ARM)


[View source]
def t0 : UInt64 #

[View source]
def t1 : UInt64 #

[View source]
def t2 : UInt64 #

[View source]
def t3 : UInt64 #

[View source]
def t4 : UInt64 #

[View source]
def t5 : UInt64 #

[View source]
def t6 : UInt64 #

[View source]
def t7 : UInt64 #

[View source]
def t8 : UInt64 #

[View source]
def t9 : UInt64 #

[View source]
def v0 : UInt64 #

[View source]
def v1 : UInt64 #

[View source]
def values : Hash(String, UInt64) #

Captures all key-value registers from the JSON payload


[View source]
def zero : UInt64 #

MIPS / PS2 Emotion Engine (R5900) and IOP (R3000A) registers


[View source]
def zero_flag? : Bool #

Zero Flag (ZF, bit 6)


[View source]
def zf? : Bool #

[View source]