Package ghidra.program.database
Class ProgramCompilerSpec
- java.lang.Object
-
- ghidra.program.model.lang.BasicCompilerSpec
-
- ghidra.program.database.ProgramCompilerSpec
-
- All Implemented Interfaces:
CompilerSpec
public class ProgramCompilerSpec extends BasicCompilerSpec
A Program-specific version of theCompilerSpec. EveryProgramowns a specificProgramCompilerSpec. It is based on aCompilerSpecreturned by theLanguageassigned to theProgram, but it may include extensions. Extensions are currently either a new form of: Extensions can be installed or removed from aProgramDBvia theOptionsmechanism (SeeSpecExtension) usingSpecExtension.addReplaceCompilerSpecExtension(String, TaskMonitor)orSpecExtension.removeCompilerSpecExtension(String, TaskMonitor).ProgramCompilerSpecallows the static evaluation models, described by the underlyingBasicCompilerSpecand returned bygetPrototypeEvaluationModel(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
Fields Modifier and Type Field Description static DecompilerLanguageDECOMPILER_OUTPUT_DEFstatic java.lang.StringDECOMPILER_OUTPUT_DESCstatic java.lang.StringDECOMPILER_OUTPUT_LANGUAGEstatic java.lang.StringDECOMPILER_PROPERTY_LIST_NAMEstatic java.lang.StringEVALUATION_MODEL_PROPERTY_NAME-
Fields inherited from class ghidra.program.model.lang.BasicCompilerSpec
allmodels, CONSTANT_SPACE_INDEX, defaultModel, evalCalledModel, evalCurrentModel, JOIN_SPACE_NAME, models, OTHER_SPACE_INDEX, OTHER_SPACE_NAME, pcodeInject, STACK_SPACE_NAME
-
Fields inherited from interface ghidra.program.model.lang.CompilerSpec
CALLING_CONVENTION_cdecl, CALLING_CONVENTION_fastcall, CALLING_CONVENTION_pascal, CALLING_CONVENTION_stdcall, CALLING_CONVENTION_thiscall, CALLING_CONVENTION_vectorcall
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidenableJavaLanguageDecompilation(Program program)Adds and enables an option to have the decompiler display java.booleanequals(java.lang.Object obj)DecompilerLanguagegetDecompilerOutputLanguage()Get the language that the decompiler producesPrototypeModelgetPrototypeEvaluationModel(CompilerSpec.EvaluationModelType modelType)Get the evaluation model matching the given type.protected voidinstallExtensions()Update this object with any program specific compiler specification extensions.protected voidregisterProgramOptions()Register program-specific compiler-spec options-
Methods inherited from class ghidra.program.model.lang.BasicCompilerSpec
applyContextSettings, doesCDataTypeConversions, findBestCallingConvention, getAddressSpace, getAllModels, getCallingConvention, getCallingConventions, getCompilerSpecDescription, getCompilerSpecID, getDataOrganization, getDefaultCallingConvention, getErrorHandler, getLanguage, getPcodeInjectLibrary, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsInt, getPropertyKeys, getStackBaseSpace, getStackPointer, getStackSpace, getXMLString, hashCode, hasProperty, isGlobal, isStackRightJustified, markPrototypeAsExtension, matchConvention, modelXrefs, registerProgramInject, removeProgramMechanismPayloads, saveXml, stackGrowsNegative
-
-
-
-
Field Detail
-
DECOMPILER_PROPERTY_LIST_NAME
public static final java.lang.String DECOMPILER_PROPERTY_LIST_NAME
- See Also:
- Constant Field Values
-
DECOMPILER_OUTPUT_LANGUAGE
public static final java.lang.String DECOMPILER_OUTPUT_LANGUAGE
- See Also:
- Constant Field Values
-
DECOMPILER_OUTPUT_DEF
public static final DecompilerLanguage DECOMPILER_OUTPUT_DEF
-
DECOMPILER_OUTPUT_DESC
public static final java.lang.String DECOMPILER_OUTPUT_DESC
- See Also:
- Constant Field Values
-
EVALUATION_MODEL_PROPERTY_NAME
public static final java.lang.String EVALUATION_MODEL_PROPERTY_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
enableJavaLanguageDecompilation
public static void enableJavaLanguageDecompilation(Program program)
Adds and enables an option to have the decompiler display java.- Parameters:
program- to be enabled
-
getDecompilerOutputLanguage
public DecompilerLanguage getDecompilerOutputLanguage()
Description copied from interface:CompilerSpecGet the language that the decompiler produces- Specified by:
getDecompilerOutputLanguagein interfaceCompilerSpec- Overrides:
getDecompilerOutputLanguagein classBasicCompilerSpec- Returns:
- an enum specifying the language
-
installExtensions
protected void installExtensions()
Update this object with any program specific compiler specification extensions.
-
getPrototypeEvaluationModel
public PrototypeModel getPrototypeEvaluationModel(CompilerSpec.EvaluationModelType modelType)
Description copied from interface:CompilerSpecGet 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:
getPrototypeEvaluationModelin interfaceCompilerSpec- Overrides:
getPrototypeEvaluationModelin classBasicCompilerSpec- Parameters:
modelType- is the type of evaluation model- Returns:
- prototype evaluation model
-
registerProgramOptions
protected void registerProgramOptions()
Register program-specific compiler-spec options
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classBasicCompilerSpec
-
-