microprobe.code.ins.Instruction

class Instruction[source]

Bases: microprobe.utils.misc.Pickable

Class to represent an instruction

__init__()[source]

Methods

__init__()
add_allow_register(reg)
param reg:
add_comment(comment)
param comment:
add_decorator(name, value)
param key:decorator name
allows(reg)
param reg:
assembly() Assembly representation of the instruction.
binary() Binary representation of the instruction.
check_context(context)
param context:
copy() Return a copy of the instruction.
memory_operands() Instruction memory operands.
operand_by_field(fieldname)
param fieldname:
 
operand_fields() Instruction field names of the operands.
operands() Instruction operands.
register_context_callback(key, …)
param key:
set_address(address)
param address:
set_arch_type(instrtype)
param instrtype:
 
set_label(label)
param label:
set_operands(values[, context])
param values:
sets() Return the list of registers set by the instruction.
unset_address() Unset instruction address.
uses() Return the list of registers used by the instruction.

Attributes

address Instruction address (InstructionAddress)
allowed_regs List of allowed registers of the instructon.
architecture_type Instruction architecture type (InstructionType).
comments List of comments of the instruction (list).
context_callbacks Returns the list of context callbacks registered.
decorators Instruction decorators (dict).
label Instruction label (str).



set_arch_type(instrtype)[source]
Parameters:instrtype
register_context_callback(key, checking_function, fixing_function)[source]
Parameters:
  • key
  • checking_function
  • fixing_function
context_callbacks

Returns the list of context callbacks registered.

check_context(context)[source]
Parameters:context
architecture_type

Instruction architecture type (InstructionType).

decorators

Instruction decorators (dict).

memory_operands()[source]

Instruction memory operands.

Return type:list of MemoryOperands
operands()[source]

Instruction operands.

Return type:list of Operands
copy()[source]

Return a copy of the instruction.

Return type:Instruction
operand_by_field(fieldname)[source]
Parameters:fieldname
operand_fields()[source]

Instruction field names of the operands.

Return type:list of str
set_operands(values, context=None)[source]
Parameters:values
sets()[source]

Return the list of registers set by the instruction.

Return type:list of Register
uses()[source]

Return the list of registers used by the instruction.

Return type:list of Register
add_allow_register(reg)[source]
Parameters:reg
add_comment(comment)[source]
Parameters:comment
add_decorator(name, value)[source]
Parameters:
  • key – decorator name
  • value – decorator value
comments

List of comments of the instruction (list).

allows(reg)[source]
Parameters:reg
allowed_regs

List of allowed registers of the instructon.

set_label(label)[source]
Parameters:label
label

Instruction label (str).

assembly()[source]

Assembly representation of the instruction.

Return type:str
binary()[source]

Binary representation of the instruction.

Return type:str
address

Instruction address (InstructionAddress)

set_address(address)[source]
Parameters:address
unset_address()[source]

Unset instruction address.