Instructions
instructions
Classes:
-
Instructions
–Provides access to instruction-related operations using structured operand hierarchy.
Instructions
Instructions(database: 'Database')
Provides access to instruction-related operations using structured operand hierarchy.
Constructs an instructions handler for the given database.
Args: database: Reference to the active IDA database.
Methods:
-
get_at
–Decodes the instruction at the specified address.
-
get_between
–Retrieves instructions between the specified addresses.
-
get_disassembly
–Retrieves the disassembled string representation of the given instruction.
-
get_mnemonic
–Retrieves the mnemonic of the given instruction.
-
get_operand
–Get a specific operand from the instruction.
-
get_operands
–Get all operands from the instruction.
-
get_operands_count
–Retrieve the operands number of the given instruction.
-
get_prev
–Decodes prev instruction of the one at specified address.
-
is_call_instruction
–Check if the instruction is a call instruction.
-
is_jump_instruction
–Check if the instruction is a jump instruction.
-
is_return_instruction
–Check if the instruction is a return instruction.
-
is_valid
–Checks if the given instruction is valid.
Attributes:
m_database
instance-attribute
m_database = database
get_at
get_at(ea: 'ea_t') -> insn_t | None
Decodes the instruction at the specified address.
Args: ea: The effective address of the instruction.
Returns: An insn_t instance, if fails returns None.
get_between
get_between(start: 'ea_t', end: 'ea_t') -> Iterator[insn_t]
Retrieves instructions between the specified addresses.
Args: start: Start of the address range. end: End of the address range.
Returns: An instruction iterator.
get_disassembly
get_disassembly(insn: insn_t) -> str | None
Retrieves the disassembled string representation of the given instruction.
Args: insn: The instruction to disassemble.
Returns: The disassembly as string, if fails, returns None.
get_mnemonic
get_mnemonic(insn: insn_t) -> str | None
Retrieves the mnemonic of the given instruction.
Args: insn: The instruction to analyze.
Returns: A string representing the mnemonic of the given instruction. If retrieving fails, returns None.
get_operand
get_operand(
insn: insn_t, index: int
) -> Optional[Operand] | None
Get a specific operand from the instruction.
Args: insn: The instruction to analyze. index: The operand index (0, 1, 2, etc.).
Returns: An Operand instance of the appropriate type, or None if the index is invalid or operand is void.
get_operands
get_operands(insn: insn_t) -> List[Operand]
Get all operands from the instruction.
Args: insn: The instruction to analyze.
Returns: A list of Operand instances of appropriate types (excludes void operands).
get_operands_count
get_operands_count(insn: insn_t) -> int
Retrieve the operands number of the given instruction.
Args: insn: The instruction to analyze.
Returns: An integer representing the number, if error, the number is negative.
get_prev
get_prev(ea: 'ea_t') -> insn_t | None
Decodes prev instruction of the one at specified address.
Args: ea: The effective address of the instruction.
Returns: An insn_t instance, if fails returns None.
is_call_instruction
is_call_instruction(insn: insn_t) -> bool
Check if the instruction is a call instruction.
Args: insn: The instruction to analyze.
Returns: True if this is a call instruction.
is_jump_instruction
is_jump_instruction(insn: insn_t) -> bool
Check if the instruction is a jump instruction.
Args: insn: The instruction to analyze.
Returns: True if this is a jump instruction.
is_return_instruction
is_return_instruction(insn: insn_t) -> bool
Check if the instruction is a return instruction.
Args: insn: The instruction to analyze.
Returns: True if this is a return instruction.
is_valid
is_valid(insn: object) -> bool
Checks if the given instruction is valid.
Args: insn: The instruction to validate.
Returns:
True
if the instruction is valid, False
otherwise.