Record Class GoSymbolName
java.lang.Object
java.lang.Record
ghidra.app.util.bin.format.golang.rtti.GoSymbolName
- Record Components:
symbolName
- full name of the golang symbolpackagePath
- portion the symbol name that is the packagePath (path+packagename), or nullpackageName
- portion of the symbol name that is the package name, or nullreceiverString
- portion of the symbol name that is the receiver string (only found when the receiver is in the form of "(*typename)"), or nullgenericInfo
- portion of the symbol name found inside of a generics "[blah]"baseName
- symbol base nameprefix
- portion of the symbol name that was prepended to the main symbol infosymtype
-GoSymbolNameType
enum specifying what kind of object this name is referencing
public record GoSymbolName(String symbolName, String packagePath, String packageName, String receiverString, String genericInfo, String baseName, String prefix, GoSymbolNameType symtype)
extends Record
Represents a Golang symbol name.
Handles formats such as:
"package/domain.name/packagename.(*ReceiverTypeName).Functionname" or "package/domain.name/packagename.(*ReceiverTypeName[genericinfo { method(); fieldname fieldtype; }]).Functionname" or "package/domain.name/packagename.Functionname[genericinfo]" or "type:.eq.[39]package/domain.name/packagename.Functionname"
-
Constructor Summary
ConstructorsConstructorDescriptionGoSymbolName
(String symbolName, String packagePath, String packageName, String receiverString, String genericInfo, String baseName, String prefix, GoSymbolNameType symtype) Creates an instance of aGoSymbolName
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns a newGoSymbolName
instance with the current instance's information (which should be without receiver info) re-interpreted to be a non-pointer receiver symbol.asString()
Returns the full name of the golang symbolbaseName()
Returns the value of thebaseName
record component.final boolean
Indicates whether some other object is "equal to" this one.static String
Fixes the specified string if it contains any of the golang special symbolname characters: middle-dot and the weird slash.static GoSymbolName
Constructs a minimal GoSymbolName instance from the supplied values.static GoSymbolName
fromPackagePath
(String packagePath) Constructs a GoSymbolName instance that only has a package path / package name.Returns the value of thegenericInfo
record component.getFunction
(Program program) Returns the matching Ghidra function (based on namespace and symbol name).Returns portion of the symbol name that is the package name, or nullReturns the portion the symbol name that is the packagePath (path+packagename), or nullReturns portion of the symbol name that is the receiver string, or nullgetReceiverString
(String modifiedGenerics) getReceiverTypeName
(String modifiedGenerics) getSymbolNamespace
(Program program) Returns a GhidraNamespace
based on the golang package path.Returns the portion of the package path before the package name, eg.boolean
final int
hashCode()
Returns a hash code value for this object.boolean
boolean
boolean
isMethod()
boolean
boolean
Returns the value of thepackageName
record component.Returns the value of thepackagePath
record component.static GoSymbolName
static GoSymbolName
parseTypeName
(String s, String packagePath) prefix()
Returns the value of theprefix
record component.Returns the value of thereceiverString
record component.Returns the value of thesymbolName
record component.symtype()
Returns the value of thesymtype
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
GoSymbolName
public GoSymbolName(String symbolName, String packagePath, String packageName, String receiverString, String genericInfo, String baseName, String prefix, GoSymbolNameType symtype) Creates an instance of aGoSymbolName
record class.- Parameters:
symbolName
- the value for thesymbolName
record componentpackagePath
- the value for thepackagePath
record componentpackageName
- the value for thepackageName
record componentreceiverString
- the value for thereceiverString
record componentgenericInfo
- the value for thegenericInfo
record componentbaseName
- the value for thebaseName
record componentprefix
- the value for theprefix
record componentsymtype
- the value for thesymtype
record component
-
-
Method Details
-
fixGolangSpecialSymbolnameChars
Fixes the specified string if it contains any of the golang special symbolname characters: middle-dot and the weird slash.- Parameters:
s
- string to fix- Returns:
- original string, or fixed version
-
parseTypeName
-
parse
-
from
Constructs a minimal GoSymbolName instance from the supplied values.- Parameters:
packageName
- package name, does not handle package paths, eg. "runtime"symbolName
- full symbol name, eg. "runtime.foo"- Returns:
- new GoSymbolName instance
-
fromPackagePath
Constructs a GoSymbolName instance that only has a package path / package name.- Parameters:
packagePath
- package path to parse- Returns:
- GoSymbolName that only has a package path and package name value
-
isMethod
public boolean isMethod() -
hasGenerics
public boolean hasGenerics() -
isUnparsed
public boolean isUnparsed() -
isAnonType
public boolean isAnonType() -
getPackagePath
Returns the portion the symbol name that is the packagePath (path+packagename), or null- Returns:
- the portion the symbol name that is the packagePath (path+packagename), or null
-
getPackageName
Returns portion of the symbol name that is the package name, or null- Returns:
- portion of the symbol name that is the package name, or null
-
hasReceiver
public boolean hasReceiver() -
getReceiverString
Returns portion of the symbol name that is the receiver string, or null- Returns:
- portion of the symbol name that is the receiver string, or null
-
getReceiverString
-
getReceiverTypeName
-
getReceiverTypeName
-
getShapelessGenericsString
-
getStrippedReceiverString
-
getGenericsString
-
getGenericParts
-
getStrippedSymbolString
-
asNonPtrReceiverSymbolName
Returns a newGoSymbolName
instance with the current instance's information (which should be without receiver info) re-interpreted to be a non-pointer receiver symbol.Example, symbol "package.name1.name2" would normally be parsed as a non-receiver symbol with a complex basename of "name1.name2", and this method will return a version that is equivalent of "package.(name1).name2".
- Returns:
- new
GoSymbolName
-
isNonPtrReceiverCandidate
public boolean isNonPtrReceiverCandidate() -
asString
Returns the full name of the golang symbol- Returns:
- full name of the golang symbol
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
getBaseName
-
getBaseTypeName
-
getNameType
-
getPrefix
-
getTypePrefixSubKeyword
-
getTruncatedPackagePath
Returns the portion of the package path before the package name, eg. "internal/sys" would become "internal/".- Returns:
- package path, without the trailing package name, or empty string if there is no path portion of the string
-
getSymbolNamespace
Returns a GhidraNamespace
based on the golang package path. -
getFunction
Returns the matching Ghidra function (based on namespace and symbol name). -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
symbolName
Returns the value of thesymbolName
record component.- Returns:
- the value of the
symbolName
record component
-
packagePath
Returns the value of thepackagePath
record component.- Returns:
- the value of the
packagePath
record component
-
packageName
Returns the value of thepackageName
record component.- Returns:
- the value of the
packageName
record component
-
receiverString
Returns the value of thereceiverString
record component.- Returns:
- the value of the
receiverString
record component
-
genericInfo
Returns the value of thegenericInfo
record component.- Returns:
- the value of the
genericInfo
record component
-
baseName
Returns the value of thebaseName
record component.- Returns:
- the value of the
baseName
record component
-
prefix
Returns the value of theprefix
record component.- Returns:
- the value of the
prefix
record component
-
symtype
Returns the value of thesymtype
record component.- Returns:
- the value of the
symtype
record component
-