Class GoFuncData
java.lang.Object
ghidra.app.util.bin.format.golang.rtti.GoFuncData
- All Implemented Interfaces:
StructureMarkup<GoFuncData>
A structure that golang generates that contains metadata about a function.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadditionalMarkup(MarkupSession session) Called to allow the implementor to perform custom markup of itself.getBody()Returns the address range of this function's body, recovered by examining addresses in the function's pc-to-filename translation table, or if not present, a single address range that contains the function's entry point.Returns a descriptive string.getFlags()Returns the func flags for this function.Returns the address of this function.longgetFuncDataValue(GoFuncDataTable tableIndex) Returns a value associated with this function.Returns the Ghidra function that corresponds to this go function.Returns a reference to theGoModuledatathat contains this function.getName()Returns the name of this function.Returns the address of this function's name string.intgetPcDataValue(GoPcDataTable tableIndex, long targetPC) Returns a value from the specified pc->value lookup table, for a specific address (that should be within the function's footprint).getPcDataValues(GoPcDataTable tableIndex) Returns all values for the specified pc->value lookup table for the entire range of the function's footprint.Returns information about the source file that this function was defined in.Returns a string that can be used to place a label on the instance.Returns the name of the instance, typically retrieved from data found inside the instance.Returns the namespace that any labels should be placed in.Returns the name of this function, as a parsed symbol object.booleanReturns true if this function is an ASM functionbooleanisInline()Returns true if this function is inlinevoidAttempts to build a 'function signature' string representing the known information about this function's arguments, using go's built-in stack trace metadata.voidsetEntry(long entry) Sets the absolute entry address.voidsetEntryoff(long entryoff) Sets the function's entry point via a relative offset valuetoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.app.util.bin.format.golang.structmapping.StructureMarkup
getExternalInstancesToMarkup
-
Constructor Details
-
GoFuncData
public GoFuncData()
-
-
Method Details
-
setEntryoff
public void setEntryoff(long entryoff) Sets the function's entry point via a relative offset valueCalled via deserialization for entryoff fieldmapping annotation
- Parameters:
entryoff- relative offset to function
-
setEntry
public void setEntry(long entry) Sets the absolute entry address.Called via deserialization for entry fieldmapping annotation
- Parameters:
entry- absolute value.
-
getFuncAddress
Returns the address of this function.- Returns:
- the address of this function
-
getBody
Returns the address range of this function's body, recovered by examining addresses in the function's pc-to-filename translation table, or if not present, a single address range that contains the function's entry point.- Returns:
AddressRangerepresenting the function's known footprint
-
getFunction
Returns the Ghidra function that corresponds to this go function.- Returns:
- Ghidra
Function, or null if there is no Ghidra function at the address
-
getDeferreturnAddress
-
getPcDataValue
Returns a value from the specified pc->value lookup table, for a specific address (that should be within the function's footprint).- Parameters:
tableIndex-GoPcDataTableenumtargetPC- address (inside the function) to determine the value of- Returns:
- int value, will be specific to the
tableit comes from, or -1 if the requested table index is not present for this function - Throws:
IOException- if error reading lookup data
-
getPcDataValues
Returns all values for the specified pc->value lookup table for the entire range of the function's footprint.- Parameters:
tableIndex-GoPcDataTableenum- Returns:
- list of int values, will be specific to the
tableit comes from, or an empty list if the requested table index is not present for this function - Throws:
IOException- if error reading lookup data
-
getFuncDataValue
Returns a value associated with this function.- Parameters:
tableIndex-GoFuncDataTableenum- Returns:
- requested value, or -1 if the requested table index is not present for this function
- Throws:
IOException- if error reading lookup data
-
recoverFunctionSignature
Attempts to build a 'function signature' string representing the known information about this function's arguments, using go's built-in stack trace metadata.The information that can be recovered about arguments is limited to:
- the size of the argument
- general grouping (eg. grouping of arg values as a structure or array)
- Returns:
- pseudo-function signature string, such as "undefined foo( 8, 8 )" which would indicate the function had 2 8-byte arguments
- Throws:
IOException- if error reading lookup data
-
getNameAddress
Returns the address of this function's name string.Referenced from nameoff's markup annotation
- Returns:
Address
-
getName
Returns the name of this function.- Returns:
- String name of this function
-
getSymbolName
Returns the name of this function, as a parsed symbol object.- Returns:
GoSymbolNamecontaining this function's name
-
getDescription
Returns a descriptive string.Referenced from the entry, entryoff field's markup annotation
- Returns:
- String description
-
isInline
public boolean isInline()Returns true if this function is inline- Returns:
- true if this function is inline
-
getFlags
Returns the func flags for this function.- Returns:
GoFuncFlags
-
isAsmFunction
public boolean isAsmFunction()Returns true if this function is an ASM function- Returns:
- true if this function is an ASM function
-
getSourceFileInfo
Returns information about the source file that this function was defined in.- Returns:
GoSourceFileInfo, or null if no source file info present- Throws:
IOException- if error reading lookup data
-
markupSourceFileInfo
public void markupSourceFileInfo() -
getModuledata
Returns a reference to theGoModuledatathat contains this function.- Returns:
GoModuledatathat contains this function
-
getStructureContext
- Specified by:
getStructureContextin interfaceStructureMarkup<GoFuncData>
-
getStructureName
Description copied from interface:StructureMarkupReturns the name of the instance, typically retrieved from data found inside the instance.- Specified by:
getStructureNamein interfaceStructureMarkup<GoFuncData>- Returns:
- string name, or null if this instance does not have a name
- Throws:
IOException- if error getting name
-
getStructureNamespace
Description copied from interface:StructureMarkupReturns the namespace that any labels should be placed in.- Specified by:
getStructureNamespacein interfaceStructureMarkup<GoFuncData>- Returns:
- name of namespace to place the label for this structure mapped type, or null
- Throws:
IOException- if error generating namespace name
-
getStructureLabel
Description copied from interface:StructureMarkupReturns a string that can be used to place a label on the instance.This default implementation will query the
StructureMarkup.getStructureName()method, and if it provides a value, will produce a string that looks like "name___mappingstructname", where "mappingstructname" will be thestructureNamevalue in the@StructureMappingannotation.- Specified by:
getStructureLabelin interfaceStructureMarkup<GoFuncData>- Returns:
- string to be used as a label, or null if there is not a valid label for the instance
- Throws:
IOException- if error getting label
-
additionalMarkup
Description copied from interface:StructureMarkupCalled to allow the implementor to perform custom markup of itself.- Specified by:
additionalMarkupin interfaceStructureMarkup<GoFuncData>- Parameters:
session- state and methods to assist marking up the program- Throws:
IOException- if error during markupCancelledException- if cancelled
-
toString
-