Package pida :: Module instruction :: Class instruction |
[show private | hide private]
[frames | no frames]

## Class instruction

Method Summary
| ``__init__`(self, ea, analysis, basic_block)` Analyze the instruction at ea.
Integer | ``flag_dependency`(first_instruction, second_instruction)` Determine if one instruction can affect flags used by the other instruction.
String | ``get_disasm`(self, ea)` A GetDisasm() wrapper that strips comments and extraneous whitespace.
Mixed | ``get_string_reference`(self, ea)` If the specified instruction references a string, get and return the contents of that string.
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.
Mixed | ``_get_arg_ref`(self)` Return the stack offset of the argument referenced, if any, by the instruction.
Mixed | ``_get_constant_ref`(self, opnum)` Return the constant value, if any, reference by the instruction.
Mixed | ``_get_var_ref`(self)` Return the stack offset of the local variable referenced, if any, by the instruction.

Class Variable Summary
`NoneType` | `analysis` = None
`NoneType` | `basic_block` = None
`list` | `bytes` = `[]`
`str` | `comment` = `''`
`NoneType` | `disasm` = None
`NoneType` | `ea` = None
`dict` | `ext` = `{}`
`dict` | `FLAGGED_OPCODES` = `{'jns': 4096, 'rol': 327680, 'lsl': 13...`
`NoneType` | `mnem` = None
`NoneType` | `op1` = None
`NoneType` | `op2` = None
`NoneType` | `op3` = None
`NoneType` | `refs_api` = None
`NoneType` | `refs_arg` = None
`NoneType` | `refs_constant` = None
`NoneType` | `refs_string` = None
`NoneType` | `refs_var` = 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, ea, analysis=0, basic_block=None) (Constructor) Analyze the instruction at ea. Parameters: `ea` - Effective address of instruction to analyze (type=DWORD) `analysis` - (Optional, Def=ANALYSIS_NONE) Which extra analysis options to enable (type=Integer) `basic_block` - (Optional, Def=None) Pointer to parent basic block container (type=pgraph.basic_block) See Also: defines.py

### 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) Author: Cameron Hotchkies

### get_disasm(self, ea) A GetDisasm() wrapper that strips comments and extraneous whitespace. Parameters: `ea` - Effective address of instruction to analyze (type=DWORD) Returns: Sanitized disassembly at ea. (type=String)

### get_string_reference(self, ea) If the specified instruction references a string, get and return the contents of that string. Currently supports: Parameters: `ea` - Effective address of instruction to analyze (type=DWORD) Returns: ASCII representation of string referenced from ea if found, None otherwise. (type=Mixed) To Do: XXX - Add more supported string types.

### 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) Author: Cameron Hotchkies

### 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) Author: Cameron Hotchkies

### _get_arg_ref(self) Return the stack offset of the argument referenced, if any, by the instruction. Returns: Referenced argument stack offset or None. (type=Mixed) Author: Peter Silberman

### _get_constant_ref(self, opnum=0) Return the constant value, if any, reference by the instruction. Returns: Integer value of referenced constant, otherwise None. (type=Mixed) Author: Peter Silberman

### _get_var_ref(self) Return the stack offset of the local variable referenced, if any, by the instruction. Returns: Referenced local variable stack offset or None. (type=Mixed) Author: Peter Silberman

Class Variable Details

    ### analysis Type: `NoneType` Value:
        None

    ### basic_block Type: `NoneType` Value:
        None

    ### bytes Type: `list` Value:
        []

    ### comment Type: `str` Value:
        ''

    ### disasm Type: `NoneType` Value:
        None

    ### ea Type: `NoneType` Value:
        None

    ### ext Type: `dict` Value:
        {}

    ### FLAGGED_OPCODES Type: `dict` Value:
        {'arpl': 131072,
         'clc': 16777216,
         'cld': 134217728,
         'imul': 327680,
         'jno': 1024,
         'jns': 4096,
         'lsl': 131072,
         'rol': 327680,
        ...

    ### mnem Type: `NoneType` Value:
        None

    ### op1 Type: `NoneType` Value:
        None

    ### op2 Type: `NoneType` Value:
        None

    ### op3 Type: `NoneType` Value:
        None

    ### 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__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 Thu Sep 14 10:39:50 2006 | http://epydoc.sf.net