Package ghidra.app.decompiler

# Class DecompileResults

java.lang.Object
ghidra.app.decompiler.DecompileResults

public class DecompileResults extends Object
Class for getting at the various structures returned by the decompiler. Depending on how the DecompInterface was called, you can get C code (with markup), the function' syntax tree, the prototype, etc. To check if the decompileFunction call completed normally use the decompileCompleted method. If this returns false, the getErrorMessage method may contain a useful error message. Its also possible that getErrorMessage will return warning messages, even if decompileFunction did complete. To get the resulting C code, marked up with XML in terms of the lines and tokens, use the getCCodeMarkup method. To get the resulting C code just as a straight String, use the getDecompiledFunction method which returns a DecompiledFunction. Off of this, you can use the getC method to get the raw C code as a String or use the getSignature method to get the functions prototype as a String. To get the syntax tree use the getHighFunction method.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DecompileResults(Function f, Language language, CompilerSpec compilerSpec, PcodeDataTypeManager d, String e, Decoder decoder, DecompileProcess.DisposeState processState)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `decompileCompleted()`
  Returns true if the decompilation producing these results completed without aborting.
  `boolean`
  `failedToStart()`
  If the action producing this set of decompiler results didn't complete, this method can be used to determine if the decompiler executable was not found or failed to start properly.
  `ClangTokenGroup`
  `getCCodeMarkup()`
  Get the marked up C code associated with these decompilation results.
  `DecompiledFunction`
  `getDecompiledFunction()`
  Converts the C code results into an unadorned string.
  `String`
  `getErrorMessage()`
  Return any error message associated with the decompilation producing these results.
  `Function`
  `getFunction()`
  `HighFunction`
  `getHighFunction()`
  Get the high-level function structure associated with these decompilation results, or null if there was an error during decompilation
  `HighParamID`
  `getHighParamID()`
  Get the high-level function structure associated with these decompilation results, or null if there was an error during decompilation
  `boolean`
  `isCancelled()`
  If the action producing this set of decompiler results didn't complete, this method can be used to determine if the action was explicitly cancelled (as opposed to an error, a timeout, or a crash).
  `boolean`
  `isTimedOut()`
  If the action producing this set of decompiler results didn't complete, this method can be used to determine if the action was halted because its timer expired (as opposed to an error, a crash, or being explicitly cancelled).

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DecompileResults

    public DecompileResults(Function f, Language language, CompilerSpec compilerSpec, PcodeDataTypeManager d, String e, Decoder decoder, DecompileProcess.DisposeState processState)

- ## Method Details

  - ### decompileCompleted

    public boolean decompileCompleted()
    Returns true if the decompilation producing these results completed without aborting. If it was aborted, there will be no real results in this object, and an error message should be available via getErrorMessage.
    Returns:
      true if the decompilation completed.

  - ### getFunction

    public Function getFunction()

  - ### isTimedOut

    public boolean isTimedOut()
    If the action producing this set of decompiler results didn't complete, this method can be used to determine if the action was halted because its timer expired (as opposed to an error, a crash, or being explicitly cancelled).
    Returns:
      true if the timer cancelled these results

  - ### isCancelled

    public boolean isCancelled()
    If the action producing this set of decompiler results didn't complete, this method can be used to determine if the action was explicitly cancelled (as opposed to an error, a timeout, or a crash).
    Returns:
      true if these results were explicitly cancelled

  - ### failedToStart

    public boolean failedToStart()
    If the action producing this set of decompiler results didn't complete, this method can be used to determine if the decompiler executable was not found or failed to start properly.
    Returns:
      true if the decompiler executable was not found.

  - ### getErrorMessage

    public String getErrorMessage()
    Return any error message associated with the decompilation producing these results. Generally, there will only be an error if the decompilation was aborted for some reason, but there could conceivably be warnings obtainable via this method, even if the decompilation did complete.
    Returns:
      any error message associated with these results

  - ### getHighFunction

    public HighFunction getHighFunction()
    Get the high-level function structure associated with these decompilation results, or null if there was an error during decompilation
    Returns:
      the resulting HighFunction object

  - ### getHighParamID

    public HighParamID getHighParamID()
    Get the high-level function structure associated with these decompilation results, or null if there was an error during decompilation
    Returns:
      the resulting HighParamID object

  - ### getCCodeMarkup

    public ClangTokenGroup getCCodeMarkup()
    Get the marked up C code associated with these decompilation results. If there was an error, or code generation was turned off, retur null
    Returns:
      the resulting root of C markup

  - ### getDecompiledFunction

    public DecompiledFunction getDecompiledFunction()
    Converts the C code results into an unadorned string. The returned object contains both the whole function and just the prototype as separate strings containing raw C code
    Returns:
      a DecompiledFunction object