Class GoType
java.lang.Object
ghidra.app.util.bin.format.golang.rtti.types.GoType
- All Implemented Interfaces:
StructureMarkup<GoType>
- Direct Known Subclasses:
GoArrayType
,GoChanType
,GoFuncType
,GoInterfaceType
,GoMapType
,GoPlainType
,GoPointerType
,GoSliceType
,GoStructType
Common abstract base class for GoType classes
-
Field Summary
Modifier and TypeFieldDescriptionprotected StructureContext<GoType>
protected GoRttiMapper
protected GoBaseType
protected GoUncommonType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 theGoRttiMapper
context.protected GoBaseType
long
Returns the location of where this type object, and any known associated optional structures ends.protected String
Returns a list of all methods defined on this type.protected String
getMethodSignature
(GoMethod method, boolean allowPartial) Return a funcdef signature for a method that is attached to this type.getName()
Returns the name of this type.protected long
Returns the package path of this type.getSpecializedTypeClass
(GoRttiMapper programContext, long offset) Returns the specific GoType derived class that will handle the go type located at the specified offset.Returns the name of the instance, typically retrieved from data found inside the instance.Returns the namespace that any labels should be placed in.protected String
Returns a descriptive string that defines the declaration of this type.long
Returns the starting offset of this type, used as an identifier.Returns the name of this type, after being uniqified against all other types defined in the program.Converts a golang RTTI type structure into a Ghidra data type.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
-
Field Details
-
programContext
-
context
-
typ
-
uncommonType
-
-
Constructor Details
-
GoType
public GoType()
-
-
Method Details
-
getSpecializedTypeClass
public static Class<? extends GoType> getSpecializedTypeClass(GoRttiMapper programContext, long offset) throws IOException Returns the specific GoType derived class that will handle the go type located at the specified offset.- Parameters:
programContext
- program-level mapper contextoffset
- absolute location of go type struct- Returns:
- GoType class that will best handle the type struct
- Throws:
IOException
- if error reading
-
getBaseType
-
getTypeOffset
public long getTypeOffset()Returns the starting offset of this type, used as an identifier.- Returns:
- starting offset of this type
-
getName
Returns the name of this type.- Returns:
- name of this type
-
getNameWithPackageString
-
getPackagePathString
Returns the package path of this type.- Returns:
- package path of this type
-
getDebugId
-
getOffsetEndOfFullType
protected long getOffsetEndOfFullType() -
getEndOfTypeInfo
Returns the location of where this type object, and any known associated optional structures ends.- Returns:
- index location of end of this type object
- Throws:
IOException
- if error reading
-
getUncommonType
- Throws:
IOException
-
getMethodInfoList
Returns a list of all methods defined on this type. Methods that specify both a "tfn" address as well as a "ifn" address will be represented twice.- Returns:
- list of MethodInfo's
- Throws:
IOException
- if error reading
-
getStructureContext
- Specified by:
getStructureContext
in interfaceStructureMarkup<GoType>
-
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<GoType>
- Returns:
- string name, or null if this instance does not have a name
- Throws:
IOException
- if error getting name
-
getStructureNamespace
Description copied from interface:StructureMarkup
Returns the namespace that any labels should be placed in.- Specified by:
getStructureNamespace
in interfaceStructureMarkup<GoType>
- Returns:
- name of namespace to place the label for this structure mapped type, or null
- Throws:
IOException
- if error generating namespace name
-
additionalMarkup
Description copied from interface:StructureMarkup
Called to allow the implementor to perform custom markup of itself.- Specified by:
additionalMarkup
in interfaceStructureMarkup<GoType>
- Parameters:
session
- state and methods to assist marking up the program- Throws:
IOException
- if error during markupCancelledException
- if cancelled
-
getImplementsInterfaceString
-
getMethodListString
- Throws:
IOException
-
getMethodSignature
public FunctionDefinition getMethodSignature(GoMethod method, boolean allowPartial) throws IOException Return a funcdef signature for a method that is attached to this type.- Parameters:
method
-GoMethod
allowPartial
- boolean flag, if true, allow returning a partially defined signature when the method's funcdef type is not specified- Returns:
FunctionDefinition
(that contains a receiver parameter), or null if the method's funcdef type was not specified and allowPartial was not true- Throws:
IOException
- if error reading type info
-
getTypeDeclString
Returns a descriptive string that defines the declaration of this type.This method should be overloaded by more specific types.
- Returns:
- descriptive string
- Throws:
IOException
- if error reading data
-
toString
-
getUniqueTypename
Returns the name of this type, after being uniqified against all other types defined in the program.- Returns:
- name of this type
-
recoverDataType
Converts a golang RTTI type structure into a Ghidra data type.- Returns:
DataType
that represents the golang type- Throws:
IOException
- if error getting name of the type
-
discoverGoTypes
Iterates this type, and any types this type refers to, while registering the types with theGoRttiMapper
context.This method should be overloaded by derived type classes to add any additional types referenced by the derived type.
- 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
-