Interface IDexCodeItem
public interface IDexCodeItem
This interface represents a Dex
code_item object. Those objects hold, among other
things, the bytecode of a method.
It holds the body of a method. They are referenced by IDexMethodData objects for
internal, non-abstract, non-native methods.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the CFG for this method.Get the debug information for the method.intRetrieve the index of the dex entry that defines this code item.default intDeprecated.List<? extends IDexExceptionItem>Get the exception items for the method.getGaps()Retrieve the gaps in the method's bytecode.intGet the number of incoming arguments for the method.getInstruction(int index) Get the instruction at the provided index.getInstructionAt(int offsetInMethod) Get the instruction at the provided byte offset in the method.List<? extends IDalvikInstruction>Get the list of parsed bytecode instructions, ordered by ascending offset.intGet the Dex file offset where the bytecode for the method starts.intGet the size of the method's bytecode, in bytes.intGet the number of outgoing arguments for the method.Retrieve the list of parsing errors, if any.intGet the number of registers used by the method.booleanDetermine whether the method's bytecode was successfully parsed.
-
Method Details
-
getRegisterCount
int getRegisterCount()Get the number of registers used by the method.- Returns:
- the number of registers
-
getInputArgumentCount
int getInputArgumentCount()Get the number of incoming arguments for the method.- Returns:
- the number of incoming arguments
-
getOutputArgumentCount
int getOutputArgumentCount()Get the number of outgoing arguments for the method.- Returns:
- the number of outgoing arguments
-
getExceptionItems
List<? extends IDexExceptionItem> getExceptionItems()Get the exception items for the method.- Returns:
- the list of exception items
-
getDebugInfo
IDexDebugInfo getDebugInfo()Get the debug information for the method.Note: debug metadata can be forged and should not be trusted.
- Returns:
- the debug info object, or null if there is none
-
getDexEntryIndex
int getDexEntryIndex()Retrieve the index of the dex entry that defines this code item.- Returns:
- an index into
IDexUnit.getDexEntries()(of the owner , or -1 if unknown or not defined
-
getDexFileIndex
default int getDexFileIndex()Deprecated. -
getInstructionsOffset
int getInstructionsOffset()Get the Dex file offset where the bytecode for the method starts.- Returns:
- the bytecode offset in bytes, that is, the absolute entry point of the associated method
-
getInstructionsSize
int getInstructionsSize()Get the size of the method's bytecode, in bytes.- Returns:
- the bytecode size in bytes
-
hasParsingErrors
boolean hasParsingErrors()Determine whether the method's bytecode was successfully parsed.- Returns:
- true if parsing errors occurred
-
getParsingErrors
List<DalvikParserError> getParsingErrors()Retrieve the list of parsing errors, if any.- Returns:
- a list
-
getInstructions
List<? extends IDalvikInstruction> getInstructions()Get the list of parsed bytecode instructions, ordered by ascending offset.This method provides the original array of instructions, not a copy. The caller should not try to modify it.
- Returns:
- the list of method instructions
-
getInstruction
Get the instruction at the provided index.- Parameters:
index-- Returns:
-
getInstructionAt
Get the instruction at the provided byte offset in the method.- Parameters:
offsetInMethod- method's code offset in byte- Returns:
- an instruction or null
-
getControlFlowGraph
CFG<IDalvikInstruction> getControlFlowGraph()Returns the CFG for this method. It may be null if the parser did not produce a control flow graph.- Returns:
-
getGaps
Retrieve the gaps in the method's bytecode. The gaps are areas within the bytecode that are not directly used as instruction as pseudo-instruction's data (switch or array data).- Returns:
- a dictionary of offset (0-based) to the gap bytes
-
getDexEntryIndex()