Interface IDMethodContext
- All Superinterfaces:
ICFGOwnerContext,IVariableInformationProvider
dexdec IR method context. A method context holds all intermediate (IR) information
relative to the decompilation of a dex method, including factory methods to create IR
instructions and IR expressions.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtraComment(String str) Add an extra comment for this method.voidRemove all virtual variables from this context.copy()Create a copy of this context.default IDArrayEltcreateArrayElt(IDExpression array, IDExpression index, IJavaType type) Convenience IR factory method wrapping aroundgetGlobalContext().default IDInstanceFieldcreateArrayLength(IDExpression instance) Convenience IR factory method wrapping aroundgetGlobalContext().createAssign(IDExpression dst, IDExpression src) Create anassignmentinstruction.default IDImmcreateBoolean(boolean value) Convenience IR factory method wrapping aroundgetGlobalContext().default IDImmcreateByte(byte value) Convenience IR factory method wrapping aroundgetGlobalContext().default IDNewArrayInfocreateByteArray(byte[] bytes) Convenience IR factory method wrapping aroundgetGlobalContext().default IDCallInfocreateCallInfo(DInvokeType invoketype, int methodindex, List<IDExpression> arguments) Convenience IR factory method wrapping aroundgetGlobalContext().default IDCallInfocreateCallInfo(IDIndex methodindex, IDExpression[] arguments, IJavaType returntype, String methodsig, DInvokeType invoketype) Convenience IR factory method wrapping aroundgetGlobalContext().default IDCallInfocreateCallInfo(IDIndex methodindex, List<IDExpression> arguments, IJavaType returntype, String methodsig, DInvokeType invoketype) Convenience IR factory method wrapping aroundgetGlobalContext().default IDOperationcreateCast(IJavaType casttype, IDExpression e) Convenience IR factory method wrapping aroundgetGlobalContext().default IDImmcreateChar(char value) Convenience IR factory method wrapping aroundgetGlobalContext().default IDStaticFieldcreateClassObject(String csig) Convenience IR factory method wrapping aroundgetGlobalContext().default IDOperationcreateConditional(IJavaType type, IDExpression pred, IDExpression expTrue, IDExpression expFalse) Convenience IR factory method wrapping aroundgetGlobalContext().createConstruct(IDNewInfo info) Create anew Object(...)instruction.createCopyVar(IDVar srcVar) Create a copy-variable.default IDImmcreateDouble(double value) Convenience IR factory method wrapping aroundgetGlobalContext().default IDImmcreateFloat(float value) Convenience IR factory method wrapping aroundgetGlobalContext().default IDImmThis convenience IR factory method wraps aroundIDGlobalContext.createImm(long, IJavaType).default IDIndexcreateIndex(int value) Convenience IR factory method wrapping aroundgetGlobalContext().default IDInstanceFieldcreateInstanceField(IDExpression instance, IDIndex index, IJavaType fieldtype, String fieldname) Convenience IR factory method wrapping aroundgetGlobalContext().default IDImmcreateInt(int value) Convenience IR factory method wrapping aroundgetGlobalContext().createInvoke(IDCallInfo info) Create aninvocationinstruction.createJcond(int irTargetOffset, IDExpression cond) Create ajcond(conditional jump) instruction.createJump(int irTargetOffset) Create agoto(unconditional jump) instruction.default IDImmcreateLong(long value) Convenience IR factory method wrapping aroundgetGlobalContext().Create amonitor-enterinstruction.Create amonitor-exitinstruction.createNewArray(IDNewArrayInfo info) Create anew arrayinstruction.default IDNewArrayInfocreateNewArrayInfo(IJavaType type, IDExpression size, List<IDExpression> initvals) Convenience IR factory method wrapping aroundgetGlobalContext().default IDNewInfocreateNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, IDExpression[] arguments, String methodsig) Convenience IR factory method wrapping aroundgetGlobalContext().default IDNewInfocreateNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, List<IDExpression> arguments, String methodsig) Convenience IR factory method wrapping aroundgetGlobalContext().default IDNewInfocreateNewInfo(String constructorSig, IDExpression... arguments) Convenience IR factory method wrapping aroundgetGlobalContext().Create ano-operationinstruction.default IDImmConvenience IR factory method wrapping aroundgetGlobalContext().default IDOperationcreateOperation(IJavaType type, IDExpression left, IJavaOperator operator, IDExpression right) Convenience IR factory method wrapping aroundgetGlobalContext().default IDOperationcreateOperation(IJavaType type, JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2) Convenience IR factory method wrapping aroundgetGlobalContext().default IDOperationcreatePredicate(IDExpression left, IJavaOperator operator, IDExpression right) Convenience IR factory method wrapping aroundgetGlobalContext().default IDOperationcreatePredicate(JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2) Convenience IR factory method wrapping aroundgetGlobalContext().default IDReferenceTypecreateReferenceType(IDIndex cindex, IJavaType ctype) Convenience IR factory method wrapping aroundgetGlobalContext().default IDReferenceTypecreateReferenceType(String csig) Convenience IR factory method wrapping aroundgetGlobalContext().createRegisterVar(int regnum, IJavaType type) Create a variable mapping to a physical Dalvik register (or pair of registers).createReturn(IDExpression exp) Create areturninstruction.default IDImmcreateShort(short value) Convenience IR factory method wrapping aroundgetGlobalContext().default IDStaticFieldcreateStaticField(IDIndex index, IJavaType fieldtype, String csig, String fieldname) Convenience IR factory method wrapping aroundgetGlobalContext().createStoreException(IDVar ident) Create anexception-storeinstruction.default IDImmcreateString(IDIndex stringIndex) Convenience IR factory method wrapping aroundgetGlobalContext().default IDImmcreateString(String value) Convenience IR factory method wrapping aroundgetGlobalContext().createSwitch(IDExpression swexp, IDSwitchData data) Create aswitchinstruction.default IDSwitchDataConvenience IR factory method wrapping aroundgetGlobalContext().default IDTargetcreateTarget(int offset) Convenience IR factory method wrapping aroundgetGlobalContext().createThrow(IDExpression exp) Create athrowinstruction.createVar(int id) Create or retrieve a variable.Create or retrieve a variable.Create or retrieve a variable.createVirtualVar(IJavaType type) Create a virtual variable.Evaluate this method with the provided immediate arguments.Evaluate this method using the provided state and arguments.getCfg()Get the current IR (intermediate representation) CFG of the decompiled method.Retrieve child contexts created from this context.Retrieve contexts copied from this context.Retrieve an arbitrary object in this context.Retrieve the set of objects keys for data elements stored usingsetData.intRetrieve the decompilation flags provided by the engine to decompile this method.intRetrieve the deobfuscation score for this method.getDex()Retrieve the underlying dex unit.Retrieve the exception information for the current IR, if theexception informationwere parsed when the Dalvik method was converted to IR.Retrieve extra comments for this method.Retrieve the global IR context, shared by all IR method contexts.Retrieve a reference to the dex method being decompiled.Retrieve the original signature of the method being decompiled.Retrieve the global high-level operator factory.Retrieve the type map for the decompiled method.Retrieve the list of variables that hold the method parameters.Retrieve the parent context, if this context was created from another method context.Retrieve the global high-level type factory.Retrieve the type information provider.getVar(int id) Retrieve avariableby name.Retrieve a read-only map of all variables created by this context.getVars()Retrieve all variables created in this context.Retrieve the optional decompilation watchdog.voidincrementDeobfuscationScore(int delta) Update the deobfuscation score for this method.default booleanConvenience method checking forIDecompilerUnit.FLAG_BATCH_DECOMPILATION.booleanDetermine whether debug information (in particular, variable names) will be ported overvariablescreated during the conversion to Intermediate Representation.booleanDetermine whether exception information will be parsed and integrated within the initial Intermediate Representation, when the Dalvik code is converted to IR.booleanisSSA()Determine whether the CFG wasconverted to an SSA form.booleanDetermine whether the dalvik method in this IR context is static or non-static.voidload(IDMethodContext sourceContext) Load the constituents of a source context into this context.voidmakeSSA()Convert this CFG to SSA (static single assignment) form.Pop the current optimizer from the working optimizer stack.voidPerform type determination and propagation on the CFG.voidpushWorkingOptimizer(IDOptimizer optimizer) Push an optimizer on the working optimizer stack.booleanremoveExtraComment(String str) Remove an extra comment for this method.booleanremoveVar(int varid) Remove a variable from this context.voidreplace(CFG<IDInstruction> replCfg, IDTryData replExdata) Replace the current IR by a new CFG and exception information.voidreplaceCFG(CFG<IDInstruction> cfg2, Map<Integer, Integer> oldToNewOffsets) Replace the current IR by a new CFG and exception information.voidReset the deobfuscation score for this method.intretrievePhysicalRegisterId(int varid) Retrieve the underlying register used by a variable.intretrievePrimaryVariableId(int varid) Retrieve the primary variable id from a variable.Retrieve or create a temporary variable.retrieveTemporaryVariable(IJavaType type, int idx) Retrieve or create a temporary variable with an explicit index.Store an arbitrary object in this context.voidverify()Self-verification.Methods inherited from interface com.pnfsoftware.jeb.core.units.code.ICFGOwnerContext
getName, getSame
-
Method Details
-
verify
Self-verification. This method performs several consistency checks on the IR. On failure, the method will throw and an attempt will be made to dump the current IR CFG to a file named "failed.dot".- Throws:
IllegalStateException- thrown on verification failure
-
copy
IDMethodContext copy()Create a copy of this context. This method is useful when optimizers need to operate and modify in depth a context and its elements (e.g. the CFG or exception-flow data), while the optimizer's success is not guaranteed. On failure, the copied context may be destroyed. On success, the context may be updated using the copied context, by usingload(IDMethodContext)- Returns:
- a new context, which is a deep duplication of this context
-
load
Load the constituents of a source context into this context. This method is to be used in conjunction withcopy().- Parameters:
sourceContext- a source context
-
getWatchdog
Watchdog getWatchdog()Retrieve the optional decompilation watchdog. The watchdog embeds timing information and can be queried by decompilation components: a component can request a self-verification, which will result in an exception being thrown (and decompilation aborted) if the timeout is exceeded.- Returns:
- optional decompilation watchdog
-
getDecompilationFlags
int getDecompilationFlags()Retrieve the decompilation flags provided by the engine to decompile this method. Refer toIDecompilerUnit#FLAG_xxxconstants.- Returns:
- decompilation flags
-
isBatchDecompilation
default boolean isBatchDecompilation()Convenience method checking forIDecompilerUnit.FLAG_BATCH_DECOMPILATION.- Returns:
- true if this context is for batch decompilation
-
isParseExceptions
boolean isParseExceptions()Determine whether exception information will be parsed and integrated within the initial Intermediate Representation, when the Dalvik code is converted to IR.- Returns:
- true if exception information is parsed
-
isParseDebugInfo
boolean isParseDebugInfo()Determine whether debug information (in particular, variable names) will be ported overvariablescreated during the conversion to Intermediate Representation.- Returns:
- true if debug information is parsed
-
getGlobalContext
IDGlobalContext getGlobalContext()Retrieve the global IR context, shared by all IR method contexts. The global context (also referred to as 'intermediate context') is managed by the decompiler.- Returns:
- global IR context
-
getParentContext
IDMethodContext getParentContext()Retrieve the parent context, if this context was created from another method context.- Returns:
- parent context, or null
-
getChildrenContexts
List<IDMethodContext> getChildrenContexts()Retrieve child contexts created from this context.- Returns:
- child contexts
-
getCopiesContexts
List<IDMethodContext> getCopiesContexts()Retrieve contexts copied from this context.- Returns:
- copied contexts
-
getOperatorFactory
IJavaOperatorFactory getOperatorFactory()Retrieve the global high-level operator factory. The type factory can be used to create all operators, including conditionals, string concatenation, and create cast operators.- Returns:
- high-level operator factory
-
getTypeFactory
IJavaTypeFactory getTypeFactory()Retrieve the global high-level type factory.- Returns:
- high-level type factory
-
getTypeInfoProvider
IDTypeInfoProvider getTypeInfoProvider()Retrieve the type information provider. This provider can access additional, user-provided libraries (jar, dex) to retrieve information on types referenced but not defined in the underlying dex unit.- Returns:
- type information provider
-
getDex
IDexUnit getDex()Retrieve the underlying dex unit.- Returns:
- underlying Dex unit
-
getMethod
IDexMethod getMethod()Retrieve a reference to the dex method being decompiled.- Returns:
- Dex method being decompiled
-
getMethodSignature
String getMethodSignature()Retrieve the original signature of the method being decompiled.- Returns:
- original method signature
-
getParametersTypeMap
Retrieve the type map for the decompiled method. The map keys are Dalvik input slot indices. The special index -1 indicates the return value type, if the method returns a value. The first entry isthis, if the method is non-static. Although typeslonganddoubleuse two slots, only the first slot number is returned. Other primitives and reference type objects use a single slot.- Example: virtual method f() of class A using 10 registers:
int f(char, double, String)=> map=(-1:int, 5:ref_A, 6:char, 7:double, 9:String)
- Example: static method g() of class B using 20 registers:
void g(long, long, Object, boolean) => map=(14:long, 16:long, 18:Object, 19:boolean)- Returns:
- parameter type map
-
getCfg
CFG<IDInstruction> getCfg()Get the current IR (intermediate representation) CFG of the decompiled method. As the method advances in the decompilation pipeline, the IR gets refined. When it is fully refined, the final IR is converted to a Java AST.- Returns:
- current IR CFG
-
getExceptionData
IDTryData getExceptionData()Retrieve the exception information for the current IR, if theexception informationwere parsed when the Dalvik method was converted to IR.- Returns:
- an exception information object, which may be empty if the method is unprotected or
if
isParseExceptions()was false when this object as built
-
replace
Replace the current IR by a new CFG and exception information.This method should be seldom called; most times, modifying the CFG itself is sufficient. However, in some cases, a full replacement may be necessary.
- Parameters:
replCfg- new CFGreplExdata- new exception data (may be null)
-
replaceCFG
Replace the current IR by a new CFG and exception information. It is recommended to usereplace(CFG, IDTryData)instead.This method should be seldom called; most times, modifying the CFG itself is sufficient. However, in some cases, a full replacement may be necessary.
- Parameters:
cfg2- new CFGoldToNewOffsets- mandatory map map specifying a correspondence "old IR offset to new IR offset" for each instruction of the CFG (this map is currently used to update various internal structures as well as IR exception information)
-
makeSSA
void makeSSA()Convert this CFG to SSA (static single assignment) form. An SSA form should be generated before attempting to apply types. This method is reserved for internal use. -
isSSA
boolean isSSA()Determine whether the CFG wasconverted to an SSA form.- Returns:
- true if the CFG was SSA'ed
-
propagateTypes
void propagateTypes()Perform type determination and propagation on the CFG. The CFG should be in SSA form before doing so. This method is reserved for internal use. -
getVariableMap
Retrieve a read-only map of all variables created by this context.- Returns:
- read-only map of variables by id
-
isStaticMethod
boolean isStaticMethod()Determine whether the dalvik method in this IR context is static or non-static.- Returns:
- true if this context is for a static method, false otherwise
-
getParameterVariables
Retrieve the list of variables that hold the method parameters. If the method is non-static, the first entry representsthis.- Returns:
- a list of variables
-
getVar
- Parameters:
id- a variable id (not to be confused with Dalvik register number)- Returns:
- a variable, or null if no variable with the provided id exists
-
getVar
Retrieve avariableby name. This method may return null.- Parameters:
name- a variable name (standard name, or custom name)- Returns:
- a variable, or null if no variable with the provided name exists
-
getVars
Collection<IDVar> getVars()Retrieve all variables created in this context.- Returns:
- variables in this context
-
removeVar
boolean removeVar(int varid) Remove a variable from this context.- Parameters:
varid- variable id- Returns:
- true if the variable was removed
-
clearVirtualVars
void clearVirtualVars()Remove all virtual variables from this context. -
createVar
Create or retrieve a variable.- Parameters:
id- variable id (not to be confused with Dalvik register number)- Returns:
- a variable
-
createVar
Create or retrieve a variable. Caution: if the variable with the provided id already exists, it will be returned by this method without performing type check: the requested type at creation may not be the type of the returned (already existing) variable.- Parameters:
id- variable id (not to be confused with Dalvik register number)type- mandatory type- Returns:
- a variable
-
createVar
Create or retrieve a variable.- Parameters:
id- variable id (not to be confused with Dalvik register number)type- mandatory typeperformTypeCheckIfExists- if false: if the variable with the provided id already exists, it will be returned by this method without performing type check: the requested type may not be the type of the returned (already existing) variable; if true: this method will throw anIllegalArgumentExceptionif an already existing variable does not have the requested type- Returns:
- a variable
-
createRegisterVar
Create a variable mapping to a physical Dalvik register (or pair of registers). This method is used during the initial decompilation phase when the bytecode is converted to low-level IR.- Parameters:
regnum- dalvik register number (first register in the case of a pair)type- variable type- Returns:
- a variable
-
createCopyVar
Create a copy-variable. If the source variable has apreferred name, it is copied to the newly-created variable.- Parameters:
srcVar- a primary variable, whose id is in [0, 0xFFFF] or [0x10000, 0x1FFFE]- Returns:
- a variable representing a copy of the provided variable
-
createVirtualVar
Create a virtual variable. A virtual variable does not map back to physical registers.- Parameters:
type- variable type- Returns:
- the created variable
-
retrieveTemporaryVariable
Retrieve or create a temporary variable.- Parameters:
type- temporary variable type- Returns:
- temporary variable
-
retrieveTemporaryVariable
Retrieve or create a temporary variable with an explicit index.- Parameters:
type- temporary variable typeidx- temporary variable index- Returns:
- temporary variable
-
retrievePhysicalRegisterId
int retrievePhysicalRegisterId(int varid) Retrieve the underlying register used by a variable. If the variable uses a long type, the first register of the pair is returned. If the variable is virtual, -1 is returned.- Parameters:
varid- a variable id- Returns:
- a register id in [0, 0xFFFF] if the variable is backed or indirectly backed by a physical register; -1 if the variable is "virtual", not backed by a register
-
retrievePrimaryVariableId
int retrievePrimaryVariableId(int varid) Retrieve the primary variable id from a variable. If the variable directly maps a register or pair of registers, or is virtual, its id is simply returned. If the variable is a copy of another variable, the id of the copied variable is provided.- Parameters:
varid- a variable id- Returns:
- the original (non-copied) variable id, which may be the provided id itself
-
createNop
IDInstruction createNop()Create ano-operationinstruction. Opcode:DOpcodeType.IR_NOP.- Returns:
- no-operation instruction
-
createAssign
Create anassignmentinstruction. Opcode:DOpcodeType.IR_ASSIGN.- Parameters:
dst- destination expressionsrc- source expression- Returns:
- assignment instruction
-
createConstruct
Create anew Object(...)instruction. Opcode:DOpcodeType.IR_INVOKE.- Parameters:
info- new-instance invocation information- Returns:
- construction instruction
-
createInvoke
Create aninvocationinstruction. Opcode:DOpcodeType.IR_INVOKE.- Parameters:
info- call information- Returns:
- invocation instruction
-
createNewArray
Create anew arrayinstruction. Opcode:DOpcodeType.IR_INVOKE.- Parameters:
info- new-array information- Returns:
- new-array instruction
-
createJump
Create agoto(unconditional jump) instruction. Opcode:DOpcodeType.IR_JUMP.- Parameters:
irTargetOffset- target IR offset- Returns:
- jump instruction
-
createJcond
Create ajcond(conditional jump) instruction. Opcode:DOpcodeType.IR_JCOND.- Parameters:
irTargetOffset- target IR offsetcond- jump condition- Returns:
- conditional jump instruction
-
createSwitch
Create aswitchinstruction. Opcode:DOpcodeType.IR_SWITCH.- Parameters:
swexp- switch expressiondata- switch data- Returns:
- switch instruction
-
createReturn
Create areturninstruction. Opcode:DOpcodeType.IR_RETURN.- Parameters:
exp- optional returned expression- Returns:
- return instruction
-
createThrow
Create athrowinstruction. Opcode:DOpcodeType.IR_THROW.- Parameters:
exp- thrown expression- Returns:
- throw instruction
-
createStoreException
Create anexception-storeinstruction. Opcode:DOpcodeType.IR_STORE_EXCEPTION.- Parameters:
ident- exception variable- Returns:
- store-exception instruction
-
createMonitorEnter
Create amonitor-enterinstruction. Opcode:DOpcodeType.IR_MONITOR_ENTER.- Parameters:
exp- monitor expression- Returns:
- monitor-enter instruction
-
createMonitorExit
Create amonitor-exitinstruction. Opcode:DOpcodeType.IR_MONITOR_EXIT.- Parameters:
exp- monitor expression- Returns:
- monitor-exit instruction
-
createImm
This convenience IR factory method wraps aroundIDGlobalContext.createImm(long, IJavaType).- Parameters:
rawvalue- raw constant valuetype- constant type- Returns:
- immediate constant
-
createBoolean
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- boolean value- Returns:
- immediate constant
-
createByte
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- byte value- Returns:
- immediate constant
-
createChar
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- char value- Returns:
- immediate constant
-
createShort
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- short value- Returns:
- immediate constant
-
createInt
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- int value- Returns:
- immediate constant
-
createLong
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- long value- Returns:
- immediate constant
-
createFloat
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- float value- Returns:
- immediate constant
-
createDouble
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- double value- Returns:
- immediate constant
-
createNull
Convenience IR factory method wrapping aroundgetGlobalContext().- Returns:
- null immediate constant
-
createString
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- string value- Returns:
- immediate constant
-
createString
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
stringIndex- Dex string pool index- Returns:
- immediate constant
-
createArrayElt
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
array- array expressionindex- element index expressiontype- element type- Returns:
- array element expression
-
createOperation
default IDOperation createOperation(IJavaType type, JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
type- operation typeoptype- operator typeopnd1- first operandopnd2- optional second operand- Returns:
- operation expression
-
createOperation
default IDOperation createOperation(IJavaType type, IDExpression left, IJavaOperator operator, IDExpression right) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
type- operation typeleft- left operandoperator- operatorright- right operand- Returns:
- operation expression
-
createCast
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
casttype- target cast typee- expression to cast- Returns:
- cast operation expression
-
createConditional
default IDOperation createConditional(IJavaType type, IDExpression pred, IDExpression expTrue, IDExpression expFalse) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
type- result typepred- predicate expressionexpTrue- expression evaluated when the predicate is trueexpFalse- expression evaluated when the predicate is false- Returns:
- conditional operation expression
-
createPredicate
default IDOperation createPredicate(JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
optype- operator typeopnd1- first operandopnd2- optional second operand- Returns:
- predicate operation expression
-
createPredicate
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
left- left operandoperator- operatorright- right operand- Returns:
- predicate operation expression
-
createReferenceType
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
cindex- class type indexctype- class type- Returns:
- reference type expression
-
createReferenceType
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
csig- class signature- Returns:
- reference type expression
-
createIndex
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
value- index value- Returns:
- index object
-
createStaticField
default IDStaticField createStaticField(IDIndex index, IJavaType fieldtype, String csig, String fieldname) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
index- field indexfieldtype- field typecsig- owner class signaturefieldname- field name- Returns:
- static field expression
-
createInstanceField
default IDInstanceField createInstanceField(IDExpression instance, IDIndex index, IJavaType fieldtype, String fieldname) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
instance- object instance expressionindex- field indexfieldtype- field typefieldname- field name- Returns:
- instance field expression
-
createClassObject
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
csig- class signature- Returns:
- class object static field expression
-
createArrayLength
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
instance- array instance expression- Returns:
- array length field expression
-
createCallInfo
default IDCallInfo createCallInfo(IDIndex methodindex, IDExpression[] arguments, IJavaType returntype, String methodsig, DInvokeType invoketype) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
methodindex- method indexarguments- call argumentsreturntype- return typemethodsig- method signatureinvoketype- invocation type- Returns:
- call information
-
createCallInfo
default IDCallInfo createCallInfo(IDIndex methodindex, List<IDExpression> arguments, IJavaType returntype, String methodsig, DInvokeType invoketype) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
methodindex- method indexarguments- call argumentsreturntype- return typemethodsig- method signatureinvoketype- invocation type- Returns:
- call information
-
createCallInfo
default IDCallInfo createCallInfo(DInvokeType invoketype, int methodindex, List<IDExpression> arguments) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
invoketype- invocation typemethodindex- method indexarguments- call arguments- Returns:
- call information
-
createNewInfo
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
constructorSig- constructor signaturearguments- constructor arguments- Returns:
- new-instance information
-
createNewInfo
default IDNewInfo createNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, IDExpression[] arguments, String methodsig) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
objecttype- created object typeconstclasstype- constructor class typeconstructorindex- constructor indexarguments- constructor argumentsmethodsig- constructor method signature- Returns:
- new-instance information
-
createNewInfo
default IDNewInfo createNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, List<IDExpression> arguments, String methodsig) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
objecttype- created object typeconstclasstype- constructor class typeconstructorindex- constructor indexarguments- constructor argumentsmethodsig- constructor method signature- Returns:
- new-instance information
-
createNewArrayInfo
default IDNewArrayInfo createNewArrayInfo(IJavaType type, IDExpression size, List<IDExpression> initvals) Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
type- array typesize- array size expressioninitvals- optional initial values- Returns:
- new-array information
-
createByteArray
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
bytes- byte values- Returns:
- new-array information
-
createTarget
Convenience IR factory method wrapping aroundgetGlobalContext().- Parameters:
offset- target offset- Returns:
- target expression
-
createSwitchData
Convenience IR factory method wrapping aroundgetGlobalContext().- Returns:
- empty switch data element
-
setData
Store an arbitrary object in this context.- Parameters:
key- non-null keyvalue- null means remove the entry- Returns:
- the previous value associated with the key
-
getData
Retrieve an arbitrary object in this context.- Parameters:
key- non-null key- Returns:
- the value associated with the key, or null
-
getDataKeys
Retrieve the set of objects keys for data elements stored usingsetData.- Returns:
- a read-only collection
-
evaluate
Evaluate this method with the provided immediate arguments.- Parameters:
arguments- method arguments- Returns:
- evaluation result
- Throws:
DexDecEvaluationException- on evaluation error
-
evaluate
Evaluate this method using the provided state and arguments.- Parameters:
state- evaluation statearguments- method arguments- Returns:
- evaluation result
- Throws:
DexDecEvaluationException- on evaluation error
-
incrementDeobfuscationScore
void incrementDeobfuscationScore(int delta) Update the deobfuscation score for this method. Note that the score is automatically updated by the master optimizer for single-method IR optimizers (that is, the majority of them). For optimizers working on a collection of IRs, right now, the score must be adjusted manually the optimizer itself.- Parameters:
delta- score increment
-
getDeobfuscationScore
int getDeobfuscationScore()Retrieve the deobfuscation score for this method.- Returns:
- current deobfuscation score
-
resetDeobfuscationScore
void resetDeobfuscationScore()Reset the deobfuscation score for this method. -
addExtraComment
Add an extra comment for this method.- Parameters:
str- comment text
-
removeExtraComment
Remove an extra comment for this method.- Parameters:
str- comment text- Returns:
- true if a comment was removed
-
getExtraComments
Collection<String> getExtraComments()Retrieve extra comments for this method.- Returns:
- extra comments
-
pushWorkingOptimizer
Push an optimizer on the working optimizer stack.- Parameters:
optimizer- optimizer being run
-
popWorkingOptimizer
IDOptimizer popWorkingOptimizer()Pop the current optimizer from the working optimizer stack.- Returns:
- popped optimizer
-