Package ghidra.program.model.pcode
Class HighFunction
java.lang.Object
ghidra.program.model.pcode.PcodeSyntaxTree
ghidra.program.model.pcode.HighFunction
- All Implemented Interfaces:
PcodeFactory
High-level abstraction associated with a low level function made up of assembly instructions.
Based on information the decompiler has produced after working on a function.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHighFunction(Function function, Language language, CompilerSpec compilerSpec, PcodeDataTypeManager dtManager) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanclearNamespace(SymbolTable symtab, Namespace space) static final booleancollapseToGlobal(Namespace namespace) The decompiler treats some namespaces as equivalent to the "global" namespace.static voidcreateLabelSymbol(SymbolTable symtab, Address addr, String name, Namespace namespace, SourceType source, boolean useLocalNamespace) voidstatic voiddeleteSymbol(SymbolTable symtab, Address addr, String name, Namespace space) voidEncode this HighFunction to a stream.static voidencodeNamespace(Encoder encoder, Namespace namespace, NameTransformer transformer) Encode <parent> element to the stream describing the formal path elements from the root (global) namespace up to the given namespacestatic NamespacefindCreateNamespace(SymbolTable symtab, Namespace parentspace, String name) static Namespacestatic NamespacefindNamespace(SymbolTable symtab, Namespace parent, String name) static NamespacefindOverrideSpace(Function func) longgetID()Get the id with the associated function symbol, if it exists.getMappedSymbol(Address addr, Address pcaddr) protected AddressgetPCAddress(Varnode rep) getSymbol(long symbolId) Get the high symbol matching the given id that has been registered with this objectvoidgrabFromFunction(int overrideExtrapop, boolean includeDefaultNames, boolean doOverride) Populate the information for the HighFunction from the information in the Function object.static booleanisOverrideNamespace(Namespace namespace) voidsetVolatile(Varnode vn, boolean val) Mark (or unmark) the given Varnode with the "volatile" propertysplitOutMergeGroup(HighVariable high, Varnode vn) If a HighVariable consists of more than one (forced) merge group, split out the group that contains vn as a separate HighVariable.static StringtagFindExclude(String tagname, String doc) Methods inherited from class ghidra.program.model.pcode.PcodeSyntaxTree
buildStorage, clear, delete, findInputVarnode, findVarnode, findVarnode, getAddressFactory, getBasicBlocks, getDataTypeManager, getJoinAddress, getJoinStorage, getNumVarnodes, getOpRef, getPcodeOp, getPcodeOps, getPcodeOps, getRef, getVarnodes, getVarnodes, getVarnodes, getVarnodes, insertAfter, insertBefore, locRange, newOp, newVarnode, newVarnode, setAddrTied, setDataType, setInput, setInput, setMergeGroup, setOpcode, setOutput, setPersistent, setUnaffected, unInsert, unlink, unSetInput, unSetOutput
-
Field Details
-
DECOMPILER_TAG_MAP
- See Also:
-
OVERRIDE_NAMESPACE_NAME
- See Also:
-
-
Constructor Details
-
HighFunction
public HighFunction(Function function, Language language, CompilerSpec compilerSpec, PcodeDataTypeManager dtManager) - Parameters:
function- function associated with the higher level function abstraction.language- description of the processor language of the functioncompilerSpec- description of the compiler that produced the functiondtManager- data type manager
-
-
Method Details
-
getFunction
- Returns:
- get the associated low level function
-
getID
public long getID()Get the id with the associated function symbol, if it exists. Otherwise return a dynamic id based on the entry point.- Returns:
- the symbol id, or possibly a dynamic id
-
getLanguage
- Returns:
- get the language parser used to disassemble
-
getCompilerSpec
-
getFunctionPrototype
- Returns:
- the function prototype for the function (how things are passed/returned)
-
getJumpTables
- Returns:
- an array of jump table definitions found for this function decompilation
-
getLocalSymbolMap
- Returns:
- the local variable map describing the defined local variables
-
getGlobalSymbolMap
- Returns:
- a map describing global variables accessed by this function
-
getMappedSymbol
-
getSymbol
Description copied from interface:PcodeFactoryGet the high symbol matching the given id that has been registered with this object- Specified by:
getSymbolin interfacePcodeFactory- Overrides:
getSymbolin classPcodeSyntaxTree- Parameters:
symbolId- is the given id- Returns:
- the matching HighSymbol or null
-
grabFromFunction
public void grabFromFunction(int overrideExtrapop, boolean includeDefaultNames, boolean doOverride) Populate the information for the HighFunction from the information in the Function object.- Parameters:
overrideExtrapop- is the value to use if extrapop is overriddenincludeDefaultNames- is true if default symbol names should be considered lockeddoOverride- is true if extrapop is overridden
-
decode
- Overrides:
decodein classPcodeSyntaxTree- Throws:
DecoderException
-
getPCAddress
-
splitOutMergeGroup
If a HighVariable consists of more than one (forced) merge group, split out the group that contains vn as a separate HighVariable. Otherwise just return the original high.- Parameters:
high- is the HighVariable to splitvn- is a representative of the merge group to split out- Returns:
- a HighVariable containing just the forced merge group of vn
- Throws:
PcodeException- if the split can't be performed
-
encode
public void encode(Encoder encoder, long id, Namespace namespace, Address entryPoint, int size) throws IOException Encode this HighFunction to a stream. The size describes how many bytes starting from the entry point are used by the function, but this doesn't need to be strictly accurate as it is only used to associate the function with addresses near its entry point.- Parameters:
encoder- is the stream encoderid- is the id associated with the function symbolnamespace- is the namespace containing the function symbolentryPoint- pass null to use the function entryPoint, pass an address to force an entry pointsize- describes how many bytes the function occupies as code- Throws:
IOException- for errors in the underlying stream
-
setVolatile
Description copied from interface:PcodeFactoryMark (or unmark) the given Varnode with the "volatile" property- Specified by:
setVolatilein interfacePcodeFactory- Overrides:
setVolatilein classPcodeSyntaxTree- Parameters:
vn- is the given Varnodeval- is true if the Varnode should be marked volatile
-
isOverrideNamespace
-
findOverrideSpace
-
findCreateOverrideSpace
-
findNamespace
-
createLabelSymbol
public static void createLabelSymbol(SymbolTable symtab, Address addr, String name, Namespace namespace, SourceType source, boolean useLocalNamespace) throws InvalidInputException - Throws:
InvalidInputException
-
deleteSymbol
public static void deleteSymbol(SymbolTable symtab, Address addr, String name, Namespace space) throws InvalidInputException - Throws:
InvalidInputException
-
clearNamespace
public static boolean clearNamespace(SymbolTable symtab, Namespace space) throws InvalidInputException - Throws:
InvalidInputException
-
findCreateNamespace
-
collapseToGlobal
The decompiler treats some namespaces as equivalent to the "global" namespace. Return true if the given namespace is treated as equivalent.- Parameters:
namespace- is the namespace- Returns:
- true if equivalent
-
encodeNamespace
public static void encodeNamespace(Encoder encoder, Namespace namespace, NameTransformer transformer) throws IOException Encode <parent> element to the stream describing the formal path elements from the root (global) namespace up to the given namespace- Parameters:
encoder- is the stream encodernamespace- is the namespace being describedtransformer- is used to computer the displayed version of each namespace- Throws:
IOException- for errors in the underlying stream
-
tagFindExclude
- Parameters:
tagname- -- Name of tag to search fordoc- -- String through which to search for tags- Returns:
- all characters between beginning and ending XML tags, excluding tags themselves
-