public interface

IDMethodContext

implements IVariableInformationProvider
com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext

Class Overview

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.

Summary

Public Methods
abstract IDArrayElt createArrayElt(IDExpression array, IDExpression index, IJavaType type)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstanceField createArrayLength(IDExpression instance)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createAssign(IDExpression dst, IDExpression src)
Create an assignment instruction.
abstract IDImm createBoolean(boolean value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDImm createByte(byte value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDNewArrayInfo createByteArray(byte[] bytes)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDCallInfo createCallInfo(DInvokeType invoketype, int methodindex, List<IDExpression> arguments)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDCallInfo createCallInfo(IDIndex methodindex, IDExpression[] arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDCallInfo createCallInfo(IDIndex methodindex, List<IDExpression> arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDOperation createCast(IJavaType casttype, IDExpression e)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDImm createChar(char value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDStaticField createClassObject(String csig)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDOperation createConditional(IDPredicate pred, IDExpression expTrue, IDExpression expFalse)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createConstruct(IDNewInfo info)
Create a new Object(...) instruction.
abstract IDImm createDouble(double value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDImm createFloat(float value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDImm createImm(long rawvalue, IJavaType type)
This convenience IR factory method wraps around createImm(long, IJavaType).
abstract IDIndex createIndex(int value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstanceField createInstanceField(IDExpression instance, IDIndex index, IJavaType fieldtype, String fieldname)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDImm createInt(int value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createInvoke(IDCallInfo info)
Create an invocation instruction.
abstract IDInstruction createJcond(int irTargetOffset, IDPredicate cond)
Create a jcond (conditional jump) instruction.
abstract IDInstruction createJump(int irTargetOffset)
Create a goto (unconditional jump) instruction.
abstract IDImm createLong(long value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createMonitorEnter(IDExpression exp)
Create a monitor-enter instruction.
abstract IDInstruction createMonitorExit(IDExpression exp)
Create a monitor-exit instruction.
abstract IDInstruction createNewArray(IDNewArrayInfo info)
Create a new array instruction.
abstract IDNewArrayInfo createNewArrayInfo(IJavaType type, IDExpression size, List<IDExpression> initvals)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDNewInfo createNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, List<IDExpression> arguments, String methodsig)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDNewInfo createNewInfo(String constructorSig, IDExpression... arguments)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDNewInfo createNewInfo(IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, IDExpression[] arguments, String methodsig)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createNop()
Create a no-operation instruction.
abstract IDImm createNull()
Convenience IR factory method wrapping around getGlobalContext().
abstract IDOperation createOperation(IDExpression left, IJavaOperator operator, IDExpression right)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDOperation createOperation(JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDPredicate createPredicate(JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDPredicate createPredicate(IDExpression left, IJavaOperator operator, IDExpression right)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDPredicate createPredicate(IDExpression e)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDReferenceType createReferenceType(String csig)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDReferenceType createReferenceType(IDIndex cindex, IJavaType ctype)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createReturn(IDExpression exp)
Create a return instruction.
abstract IDImm createShort(short value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDStaticField createStaticField(IDIndex index, IJavaType fieldtype, String csig, String fieldname)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createStoreException(IDVar ident)
Create an exception-store instruction.
abstract IDImm createString(IDIndex stringIndex)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDImm createString(String value)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createSwitch(IDExpression swexp, IDSwitchData data)
Create a switch instruction.
abstract IDSwitchData createSwitchData()
abstract IDTarget createTarget(int offset)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDInstruction createThrow(IDExpression exp)
Create a throw instruction.
abstract IDVar createVar(int reg, IJavaType type)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDVar createVar(int regLo, int regHi, IJavaType type)
Convenience IR factory method wrapping around getGlobalContext().
abstract IDVar createVirtualVar(IJavaType type)
Create a virtual variable.
abstract CFG<IDInstruction> getCfg()
Get the current IR (intermediate representation) CFG of the decompiled method.
abstract int getDecompilationFlags()
Retrieve the decompilation flags provided by the engine to decompile this method.
abstract IDexUnit getDex()
Retrieve the underlying dex unit.
abstract IDTryData getExceptionData()
Retrieve the exception information for the current IR, if the exception information were parsed when the Dalvik method was converted to IR.
abstract IDGlobalContext getGlobalContext()
Retrieve the global IR context, shared by all IR method contexts.
abstract int getIdentifierForInputRegister(int reg)
Retrieve the IDVar id holding the requested Dalvik register.
abstract IDexMethod getMethod()
Retrieve a reference to the dex method being decompiled.
abstract String getMethodSignature()
Retrieve the original signature of the method being decompiled.
abstract IJavaOperatorFactory getOperatorFactory()
Retrieve the global high-level operator factory.
abstract SortedMap<Integer, IJavaType> getParametersTypeMap()
Retrieve the type map for the decompiled method.
abstract IJavaTypeFactory getTypeFactory()
Retrieve the global high-level type factory.
abstract IDTypeInfoProvider getTypeInfoProvider()
Retrieve the type information provider.
abstract Watchdog getWatchdog()
Retrieve the optional decompilation watchdog.
abstract boolean isBatchDecompilation()
Convenience method checking for FLAG_BATCH_DECOMPILATION.
abstract boolean isParseDebugInfo()
Determine whether debug information (in particular, variable names) will be ported over variables created during the conversion to Intermediate Representation.
abstract boolean isParseExceptions()
Determine whether exception information will be parsed and integrated within the initial Intermediate Representation, when the Dalvik code is converted to IR.
abstract boolean isRegisterId(int id)
Determine whether the provided id is a physical register's or a virtual register's.
abstract void replace(CFG<IDInstruction> cfg2, IDTryData trydata2)
Replace the current IR by a new CFG and exception information.
abstract void replaceCFG(CFG<IDInstruction> cfg2, Map<Integer, Integer> oldToNewOffsets)
Replace the current IR by a new CFG and exception information.
abstract int retrieveRegisterId(int id)
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.units.code.android.controlflow.IVariableInformationProvider

Public Methods

public abstract IDArrayElt createArrayElt (IDExpression array, IDExpression index, IJavaType type)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstanceField createArrayLength (IDExpression instance)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createAssign (IDExpression dst, IDExpression src)

Create an assignment instruction. Opcode: IR_ASSIGN.

public abstract IDImm createBoolean (boolean value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDImm createByte (byte value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDNewArrayInfo createByteArray (byte[] bytes)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDCallInfo createCallInfo (DInvokeType invoketype, int methodindex, List<IDExpression> arguments)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDCallInfo createCallInfo (IDIndex methodindex, IDExpression[] arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDCallInfo createCallInfo (IDIndex methodindex, List<IDExpression> arguments, IJavaType returntype, String methodsig, DInvokeType invoketype)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDOperation createCast (IJavaType casttype, IDExpression e)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDImm createChar (char value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDStaticField createClassObject (String csig)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDOperation createConditional (IDPredicate pred, IDExpression expTrue, IDExpression expFalse)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createConstruct (IDNewInfo info)

Create a new Object(...) instruction. Opcode: IR_INVOKE.

public abstract IDImm createDouble (double value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDImm createFloat (float value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDImm createImm (long rawvalue, IJavaType type)

This convenience IR factory method wraps around createImm(long, IJavaType).

public abstract IDIndex createIndex (int value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstanceField createInstanceField (IDExpression instance, IDIndex index, IJavaType fieldtype, String fieldname)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDImm createInt (int value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createInvoke (IDCallInfo info)

Create an invocation instruction. Opcode: IR_INVOKE.

public abstract IDInstruction createJcond (int irTargetOffset, IDPredicate cond)

Create a jcond (conditional jump) instruction. Opcode: IR_JCOND.

public abstract IDInstruction createJump (int irTargetOffset)

Create a goto (unconditional jump) instruction. Opcode: IR_JUMP.

public abstract IDImm createLong (long value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createMonitorEnter (IDExpression exp)

Create a monitor-enter instruction. Opcode: IR_MONITOR_ENTER.

public abstract IDInstruction createMonitorExit (IDExpression exp)

Create a monitor-exit instruction. Opcode: IR_MONITOR_EXIT.

public abstract IDInstruction createNewArray (IDNewArrayInfo info)

Create a new array instruction. Opcode: IR_INVOKE.

public abstract IDNewArrayInfo createNewArrayInfo (IJavaType type, IDExpression size, List<IDExpression> initvals)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDNewInfo createNewInfo (IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, List<IDExpression> arguments, String methodsig)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDNewInfo createNewInfo (String constructorSig, IDExpression... arguments)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDNewInfo createNewInfo (IJavaType objecttype, IJavaType constclasstype, IDIndex constructorindex, IDExpression[] arguments, String methodsig)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createNop ()

Create a no-operation instruction. Opcode: IR_NOP.

public abstract IDImm createNull ()

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDOperation createOperation (IDExpression left, IJavaOperator operator, IDExpression right)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDOperation createOperation (JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDPredicate createPredicate (JavaOperatorType optype, IDExpression opnd1, IDExpression opnd2)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDPredicate createPredicate (IDExpression left, IJavaOperator operator, IDExpression right)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDPredicate createPredicate (IDExpression e)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDReferenceType createReferenceType (String csig)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDReferenceType createReferenceType (IDIndex cindex, IJavaType ctype)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createReturn (IDExpression exp)

Create a return instruction. Opcode: IR_RETURN.

public abstract IDImm createShort (short value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDStaticField createStaticField (IDIndex index, IJavaType fieldtype, String csig, String fieldname)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createStoreException (IDVar ident)

Create an exception-store instruction. Opcode: IR_STORE_EXCEPTION.

public abstract IDImm createString (IDIndex stringIndex)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDImm createString (String value)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createSwitch (IDExpression swexp, IDSwitchData data)

Create a switch instruction. Opcode: IR_SWITCH.

public abstract IDSwitchData createSwitchData ()

public abstract IDTarget createTarget (int offset)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDInstruction createThrow (IDExpression exp)

Create a throw instruction. Opcode: IR_THROW.

public abstract IDVar createVar (int reg, IJavaType type)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDVar createVar (int regLo, int regHi, IJavaType type)

Convenience IR factory method wrapping around getGlobalContext().

public abstract IDVar createVirtualVar (IJavaType type)

Create a virtual variable. A virtual variable does not map back to physical registers.

Parameters
type variable type
Returns
  • the created variable

public abstract 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.

public abstract int getDecompilationFlags ()

Retrieve the decompilation flags provided by the engine to decompile this method. Refer to IDecompilerUnit#FLAG_xxx constants.

public abstract IDexUnit getDex ()

Retrieve the underlying dex unit.

public abstract IDTryData getExceptionData ()

Retrieve the exception information for the current IR, if the exception information were parsed when the Dalvik method was converted to IR.

Returns
  • an exception information object or null

public abstract 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.

public abstract int getIdentifierForInputRegister (int reg)

Retrieve the IDVar id holding the requested Dalvik register. This method is necessary as the conversion may not be 1-to-1: as the IR-CFG gets refined, new, virtual IDVar are introduced, replacing physical variables (e.g. virtual variables are inserted during the SSA phase).

Parameters
reg a Dalvik identifier
Returns
  • the current identifier (in the current IR CFG) of the variable representing the requested input

public abstract IDexMethod getMethod ()

Retrieve a reference to the dex method being decompiled.

public abstract String getMethodSignature ()

Retrieve the original signature of the method being decompiled.

public abstract 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.

public abstract SortedMap<Integer, IJavaType> getParametersTypeMap ()

Retrieve the type map for the decompiled method. The map keys are input slot indices; the special index -1 indicates the return value type, if the method returns a value. The first entry is this, if the method is non-static. Types long and double use two slots; other primitives and reference type objects use a single slot.

- Example: virtual method f() of class A:
int f(char, double, String) => map= (-1:int, 0:A, 1:char, 2:double, 4:String)

- Example: static method g() of class B:
void g(long, long, Object, boolean) => map= (0:long, 2:long, 4:Object, 5:boolean)

public abstract IJavaTypeFactory getTypeFactory ()

Retrieve the global high-level type factory.

public abstract 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.

public abstract 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.

public abstract boolean isBatchDecompilation ()

Convenience method checking for FLAG_BATCH_DECOMPILATION.

public abstract boolean isParseDebugInfo ()

Determine whether debug information (in particular, variable names) will be ported over variables created during the conversion to Intermediate Representation.

public abstract boolean isParseExceptions ()

Determine whether exception information will be parsed and integrated within the initial Intermediate Representation, when the Dalvik code is converted to IR.

public abstract boolean isRegisterId (int id)

Determine whether the provided id is a physical register's or a virtual register's.

public abstract void replace (CFG<IDInstruction> cfg2, IDTryData trydata2)

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
cfg2 new CFG
trydata2 new exception data (may be null)

public abstract void replaceCFG (CFG<IDInstruction> cfg2, Map<Integer, Integer> oldToNewOffsets)

Replace the current IR by a new CFG and exception information. It is recommended to use replace(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 CFG
oldToNewOffsets 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)

public abstract int retrieveRegisterId (int id)

Parameters
id mirror id or register id
Returns
  • the underlying register id