Package ghidra.program.database
Class ProgramCompilerSpec
java.lang.Object
ghidra.program.model.lang.BasicCompilerSpec
ghidra.program.database.ProgramCompilerSpec
- All Implemented Interfaces:
CompilerSpec
A Program-specific version of the
CompilerSpec
.
Every Program
owns a specific ProgramCompilerSpec
. It is based on a
CompilerSpec
returned by the Language
assigned to the Program
, but it may
include extensions. Extensions are currently either a new form of:
Extensions can be installed or removed from a ProgramDB
via the Options
mechanism
(See SpecExtension
) using
SpecExtension.addReplaceCompilerSpecExtension(String, TaskMonitor)
or
SpecExtension.removeCompilerSpecExtension(String, TaskMonitor)
.
ProgramCompilerSpec
allows the static evaluation models, described by the underlying
BasicCompilerSpec
and returned by
getPrototypeEvaluationModel(EvaluationModelType)
, to be overridden by Program-specific
options.
getDecompilerOutputLanguage()
queries the Program-specific language the decompiler
should use as output.
installExtensions()
is the main entry point for integrating the Program Options with the
Language's base CompilerSpec and producing a complete in-memory CompilerSpec for the Program.-
Nested Class Summary
Nested classes/interfaces inherited from interface ghidra.program.model.lang.CompilerSpec
CompilerSpec.EvaluationModelType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DecompilerLanguage
static final String
static final String
static final String
static final String
Fields inherited from class ghidra.program.model.lang.BasicCompilerSpec
allmodels, defaultModel, evalCalledModel, evalCurrentModel, models, pcodeInject, returnAddress
Fields inherited from interface ghidra.program.model.lang.CompilerSpec
CALLING_CONVENTION_cdecl, CALLING_CONVENTION_default, CALLING_CONVENTION_fastcall, CALLING_CONVENTION_pascal, CALLING_CONVENTION_rustcall, CALLING_CONVENTION_stdcall, CALLING_CONVENTION_thiscall, CALLING_CONVENTION_unknown, CALLING_CONVENTION_vectorcall
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
enableJavaLanguageDecompilation
(Program program) Adds and enables an option to have the decompiler display java.boolean
Get the language that the decompiler producesGet the evaluation model matching the given type.protected void
Update this object with any program specific compiler specification extensions.protected void
Register program-specific compiler-spec optionsprotected void
resetProgramOptions
(TaskMonitor monitor) Reset options to default (for this CompilerSpec) This is for setLanguage to clear out strings that might belong to the old language.Methods inherited from class ghidra.program.model.lang.BasicCompilerSpec
applyContextSettings, doesCDataTypeConversions, encode, findBestCallingConvention, getAddressSpace, getAllModels, getCallingConvention, getCallingConventions, getCompilerSpecDescription, getCompilerSpecID, getDataOrganization, getDefaultCallingConvention, getErrorHandler, getLanguage, getPcodeInjectLibrary, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsInt, getPropertyKeys, getStackBaseSpace, getStackPointer, getStackSpace, hasProperty, isEquivalent, isGlobal, isStackRightJustified, markPrototypeAsExtension, matchConvention, modelXrefs, registerProgramInject, removeProgramMechanismPayloads, setDefaultReturnAddressIfNeeded, stackGrowsNegative
-
Field Details
-
DECOMPILER_PROPERTY_LIST_NAME
- See Also:
-
DECOMPILER_OUTPUT_LANGUAGE
- See Also:
-
DECOMPILER_OUTPUT_DEF
-
DECOMPILER_OUTPUT_DESC
- See Also:
-
EVALUATION_MODEL_PROPERTY_NAME
- See Also:
-
-
Method Details
-
enableJavaLanguageDecompilation
Adds and enables an option to have the decompiler display java.- Parameters:
program
- to be enabled
-
getDecompilerOutputLanguage
Description copied from interface:CompilerSpec
Get the language that the decompiler produces- Specified by:
getDecompilerOutputLanguage
in interfaceCompilerSpec
- Overrides:
getDecompilerOutputLanguage
in classBasicCompilerSpec
- Returns:
- an enum specifying the language
-
installExtensions
protected void installExtensions()Update this object with any program specific compiler specification extensions. -
getPrototypeEvaluationModel
Description copied from interface:CompilerSpec
Get the evaluation model matching the given type. If analysis needs to apply a PrototypeModel to a function but a specific model is not known, then this method can be used to select a putative PrototypeModel based on the analysis use-case: - EVAL_CURRENT indicates the model to use for the "current function" being analyzed - EVAL_CALLED indicates the model to use for a function called by the current function- Specified by:
getPrototypeEvaluationModel
in interfaceCompilerSpec
- Overrides:
getPrototypeEvaluationModel
in classBasicCompilerSpec
- Parameters:
modelType
- is the type of evaluation model- Returns:
- prototype evaluation model
-
registerProgramOptions
protected void registerProgramOptions()Register program-specific compiler-spec options -
resetProgramOptions
Reset options to default (for this CompilerSpec) This is for setLanguage to clear out strings that might belong to the old language.- Parameters:
monitor
- is the monitor for checking cancellation- Throws:
CancelledException
- if operation is cancelled externally
-
equals
-