public interface

IDExpression

implements IDElement
com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression
Known Indirect Subclasses

Class Overview

Base interface for all dexdec IR expressions, such as IR instructions, fields/attributes, immediates, variables/identifiers, operations, etc.

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.android.ir.IDElement
Public Methods
abstract IDArrayElt asArrayElt()
abstract IDCallInfo asCallInfo()
abstract IDReferenceType asClassReference()
abstract IDImm asImm()
abstract IDInstanceField asInstanceField()
abstract IDInstruction asInstruction()
abstract IDNewArrayInfo asNewArrayInfo()
abstract IDNewInfo asNewInfo()
abstract IDOperation asOperation()
abstract IDPredicate asPredicate()
abstract IDStaticField asStaticField()
abstract IDVar asVar()
abstract void collectAllPhysicalOffsets(Collection<Integer> physicalOffsets)
Gather all physical offsets for this element and all its constituents.
abstract void collectRegisters(Set<Integer> sink)
Recursively collect all the ids used and defined by this expression.
abstract void collectSubExpressions(List<IDExpression> sink)
Recursively collect all sub-expressions of this expression, in evaluation order.
abstract IDExpression copy(DCopyOptions opt)
Copy this element.
abstract IDExpression duplicate()
Duplicate this element.
abstract IDImm evaluate(IDState state)
Evaluate this expression.
abstract IDImm evaluate(IDMethodContext ctx)
Convenience method: Evaluate this expression within the context of the provided method.
abstract IJavaElement generateAST(IDMethodContext ctx, IJavaMethod m)
Generate the Java AST element for this IR expression.
abstract Object getData(String key)
Retrieve a value from this IR element's data map.
abstract String getOrigin()
Retrieve the origin info string of this IR element, if there is one.
abstract int getPhysicalOffset()
Retrieve the physical offset (dalvik) associated with this IR.
abstract Set<Integer> getRegisters()
abstract List<IDExpression> getSubExpressions()
Convenience method used to retrieve all the sub-expressions of this IR, in evaluation order.
abstract IJavaType getType()
Get the IR expression type.
abstract IJavaType getTypeForIdentifier(IDVar var)
Get the type of an identifier used by this IR expression.
abstract boolean isArrayElt()
abstract boolean isCallInfo()
Note: this method also returns true if this object is of type IDNewInfo.
abstract boolean isClassReference()
abstract boolean isImm(long expectedRawValue)
abstract boolean isImm()
abstract boolean isInstanceField()
abstract boolean isInstruction()
abstract boolean isNewArrayInfo()
abstract boolean isNewInfo()
abstract boolean isOperation(JavaOperatorType expectedOperatorType)
abstract boolean isOperation()
Note: this method also returns true if this object is of type IDPredicate.
abstract boolean isPredicate()
abstract boolean isStaticField()
abstract boolean isVar()
abstract void removeData(String key)
Remove an entry from this IR element's data map.
abstract int replaceIdentifier(IDVar var, IDExpression repl)
Replace matching identifiers (per same()) by a given expression.
abstract boolean replaceSubExpression(IDExpression oldExp, IDExpression newExp)
Replace an expression of this IR.
abstract void setData(String key, Object value)
Store a key-value pair in this IR element's data map.
abstract void setOrigin(String origin)
Set an optional origin info string for this IR element.
abstract boolean setType(IJavaType type, boolean forced)
Update the type of an expression.
abstract boolean setType(IJavaType type)
Update the type of an expression.
abstract boolean setTypeForIdentifier(IDVar var, IJavaType type)
Set the type of an identifier used by this IR expression.
abstract void transferMetadataFrom(IDExpression src)
Transfer (shallow copy) metadata from a source IR to this IR.
abstract void updateAllPhysicalOffsets(int physicalOffset)
Update the physical offset of this element and all its constituents.
abstract boolean visitDepthPost(IDVisitor visitor, IDExpression parent, DTreeVisitResults results)
Visit this expression and its constituents, depth-first post-order.
abstract boolean visitDepthPost(IDVisitor visitor, IDExpression parent)
Visit this expression and its constituents, depth-first post-order.
abstract boolean visitDepthPost(IDVisitor visitor)
Visit this expression and its constituents, depth-first post-order.
abstract boolean visitDepthPre(IDVisitor visitor)
Visit this expression and its constituents, depth-first pre-order.
abstract boolean visitDepthPre(IDVisitor visitor, IDExpression parent, DTreeVisitResults results)
Visit this expression and its constituents, depth-first pre-order.
abstract boolean visitDepthPre(IDVisitor visitor, IDExpression parent)
Visit this expression and its constituents, depth-first pre-order.
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.units.code.IInstructionOperand
From interface com.pnfsoftware.jeb.core.units.code.android.ir.IDElement

