Class DecompilerAPI

java.lang.Object
cppclassanalyzer.decompiler.DecompilerAPI
All Implemented Interfaces:
Disposable, AutoCloseable

public final class DecompilerAPI
extends Object
implements Disposable, AutoCloseable
A Decompiler API with more to offer than the FlatDecompilerAPI
  • Constructor Details

    • DecompilerAPI

      public DecompilerAPI​(PluginTool tool)
      Constructs a new DecompilerAPI
      Parameters:
      tool - the current tool
    • DecompilerAPI

      public DecompilerAPI​(Program program)
      Constructs a new DecompilerAPI
      Parameters:
      program - the current program
    • DecompilerAPI

      public DecompilerAPI​(Program program, TaskMonitor monitor, int timeout)
      Constructs a new DecompilerAPI
      Parameters:
      program - the current program
      monitor - the monitor to use for the decompiler
      timeout - the timeout to use for the decompiler or < 0 to use the default timeout provided by user settings.
  • Method Details

    • dispose

      public void dispose()
      Specified by:
      dispose in interface Disposable
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • getProgram

      public Program getProgram()
      Get the current program opened in the decompiler
      Returns:
      the decompiler's opened program
    • setProgram

      public void setProgram​(Program program)
      Sets the program for the decompiler to use
      Parameters:
      program - to program to open in the decompiler
    • getTool

      public PluginTool getTool()
      Gets the tool
      Returns:
      the tool
    • getDecompiler

      public DecompInterface getDecompiler()
      Gets the decompiler
      Returns:
      the decompiler
    • getTimeout

      public int getTimeout()
      Gets the decompiler timeout
      Returns:
      the decompiler timeout
    • setTimeout

      public void setTimeout​(int timeout)
      Sets the decompiler timeout
      Parameters:
      timeout - the timeout
    • setMonitor

      public void setMonitor​(TaskMonitor monitor)
      Sets the task monitor to use
      Parameters:
      monitor - the task monitor
    • getCache

      public Map<Function,​DecompileResults> getCache()
      Gets a thread safe and unmodifiable view of the decompiler cache
      Returns:
      a map of the decompiler cache
    • clearCache

      public void clearCache()
      Flushes the decompiler cache
    • decompileFunction

      public DecompileResults decompileFunction​(Function function) throws CancelledException
      Decompiles the provided function
      Parameters:
      function - the function to decompile
      Returns:
      the decompiled function
      Throws:
      CancelledException - if the decompilation is cancelled
    • getClangStatements

      public List<ClangStatement> getClangStatements​(Function function) throws CancelledException
      Gets all the ClangStatements in the decompiled function
      Parameters:
      function - the function to decompile
      Returns:
      a list of all the functions statements
      Throws:
      CancelledException - if the decompilation is cancelled
    • getHighFunction

      public HighFunction getHighFunction​(Function function) throws CancelledException
      Gets the HighFunction for the decompiled function
      Parameters:
      function - the function to decompile
      Returns:
      the functions HighFunction
      Throws:
      CancelledException - if the decompilation is cancelled
    • getFunctionCalls

      public List<HighFunctionCall> getFunctionCalls​(Function function) throws CancelledException
      Gets a list of all the functions the decompiled function calls
      Parameters:
      function - the function to decompile
      Returns:
      a list of function calls
      Throws:
      CancelledException - if the decompilation is cancelled
    • getFunction

      public Function getFunction​(ClangFuncNameToken token)
      A convience method to get the corresponding Function for a function name
      Parameters:
      token - the function name
      Returns:
      the function
    • getCacheStats

      public com.google.common.cache.CacheStats getCacheStats()
      Gets the decompiler cache stats
      Returns:
      the decompiler cache stats