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.

  • OperandFormat

    Enumeration of operand display representations.

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

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.

display_as

display_as(format: OperandFormat, base: int = 0) -> bool

Render this operand using the given format.

Parameters:

  • format (OperandFormat) –

    The representation to apply.

  • base (int, default: 0 ) –

    Base address, only used for OperandFormat.OFFSET.

Returns:

  • bool

    True if the representation was applied, False otherwise.

Raises:

  • InvalidParameterError

    If the format is unknown.

display_based_struct_offset

display_based_struct_offset(base: ea_t) -> bool

Render this operand as a structure member offset based at base.

Parameters:

  • base (ea_t) –

    Address of a structure instance laid out in the database; its type supplies the member layout.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_binary

display_binary() -> bool

Render this operand in binary.

display_char

display_char() -> bool

Render this operand as a character literal.

display_decimal

display_decimal() -> bool

Render this operand in decimal.

display_float

display_float() -> bool

Render this operand as a floating point number.

display_hex

display_hex() -> bool

Render this operand in hexadecimal.

display_octal

display_octal() -> bool

Render this operand in octal.

display_offset

display_offset(base: int = 0) -> bool

Render this operand as an offset from base.

Parameters:

  • base (int, default: 0 ) –

    Base address the offset is relative to.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_reset

display_reset() -> bool

Reset this operand to its default rendering.

display_stack_var

display_stack_var() -> bool

Link this operand to a stack variable.

display_struct_offset

display_struct_offset(
    path: int | list[int], delta: int = 0
) -> bool

Render this operand as a structure member offset.

Parameters:

  • path (int | list[int]) –

    A structure type id. Pass a list of ids to select particular union members in the chain; nested structs are resolved automatically.

  • delta (int, default: 0 ) –

    Additional offset to be applied to the member after path resolution.

Returns:

  • bool

    True if the representation was applied, False otherwise.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_forced_text

get_forced_text() -> Optional[str]

Get the display-text override, or None if there is none.

Returns:

  • Optional[str]

    The override text, or None if the operand has no override.

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.

set_forced_text

set_forced_text(text: str) -> bool

Override the display text of this operand.

Parameters:

  • text (str) –

    The text to display; an empty string removes the override.

Returns:

  • bool

    True if the override was applied, False otherwise.

struct_offset_field_names

struct_offset_field_names() -> list[str]

Read the struct-offset path as the field names.

For an operand rendered as OuterStruct.nested.inner_field2 this returns ['OuterStruct', 'nested', 'inner_field2']. Use struct_offset_path_names to get the type name path.

Returns:

  • list[str]

    The member chain, or an empty list if the operand is not represented as

  • list[str]

    a structure offset.

struct_offset_path

struct_offset_path() -> Optional[tuple[list[int], int]]

Read the structure offset path as type ids.

Returns:

  • Optional[tuple[list[int], int]]

    A tuple of (path of type ids, delta), or None if the operand is not

  • Optional[tuple[list[int], int]]

    represented as a structure offset. The path is the root structure type

  • Optional[tuple[list[int], int]]

    id, consecutive elements are ids of used union members (if any).

struct_offset_path_names

struct_offset_path_names() -> list[str]

Read the struct-offset path as type names.

The path holds the root structure plus any union members chosen along the chain (plain nested structs add no entries), so an operand rendered as OuterStruct.nested.inner_field2 yields just ['OuterStruct']. Use struct_offset_field_names to get the member chain.

Returns:

  • list[str]

    The path as a list of type names, or an empty list if the operand is

  • list[str]

    not represented as a structure offset. An unnamed type appears as its

  • list[str]

    hex tid.

toggle_negate

toggle_negate() -> bool

Toggle the bitwise-negation rendering of this operand.

toggle_sign

toggle_sign() -> bool

Flip the sign rendering of this operand.

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.

display_as

display_as(format: OperandFormat, base: int = 0) -> bool

Render this operand using the given format.

