public interface

IDecompilerUnit

implements IInteractiveUnit
com.pnfsoftware.jeb.core.units.code.IDecompilerUnit
Known Indirect Subclasses

Class Overview

Generic interface for decompilers.

Summary

Constants
int FLAG_BATCH_DECOMPILATION This indicative flag is to let the decompiler know that the current decompilation is part of a batch decompilation.
int FLAG_KEEP_IR This indicative flag is to let the decompiler know that the intermediate representation shall be kept.
int FLAG_NO_CONCURRENT_DECOMPILATION Restrictive flag: if the decompiler supports concurrent decompilations (multi-threading), setting this flag requests it to disable it and perform serial decompilations.
int FLAG_NO_DEFERRED_DECOMPILATION Restrictive flag: disallow deferred decompilations.
int FLAG_NO_INNER_DECOMPILATION Restrictive flag: shallow decompilation (eg, a request to decompile a method would not decompile inner items contained within the method).
int FLAG_NO_METHOD_AST_GENERATION Special flag indicating that the final stage of a method decompilation (the generation and optimization of its abstract syntax tree) shall be skipped.
int FLAG_STANDALONE_IR_CONVERSION Indicate that the decompiler should perform a fresh decompilation up to the IR_CONVERSION stage (regardless of the provided user-requested stage).
int FLAG_TEMP_FORCED_REDECOMPILATIONS Special flag indicating that already decompiled methods should be temporarily redecompiled.
String propnameListOfDisabledExternalPlugins
Public Methods
abstract boolean canDecompile(String identifier)
Determine if a decompilation at the provided identifier/address has a chance to succeed.
abstract boolean canPerformConcurrentDecompilations()
Determine whether this decompiler can perform decompilations concurrently.
abstract boolean decompile(Collection<String> identifiers, DecompilationContext ctx)
Decompile multiple items.
abstract ISourceUnit decompile(String identifier)
This method is deprecated. use decompileToUnit(String).
abstract boolean decompileAll(DecompilationContext ctx)
Decompile everything meaningful.
abstract boolean decompileAllClasses(DecompilationContext ctx)
Decompile all classes.
abstract boolean decompileAllMethods(DecompilationContext ctx)
Decompile all methods.
abstract boolean decompileClass(String identifier)
Decompile a class.
abstract boolean decompileClass(String identifier, DecompilationContext ctx)
Decompile a class.
abstract boolean decompileClasses(Collection<String> identifiers, DecompilationContext ctx)
Decompile a collection of classes.
abstract boolean decompileField(String identifier)
Decompile a field.
abstract boolean decompileField(String identifier, DecompilationContext ctx)
Decompile a field.
abstract boolean decompileMethod(String identifier, DecompilationContext ctx)
Decompile a method.
abstract boolean decompileMethod(String identifier)
Decompile a method.
abstract boolean decompileMethods(Collection<String> identifiers, DecompilationContext ctx)
Decompile a collection of methods.
abstract ISourceUnit decompileToUnit(String identifier, DecompilationContext ctx)
Retrieve a decompiled unit or perform a decompilation.
abstract ISourceUnit decompileToUnit(String identifier)
Retrieve a decompiled unit or perform a decompilation.
abstract ICodeUnit getCodeUnit()
Get the code unit (possibly the parent, possibly null) that is providing the low-level data to this decompiler.
abstract String getDecompiledClassText(String identifier)
Retrieve the decompiled source for the provided class.
abstract String getDecompiledFieldText(String identifier)
Retrieve the decompiled source for the provided field.
abstract String getDecompiledMethodText(String identifier)
Retrieve the decompiled source for the provided method.
abstract String getDecompiledText(String identifier)
Retrieve the decompiled source for the provided item.
abstract ISourceUnit getDecompiledUnit(String identifier)
Retrieve the unit representing the decompiled entity at the provided identifier/address.
abstract 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.
abstract List<String> getInferredTypes(String msig, int moff, int varindex)
This method is deprecated. do not use
abstract DecompilerOutputType getOutputType()
Get the type of output produced by this decompiler.
abstract int getThreadPoolSize()
Set the maximum number of threads to be used when decompiling multiple items concurrently.
abstract void removeAllDecompilations()
Remove all decompilations.
abstract void removeDecompilation(String identifier)
Remove a decompilation.
abstract void removeFreeElements()
Remove all decompilation objects that exist but are not directly or indirectly managed by an existing decompiled source unit.
abstract void resetAllDecompilations()
Reset all decompilations.
abstract void resetDecompilation(String identifier)
Reset a decompilation.
abstract void runGarbageCollection()
This method instructs the decompiler to perform garbage collection.
abstract void setThreadPoolSize(int threadPoolSize)
Get the maximum number of threads to be used when decompiling multiple items concurrently.
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.IUnitCreator
From interface com.pnfsoftware.jeb.core.IUserDataSupport
From interface com.pnfsoftware.jeb.core.units.IAddressableUnit
From interface com.pnfsoftware.jeb.core.units.IInteractiveUnit
From interface com.pnfsoftware.jeb.core.units.IUnit
From interface com.pnfsoftware.jeb.util.events.IEventSource

Constants

public static final int FLAG_BATCH_DECOMPILATION

This 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.

Constant Value: 32 (0x00000020)

public static final int FLAG_KEEP_IR

This 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.

Constant Value: 64 (0x00000040)

public static final int FLAG_NO_CONCURRENT_DECOMPILATION

Restrictive 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.

