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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
additionalMarkup
(MarkupSession session) Called to allow the implementor to perform custom markup of itself.Attempts to return aGoMethod.GoMethodInfo
for this function, based on this function's inclusion in a golang interface as a method.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.long
getFuncDataValue
(GoFuncDataTable tableIndex) Returns a value associated with this function.Returns theGoFuncID
enum that categorizes this functionReturns the Ghidra function that corresponds to this go function.Returns a reference to theGoModuledata
that contains this function.getName()
Returns the name of this function.Returns the address of this function's name string.int
getPcDataValue
(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 the name of the instance, typically retrieved from data found inside the instance.Returns the name of this function, as a parsed symbol object.boolean
Returns true if this function is an ASM functionboolean
isInline()
Returns true if this function is inlineAttempts to build a 'function signature' string representing the known information about this function's arguments, using go's built-in stack trace metadata.void
setEntry
(long entry) Sets the absolute entry address.void
setEntryoff
(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, wait
Methods inherited from interface ghidra.app.util.bin.format.golang.structmapping.StructureMarkup
getExternalInstancesToMarkup, getStructureLabel, getStructureNamespace
-
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:
AddressRange
representing 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
-
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
-GoPcDataTable
enumtargetPC
- address (inside the function) to determine the value of- Returns:
- int value, will be specific to the
table
it 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
-GoPcDataTable
enum- Returns:
- list of int values, will be specific to the
table
it 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
-GoFuncDataTable
enum- 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
-
findMethodInfo
Attempts to return aGoMethod.GoMethodInfo
for this function, based on this function's inclusion in a golang interface as a method.- Returns:
GoMethod.GoMethodInfo
-
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:
GoSymbolName
containing 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:
GoFuncFlag
s
-
isAsmFunction
public boolean isAsmFunction()Returns true if this function is an ASM function- Returns:
- true if this function is an ASM function
-
getFuncIDEnum
Returns theGoFuncID
enum that categorizes this function- Returns:
- the
GoFuncID
enum that categorizes this 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
-
getModuledata
Returns a reference to theGoModuledata
that contains this function.- Returns:
GoModuledata
that contains this function
-
getStructureContext
- Specified by:
getStructureContext
in interfaceStructureMarkup<GoFuncData>
-
getStructureName
Description copied from interface:StructureMarkup
Returns the name of the instance, typically retrieved from data found inside the instance.- Specified by:
getStructureName
in interfaceStructureMarkup<GoFuncData>
- Returns:
- string name, or null if this instance does not have a name
- Throws:
IOException
- if error getting name
-
additionalMarkup
Description copied from interface:StructureMarkup
Called to allow the implementor to perform custom markup of itself.- Specified by:
additionalMarkup
in interfaceStructureMarkup<GoFuncData>
- Parameters:
session
- state and methods to assist marking up the program- Throws:
IOException
- if error during markupCancelledException
- if cancelled
-
toString
-