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 intConstant value forindex-is-field-offset.static final intConstant value forindex-is-inline-offset.static final intConstant value forindex-is-vtable-offset.static final intConstant value forindex-to-call-site.static final intConstant value forindex-to-field.static final intConstant value forindex-to-method.static final intConstant value forindex-to-method-handle.static final intConstant value forindex-to-prototype.static final intConstant value forindex-to-string.static final intConstant value forindex-to-type.static final intOperand type for branch target.
Value: signed int, relative displacement in code units (2 bytes) from current instruction addressstatic final intOperand type for an index into a constant pool (which pool is instruction specific).static final intOperand type for a second index into the prototype pool.static final intOperand type for an immediate.
Value: long, sign-extended, could be anything from a boolean to a doublestatic final intOperand type for a register or pair of registers.
Value: int, the register index (or first register index , in case of a pair)static final intOperand 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.intGet the Dalvik instruction opcode, as defined inDalvikInstructionOpcodes.getParameter(int index) Get an instruction operand by index, typed as a proper Dalvik parameter.intGet the count of parameters.intIf 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.intIf this instruction has a second index parameter (of typeTYPE_IDX2), retrieve the kind of pool that is referenced by this parameter index value.intgetParameterType(int index) Get the type of a parameter.longgetParameterValue(int index) Get the value of a parameter.Get the instruction switch data.booleanisArray()Determine if the instruction is an array initializer.booleanProvide a hint if the instruction looks like an optimized (non-standard) instruction, such as an odex or Art.booleanDetermine if this instruction is a so-called pseudo instruction, that is, a switch or an array-initialization instruction.booleanisSwitch()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, getSizeMethods 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_STRINGConstant value forindex-to-string.- See Also:
-
INDEX_TO_TYPE
static final int INDEX_TO_TYPEConstant value forindex-to-type.- See Also:
-
INDEX_TO_FIELD
static final int INDEX_TO_FIELDConstant value forindex-to-field.- See Also:
-
INDEX_TO_METHOD
static final int INDEX_TO_METHODConstant value forindex-to-method.- See Also:
-
INDEX_TO_PROTOTYPE
static final int INDEX_TO_PROTOTYPEConstant value forindex-to-prototype.- See Also:
-
INDEX_TO_CALL_SITE
static final int INDEX_TO_CALL_SITEConstant value forindex-to-call-site.- See Also:
-
INDEX_TO_METHOD_HANDLE
static final int INDEX_TO_METHOD_HANDLEConstant value forindex-to-method-handle.- See Also:
-
INDEX_IS_INLINE_OFFSET
static final int INDEX_IS_INLINE_OFFSETConstant value forindex-is-inline-offset.- See Also:
-
INDEX_IS_VTABLE_OFFSET
static final int INDEX_IS_VTABLE_OFFSETConstant value forindex-is-vtable-offset.- See Also:
-
INDEX_IS_FIELD_OFFSET
static final int INDEX_IS_FIELD_OFFSETConstant value forindex-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:
getCodein 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:
- an array of Dalvik instruction parameters
-
getParameter
Get an instruction operand by index, typed as a proper Dalvik parameter.- Parameters:
index- the zero-based parameter index- Returns:
- the Dalvik instruction parameter
-
getParameterCount
int getParameterCount()Get the count of parameters.- Returns:
- the number of parameters
-
getParameterType
int getParameterType(int index) Get the type of a parameter. Refer toTYPE_xxxconstants.- Parameters:
index- the zero-based parameter index- Returns:
- one of the
TYPE_xxxconstants
-
getParameterValue
long getParameterValue(int index) Get the value of a parameter.- Parameters:
index- the zero-based parameter index- Returns:
- the parameter value
-
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_xxxconstant 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_xxxconstant 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:
- true if this is a switch or array payload instruction
-
isSwitch
boolean isSwitch()Determine if the instruction is a switch.- Returns:
- true if this instruction is a switch payload instruction
-
isArray
boolean isArray()Determine if the instruction is an array initializer.- Returns:
- true if this instruction is an array payload instruction
-
getSwitchData
IDalvikInstructionSwitchData getSwitchData()Get the instruction switch data.- Returns:
- the switch payload object, or null if the instruction is neither
packed-switchnorsparse-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:
- true if this instruction appears to use a non-standard optimized opcode
-