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-GoSymbolNameTypeenum 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 aGoSymbolNamerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns a newGoSymbolNameinstance 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 thebaseNamerecord component.final booleanIndicates whether some other object is "equal to" this one.static StringFixes the specified string if it contains any of the golang special symbolname characters: middle-dot and the weird slash.static GoSymbolNameConstructs a minimal GoSymbolName instance from the supplied values.static GoSymbolNamefromPackagePath(String packagePath) Constructs a GoSymbolName instance that only has a package path / package name.Returns the value of thegenericInforecord 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 GhidraNamespacebased on the golang package path.Returns the portion of the package path before the package name, eg.booleanfinal inthashCode()Returns a hash code value for this object.booleanbooleanbooleanisMethod()booleanbooleanReturns the value of thepackageNamerecord component.Returns the value of thepackagePathrecord component.static GoSymbolNamestatic GoSymbolNameparseTypeName(String s, String packagePath) prefix()Returns the value of theprefixrecord component.Returns the value of thereceiverStringrecord component.Returns the value of thesymbolNamerecord component.symtype()Returns the value of thesymtyperecord component.final StringtoString()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 aGoSymbolNamerecord class.- Parameters:
symbolName- the value for thesymbolNamerecord componentpackagePath- the value for thepackagePathrecord componentpackageName- the value for thepackageNamerecord componentreceiverString- the value for thereceiverStringrecord componentgenericInfo- the value for thegenericInforecord componentbaseName- the value for thebaseNamerecord componentprefix- the value for theprefixrecord componentsymtype- the value for thesymtyperecord 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 newGoSymbolNameinstance 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 GhidraNamespacebased 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 thesymbolNamerecord component.- Returns:
- the value of the
symbolNamerecord component
-
packagePath
Returns the value of thepackagePathrecord component.- Returns:
- the value of the
packagePathrecord component
-
packageName
Returns the value of thepackageNamerecord component.- Returns:
- the value of the
packageNamerecord component
-
receiverString
Returns the value of thereceiverStringrecord component.- Returns:
- the value of the
receiverStringrecord component
-
genericInfo
Returns the value of thegenericInforecord component.- Returns:
- the value of the
genericInforecord component
-
baseName
Returns the value of thebaseNamerecord component.- Returns:
- the value of the
baseNamerecord component
-
prefix
Returns the value of theprefixrecord component.- Returns:
- the value of the
prefixrecord component
-
symtype
Returns the value of thesymtyperecord component.- Returns:
- the value of the
symtyperecord component
-