Package bakmei :: Module instruction :: Class instruction |

[show private | hide private]
[frames | no frames]

## Type instruction

    object --+
             |
            instruction

This class represents an assembly instruction.

Author: Cameron Hotchkies, Pedram Amini

Contact: chotchkies@tippingpoint.com

Organization: www.openrce.org

License: GNU General Public License 2.0 or later

Method Summary
| ``__init__`(self, DSN, database_id)` Initializes an instruction object.
Integer | ``flag_dependency`(first_instruction, second_instruction)` Determine if one instruction can affect flags used by the other instruction.
Boolean | ``is_conditional_branch`(self)` Check if the instruction is a conditional branch.
Boolean | ``overwrites_register`(self, register)` Indicates if the given register is modified by this instruction.
| ``set_operand`(self, position, value)` Updates the text representation of an operand.
Inherited from object
| ``__delattr__`(...)` x.__delattr__('name') <==> del x.name
| ``__getattribute__`(...)` x.__getattribute__('name') <==> x.name
| ``__hash__`(x)` x.__hash__() <==> hash(x)
| ``__new__`(T, S, ...)` T.__new__(S, ...) -> a new object with type S, a subtype of T
| ``__reduce__`(...)` helper for pickle
| ``__reduce_ex__`(...)` helper for pickle
| ``__repr__`(x)` x.__repr__() <==> repr(x)
| ``__setattr__`(...)` x.__setattr__('name', value) <==> x.name = value
| ``__str__`(x)` x.__str__() <==> str(x)

Property Summary
List | `bytes`: The raw bytes of the instruction.
String | `comment`: The instruction comment.
String | `disasm`: The textual disassembly of the instruction.
DWORD | `ea`: The address of the instruction.
| `id`: The identifier for the class (internal use only).
String | `mnem`: The instruction mnemonic.
| `operands`: The list of operands.
| `xrefs_to`: The instructions that referenc this instruction.

Class Variable Summary
`NoneType` | `basic_block` = None
Integer | `dbid`: Database Identifier
String | `DSN`: Database location
`dict` | `ext` = `{}`
`NoneType` | `refs_api` = None
`NoneType` | `refs_arg` = None
`NoneType` | `refs_constant` = None
`NoneType` | `refs_string` = None
`NoneType` | `refs_var` = None

Method Details

### __init__(self, DSN, database_id)
(Constructor)

Initializes an instruction object.

  Parameters:
    `DSN` - The filename for the database to read from.
    (type=String)
    `database_id` - The id of the instruction in the database
    (type=Integer)
  Overrides:
    `__builtin__.object.__init__`

### flag_dependency(first_instruction, second_instruction)

Determine if one instruction can affect flags used by the other instruction.

  Parameters:
    `first_instruction` - The first instruction to check
    (type=instruction)
    `second_instruction` - The second instruction to check
    (type=instruction)
  Returns:
    0 for no effect, 1 for first affects second, 2 for second affects first, 3 for both can affect
    (type=Integer)

### is_conditional_branch(self)

Check if the instruction is a conditional branch. (x86 specific)

  Returns:
    True if the instruction is a conditional branch, False otherwise.
    (type=Boolean)

### overwrites_register(self, register)

Indicates if the given register is modified by this instruction. This does not check for all modifications, just lea, mov and pop into the specific register.

  Parameters:
    `register` - The text representation of the register
    (type=String)
  Returns:
    True if the register is modified
    (type=Boolean)

### set_operand(self, position, value)

Updates the text representation of an operand.

  Parameters:
    `position` - The position of the operand in the instruction. This is zero based.
    (type=Integer)
    `value` - The new text representation of the operand.
    (type=String)

Property Details

### bytes

The raw bytes of the instruction.

### comment

The instruction comment.

### disasm

The textual disassembly of the instruction.

### ea

The address of the instruction.

### id

The identifier for the class (internal use only).

### mnem

The instruction mnemonic.

### operands

The list of operands. (read-only)

### xrefs_to

The instructions that referenc this instruction.

Class Variable Details

### basic_block

  Type:
    `NoneType`
  Value:

        None

### dbid

Database Identifier

  Type:
    Integer
  Value:

        None

### DSN

Database location

  Type:
    String
  Value:

        None

### ext

  Type:
    `dict`
  Value:

        {}

### refs_api

  Type:
    `NoneType`
  Value:

        None

### refs_arg

  Type:
    `NoneType`
  Value:

        None

### refs_constant

  Type:
    `NoneType`
  Value:

        None

### refs_string

  Type:
    `NoneType`
  Value:

        None

### refs_var

  Type:
    `NoneType`
  Value:

        None

Generated by Epydoc 2.1 on Wed Mar 14 16:32:07 2007 | http://epydoc.sf.net