Package ghidra.program.database.external
Class ExternalLocationDB
java.lang.Object
ghidra.program.database.external.ExternalLocationDB
- All Implemented Interfaces:
ExternalLocation
-
Method Summary
Modifier and TypeMethodDescriptionCreate an external function associated with this location or return the existing function if one already existsboolean
Returns the external address if known, or nullReturns the DataType which has been associated with this location.Returns the address in "External" (fake) space where this location is stored.Returns the external function associated with this location or null if this is a data location.getLabel()
Returns the external label associated with this location.Returns the name of the external program containing this location.Returns the original name for this location.Returns the name of the parent namespace containing this location.Returns the parent namespace containing this location.Returns the source of this location.Returns the symbol associated with this external location or null.int
hashCode()
boolean
isEquivalent
(ExternalLocation other) Returns true if the given external location has the same name, namespace, original import name, and external address.boolean
void
If this external location has a replacement name, then the primary symbol will be deleted and the original symbol will become the primary symbol, effectively restoring the location to it's original name.void
saveOriginalNameIfNeeded
(Namespace oldNamespace, String oldName, SourceType oldSource) void
setAddress
(Address address) Sets the address in the external program associated with this location.void
setDataType
(DataType dt) Associate the specified data type with this location.void
setLocation
(String label, Address addr, SourceType source) Set the external label which defines this location.void
setName
(Namespace namespace, String newName, SourceType sourceType) Set a new name for this external location.toString()
-
Method Details
-
getSymbol
Description copied from interface:ExternalLocation
Returns the symbol associated with this external location or null.- Specified by:
getSymbol
in interfaceExternalLocation
- Returns:
- the symbol associated with this external location or null.
-
getLibraryName
Description copied from interface:ExternalLocation
Returns the name of the external program containing this location.- Specified by:
getLibraryName
in interfaceExternalLocation
- Returns:
- the name of the external program containing this location.
- See Also:
-
getParentNameSpace
Description copied from interface:ExternalLocation
Returns the parent namespace containing this location.- Specified by:
getParentNameSpace
in interfaceExternalLocation
- Returns:
- the parent namespace containing this location.
- See Also:
-
getParentName
Description copied from interface:ExternalLocation
Returns the name of the parent namespace containing this location.- Specified by:
getParentName
in interfaceExternalLocation
- Returns:
- the name of the parent namespace containing this location.
- See Also:
-
getLabel
Description copied from interface:ExternalLocation
Returns the external label associated with this location.- Specified by:
getLabel
in interfaceExternalLocation
- Returns:
- the external label associated with this location.
- See Also:
-
getOriginalImportedName
Description copied from interface:ExternalLocation
Returns the original name for this location. Will be null if the name was never changed.- Specified by:
getOriginalImportedName
in interfaceExternalLocation
- Returns:
- the original name for this location. Will be null if the name was never changed.
-
getSource
Description copied from interface:ExternalLocation
Returns the source of this location.- Specified by:
getSource
in interfaceExternalLocation
- Returns:
- the source
-
getAddress
Description copied from interface:ExternalLocation
Returns the external address if known, or null- Specified by:
getAddress
in interfaceExternalLocation
- Returns:
- the external address if known, or null
- See Also:
-
getExternalSpaceAddress
Description copied from interface:ExternalLocation
Returns the address in "External" (fake) space where this location is stored.- Specified by:
getExternalSpaceAddress
in interfaceExternalLocation
- Returns:
- the address that represents this location in "External" space.
- See Also:
-
toString
-
isFunction
public boolean isFunction()- Specified by:
isFunction
in interfaceExternalLocation
- Returns:
- true if location corresponds to a function
-
getDataType
Description copied from interface:ExternalLocation
Returns the DataType which has been associated with this location.- Specified by:
getDataType
in interfaceExternalLocation
- See Also:
-
setDataType
Description copied from interface:ExternalLocation
Associate the specified data type with this location.- Specified by:
setDataType
in interfaceExternalLocation
- Parameters:
dt
- data type- See Also:
-
getFunction
Description copied from interface:ExternalLocation
Returns the external function associated with this location or null if this is a data location.- Specified by:
getFunction
in interfaceExternalLocation
- Returns:
- external function associated with this location or null if this is a data location.
-
createFunction
Description copied from interface:ExternalLocation
Create an external function associated with this location or return the existing function if one already exists- Specified by:
createFunction
in interfaceExternalLocation
- Returns:
- external function
-
setLocation
Description copied from interface:ExternalLocation
Set the external label which defines this location.- Specified by:
setLocation
in interfaceExternalLocation
- Parameters:
label
- external label, may be null if addr is not null. Label may also be namespace qualified and best effort will be used to parse namespace (seeSymbolPath
). If a namespace is not included within label, the current namespace will be preserved. Note that this method does not properly handle the presence of template information within the label.addr
- external address, may be nullsource
- the source of the external label name- Throws:
InvalidInputException
-
setAddress
Description copied from interface:ExternalLocation
Sets the address in the external program associated with this location. The address may not be null if location has a default label.- Specified by:
setAddress
in interfaceExternalLocation
- Parameters:
address
- the address to set.- Throws:
InvalidInputException
- if address is null and location currently has a default name
-
saveOriginalNameIfNeeded
-
setName
public void setName(Namespace namespace, String newName, SourceType sourceType) throws InvalidInputException Description copied from interface:ExternalLocation
Set a new name for this external location. The new name will become the primary symbol for this location. The current name for this location will be saved as the original symbol for this location.- Specified by:
setName
in interfaceExternalLocation
- Parameters:
namespace
- the namespace for the original symbol. Can be different than original symbolnewName
- the user-friendly name.sourceType
- the SourceType for the new name.- Throws:
InvalidInputException
- if the name contains illegal characters (space for example)
-
restoreOriginalName
public void restoreOriginalName()Description copied from interface:ExternalLocation
If this external location has a replacement name, then the primary symbol will be deleted and the original symbol will become the primary symbol, effectively restoring the location to it's original name.- Specified by:
restoreOriginalName
in interfaceExternalLocation
-
hashCode
public int hashCode() -
equals
-
isEquivalent
Description copied from interface:ExternalLocation
Returns true if the given external location has the same name, namespace, original import name, and external address.- Specified by:
isEquivalent
in interfaceExternalLocation
- Parameters:
other
- the other ExternalLocation to compare- Returns:
- true if the other location is equivalent to this one.
-