Class DecompilationContext

java.lang.Object
com.pnfsoftware.jeb.core.units.code.DecompilationContext

public class DecompilationContext extends Object
Decompilation context holding information about a decompilation and its results, as well as decompilation options. Immutable object, Thread-safe.
  • Constructor Details

    • DecompilationContext

      public DecompilationContext()
      Construct a new context with no particular options (defaults will be used).
    • DecompilationContext

      public DecompilationContext(DecompilationOptions opt)
      Construct a new context with the provided options.
      Parameters:
      opt -
    • DecompilationContext

      public DecompilationContext(int flags, Long maxTimePerMethod, Long maxTimeTotal)
      Convenience constructor.
      Parameters:
      flags -
      maxTimePerMethod -
      maxTimeTotal -
    • DecompilationContext

      public DecompilationContext(int flags)
      Convenience constructor.
      Parameters:
      flags -
  • Method Details

    • safe

      public static DecompilationContext safe(DecompilationContext ctx)
    • fork

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

      public DecompilationOptions getOptions()
      Returns:
      current options (never null)
    • setOptions

      public DecompilationOptions setOptions(DecompilationOptions options)
      Parameters:
      options -
      Returns:
      the previous options
    • getCallback

      public IProgressCallback getCallback()
    • setCallback

      public void setCallback(IProgressCallback callback)
      Set an optional callback object to receive progress information regarding a decompilation operation.
      Parameters:
      callback -
    • addFlags

      public DecompilationOptions addFlags(int flags)
      Convenience method.
      Parameters:
      flags - option flags to be added
      Returns:
      the previous options
    • removeFlags

      public DecompilationOptions removeFlags(int flags)
      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

      public Long getMaxTimePerMethod()
      Convenience method.
      Returns:
    • getMaxTimeTotal

      public Long getMaxTimeTotal()
      Convenience method.
      Returns:
    • requestInterruption

      public void requestInterruption()
    • isInterruptionRequested

      public boolean isInterruptionRequested()
    • recordResult

      public void recordResult(String sig, DecompilationResult r)
    • getResults

      public DecompilationResult getResults(String sig)
    • getResultMap

      public Map<String,DecompilationResult> getResultMap()
    • recordError

      public void recordError(String sig, String error)
    • getError

      public String getError(String sig)
    • getErrorMap

      public Map<String,String> 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

      public void putData(String key, Object value)
    • getData

      public Object getData(String key)
    • 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 record
      cap - 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

      public Map<String,Object> getMap1()
      Retrieve the custom map 1. A decompiler may use this concurrent map as they choose.
      Returns:
    • getMap2

      public Map<String,Object> 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