struct
Cradare2::Model::Registers
- Cradare2::Model::Registers
- Struct
- Value
- Object
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
- JSON::Serializable
Defined in:
cradare2/models/register.crConstructors
- .new(pull : JSON::PullParser)
-
.new(registers : Hash(String, UInt64) = Hash(String, UInt64).new)
For direct instantiation in tests/mocks
- .new(*, __pull_for_json_serializable pull : JSON::PullParser)
Instance Method Summary
-
#[](name : String) : UInt64
Fetches any register by name (case-insensitive)
-
#[]?(name : String) : UInt64 | Nil
Safe lookup returning nil if register is absent
- #a0 : UInt64
- #a1 : UInt64
- #a2 : UInt64
- #a3 : UInt64
-
#all_registers : Hash(String, UInt64)
Returns all captured registers
- #at : UInt64
-
#bp : UInt64
Architecture-neutral Frame/Base Pointer (RBP on x64, EBP on x86, FP on ARM)
-
#carry_flag? : Bool
Carry Flag (CF, bit 0)
- #cf? : Bool
-
#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.
- #eax : UInt64
- #ebp : UInt64
- #ebx : UInt64
- #ecx : UInt64
- #edi : UInt64
- #edx : UInt64
-
#eflags : UInt64
Flags
-
#eip : UInt64
x86 (32-bit) registers
- #esi : UInt64
- #esp : UInt64
- #gp : UInt64
- #hi : UInt64
- #if? : Bool
-
#interrupt_flag? : Bool
Interrupt Flag (IF, bit 9)
- #lo : UInt64
-
#lr : UInt64
ARM registers
- #of? : Bool
-
#overflow_flag? : Bool
Overflow Flag (OF, bit 11)
-
#parity_flag? : Bool
Parity Flag (PF, bit 2)
-
#pc : UInt64
Architecture-neutral Instruction Pointer (RIP on x64, EIP on x86, PC on ARM)
- #pf? : Bool
- #r0 : UInt64
- #r1 : UInt64
- #r10 : UInt64
- #r11 : UInt64
- #r12 : UInt64
- #r13 : UInt64
- #r14 : UInt64
- #r15 : UInt64
- #r2 : UInt64
- #r3 : UInt64
- #r4 : UInt64
- #r5 : UInt64
- #r6 : UInt64
- #r7 : UInt64
- #r8 : UInt64
- #r9 : UInt64
- #ra : UInt64
- #rax : UInt64
- #rbp : UInt64
- #rbx : UInt64
- #rcx : UInt64
- #rdi : UInt64
- #rdx : UInt64
-
#rip : UInt64
x86_64 registers with 32-bit and ARM fallbacks
- #rsi : UInt64
- #rsp : UInt64
- #s0 : UInt64
- #s1 : UInt64
- #s2 : UInt64
- #s3 : UInt64
- #s4 : UInt64
- #s5 : UInt64
- #s6 : UInt64
- #s7 : UInt64
- #sf? : Bool
-
#sign_flag? : Bool
Sign Flag (SF, bit 7)
-
#sp : UInt64
Architecture-neutral Stack Pointer (RSP on x64, ESP on x86, SP on ARM)
- #t0 : UInt64
- #t1 : UInt64
- #t2 : UInt64
- #t3 : UInt64
- #t4 : UInt64
- #t5 : UInt64
- #t6 : UInt64
- #t7 : UInt64
- #t8 : UInt64
- #t9 : UInt64
- #v0 : UInt64
- #v1 : UInt64
-
#values : Hash(String, UInt64)
Captures all key-value registers from the JSON payload
-
#zero : UInt64
MIPS / PS2 Emotion Engine (R5900) and IOP (R3000A) registers
-
#zero_flag? : Bool
Zero Flag (ZF, bit 6)
- #zf? : Bool
Constructor Detail
For direct instantiation in tests/mocks
Instance Method Detail
Compares this register snapshot against a baseline, returning a mapping of register_name => {old_value, new_value} for only registers whose values changed.