Package ghidra.app.util.bin.format.dwarf

# Class DWARFFunction

java.lang.Object
ghidra.app.util.bin.format.dwarf.DWARFFunction

public class DWARFFunction extends Object
Represents a function that was read from DWARF information.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `DWARFFunction.CommitMode`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `Address`
  `address`
  `String`
  `callingConventionName`
  `DIEAggregate`
  `diea`
  `DWARFLocation`
  `funcEntryFrameBaseLoc`
  `Function`
  `function`
  `boolean`
  `isExternal`
  `boolean`
  `localVarErrors`
  `List<DWARFVariable>`
  `localVars`
  `DWARFName`
  `name`
  `Namespace`
  `namespace`
  `boolean`
  `noReturn`
  `List<DWARFVariable>`
  `params`
  `DWARFVariable`
  `retval`
  `DWARFFunction.CommitMode`
  `signatureCommitMode`
  `DWARFSourceInfo`
  `sourceInfo`
  `boolean`
  `varArg`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FunctionDefinition`
  `asFunctionDefinition(boolean includeCC)`
  Returns a `FunctionDefinition` that reflects this function's information.
  `void`
  `commitLocalVariable(DWARFVariable dvar)`
  `List<String>`
  `getAllLocalVariableNames()`
  `List<String>`
  `getAllParamNames()`
  `AddressSetView`
  `getBody()`
  `String`
  `getCallingConventionName()`
  `String`
  `getDescriptiveName()`
  `long`
  `getEntryPc()`
  `List<String>`
  `getExistingLocalVariableNames()`
  `static AddressRange`
  `getFuncBody(DIEAggregate diea, boolean flattenDisjoint)`
  `static DWARFRangeList`
  `getFuncBodyRanges(DIEAggregate diea)`
  `DWARFVariable`
  `getLocalVarByOffset(long offset)`
  Returns the DWARFVariable that starts at the specified stack offset.
  `List<String>`
  `getNonParamSymbolNames()`
  `ParameterDefinition[]`
  `getParameterDefinitions()`
  Returns the parameters of this function as `ParameterDefinition`s.
  `List<Parameter>`
  `getParameters(boolean includeStorageDetail)`
  Returns this function's parameters as a list of `Parameter` instances.
  `DWARFProgram`
  `getProgram()`
  `DWARFRangeList`
  `getRangeList()`
  `boolean`
  `hasConflictWithExistingLocalVariableStorage(DWARFVariable dvar)`
  `boolean`
  `hasConflictWithParamStorage(DWARFVariable dvar)`
  `boolean`
  `isInLocalVarStorageArea(long offset)`
  Returns true if the specified stack offset is within the function's local variable storage area.
  `static DWARFFunction`
  `read(DIEAggregate diea)`
  Create a function instance from the information found in the specified DIEA.
  `void`
  `runFixups()`
  `boolean`
  `syncWithExistingGhidraFunction(boolean createIfMissing)`
  `String`
  `toString()`
  `void`
  `updateFunctionSignature()`

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

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

- ## Field Details

  - ### diea

    public DIEAggregate diea

  - ### name

    public DWARFName name

  - ### namespace

    public Namespace namespace

  - ### address

    public Address address

  - ### function

    public Function function

  - ### funcEntryFrameBaseLoc

    public DWARFLocation funcEntryFrameBaseLoc

  - ### callingConventionName

    public String callingConventionName

  - ### retval

    public DWARFVariable retval

  - ### params

    public List<DWARFVariable> params

  - ### varArg

    public boolean varArg

  - ### localVars

    public List<DWARFVariable> localVars

  - ### localVarErrors

    public boolean localVarErrors

  - ### signatureCommitMode

    public DWARFFunction.CommitMode signatureCommitMode

  - ### noReturn

    public boolean noReturn

  - ### sourceInfo

    public DWARFSourceInfo sourceInfo

  - ### isExternal

    public boolean isExternal

- ## Method Details

  - ### read

    public static DWARFFunction read(DIEAggregate diea) throws IOException
    Create a function instance from the information found in the specified DIEA.
    Parameters:
      `diea` - DW_TAG_subprogram `DIEAggregate`
    Returns:
      new `DWARFFunction`, or null if invalid DWARF information
    Throws:
      `IOException` - if error accessing attribute values

  - ### getProgram

    public DWARFProgram getProgram()

  - ### getDescriptiveName

    public String getDescriptiveName()

  - ### getRangeList

    public DWARFRangeList getRangeList()

  - ### getCallingConventionName

    public String getCallingConventionName()

  - ### getBody

    public AddressSetView getBody()

  - ### getEntryPc

    public long getEntryPc()

  - ### getLocalVarByOffset

    public DWARFVariable getLocalVarByOffset(long offset)
    Returns the DWARFVariable that starts at the specified stack offset.
    Parameters:
      `offset` - stack offset
    Returns:
      local variable that starts at offset, or null if not present

  - ### isInLocalVarStorageArea

    public boolean isInLocalVarStorageArea(long offset)
    Returns true if the specified stack offset is within the function's local variable storage area.
    Parameters:
      `offset` - stack offset to test
    Returns:
      true if stack offset is within this function's local variable area

  - ### hasConflictWithParamStorage

    public boolean hasConflictWithParamStorage(DWARFVariable dvar) throws InvalidInputException
    Throws:
      `InvalidInputException`

  - ### hasConflictWithExistingLocalVariableStorage

    public boolean hasConflictWithExistingLocalVariableStorage(DWARFVariable dvar) throws InvalidInputException
    Throws:
      `InvalidInputException`

  - ### getAllParamNames

    public List<String> getAllParamNames()

  - ### getAllLocalVariableNames

    public List<String> getAllLocalVariableNames()

  - ### getExistingLocalVariableNames

    public List<String> getExistingLocalVariableNames()

  - ### getNonParamSymbolNames

    public List<String> getNonParamSymbolNames()

  - ### getParameters

    public List<Parameter> getParameters(boolean includeStorageDetail) throws InvalidInputException
    Returns this function's parameters as a list of `Parameter` instances.
    Parameters:
      `includeStorageDetail` - boolean flag, if true storage information will be included, if false, VariableStorage.UNASSIGNED_STORAGE will be used
    Returns:
      list of Parameters
    Throws:
      `InvalidInputException` - if bad information in param storage

  - ### getParameterDefinitions

    public ParameterDefinition[] getParameterDefinitions()
    Returns the parameters of this function as `ParameterDefinition`s.
    Returns:
      array of `ParameterDefinition`s

  - ### commitLocalVariable

    public void commitLocalVariable(DWARFVariable dvar)

  - ### getFuncBody

    public static AddressRange getFuncBody(DIEAggregate diea, boolean flattenDisjoint) throws IOException
    Throws:
      `IOException`

  - ### getFuncBodyRanges

    public static DWARFRangeList getFuncBodyRanges(DIEAggregate diea) throws IOException
    Throws:
      `IOException`

  - ### syncWithExistingGhidraFunction

    public boolean syncWithExistingGhidraFunction(boolean createIfMissing)

  - ### runFixups

    public void runFixups()

  - ### updateFunctionSignature

    public void updateFunctionSignature()

  - ### asFunctionDefinition

    public FunctionDefinition asFunctionDefinition(boolean includeCC)
    Returns a `FunctionDefinition` that reflects this function's information.
    Parameters:
      `includeCC` - boolean flag, if true the returned funcdef will include calling convention
    Returns:
      `FunctionDefinition` that reflects this function's information

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`