Package ghidra.app.decompiler
Class DecompileResults
java.lang.Object
ghidra.app.decompiler.DecompileResults
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
ConstructorDescriptionDecompileResults
(Function f, Language language, CompilerSpec compilerSpec, PcodeDataTypeManager d, String e, Decoder decoder, DecompileProcess.DisposeState processState) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the decompilation producing these results completed without aborting.boolean
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.Get the marked up C code associated with these decompilation results.Converts the C code results into an unadorned string.Return any error message associated with the decompilation producing these results.Get the high-level function structure associated with these decompilation results, or null if there was an error during decompilationGet the high-level function structure associated with these decompilation results, or null if there was an error during decompilationboolean
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
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).boolean
isValid()
Returns true if the decompile completed normally
-
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
-
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.
-
isValid
public boolean isValid()Returns true if the decompile completed normally- Returns:
- true if the decompile completed normally
-
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
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
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
Get the marked up C code associated with these decompilation results. If there was an error, or code generation was turned off, return null- Returns:
- the resulting root of C markup
-
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
-