Parameters:

  • format (OperandFormat) –

    The representation to apply.

  • base (int, default: 0 ) –

    Base address, only used for OperandFormat.OFFSET.

Returns:

  • bool

    True if the representation was applied, False otherwise.

Raises:

  • InvalidParameterError

    If the format is unknown.

display_based_struct_offset

display_based_struct_offset(base: ea_t) -> bool

Render this operand as a structure member offset based at base.

Parameters:

  • base (ea_t) –

    Address of a structure instance laid out in the database; its type supplies the member layout.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_binary

display_binary() -> bool

Render this operand in binary.

display_char

display_char() -> bool

Render this operand as a character literal.

display_decimal

display_decimal() -> bool

Render this operand in decimal.

display_float

display_float() -> bool

Render this operand as a floating point number.

display_hex

display_hex() -> bool

Render this operand in hexadecimal.

display_octal

display_octal() -> bool

Render this operand in octal.

display_offset

display_offset(base: int = 0) -> bool

Render this operand as an offset from base.

Parameters:

  • base (int, default: 0 ) –

    Base address the offset is relative to.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_reset

display_reset() -> bool

Reset this operand to its default rendering.

display_stack_var

display_stack_var() -> bool

Link this operand to a stack variable.

display_struct_offset

display_struct_offset(
    path: int | list[int], delta: int = 0
) -> bool

Render this operand as a structure member offset.

Parameters:

  • path (int | list[int]) –

    A structure type id. Pass a list of ids to select particular union members in the chain; nested structs are resolved automatically.

  • delta (int, default: 0 ) –

    Additional offset to be applied to the member after path resolution.

Returns:

  • bool

    True if the representation was applied, False otherwise.

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_forced_text

get_forced_text() -> Optional[str]

Get the display-text override, or None if there is none.

Returns:

  • Optional[str]

    The override text, or None if the operand has no override.

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.

set_forced_text

set_forced_text(text: str) -> bool

Override the display text of this operand.

Parameters:

  • text (str) –

    The text to display; an empty string removes the override.

Returns:

  • bool

    True if the override was applied, False otherwise.

struct_offset_field_names

struct_offset_field_names() -> list[str]

Read the struct-offset path as the field names.

For an operand rendered as OuterStruct.nested.inner_field2 this returns ['OuterStruct', 'nested', 'inner_field2']. Use struct_offset_path_names to get the type name path.

Returns:

  • list[str]

    The member chain, or an empty list if the operand is not represented as

  • list[str]

    a structure offset.

struct_offset_path

struct_offset_path() -> Optional[tuple[list[int], int]]

Read the structure offset path as type ids.

Returns:

  • Optional[tuple[list[int], int]]

    A tuple of (path of type ids, delta), or None if the operand is not

  • Optional[tuple[list[int], int]]

    represented as a structure offset. The path is the root structure type

  • Optional[tuple[list[int], int]]

    id, consecutive elements are ids of used union members (if any).

struct_offset_path_names

struct_offset_path_names() -> list[str]

Read the struct-offset path as type names.

The path holds the root structure plus any union members chosen along the chain (plain nested structs add no entries), so an operand rendered as OuterStruct.nested.inner_field2 yields just ['OuterStruct']. Use struct_offset_field_names to get the member chain.

Returns:

  • list[str]

    The path as a list of type names, or an empty list if the operand is

  • list[str]

    not represented as a structure offset. An unnamed type appears as its

  • list[str]

    hex tid.

toggle_negate

toggle_negate() -> bool

Toggle the bitwise-negation rendering of this operand.

toggle_sign

toggle_sign() -> bool

Flip the sign rendering of this operand.

Operand

Operand(
    database: Database, operand: op_t, instruction_ea: ea_t
)

Bases: ABC

Abstract base class for all operand types.

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.

display_as

display_as(format: OperandFormat, base: int = 0) -> bool

Render this operand using the given format.

