InstructionDisassembler Class Reference

#include <jvmti_dasm.h>

List of all members.

Public Types

enum  Type {
  OPCODEERROR = 0, UNKNOWN, OTHER = UNKNOWN, RELATIVE_JUMP,
  RELATIVE_COND_JUMP, RELATIVE_CALL, INDIRECT_JUMP, INDIRECT_CALL,
  RET
}
 Type of instruction. More...
enum  Register { DISASM_REG_NONE }
 General-purpose registers set. More...
enum  Kind { Kind_Imm, Kind_Mem, Kind_Reg }
 Kind of operand. More...
enum  CondJumpType {
  JUMP_OVERFLOW = 0, JUMP_NOT_OVERFLOW = 1, JUMP_BELOW = 2, JUMP_NOT_ABOVE_OR_EQUAL = JUMP_BELOW,
  JUMP_CARRY = JUMP_BELOW, JUMP_NOT_BELOW = 3, JUMP_ABOVE_OR_EQUAL = JUMP_NOT_BELOW, JUMP_NOT_CARRY = JUMP_NOT_BELOW,
  JUMP_ZERO = 4, JUMP_EQUAL = JUMP_ZERO, JUMP_NOT_ZERO = 5, JUMP_NOT_EQUAL = JUMP_NOT_ZERO,
  JUMP_BELOW_OR_EQUAL = 6, JUMP_NOT_ABOVE = JUMP_BELOW_OR_EQUAL, JUMP_NOT_BELOW_OR_EQUAL = 7, JUMP_ABOVE = JUMP_NOT_BELOW_OR_EQUAL,
  JUMP_SIGN = 8, JUMP_NOT_SIGN = 9, JUMP_PARITY = 10, JUMP_PARITY_EVEN = JUMP_PARITY,
  JUMP_NOT_PARITY = 11, JUMP_PARITY_ODD = JUMP_NOT_PARITY, JUMP_LESS = 12, JUMP_NOT_GREATER_OR_EQUAL = JUMP_LESS,
  JUMP_NOT_LESS = 13, JUMP_GREATER_OR_EQUAL = JUMP_NOT_LESS, JUMP_LESS_OR_EQUAL = 14, JUMP_NOT_GREATER = JUMP_LESS_OR_EQUAL,
  JUMP_NOT_LESS_OR_EQUAL = 15, JUMP_GREATER = JUMP_NOT_LESS_OR_EQUAL, CondJumpType_Count = 16
}
 Enum of possible condtions for conditional jump-s. More...

Public Member Functions

 InstructionDisassembler (void)
 InstructionDisassembler (NativeCodePtr address)
 InstructionDisassembler (InstructionDisassembler &d)
Type get_type (void) const
 Returns type of underlying instruction.
jint get_length_with_prefix (void) const
 Returns length (in bytes) of underlying instruction.
NativeCodePtr get_jump_target_address (void) const
 Returns absolute address of target, if applicable.
CondJumpType get_cond_jump_type (void) const
 Returns type of conditional jump.
unsigned get_operands_count (void) const
 Returns number of operands of the instruction.
const Opndget_opnd (unsigned i) const
 Returns i-th operand.
NativeCodePtr get_target_address_from_context (const Registers *pregs) const
 Calculates and returns address of target basing on the decoded arguments and provided register context.
const char * get_reg_value (Register reg, const Registers *pcontext) const
 Returns the appropriate register value for the register operand reg.

Classes

struct  Opnd
 Describes an argument of instruction. More...


Member Enumeration Documentation

enum InstructionDisassembler::Type

Type of instruction.

Enumerator:
OPCODEERROR 
UNKNOWN 
OTHER 
RELATIVE_JUMP 
RELATIVE_COND_JUMP 
RELATIVE_CALL 
INDIRECT_JUMP 
INDIRECT_CALL 
RET 

enum InstructionDisassembler::Register

General-purpose registers set.

Enumerator:
DISASM_REG_NONE 

enum InstructionDisassembler::Kind

Kind of operand.

See also:
Opnd
Enumerator:
Kind_Imm  Operand represents a constant.
Kind_Mem  Operand is memory reference.
Kind_Reg  Operand is register.

enum InstructionDisassembler::CondJumpType

Enum of possible condtions for conditional jump-s.

Note:
To simplify decoding, the current order of the enum constants exactly matches the order of ConditionalMnemonic constants in EncoderBase. Reordering of this constants requires some changes in InstructionDisassembler.disasm.
Enumerator:
JUMP_OVERFLOW 
JUMP_NOT_OVERFLOW 
JUMP_BELOW 
JUMP_NOT_ABOVE_OR_EQUAL 
JUMP_CARRY 
JUMP_NOT_BELOW 
JUMP_ABOVE_OR_EQUAL 
JUMP_NOT_CARRY 
JUMP_ZERO 
JUMP_EQUAL 
JUMP_NOT_ZERO 
JUMP_NOT_EQUAL 
JUMP_BELOW_OR_EQUAL 
JUMP_NOT_ABOVE 
JUMP_NOT_BELOW_OR_EQUAL 
JUMP_ABOVE 
JUMP_SIGN 
JUMP_NOT_SIGN 
JUMP_PARITY 
JUMP_PARITY_EVEN 
JUMP_NOT_PARITY 
JUMP_PARITY_ODD 
JUMP_LESS 
JUMP_NOT_GREATER_OR_EQUAL 
JUMP_NOT_LESS 
JUMP_GREATER_OR_EQUAL 
JUMP_LESS_OR_EQUAL 
JUMP_NOT_GREATER 
JUMP_NOT_LESS_OR_EQUAL 
JUMP_GREATER 
CondJumpType_Count 


Constructor & Destructor Documentation

InstructionDisassembler.InstructionDisassembler ( void   ) 

InstructionDisassembler.InstructionDisassembler ( NativeCodePtr  address  ) 

InstructionDisassembler.InstructionDisassembler ( InstructionDisassembler d  ) 


Member Function Documentation

Type InstructionDisassembler.get_type ( void   )  const

Returns type of underlying instruction.

jint InstructionDisassembler.get_length_with_prefix ( void   )  const

Returns length (in bytes) of underlying instruction.

The size includes instruction's prefixes, if any.

NativeCodePtr InstructionDisassembler.get_jump_target_address ( void   )  const

Returns absolute address of target, if applicable.

For instructions other than relative JMP, CALL and conditional jumps, the value is undefined.

CondJumpType InstructionDisassembler.get_cond_jump_type ( void   )  const

Returns type of conditional jump.

Note:
For instructions other than conditional jump, the value is undefined.

unsigned InstructionDisassembler.get_operands_count ( void   )  const

Returns number of operands of the instruction.

const Opnd& InstructionDisassembler.get_opnd ( unsigned  i  )  const

Returns i-th operand.

NativeCodePtr InstructionDisassembler.get_target_address_from_context ( const Registers *  pregs  )  const

Calculates and returns address of target basing on the decoded arguments and provided register context.

Works for both indirect and direct branches.

Note:
Only valid for branch instructions like JMPs, CALLs, etc.

const char* InstructionDisassembler.get_reg_value ( Register  reg,
const Registers *  pcontext 
) const

Returns the appropriate register value for the register operand reg.


The documentation for this class was generated from the following file:

Genereated on Tue Mar 11 19:26:01 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.