Public Methods

public abstract IDArrayElt asArrayElt ()

public abstract IDCallInfo asCallInfo ()

public abstract IDReferenceType asClassReference ()

public abstract IDImm asImm ()

public abstract IDInstanceField asInstanceField ()

public abstract IDInstruction asInstruction ()

public abstract IDNewArrayInfo asNewArrayInfo ()

public abstract IDNewInfo asNewInfo ()

public abstract IDOperation asOperation ()

public abstract IDPredicate asPredicate ()

public abstract IDStaticField asStaticField ()

public abstract IDVar asVar ()

public abstract void collectAllPhysicalOffsets (Collection<Integer> physicalOffsets)

Gather all physical offsets for this element and all its constituents.

Parameters
physicalOffsets sink

public abstract void collectRegisters (Set<Integer> sink)

Recursively collect all the ids used and defined by this expression.

Note: IDVar are made of 1 or 2 physical or virtual registers.

Parameters
sink collection receiving the register ids

public abstract void collectSubExpressions (List<IDExpression> sink)

Recursively collect all sub-expressions of this expression, in evaluation order. If the full expression were to be evaluated at runtime, a sub-expression at index i in the list would be evaluated before a sub-expression at index i+1.

Parameters
sink a list to which all sub-expressions will be added

public abstract IDExpression copy (DCopyOptions opt)

Copy this element. This operation can be seen as a custom duplication; the resulting element may not be of the same type as this element.

Parameters
opt optional; if one is provided, onDup(IDExpression) will be tried first to create a copy
Returns
  • the copied element

public abstract IDExpression duplicate ()

Duplicate this element.

Returns
  • a deep copy of this element; the type of the duplicated element should be the same as this element's type

public abstract IDImm evaluate (IDState state)

Evaluate this expression.

Returns
  • the evaluated expression
Throws
DexDecEvaluationException on evaluation error

public abstract IDImm evaluate (IDMethodContext ctx)

Convenience method: Evaluate this expression within the context of the provided method.

Parameters
ctx method context
Returns
  • the evaluated expression
Throws
DexDecEvaluationException on evaluation error

public abstract IJavaElement generateAST (IDMethodContext ctx, IJavaMethod m)

Generate the Java AST element for this IR expression.

Parameters
ctx IR method context (of which this IR element belongs)
m AST Method context (of which the resulting AST element will belong)
Returns
  • the generated AST element

public abstract Object getData (String key)

Retrieve a value from this IR element's data map.

Parameters
key mandatory key
Returns
  • value associated with the key, null if none

public abstract String getOrigin ()

Retrieve the origin info string of this IR element, if there is one.

public abstract int getPhysicalOffset ()

Retrieve the physical offset (dalvik) associated with this IR.

Returns
  • a dalvik method offset (in bytes); -1 if there is no offset associated with the IR

public abstract Set<Integer> getRegisters ()

public abstract List<IDExpression> getSubExpressions ()

Convenience method used to retrieve all the sub-expressions of this IR, in evaluation order. Uses collectSubExpressions(List).

Returns
  • a list of sub-expressions

public abstract IJavaType getType ()

Get the IR expression type.

Returns
  • the expression type

public abstract IJavaType getTypeForIdentifier (IDVar var)

Get the type of an identifier used by this IR expression. Recursive method.

Parameters
var identifier
Returns
  • the identifier's type

public abstract boolean isArrayElt ()

public abstract boolean isCallInfo ()

Note: this method also returns true if this object is of type IDNewInfo.

public abstract boolean isClassReference ()

public abstract boolean isImm (long expectedRawValue)

public abstract boolean isImm ()

public abstract boolean isInstanceField ()

public abstract boolean isInstruction ()

public abstract boolean isNewArrayInfo ()

public abstract boolean isNewInfo ()

public abstract boolean isOperation (JavaOperatorType expectedOperatorType)

