Package com.pnfsoftware.jeb.core.units.code.android.ir
package com.pnfsoftware.jeb.core.units.code.android.ir
This package contains types used to publicly access and manipulate JEB's DEX Decompiler (referred
to as
Additional resources: refer to the User Manual and Technical Blogs, at https://www.pnfsoftware.com.
dexdec) Intermediate Representation (IR) objects. Users can use this API to write
custom IR optimizers, that will be run by dexdec when decompiling code. Interfaces and
classes/enums in this package start with ID... or D..., respectively -- for
"(Interface) dexdec" (or dex/dalvik)). Exception classes are named
DexDec...Exception.
Design note: Note the symmetry with JEB's Generic Decompiler (gendec) naming
conventions, whose public interfaces and types start with IE... or E.... That
symmetry does not extend to naming only: dexdec IR type structure closely mirror,
whenever possible, gendec's.
dexdec IR optimizer plugins may be written in Python or Java.
A sample skeleton plugin, in Python:
#?type=dexdec-ir
from com.pnfsoftware.jeb.core.units.code.android.ir import AbstractDOptimizer
class DOptSamplePython(AbstractDOptimizer):
def perform(self):
# do not perform optimizations, simply print out each IR instruction of the current IR CFG
for blk in self.cfg: # BasicBlock (of IDInstruction)
for insn in blk: # IDInstruction
logger.info("%04X: %s" % (insn.getOffset(), insn))
# no optimization performed
return 0
The same sample plugin, in Java:
//?type=dexdec-ir
import com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock;
import com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDOptimizer;
import com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction;
public class DOptSampleJava extends AbstractDOptimizer {
// note: implicit no-arg constructor is calling super()
@Override
public int perform() {
// do not perform optimizations, simply print out each IR instruction of the current IR CFG
for(BasicBlock<IDInstruction> b: cfg) {
for(IDInstruction insn: b) {
logger.info("%04X: %s", insn.getOffset(), insn);
}
}
// no optimization performed
return 0;
}
}
Refer to the sub-directory coreplugins/, located in the JEB installation folder, for
examples.Additional resources: refer to the User Manual and Technical Blogs, at https://www.pnfsoftware.com.
-
ClassDescriptionBase class for
dexdec(DEX decompiler) IR optimizer plugins working on a collection of IR contexts.Skeleton for an IR Master Optimizer instrumenter.Base class fordexdec(DEX decompiler) IR optimizer plugins.copy()options for IR expressions.The emulation policy for API methods relying or depending on the execution environment, the date and time, and random number generators.A Dalvik-to-IR conversion exception.Those objects are used to wrap throwables raised by the emulated code.The emulation of some Dalvik code failed because there was an error reported when translating to IR.The emulation is taking too long (maximum iteration count exceeded).An error occurred while executing code in the emulator-controlled sandbox.An internal exception used when attempting to emulate a method whose body was removed.The emulation is taking too long (timeout exceeded).This exception and its sub-types are throw by theState componentsandevaluatemethods.An error occurred in code running in a restricted thread not directly managed by the emulator.An error occurred while evaluating native code.dexdecIR emulation parameters object.dexdecIR formatting context, providing an output sink and specifications for the output.dexdecIR types of invocation, used to specifyIDCallInfo.This enumeration defines the opcode types of the intermediate representation (IR)instructionsused bydexdec.dexdecIR optimizer type.Type information object used to collect typing results when propagating types through an SSA'ed IR.Details about a typing conflict.dexdecIR access and manipulation utility methods.Visit result object, provided to the call-back methods of adexdecIR visitor object.dexdecIR array element.Base interface for alldexdecIR elements.An emulated class, represent the type of an emulated object.An emulator context, used bydexdecState objects.An emulator frame, used bydexdecState objects.An interface for user-defined hooks called bydexdec's IR emulator when executing internal (in DEX) code.An emulated object, representing an internal emulated object.dexdecexception handler definition.dexdecexception item definition.Base interface for alldexdecIR expressions, such as IR instructions, fields/attributes, immediates, variables/identifiers, operations, etc.dexdecIR generic interface for field elements, that is, static fields and instance fields.dexdecIR global context.This dual-purposedexdecIR element serves to encode immediate values (primitives and pooled strings) andevaluatedvalues (primitives and objects).dexdecIR interface for objects representing a pool index (e.g.dexdecIR instance field.dexdecIR instruction object.dexdecIR generic interface holding invocation information forIDCallInfo,IDNewInfo,IDNewArrayInfo,IDAllocObjectInfo.A manager ofIR optimizers.Instrumenter interface for IRmaster optimizer(MO).dexdecIR method context.Method execution helper interface, to be registered with adexdecIR state.dexdecIR element holdingnewarray creation information.dexdecIR operation expression.Plugin interface fordexdec(DEX decompiler) IR optimizer plugins.dexdecIR reference type object.An interface for user-defined hooks called bydexdec's IR sandbox when executing external (not in DEX) code.dexdecIR state (referred as "State"), used to perform IR evaluations, emulation and sandboxing.dexdecIR static field, including a type'sclasspseudo-attribute.dexdecIR switch data, used to specify the case and target values of a high-levelswitchinstruction.dexdecIR target information, containing an intra-method IR offset.dexdecexception handling information, optionally provided by anIR method context.Type information provider interface.dexdecIR interface used to represent a variable (a.k.a.Specialized tree node visitor interface fordexdecIR expressions.