com.pnfsoftware.jeb.core.units.code.IInstruction |
Known Indirect Subclasses
AbstractInstruction<T extends IInstructionOperand>,
AddressableInstruction<InsnType extends IInstruction>,
IDInstruction,
IDalvikInstruction,
IEAssign,
IECall,
IEJump,
IEJumpFar,
IEJumpWithOptionalCondition,
IENop,
IEReturn,
IEStatement,
IESwitch,
IEUntranslatedInstruction,
ILocatedInstruction,
IResizableInstruction
|
A generic interface to represent machine-code or bytecode instructions. Note that this interface does not specify an address or offset for the instruction.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract boolean |
canThrow()
Determine if the instruction can throw an exception.
| ||||||||||
abstract IFlowInformation |
collectIndirectCallReferences(long instructionAddress)
Collect the list of dereferenced addresses computed by a call-to-sub instruction.
| ||||||||||
abstract String |
format(Object context)
Format the instruction for printing
| ||||||||||
abstract ACS | getACS() | ||||||||||
abstract IFlowInformation |
getBreakingFlow(long instructionAddress)
Determine if an instruction breaks the flow of execution.
| ||||||||||
abstract byte[] |
getCode()
Get the binary code that makes up this instruction.
| ||||||||||
abstract int | getCountOfOperands() | ||||||||||
abstract void |
getDefUse(List<Integer> def, List<Integer> use, Object context)
Determine the variables defined and used by the instruction.
| ||||||||||
abstract void |
getDefUse(List<Integer> def, List<Integer> use)
Determine the variables defined and used by the instruction.
| ||||||||||
abstract DefUseInfo |
getDefUseInfo(long instructionAddress, int flags)
Determine the variables defined and used by the instruction.
| ||||||||||
abstract Collection<InstructionFlags> | getInstructionFlags() | ||||||||||
abstract String |
getMnemonic()
The instruction mnemonic.
| ||||||||||
abstract IInstructionOperand |
getOperand(int index)
Get an operand by index.
| ||||||||||
abstract IInstructionOperand[] |
getOperands()
Get the list of operands for this instruction.
| ||||||||||
abstract String |
getPrefix()
Get the instruction's optional prefix(es).
| ||||||||||
abstract long |
getPrimaryBranchAddress(long instructionAddress)
Convenience method used to retrieve the primary target of this branching instruction.
| ||||||||||
abstract int |
getProcessorMode()
Get the mode the processor was in when it parsed and created this instruction.
| ||||||||||
abstract IFlowInformation |
getRoutineCall(long instructionAddress)
Determine if an instruction branches to (or calls into) a sub-routine.
| ||||||||||
abstract int |
getSize()
Get the instruction size in bytes.
|
Determine if the instruction can throw an exception.
Collect the list of dereferenced addresses computed by a call-to-sub instruction. This method
should not be confused with getRoutineCall(long)
.
instructionAddress | the address of the current instruction |
---|
isBroken()
is true if the instruction indirectly calls into
a sub-routine, false otherwise (in particular for direct routine calls); if
true, the getTargets()
may be filled with the dereferenced
addresses, else its contents is irrelevant
Format the instruction for printing
context | optional context, used to provide a better representation of the instruction (for instance, resolving strings or method names.) The implementor should do its best to return a decent result even if context is null. |
---|
Determine if an instruction breaks the flow of execution.
Examples: jump instructions, conditional jumps, return-to-caller instructions, etc.
Sub-routine calls should not be regarded as flow-breakers by this method. Refer to
getRoutineCall
.
instructionAddress | the address of the current instruction |
---|
isBroken()
is true if the instruction breaks the current
flow of execution (sub-routine call instructions are excluded) , false otherwise; if
true, getTargets()
may be filled with potential addresses,
and the first entry should be the fall-through instruction, if there is any
Get the binary code that makes up this instruction.
Determine the variables defined and used by the instruction.
def | output, the list of variables defined by the instruction. |
---|---|
use | output, the list of variables used by the instruction |
context | optional context (implementation specific) |
Determine the variables defined and used by the instruction.
def | output, the list of variables defined by the instruction. |
---|---|
use | output, the list of variables used by the instruction |
Determine the variables defined and used by the instruction. This method is an extended
version of getDefUse(List, List, Object)
.@return
instructionAddress | address of the instruction |
---|---|
flags | see DefUseInfo.XXX static final flags |
NotImplementedException |
---|
The instruction mnemonic.
Get the list of operands for this instruction.
Get the instruction's optional prefix(es).
Convenience method used to retrieve the primary target of this branching instruction. If the instruction is not branching, or if the target cannot be determined, -1 is returned. If the instruction has multiple branches, only one is returned.
instructionAddress | the address of the current instruction |
---|
Get the mode the processor was in when it parsed and created this instruction. Refer to
IProcessor
MODE_xxx
.
Determine if an instruction branches to (or calls into) a sub-routine.
Under normal circumstances, those instructions save the return address (e.g., on a stack or
in a register). Therefore, the fall-through address is implied and should not be returned by
getTargets()
. The list of targets should contain the branch address
- or addresses, for example if the processor branching instruction allows branch selection.
instructionAddress | the address of the current instruction |
---|
isBroken()
is true if the instruction calls into a
sub-routine, false otherwise; if true, getTargets()
may be
filled, else its contents is irrelevant
Get the instruction size in bytes.