Class GoType
java.lang.Object
ghidra.app.util.bin.format.golang.rtti.types.GoType
- All Implemented Interfaces:
StructureMarkup<GoType>,StructureVerifier
- Direct Known Subclasses:
GoArrayType,GoChanType,GoFuncType,GoInterfaceType,GoMapType,GoPlainType,GoPointerType,GoSliceType,GoStructType,GoTypeBridge
Common abstract base class for GoType classes
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StructureContext<GoType> protected GoRttiMapperprotected GoBaseTypeprotected GoUncommonType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadditionalMarkup(MarkupSession session) Called to allow the implementor to perform custom markup of itself.booleandiscoverGoTypes(Set<Long> discoveredTypes) Iterates this type, and any types this type refers to, while registering the types with theGoRttiMappercontext.protected GoBaseTypelongReturns the location of where this type object, and any known associated optional structures ends.protected StringReturns a list of all methods defined on this type.protected StringgetMethodPrototypeString(String methodName, GoFuncType funcdefType) getMethodPrototypeString(String recvStr, String methodName, GoFuncType funcdefType) getName()Returns the name of this type.protected longReturns 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 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.protected StringReturns a descriptive string that defines the declaration of this type.longReturns the starting offset of this type, used as an identifier.booleanisValid()recoverDataType(GoTypeManager goTypes) 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, waitMethods inherited from interface ghidra.app.util.bin.format.golang.structmapping.StructureMarkup
getExternalInstancesToMarkup
-
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
-
getSymbolName
-
getFullyQualifiedName
-
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:
getStructureContextin interfaceStructureMarkup<GoType>
-
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<GoType>- 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
-
getStructureName
Description copied from interface:StructureMarkupReturns the name of the instance, typically retrieved from data found inside the instance.- Specified by:
getStructureNamein 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:StructureMarkupReturns the namespace that any labels should be placed in.- Specified by:
getStructureNamespacein 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:StructureMarkupCalled to allow the implementor to perform custom markup of itself.- Specified by:
additionalMarkupin 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
-
getMethodPrototypeString
-
getMethodPrototypeString
-
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
-
recoverDataType
Converts a golang RTTI type structure into a Ghidra data type.This default implementation just creates an opaque blob of the appropriate size
- Parameters:
goTypes-GoTypeManager- Returns:
DataTypethat 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 theGoRttiMappercontext.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
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceStructureVerifier
-