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

# Class GoFunctionMultiReturn

java.lang.Object
ghidra.app.util.bin.format.golang.GoFunctionMultiReturn

public class GoFunctionMultiReturn extends Object
Handles creating a Ghidra structure to represent multiple return values returned from a golang function.

Assigning custom storage for the return value is complicated by:

- golang storage allocations depend on the formal ordering of the return values
- stack storage must be last in a list of varnodes
- the decompiler maps a structure's contents to the list of varnodes in an endian-dependent manner.

To meet these complications, the structure's layout is modified to put all items that were marked as being stack parameters to either the front or back of the structure.

To allow this artificial structure to adjusted by the user and reused at some later time to re-calculate the correct storage, the items in the structure are tagged with the original ordinal of that item as a text comment of each structure field, so that the correct ordering of items can be re-created when needed.

If the structure layout is modified to conform to an arch's requirements, the structure's name will be modified to include that arch's description at the end (eg. "_x86_64")

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `MULTIVALUE_RETURNTYPE_SUFFIX`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GoFunctionMultiReturn(CategoryPath categoryPath, String funcName, List<DataType> types, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)`
  `GoFunctionMultiReturn(Structure struct, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)`
  `GoFunctionMultiReturn(List<DWARFVariable> returnParams, DWARFFunction dfunc, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static GoFunctionMultiReturn`
  `fromStructure(DataType dt, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)`
  `List<DataTypeComponent>`
  `getNormalStorageComponents()`
  `List<DataTypeComponent>`
  `getStackStorageComponents()`
  `Structure`
  `getStruct()`
  `static boolean`
  `isMultiReturnDataType(DataType dt)`

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

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

- ## Field Details

  - ### MULTIVALUE_RETURNTYPE_SUFFIX

    public static final String MULTIVALUE_RETURNTYPE_SUFFIX
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### GoFunctionMultiReturn

    public GoFunctionMultiReturn(List<DWARFVariable> returnParams, DWARFFunction dfunc, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)

  - ### GoFunctionMultiReturn

    public GoFunctionMultiReturn(CategoryPath categoryPath, String funcName, List<DataType> types, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)

  - ### GoFunctionMultiReturn

    public GoFunctionMultiReturn(Structure struct, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)

- ## Method Details

  - ### isMultiReturnDataType

    public static boolean isMultiReturnDataType(DataType dt)

  - ### fromStructure

    public static GoFunctionMultiReturn fromStructure(DataType dt, DataTypeManager dtm, GoParamStorageAllocator storageAllocator)

  - ### getStruct

    public Structure getStruct()

  - ### getNormalStorageComponents

    public List<DataTypeComponent> getNormalStorageComponents()

  - ### getStackStorageComponents

    public List<DataTypeComponent> getStackStorageComponents()