| com.pnfsoftware.jeb.core.units.code.asm.decompiler.IEConverter<InsnType extends com.pnfsoftware.jeb.core.units.code.IInstruction> |
Known Indirect Subclasses
AbstractConverter<InsnType extends IInstruction>
|
Definition of an IR expression converter, used by the generic decompiler to convert native
machine code to an intermediate representation. Decompiler plugins are discouraged from
implementing this interface on their own; they they should extend the AbstractConverter
class instead.
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| abstract IWildcardPrototype |
buildFailsafePrototype(IERoutineContext ctx, IEStatement stm)
Create a simple, failsafe prototype for the given routine.
| ||||||||||
| abstract IERoutineContext |
convert(INativeMethodItem routine, boolean delayBuild)
Convert a native code routine to its initial intermediate representation.
| ||||||||||
| abstract IERoutineContext |
convert(INativeMethodItem routine)
Convert a routine.
| ||||||||||
| abstract List<IEGeneric> |
convertParameterExpressions(IWildcardPrototype prototype, int varArgCount)
Given a prototype, determine the list of IR expressions representing the input expressions
(would also contain implicitly read registers).
| ||||||||||
| abstract List<IEGeneric> |
convertReturnExpressions(IWildcardPrototype prototype)
Given a prototype, determine the list of IR expressions representing the output expressions
(would also contain spoiled registers, which are implicitly written).
| ||||||||||
| abstract IEGeneric |
convertReturnLocation(IWildcardPrototype prototype)
Given a prototype, determine the IR expression representing the return address
location of a call to a method of said prototype.
| ||||||||||
| abstract IEMem |
createStackMemoryAccess(IEGeneric address, int bitsize)
Create an EMem using the adequate segment register (if any) for the current converter.
| ||||||||||
| abstract int |
defaultPCConversion(IERoutineContext ctx)
Convert PC-assignment to EJumpFar statements.
| ||||||||||
| abstract int |
determineStackPointerDeltaAfterIRCall(IWildcardPrototype prototype)
Given a prototype, determine the stack pointer delta (in bytes) after the ECall
executed and returned.
| ||||||||||
| abstract int |
getAddressBitsize()
Determine the native address in bits.
| ||||||||||
| abstract IEBranchDetails |
getDefaultBranchToRoutineSideEffects(INativeMethodItem optionalRoutine)
This heuristic does a best-effort determination of the side-effects resulting by calling a
sub routine (used/defined registers, stack delta).
| ||||||||||
| abstract IEGlobalContext |
getGlobalContext()
Retrieve the global program context.
| ||||||||||
| abstract int |
getProcessorMode(IEState state)
Retrieve the current processor mode relative to this EState.
| ||||||||||
| abstract IEVar |
getProgramCounter()
Retrieve the IR variable object that represents the program counter.
| ||||||||||
| abstract int |
getRegisterBitsize()
Determine the standard native register size in bits.
| ||||||||||
| abstract IEVar |
getReturnAddressRegister()
Retrieve the IR variable object that represents the return address register.
| ||||||||||
| abstract IEVar |
getStackPointer()
Retrieve the IR variable object that represents the stack pointer.
| ||||||||||
| abstract void |
initializeStateRegisters(IEState state, Long optionalNativeProgramCounter)
Initialize the registers of an IR execution state to safe defaults.
| ||||||||||
| abstract int |
insertReturns(IERoutineContext ctx)
This method introduces EReturn statements into the IR.
| ||||||||||
| abstract boolean |
resolveCustomCalls(INativeCodeUnit<?> pbcu, IERoutineContext ctx)
Implementations should be aggressive and fast: calls to this method should always be enclosed
in a try-catch.
| ||||||||||
Create a simple, failsafe prototype for the given routine.
| ctx | routine for which a failsafe prototype is to be generated |
|---|---|
| stm | optional statement calling into the routine |
Convert a native code routine to its initial intermediate representation. The initial IR
consists only of EAssign, EJump, ENop and
EUntranslatedInstruction statements. Each statement instruction must have a
size of 1. The resulting IR is verified and the initial IR-CFG
created.
| routine | the routine to be converted; must have a data definition |
|---|---|
| delayBuild | if true, the IR validation and CFG building will not take place (in that
case, getCfg() would return false) |
Convert a routine. Convenience method for convert(routine, false).
Given a prototype, determine the list of IR expressions representing the input expressions (would also contain implicitly read registers).
Used by ECall.
Given a prototype, determine the list of IR expressions representing the output expressions (would also contain spoiled registers, which are implicitly written).
Used by ECall.
Given a prototype, determine the IR expression representing the return address location of a call to a method of said prototype.
Used by ECall.
Create an EMem using the adequate segment register (if any) for the current converter.
Convert PC-assignment to EJumpFar statements. This method is a fail-safe converter for PC-assignments, and should be call as late as possible in the IR conversion phases.
Given a prototype, determine the stack pointer delta (in bytes) after the ECall
executed and returned.
Careful: "IR-Call" and the "native-call" may not have the same structure; it depends on how
the conversion of "native-call" is implemented, and therefore is converter-dependent. The SP
delta returned by this method is the one after an execution over ECall.
Used by ECall.
Determine the native address in bits.
This heuristic does a best-effort determination of the side-effects resulting by calling a sub routine (used/defined registers, stack delta). Implementors should not attempt to do complex determination (eg, involving IR processing) in this method; the result provided by this method is meant to augment PC-assignments in earlier phases of the decompilation pipeline.
Used by EStandardCallSiteResolver.
| optionalRoutine | the optional target routine; if provided, the implementation may use that information to provide more accurate results |
|---|
Retrieve the global program context. There is a single global context per decompiler, common to all ERoutineContext routine contexts.
Retrieve the current processor mode relative to this EState. A bit can be set in the EState to indicate the current mode (for example ARM Thumb Bit).
| state | current state |
|---|
Retrieve the IR variable object that represents the program counter.
Determine the standard native register size in bits.
Retrieve the IR variable object that represents the return address register.
Retrieve the IR variable object that represents the stack pointer.
Initialize the registers of an IR execution state to safe defaults.
| state | input state to be initialized |
|---|---|
| optionalNativeProgramCounter | optional current native PC |
This method introduces EReturn statements into the IR. Must be performed only after prototype discovery is completed.
Data chains: not used, may be invalidated; in the latter case, this method is responsible for recalculating them.
| ctx | the routine context |
|---|
Implementations should be aggressive and fast: calls to this method should always be enclosed in a try-catch.
TODO: MOVE to the CBDU