Constant Value: 4 (0x00000004)

public static final int FLAG_NO_DEFERRED_DECOMPILATION

Restrictive 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.

Constant Value: 2 (0x00000002)

public static final int FLAG_NO_INNER_DECOMPILATION

Restrictive 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.

Constant Value: 1 (0x00000001)

public static final int FLAG_NO_METHOD_AST_GENERATION

Special 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 use FLAG_NO_INNER_DECOMPILATION when setting this flag.

A decompiler cannot ignore this flag.

Constant Value: 8 (0x00000008)

public static final int FLAG_STANDALONE_IR_CONVERSION

Indicate that the decompiler should perform a fresh decompilation up to the 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 with FLAG_KEEP_IR in order to examine the IR post decompilation.

A decompiler may not be able to honor this flag.

Constant Value: 128 (0x00000080)

public static final int FLAG_TEMP_FORCED_REDECOMPILATIONS

Special 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 use FLAG_NO_INNER_DECOMPILATION when setting this flag.

A decompiler cannot ignore this flag.

Constant Value: 16 (0x00000010)

public static final String propnameListOfDisabledExternalPlugins

Constant Value: "ListOfDisabledExternalPlugins"

Public Methods

public abstract boolean canDecompile (String identifier)

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.

public abstract boolean canPerformConcurrentDecompilations ()

Determine whether this decompiler can perform decompilations concurrently.

public abstract boolean decompile (Collection<String> identifiers, DecompilationContext ctx)

Decompile multiple items.

Parameters
identifiers a collection of item identifiers to be decompiled
ctx optional context
Returns
  • true if and only if all decompilations succeeded

public abstract ISourceUnit decompile (String identifier)

This method is deprecated.
use decompileToUnit(String).

DO NOT USE. Use decompileToUnit(String) instead. Left to maintain script compatibility.

public abstract boolean decompileAll (DecompilationContext ctx)

Decompile everything meaningful.

Returns
  • true if and only if all decompilations succeeded

public abstract boolean decompileAllClasses (DecompilationContext ctx)

Decompile all classes.

Returns
  • true if and only if all classes were successfully decompiled

public abstract boolean decompileAllMethods (DecompilationContext ctx)

Decompile all methods.

Returns
  • true if and only if all methods were successfully decompiled

public abstract boolean decompileClass (String identifier)

Decompile a class.

Parameters
identifier class identifier
Returns
  • success indicator

public abstract boolean decompileClass (String identifier, DecompilationContext ctx)

Decompile a class.

Parameters
identifier class identifier
Returns
  • success indicator

public abstract boolean decompileClasses (Collection<String> identifiers, DecompilationContext ctx)

Decompile a collection of classes.

Returns
  • true if and only if all requested classes were successfully decompiled

public abstract boolean decompileField (String identifier)

Decompile a field.

Parameters
identifier field identifier
Returns
  • success indicator

public abstract boolean decompileField (String identifier, DecompilationContext ctx)

Decompile a field.

Parameters
identifier field identifier
Returns
  • success indicator

public abstract boolean decompileMethod (String identifier, DecompilationContext ctx)

Decompile a method.

Parameters
identifier method identifier
Returns
  • success indicator

public abstract boolean decompileMethod (String identifier)

Decompile a method.

Parameters
identifier method identifier
Returns
  • success indicator

public abstract boolean decompileMethods (Collection<String> identifiers, DecompilationContext ctx)

Decompile a collection of methods.

Returns
  • true if and only if all requested methods were successfully decompiled

public abstract ISourceUnit decompileToUnit (String identifier, DecompilationContext ctx)

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 performed
ctx optional decompilation context and options
Returns
  • a source unit, null on error

public abstract ISourceUnit decompileToUnit (String identifier)

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

public abstract 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

public abstract String getDecompiledClassText (String identifier)

Retrieve the decompiled source for the provided class.

Parameters
identifier class identifier

public abstract String getDecompiledFieldText (String identifier)

Retrieve the decompiled source for the provided field.

Parameters
identifier field identifier

public abstract String getDecompiledMethodText (String identifier)

Retrieve the decompiled source for the provided method.

Parameters
identifier method identifier

public abstract String getDecompiledText (String identifier)

Retrieve the decompiled source for the provided item.

Parameters
identifier object identifier

public abstract ISourceUnit getDecompiledUnit (String identifier)

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

public abstract 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.

public abstract List<String> getInferredTypes (String msig, int moff, int varindex)

This method is deprecated.
do not use

public abstract 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

public abstract int getThreadPoolSize ()

Set the maximum number of threads to be used when decompiling multiple items concurrently.

Will always return 1 if canPerformConcurrentDecompilations() is false.

public abstract void removeAllDecompilations ()

Remove all decompilations.

public abstract void removeDecompilation (String identifier)

Remove a decompilation.

public abstract void removeFreeElements ()

Remove all decompilation objects that exist but are not directly or indirectly managed by an existing decompiled source unit.

public abstract void resetAllDecompilations ()

Reset all decompilations.

public abstract void resetDecompilation (String identifier)

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 removeChild(com.pnfsoftware.jeb.core.units.IUnit). To do a proper removal, use removeDecompilation(String).

public abstract void runGarbageCollection ()

This method instructs the decompiler to perform garbage collection. It includes the actions performed by removeFreeElements().

public abstract void setThreadPoolSize (int threadPoolSize)

Get the maximum number of threads to be used when decompiling multiple items concurrently.

N/A if canPerformConcurrentDecompilations() is false.