Interface INativeDecompilerExtension
- All Superinterfaces:
IPlugin
- All Known Subinterfaces:
INativeDecompilerExtensionsManager
- All Known Implementing Classes:
AbstractNativeDecompilerExtension
Decompiler extension plugins. Refer to
AbstractNativeDecompilerExtension for additional
details concerning the lifecycle of those objects.
Important notes:
- Be careful with state data stored in decompiler extensions; those plugins are shared among all
decompilers (except for a decompiler primary extension)
- Methods must not return null
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionapplyAdditionalTypes(IDecompiledMethod target, CFG<IEStatement> cfg) This method is called by the decompiler just before type propagation on the IR-CFG takes place.augmentSimulationContext(INativeDecompilerContext decompiler, IERoutineContext ctx, IESimulationResults simulationContext, long offset, IEStatement insn, EState state) This method is called during the early simulation phase (unoptimized IR emulation) in the decompilation pipeline.collectCandidateMemoryDerefs(IEGeneric exp, EDefUseInfo defuse, boolean isDef) This method is called potentially-used/defined variables (candidates) are being collected forIEMemIR expressions.convertInstruction(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e) Convert a native instruction to IR code.convertToInlinedCall(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e, long target) Convert a native instruction into an inlined call.customizeIntermediateOptimizer(INativeDecompilerContext decompiler, IEMasterOptimizer mo) This method is called by a decompiler unit to customize a master IR optimizer.executePostPipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) Extensions may customize the decompilation pipeline by implementing this method.executePrePipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) Extensions may customize the decompilation pipeline by implementing this method.isMemoryResolutionAllowed(INativeDecompilerContext decompiler, IERoutineContext ctx, IEMem mem) This method is called when the decompiler is attempting to dereference memory in order to replace a memory access by an actual immediate value.This method is called duringIECall's def-use determination on parameters that are unresolved pointer types.resolveVariableArgumentInformation(IERoutineContext ctx, CFG<IEStatement> cfg, int iblk, IWildcardPrototype proto) Resolve variable argument information for a routine call.Methods inherited from interface com.pnfsoftware.jeb.core.IPlugin
dispose, getData, getPluginInformation, setData
-
Method Details
-
convertInstruction
ChainedOperationResult<Boolean> convertInstruction(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e) Convert a native instruction to IR code. It is the responsibility ofnative code convertersto decide whether they want to call this method, before attempting to convert the instruction themselves. Extensions implementing this method have a chance to provide alternate conversion of low-level instructions or even provide conversion support for instructions not supported by a converter.- 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
ChainedOperationResult<Boolean> convertToInlinedCall(IEConverter<?> converter, IERoutineContext ctx, ConverterInstructionEntry<?> e, long target) Convert a native instruction into an inlined call.- Parameters:
converter- converter requesting the extensionctx- routine contexte- instruction entry being convertedtarget- target native address- Returns:
- success indicator
-
executePrePipelineStage
ChainedOperationResult<DecompilationStatus> executePrePipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) Extensions may customize the decompilation pipeline by implementing this method. It is called by the pipeline at the beginning of each stage of method decompilation.- 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
ChainedOperationResult<DecompilationStatus> executePostPipelineStage(NativeDecompilationStage stage, IDecompiledMethod target) Extensions may customize the decompilation pipeline by implementing this method. It is called by the pipeline at the end of each stage of method decompilation.- Parameters:
stage- stage that just executedtarget- the method being decompiled- Returns:
- decompilation status override
-
resolveVariableArgumentInformation
ChainedOperationResult<VariableArgumentInformation> resolveVariableArgumentInformation(IERoutineContext ctx, CFG<IEStatement> cfg, int iblk, IWildcardPrototype proto) Resolve variable argument information for a routine call.- Parameters:
ctx- routine contextcfg- routine CFGiblk- block indexproto- call prototype- Returns:
- variable argument information, if resolved
-
applyAdditionalTypes
ChainedOperationResult<Boolean> applyAdditionalTypes(IDecompiledMethod target, CFG<IEStatement> cfg) This method is called by the decompiler just before type propagation on the IR-CFG takes place. Extensions can use it to set additional types on IR expressions.- Parameters:
target- method being decompiledcfg- routine CFG- Returns:
- success indicator
-
customizeIntermediateOptimizer
ChainedOperationResult<Boolean> customizeIntermediateOptimizer(INativeDecompilerContext decompiler, IEMasterOptimizer mo) This method is called by a decompiler unit to customize a master IR optimizer. Extensions may use it to change settings of the master optimizer, provide additional IR optimizers, etc.- Parameters:
decompiler- native decompiler contextmo- IR master optimizer- Returns:
- success indicator
-
augmentSimulationContext
ChainedOperationResult<Boolean> augmentSimulationContext(INativeDecompilerContext decompiler, IERoutineContext ctx, IESimulationResults simulationContext, long offset, IEStatement insn, EState state) This method is called during the early simulation phase (unoptimized IR emulation) in the decompilation pipeline. Extensions can provide additional details to enhance further decompilation stages.For an example of this method, refer to the MIPS decompiler primary extension code.
- 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
ChainedOperationResult<Boolean> isMemoryResolutionAllowed(INativeDecompilerContext decompiler, IERoutineContext ctx, IEMem mem) This method is called when the decompiler is attempting to dereference memory in order to replace a memory access by an actual immediate value. Extension can prevent a resolution that could normally take place.- Parameters:
decompiler- native decompiler contextctx- routine contextmem- memory expression considered for resolution- Returns:
- resolution policy override
-
collectCandidateMemoryDerefs
ChainedOperationResult<Boolean> collectCandidateMemoryDerefs(IEGeneric exp, EDefUseInfo defuse, boolean isDef) This method is called potentially-used/defined variables (candidates) are being collected forIEMemIR expressions. It may be used to replace EMem's built-in implementation, which uses gendec internal heuristics, or add to the results generated by the built-in implementation.- 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
This method is called duringIECall's def-use determination on parameters that are unresolved pointer types. If a type is deemed as "opaque" by this method, the pointer is not considered to access any global or local data. I.e., its effect on def-use calculation is none.- Parameters:
t- a type- Returns:
- true if the type is "opaque"
-