Package soot.dexpler
Class DexBody
- java.lang.Object
-
- soot.dexpler.DexBody
-
public class DexBody extends Object
A DexBody contains the code of a DexMethod and is used as a wrapper around JimpleBody in the jimplification process.- Author:
- Michael Markert, Frank Hartmann
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classDexBody.RegDbgEntryAn entry of debug information for a register from the dex file.
-
Field Summary
Fields Modifier and Type Field Description protected DanglingInstructiondanglingprotected RefTypedeclaringClassTypeprotected List<DeferableInstruction>deferredInstructionsprotected org.jf.dexlib2.iface.MultiDexContainer.DexEntry<? extends org.jf.dexlib2.iface.DexFile>dexEntryprotected TreeMap<Integer,DexlibAbstractInstruction>instructionAtAddressprotected List<DexlibAbstractInstruction>instructionsprotected Set<RetypeableInstruction>instructionsToRetypeprotected booleanisStaticprotected JimpleBodyjBodyprotected org.jf.dexlib2.iface.Methodmethodprotected intnumParameterRegistersprotected intnumRegistersprotected List<String>parameterNamesprotected List<Type>parameterTypesprotected List<PseudoInstruction>pseudoInstructionDataprotected Local[]registerLocalsprotected LocalstoreResultLocalprotected Set<String>takenLocalNamesprotected List<? extends org.jf.dexlib2.iface.TryBlock<? extends org.jf.dexlib2.iface.ExceptionHandler>>tries
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Unit u)Add unit to this body.voidaddDeferredJimplification(DeferableInstruction i)Add a deferred instruction to this body.voidaddRetype(RetypeableInstruction i)Add a retypeable instruction to this body.protected voidextractDexInstructions(org.jf.dexlib2.iface.MethodImplementation code)Extracts the list of dalvik instructions from dexlib and converts them into our own instruction data modelprotected voidfixLineNumbers()Fixes the line numbers.protected StringfreshLocalName(String hint)Allocate a fresh name for Jimple localBodygetBody()Return the associated JimpleBody.protected CopyPropagatorgetCopyPopagator()protected LocalSplittergetLocalSplitter()LocalgetRegisterLocal(int num)Return the Local that are associated with the number in the current register state.Local[]getRegisterLocals()Return the Locals that are associated with the current register state.LocalgetStoreResultLocal()protected UnreachableCodeEliminatorgetUnreachableCodeEliminator()DexlibAbstractInstructioninstructionAtAddress(int address)Return the instruction that is present at the byte code address.List<DexlibAbstractInstruction>instructionsAfter(DexlibAbstractInstruction instruction)Return the instructions that appear (lexically) after the given instruction.List<DexlibAbstractInstruction>instructionsBefore(DexlibAbstractInstruction instruction)Return the instructions that appear (lexically) before the given instruction.Bodyjimplify(Body b, SootMethod m)Return the jimple equivalent of this body.voidsetDanglingInstruction(DanglingInstruction i)Set a dangling instruction for this body.Set<Type>usedTypes()Return the types that are used in this body.
-
-
-
Field Detail
-
instructions
protected List<DexlibAbstractInstruction> instructions
-
registerLocals
protected Local[] registerLocals
-
storeResultLocal
protected Local storeResultLocal
-
instructionAtAddress
protected TreeMap<Integer,DexlibAbstractInstruction> instructionAtAddress
-
deferredInstructions
protected List<DeferableInstruction> deferredInstructions
-
instructionsToRetype
protected Set<RetypeableInstruction> instructionsToRetype
-
dangling
protected DanglingInstruction dangling
-
numRegisters
protected int numRegisters
-
numParameterRegisters
protected int numParameterRegisters
-
isStatic
protected boolean isStatic
-
jBody
protected JimpleBody jBody
-
tries
protected List<? extends org.jf.dexlib2.iface.TryBlock<? extends org.jf.dexlib2.iface.ExceptionHandler>> tries
-
declaringClassType
protected RefType declaringClassType
-
dexEntry
protected final org.jf.dexlib2.iface.MultiDexContainer.DexEntry<? extends org.jf.dexlib2.iface.DexFile> dexEntry
-
method
protected final org.jf.dexlib2.iface.Method method
-
pseudoInstructionData
protected List<PseudoInstruction> pseudoInstructionData
-
-
Constructor Detail
-
DexBody
protected DexBody(org.jf.dexlib2.iface.MultiDexContainer.DexEntry<? extends org.jf.dexlib2.iface.DexFile> dexFile, org.jf.dexlib2.iface.Method method, RefType declaringClassType)- Parameters:
code- the codeitem that is contained in this bodymethod- the method that is associated with this body
-
-
Method Detail
-
freshLocalName
protected String freshLocalName(String hint)
Allocate a fresh name for Jimple local- Parameters:
hint- A name that the fresh name will look like
-
extractDexInstructions
protected void extractDexInstructions(org.jf.dexlib2.iface.MethodImplementation code)
Extracts the list of dalvik instructions from dexlib and converts them into our own instruction data model- Parameters:
code- The dexlib method implementation
-
add
public void add(Unit u)
Add unit to this body.- Parameters:
u- Unit to add.
-
addDeferredJimplification
public void addDeferredJimplification(DeferableInstruction i)
Add a deferred instruction to this body.- Parameters:
i- the deferred instruction.
-
addRetype
public void addRetype(RetypeableInstruction i)
Add a retypeable instruction to this body.- Parameters:
i- the retypeable instruction.
-
getBody
public Body getBody()
Return the associated JimpleBody.- Throws:
RuntimeException- if no jimplification happened yet.
-
getRegisterLocals
public Local[] getRegisterLocals()
Return the Locals that are associated with the current register state.
-
getRegisterLocal
public Local getRegisterLocal(int num) throws InvalidDalvikBytecodeException
Return the Local that are associated with the number in the current register state.Handles if the register number actually points to a method parameter.
- Parameters:
num- the register number- Throws:
InvalidDalvikBytecodeException
-
getStoreResultLocal
public Local getStoreResultLocal()
-
instructionAtAddress
public DexlibAbstractInstruction instructionAtAddress(int address)
Return the instruction that is present at the byte code address.- Parameters:
address- the byte code address.- Throws:
RuntimeException- if address is not part of this body.
-
jimplify
public Body jimplify(Body b, SootMethod m)
Return the jimple equivalent of this body.- Parameters:
m- the SootMethod that contains this body
-
fixLineNumbers
protected void fixLineNumbers()
Fixes the line numbers. If there is a unit without a line number, it gets the line number of the last (transitive) predecessor that has a line number.
-
getLocalSplitter
protected LocalSplitter getLocalSplitter()
-
getUnreachableCodeEliminator
protected UnreachableCodeEliminator getUnreachableCodeEliminator()
-
getCopyPopagator
protected CopyPropagator getCopyPopagator()
-
setDanglingInstruction
public void setDanglingInstruction(DanglingInstruction i)
Set a dangling instruction for this body.
-
instructionsAfter
public List<DexlibAbstractInstruction> instructionsAfter(DexlibAbstractInstruction instruction)
Return the instructions that appear (lexically) after the given instruction.- Parameters:
instruction- the instruction which successors will be returned.
-
instructionsBefore
public List<DexlibAbstractInstruction> instructionsBefore(DexlibAbstractInstruction instruction)
Return the instructions that appear (lexically) before the given instruction.The instruction immediately before the given is the first instruction and so on.
- Parameters:
instruction- the instruction which successors will be returned.
-
-