public abstract class BaseEntryPointCreator extends Object implements IEntryPointCreator
| 限定符和类型 | 字段和说明 |
|---|---|
protected soot.Body |
body |
protected int |
conditionCounter |
protected String |
dummyClassName
Default name of the class containing the dummy main method
|
protected String |
dummyMethodName
Default name of the dummy main method
|
protected soot.LocalGenerator |
generator |
protected soot.Value |
intCounter |
protected Map<soot.SootClass,soot.Local> |
localVarsForClasses |
protected org.slf4j.Logger |
logger |
protected soot.SootMethod |
mainMethod |
protected boolean |
overwriteDummyMainMethod |
protected boolean |
shallowMode |
protected boolean |
warnOnConstructorLoop |
| 构造器和说明 |
|---|
BaseEntryPointCreator() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected boolean |
acceptClass(soot.SootClass clazz)
Determines whether a class is accepted for generating a constructor.
|
protected soot.jimple.Stmt |
buildMethodCall(soot.SootMethod methodToCall,
soot.Local classLocal)
Builds a new invocation statement that invokes the given method
|
protected soot.jimple.Stmt |
buildMethodCall(soot.SootMethod methodToCall,
soot.Local classLocal,
Set<soot.SootClass> parentClasses)
Builds a new invocation statement that invokes the given method
|
protected void |
createAdditionalFields()
Creates additional fields in the entry point class that are required by the
dummy main method
|
protected void |
createAdditionalMethods()
Creates additional methods in the entry point class that are required by the
dummy main method
|
soot.SootMethod |
createDummyMain()
Generates a dummy main method that calls all methods in the given list
|
protected abstract soot.SootMethod |
createDummyMainInternal()
Implementors need to overwrite this method for providing the actual dummy
main method
|
protected void |
createEmptyMainMethod()
Creates a new, empty main method containing the given body
|
protected void |
createIfStmt(soot.Unit target)
Creates an opaque predicate that jumps to the given target
|
protected void |
eliminateSelfLoops()
Eliminates all loops of length 0 (if a goto
|
protected soot.SootMethod |
findMethod(soot.SootClass currentClass,
String subsignature)
Finds a method with the given signature in the given class or one of its
super classes
|
protected soot.Local |
generateClassConstructor(soot.SootClass createdClass)
Generates code which creates a new instance of the given class.
|
protected soot.Local |
generateClassConstructor(soot.SootClass createdClass,
Set<soot.SootClass> parentClasses)
Generates code which creates a new instance of the given class.
|
protected soot.Local |
generateClassConstructor(soot.SootClass createdClass,
Set<soot.SootClass> constructionStack,
Set<soot.SootClass> parentClasses,
Set<soot.Local> tempLocals)
Generates code which creates a new instance of the given class.
|
Set<soot.SootClass> |
getFailedClasses()
Returns a copy of all classes that could not be instantiated properly
|
Set<soot.SootMethod> |
getFailedMethods()
Returns all methods from from methodsToCall, where no call was possible
|
soot.SootMethod |
getGeneratedMainMethod()
Gets the last dummy main method that was generated by this creator
|
protected String |
getNonCollidingFieldName(String baseName)
Gets a field name that is not already in use by some field
|
protected soot.SootClass |
getOrCreateDummyMainClass()
Gets the class that contains the dummy main method.
|
boolean |
getOverwriteDummyMainMethod()
Gets whether the dummy main method shall be overwritten if it already exists.
|
boolean |
getShallowMode()
Gets whether shallow mode shall be used.
|
protected soot.Value |
getSimpleDefaultValue(soot.Type t) |
protected soot.Type |
getSimpleTypeFromType(soot.Type type) |
protected soot.Value |
getValueForType(soot.Type tp,
Set<soot.SootClass> constructionStack,
Set<soot.SootClass> parentClasses)
Creates a value of the given type to be used as a substitution in method
invocations or fields
|
protected soot.Value |
getValueForType(soot.Type tp,
Set<soot.SootClass> constructionStack,
Set<soot.SootClass> parentClasses,
Set<soot.Local> generatedLocals)
Creates a value of the given type to be used as a substitution in method
invocations or fields
|
boolean |
getWarnOnConstructorLoop()
Gets whether a warning shall be written to the log when a constructor call
cannot be generated because the analysis ran into a loop when trying to
generate parameter values.
|
protected boolean |
isCompatible(soot.SootClass actual,
soot.SootClass expected)
Checks whether an object of type "actual" can be inserted where an object of
type "expected" is required.
|
protected static boolean |
isSimpleType(String t) |
protected void |
reset()
Resets the internal state to make sure that the entry point creator is
re-usable.
|
void |
setAllowNonPublicConstructors(boolean allowNonPublicConstructors)
Sets whether the entry point creator may use private or protected
constructors in order to generate a class instance in the dummyMain method.
|
void |
setAllowSelfReferences(boolean value)
Sets whether a call to a method A.foo() may receive an instance of A as a
parameter.
|
void |
setDummyClassName(String dummyClassName)
Sets the name that shall be used for the new class containing the dummy main
method
|
void |
setDummyMethodName(String dummyMethodName)
Sets the name that shall be used for the new dummy main method
|
void |
setIgnoreSystemClassParams(boolean ignoreSystemClassParams)
Sets whether the entry point creator shall always pass "null" if a method
expects an object of a system class.
|
void |
setOverwriteDummyMainMethod(boolean overwriteDummyMainValue)
Sets whether the dummy main method shall be overwritten if it already exists.
|
void |
setShallowMode(boolean shallowMode)
Sets whether shallow mode shall be used.
|
void |
setSubstituteCallParams(boolean b)
with this option enabled the EntryPointCreator tries to find suitable
subclasses of abstract classes and implementers of interfaces
|
void |
setSubstituteClasses(List<String> l)
set classes that are allowed to substitute (otherwise constructor loops are
very likely)
|
void |
setWarnOnConstructorLoop(boolean warnOnConstructorLoop)
Sets whether a warning shall be written to the log when a constructor call
cannot be generated because the analysis ran into a loop when trying to
generate parameter values.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAdditionalFields, getAdditionalMethods, getRequiredClassesprotected final org.slf4j.Logger logger
protected Map<soot.SootClass,soot.Local> localVarsForClasses
protected String dummyClassName
protected String dummyMethodName
protected boolean shallowMode
protected boolean overwriteDummyMainMethod
protected boolean warnOnConstructorLoop
protected soot.Value intCounter
protected int conditionCounter
protected soot.SootMethod mainMethod
protected soot.Body body
protected soot.LocalGenerator generator
public Set<soot.SootClass> getFailedClasses()
public Set<soot.SootMethod> getFailedMethods()
public void setSubstituteCallParams(boolean b)
IEntryPointCreatorsetSubstituteCallParams 在接口中 IEntryPointCreatorb - sets substitution of call parameterspublic void setSubstituteClasses(List<String> l)
IEntryPointCreatorsetSubstituteClasses 在接口中 IEntryPointCreatorpublic soot.SootMethod createDummyMain()
IEntryPointCreatorcreateDummyMain 在接口中 IEntryPointCreatorprotected abstract soot.SootMethod createDummyMainInternal()
protected soot.SootClass getOrCreateDummyMainClass()
protected void createEmptyMainMethod()
protected void createAdditionalFields()
protected void createAdditionalMethods()
protected String getNonCollidingFieldName(String baseName)
baseName - The base name, i.e., prefix of the new fieldprotected soot.jimple.Stmt buildMethodCall(soot.SootMethod methodToCall,
soot.Local classLocal)
methodToCall - The method to callclassLocal - The local containing an instance of the class on which to
invoke the methodprotected soot.jimple.Stmt buildMethodCall(soot.SootMethod methodToCall,
soot.Local classLocal,
Set<soot.SootClass> parentClasses)
methodToCall - The method to callclassLocal - The local containing an instance of the class on which
to invoke the methodparentClasses - The classes for which we already have instances that
shall be reusedprotected soot.Value getValueForType(soot.Type tp,
Set<soot.SootClass> constructionStack,
Set<soot.SootClass> parentClasses)
tp - The type for which to get a valueconstructionStack - The set of classes we're currently constructing.
Attempts to create a parameter of one of these
classes will trigger the constructor loop check and
the respective parameter will be substituted by
null.parentClasses - If the given type is compatible with one of the
types in this list, the already-created object is
used instead of creating a new one.protected soot.Value getValueForType(soot.Type tp,
Set<soot.SootClass> constructionStack,
Set<soot.SootClass> parentClasses,
Set<soot.Local> generatedLocals)
tp - The type for which to get a valueconstructionStack - The set of classes we're currently constructing.
Attempts to create a parameter of one of these
classes will trigger the constructor loop check and
the respective parameter will be substituted by
null.parentClasses - If the given type is compatible with one of the
types in this list, the already-created object is
used instead of creating a new one.generatedLocals - The set that receives all (temporary) locals created
to provide a value of the requested typeprotected soot.Local generateClassConstructor(soot.SootClass createdClass)
createdClass - The class of which to create an instanceprotected soot.Local generateClassConstructor(soot.SootClass createdClass,
Set<soot.SootClass> parentClasses)
createdClass - The class of which to create an instanceparentClasses - If a constructor call requires an object of a type which
is compatible with one of the types in this list, the
already-created object is used instead of creating a new
one.protected boolean acceptClass(soot.SootClass clazz)
clazz - The class of which to create an instanceprotected soot.Local generateClassConstructor(soot.SootClass createdClass,
Set<soot.SootClass> constructionStack,
Set<soot.SootClass> parentClasses,
Set<soot.Local> tempLocals)
allowNonPublicConstructors is true, private or protected
constructors may be used.createdClass - The class of which to create an instanceconstructionStack - The stack of classes currently under construction.
This is used to detect constructor loops. If a
constructor requires a parameter of a type that is
already on the stack, this value is substituted by
null.parentClasses - If a constructor call requires an object of a type
which is compatible with one of the types in this
list, the already-created object is used instead of
creating a new one.tempLocals - The set that receives all generated temporary locals
that were necessary for calling the constructor of
the requested classprotected soot.Type getSimpleTypeFromType(soot.Type type)
protected static boolean isSimpleType(String t)
protected soot.Value getSimpleDefaultValue(soot.Type t)
protected soot.SootMethod findMethod(soot.SootClass currentClass,
String subsignature)
currentClass - The current class in which to start the searchsubsignature - The subsignature of the method to findprotected boolean isCompatible(soot.SootClass actual,
soot.SootClass expected)
actual - The actual type (the substitution candidate)expected - The requested typeprotected void eliminateSelfLoops()
public void setDummyClassName(String dummyClassName)
dummyMethodName - The name for the new class containing the dummy main
methodpublic void setDummyMethodName(String dummyMethodName)
dummyMethodName - The name for the new dummy main methodpublic void setAllowSelfReferences(boolean value)
value - True if method calls may receive instances of their containing
class as parameter values, otherwise falsepublic void setShallowMode(boolean shallowMode)
shallowMode - True if shallow mode shall be used, otherwise falsepublic boolean getShallowMode()
public void setIgnoreSystemClassParams(boolean ignoreSystemClassParams)
ignoreSystemClassParams - public void setAllowNonPublicConstructors(boolean allowNonPublicConstructors)
allowNonPublicConstructors - public void setOverwriteDummyMainMethod(boolean overwriteDummyMainValue)
reuseDummyMainValue - True if existing methods that conflict with the
entry point to be created shall be overwritten,
false to automatically chose a new,
non-conflicting name.public boolean getOverwriteDummyMainMethod()
public void setWarnOnConstructorLoop(boolean warnOnConstructorLoop)
warnOnConstructorLoop - True if a warning shall be written to the log
when a constructor generation loop is
encountered, otherwise falsepublic boolean getWarnOnConstructorLoop()
protected void reset()
protected void createIfStmt(soot.Unit target)
target - The target to which the opaque predicate shall jumppublic soot.SootMethod getGeneratedMainMethod()
IEntryPointCreatorgetGeneratedMainMethod 在接口中 IEntryPointCreatorCopyright © 2022 Fraunhofer SIT. All rights reserved.