Parameters:

  • format (OperandFormat) –

    The representation to apply.

  • base (int, default: 0 ) –

    Base address, only used for OperandFormat.OFFSET.

Returns:

  • bool

    True if the representation was applied, False otherwise.

Raises:

  • InvalidParameterError

    If the format is unknown.

display_based_struct_offset

display_based_struct_offset(base: ea_t) -> bool

Render this operand as a structure member offset based at base.

Parameters:

  • base (ea_t) –

    Address of a structure instance laid out in the database; its type supplies the member layout.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_binary

display_binary() -> bool

Render this operand in binary.

display_char

display_char() -> bool

Render this operand as a character literal.

display_decimal

display_decimal() -> bool

Render this operand in decimal.

display_float

display_float() -> bool

Render this operand as a floating point number.

display_hex

display_hex() -> bool

Render this operand in hexadecimal.

display_octal

display_octal() -> bool

Render this operand in octal.

display_offset

display_offset(base: int = 0) -> bool

Render this operand as an offset from base.

Parameters:

  • base (int, default: 0 ) –

    Base address the offset is relative to.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_reset

display_reset() -> bool

Reset this operand to its default rendering.

display_stack_var

display_stack_var() -> bool

Link this operand to a stack variable.

display_struct_offset

display_struct_offset(
    path: int | list[int], delta: int = 0
) -> bool

Render this operand as a structure member offset.

Parameters:

  • path (int | list[int]) –

    A structure type id. Pass a list of ids to select particular union members in the chain; nested structs are resolved automatically.

  • delta (int, default: 0 ) –

    Additional offset to be applied to the member after path resolution.

Returns:

  • bool

    True if the representation was applied, False otherwise.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_forced_text

get_forced_text() -> Optional[str]

Get the display-text override, or None if there is none.

Returns:

  • Optional[str]

    The override text, or None if the operand has no override.

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.

set_forced_text

set_forced_text(text: str) -> bool

Override the display text of this operand.

Parameters:

  • text (str) –

    The text to display; an empty string removes the override.

Returns:

  • bool

    True if the override was applied, False otherwise.

struct_offset_field_names

struct_offset_field_names() -> list[str]

Read the struct-offset path as the field names.

For an operand rendered as OuterStruct.nested.inner_field2 this returns ['OuterStruct', 'nested', 'inner_field2']. Use struct_offset_path_names to get the type name path.

Returns:

  • list[str]

    The member chain, or an empty list if the operand is not represented as

  • list[str]

    a structure offset.

struct_offset_path

struct_offset_path() -> Optional[tuple[list[int], int]]

Read the structure offset path as type ids.

Returns:

  • Optional[tuple[list[int], int]]

    A tuple of (path of type ids, delta), or None if the operand is not

  • Optional[tuple[list[int], int]]

    represented as a structure offset. The path is the root structure type

  • Optional[tuple[list[int], int]]

    id, consecutive elements are ids of used union members (if any).

struct_offset_path_names

struct_offset_path_names() -> list[str]

Read the struct-offset path as type names.

The path holds the root structure plus any union members chosen along the chain (plain nested structs add no entries), so an operand rendered as OuterStruct.nested.inner_field2 yields just ['OuterStruct']. Use struct_offset_field_names to get the member chain.

Returns:

  • list[str]

    The path as a list of type names, or an empty list if the operand is

  • list[str]

    not represented as a structure offset. An unnamed type appears as its

  • list[str]

    hex tid.

toggle_negate

toggle_negate() -> bool

Toggle the bitwise-negation rendering of this operand.

toggle_sign

toggle_sign() -> bool

Flip the sign rendering of this operand.

OperandDataType

Bases: IntEnum

Enumeration of operand data types.

Attributes:

BITFIELD class-attribute instance-attribute

BITFIELD = ida_ua.dt_bitfild

BYTE class-attribute instance-attribute

BYTE = ida_ua.dt_byte

