Interface IDalvikInstruction

All Superinterfaces:
IInstruction, ILocatedInstruction

@Ser public interface IDalvikInstruction extends ILocatedInstruction
Definition of a Dalvik instruction. Retrieved via methods in the container IDexCodeItem object.
See Also:
  • Field Details

    • TYPE_REG

      static final int TYPE_REG
      Operand type for a register or pair of registers.
      Value: int, the register index (or first register index , in case of a pair)
      See Also:
    • TYPE_IMM

      static final int TYPE_IMM
      Operand type for an immediate.
      Value: long, sign-extended, could be anything from a boolean to a double
      See Also:
    • TYPE_IDX

      static final int TYPE_IDX
      Operand type for an index into a constant pool (which pool is instruction specific). The index may reference a type, a string, a field, a method, or a call site. It cannot be used to reference a prototype (see TYPE_IDX2. An instruction can have at most one such index.
      Value: an unsigned int
      See Also:
    • TYPE_BRA

      static final int TYPE_BRA
      Operand type for branch target.
      Value: signed int, relative displacement in code units (2 bytes) from current instruction address
      See Also:
    • TYPE_RGR

      static final int TYPE_RGR
      Operand type for a register range.
      Value: long, made up of 2 ints as follows: low-int=first register index, high-int=last register index (inclusive)
      See Also:
    • TYPE_IDX2

      static final int TYPE_IDX2
      Operand type for a second index into the prototype pool. An instruction can have at most one such index, and only if it also has a first index parameters (type TYPE_IDX).
      Value: an unsigned int
      See Also:
    • INDEX_TO_STRING

      static final int INDEX_TO_STRING
      See Also:
    • INDEX_TO_TYPE

      static final int INDEX_TO_TYPE
      See Also:
    • INDEX_TO_FIELD

      static final int INDEX_TO_FIELD
      See Also:
    • INDEX_TO_METHOD

      static final int INDEX_TO_METHOD
      See Also:
    • INDEX_TO_PROTOTYPE

      static final int INDEX_TO_PROTOTYPE
      See Also:
    • INDEX_TO_CALL_SITE

      static final int INDEX_TO_CALL_SITE
      See Also:
    • INDEX_TO_METHOD_HANDLE

      static final int INDEX_TO_METHOD_HANDLE
      See Also:
    • INDEX_IS_INLINE_OFFSET

      static final int INDEX_IS_INLINE_OFFSET
      See Also:
    • INDEX_IS_VTABLE_OFFSET

      static final int INDEX_IS_VTABLE_OFFSET
      See Also:
    • INDEX_IS_FIELD_OFFSET

      static final int INDEX_IS_FIELD_OFFSET
      See Also:
  • Method Details

    • getCode

      byte[] getCode()
      Get the binary code that makes up this instruction.

      For pseudo-instructions, additional data bytes can be retrieved via getArrayData() or getSwitchData().

      Specified by:
      getCode in interface IInstruction
      Returns:
      an array of bytes, or null if the instruction is abstract
    • getOpcode

      int getOpcode()
      Get the Dalvik instruction opcode, as defined in DalvikInstructionOpcodes.
      Returns:
      the opcode
    • getParameters

      IDalvikInstructionParameter[] getParameters()
      Get the instruction operands typed as proper Dalvik parameters.

      This method is a convenience method, that does the same thing as IInstruction.getOperands() but returns Dalvik-typed parameters instead of generic IInstructionOperand-typed object.

      Returns:
    • getParameter

      IDalvikInstructionParameter getParameter(int index)
      Get an instruction operand by index, typed as a proper Dalvik parameter.
      Parameters:
      index -
      Returns:
    • getParameterCount

      int getParameterCount()
      Get the count of parameters.
      Returns:
    • getParameterType

      int getParameterType(int index)
      Get the type of a parameter. Refer to TYPE_xxx constants.
      Parameters:
      index -
      Returns:
    • getParameterValue

      long getParameterValue(int index)
      Get the value of a parameter.
      Parameters:
      index -
      Returns:
    • getParameterFirstIndexType

      int getParameterFirstIndexType()
      If this instruction has an index parameter (of type TYPE_IDX), retrieve the kind of pool that is referenced by this parameter index value.
      Returns:
      one of the INDEX_xxx constant defined in this class, or 0 if the instruction does not have a first index parameter
    • getParameterSecondIndexType

      int getParameterSecondIndexType()
      If this instruction has a second index parameter (of type TYPE_IDX2), retrieve the kind of pool that is referenced by this parameter index value.
      Returns:
      one of the INDEX_xxx constant defined in this class, or 0 if the instruction does not have a second index parameter
    • isPseudoInstruction

      boolean isPseudoInstruction()
      Determine if this instruction is a so-called pseudo instruction, that is, a switch or an array-initialization instruction.
      Returns:
    • isSwitch

      boolean isSwitch()
      Determine if the instruction is a switch.
      Returns:
    • isArray

      boolean isArray()
      Determine if the instruction is an array initializer.
      Returns:
    • getSwitchData

      Get the instruction switch data.
      Returns:
      the switch payload object, or null if the instruction is neither packed-switch nor sparse-switch
    • getArrayData

      Get the instruction array data.
      Returns:
      the array data, null of the instruction is not fill-array-data
    • isOptimized

      boolean isOptimized()
      Provide a hint if the instruction looks like an optimized (non-standard) instruction, such as an odex or Art.
      Returns: