Package ghidra.program.model.pcode
Class FunctionPrototype
- java.lang.Object
-
- ghidra.program.model.pcode.FunctionPrototype
-
public class FunctionPrototype extends java.lang.Object
High-level prototype of a function based on Varnodes, describing the inputs and outputs of this function.
-
-
Constructor Summary
Constructors Constructor Description FunctionPrototype(FunctionSignature proto, CompilerSpec cspec, boolean voidimpliesdotdotdot)
Construct an internally backed prototype based on a FunctionSignature prototypeFunctionPrototype(LocalSymbolMap ls, Function func)
Construct a FunctionPrototype backed by a local symbolmap
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildPrototypeXML(java.lang.StringBuilder res, PcodeDataTypeManager dtmanage)
append an XML string representing this function prototypeint
getExtraPop()
GenericCallingConvention
getGenericCallingConvention()
java.lang.String
getModelName()
int
getNumParams()
HighParam
getParam(int i)
ParameterDefinition[]
getParameterDefinitions()
VariableStorage
getReturnStorage()
DataType
getReturnType()
boolean
hasNoReturn()
boolean
hasThisPointer()
boolean
isBackedByLocalSymbolMap()
boolean
isConstructor()
boolean
isDestructor()
boolean
isInline()
boolean
isVarArg()
void
readPrototypeXML(XmlPullParser parser, PcodeDataTypeManager dtmanage)
Parse the function prototype fromtag.
-
-
-
Constructor Detail
-
FunctionPrototype
public FunctionPrototype(LocalSymbolMap ls, Function func)
Construct a FunctionPrototype backed by a local symbolmap- Parameters:
ls
- is the LocalSymbolMap backing the prototypefunc
- is the function using the symbolmap
-
FunctionPrototype
public FunctionPrototype(FunctionSignature proto, CompilerSpec cspec, boolean voidimpliesdotdotdot)
Construct an internally backed prototype based on a FunctionSignature prototype- Parameters:
proto
- is the FunctionSignature used to internally back input parameterscspec
- is the compiler spec used to pick prototype modelvoidimpliesdotdotdot
- set to true if a void prototype is interpreted as varargs
-
-
Method Detail
-
getNumParams
public int getNumParams()
- Returns:
- the number of defined parameters for this function prototype
-
getParam
public HighParam getParam(int i)
- Parameters:
i
- i'th parameter index- Returns:
- the i'th HighParam to this function prototype or null if this prototype is not backed by a LocalSymbolMap
-
getParameterDefinitions
public ParameterDefinition[] getParameterDefinitions()
- Returns:
- parameter definitions if prototype was produced from a FunctionSignature or null if backed by a LocalSymbolMap
-
isBackedByLocalSymbolMap
public boolean isBackedByLocalSymbolMap()
- Returns:
- true if this prototype is backed by a LocalSymbolMap, or false if generated from a FunctionSignature.
-
getReturnType
public DataType getReturnType()
- Returns:
- the return type for the function
-
getReturnStorage
public VariableStorage getReturnStorage()
- Returns:
- the return storage for the function
-
getExtraPop
public int getExtraPop()
- Returns:
- the number of extra bytes popped off by this functions return
-
isVarArg
public boolean isVarArg()
- Returns:
- true if this function has variable arguments
-
isInline
public boolean isInline()
- Returns:
- true if this function should be inlined by the decompile
-
hasNoReturn
public boolean hasNoReturn()
- Returns:
- true if calls to this function do not return
-
hasThisPointer
public boolean hasThisPointer()
- Returns:
- true if this function is a method taking a 'this' pointer as a parameter
-
isConstructor
public boolean isConstructor()
- Returns:
- true if this function is an (object-oriented) constructor
-
isDestructor
public boolean isDestructor()
- Returns:
- true if this function is an (object-oriented) destructor
-
getModelName
public java.lang.String getModelName()
- Returns:
- calling convention model name specific to the associated compiler spec
-
getGenericCallingConvention
public GenericCallingConvention getGenericCallingConvention()
- Returns:
- generic calling convention
-
buildPrototypeXML
public void buildPrototypeXML(java.lang.StringBuilder res, PcodeDataTypeManager dtmanage)
append an XML string representing this function prototype- Parameters:
res
- is where the string should be appendeddtmanage
- is the DataTypeManager for building type reference tags
-
readPrototypeXML
public void readPrototypeXML(XmlPullParser parser, PcodeDataTypeManager dtmanage) throws PcodeXMLException
Parse the function prototype fromtag. - Parameters:
parser
- is the XML document to parsedtmanage
- is the DataTypeManager used to parse data-type tags- Throws:
PcodeXMLException
- for any problems parsing
-
-