Package ghidra.program.database.symbol
Class NamespaceManager
- java.lang.Object
-
- ghidra.program.database.symbol.NamespaceManager
-
-
Constructor Summary
Constructors Constructor Description NamespaceManager(DBHandle handle, ErrorHandler errHandler, AddressMap addrMap, int openMode, Lock lock, TaskMonitor monitor)
Construct a new namespace manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor)
Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.AddressSetView
getAddressSet(Namespace namespace)
Gets the body for the given namespace.Namespace
getGlobalNamespace()
Get the global namespace.Namespace
getNamespaceContaining(Address addr)
Get the Namespace containing the given address.java.util.Iterator<Namespace>
getNamespacesOverlapping(AddressSetView set)
Get all Namespaces whose body overlaps the specified address set.void
invalidateCache(boolean all)
Clears all data caches.void
moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)
Move all objects within an address range to a new location.AddressRange
overlapsNamespace(AddressSetView set)
Checks if an existing namespace's address set intersects with the given set.void
programReady(int openMode, int currentRevision, TaskMonitor monitor)
Callback from program made to each manager after the program has completed initialization.AddressSetView
removeBody(Namespace namespace)
Removes any associated body with the given namespace.void
setBody(Namespace namespace, AddressSetView set)
Sets the body of a namespace.void
setProgram(ProgramDB program)
Callback from program used to indicate all manager have been created.
-
-
-
Constructor Detail
-
NamespaceManager
public NamespaceManager(DBHandle handle, ErrorHandler errHandler, AddressMap addrMap, int openMode, Lock lock, TaskMonitor monitor) throws VersionException
Construct a new namespace manager.- Parameters:
handle
- the database handle.errHandler
- the error handler.addrMap
- the address mapopenMode
- the open modelock
- the program synchronization lockmonitor
- the task monitor.- Throws:
VersionException
- if the table version is different from this adapter.
-
-
Method Detail
-
deleteAddressRange
public void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
Description copied from interface:ManagerDB
Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.- Specified by:
deleteAddressRange
in interfaceManagerDB
- Parameters:
startAddr
- the first address in the range.endAddr
- the last address in the range.monitor
- the task monitor to use in any upgrade operations.- Throws:
CancelledException
- if the user cancelled the operation via the task monitor.
-
invalidateCache
public void invalidateCache(boolean all) throws java.io.IOException
Description copied from interface:ManagerDB
Clears all data caches.- Specified by:
invalidateCache
in interfaceManagerDB
- Parameters:
all
- if false, some managers may not need to update their cache if they can tell that its not necessary. If this flag is true, then all managers should clear their cache no matter what.- Throws:
java.io.IOException
- if a database io error occurs.
-
setProgram
public void setProgram(ProgramDB program)
Description copied from interface:ManagerDB
Callback from program used to indicate all manager have been created. When this method is invoked, all managers have been instantiated but may not be fully initialized.- Specified by:
setProgram
in interfaceManagerDB
- Parameters:
program
- the program is set when all the initializations have been completed.
-
programReady
public void programReady(int openMode, int currentRevision, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:ManagerDB
Callback from program made to each manager after the program has completed initialization. This method may be used by managers to perform additional upgrading which may have been deferred.- Specified by:
programReady
in interfaceManagerDB
- Parameters:
openMode
- the mode that the program is being opened.currentRevision
- current program revision. If openMode is UPGRADE, this value reflects the pre-upgrade value.monitor
- the task monitor to use in any upgrade operations.- Throws:
java.io.IOException
- if a database io error occurs.CancelledException
- if the user cancelled the operation via the task monitor.
-
getGlobalNamespace
public Namespace getGlobalNamespace()
Get the global namespace.
-
setBody
public void setBody(Namespace namespace, AddressSetView set) throws OverlappingNamespaceException
Sets the body of a namespace.- Parameters:
namespace
- the namespace whose body is to be modified.set
- the address set for the new body.- Throws:
OverlappingNamespaceException
-
removeBody
public AddressSetView removeBody(Namespace namespace)
Removes any associated body with the given namespace.- Parameters:
namespace
- the namespace whose body is to be cleared.
-
getNamespaceContaining
public Namespace getNamespaceContaining(Address addr)
Get the Namespace containing the given address. If the address is not in a defined namespace (e.g., Function), the global namespace is returned.- Parameters:
addr
- the address for which to find a namespace.
-
overlapsNamespace
public AddressRange overlapsNamespace(AddressSetView set)
Checks if an existing namespace's address set intersects with the given set. If so, return the first overlapping range.
-
getNamespacesOverlapping
public java.util.Iterator<Namespace> getNamespacesOverlapping(AddressSetView set)
Get all Namespaces whose body overlaps the specified address set.- Parameters:
set
- the address for which to find namespace's that intersect it.- Returns:
- a LongField function key iterator.
-
getAddressSet
public AddressSetView getAddressSet(Namespace namespace)
Gets the body for the given namespace.- Parameters:
namespace
- the namespace for which to get its body.
-
moveAddressRange
public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws AddressOverflowException, CancelledException
Description copied from interface:ManagerDB
Move all objects within an address range to a new location.- Specified by:
moveAddressRange
in interfaceManagerDB
- Parameters:
fromAddr
- the first address of the range to be moved.toAddr
- the address where to the range is to be moved.length
- the number of addresses to move.monitor
- the task monitor to use in any upgrade operations.- Throws:
AddressOverflowException
- if the length is such that a address wrap occursCancelledException
- if the user cancelled the operation via the task monitor.
-
-