public abstract class AbstractAndroidModel extends Object
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
,
DexFakeRootMethod
,
AndroidModelParameterManager
Modifier and Type | Field and Description |
---|---|
protected VolatileMethodSummary |
body |
protected Iterable<? extends Entrypoint> |
entryPoints |
protected TypeSafeInstructionFactory |
insts |
protected SSAValueManager |
paramManager |
Constructor and Description |
---|
AbstractAndroidModel(VolatileMethodSummary body,
TypeSafeInstructionFactory insts,
SSAValueManager paramManager,
Iterable<? extends 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 List<TypeReference> |
returnTypesBetween(AndroidEntryPoint.IExecutionOrder start,
AndroidEntryPoint.IExecutionOrder end)
Return a List of all Types returned by functions between start (inclusive) and end (exclusive).
|
protected VolatileMethodSummary body
protected TypeSafeInstructionFactory insts
protected SSAValueManager paramManager
protected Iterable<? extends Entrypoint> entryPoints
public AbstractAndroidModel(VolatileMethodSummary body, TypeSafeInstructionFactory insts, SSAValueManager paramManager, Iterable<? extends 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 List<TypeReference> returnTypesBetween(AndroidEntryPoint.IExecutionOrder start, AndroidEntryPoint.IExecutionOrder end)
IllegalArgumentException
- if an EntryPoint was not an AndroidEntryPointpublic final boolean hadSectionSwitch(AndroidEntryPoint.IExecutionOrder order)
#enter(ExecutionOrder, int)
iff a
Label got skipped over.order
- The entrypoint in questionIllegalArgumentException
- If the entrypoints weren't in ascending orderIllegalStateException
- if you didn't call enter()protected int enterAT_FIRST(int PC)
#enter(ExecutionOrder.AT_FIRST, int)
instead.
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int enterBEFORE_LOOP(int PC)
#enter(ExecutionOrder.BEFORE_LOOP, int)
instead
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int enterSTART_OF_LOOP(int PC)
#enter(ExecutionOrder.START_OF_LOOP, int)
instead
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int enterMIDDLE_OF_LOOP(int PC)
#enter(ExecutionOrder.MIDDLE_OF_LOOP, int)
instead
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int enterMULTIPLE_TIMES_IN_LOOP(int PC)
#enter(ExecutionOrder.MULTIPLE_TIMES_IN_LOOP, int)
instead
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int enterEND_OF_LOOP(int PC)
#enter(ExecutionOrder.END_OF_LOOP, int)
instead
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int enterAFTER_LOOP(int PC)
#enter(ExecutionOrder.AFTER_LOOP, int)
instead
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int enterAT_LAST(int PC)
#enter(ExecutionOrder.AT_LAST, int)
instead
Sideeffects: currentSection is updated, instructions are inserted into the bodyPC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()protected int leaveAT_LAST(int PC)
finish(int)
instead
Sideeffects: instructions are inserted into the bodyPC
- 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()IllegalArgumentException
- if you didn't use sections in ascending order, pc is negativepublic int finish(int PC)
PC
- Program Counter instructions shall be placed at. In most cases
you'll simply pass body.getNextProgramCounter()IllegalStateException
- if called on an empty model