Public Member Functions | Static Public Member Functions

# BinNavi.API.disassembly.Instruction Class Reference

Represents a single disassembled instruction. More...

Inherits BinNavi::APIHelpers::ApiObject< INaviInstruction >.

List of all members.

## Public Member Functions
void | addListener (final IInstructionListener listener)
| Adds an instruction listener.
Address | getAddress ()
| Address of the instruction.
String | getArchitecture ()
| Returns the architecture of the instruction.
String | getComment ()
| Comment of the instruction.
byte[] | getData ()
| Binary data of the instruction.
String | getMnemonic ()
| Mnemonic of the instruction.
List< Operand > | getOperands ()
| Operands of the instruction.
ReilGraph | getReilCode () throws InternalTranslationException
| REIL code of the instruction.
void | removeListener (final IInstructionListener listener)
| Removes an instruction listener.
void | setComment (final String comment) throws CouldntSaveDataException
| Changes the instruction comment.
String | toString ()
| Printable representation of the instruction.
## Static Public Member Functions
static Instruction | create (final Module module, final Address address, final String mnemonic, final List< Operand > operands, final byte[] data, final String architecture)
| Creates a new instruction.

## Detailed Description

An Instruction object represents a single instruction of a disassembled module.

## Member Function Documentation

void BinNavi.API.disassembly.Instruction.addListener | ( | final IInstructionListener | listener | ) |

Adds an object that is notified about changes in the instruction.

Parameters:

  | listener | The listener object that is notified about changes in the instruction.

Exceptions:

  | IllegalArgumentException | Thrown if the listener argument is null.
  | IllegalStateException | Thrown if the listener object is already listening on the instruction.

static Instruction BinNavi.API.disassembly.Instruction.create | ( | final Module | module,
|  | final Address | address,
|  | final String | mnemonic,
|  | final List< Operand > | operands,
|  | final byte[] | data,
|  | final String | architecture |
| ) |  |  | `[static]`

Creates a new instruction which is part of this module. The new instruction is immediately stored in the database.

Parameters:

  | module | The module the instruction belongs to.
  | address | The address of the instruction.
  | mnemonic | The mnemonic of the instruction.
  | operands | The operands that belong to the instruction.
  | data | The binary data of the instruction.
  | architecture | The architecture of the instruction.

Returns:
  The created instruction object.

Address BinNavi.API.disassembly.Instruction.getAddress | ( |  | ) |

Returns the address of the instruction.

Returns:
  The address of the instruction.

String BinNavi.API.disassembly.Instruction.getArchitecture | ( |  | ) |

Returns the architecture of the instruction.

Returns:
  The architecture of the instruction.

String BinNavi.API.disassembly.Instruction.getComment | ( |  | ) |

Returns the comment of the instruction. This comment is the string that is displayed in views as the global instruction comment of the instruction.

Returns:
  The comment of the instruction.

byte [] BinNavi.API.disassembly.Instruction.getData | ( |  | ) |

Returns the original bytes of the instruction.

Returns:
  The original bytes of the instruction.

String BinNavi.API.disassembly.Instruction.getMnemonic | ( |  | ) |

Returns the mnemonic of the instruction.

Returns:
  The mnemonic of the instruction.

List<Operand> BinNavi.API.disassembly.Instruction.getOperands | ( |  | ) |

Returns the operands of the instruction.

Returns:
  The operands of the instruction.

ReilGraph BinNavi.API.disassembly.Instruction.getReilCode | ( |  | ) | throws InternalTranslationException

Converts the instruction to REIL code.

Using this function over manual translation via ReilTranslator has the advantage that REIL translation results are automatically cached. Subsequent uses of this function requires no additional re-translation of the instruction provided that nothing relevant (like added/removed code nodes) changed.

Returns:
  The REIL representation of the instruction.

Exceptions:

  | InternalTranslationException | Thrown if the REIL translation failed.

void BinNavi.API.disassembly.Instruction.removeListener | ( | final IInstructionListener | listener | ) |

Removes a listener object from the instruction.

Parameters:

  | listener | The listener object to remove from the instruction.

Exceptions:

  | IllegalArgumentException | Thrown if the listener argument is null.
  | IllegalStateException | Thrown if the listener object was not listening on the instruction.

void BinNavi.API.disassembly.Instruction.setComment | ( | final String | comment | ) | throws CouldntSaveDataException

Changes the comment of the instruction. This comment is the string that is displayed in views as the global instruction comment of the instruction.

Parameters:

  | comment | The new comment of the instruction.

Exceptions:

  | IllegalArgumentException | Thrown if the comment argument is null.
  | CouldntSaveDataException | Thrown if the comment could not be changed.

String BinNavi.API.disassembly.Instruction.toString | ( |  | ) |

Returns the string representation of the instruction.

Returns:
  The string representation of the instruction.