Package ghidra.program.database.external
Class ExternalLocationDB
- java.lang.Object
-
- ghidra.program.database.external.ExternalLocationDB
-
- All Implemented Interfaces:
ExternalLocation
public class ExternalLocationDB extends java.lang.Object implements ExternalLocation
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Function
createFunction()
Create an external function associated with this location or return the existing function if one already existsboolean
equals(java.lang.Object obj)
Address
getAddress()
Returns the external address if known, or nullDataType
getDataType()
Returns the DataType which has been associated with this location.Address
getExternalSpaceAddress()
Returns the address in "External" (fake) space where this location is stored.Function
getFunction()
Returns the external function associated with this location or null if this is a data location.java.lang.String
getLabel()
Returns the external label associated with this location.java.lang.String
getLibraryName()
Returns the name of the external program containing this location.java.lang.String
getOriginalImportedName()
Returns the original name for this location.java.lang.String
getParentName()
Returns the name of the parent namespace containing this location.Namespace
getParentNameSpace()
Returns the parent namespace containing this location.SourceType
getSource()
Returns the source of this location.Symbol
getSymbol()
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
isFunction()
void
restoreOriginalName()
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, java.lang.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(java.lang.String label, Address addr, SourceType source)
Set the external label which defines this location.void
setName(Namespace namespace, java.lang.String newName, SourceType sourceType)
Set a new name for this external location.java.lang.String
toString()
-
-
-
Method Detail
-
getSymbol
public Symbol 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
public java.lang.String 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:
ExternalLocation.getLibraryName()
-
getParentNameSpace
public Namespace 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:
ExternalLocation.getParentNameSpace()
-
getParentName
public java.lang.String 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:
ExternalLocation.getParentName()
-
getLabel
public java.lang.String 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:
ExternalLocation.getLabel()
-
getOriginalImportedName
public java.lang.String 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
public SourceType getSource()
Description copied from interface:ExternalLocation
Returns the source of this location.- Specified by:
getSource
in interfaceExternalLocation
- Returns:
- the source
-
getAddress
public Address 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:
ExternalLocation.getAddress()
-
getExternalSpaceAddress
public Address 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:
ExternalLocation.getExternalSpaceAddress()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isFunction
public boolean isFunction()
- Specified by:
isFunction
in interfaceExternalLocation
- Returns:
- true if location corresponds to a function
-
getDataType
public DataType getDataType()
Description copied from interface:ExternalLocation
Returns the DataType which has been associated with this location.- Specified by:
getDataType
in interfaceExternalLocation
- See Also:
ExternalLocation.getDataType()
-
setDataType
public void setDataType(DataType dt)
Description copied from interface:ExternalLocation
Associate the specified data type with this location.- Specified by:
setDataType
in interfaceExternalLocation
- Parameters:
dt
- data type- See Also:
ExternalLocation.setDataType(ghidra.program.model.data.DataType)
-
getFunction
public Function 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
public Function 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
public void setLocation(java.lang.String label, Address addr, SourceType source) throws InvalidInputException
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
public void setAddress(Address address) throws InvalidInputException
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
public void saveOriginalNameIfNeeded(Namespace oldNamespace, java.lang.String oldName, SourceType oldSource)
-
setName
public void setName(Namespace namespace, java.lang.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()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
isEquivalent
public boolean isEquivalent(ExternalLocation other)
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.
-
-