BYTE16 class-attribute instance-attribute

BYTE16 = ida_ua.dt_byte16

BYTE32 class-attribute instance-attribute

BYTE32 = ida_ua.dt_byte32

BYTE64 class-attribute instance-attribute

BYTE64 = ida_ua.dt_byte64

CODE class-attribute instance-attribute

CODE = ida_ua.dt_code

DOUBLE class-attribute instance-attribute

DOUBLE = ida_ua.dt_double

DWORD class-attribute instance-attribute

DWORD = ida_ua.dt_dword

FLOAT class-attribute instance-attribute

FLOAT = ida_ua.dt_float

FWORD class-attribute instance-attribute

FWORD = ida_ua.dt_fword

HALF class-attribute instance-attribute

HALF = ida_ua.dt_half

LDBL class-attribute instance-attribute

LDBL = ida_ua.dt_ldbl

PACKREAL class-attribute instance-attribute

PACKREAL = ida_ua.dt_packreal

QWORD class-attribute instance-attribute

QWORD = ida_ua.dt_qword

STRING class-attribute instance-attribute

STRING = ida_ua.dt_string

TBYTE class-attribute instance-attribute

TBYTE = ida_ua.dt_tbyte

UNICODE class-attribute instance-attribute

UNICODE = ida_ua.dt_unicode

VOID class-attribute instance-attribute

VOID = ida_ua.dt_void

WORD class-attribute instance-attribute

WORD = ida_ua.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.

OperandFormat

Bases: Enum

Enumeration of operand display representations.

Attributes:

BINARY class-attribute instance-attribute

BINARY = auto()

CHARACTER class-attribute instance-attribute

CHARACTER = auto()

DECIMAL class-attribute instance-attribute

DECIMAL = auto()

FLOAT class-attribute instance-attribute

FLOAT = auto()

HEX class-attribute instance-attribute

HEX = auto()

NUMBER class-attribute instance-attribute

NUMBER = auto()

OCTAL class-attribute instance-attribute

OCTAL = auto()

OFFSET class-attribute instance-attribute

OFFSET = auto()

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 = ida_ua.o_displ

FAR_ADDRESS class-attribute instance-attribute

FAR_ADDRESS = ida_ua.o_far

IMMEDIATE class-attribute instance-attribute

IMMEDIATE = ida_ua.o_imm

MEMORY class-attribute instance-attribute

MEMORY = ida_ua.o_mem

NEAR_ADDRESS class-attribute instance-attribute

NEAR_ADDRESS = ida_ua.o_near

PHRASE class-attribute instance-attribute

PHRASE = ida_ua.o_phrase

PROCESSOR_SPECIFIC_0 class-attribute instance-attribute

PROCESSOR_SPECIFIC_0 = ida_ua.o_idpspec0

PROCESSOR_SPECIFIC_1 class-attribute instance-attribute

PROCESSOR_SPECIFIC_1 = ida_ua.o_idpspec1

PROCESSOR_SPECIFIC_2 class-attribute instance-attribute

PROCESSOR_SPECIFIC_2 = ida_ua.o_idpspec2

PROCESSOR_SPECIFIC_3 class-attribute instance-attribute

PROCESSOR_SPECIFIC_3 = ida_ua.o_idpspec3

PROCESSOR_SPECIFIC_4 class-attribute instance-attribute

PROCESSOR_SPECIFIC_4 = ida_ua.o_idpspec4

PROCESSOR_SPECIFIC_5 class-attribute instance-attribute

PROCESSOR_SPECIFIC_5 = ida_ua.o_idpspec5

REGISTER class-attribute instance-attribute

REGISTER = ida_ua.o_reg

VOID class-attribute instance-attribute

VOID = ida_ua.o_void

ProcessorSpecificOperand

ProcessorSpecificOperand(
    database: Database, operand: op_t, instruction_ea: int
)

Bases: Operand

Operand representing processor-specific types (o_idpspec0-5).

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.

