public abstract class AbstractAndroidModel
extends java.lang.Object
Overload this class to change the structure of the model. When the model is being built the enterLABEL-functions are called when ever a label gets stepped over.
You can then add instructions to the body using the insts-Instruction factory. Instructions don't have to be in ascending order. Instead they will be sorted by their IIndex once the model gets finished.
If you want to add loops to the model you might want to have a look at AndroidModelParameterManager which aids in keeping track of SSA-Variables and adding Phi-Functions.
AndroidEntryPoint.ExecutionOrder,
AndroidModelParameterManager| Modifier and Type | Field and Description |
|---|---|
protected com.ibm.wala.ipa.summaries.VolatileMethodSummary |
body |
protected java.lang.Iterable<? extends com.ibm.wala.ipa.callgraph.Entrypoint> |
entryPoints |
protected com.ibm.wala.util.ssa.TypeSafeInstructionFactory |
insts |
protected com.ibm.wala.util.ssa.SSAValueManager |
paramManager |
| Constructor and Description |
|---|
AbstractAndroidModel(com.ibm.wala.ipa.summaries.VolatileMethodSummary body,
com.ibm.wala.util.ssa.TypeSafeInstructionFactory insts,
com.ibm.wala.util.ssa.SSAValueManager paramManager,
java.lang.Iterable<? extends com.ibm.wala.ipa.callgraph.Entrypoint> entryPoints)
If you don't intend to use the paramManager, you can pass null.
|
| Modifier and Type | Method and Description |
|---|---|
int |
enter(AndroidEntryPoint.ExecutionOrder section,
int PC)
Dispatches to the enterLABEL-functions.
|
protected int |
enterAFTER_LOOP(int PC)
Gets called when Label ExecutionOrder.AFTER_LOOP got stepped over.
|
protected int |
enterAT_FIRST(int PC)
Gets called when Label ExecutionOrder.AT_FIRST got stepped over.
|
protected int |
enterAT_LAST(int PC)
Gets called when Label ExecutionOrder.AT_LAST got stepped over.
|
protected int |
enterBEFORE_LOOP(int PC)
Gets called when Label ExecutionOrder.BEFORE_LOOP got stepped over.
|
protected int |
enterEND_OF_LOOP(int PC)
Gets called when Label ExecutionOrder.END_OF_LOOP got stepped over.
|
protected int |
enterMIDDLE_OF_LOOP(int PC)
Gets called when Label ExecutionOrder.MIDDLE_OF_LOOP got stepped over.
|
protected int |
enterMULTIPLE_TIMES_IN_LOOP(int PC)
Gets called when Label ExecutionOrder.MULTIPLE_TIMES_IN_LOOP got stepped over.
|
protected int |
enterSTART_OF_LOOP(int PC)
Gets called when Label ExecutionOrder.START_OF_LOOP got stepped over.
|
int |
finish(int PC)
Calls all remaining enterLABEL-functions, finally calls leaveAT_LAST.
|
boolean |
hadSectionSwitch(AndroidEntryPoint.IExecutionOrder order)
Determines for an AndroidEntryPoint if a label got skipped over.
|
protected int |
leaveAT_LAST(int PC)
Gets called when the model gets finished.
|
protected java.util.List<com.ibm.wala.types.TypeReference> |
returnTypesBetween(AndroidEntryPoint.IExecutionOrder start,
AndroidEntryPoint.IExecutionOrder end)
Return a List of all Types returned by functions between start (inclusive) and end (exclusive).
|
protected com.ibm.wala.ipa.summaries.VolatileMethodSummary body
protected com.ibm.wala.util.ssa.TypeSafeInstructionFactory insts
protected com.ibm.wala.util.ssa.SSAValueManager paramManager
protected java.lang.Iterable<? extends com.ibm.wala.ipa.callgraph.Entrypoint> entryPoints
public AbstractAndroidModel(com.ibm.wala.ipa.summaries.VolatileMethodSummary body,
com.ibm.wala.util.ssa.TypeSafeInstructionFactory insts,
com.ibm.wala.util.ssa.SSAValueManager paramManager,
java.lang.Iterable<? extends com.ibm.wala.ipa.callgraph.Entrypoint> entryPoints)
body - The MethodSummary to add instructions toinsts - Will be used to generate the instructionsparamManager - aids in handling SSA-ValuesentryPoints - This iterable has to contain only instances of AnroidEntryPoint.protected java.util.List<com.ibm.wala.types.TypeReference> returnTypesBetween(AndroidEntryPoint.IExecutionOrder start, AndroidEntryPoint.IExecutionOrder end)
java.lang.IllegalArgumentException - if an EntryPoint was not an AndroidEntryPointpublic final boolean hadSectionSwitch(AndroidEntryPoint.IExecutionOrder order)
If a label got skipped over special handling code has to be inserted before the entrypoints invocation.
This function is expected to be called on entrypoints in ascending order.
You are expected to call enter(com.ibm.wala.dalvik.ipa.callgraph.impl.AndroidEntryPoint.ExecutionOrder, int) iff a
Label got skipped over.
order - The entrypoint in questionjava.lang.IllegalArgumentException - If the entrypoints weren't in ascending orderjava.lang.IllegalStateException - if you didn't call enter()protected int enterAT_FIRST(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.AT_FIRST, int) instead.
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int enterBEFORE_LOOP(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.BEFORE_LOOP, int) instead
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int enterSTART_OF_LOOP(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.START_OF_LOOP, int) instead
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int enterMIDDLE_OF_LOOP(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.MIDDLE_OF_LOOP, int) instead
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int enterMULTIPLE_TIMES_IN_LOOP(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.MULTIPLE_TIMES_IN_LOOP, int) instead
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int enterEND_OF_LOOP(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.END_OF_LOOP, int) instead
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int enterAFTER_LOOP(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.AFTER_LOOP, int) instead
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int enterAT_LAST(int PC)
In most cases you don't want to invoke this function directly but to use enter(ExecutionOrder.AT_LAST, int) instead
Sideeffects: currentSection is updated, instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()protected int leaveAT_LAST(int PC)
In most cases you don't want to invoke this function directly but to use finish(int) instead
Sideeffects: instructions are inserted into the body
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()public int enter(AndroidEntryPoint.ExecutionOrder section, int PC)
section - The Section to enterPC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()java.lang.IllegalArgumentException - if you didn't use sections in ascending order, pc is negativepublic int finish(int PC)
Then Locks the model and frees some memory.
PC - Program Counter instructions shall be placed at. In most cases you'll simply pass
body.getNextProgramCounter()java.lang.IllegalStateException - if called on an empty model