Class 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 Detail

      • FunctionPrototype

        public FunctionPrototype​(LocalSymbolMap ls,
                                 Function func)
        Construct a FunctionPrototype backed by a local symbolmap
        Parameters:
        ls - is the LocalSymbolMap backing the prototype
        func - 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 parameters
        cspec - is the compiler spec used to pick prototype model
        voidimpliesdotdotdot - 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 appended
        dtmanage - is the DataTypeManager for building type reference tags
      • readPrototypeXML

        public void readPrototypeXML​(XmlPullParser parser,
                                     PcodeDataTypeManager dtmanage)
                              throws PcodeXMLException
        Parse the function prototype from tag.
        Parameters:
        parser - is the XML document to parse
        dtmanage - is the DataTypeManager used to parse data-type tags
        Throws:
        PcodeXMLException - for any problems parsing