public class BytecodeInstruction extends ASMWrapper implements Serializable, Comparable<BytecodeInstruction>
| Modifier and Type | Field and Description |
|---|---|
protected int |
bytecodeOffset |
protected ClassLoader |
classLoader |
protected String |
className |
protected int |
instructionId |
protected String |
methodName |
asmNode, frame| Constructor and Description |
|---|
BytecodeInstruction(BytecodeInstruction wrap)
Can represent any byteCode instruction
|
BytecodeInstruction(ClassLoader classLoader,
String className,
String methodName,
int instructionId,
int bytecodeOffset,
org.objectweb.asm.tree.AbstractInsnNode asmNode)
Generates a ByteCodeInstruction instance that represents a byteCode
instruction as indicated by the given ASMNode in the given method and
class
|
BytecodeInstruction(ClassLoader classLoader,
String className,
String methodName,
int instructionId,
int bytecodeOffset,
org.objectweb.asm.tree.AbstractInsnNode asmNode,
int lineNumber)
Constructor for BytecodeInstruction.
|
BytecodeInstruction(ClassLoader classLoader,
String className,
String methodName,
int instructionId,
int bytecodeOffset,
org.objectweb.asm.tree.AbstractInsnNode asmNode,
int lineNumber,
BasicBlock basicBlock)
Constructor for BytecodeInstruction.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canBeExitPoint()
canBeExitPoint
|
boolean |
canBeInstrumented()
canBeInstrumented
|
int |
compareTo(BytecodeInstruction o) |
boolean |
equals(Object obj) |
String |
explain()
explain
|
ActualControlFlowGraph |
getActualCFG()
Returns the ActualControlFlowGraph of this instructions method
Convenience method.
|
String |
getASMNodeString()
getASMNodeString
|
BasicBlock |
getBasicBlock()
Return's the BasicBlock that contain's this instruction in it's CFG.
|
boolean |
getBranchExpressionValue(Branch b)
getBranchExpressionValue
|
int |
getBytecodeOffset()
getBytecodeOffset
|
RawControlFlowGraph |
getCalledCFG()
Returns the RawCFG of the method called by this instruction
|
ControlDependenceGraph |
getCDG()
Returns the ControlDependenceGraph of this instructions method
Convenience method.
|
int |
getCDGDepth()
getCDGDepth
|
String |
getClassName()
Getter for the field
className. |
Set<ControlDependency> |
getControlDependencies()
Returns a cfg.Branch object for each branch this instruction is control
dependent on as determined by the ControlDependenceGraph.
|
ControlDependency |
getControlDependency(Branch branch)
getControlDependency
|
Branch |
getControlDependentBranch()
This method returns a random Branch among all Branches this instruction
is control dependent on
If this instruction is only dependent on the root branch, this method
returns null
Since EvoSuite was previously unable to detect multiple control
dependencies for one instruction this method serves as a backwards
compatibility bridge
|
boolean |
getControlDependentBranchExpressionValue()
This method returns the branchExpressionValue from a random Branch among
all Branches this instruction is control dependent on.
|
int |
getControlDependentBranchId()
This method returns a random branchId among all branchIds this
instruction is control dependent on.
|
Set<Integer> |
getControlDependentBranchIds()
Returns all branchIds of Branches this instruction is directly control
dependent on as determined by the ControlDependenceGraph for this
instruction's method.
|
String |
getFieldMethodCallName()
Determines the name of the field variable this method call is invoked on
This is done using the getSourceOfMethodInvocationInstruction() method
and returning its variable name
|
int |
getInstructionId()
getInstructionId
|
int |
getLineNumber()
getLineNumber
|
String |
getMethodName()
getMethodName
|
String |
getName()
getName
|
RawControlFlowGraph |
getRawCFG()
Returns the RawControlFlowGraph of this instructions method
Convenience method.
|
BytecodeInstruction |
getSourceOfArrayReference()
If this instruction is an array instruction this method will return the
BytecodeInstruction that loaded the reference of the array onto the
stack.
|
BytecodeInstruction |
getSourceOfMethodInvocationInstruction()
If this is a method call instruction this method will return the
instruction that loaded the reference of the Object the method is invoked
onto the stack.
|
BytecodeInstruction |
getSourceOfStackInstruction(int positionFromTop)
This method returns the BytecodeInstruction that loaded the reference
which is located on top of the stack minus positionFromTop when this
instruction is executed.
|
boolean |
hasBasicBlockSet()
Checks whether this instance's basicBlock has already been set by the CFG
or
|
int |
hashCode() |
boolean |
hasLineNumberSet()
At first, if this instruction constitutes a line number instruction this
method tries to retrieve the lineNumber from the underlying asmNode and
set the lineNumber field to the value given by the asmNode.
|
boolean |
isCallToPublicMethod()
isCallToPublicMethod
|
boolean |
isCallToStaticMethod()
isCallToStaticMethod
|
boolean |
isDirectlyControlDependentOn(Branch branch)
Determines whether this BytecodeInstruction is directly control dependent
on the given Branch.
|
boolean |
isFieldMethodCallDefinition() |
boolean |
isFieldMethodCallUse() |
boolean |
isLastInstructionInMethod()
isLastInstructionInMethod
|
boolean |
isMethodCallOfField()
Determines whether this instruction calls a method on a field variable
This is done using the getSourceOfMethodInvocationInstruction() method
and checking if the return of that method is a field use instruction
|
boolean |
isMethodCallOnSameObject()
Determines whether this instruction calls a method on its own Object
('this')
This is done using the getSourceOfMethodInvocationInstruction() method
and checking if the return of that method loads this using loadsReferenceToThis()
|
boolean |
isRootBranchDependent()
Determines whether or not this instruction is control dependent on the
root branch of it's method by calling getControlDependentBranchIds() to
see if the return contains -1.
|
boolean |
isWithinConstructor()
isWithinConstructor
|
void |
printFrameInformation()
printFrameInformation
|
boolean |
proceedsOwnConstructorInvocation()
proceedsOwnConstructorInvocation
|
void |
setBasicBlock(BasicBlock block)
Once the CFG has been asked for this instruction's BasicBlock it sets
this instance's internal basicBlock field.
|
void |
setCFGFrame(CFGFrame frame)
setCFGFrame
|
void |
setLineNumber(int lineNumber)
Setter for the field
lineNumber. |
Branch |
toBranch()
Convenience method:
If this instruction is known by the BranchPool to be a Branch, you can
call this method in order to retrieve the corresponding Branch object
registered within the BranchPool.
|
String |
toString() |
canReturnFromMethod, getArrayVariableName, getASMNode, getCalledMethod, getCalledMethodName, getCalledMethodsArgumentCount, getCalledMethodsClass, getFieldName, getFieldSimpleName, getFieldType, getInstructionType, getLocalVariableName, getLocalVariableSlot, getMethodCallDescriptor, getType, getVariableName, isActualBranch, isArrayLoadInstruction, isArrayStoreInstruction, isBranch, isBranchLabel, isConstant, isConstructorInvocation, isConstructorInvocation, isDefinition, isDefinitionForVariable, isDefUse, isFieldArrayDefinition, isFieldDefinition, isFieldDU, isFieldNodeDefinition, isFieldNodeDU, isFieldNodeUse, isFieldUse, isFrame, isGoto, isIfNull, isIINC, isInvokeSpecial, isInvokeStatic, isJump, isLabel, isLineNumber, isLoadConstant, isLocalArrayDefinition, isLocalDU, isLocalVariableDefinition, isLocalVariableUse, isLookupSwitch, isMethodCall, isMethodCallForClass, isReturn, isStaticArrayUsage, isStaticDefUse, isSwitch, isTableSwitch, isThrow, isUse, loadsReferenceToThis, sanityCheckAbstractInsnNodeprotected ClassLoader classLoader
protected String className
protected String methodName
protected int instructionId
protected int bytecodeOffset
public BytecodeInstruction(ClassLoader classLoader, String className, String methodName, int instructionId, int bytecodeOffset, org.objectweb.asm.tree.AbstractInsnNode asmNode)
public BytecodeInstruction(BytecodeInstruction wrap)
wrap - a BytecodeInstruction object.public BytecodeInstruction(ClassLoader classLoader, String className, String methodName, int instructionId, int bytecodeOffset, org.objectweb.asm.tree.AbstractInsnNode asmNode, int lineNumber, BasicBlock basicBlock)
Constructor for BytecodeInstruction.
className - a String object.methodName - a String object.instructionId - a int.bytecodeOffset - a int.asmNode - a AbstractInsnNode object.lineNumber - a int.basicBlock - a BasicBlock object.public BytecodeInstruction(ClassLoader classLoader, String className, String methodName, int instructionId, int bytecodeOffset, org.objectweb.asm.tree.AbstractInsnNode asmNode, int lineNumber)
Constructor for BytecodeInstruction.
public void setCFGFrame(CFGFrame frame)
setCFGFrame
frame - a CFGFrame object.public int getInstructionId()
getInstructionId
getInstructionId in class ASMWrapperpublic int getBytecodeOffset()
getBytecodeOffset
public String getMethodName()
getMethodName
getMethodName in class ASMWrapperString object.public String getClassName()
Getter for the field className.
getClassName in class ASMWrapperString object.public BasicBlock getBasicBlock()
BasicBlock object.public void setBasicBlock(BasicBlock block)
block - a BasicBlock object.public boolean hasBasicBlockSet()
public int getLineNumber()
getLineNumber
getLineNumber in class ASMWrapperpublic void setLineNumber(int lineNumber)
Setter for the field lineNumber.
lineNumber - a int.public boolean hasLineNumberSet()
public ActualControlFlowGraph getActualCFG()
ActualControlFlowGraph object.public RawControlFlowGraph getRawCFG()
getRawCFG in class ASMWrapperRawControlFlowGraph object.public ControlDependenceGraph getCDG()
ControlDependenceGraph object.public Set<ControlDependency> getControlDependencies()
Set object.public Branch getControlDependentBranch()
Branch object.public Set<Integer> getControlDependentBranchIds()
Set object.public boolean isRootBranchDependent()
public int getControlDependentBranchId()
public boolean getControlDependentBranchExpressionValue()
public boolean getBranchExpressionValue(Branch b)
getBranchExpressionValue
b - a Branch object.public boolean isDirectlyControlDependentOn(Branch branch)
branch - a Branch object.public ControlDependency getControlDependency(Branch branch)
getControlDependency
branch - a Branch object.ControlDependency object.public int getCDGDepth()
getCDGDepth
public void printFrameInformation()
printFrameInformation
public Branch toBranch()
Branch object.public boolean proceedsOwnConstructorInvocation()
proceedsOwnConstructorInvocation
public boolean isWithinConstructor()
isWithinConstructor
public boolean isLastInstructionInMethod()
isLastInstructionInMethod
public boolean canBeExitPoint()
canBeExitPoint
public RawControlFlowGraph getCalledCFG()
RawControlFlowGraph object.public boolean isMethodCallOnSameObject()
public boolean isMethodCallOfField()
isMethodCallOfField in class ASMWrapperpublic String getFieldMethodCallName()
getFieldMethodCallName in class ASMWrapperString object.public BytecodeInstruction getSourceOfMethodInvocationInstruction()
public BytecodeInstruction getSourceOfArrayReference()
getSourceOfArrayReference in class ASMWrapperpublic BytecodeInstruction getSourceOfStackInstruction(int positionFromTop)
public boolean isFieldMethodCallDefinition()
isFieldMethodCallDefinition in class ASMWrapperpublic boolean isFieldMethodCallUse()
isFieldMethodCallUse in class ASMWrapperpublic boolean isCallToPublicMethod()
isCallToPublicMethod
public boolean isCallToStaticMethod()
isCallToStaticMethod
public boolean canBeInstrumented()
canBeInstrumented
public int compareTo(BytecodeInstruction o)
compareTo in interface Comparable<BytecodeInstruction>Copyright © 2010–2017 EvoSuite. All rights reserved.