Class DecompilationContext
java.lang.Object
com.pnfsoftware.jeb.core.units.code.DecompilationContext
Decompilation context holding information about a decompilation and its results, as well as
decompilation options. Immutable object, Thread-safe.
-
Constructor Summary
ConstructorDescriptionConstruct a new context with no particular options (defaults will be used).DecompilationContext
(int flags) Convenience constructor.DecompilationContext
(int flags, Long maxTimePerMethod, Long maxTimeTotal) Convenience constructor.Construct a new context with the provided options. -
Method Summary
Modifier and TypeMethodDescriptionaddFlags
(int flags) Convenience method.fork()
Fork the context.int
Retrieve the value of custom counter 1.int
Retrieve the value of custom counter 2.Convenience method.int
getFlags()
Convenience method.getMap1()
Retrieve the custom map 1.getMap2()
Retrieve the custom map 2.Convenience method.Convenience method.getResults
(String sig) boolean
boolean
hasFlags
(int f) Convenience method.int
Increment the value of custom counter 1.int
Increment the value of custom counter 2.boolean
void
boolean
recordAndCheckDeferredRequests
(int cnt, int cap) Record occurrences or future occurrences of deferred requests, and check them against a provided cap.int
Record the occurrence or future occurrence of a deferred request.void
recordError
(String sig, String error) void
recordResult
(String sig, DecompilationResult r) removeFlags
(int flags) Convenience method.void
static DecompilationContext
safe
(DecompilationContext ctx) void
setCallback
(IProgressCallback callback) Set an optional callback object to receive progress information regarding a decompilation operation.setOptions
(DecompilationOptions options)
-
Constructor Details
-
DecompilationContext
public DecompilationContext()Construct a new context with no particular options (defaults will be used). -
DecompilationContext
Construct a new context with the provided options.- Parameters:
opt
-
-
DecompilationContext
Convenience constructor.- Parameters:
flags
-maxTimePerMethod
-maxTimeTotal
-
-
DecompilationContext
public DecompilationContext(int flags) Convenience constructor.- Parameters:
flags
-
-
-
Method Details
-
safe
-
fork
Fork the context. The fork context reuses this context's objects. Forked contexts may be used hen performing concurrent decompilations.- Returns:
- a new context
-
getOptions
- Returns:
- current options (never null)
-
setOptions
- Parameters:
options
-- Returns:
- the previous options
-
getCallback
-
setCallback
Set an optional callback object to receive progress information regarding a decompilation operation.- Parameters:
callback
-
-
addFlags
Convenience method.- Parameters:
flags
- option flags to be added- Returns:
- the previous options
-
removeFlags
Convenience method.- Parameters:
flags
- option flags to be removed- Returns:
- the previous options
-
getFlags
public int getFlags()Convenience method.- Returns:
-
hasFlags
public boolean hasFlags(int f) Convenience method.- Parameters:
f
-- Returns:
-
getMaxTimePerMethod
Convenience method.- Returns:
-
getMaxTimeTotal
Convenience method.- Returns:
-
requestInterruption
public void requestInterruption() -
isInterruptionRequested
public boolean isInterruptionRequested() -
recordResult
-
getResults
-
getResultMap
-
recordError
-
getError
-
getErrorMap
Convenience method. Map of key=object signature (e.g., method jvm name) to value= error string (e.g., stacktrace)- Returns:
-
hasErrors
public boolean hasErrors() -
putData
-
getData
-
recordDeferredRequest
public int recordDeferredRequest()Record the occurrence or future occurrence of a deferred request.- Returns:
- the updated recorded count of deferred requests
-
recordAndCheckDeferredRequests
public boolean recordAndCheckDeferredRequests(int cnt, int cap) Record occurrences or future occurrences of deferred requests, and check them against a provided cap.- Parameters:
cnt
- count of deferred requests to recordcap
- current cap (a negative number means no cap)- Returns:
- true if the updated recorded count of deferred requests is within the cap; false if it exceeds the cap
-
getMap1
Retrieve the custom map 1. A decompiler may use this concurrent map as they choose.- Returns:
-
getMap2
Retrieve the custom map 2. A decompiler may use this concurrent map as they choose.- Returns:
-
getCounter1
public int getCounter1()Retrieve the value of custom counter 1. The counter is initialized with 0.- Returns:
- the counter value
-
incrementCounter1
public int incrementCounter1()Increment the value of custom counter 1. A decompiler may use this counter as they choose.- Returns:
- the updated counter value
-
getCounter2
public int getCounter2()Retrieve the value of custom counter 2. The counter is initialized with 0.- Returns:
- the counter value
-
incrementCounter2
public int incrementCounter2()Increment the value of custom counter 2. A decompiler may use this counter as they choose.- Returns:
- the updated counter value
-