Package ghidra.app.util.bin.format.golang.rtti.types

# Class GoFuncType

java.lang.Object
ghidra.app.util.bin.format.golang.rtti.types.GoType
ghidra.app.util.bin.format.golang.rtti.types.GoFuncType

All Implemented Interfaces:
  `StructureMarkup<GoType>`

public class GoFuncType extends GoType
A `GoType` structure that defines a function type.

- ## Field Summary

  ### Fields inherited from class ghidra.app.util.bin.format.golang.rtti.types.GoType

  `context, programContext, typ, uncommonType`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GoFuncType()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `additionalMarkup(MarkupSession session)`
  Called to allow the implementor to perform custom markup of itself.
  `boolean`
  `discoverGoTypes(Set<Long> discoveredTypes)`
  Iterates this type, and any types this type refers to, while registering the types with the `GoRttiMapper` context.
  `String`
  `getFuncPrototypeString(String funcName, String receiverString)`
  Returns a string that describes the function type as a golang-ish function decl.
  `int`
  `getInCount()`
  Returns the number of inbound parameters
  `int`
  `getOutCount()`
  Returns the number of outbound result values
  `int`
  `getParamCount()`
  Returns the total number of in and out parameters
  `List<GoType>`
  `getParamTypes()`
  Returns a list of `GoType`s for each parameter
  `protected String`
  `getTypeDeclString()`
  Returns a descriptive string that defines the declaration of this type.
  `boolean`
  `isVarArg()`
  Returns true if this function type is defined to be vararg
  `DataType`
  `recoverDataType()`
  Converts a golang RTTI type structure into a Ghidra data type.
  `static FunctionDefinition`
  `unwrapFunctionDefinitionPtrs(DataType dt)`
  Converts a ptr-to-ptr-to-funcdef to the base funcdef type.

  ### Methods inherited from class ghidra.app.util.bin.format.golang.rtti.types.GoType

  `getBaseType, getDebugId, getEndOfTypeInfo, getImplementsInterfaceString, getMethodInfoList, getMethodListString, getMethodSignature, getName, getNameWithPackageString, getOffsetEndOfFullType, getPackagePathString, getSpecializedTypeClass, getStructureContext, getStructureName, getStructureNamespace, getTypeOffset, getUncommonType, getUniqueTypename, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface ghidra.app.util.bin.format.golang.structmapping.StructureMarkup

  `getExternalInstancesToMarkup, getStructureLabel`

- ## Constructor Details

  - ### GoFuncType

    public GoFuncType()

- ## Method Details

  - ### unwrapFunctionDefinitionPtrs

    public static FunctionDefinition unwrapFunctionDefinitionPtrs(DataType dt)
    Converts a ptr-to-ptr-to-funcdef to the base funcdef type.
    Parameters:
      `dt` - ghidra `DataType`
    Returns:
      `FunctionDefinition` that was pointed to by specified data type, or null

  - ### isVarArg

    public boolean isVarArg()
    Returns true if this function type is defined to be vararg
    Returns:
      true if this function type is defined to be vararg

  - ### getInCount

    public int getInCount()
    Returns the number of inbound parameters
    Returns:
      number of inbound parameters

  - ### getOutCount

    public int getOutCount()
    Returns the number of outbound result values
    Returns:
      number of outbound result values

  - ### getParamCount

    public int getParamCount()
    Returns the total number of in and out parameters
    Returns:
      total number of in and out parameters

  - ### getParamTypes

    public List<GoType> getParamTypes() throws IOException
    Returns a list of `GoType`s for each parameter
    Returns:
      list of `GoType`s for each parameter
    Throws:
      `IOException` - if error read type info

  - ### additionalMarkup

    public void additionalMarkup(MarkupSession session) throws IOException
    Description copied from interface: `StructureMarkup`
    Called to allow the implementor to perform custom markup of itself.
    Specified by:
      `additionalMarkup` in interface `StructureMarkup<GoType>`
    Overrides:
      `additionalMarkup` in class `GoType`
    Parameters:
      `session` - state and methods to assist marking up the program
    Throws:
      `IOException` - if error during markup

  - ### getFuncPrototypeString

    public String getFuncPrototypeString(String funcName, String receiverString) throws IOException
    Returns a string that describes the function type as a golang-ish function decl.
    Parameters:
      `funcName` - optional name of a function
      `receiverString` - optional receiver decl string
    Returns:
      golang func decl string
    Throws:
      `IOException` - if error reading parameter type info

  - ### recoverDataType

    public DataType recoverDataType() throws IOException
    Description copied from class: `GoType`
    Converts a golang RTTI type structure into a Ghidra data type.
    Overrides:
      `recoverDataType` in class `GoType`
    Returns:
      `DataType` that represents the golang type
    Throws:
      `IOException` - if error getting name of the type

  - ### discoverGoTypes

    public boolean discoverGoTypes(Set<Long> discoveredTypes) throws IOException
    Description copied from class: `GoType`
    Iterates this type, and any types this type refers to, while registering the types with the `GoRttiMapper` context.

    This method should be overloaded by derived type classes to add any additional types referenced by the derived type.

    Overrides:
      `discoverGoTypes` in class `GoType`
    Parameters:
      `discoveredTypes` - set of already iterated types
    Returns:
      boolean boolean flag, if false the type has already been discovered, if true the type was encountered for the first time
    Throws:
      `IOException` - if error reading type info

  - ### getTypeDeclString

    protected String getTypeDeclString() throws IOException
    Description copied from class: `GoType`
    Returns a descriptive string that defines the declaration of this type.

    This method should be overloaded by more specific types.

    Overrides:
      `getTypeDeclString` in class `GoType`
    Returns:
      descriptive string
    Throws:
      `IOException` - if error reading data