display_as

display_as(format: OperandFormat, base: int = 0) -> bool

Render this operand using the given format.

Parameters:

  • format (OperandFormat) –

    The representation to apply.

  • base (int, default: 0 ) –

    Base address, only used for OperandFormat.OFFSET.

Returns:

  • bool

    True if the representation was applied, False otherwise.

Raises:

  • InvalidParameterError

    If the format is unknown.

display_based_struct_offset

display_based_struct_offset(base: ea_t) -> bool

Render this operand as a structure member offset based at base.

Parameters:

  • base (ea_t) –

    Address of a structure instance laid out in the database; its type supplies the member layout.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_binary

display_binary() -> bool

Render this operand in binary.

display_char

display_char() -> bool

Render this operand as a character literal.

display_decimal

display_decimal() -> bool

Render this operand in decimal.

display_float

display_float() -> bool

Render this operand as a floating point number.

display_hex

display_hex() -> bool

Render this operand in hexadecimal.

display_octal

display_octal() -> bool

Render this operand in octal.

display_offset

display_offset(base: int = 0) -> bool

Render this operand as an offset from base.

Parameters:

  • base (int, default: 0 ) –

    Base address the offset is relative to.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_reset

display_reset() -> bool

Reset this operand to its default rendering.

display_stack_var

display_stack_var() -> bool

Link this operand to a stack variable.

display_struct_offset

display_struct_offset(
    path: int | list[int], delta: int = 0
) -> bool

Render this operand as a structure member offset.

Parameters:

  • path (int | list[int]) –

    A structure type id. Pass a list of ids to select particular union members in the chain; nested structs are resolved automatically.

  • delta (int, default: 0 ) –

    Additional offset to be applied to the member after path resolution.

Returns:

  • bool

    True if the representation was applied, False otherwise.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_forced_text

get_forced_text() -> Optional[str]

Get the display-text override, or None if there is none.

Returns:

  • Optional[str]

    The override text, or None if the operand has no override.

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.

set_forced_text

set_forced_text(text: str) -> bool

Override the display text of this operand.

Parameters:

  • text (str) –

    The text to display; an empty string removes the override.

Returns:

  • bool

    True if the override was applied, False otherwise.

struct_offset_field_names

struct_offset_field_names() -> list[str]

Read the struct-offset path as the field names.

For an operand rendered as OuterStruct.nested.inner_field2 this returns ['OuterStruct', 'nested', 'inner_field2']. Use struct_offset_path_names to get the type name path.

Returns:

  • list[str]

    The member chain, or an empty list if the operand is not represented as

  • list[str]

    a structure offset.

struct_offset_path

struct_offset_path() -> Optional[tuple[list[int], int]]

Read the structure offset path as type ids.

Returns:

  • Optional[tuple[list[int], int]]

    A tuple of (path of type ids, delta), or None if the operand is not

  • Optional[tuple[list[int], int]]

    represented as a structure offset. The path is the root structure type

  • Optional[tuple[list[int], int]]

    id, consecutive elements are ids of used union members (if any).

struct_offset_path_names

struct_offset_path_names() -> list[str]

Read the struct-offset path as type names.

The path holds the root structure plus any union members chosen along the chain (plain nested structs add no entries), so an operand rendered as OuterStruct.nested.inner_field2 yields just ['OuterStruct']. Use struct_offset_field_names to get the member chain.

Returns:

  • list[str]

    The path as a list of type names, or an empty list if the operand is

  • list[str]

    not represented as a structure offset. An unnamed type appears as its

  • list[str]

    hex tid.

toggle_negate

toggle_negate() -> bool

Toggle the bitwise-negation rendering of this operand.

toggle_sign

toggle_sign() -> bool

Flip the sign rendering of this operand.

RegisterOperand

RegisterOperand(
    database: Database, operand: op_t, instruction_ea: ea_t
)

Bases: Operand

Operand representing a processor register (o_reg).

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.

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.

