Interface IDecompilerUnit
- All Superinterfaces:
IAddressableUnit
,IEventSource
,IInteractiveUnit
,IUnit
,IUnitCreator
,IUserDataSupport
- All Known Subinterfaces:
IDexDecompilerUnit
,INativeDecompilerUnit<InsnType>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
This indicative flag is to let the decompiler know that the current decompilation is part of a batch decompilation.static final int
This indicative flag is to let the decompiler know that the intermediate representation shall be kept.static final int
Restrictive flag: if the decompiler supports concurrent decompilations (multi-threading), setting this flag requests it to disable it and perform serial decompilations.static final int
Restrictive flag: disallow deferred decompilations.static final int
Restrictive flag: shallow decompilation (eg, a request to decompile a method would not decompile inner items contained within the method).static final int
Special flag indicating that the final stage of a method decompilation (the generation and optimization of its abstract syntax tree) shall be skipped.static final int
Indicate that the decompiler should perform a fresh decompilation up to theNativeDecompilationStage.IR_CONVERSION
stage (regardless of the provided user-requested stage).static final int
Special flag indicating that already decompiled methods should be temporarily redecompiled.static final String
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecompile
(String identifier) Determine if a decompilation at the provided identifier/address has a chance to succeed.boolean
Determine whether this decompiler can perform decompilations concurrently.boolean
decompile
(Collection<String> identifiers, DecompilationContext ctx) Decompile multiple items.boolean
Decompile everything meaningful.boolean
Decompile all classes.boolean
Decompile all methods.boolean
decompileClass
(String identifier) Decompile a class.boolean
decompileClass
(String identifier, DecompilationContext ctx) Decompile a class.boolean
decompileClasses
(Collection<String> identifiers, DecompilationContext ctx) Decompile a collection of classes.boolean
decompileField
(String identifier) Decompile a field.boolean
decompileField
(String identifier, DecompilationContext ctx) Decompile a field.boolean
decompileMethod
(String identifier) Decompile a method.boolean
decompileMethod
(String identifier, DecompilationContext ctx) Decompile a method.boolean
decompileMethods
(Collection<String> identifiers, DecompilationContext ctx) Decompile a collection of methods.decompileToUnit
(String identifier) Retrieve a decompiled unit or perform a decompilation.decompileToUnit
(String identifier, DecompilationContext ctx) Retrieve a decompiled unit or perform a decompilation.Get the code unit (possibly the parent, possibly null) that is providing the low-level data to this decompiler.getDecompiledClassText
(String identifier) Retrieve the decompiled source for the provided class.getDecompiledFieldText
(String identifier) Retrieve the decompiled source for the provided field.getDecompiledMethodText
(String identifier) Retrieve the decompiled source for the provided method.getDecompiledText
(String identifier) Retrieve the decompiled source for the provided item.getDecompiledUnit
(String identifier) Retrieve the unit representing the decompiled entity at the provided identifier/address.Convenience method used to create an exporter object used to decompile and export some or all potentially decompilable to source files on disk.Get the type of output produced by this decompiler.int
Set the maximum number of threads to be used when decompiling multiple items concurrently.void
Remove all decompilations.void
removeDecompilation
(String identifier) Remove a decompilation.void
Remove all decompilation objects that exist but are not directly or indirectly managed by an existing decompiled source unit.void
Reset all decompilations.void
resetDecompilation
(String identifier) Reset a decompilation.default void
This method instructs the decompiler to perform garbage collection.void
setThreadPoolSize
(int threadPoolSize) Get the maximum number of threads to be used when decompiling multiple items concurrently.Methods inherited from interface com.pnfsoftware.jeb.core.units.IAddressableUnit
getAddressLabel, getAddressLabels, getAddressOfItem, getCanonicalAddress, getItemAtAddress, getItemObject, getRelatedItems, getWellKnownAddresses, isValidAddress
Methods inherited from interface com.pnfsoftware.jeb.util.events.IEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, removeListener, setParentSource
Methods inherited from interface com.pnfsoftware.jeb.core.units.IInteractiveUnit
addressToLocation, canExecuteAction, executeAction, executeAction, getAddressActions, getCommentManager, getFullComment, getFullComments, getGlobalActions, getInlineComment, getInlineComments, getItemActions, getMetadataManager, locationToAddress, prepareExecution, setInlineComment
Methods inherited from interface com.pnfsoftware.jeb.core.units.IUnit
addChild, addChild, canBePersisted, dispose, generateQuickState, getChildren, getContributions, getCreationTimestamp, getDescription, getExtraInputs, getFormatter, getFormatType, getIconData, getInput, getInterpreters, getLock, getName, getNotes, getNotificationManager, getParent, getParentArtifact, getParentProject, getPropertyDefinitionManager, getPropertyManager, getRealName, getStatus, getUid, getUnitProcessor, initializePropertyObjects, isDisposed, isProcessed, isStale, isTransientChild, notifyGenericChange, postDeserialization, process, removeChild, setName, setNotes, setParent, setRealName, setUnitProcessor
Methods inherited from interface com.pnfsoftware.jeb.core.IUserDataSupport
clearAllData, getAllData, getData, setData
-
Field Details
-
propnameListOfDisabledExternalPlugins
- See Also:
-
FLAG_NO_INNER_DECOMPILATION
static final int FLAG_NO_INNER_DECOMPILATIONRestrictive flag: shallow decompilation (eg, a request to decompile a method would not decompile inner items contained within the method).A decompiler may choose to ignore this flag.
- See Also:
-
FLAG_NO_DEFERRED_DECOMPILATION
static final int FLAG_NO_DEFERRED_DECOMPILATIONRestrictive flag: disallow deferred decompilations. Deferred decompilations are decompilations of additional items, that usually take place after the main request has completed or partially completed, in order to provide better output.A decompiler may choose to ignore this flag.
- See Also:
-
FLAG_NO_CONCURRENT_DECOMPILATION
static final int FLAG_NO_CONCURRENT_DECOMPILATIONRestrictive flag: if the decompiler supports concurrent decompilations (multi-threading), setting this flag requests it to disable it and perform serial decompilations.A decompiler may choose to ignore this flag.
- See Also:
-
FLAG_NO_METHOD_AST_GENERATION
static final int FLAG_NO_METHOD_AST_GENERATIONSpecial flag indicating that the final stage of a method decompilation (the generation and optimization of its abstract syntax tree) shall be skipped.By using this flags, these other flags will be automatically set:
FLAG_NO_DEFERRED_DECOMPILATION
.
It is also recommended to useFLAG_NO_INNER_DECOMPILATION
when setting this flag.A decompiler cannot ignore this flag.
- See Also:
-
FLAG_TEMP_FORCED_REDECOMPILATIONS
static final int FLAG_TEMP_FORCED_REDECOMPILATIONSSpecial flag indicating that already decompiled methods should be temporarily redecompiled. Existing decompilations will not be replaced by new ones.By using this flags, these other flags will be automatically set:
FLAG_NO_DEFERRED_DECOMPILATION
,FLAG_NO_METHOD_AST_GENERATION
.
It is also recommended to useFLAG_NO_INNER_DECOMPILATION
when setting this flag.A decompiler cannot ignore this flag.
- See Also:
-
FLAG_BATCH_DECOMPILATION
static final int FLAG_BATCH_DECOMPILATIONThis indicative flag is to let the decompiler know that the current decompilation is part of a batch decompilation. This flag may be provided to internal components, that may change their behavior when it is set.A decompiler may ignore this flag.
- See Also:
-
FLAG_KEEP_IR
static final int FLAG_KEEP_IRThis indicative flag is to let the decompiler know that the intermediate representation shall be kept.A decompiler may not be able to honor this flag.
- See Also:
-
FLAG_STANDALONE_IR_CONVERSION
static final int FLAG_STANDALONE_IR_CONVERSIONIndicate that the decompiler should perform a fresh decompilation up to theNativeDecompilationStage.IR_CONVERSION
stage (regardless of the provided user-requested stage). The decompilation will not be registered with the decompiler. In general, this flag should be combined withFLAG_KEEP_IR
in order to examine the IR post decompilation.A decompiler may not be able to honor this flag.
- See Also:
-
-
Method Details
-
getCodeUnit
ICodeUnit getCodeUnit()Get the code unit (possibly the parent, possibly null) that is providing the low-level data to this decompiler.- Returns:
- a code unit, possibly null
-
getOutputType
DecompilerOutputType getOutputType()Get the type of output produced by this decompiler.- Returns:
- the unit (newly created or retrieved) or null if no decompilation could be performed
-
canDecompile
Determine if a decompilation at the provided identifier/address has a chance to succeed. A positive result may result in a valid decompilation; a negative result will always result in an invalid/impossible decompilation.- Parameters:
identifier
-- Returns:
-
getDecompiledUnit
Retrieve the unit representing the decompiled entity at the provided identifier/address. No decompilation is performed.- Parameters:
identifier
- the identifier or address- Returns:
- the unit or null, if no decompilation at the provided identifier previously took place
-
decompileToUnit
Retrieve a decompiled unit or perform a decompilation. This is a high-level function used to decompile generate meaningful (to clients) decompiled code units. The decompiler may normalize the identifier.- Parameters:
identifier
- the identifier or address at which the decompilation should be performed- Returns:
- the source unit
-
decompileToUnit
Retrieve a decompiled unit or perform a decompilation. This is a high-level function used to decompile and generate meaningful (to clients)source code units
. The decompiler may normalize the identifier.If a source unit encompassing the provided identifier address already exists, it is returned.
- Parameters:
identifier
- the identifier or address at which the decompilation should be performedctx
- optional decompilation context and options- Returns:
- a source unit, null on error
-
decompileClass
Decompile a class.- Parameters:
identifier
- class identifier- Returns:
- success indicator
-
decompileClass
Decompile a class.- Parameters:
identifier
- class identifierctx
-- Returns:
- success indicator
-
decompileField
Decompile a field.- Parameters:
identifier
- field identifier- Returns:
- success indicator
-
decompileField
Decompile a field.- Parameters:
identifier
- field identifierctx
-- Returns:
- success indicator
-
decompileMethod
Decompile a method.- Parameters:
identifier
- method identifier- Returns:
- success indicator
-
decompileMethod
Decompile a method.- Parameters:
identifier
- method identifierctx
-- Returns:
- success indicator
-
decompileMethods
Decompile a collection of methods.- Parameters:
identifiers
-ctx
-- Returns:
- true if and only if all requested methods were successfully decompiled
-
decompileAllMethods
Decompile all methods.- Parameters:
ctx
-- Returns:
- true if and only if all methods were successfully decompiled
-
decompileClasses
Decompile a collection of classes.- Parameters:
identifiers
-ctx
-- Returns:
- true if and only if all requested classes were successfully decompiled
-
decompileAllClasses
Decompile all classes.- Parameters:
ctx
-- Returns:
- true if and only if all classes were successfully decompiled
-
decompileAll
Decompile everything meaningful.- Parameters:
ctx
-- Returns:
- true if and only if all decompilations succeeded
-
decompile
Decompile multiple items.- Parameters:
identifiers
- a collection of item identifiers to be decompiledctx
- optional context- Returns:
- true if and only if all decompilations succeeded
-
resetDecompilation
Reset a decompilation.Note that if a source unit representing the decompiled object exists, it is not guaranteed to be removed. It will simply be reset, making a redecompilation possible. In order to remove a child unit of a decompiler, use
IUnit.removeChild(com.pnfsoftware.jeb.core.units.IUnit)
. To do a proper removal, useremoveDecompilation(String)
.- Parameters:
identifier
-
-
removeDecompilation
Remove a decompilation.- Parameters:
identifier
-
-
resetAllDecompilations
void resetAllDecompilations()Reset all decompilations. -
removeAllDecompilations
void removeAllDecompilations()Remove all decompilations. -
removeFreeElements
void removeFreeElements()Remove all decompilation objects that exist but are not directly or indirectly managed by an existing decompiled source unit. -
runGarbageCollection
default void runGarbageCollection()This method instructs the decompiler to perform garbage collection. It includes the actions performed byremoveFreeElements()
. -
getDecompiledText
Retrieve the decompiled source for the provided item.- Parameters:
identifier
- object identifier- Returns:
-
getDecompiledClassText
Retrieve the decompiled source for the provided class.- Parameters:
identifier
- class identifier- Returns:
-
getDecompiledFieldText
Retrieve the decompiled source for the provided field.- Parameters:
identifier
- field identifier- Returns:
-
getDecompiledMethodText
Retrieve the decompiled source for the provided method.- Parameters:
identifier
- method identifier- Returns:
-
canPerformConcurrentDecompilations
boolean canPerformConcurrentDecompilations()Determine whether this decompiler can perform decompilations concurrently.- Returns:
-
getThreadPoolSize
int getThreadPoolSize()Set the maximum number of threads to be used when decompiling multiple items concurrently.Will always return 1 if
canPerformConcurrentDecompilations()
is false.- Returns:
-
setThreadPoolSize
void setThreadPoolSize(int threadPoolSize) Get the maximum number of threads to be used when decompiling multiple items concurrently.N/A if
canPerformConcurrentDecompilations()
is false.- Parameters:
threadPoolSize
-
-
getExporter
DecompilerExporter getExporter()Convenience method used to create an exporter object used to decompile and export some or all potentially decompilable to source files on disk.- Returns:
-