Package ghidra.app.util.bin.format.dwarf
Class DWARFName
java.lang.Object
ghidra.app.util.bin.format.dwarf.DWARFName
A immutable hierarchical path based name implementation that can be viewed as either
namespaces or categorypaths.-
Method Summary
Modifier and TypeMethodDescriptionConverts this object into an equivCategoryPath.Converts this object into an equivDataTypePath.asNamespace(Program program) Converts this object into an equiv GhidraNamespace, omitting the organizational category path (which only applies to DataTypes).createChild(String childOriginalName, String childName, SymbolType childType) Creates aDWARFNameinstance, which has a name that is contained with this instance's namespace, using the specified name and symbol type.static DWARFNamecreateRoot(CategoryPath rootCategory) Create a root name entry that will serve as the parent for all children.booleanstatic DWARFNamefromDataType(DataType dataType) static DWARFNameCreate a childDWARFNameinstance of the specified parent.getName()Returns the name of this entry.Returns the NamespacePath of this instance.Returns the organizational category path.Returns the original name (unmodified by Ghidra-isms) of this entry.Returns the parent nameReturns the parent's CategoryPath.getParentNamespace(Program program) Returns the GhidraNamespacethat represents this entry's parent.getType()Returns the SymbolType of this name.inthashCode()booleanisAnon()Returns true if the original name of this entry was blank.booleanbooleanisRoot()Returns true if this instance has no parent and is considered the root.replaceName(String newName, String newOriginalName) Creates a new DWARFNameInfo instance, using this instance as the template, replacing the name with a new name.replaceType(SymbolType newType) Creates a new DWARFNameInfo instance, using this instance as the template, replacing the SymbolType with a new value.toString()
-
Method Details
-
createRoot
Create a root name entry that will serve as the parent for all children.- Parameters:
rootCategory-CategoryPathin the data type manager that will contain any sub-categories that represent namespaces- Returns:
- a new
DWARFNameinstance
-
fromDataType
-
fromList
Create a childDWARFNameinstance of the specified parent.Example:
fromList(parent, List.of("name1", "name2")) → parent_name/name1/name2 -
getParent
Returns the parent name- Returns:
- parent
-
isRoot
public boolean isRoot()Returns true if this instance has no parent and is considered the root.- Returns:
- boolean true if root name, false if not root
-
getOrganizationalCategoryPath
Returns the organizational category path.- Returns:
- organizational category path for dwarf names
-
getNamespacePath
Returns the NamespacePath of this instance.- Returns:
NamespacePathof this instance
-
getParentCP
Returns the parent's CategoryPath.- Returns:
- parent name's CategoryPath
-
getName
Returns the name of this entry.- Returns:
- string name of this entry, safe to use to name a Ghidra object (datatype, namespace, etc)
-
replaceName
Creates a new DWARFNameInfo instance, using this instance as the template, replacing the name with a new name.- Parameters:
newName- name for the new instancenewOriginalName- originalName for the new instance- Returns:
- new instance with new name
-
replaceType
Creates a new DWARFNameInfo instance, using this instance as the template, replacing the SymbolType with a new value.- Parameters:
newType- new SymbolType value- Returns:
- new instance with the specified SymbolType
-
getType
Returns the SymbolType of this name.- Returns:
SymbolTypeof this entry
-
asCategoryPath
Converts this object into an equivCategoryPath.- Returns:
CategoryPath: "/organizational_cat_path/namespace1/namespace2/obj_name"
-
asDataTypePath
Converts this object into an equivDataTypePath.- Returns:
DataTypePath: { "/organizational_cat_path/namespace1/namespace2", "obj_name" }
-
getParentNamespace
Returns the GhidraNamespacethat represents this entry's parent.- Parameters:
program- the Ghidra program that contains the namespace- Returns:
Namespacerepresenting this entry's parent
-
asNamespace
Converts this object into an equiv GhidraNamespace, omitting the organizational category path (which only applies to DataTypes). -
toString
-
isAnon
public boolean isAnon()Returns true if the original name of this entry was blank.- Returns:
- boolean true if there was no original name
-
getOriginalName
Returns the original name (unmodified by Ghidra-isms) of this entry.- Returns:
- original name
-
isNameModified
public boolean isNameModified()- Returns:
- boolean true if the original name doesn't match the ghidra-ized name
-
createChild
Creates aDWARFNameinstance, which has a name that is contained with this instance's namespace, using the specified name and symbol type.- Parameters:
childOriginalName- the unmodified namechildName- the ghidra-ized name of the type/symbol/namespace/etcchildType- the type of the object being named- Returns:
- new DWARFNameInfo instance
-
hashCode
public int hashCode() -
equals
-