Skip to content

Operands

operands

Classes:

  • AccessType

    Enumeration of operand access types.

  • 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).

  • RegisterOperand

    Operand representing a processor register (o_reg).

AccessType

Bases: Enum

Enumeration of operand access types.

Attributes:

NONE class-attribute instance-attribute

NONE = 'none'

READ class-attribute instance-attribute

READ = 'read'

READ_WRITE class-attribute instance-attribute

READ_WRITE = 'read_write'

WRITE class-attribute instance-attribute

WRITE = 'write'

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_info

    Get structured information about the operand.

  • get_name

    Get the symbolic name for address operands.

  • 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 property

data_type: OperandDataType

Get the operand data 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.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_info

get_info() -> OperandInfo

Get structured information about the operand.

get_name

get_name() -> Optional[str]

Get the symbolic name for address operands.

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:

Attributes:

data_type property

data_type: OperandDataType

Get the operand data 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.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> AccessType

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_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_info

get_info() -> OperandInfo

Get structured information about the operand.

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.

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_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_info

    Get structured information about the operand.

  • 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 property

data_type: OperandDataType

Get the operand data 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.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_info

get_info() -> OperandInfo

Get structured information about the operand.

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 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

Factory for creating appropriate operand instances.

Methods:

  • create

    Create an operand instance based on the operand type.

create staticmethod

create(
    database: Database, operand: op_t, instruction_ea: int
) -> Optional[Operand]

Create an operand instance based on the operand type.

OperandInfo dataclass

OperandInfo(
    number: int,
    type: OperandType,
    data_type: OperandDataType,
    access_type: AccessType,
    size_bytes: int,
    size_bits: int,
    flags: int,
    is_hidden: bool,
    is_floating_point: bool,
)

Basic information about an operand.

Attributes:

access_type instance-attribute

access_type: AccessType

data_type instance-attribute

data_type: OperandDataType

flags instance-attribute

flags: int

is_floating_point instance-attribute

is_floating_point: bool

is_hidden instance-attribute

is_hidden: bool

number instance-attribute

number: int

size_bits instance-attribute

size_bits: int

size_bytes instance-attribute

size_bytes: int

type instance-attribute

OperandType

Bases: IntEnum

Enumeration of operand types for easier identification.

Attributes:

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_info

    Get structured information about the operand.

  • get_spec_type

    Get the processor-specific type number (0-5).

  • 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 property

data_type: OperandDataType

Get the operand data 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.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_info

get_info() -> OperandInfo

Get structured information about the operand.

get_spec_type

get_spec_type() -> int

Get the processor-specific type number (0-5).

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.

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_info

    Get structured information about the operand.

  • get_register_name

    Get the name of this register using the operand's size.

  • 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 property

data_type: OperandDataType

Get the operand data 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.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_info

get_info() -> OperandInfo

Get structured information about the operand.

get_register_name

get_register_name() -> str

Get the name of this register using the operand's size.

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.