Class AbstractNativeDecompilerExtension
java.lang.Object
com.pnfsoftware.jeb.core.AbstractPlugin
com.pnfsoftware.jeb.core.units.code.asm.decompiler.AbstractNativeDecompilerExtension
- All Implemented Interfaces:
IPlugin,INativeDecompilerExtension
public abstract class AbstractNativeDecompilerExtension
extends AbstractPlugin
implements INativeDecompilerExtension
Skeleton for native decompiler extensions. Implementations must extend this class, they should
not directly implement the extension interface.
Decompiler extensions are of two kinds:
- the primary extension, optionally provided by a decompiler plugin: this extension is always
executed first by an extensions manager (and therefore, can decide to stop the execution of any
subsequent extension), in the context of its decompiler
- secondary (additional) extensions, provided as external plugins to JEB: those extensions are
shared objects among the native decompiler objects instantiated during a session. They must check
the type of decompiler before performing meaningful operations (eg, an secondary extension meant
to enhance an EVM decompiler should first make sure that it is called within the context of an
EVM decompiler)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate an unnamed native decompiler extension.Create a native decompiler extension. -
Method Summary
Modifier and TypeMethodDescriptionapplyAdditionalTypes(IDecompiledMethod target, CFG<IEStatement> cfg) The default implementation does nothing and requests continuation.augmentSimulationContext(INativeDecompilerContext decompiler, IERoutineContext ctx, IESimulationResults simulationContext, long offset, IEStatement insn, EState state) The default implementation does nothing and requests continuation.collectCandidateMemoryDerefs(IEGeneric exp, EDefUseInfo defuse, boolean isDef) The default implementation does nothing and requests continuation.convertInstruction(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e) The default implementation does nothing and requests continuation.convertToInlinedCall(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e, long target) The default implementation does nothing and requests continuation.customizeIntermediateOptimizer(INativeDecompilerContext decompiler, IEMasterOptimizer mo) The default implementation does nothing and requests continuation.executePostPipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) The default implementation returnsIN_PROCESSand requests continuation.executePrePipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) The default implementation returnsIN_PROCESSand requests continuation.getName()Retrieve the extension name.Retrieve basic information about the plugin, such as name, version, author, and organization.isMemoryResolutionAllowed(INativeDecompilerContext decompiler, IERoutineContext ctx, IEMem mem) The default implementation does nothing and requests continuation.The default implementation returns false and requests continuation.resolveVariableArgumentInformation(IERoutineContext ctx, CFG<IEStatement> cfg, int iblk, IWildcardPrototype proto) Resolve variable argument information for a routine call.protected voidMethods inherited from class com.pnfsoftware.jeb.core.AbstractPlugin
dispose, getData, setData
-
Field Details
-
logger
-
-
Constructor Details
-
AbstractNativeDecompilerExtension
public AbstractNativeDecompilerExtension()Create an unnamed native decompiler extension. -
AbstractNativeDecompilerExtension
Create a native decompiler extension.- Parameters:
name- extension name
-
-
Method Details
-
setName
-
getName
Retrieve the extension name.- Returns:
- extension name
-
getPluginInformation
Description copied from interface:IPluginRetrieve basic information about the plugin, such as name, version, author, and organization.- Specified by:
getPluginInformationin interfaceIPlugin- Returns:
- the plugin information
-
convertInstruction
public ChainedOperationResult<Boolean> convertInstruction(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e) The default implementation does nothing and requests continuation.- Specified by:
convertInstructionin interfaceINativeDecompilerExtension- Parameters:
converter- converter requesting the extensionctx- routine contexte- the entry to be converted, holding references to theIInstructionand current state of the IR basic block- Returns:
- success indicator - upon success, an extension must return TRUE/STOP, else another conversion will be attempted, leading to undefined behavior
-
convertToInlinedCall
public ChainedOperationResult<Boolean> convertToInlinedCall(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e, long target) The default implementation does nothing and requests continuation.- Specified by:
convertToInlinedCallin interfaceINativeDecompilerExtension- Parameters:
converter- converter requesting the extensionctx- routine contexte- instruction entry being convertedtarget- target native address- Returns:
- success indicator
-
resolveVariableArgumentInformation
public ChainedOperationResult<VariableArgumentInformation> resolveVariableArgumentInformation(IERoutineContext ctx, CFG<IEStatement> cfg, int iblk, IWildcardPrototype proto) Description copied from interface:INativeDecompilerExtensionResolve variable argument information for a routine call.- Specified by:
resolveVariableArgumentInformationin interfaceINativeDecompilerExtension- Parameters:
ctx- routine contextcfg- routine CFGiblk- block indexproto- call prototype- Returns:
- variable argument information, if resolved
-
executePrePipelineStage
public ChainedOperationResult<DecompilationStatus> executePrePipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) The default implementation returnsIN_PROCESSand requests continuation.- Specified by:
executePrePipelineStagein interfaceINativeDecompilerExtension- Parameters:
stage- the stage about to be executedtarget- the method being decompiled- Returns:
DecompilationStatus.IN_PROCESSto continue; for this method, returningDecompilationStatus.COMPLETEDmeans to skip the stage execution (it does not mean the decompilation is complete)
-
executePostPipelineStage
public ChainedOperationResult<DecompilationStatus> executePostPipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) The default implementation returnsIN_PROCESSand requests continuation.- Specified by:
executePostPipelineStagein interfaceINativeDecompilerExtension- Parameters:
stage- stage that just executedtarget- the method being decompiled- Returns:
- decompilation status override
-
applyAdditionalTypes
public ChainedOperationResult<Boolean> applyAdditionalTypes(IDecompiledMethod target, CFG<IEStatement> cfg) The default implementation does nothing and requests continuation.- Specified by:
applyAdditionalTypesin interfaceINativeDecompilerExtension- Parameters:
target- method being decompiledcfg- routine CFG- Returns:
- success indicator
-
customizeIntermediateOptimizer
public ChainedOperationResult<Boolean> customizeIntermediateOptimizer(INativeDecompilerContext decompiler, IEMasterOptimizer mo) The default implementation does nothing and requests continuation.- Specified by:
customizeIntermediateOptimizerin interfaceINativeDecompilerExtension- Parameters:
decompiler- native decompiler contextmo- IR master optimizer- Returns:
- success indicator
-
augmentSimulationContext
public ChainedOperationResult<Boolean> augmentSimulationContext(INativeDecompilerContext decompiler, IERoutineContext ctx, IESimulationResults simulationContext, long offset, IEStatement insn, EState state) The default implementation does nothing and requests continuation.- Specified by:
augmentSimulationContextin interfaceINativeDecompilerExtension- Parameters:
decompiler- native decompiler contextctx- routine contextsimulationContext- simulation context, the extension may record information in this contextoffset- IR offsetinsn- IR instructionstate- input pre-execution state at the provided instruction- Returns:
- success indicator
-
isMemoryResolutionAllowed
public ChainedOperationResult<Boolean> isMemoryResolutionAllowed(INativeDecompilerContext decompiler, IERoutineContext ctx, IEMem mem) The default implementation does nothing and requests continuation.- Specified by:
isMemoryResolutionAllowedin interfaceINativeDecompilerExtension- Parameters:
decompiler- native decompiler contextctx- routine contextmem- memory expression considered for resolution- Returns:
- resolution policy override
-
collectCandidateMemoryDerefs
public ChainedOperationResult<Boolean> collectCandidateMemoryDerefs(IEGeneric exp, EDefUseInfo defuse, boolean isDef) The default implementation does nothing and requests continuation.- Specified by:
collectCandidateMemoryDerefsin interfaceINativeDecompilerExtension- Parameters:
exp- an IR expression (in its current form, always an EMem)defuse- sink for collection; also provides the currentIR contextisDef- true if potentially-defined variables are to be collected, false if potentially-used variables are to be collected- Returns:
- success indicator
-
isOpaquePointerType
The default implementation returns false and requests continuation.- Specified by:
isOpaquePointerTypein interfaceINativeDecompilerExtension- Parameters:
t- a type- Returns:
- true if the type is "opaque"
-