Package ghidra.program.model.pcode
Class FunctionPrototype
java.lang.Object
ghidra.program.model.pcode.FunctionPrototype
High-level prototype of a function based on Varnodes, describing the inputs and outputs
of this function.
-
Constructor Summary
ConstructorDescriptionFunctionPrototype
(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
Modifier and TypeMethodDescriptionvoid
decodePrototype
(Decoder decoder, PcodeFactory pcodeFactory) Decode the function prototype from a<prototype>
element in the stream.void
encodePrototype
(Encoder encoder, PcodeDataTypeManager dtmanage) Encode this function prototype to a stream.int
int
getParam
(int i) boolean
boolean
boolean
boolean
boolean
boolean
isInline()
boolean
isVarArg()
-
Constructor Details
-
FunctionPrototype
Construct a FunctionPrototype backed by a local symbolmap. This is only a partial initialization. It is intended to be followed either by grabFromFunction() or readPrototypeXML()- Parameters:
ls
- is the LocalSymbolMap backing the prototypefunc
- is the function using the symbolmap
-
FunctionPrototype
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 Details
-
getNumParams
public int getNumParams()- Returns:
- the number of defined parameters for this function prototype
-
getParam
- 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
- 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
- Returns:
- the return type for the function
-
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
- Returns:
- calling convention model name specific to the associated compiler spec
-
encodePrototype
Encode this function prototype to a stream.- Parameters:
encoder
- is the stream encoderdtmanage
- is the DataTypeManager for building type reference tags- Throws:
IOException
- for errors in the underlying stream
-
decodePrototype
Decode the function prototype from a<prototype>
element in the stream.- Parameters:
decoder
- is the stream decoderpcodeFactory
- is used to resolve data-type and address space references- Throws:
DecoderException
- for invalid encodings
-