Interface IDalvikInstruction
- All Superinterfaces:
IInstruction
,ILocatedInstruction
Definition of a Dalvik instruction. Retrieved via methods in the container
IDexCodeItem
object.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Operand type for branch target.
Value: signed int, relative displacement in code units (2 bytes) from current instruction addressstatic final int
Operand type for an index into a constant pool (which pool is instruction specific).static final int
Operand type for a second index into the prototype pool.static final int
Operand type for an immediate.
Value: long, sign-extended, could be anything from a boolean to a doublestatic final int
Operand type for a register or pair of registers.
Value: int, the register index (or first register index , in case of a pair)static final int
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) -
Method Summary
Modifier and TypeMethodDescriptionGet the instruction array data.byte[]
getCode()
Get the binary code that makes up this instruction.int
Get the Dalvik instruction opcode, as defined inDalvikInstructionOpcodes
.getParameter
(int index) Get an instruction operand by index, typed as a proper Dalvik parameter.int
Get the count of parameters.int
If this instruction has an index parameter (of typeTYPE_IDX
), retrieve the kind of pool that is referenced by this parameter index value.Get the instruction operands typed as proper Dalvik parameters.int
If this instruction has a second index parameter (of typeTYPE_IDX2
), retrieve the kind of pool that is referenced by this parameter index value.int
getParameterType
(int index) Get the type of a parameter.long
getParameterValue
(int index) Get the value of a parameter.Get the instruction switch data.boolean
isArray()
Determine if the instruction is an array initializer.boolean
Provide a hint if the instruction looks like an optimized (non-standard) instruction, such as an odex or Art.boolean
Determine if this instruction is a so-called pseudo instruction, that is, a switch or an array-initialization instruction.boolean
isSwitch()
Determine if the instruction is a switch.Methods inherited from interface com.pnfsoftware.jeb.core.units.code.IInstruction
canThrow, collectIndirectCallReferences, format, getACS, getBreakingFlow, getCountOfOperands, getDefUse, getDefUse, getDefUseInfo, getInstructionFlags, getMnemonic, getOperand, getOperands, getPrefix, getPrimaryBranchAddress, getProcessorMode, getRoutineCall, getSize
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.ILocatedInstruction
collectIndirectCallReferences, getBreakingFlow, getOffset, getOffsetEnd, getPrimaryBranchAddress, getRoutineCall
-
Field Details
-
TYPE_REG
static final int TYPE_REGOperand 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_IMMOperand 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_IDXOperand 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 (seeTYPE_IDX2
. An instruction can have at most one such index.
Value: an unsigned int- See Also:
-
TYPE_BRA
static final int TYPE_BRAOperand 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_RGROperand 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_IDX2Operand 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 (typeTYPE_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()
orgetSwitchData()
.- Specified by:
getCode
in interfaceIInstruction
- Returns:
- an array of bytes, or null if the instruction is abstract
-
getOpcode
int getOpcode()Get the Dalvik instruction opcode, as defined inDalvikInstructionOpcodes
.- 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 genericIInstructionOperand
-typed object.- Returns:
-
getParameter
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 toTYPE_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 typeTYPE_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 typeTYPE_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
IDalvikInstructionSwitchData getSwitchData()Get the instruction switch data.- Returns:
- the switch payload object, or null if the instruction is neither
packed-switch
norsparse-switch
-
getArrayData
IDalvikInstructionArrayData 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:
-