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.
| ``__deleteAddress`(self)` Clears the name of the module
| ``__deleteBytes`(self)` destructs the raw bytes of the instruction
| ``__deleteComment`(self)` destructs the instruction comment
| `__deleteDisasm(self)`
| ``__deleteMnemonic`(self)` destructs the instuction mnemonic
| ``__deleteOperands`(self)` destructs the first operand of the instruction
| `__deleteXrefsTo(self)`
DWORD | ``__getAddress`(self)` The address of the instruction
[Integers] | ``__getBytes`(self)` The raw bytes of the instruction
String | ``__getComment`(self)` The instruction comment.
String | ``__getDisasm`(self)` Returns the disassembly view of the instruction.
String | ``__getMnemonic`(self)` The instruction mnemonic.
[operand] | ``__getOperands`(self)` Gets the operands for the instruction
[instruction] | ``__getXrefsTo`(self)` Returns the instructions that reference this instruction.
| `__load_from_sql(self)`
| `__load_operands_from_sql(self)`
| ``__setAddress`(self, value)` Sets the address of the instruction.
| ``__setBytes`(self, value)` Sets the name of the module.
| ``__setComment`(self, value)` Sets the instruction comment.
| `__setDisasm(self, value)`
| ``__setMnemonic`(self, value)` Sets the instruction mnemonic.
| ``__setOperands`(self, value)` Sets the first operand of the instruction
| `__setXrefsTo(self, value)`
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
`list` | `_instruction__bytes` = `[]`
`bool` | `_instruction__cached` = `False`
`str` | `_instruction__comment` = `''`
`NoneType` | `_instruction__ea` = None
`dict` | `_instruction__FLAGGED_OPCODES` = `{'jns': 4096, 'rol': 327...`
`NoneType` | `_instruction__mnem` = None
`bool` | `_instruction__operand_cache` = `False`
`NoneType` | `_instruction__operands` = None
`int` | `_instruction__SET_ALL` = 3604480
`int` | `_instruction__SET_CARRY` = 65536
`int` | `_instruction__SET_DIR` = 524288
`long` | `_instruction__SET_MASK` = `4294901760L`
`int` | `_instruction__SET_NCARRY` = 16777216
`int` | `_instruction__SET_NDIR` = 134217728
`int` | `_instruction__SET_NOFLOW` = 67108864
`int` | `_instruction__SET_NPARITY` = 536870912
`int` | `_instruction__SET_NSIGN` = 268435456
`int` | `_instruction__SET_NZERO` = 33554432
`int` | `_instruction__SET_OFLOW` = 262144
`int` | `_instruction__SET_PARITY` = 2097152
`int` | `_instruction__SET_SFEQOF` = 1073741824
`long` | `_instruction__SET_SFNEOF` = `2147483648L`
`int` | `_instruction__SET_SIGN` = 1048576
`int` | `_instruction__SET_ZERO` = 131072
`int` | `_instruction__TEST_ALL` = 55
`int` | `_instruction__TEST_CARRY` = 1
`int` | `_instruction__TEST_DIR` = 8
`int` | `_instruction__TEST_MASK` = 65535
`int` | `_instruction__TEST_NCARRY` = 256
`int` | `_instruction__TEST_NDIR` = 2048
`int` | `_instruction__TEST_NOFLOW` = 1024
`int` | `_instruction__TEST_NPARITY` = 8192
`int` | `_instruction__TEST_NSIGN` = 4096
`int` | `_instruction__TEST_NZERO` = 512
`int` | `_instruction__TEST_OFLOW` = 4
`int` | `_instruction__TEST_PARITY` = 32
`int` | `_instruction__TEST_SFEQOF` = 16384
`int` | `_instruction__TEST_SFNEOF` = 32768
`int` | `_instruction__TEST_SIGN` = 16
`int` | `_instruction__TEST_ZERO` = 2

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)

### __deleteAddress(self)

Clears the name of the module

### __deleteBytes(self)

destructs the raw bytes of the instruction

### __deleteComment(self)

destructs the instruction comment

### __deleteMnemonic(self)

destructs the instuction mnemonic

### __deleteOperands(self)

destructs the first operand of the instruction

### __getAddress(self)

The address of the instruction

  Returns:
    The address of the instruction
    (type=DWORD)

### __getBytes(self)

The raw bytes of the instruction

  Returns:
    The raw bytes of the instruction
    (type=[Integers])

### __getComment(self)

The instruction comment.

  Returns:
    The instruction comment
    (type=String)

### __getDisasm(self)

Returns the disassembly view of the instruction.

  Returns:
    The disassembly view of the instruction.
    (type=String)

### __getMnemonic(self)

The instruction mnemonic.

  Returns:
    The instruction mnemonic
    (type=String)

### __getOperands(self)

Gets the operands for the instruction

  Returns:
    The first operand of the instruction
    (type=[operand])

### __getXrefsTo(self)

Returns the instructions that reference this instruction.

  Returns:
    A list of instructions that reference this instructon
    (type=[instruction])

### __setAddress(self, value)

Sets the address of the instruction.

  Parameters:
    `value` - The address of the instruction.
    (type=DWORD)

### __setBytes(self, value)

Sets the name of the module.

  Parameters:
    `value` - The raw bytes of the instruction
    (type=[Integer])

### __setComment(self, value)

Sets the instruction comment.

  Parameters:
    `value` - The instruction comment.
    (type=String)

### __setMnemonic(self, value)