display_as

display_as(format: OperandFormat, base: int = 0) -> bool

Render this operand using the given format.

Parameters:

  • format (OperandFormat) –

    The representation to apply.

  • base (int, default: 0 ) –

    Base address, only used for OperandFormat.OFFSET.

Returns:

  • bool

    True if the representation was applied, False otherwise.

Raises:

  • InvalidParameterError

    If the format is unknown.

display_based_struct_offset

display_based_struct_offset(base: ea_t) -> bool

Render this operand as a structure member offset based at base.

Parameters:

  • base (ea_t) –

    Address of a structure instance laid out in the database; its type supplies the member layout.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_binary

display_binary() -> bool

Render this operand in binary.

display_char

display_char() -> bool

Render this operand as a character literal.

display_decimal

display_decimal() -> bool

Render this operand in decimal.

display_float

display_float() -> bool

Render this operand as a floating point number.

display_hex

display_hex() -> bool

Render this operand in hexadecimal.

display_octal

display_octal() -> bool

Render this operand in octal.

display_offset

display_offset(base: int = 0) -> bool

Render this operand as an offset from base.

Parameters:

  • base (int, default: 0 ) –

    Base address the offset is relative to.

Returns:

  • bool

    True if the representation was applied, False otherwise.

display_reset

display_reset() -> bool

Reset this operand to its default rendering.

display_stack_var

display_stack_var() -> bool

Link this operand to a stack variable.

display_struct_offset

display_struct_offset(
    path: int | list[int], delta: int = 0
) -> bool

Render this operand as a structure member offset.

Parameters:

  • path (int | list[int]) –

    A structure type id. Pass a list of ids to select particular union members in the chain; nested structs are resolved automatically.

  • delta (int, default: 0 ) –

    Additional offset to be applied to the member after path resolution.

Returns:

  • bool

    True if the representation was applied, False otherwise.

get_access_type

get_access_type() -> AccessType

Get a string description of how this operand is accessed.

get_forced_text

get_forced_text() -> Optional[str]

Get the display-text override, or None if there is none.

Returns:

  • Optional[str]

    The override text, or None if the operand has no override.

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.

set_forced_text

set_forced_text(text: str) -> bool

Override the display text of this operand.

Parameters:

  • text (str) –

    The text to display; an empty string removes the override.

Returns:

  • bool

    True if the override was applied, False otherwise.

struct_offset_field_names

struct_offset_field_names() -> list[str]

Read the struct-offset path as the field names.

For an operand rendered as OuterStruct.nested.inner_field2 this returns ['OuterStruct', 'nested', 'inner_field2']. Use struct_offset_path_names to get the type name path.

Returns:

  • list[str]

    The member chain, or an empty list if the operand is not represented as

  • list[str]

    a structure offset.

struct_offset_path

struct_offset_path() -> Optional[tuple[list[int], int]]

Read the structure offset path as type ids.

Returns:

  • Optional[tuple[list[int], int]]

    A tuple of (path of type ids, delta), or None if the operand is not

  • Optional[tuple[list[int], int]]

    represented as a structure offset. The path is the root structure type

  • Optional[tuple[list[int], int]]

    id, consecutive elements are ids of used union members (if any).

struct_offset_path_names

struct_offset_path_names() -> list[str]

Read the struct-offset path as type names.

The path holds the root structure plus any union members chosen along the chain (plain nested structs add no entries), so an operand rendered as OuterStruct.nested.inner_field2 yields just ['OuterStruct']. Use struct_offset_field_names to get the member chain.

Returns:

  • list[str]

    The path as a list of type names, or an empty list if the operand is

  • list[str]

    not represented as a structure offset. An unnamed type appears as its

  • list[str]

    hex tid.

toggle_negate

toggle_negate() -> bool

Toggle the bitwise-negation rendering of this operand.

toggle_sign

toggle_sign() -> bool

Flip the sign rendering of this operand.