public abstract boolean isOperation ()

Note: this method also returns true if this object is of type IDPredicate.

public abstract boolean isPredicate ()

public abstract boolean isStaticField ()

public abstract boolean isVar ()

public abstract void removeData (String key)

Remove an entry from this IR element's data map.

public abstract int replaceIdentifier (IDVar var, IDExpression repl)

Replace matching identifiers (per same()) by a given expression. Recursive method. Note: the replacement expression is duplicated to avoid reuse.

Parameters
var identifier
repl expression that will replace the identifier
Returns
  • the number of replacements

public abstract boolean replaceSubExpression (IDExpression oldExp, IDExpression newExp)

Replace an expression of this IR. This method does not perform deep replacement.

Parameters
oldExp IR expression to be replaced
newExp replacement expression
Returns
  • success indicator

public abstract void setData (String key, Object value)

Store a key-value pair in this IR element's data map.

Parameters
key mandatory key
value mandatory value

public abstract void setOrigin (String origin)

Set an optional origin info string for this IR element. Note that the origin is stored as an entry in the data map.

public abstract boolean setType (IJavaType type, boolean forced)

Update the type of an expression.

Parameters
type mandatory new type
forced if true, the new type will always be set (compatibility checks are bypassed)
Returns
  • true if the type was updated, false otherwise

public abstract boolean setType (IJavaType type)

Update the type of an expression.

Parameters
type mandatory new type
Returns
  • true if the type was updated, false otherwise

public abstract boolean setTypeForIdentifier (IDVar var, IJavaType type)

Set the type of an identifier used by this IR expression. Recursive method.

Parameters
var identifier
type new type
Returns
  • true if the type was successfully set, false otherwise

public abstract void transferMetadataFrom (IDExpression src)

Transfer (shallow copy) metadata from a source IR to this IR. Currently, this includes the physical offset and the data map.

public abstract void updateAllPhysicalOffsets (int physicalOffset)

Update the physical offset of this element and all its constituents.

Parameters
physicalOffset new physical offset, -1 to reset (to none)

public abstract boolean visitDepthPost (IDVisitor visitor, IDExpression parent, DTreeVisitResults results)

Visit this expression and its constituents, depth-first post-order.

Parameters
visitor visitor object
parent the optional parent of this expression
results an optional result object provided to the visitor, containing flags used to customize the visiting process
Returns
  • success indicator; true unless a different value was specified in DTreeVisitResults when visiting an element

public abstract boolean visitDepthPost (IDVisitor visitor, IDExpression parent)

Visit this expression and its constituents, depth-first post-order.

Parameters
visitor visitor object
parent the optional parent of this expression
Returns
  • success indicator; true unless a different value was specified in DTreeVisitResults when visiting an element

public abstract boolean visitDepthPost (IDVisitor visitor)

Visit this expression and its constituents, depth-first post-order.

Parameters
visitor visitor object
Returns
  • success indicator; true unless a different value was specified in DTreeVisitResults when visiting an element

public abstract boolean visitDepthPre (IDVisitor visitor)

Visit this expression and its constituents, depth-first pre-order.

If the visitor replaces an element, the new element must be specified by calling DTreeVisitResults#setReplacedNode(IDExpression) setReplacedNode().

Parameters
visitor visitor object
Returns
  • success indicator; true unless a different value was specified in DTreeVisitResults when visiting an element

public abstract boolean visitDepthPre (IDVisitor visitor, IDExpression parent, DTreeVisitResults results)

Visit this expression and its constituents, depth-first pre-order.

If the visitor replaces an element, the new element must be specified by calling DTreeVisitResults#setReplacedNode(IDExpression) setReplacedNode().

Parameters
visitor visitor object
parent the optional parent of this expression
results an optional result object provided to the visitor, containing flags used to customize the visiting process
Returns
  • success indicator; true unless a different value was specified in DTreeVisitResults when visiting an element

public abstract boolean visitDepthPre (IDVisitor visitor, IDExpression parent)

Visit this expression and its constituents, depth-first pre-order.

If the visitor replaces an element, the new element must be specified by calling DTreeVisitResults#setReplacedNode(IDExpression) setReplacedNode().

Parameters
visitor visitor object
parent the optional parent of this expression
Returns
  • success indicator; true unless a different value was specified in DTreeVisitResults when visiting an element