Operands
operands
Classes:
-
AddressingInfo
–Information about memory operand addressing.
-
ImmediateInfo
–Information about an immediate operand.
-
ImmediateOperand
–Operand representing immediate values (o_imm, o_far, o_near).
-
MemoryOperand
–Operand representing memory access (o_mem, o_phrase, o_displ).
-
Operand
–Abstract base class for all operand types.
-
OperandDataType
–Enumeration of operand data types.
-
OperandFactory
–Factory for creating appropriate operand instances.
-
OperandInfo
–Basic information about an operand.
-
OperandType
–Enumeration of operand types for easier identification.
-
ProcessorSpecificOperand
–Operand representing processor-specific types (o_idpspec0-5).
-
RegisterInfo
–Information about a register operand.
-
RegisterOperand
–Operand representing a processor register (o_reg).
AddressingInfo
dataclass
AddressingInfo(
addressing_type: str,
formatted_string: Optional[str] = None,
address: Optional[ea_t] = None,
symbol_name: Optional[str] = None,
phrase_number: Optional[int] = None,
displacement: Optional[int] = None,
outer_displacement: Optional[int] = None,
has_outer_displacement: bool = False,
)
Information about memory operand addressing.
Methods:
-
has_displacement
–Check if this addressing mode has any displacement.
-
is_direct_memory
–Check if this is direct memory addressing.
-
is_register_based
–Check if this uses register-based addressing.
Attributes:
-
address
(Optional[ea_t]
) – -
addressing_type
(str
) – -
displacement
(Optional[int]
) – -
formatted_string
(Optional[str]
) – -
has_outer_displacement
(bool
) – -
outer_displacement
(Optional[int]
) – -
phrase_number
(Optional[int]
) – -
symbol_name
(Optional[str]
) –
address
class-attribute
instance-attribute
address: Optional[ea_t] = None
addressing_type
instance-attribute
addressing_type: str
displacement
class-attribute
instance-attribute
displacement: Optional[int] = None
formatted_string
class-attribute
instance-attribute
formatted_string: Optional[str] = None
has_outer_displacement
class-attribute
instance-attribute
has_outer_displacement: bool = False
outer_displacement
class-attribute
instance-attribute
outer_displacement: Optional[int] = None
phrase_number
class-attribute
instance-attribute
phrase_number: Optional[int] = None
symbol_name
class-attribute
instance-attribute
symbol_name: Optional[str] = None
has_displacement
has_displacement() -> bool
Check if this addressing mode has any displacement.
is_direct_memory
is_direct_memory() -> bool
Check if this is direct memory addressing.
is_register_based
is_register_based() -> bool
Check if this uses register-based addressing.
ImmediateInfo
dataclass
ImmediateInfo(
value: int,
hex_value: str,
is_address: bool,
symbol_name: Optional[str] = None,
signed_32bit: Optional[int] = None,
)
Information about an immediate operand.
Attributes:
-
hex_value
(str
) – -
is_address
(bool
) – -
signed_32bit
(Optional[int]
) – -
symbol_name
(Optional[str]
) – -
value
(int
) –
hex_value
instance-attribute
hex_value: str
is_address
instance-attribute
is_address: bool
signed_32bit
class-attribute
instance-attribute
signed_32bit: Optional[int] = None
symbol_name
class-attribute
instance-attribute
symbol_name: Optional[str] = None
value
instance-attribute
value: int
ImmediateOperand
ImmediateOperand(
database: 'Database',
operand: op_t,
instruction_ea: ea_t,
)
Bases: Operand
Operand representing immediate values (o_imm, o_far, o_near).
Methods:
-
get_access_type
–Get a string description of how this operand is accessed.
-
get_data_type_name
–Get a human-readable name for the operand data type.
-
get_hex_value
–Get hex representation of the value.
-
get_immediate_info
–Get detailed immediate information.
-
get_info
– -
get_name
–Get the symbolic name for address operands.
-
get_register_info
–Get detailed register information.
-
get_signed_32bit
–Get signed 32-bit interpretation for large values.
-
get_type_name
– -
get_value
–Get the immediate value or address.
-
has_outer_displacement
–Check if this operand has an outer displacement.
-
is_address
–Check if this is an address operand (far/near).
-
is_floating_point
–Check if this is a floating point operand.
-
is_read
–Check if this operand is read (used) by the instruction.
-
is_write
–Check if this operand is written (modified) by the instruction.
Attributes:
-
data_type
(OperandDataType
) –Get the operand data type as an enum.
-
flags
(int
) –Get the operand flags.
-
is_shown
(bool
) –Check if the operand should be displayed.
-
m_database
– -
number
(int
) –Get the operand number (0, 1, 2, etc.).
-
raw_operand
(op_t
) –Get the underlying op_t object.
-
size_bits
(int
) –Get the size of the operand in bits.
-
size_bytes
(int
) –Get the size of the operand in bytes.
-
type
(OperandType
) –Get the operand type as an enum.
flags
property
flags: int
Get the operand flags.
is_shown
property
is_shown: bool
Check if the operand should be displayed.
m_database
instance-attribute
m_database = database
number
property
number: int
Get the operand number (0, 1, 2, etc.).
raw_operand
property
raw_operand: op_t
Get the underlying op_t object.
size_bits
property
size_bits: int
Get the size of the operand in bits.
size_bytes
property
size_bytes: int
Get the size of the operand in bytes.
get_access_type
get_access_type() -> str
Get a string description of how this operand is accessed.
get_data_type_name
get_data_type_name() -> str
Get a human-readable name for the operand data type.
get_hex_value
get_hex_value() -> str
Get hex representation of the value.
get_name
get_name() -> Optional[str]
Get the symbolic name for address operands.
get_signed_32bit
get_signed_32bit() -> Optional[int]
Get signed 32-bit interpretation for large values.
get_type_name
get_type_name() -> str
get_value
get_value() -> int
Get the immediate value or address.
has_outer_displacement
has_outer_displacement() -> bool
Check if this operand has an outer displacement.
Returns True if the OF_OUTER_DISP flag is set.
is_address
is_address() -> bool
Check if this is an address operand (far/near).
is_floating_point
is_floating_point() -> bool
Check if this is a floating point operand.
is_read
is_read() -> bool
Check if this operand is read (used) by the instruction.
is_write
is_write() -> bool
Check if this operand is written (modified) by the instruction.
MemoryOperand
MemoryOperand(
database: 'Database',
operand: op_t,
instruction_ea: ea_t,
)
Bases: Operand
Operand representing memory access (o_mem, o_phrase, o_displ).
Methods:
-
get_access_type
–Get a string description of how this operand is accessed.
-
get_address
–Get the address for direct memory operands.
-
get_addressing_info
–Get detailed addressing information.
-
get_base_register
–Get the base register name (e.g., 'rsi', 'rbp').
-
get_data_type_name
–Get a human-readable name for the operand data type.
-
get_displacement
–Get the base displacement value.
-
get_formatted_string
–Get the formatted operand string from IDA.
-
get_index_register
–Get the index register name (e.g., 'rdi', 'rcx').
-
get_info
– -
get_name
–Get the symbolic name for direct memory operands.
-
get_outer_displacement
–Get the outer displacement value for complex addressing modes.
-
get_phrase_number
–Get the phrase number for register-based operands.
-
get_register_info
–Get detailed register information.
-
get_scale
–Get the scale factor (1, 2, 4, or 8).
-
get_sib_components
–Get SIB components: (base_register, index_register, scale, displacement).
-
get_sib_displacement
–Get the displacement value from SIB addressing.
-
get_type_name
– -
get_value
–Get the primary value based on memory type.
-
has_outer_displacement
–Check if this operand has an outer displacement.
-
is_direct_memory
–Check if this is direct memory access.
-
is_floating_point
–Check if this is a floating point operand.
-
is_read
–Check if this operand is read (used) by the instruction.
-
is_register_based
–Check if this uses register-based addressing.
-
is_write
–Check if this operand is written (modified) by the instruction.
Attributes:
-
data_type
(OperandDataType
) –Get the operand data type as an enum.
-
flags
(int
) –Get the operand flags.
-
is_shown
(bool
) –Check if the operand should be displayed.
-
m_database
– -
number
(int
) –Get the operand number (0, 1, 2, etc.).
-
raw_operand
(op_t
) –Get the underlying op_t object.
-
size_bits
(int
) –Get the size of the operand in bits.
-
size_bytes
(int
) –Get the size of the operand in bytes.
-
type
(OperandType
) –Get the operand type as an enum.
flags
property
flags: int
Get the operand flags.
is_shown
property
is_shown: bool
Check if the operand should be displayed.
m_database
instance-attribute
m_database = database
number
property
number: int
Get the operand number (0, 1, 2, etc.).
raw_operand
property
raw_operand: op_t
Get the underlying op_t object.
size_bits
property
size_bits: int
Get the size of the operand in bits.
size_bytes
property
size_bytes: int
Get the size of the operand in bytes.
get_access_type
get_access_type() -> str
Get a string description of how this operand is accessed.
get_address
get_address() -> Optional[ea_t]
Get the address for direct memory operands.
get_base_register
get_base_register() -> Optional[str]
Get the base register name (e.g., 'rsi', 'rbp').
get_data_type_name
get_data_type_name() -> str
Get a human-readable name for the operand data type.
get_displacement
get_displacement() -> Optional[int]
Get the base displacement value.
This is the primary displacement used in addressing modes like [reg + disp]. Stored in op_t.addr field.
get_formatted_string
get_formatted_string() -> Optional[str]
Get the formatted operand string from IDA.
get_index_register
get_index_register() -> Optional[str]
Get the index register name (e.g., 'rdi', 'rcx').
get_name
get_name() -> Optional[str]
Get the symbolic name for direct memory operands.
get_outer_displacement
get_outer_displacement() -> Optional[int]
Get the outer displacement value for complex addressing modes.
Used in processors like 68k for nested addressing: ([reg + disp1], disp2) where disp1 is base displacement and disp2 is outer displacement. Only present when OF_OUTER_DISP flag is set. Stored in op_t.value field.
get_phrase_number
get_phrase_number() -> Optional[int]
Get the phrase number for register-based operands.
get_scale
get_scale() -> Optional[int]
Get the scale factor (1, 2, 4, or 8).
get_sib_components
get_sib_components() -> tuple[
Optional[str],
Optional[str],
Optional[int],
Optional[int],
]
Get SIB components: (base_register, index_register, scale, displacement).
Returns: tuple: (base_reg, index_reg, scale, displacement) or (None, None, None, None) if fails
get_sib_displacement
get_sib_displacement() -> Optional[int]
Get the displacement value from SIB addressing.
get_type_name
get_type_name() -> str
get_value
get_value() -> Any
Get the primary value based on memory type.
has_outer_displacement
has_outer_displacement() -> bool
Check if this operand has an outer displacement.
Returns True if the OF_OUTER_DISP flag is set.
is_direct_memory
is_direct_memory() -> bool
Check if this is direct memory access.
is_floating_point
is_floating_point() -> bool
Check if this is a floating point operand.
is_read
is_read() -> bool
Check if this operand is read (used) by the instruction.
is_register_based
is_register_based() -> bool
Check if this uses register-based addressing.
is_write
is_write() -> bool
Check if this operand is written (modified) by the instruction.
Operand
Operand(
database: 'Database',
operand: op_t,
instruction_ea: ea_t,
)
Bases: ABC
Abstract base class for all operand types.
Methods:
-
get_access_type
–Get a string description of how this operand is accessed.
-
get_data_type_name
–Get a human-readable name for the operand data type.
-
get_info
–Get structured information about the operand.
-
get_register_info
–Get detailed register information.
-
get_type_name
–Get a human-readable name for the operand type.
-
get_value
–Get the primary value of the operand.
-
is_floating_point
–Check if this is a floating point operand.
-
is_read
–Check if this operand is read (used) by the instruction.
-
is_write
–Check if this operand is written (modified) by the instruction.
Attributes:
-
data_type
(OperandDataType
) –Get the operand data type as an enum.
-
flags
(int
) –Get the operand flags.
-
is_shown
(bool
) –Check if the operand should be displayed.
-
m_database
– -
number
(int
) –Get the operand number (0, 1, 2, etc.).
-
raw_operand
(op_t
) –Get the underlying op_t object.
-
size_bits
(int
) –Get the size of the operand in bits.
-
size_bytes
(int
) –Get the size of the operand in bytes.
-
type
(OperandType
) –Get the operand type as an enum.
flags
property
flags: int
Get the operand flags.
is_shown
property
is_shown: bool
Check if the operand should be displayed.
m_database
instance-attribute
m_database = database
number
property
number: int
Get the operand number (0, 1, 2, etc.).
raw_operand
property
raw_operand: op_t
Get the underlying op_t object.
size_bits
property
size_bits: int
Get the size of the operand in bits.
size_bytes
property
size_bytes: int
Get the size of the operand in bytes.
get_access_type
get_access_type() -> str
Get a string description of how this operand is accessed.
get_data_type_name
get_data_type_name() -> str
Get a human-readable name for the operand data type.
get_type_name
abstractmethod
get_type_name() -> str
Get a human-readable name for the operand type.
get_value
abstractmethod
get_value() -> Any
Get the primary value of the operand.
is_floating_point
is_floating_point() -> bool
Check if this is a floating point operand.
is_read
is_read() -> bool
Check if this operand is read (used) by the instruction.
is_write
is_write() -> bool
Check if this operand is written (modified) by the instruction.
OperandDataType
Bases: IntEnum
Enumeration of operand data types.
Attributes:
-
BITFIELD
– -
BYTE
– -
BYTE16
– -
BYTE32
– -
BYTE64
– -
CODE
– -
DOUBLE
– -
DWORD
– -
FLOAT
– -
FWORD
– -
HALF
– -
LDBL
– -
PACKREAL
– -
QWORD
– -
STRING
– -
TBYTE
– -
UNICODE
– -
VOID
– -
WORD
–
BITFIELD
class-attribute
instance-attribute
BITFIELD = dt_bitfild
BYTE
class-attribute
instance-attribute
BYTE = dt_byte
BYTE16
class-attribute
instance-attribute
BYTE16 = dt_byte16
BYTE32
class-attribute
instance-attribute
BYTE32 = dt_byte32
BYTE64
class-attribute
instance-attribute
BYTE64 = dt_byte64
CODE
class-attribute
instance-attribute
CODE = dt_code
DOUBLE
class-attribute
instance-attribute
DOUBLE = dt_double
DWORD
class-attribute
instance-attribute
DWORD = dt_dword
FLOAT
class-attribute
instance-attribute
FLOAT = dt_float
FWORD
class-attribute
instance-attribute
FWORD = dt_fword
HALF
class-attribute
instance-attribute
HALF = dt_half
LDBL
class-attribute
instance-attribute
LDBL = dt_ldbl
PACKREAL
class-attribute
instance-attribute
PACKREAL = dt_packreal
QWORD
class-attribute
instance-attribute
QWORD = dt_qword
STRING
class-attribute
instance-attribute
STRING = dt_string
TBYTE
class-attribute
instance-attribute
TBYTE = dt_tbyte
UNICODE
class-attribute
instance-attribute
UNICODE = dt_unicode
VOID
class-attribute
instance-attribute
VOID = dt_void
WORD
class-attribute
instance-attribute
WORD = dt_word
OperandFactory
OperandInfo
dataclass
OperandInfo(
number: int,
type_name: str,
data_type_name: str,
size_bytes: int,
size_bits: Optional[int] = None,
flags: Optional[str] = None,
is_hidden: bool = False,
special_value: Optional[str] = None,
is_floating_point: bool = False,
is_read: bool = False,
is_write: bool = False,
access_type: Optional[str] = None,
)
Basic information about an operand.
Attributes:
-
access_type
(Optional[str]
) – -
data_type_name
(str
) – -
flags
(Optional[str]
) – -
is_floating_point
(bool
) – -
is_hidden
(bool
) – -
is_read
(bool
) – -
is_write
(bool
) – -
number
(int
) – -
size_bits
(Optional[int]
) – -
size_bytes
(int
) – -
special_value
(Optional[str]
) – -
type_name
(str
) –
access_type
class-attribute
instance-attribute
access_type: Optional[str] = None
data_type_name
instance-attribute
data_type_name: str
flags
class-attribute
instance-attribute
flags: Optional[str] = None
is_floating_point
class-attribute
instance-attribute
is_floating_point: bool = False
is_hidden
class-attribute
instance-attribute
is_hidden: bool = False
is_read
class-attribute
instance-attribute
is_read: bool = False
is_write
class-attribute
instance-attribute
is_write: bool = False
number
instance-attribute
number: int
size_bits
class-attribute
instance-attribute
size_bits: Optional[int] = None
size_bytes
instance-attribute
size_bytes: int
special_value
class-attribute
instance-attribute
special_value: Optional[str] = None
type_name
instance-attribute
type_name: str
OperandType
Bases: IntEnum
Enumeration of operand types for easier identification.
Attributes:
-
DISPLACEMENT
– -
FAR_ADDRESS
– -
IMMEDIATE
– -
MEMORY
– -
NEAR_ADDRESS
– -
PHRASE
– -
PROCESSOR_SPECIFIC_0
– -
PROCESSOR_SPECIFIC_1
– -
PROCESSOR_SPECIFIC_2
– -
PROCESSOR_SPECIFIC_3
– -
PROCESSOR_SPECIFIC_4
– -
PROCESSOR_SPECIFIC_5
– -
REGISTER
– -
VOID
–
DISPLACEMENT
class-attribute
instance-attribute
DISPLACEMENT = o_displ
FAR_ADDRESS
class-attribute
instance-attribute
FAR_ADDRESS = o_far
IMMEDIATE
class-attribute
instance-attribute
IMMEDIATE = o_imm
MEMORY
class-attribute
instance-attribute
MEMORY = o_mem
NEAR_ADDRESS
class-attribute
instance-attribute
NEAR_ADDRESS = o_near
PHRASE
class-attribute
instance-attribute
PHRASE = o_phrase
PROCESSOR_SPECIFIC_0
class-attribute
instance-attribute
PROCESSOR_SPECIFIC_0 = o_idpspec0
PROCESSOR_SPECIFIC_1
class-attribute
instance-attribute
PROCESSOR_SPECIFIC_1 = o_idpspec1
PROCESSOR_SPECIFIC_2
class-attribute
instance-attribute
PROCESSOR_SPECIFIC_2 = o_idpspec2
PROCESSOR_SPECIFIC_3
class-attribute
instance-attribute
PROCESSOR_SPECIFIC_3 = o_idpspec3
PROCESSOR_SPECIFIC_4
class-attribute
instance-attribute
PROCESSOR_SPECIFIC_4 = o_idpspec4
PROCESSOR_SPECIFIC_5
class-attribute
instance-attribute
PROCESSOR_SPECIFIC_5 = o_idpspec5
REGISTER
class-attribute
instance-attribute
REGISTER = o_reg
VOID
class-attribute
instance-attribute
VOID = o_void
ProcessorSpecificOperand
ProcessorSpecificOperand(
database: 'Database', operand: op_t, instruction_ea: int
)
Bases: Operand
Operand representing processor-specific types (o_idpspec0-5).
Methods:
-
get_access_type
–Get a string description of how this operand is accessed.
-
get_data_type_name
–Get a human-readable name for the operand data type.
-
get_info
– -
get_register_info
–Get detailed register information.
-
get_spec_type
–Get the processor-specific type number (0-5).
-
get_type_name
– -
get_value
–Return raw value for processor-specific operands.
-
is_floating_point
–Check if this is a floating point operand.
-
is_read
–Check if this operand is read (used) by the instruction.
-
is_write
–Check if this operand is written (modified) by the instruction.
Attributes:
-
data_type
(OperandDataType
) –Get the operand data type as an enum.
-
flags
(int
) –Get the operand flags.
-
is_shown
(bool
) –Check if the operand should be displayed.
-
m_database
– -
number
(int
) –Get the operand number (0, 1, 2, etc.).
-
raw_operand
(op_t
) –Get the underlying op_t object.
-
size_bits
(int
) –Get the size of the operand in bits.
-
size_bytes
(int
) –Get the size of the operand in bytes.
-
type
(OperandType
) –Get the operand type as an enum.
flags
property
flags: int
Get the operand flags.
is_shown
property
is_shown: bool
Check if the operand should be displayed.
m_database
instance-attribute
m_database = database
number
property
number: int
Get the operand number (0, 1, 2, etc.).
raw_operand
property
raw_operand: op_t
Get the underlying op_t object.
size_bits
property
size_bits: int
Get the size of the operand in bits.
size_bytes
property
size_bytes: int
Get the size of the operand in bytes.
get_access_type
get_access_type() -> str
Get a string description of how this operand is accessed.
get_data_type_name
get_data_type_name() -> str
Get a human-readable name for the operand data type.
get_spec_type
get_spec_type() -> int
Get the processor-specific type number (0-5).
get_type_name
get_type_name() -> str
get_value
get_value() -> Any
Return raw value for processor-specific operands.
is_floating_point
is_floating_point() -> bool
Check if this is a floating point operand.
is_read
is_read() -> bool
Check if this operand is read (used) by the instruction.
is_write
is_write() -> bool
Check if this operand is written (modified) by the instruction.
RegisterInfo
dataclass
RegisterInfo(register_number: int, register_name: str)
Information about a register operand.
Attributes:
-
register_name
(str
) – -
register_number
(int
) –
register_name
instance-attribute
register_name: str
register_number
instance-attribute
register_number: int
RegisterOperand
RegisterOperand(
database: 'Database',
operand: op_t,
instruction_ea: ea_t,
)
Bases: Operand
Operand representing a processor register (o_reg).
Methods:
-
get_access_type
–Get a string description of how this operand is accessed.
-
get_data_type_name
–Get a human-readable name for the operand data type.
-
get_info
– -
get_register_info
–Get detailed register information.
-
get_register_name
–Get the name of this register using the operand's size.
-
get_type_name
– -
get_value
– -
is_floating_point
–Check if this is a floating point operand.
-
is_read
–Check if this operand is read (used) by the instruction.
-
is_write
–Check if this operand is written (modified) by the instruction.
Attributes:
-
data_type
(OperandDataType
) –Get the operand data type as an enum.
-
flags
(int
) –Get the operand flags.
-
is_shown
(bool
) –Check if the operand should be displayed.
-
m_database
– -
number
(int
) –Get the operand number (0, 1, 2, etc.).
-
raw_operand
(op_t
) –Get the underlying op_t object.
-
register_number
(int
) –Get the register number.
-
size_bits
(int
) –Get the size of the operand in bits.
-
size_bytes
(int
) –Get the size of the operand in bytes.
-
type
(OperandType
) –Get the operand type as an enum.
flags
property
flags: int
Get the operand flags.
is_shown
property
is_shown: bool
Check if the operand should be displayed.
m_database
instance-attribute
m_database = database
number
property
number: int
Get the operand number (0, 1, 2, etc.).
raw_operand
property
raw_operand: op_t
Get the underlying op_t object.
register_number
property
register_number: int
Get the register number.
size_bits
property
size_bits: int
Get the size of the operand in bits.
size_bytes
property
size_bytes: int
Get the size of the operand in bytes.
get_access_type
get_access_type() -> str
Get a string description of how this operand is accessed.
get_data_type_name
get_data_type_name() -> str
Get a human-readable name for the operand data type.
get_register_name
get_register_name() -> str
Get the name of this register using the operand's size.
get_type_name
get_type_name() -> str
get_value
get_value() -> int
is_floating_point
is_floating_point() -> bool
Check if this is a floating point operand.
is_read
is_read() -> bool
Check if this operand is read (used) by the instruction.
is_write
is_write() -> bool
Check if this operand is written (modified) by the instruction.