Sets the instruction mnemonic.

  Parameters:
    `value` - The instuction mnemonic.
    (type=String)

### __setOperands(self, value)

Sets the first operand of the instruction

  Parameters:
    `value` - The first operand of the instruction
    (type=operand)

Property Details

### bytes

The raw bytes of the instruction.

  Get Method:
    `__getBytes`(self)
  Set Method:
    `__setBytes`(self, value)
  Delete Method:
    `__deleteBytes`(self)

### comment

The instruction comment.

  Get Method:
    `__getComment`(self)
  Set Method:
    `__setComment`(self, value)
  Delete Method:
    `__deleteComment`(self)

### disasm

The textual disassembly of the instruction.

  Get Method:
    `__getDisasm`(self)
  Set Method:
    `__setDisasm`(self, value)
  Delete Method:
    `__deleteDisasm`(self)

### ea

The address of the instruction.

  Get Method:
    `__getAddress`(self)
  Set Method:
    `__setAddress`(self, value)
  Delete Method:
    `__deleteAddress`(self)

### id

The identifier for the class (internal use only).

  Get Method:
    `__getAddress`(self)
  Set Method:
    `__setAddress`(self, value)
  Delete Method:
    `__deleteAddress`(self)

### mnem

The instruction mnemonic.

  Get Method:
    `__getMnemonic`(self)
  Set Method:
    `__setMnemonic`(self, value)
  Delete Method:
    `__deleteMnemonic`(self)

### operands

The list of operands. (read-only)

  Get Method:
    `__getOperands`(self)
  Set Method:
    `__setOperands`(self, value)
  Delete Method:
    `__deleteOperands`(self)

### xrefs_to

The instructions that referenc this instruction.

  Get Method:
    `__getXrefsTo`(self)
  Set Method:
    `__setXrefsTo`(self, value)
  Delete Method:
    `__deleteXrefsTo`(self)

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

### _instruction__bytes

  Type:
    `list`
  Value:

        []

### _instruction__cached

  Type:
    `bool`
  Value:

        False

### _instruction__comment

  Type:
    `str`
  Value:

        ''

### _instruction__ea

  Type:
    `NoneType`
  Value:

        None

### _instruction__FLAGGED_OPCODES

  Type:
    `dict`
  Value:

        {'arpl': 131072,
         'clc': 16777216,
         'cld': 134217728,
         'imul': 327680,
         'jno': 1024,
         'jns': 4096,
         'lsl': 131072,
         'rol': 327680,
        ...

### _instruction__mnem

  Type:
    `NoneType`
  Value:

        None

### _instruction__operand_cache

  Type:
    `bool`
  Value:

        False

### _instruction__operands

  Type:
    `NoneType`
  Value:

        None

### _instruction__SET_ALL

  Type:
    `int`
  Value:

        3604480

### _instruction__SET_CARRY

  Type:
    `int`
  Value:

        65536

### _instruction__SET_DIR

  Type:
    `int`
  Value:

        524288

### _instruction__SET_MASK

  Type:
    `long`
  Value:

        4294901760L

### _instruction__SET_NCARRY

  Type:
    `int`
  Value:

        16777216

### _instruction__SET_NDIR

  Type:
    `int`
  Value:

        134217728

### _instruction__SET_NOFLOW

  Type:
    `int`
  Value:

        67108864

### _instruction__SET_NPARITY

  Type:
    `int`
  Value:

        536870912

### _instruction__SET_NSIGN

  Type:
    `int`
  Value:

        268435456

### _instruction__SET_NZERO

  Type:
    `int`
  Value:

        33554432

### _instruction__SET_OFLOW

  Type:
    `int`
  Value:

        262144

### _instruction__SET_PARITY

  Type:
    `int`
  Value:

        2097152

### _instruction__SET_SFEQOF

  Type:
    `int`
  Value:

        1073741824

### _instruction__SET_SFNEOF

  Type:
    `long`
  Value:

        2147483648L

### _instruction__SET_SIGN

  Type:
    `int`
  Value:

        1048576

### _instruction__SET_ZERO

  Type:
    `int`
  Value:

        131072

### _instruction__TEST_ALL

  Type:
    `int`
  Value:

        55

### _instruction__TEST_CARRY

  Type:
    `int`
  Value:

        1

### _instruction__TEST_DIR

  Type:
    `int`
  Value:

        8

### _instruction__TEST_MASK

  Type:
    `int`
  Value:

        65535

### _instruction__TEST_NCARRY

  Type:
    `int`
  Value:

        256

### _instruction__TEST_NDIR

  Type:
    `int`
  Value:

        2048

### _instruction__TEST_NOFLOW

  Type:
    `int`
  Value:

        1024

### _instruction__TEST_NPARITY

  Type:
    `int`
  Value:

        8192

### _instruction__TEST_NSIGN

  Type:
    `int`
  Value:

        4096

### _instruction__TEST_NZERO

  Type:
    `int`
  Value:

        512

### _instruction__TEST_OFLOW

  Type:
    `int`
  Value:

        4

### _instruction__TEST_PARITY

  Type:
    `int`
  Value:

        32

### _instruction__TEST_SFEQOF

  Type:
    `int`
  Value:

        16384

### _instruction__TEST_SFNEOF

  Type:
    `int`
  Value:

        32768

### _instruction__TEST_SIGN

  Type:
    `int`
  Value:

        16

### _instruction__TEST_ZERO

  Type:
    `int`
  Value:

        2

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