Package ghidra.program.database.symbol
Class SymbolManager
- java.lang.Object
- 
- ghidra.program.database.symbol.SymbolManager
 
- 
- All Implemented Interfaces:
- ManagerDB,- SymbolTable
 
 public class SymbolManager extends java.lang.Object implements SymbolTable, ManagerDB 
- 
- 
Constructor SummaryConstructors Constructor Description SymbolManager(DBHandle handle, AddressMap addrMap, int openMode, Lock lock, TaskMonitor monitor)Creates a new Symbol manager.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExternalEntryPoint(Address addr)Sets the given address to be an external entry point.GhidraClasscreateClass(Namespace parent, java.lang.String name, SourceType source)Create a class namespace in the given parent namespace.SymbolcreateCodeSymbol(Address addr, java.lang.String name, Namespace namespace, SourceType source, java.lang.String data3)Internal method for creating label symbols.LibrarycreateExternalLibrary(java.lang.String name, SourceType source)Creates a Library namespace with the given name.SymbolcreateFunctionSymbol(Address addr, java.lang.String name, Namespace namespace, SourceType source, java.lang.String data3)Internal method for creating funcions symbols.SymbolcreateLabel(Address addr, java.lang.String name, Namespace namespace, SourceType source)Create a label symbol with the given name associated to the given Address and namespace.SymbolcreateLabel(Address addr, java.lang.String name, SourceType source)Create a label symbol with the given name associated to the given Address.NamespacecreateNameSpace(Namespace parent, java.lang.String name, SourceType source)Creates a new namespace.SymbolDBcreateSpecialSymbol(Address addr, java.lang.String name, Namespace parent, SymbolType symbolType, long data1, int data2, java.lang.String data3, SourceType source)Creates a symbol, specifying all information for the record.SymbolcreateSymbol(Address addr, java.lang.String name, Namespace namespace, SourceType source)SymbolcreateSymbol(Address addr, java.lang.String name, SourceType source)VariableSymbolDBcreateVariableSymbol(java.lang.String name, Namespace namespace, SymbolType type, int firstUseOffsetOrOrdinal, VariableStorage storage, SourceType source)Creates variable symbols.voiddeleteAddressRange(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.AddressfindVariableStorageAddress(VariableStorage storage)Find previously defined variable storage addressSymbolIteratorgetAllSymbols(boolean includeDynamicSymbols)Returns an iterator over all symbols, including Dynamic symbols if includeDynamicSymbols is true.SymbolIteratorgetChildren(Symbol parentSymbol)Returns an iterator over all symbols that have the given symbol as its parent..java.util.Iterator<GhidraClass>getClassNamespaces()Returns all Class Namespaces defined within the program.SymbolgetClassSymbol(java.lang.String name, Namespace namespace)Returns the class symbol with the given name in the given namespace.SymbolIteratorgetDefinedSymbols()Returns an iterator over all defined symbols in no particular order.longgetDynamicSymbolID(Address addr)Get the unique symbol ID for a dynamic symbol associated with the speified addr.AddressIteratorgetExternalEntryPointIterator()Get forward/back iterator over addresses that are entry points.SymbolgetExternalSymbol(java.lang.String name)Returns the external symbol with the given name.SymbolIteratorgetExternalSymbols()Returns an iterator over all defined external symbols in no particular order.SymbolIteratorgetExternalSymbols(java.lang.String name)Returns all the external symbols with the given name.SymbolgetGlobalSymbol(java.lang.String name, Address addr)Get the global symbol with the given name and address.java.util.List<Symbol>getGlobalSymbols(java.lang.String name)Returns a list of all global symbols with the given name.java.util.Iterator<LabelHistory>getLabelHistory()Get an iterator over all the label history objects.LabelHistory[]getLabelHistory(Address addr)Get the label history objects for the given address.java.util.List<Symbol>getLabelOrFunctionSymbols(java.lang.String name, Namespace namespace)Returns all the label or function symbols that have the given name in the given namespace.SymbolgetLibrarySymbol(java.lang.String name)Returns the library symbol with the given name.SymbolgetLocalVariableSymbol(java.lang.String name, Namespace namespace)Returns the local variable symbol with the given name in the given namespace.AddressgetMaxSymbolAddress(AddressSpace space)Returns the maximum symbol address within the specified address space.NamespacegetNamespace(Address addr)Returns the lowest level Namespace within which the specified address is contained.NamespacegetNamespace(java.lang.String name, Namespace namespace)Returns the namespace with the given name in the given parent namespace.SymbolgetNamespaceSymbol(java.lang.String name, Namespace namespace)Returns a generic namespace symbol with the given name in the given namespace.AddressgetNextExternalSymbolAddress()Returns the next available external symbol addressintgetNumSymbols()Returns the total number of symbols in the table.SymbolgetParameterSymbol(java.lang.String name, Namespace namespace)Returns the parameter symbol with the given name in the given namespace.SymbolgetPrimarySymbol(Address addr)Returns the primary symbol at the specified address.SymbolIteratorgetPrimarySymbolIterator(boolean forward)Get iterator over all primary symbols.SymbolIteratorgetPrimarySymbolIterator(Address startAddr, boolean forward)Get iterator over only primary symbols starting at the specifiedstartAddrSymbolIteratorgetPrimarySymbolIterator(AddressSetView set, boolean forward)Get an iterator over symbols at addresses in the given addressSetSymbolgetSymbol(long symbolID)Get the symbol for the given symbol ID.SymbolgetSymbol(Reference ref)Returns the symbol that this reference is associated with.SymbolgetSymbol(java.lang.String name)Returns the first global symbol that it finds with the given name.SymbolgetSymbol(java.lang.String name, Address addr, Namespace namespace)Get the symbol with the given name, address, and namespace.SymbolgetSymbol(java.lang.String name, Namespace namespace)Returns the first symbol with the given name found in the given namespace.SymbolIteratorgetSymbolIterator()Get iterator over all label symbols.SymbolIteratorgetSymbolIterator(boolean forward)Returns an iterator over all symbols.SymbolIteratorgetSymbolIterator(Address startAddr, boolean forward)Get iterator over all symbols starting at the specifiedstartAddrSymbolIteratorgetSymbolIterator(java.lang.String searchStr, boolean caseSensitive)Returns a an iterator over all symbols that match the given search string.SymbolIteratorgetSymbols(long namespaceID)Returns an iterator over all the symbols in the given namespaceSymbol[]getSymbols(Address addr)Returns all the symbols at the given address.SymbolIteratorgetSymbols(AddressSetView set, SymbolType type, boolean forward)Returns all the symbols of the given type within the given address set.SymbolIteratorgetSymbols(Namespace namespace)Returns an iterator over all the symbols in the given namespaceSymbolIteratorgetSymbols(java.lang.String name)Returns all the symbols with the given name.java.util.List<Symbol>getSymbols(java.lang.String name, Namespace namespace)Returns a list of all symbols with the given name in the given namespace.Symbol[]getUserSymbols(Address addr)Returns an array of all user defined symbols at the given addressSymbolgetVariableSymbol(java.lang.String name, Function function)Returns a symbol that is either a parameter or local variable.booleanhasLabelHistory(Address addr)Return true if there is a history of label changes at the given address.booleanhasSymbol(Address addr)Return true if there exists a symbol at the given address.voidimageBaseChanged(Address oldBase, Address base)voidinvalidateCache(boolean all)Clears all data caches.booleanisExternalEntryPoint(Address addr)Returns true if the given address has been set as an external entry point.voidmigrateFromOldVariableStorageManager(TaskMonitor monitor)No more sharing the same variable address for multiple variable symbols.voidmoveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)Move all objects within an address range to a new location.voidmoveSymbolsAt(Address oldAddr, Address newAddr)Move symbol.voidnamespaceRemoved(long namespaceID)Called by the NamespaceManager when a namespace is removed; remove all symbols that have the given namespace ID.voidprogramReady(int openMode, int currentRevision, TaskMonitor monitor)Callback from program made to each manager after the program has completed initialization.voidremoveExternalEntryPoint(Address addr)Removes the given address as an external entry point.booleanremoveSymbolSpecial(Symbol sym)Removes the specified symbol from the symbol table.voidreplaceDataTypes(long oldDataTypeID, long newDataTypeID)static voidsaveLocalSymbol(DBHandle tmpHandle, long symbolID, long oldAddr, java.lang.String name, boolean isPrimary)Save off old local symbols whose upgrade needs to be deferred until after function manager upgrade has been completed.voidsetLanguage(LanguageTranslator translator, TaskMonitor monitor)voidsetProgram(ProgramDB program)Callback from program used to indicate all manager have been created.
 
- 
- 
- 
Constructor Detail- 
SymbolManagerpublic SymbolManager(DBHandle handle, AddressMap addrMap, int openMode, Lock lock, TaskMonitor monitor) throws CancelledException, java.io.IOException, VersionException Creates a new Symbol manager.- Parameters:
- handle- the database handler
- addrMap- the address map.
- openMode- the open mode.
- lock- the program synchronization lock
- monitor- the progress monitor used when upgrading.
- Throws:
- CancelledException- if the user cancels the upgrade.
- java.io.IOException- if a database io error occurs.
- VersionException- if the database version doesn't match the current version.
 
 
- 
 - 
Method Detail- 
findVariableStorageAddresspublic Address findVariableStorageAddress(VariableStorage storage) throws java.io.IOException Find previously defined variable storage address- Parameters:
- storage- variable storage
- Returns:
- previously defined variable storage address or null if not found
- Throws:
- java.io.IOException
 
 - 
setProgrampublic void setProgram(ProgramDB program) Description copied from interface:ManagerDBCallback 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:
- setProgramin interface- ManagerDB
- Parameters:
- program- the program is set when all the initializations have been completed.
 
 - 
programReadypublic void programReady(int openMode, int currentRevision, TaskMonitor monitor) throws java.io.IOException, CancelledExceptionDescription copied from interface:ManagerDBCallback 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:
- programReadyin interface- ManagerDB
- 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.
 
 - 
migrateFromOldVariableStorageManagerpublic void migrateFromOldVariableStorageManager(TaskMonitor monitor) throws CancelledException No more sharing the same variable address for multiple variable symbols. Must split these up. Only reference to variable addresses should be the symbol address - reference refer to physical/stack addresses, and symbolIDs.- Parameters:
- monitor-
- Throws:
- CancelledException
 
 - 
saveLocalSymbolpublic static void saveLocalSymbol(DBHandle tmpHandle, long symbolID, long oldAddr, java.lang.String name, boolean isPrimary) throws java.io.IOException Save off old local symbols whose upgrade needs to be deferred until after function manager upgrade has been completed.- Parameters:
- tmpHandle- scratch pad database handle
- symbolID- local symbol ID
- oldAddr- old address value from symbol table
- name- symbol name
- isPrimary- true if symbol is primary at oldAddr
- Throws:
- java.io.IOException
 
 - 
getNumSymbolspublic int getNumSymbols() Description copied from interface:SymbolTableReturns the total number of symbols in the table.- Specified by:
- getNumSymbolsin interface- SymbolTable
 
 - 
removeSymbolSpecialpublic boolean removeSymbolSpecial(Symbol sym) Description copied from interface:SymbolTableRemoves the specified symbol from the symbol table. If removing any non-function symbol the behavior will be the same as invokingSymbol.delete()on the symbol. Use of this method for non-function symbols is discouraged.WARNING! If removing a function symbol the behavior differs from directly invoking Symbol.delete()on the function symbol.When removing a function symbol this method has the following behavior: - If the function is a default symbol (e.g., FUN_12345678) this method has no affect and will return null
- otherwise if another label exists at the function entry point, that label will be removed and the function will be renamed with that labels name
- If no other labels exist at the function entry, the function will be renamed to the default function name
 - Specified by:
- removeSymbolSpecialin interface- SymbolTable
- Parameters:
- sym- the symbol to be removed.
- Returns:
- false, if removal of the symbol fails
 
 - 
hasSymbolpublic boolean hasSymbol(Address addr) Description copied from interface:SymbolTableReturn true if there exists a symbol at the given address.- Specified by:
- hasSymbolin interface- SymbolTable
- Parameters:
- addr- address to check for an existing symbol
- Returns:
- true if any symbol exists
 
 - 
getSymbolpublic Symbol getSymbol(long symbolID) Description copied from interface:SymbolTableGet the symbol for the given symbol ID.- Specified by:
- getSymbolin interface- SymbolTable
- Parameters:
- symbolID- the id of the symbol to be retrieved.
- Returns:
- null if there is no symbol with the given ID.
 
 - 
getSymbolspublic Symbol[] getSymbols(Address addr) Description copied from interface:SymbolTableReturns all the symbols at the given address. When addr is a memory address the primary symbol will be returned in array slot 0. WARNING! Use of this method with a Variable address is highly discouraged since a single Variable address could be used multiple times by many functions.- Specified by:
- getSymbolsin interface- SymbolTable
- Parameters:
- addr- the address at which to retrieve all symbols.
- Returns:
- a zero-length array when no symbols are defined at address.
 
 - 
getUserSymbolspublic Symbol[] getUserSymbols(Address addr) Description copied from interface:SymbolTableReturns an array of all user defined symbols at the given address- Specified by:
- getUserSymbolsin interface- SymbolTable
- Parameters:
- addr- the address at which to retrieve all user defined symbols.
 
 - 
getSymbolpublic Symbol getSymbol(java.lang.String name, Address addr, Namespace namespace) Description copied from interface:SymbolTableGet the symbol with the given name, address, and namespace.Note that for a symbol to be uniquely specified, all these parameters are required. Any method that queries for symbols using just one or two of these parameters will return a list of symbols. - Specified by:
- getSymbolin interface- SymbolTable
- Parameters:
- name- the name of the symbol to retrieve
- addr- the address of the symbol to retrieve
- namespace- the namespace of the symbol to retrieve. May be null which indicates global namespace.
 
 - 
getSymbolpublic Symbol getSymbol(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns the first symbol with the given name found in the given namespace. Ghidra now allows multiple symbols with the same name in the same namespace, so using this method is likely to produce unintended results. Use#getSymbols(Namespace, String)instead.- Specified by:
- getSymbolin interface- SymbolTable
- Parameters:
- name- the name of the symbol to retreive
- namespace- the namespace of the symbol to retrieve (null assumes global namespace)
 
 - 
getGlobalSymbolpublic Symbol getGlobalSymbol(java.lang.String name, Address addr) Description copied from interface:SymbolTableGet the global symbol with the given name and address. Note that this results in a single Symbol because of an additional restriction that allows only one symbol with a given name at the same address and namespace (in this case the global namespace).This is just a convenience method for SymbolTable.getSymbol(String, Address, Namespace)where the namespace is the global namespace.- Specified by:
- getGlobalSymbolin interface- SymbolTable
- Parameters:
- name- the name of the symbol to retrieve
- addr- the address of the symbol to retrieve
 
 - 
getSymbolpublic Symbol getSymbol(java.lang.String name) Description copied from interface:SymbolTableReturns the first global symbol that it finds with the given name. Now that Ghidra allows duplicate symbol names, this method is practically useless.- Specified by:
- getSymbolin interface- SymbolTable
- Parameters:
- name- the name of the symbol to be retrieved.
- Returns:
- symbol, or null if no global symbol has that name
 
 - 
getGlobalSymbolspublic java.util.List<Symbol> getGlobalSymbols(java.lang.String name) Description copied from interface:SymbolTableReturns a list of all global symbols with the given name.- Specified by:
- getGlobalSymbolsin interface- SymbolTable
- Parameters:
- name- the name of the symbols to retrieve.
- Returns:
- a list of all global symbols with the given name.
 
 - 
getLibrarySymbolpublic Symbol getLibrarySymbol(java.lang.String name) Description copied from interface:SymbolTableReturns the library symbol with the given name.- Specified by:
- getLibrarySymbolin interface- SymbolTable
- Parameters:
- name- the name of the library symbol to retrieve.
- Returns:
- the library symbol with the given name.
 
 - 
getSymbolspublic java.util.List<Symbol> getSymbols(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns a list of all symbols with the given name in the given namespace.- Specified by:
- getSymbolsin interface- SymbolTable
- Parameters:
- name- the name of the symbols to retrieve.
- namespace- the namespace to search for symbols.
- Returns:
 
 - 
getNamespacepublic Namespace getNamespace(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns the namespace with the given name in the given parent namespace. The namespace returned can be either a generic namespace or a class or library. It does not include functions.- Specified by:
- getNamespacein interface- SymbolTable
- Parameters:
- name- the name of the namespace to be retrieved.
- namespace- the parent namespace of the namespace to be retrieved.
- Returns:
- the namespace with the given name in the given parent namespace.
 
 - 
getSymbolspublic SymbolIterator getSymbols(Namespace namespace) Description copied from interface:SymbolTableReturns an iterator over all the symbols in the given namespace- Specified by:
- getSymbolsin interface- SymbolTable
- Parameters:
- namespace- the namespace to search for symbols.
 
 - 
getSymbolspublic SymbolIterator getSymbols(long namespaceID) Description copied from interface:SymbolTableReturns an iterator over all the symbols in the given namespace- Specified by:
- getSymbolsin interface- SymbolTable
- Parameters:
- namespaceID- the namespace ID to search for symbols.
 
 - 
getSymbolspublic SymbolIterator getSymbols(java.lang.String name) Description copied from interface:SymbolTableReturns all the symbols with the given name.- Specified by:
- getSymbolsin interface- SymbolTable
- Parameters:
- name- the name of symbols to search for.
- Returns:
- array of symbols with the given name
 
 - 
getPrimarySymbolpublic Symbol getPrimarySymbol(Address addr) Description copied from interface:SymbolTableReturns the primary symbol at the specified address. This method will always return null if the address specified is neither a Memory address nor an External address.- Specified by:
- getPrimarySymbolin interface- SymbolTable
- Parameters:
- addr- the address at which to retrieve the primary symbol
- Returns:
- symbol, or null if no symbol at that address
 
 - 
getSymbolpublic Symbol getSymbol(Reference ref) Description copied from interface:SymbolTableReturns the symbol that this reference is associated with.- Specified by:
- getSymbolin interface- SymbolTable
- Parameters:
- ref- the reference to find the associated symbol for.
 
 - 
getMaxSymbolAddresspublic Address getMaxSymbolAddress(AddressSpace space) Returns the maximum symbol address within the specified address space.- Parameters:
- space- address space
- Returns:
- maximum symbol address within space or null if none are found.
 
 - 
getNextExternalSymbolAddresspublic Address getNextExternalSymbolAddress() Returns the next available external symbol address- Returns:
 
 - 
getPrimarySymbolIteratorpublic SymbolIterator getPrimarySymbolIterator(Address startAddr, boolean forward) Description copied from interface:SymbolTableGet iterator over only primary symbols starting at the specifiedstartAddr- Specified by:
- getPrimarySymbolIteratorin interface- SymbolTable
- Parameters:
- startAddr- the address at which to begin the iteration.
- forward- true means the iterator is in the forward direction
 
 - 
getPrimarySymbolIteratorpublic SymbolIterator getPrimarySymbolIterator(AddressSetView set, boolean forward) Description copied from interface:SymbolTableGet an iterator over symbols at addresses in the given addressSet- Specified by:
- getPrimarySymbolIteratorin interface- SymbolTable
- Parameters:
- set- the set of address over which to iterate symbols.
- forward- true means the iterator is in the forward direction
 
 - 
getSymbolspublic SymbolIterator getSymbols(AddressSetView set, SymbolType type, boolean forward) Description copied from interface:SymbolTableReturns all the symbols of the given type within the given address set.- Specified by:
- getSymbolsin interface- SymbolTable
- Parameters:
- set- the address set in which to look for symbols of the given type
- type- the SymbolType to look for.
- forward- the direction within the addressSet to search
 
 - 
getPrimarySymbolIteratorpublic SymbolIterator getPrimarySymbolIterator(boolean forward) Description copied from interface:SymbolTableGet iterator over all primary symbols.- Specified by:
- getPrimarySymbolIteratorin interface- SymbolTable
- Parameters:
- forward- true means the iterator is in the forward direction
 
 - 
getSymbolIteratorpublic SymbolIterator getSymbolIterator(Address startAddr, boolean forward) Description copied from interface:SymbolTableGet iterator over all symbols starting at the specifiedstartAddr- Specified by:
- getSymbolIteratorin interface- SymbolTable
- Parameters:
- startAddr- the address at which to begin the iteration.
- forward- true means the iterator is in the forward direction
 
 - 
getSymbolIteratorpublic SymbolIterator getSymbolIterator() Description copied from interface:SymbolTableGet iterator over all label symbols. Labels are defined on memory locations.- Specified by:
- getSymbolIteratorin interface- SymbolTable
 
 - 
getAllSymbolspublic SymbolIterator getAllSymbols(boolean includeDynamicSymbols) Description copied from interface:SymbolTableReturns an iterator over all symbols, including Dynamic symbols if includeDynamicSymbols is true.- Specified by:
- getAllSymbolsin interface- SymbolTable
- Parameters:
- includeDynamicSymbols- if true, the iterator will include dynamicSymbols
 
 - 
getSymbolIteratorpublic SymbolIterator getSymbolIterator(boolean forward) Description copied from interface:SymbolTableReturns an iterator over all symbols.- Specified by:
- getSymbolIteratorin interface- SymbolTable
- Parameters:
- forward- true means the iterator is in the forward direction
 
 - 
getSymbolIteratorpublic SymbolIterator getSymbolIterator(java.lang.String searchStr, boolean caseSensitive) Description copied from interface:SymbolTableReturns a an iterator over all symbols that match the given search string. NOTE: The iterator is in the forward direction only.- Specified by:
- getSymbolIteratorin interface- SymbolTable
- Parameters:
- searchStr- the string to search for (may contain * to match any sequence or ? to match a single char)
- caseSensitive- flag to determine if the search is case sensitive or not.
 
 - 
addExternalEntryPointpublic void addExternalEntryPoint(Address addr) Description copied from interface:SymbolTableSets the given address to be an external entry point.- Specified by:
- addExternalEntryPointin interface- SymbolTable
- Parameters:
- addr- the address to set as an external entry point.
 
 - 
getExternalEntryPointIteratorpublic AddressIterator getExternalEntryPointIterator() Description copied from interface:SymbolTableGet forward/back iterator over addresses that are entry points.- Specified by:
- getExternalEntryPointIteratorin interface- SymbolTable
 
 - 
isExternalEntryPointpublic boolean isExternalEntryPoint(Address addr) Description copied from interface:SymbolTableReturns true if the given address has been set as an external entry point.- Specified by:
- isExternalEntryPointin interface- SymbolTable
- Parameters:
- addr- address to test for external entry point.
 
 - 
removeExternalEntryPointpublic void removeExternalEntryPoint(Address addr) Description copied from interface:SymbolTableRemoves the given address as an external entry point.- Specified by:
- removeExternalEntryPointin interface- SymbolTable
- Parameters:
- addr- the address to remove as an external entry point.
 
 - 
hasLabelHistorypublic boolean hasLabelHistory(Address addr) Description copied from interface:SymbolTableReturn true if there is a history of label changes at the given address.- Specified by:
- hasLabelHistoryin interface- SymbolTable
- Parameters:
- addr- the address to check for symbol history.
 
 - 
getLabelHistorypublic java.util.Iterator<LabelHistory> getLabelHistory() Description copied from interface:SymbolTableGet an iterator over all the label history objects.- Specified by:
- getLabelHistoryin interface- SymbolTable
 
 - 
getLabelHistorypublic LabelHistory[] getLabelHistory(Address addr) Description copied from interface:SymbolTableGet the label history objects for the given address. The history object records changes made to labels at some address.- Specified by:
- getLabelHistoryin interface- SymbolTable
- Parameters:
- addr- address of the label change
- Returns:
- array of history objects
 
 - 
invalidateCachepublic void invalidateCache(boolean all) Description copied from interface:ManagerDBClears all data caches.- Specified by:
- invalidateCachein interface- ManagerDB
- 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.
 
 - 
moveSymbolsAtpublic void moveSymbolsAt(Address oldAddr, Address newAddr) Move symbol. Only symbol address is changed. References must be moved separately.- Parameters:
- fromAddr-
- toAddr-
 
 - 
getDynamicSymbolIDpublic long getDynamicSymbolID(Address addr) Description copied from interface:SymbolTableGet the unique symbol ID for a dynamic symbol associated with the speified addr. The generation of this symbol ID does not reflect the presence of a dyanmic symbol at the specified addr. This symbol ID should not be permanently stored since the encoding may change between software releases.- Specified by:
- getDynamicSymbolIDin interface- SymbolTable
- Parameters:
- addr- dynamic symbol address
- Returns:
- unique symbol ID
 
 - 
namespaceRemovedpublic void namespaceRemoved(long namespaceID) Called by the NamespaceManager when a namespace is removed; remove all symbols that have the given namespace ID.- Parameters:
- namespaceID- ID of namespace being removed
 
 - 
getNamespacepublic Namespace getNamespace(Address addr) Description copied from interface:SymbolTableReturns the lowest level Namespace within which the specified address is contained.- Specified by:
- getNamespacein interface- SymbolTable
- Parameters:
- addr- the address for which to finds its enclosing namespace.
 
 - 
getClassNamespacespublic java.util.Iterator<GhidraClass> getClassNamespaces() Description copied from interface:SymbolTableReturns all Class Namespaces defined within the program.- Specified by:
- getClassNamespacesin interface- SymbolTable
 
 - 
getDefinedSymbolspublic SymbolIterator getDefinedSymbols() Description copied from interface:SymbolTableReturns an iterator over all defined symbols in no particular order.- Specified by:
- getDefinedSymbolsin interface- SymbolTable
 
 - 
getExternalSymbolpublic Symbol getExternalSymbol(java.lang.String name) Description copied from interface:SymbolTableReturns the external symbol with the given name.- Specified by:
- getExternalSymbolin interface- SymbolTable
- Parameters:
- name- the name of the symbol to be retrieved.
- Returns:
- symbol, or null if no external symbol has that name
 
 - 
getExternalSymbolspublic SymbolIterator getExternalSymbols(java.lang.String name) Description copied from interface:SymbolTableReturns all the external symbols with the given name.- Specified by:
- getExternalSymbolsin interface- SymbolTable
- Parameters:
- name- the name of symbols to search for.
- Returns:
- array of external symbols with the given name
 
 - 
getExternalSymbolspublic SymbolIterator getExternalSymbols() Description copied from interface:SymbolTableReturns an iterator over all defined external symbols in no particular order.- Specified by:
- getExternalSymbolsin interface- SymbolTable
 
 - 
getChildrenpublic SymbolIterator getChildren(Symbol parentSymbol) Description copied from interface:SymbolTableReturns an iterator over all symbols that have the given symbol as its parent..- Specified by:
- getChildrenin interface- SymbolTable
- Parameters:
- parentSymbol- the parent symbol
 
 - 
setLanguagepublic void setLanguage(LanguageTranslator translator, TaskMonitor monitor) throws CancelledException - Throws:
- CancelledException
 
 - 
replaceDataTypespublic void replaceDataTypes(long oldDataTypeID, long newDataTypeID)
 - 
moveAddressRangepublic void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException Description copied from interface:ManagerDBMove all objects within an address range to a new location.- Specified by:
- moveAddressRangein interface- ManagerDB
- 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:
- CancelledException- if the user cancelled the operation via the task monitor.
 
 - 
deleteAddressRangepublic void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException Description copied from interface:ManagerDBDelete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.- Specified by:
- deleteAddressRangein interface- ManagerDB
- 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.
 
 - 
createVariableSymbolpublic VariableSymbolDB createVariableSymbol(java.lang.String name, Namespace namespace, SymbolType type, int firstUseOffsetOrOrdinal, VariableStorage storage, SourceType source) throws DuplicateNameException, InvalidInputException Creates variable symbols. Note this is not a method defined in the Symbol Table interface. It is intended to be used by Ghidra program internals.- Parameters:
- name- the name of the variable
- namespace- the function that contains the variable.
- type- the type of the variable (can only be PARAMETER or LOCAL_VAR)
- firstUseOffsetOrOrdinal- the offset in the function where the variable is first used.
- storage- the VariableStorage (stack, registers, etc.)
- source- the symbol source type (user defined, analysis, etc.)
- Returns:
- the new VariableSymbol that was created.
- Throws:
- DuplicateNameException- if there is another variable in this function with that name.
- InvalidInputException- if the name contains illegal characters (space for example)
 
 - 
createClasspublic GhidraClass createClass(Namespace parent, java.lang.String name, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolTableCreate a class namespace in the given parent namespace.- Specified by:
- createClassin interface- SymbolTable
- Parameters:
- parent- parent namespace
- name- name of the namespace
- source- the source of this class namespace's symbol
- Returns:
- new class namespace
- Throws:
- DuplicateNameException- thrown if another non function or lable symbol exists with the given name
- InvalidInputException- throw if the name has invalid characters or is null
 
 - 
createExternalLibrarypublic Library createExternalLibrary(java.lang.String name, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolTableCreates a Library namespace with the given name.- Specified by:
- createExternalLibraryin interface- SymbolTable
- Parameters:
- name- the name of the new Library namespace
- source- the source of this external library's symbol
- Returns:
- the new Library namespace.
- Throws:
- DuplicateNameException- thrown if another non function or lable symbol exists with the given name
- InvalidInputException
 
 - 
createNameSpacepublic Namespace createNameSpace(Namespace parent, java.lang.String name, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolTableCreates a new namespace.- Specified by:
- createNameSpacein interface- SymbolTable
- Parameters:
- parent- the parent namespace for the new namespace
- name- the name of the new namespace
- source- the source of this namespace's symbol
- Returns:
- the new Namespace object.
- Throws:
- DuplicateNameException- thrown if another non function or lable symbol exists with the given name
- InvalidInputException- if the name is invalid.
 
 - 
createSpecialSymbolpublic SymbolDB createSpecialSymbol(Address addr, java.lang.String name, Namespace parent, SymbolType symbolType, long data1, int data2, java.lang.String data3, SourceType source) throws DuplicateNameException, InvalidInputException Creates a symbol, specifying all information for the record. This method is not on the public interface and is only intended for program API internal use. The user of this method must carefully provided exactly the information needed depending on the type of symbol being created.- Parameters:
- addr- the address for the symbol
- name- the name of the symbol
- parent- the namespace for the symbol
- symbolType- the type of the symbol
- data1- long value whose meaning depends on the symbol type.
- data2- int value whose meaning depends on the symbol type.
- data3- string value whose meaning depends on the symbol type.
- source- the SourceType for the new symbol
- Returns:
- the newly created symbol
- Throws:
- DuplicateNameException- if the symbol type must be unique and another already has that name in the given namespace.
- InvalidInputException- if the name contains any illegal characters (i.e. space)
 
 - 
createSymbolpublic Symbol createSymbol(Address addr, java.lang.String name, SourceType source) throws InvalidInputException - Specified by:
- createSymbolin interface- SymbolTable
- Throws:
- InvalidInputException
 
 - 
createLabelpublic Symbol createLabel(Address addr, java.lang.String name, SourceType source) throws InvalidInputException Description copied from interface:SymbolTableCreate a label symbol with the given name associated to the given Address. The symbol will be global and be of type SymbolType.CODE. Label Symbols do not have to have unique names. If this is the first symbol defined for the address it becomes the primary.- Specified by:
- createLabelin interface- SymbolTable
- Parameters:
- addr- the address at which to create a symbol
- name- the name of the symbol.
- source- the source of this symbol
 Some symbol types, such as function symbols, can set the source to Symbol.DEFAULT.
- Throws:
- InvalidInputException- thrown if names contains white space, is zero length, or is null. Also thrown if invalid parentNamespace is specified.
 
 - 
createSymbolpublic Symbol createSymbol(Address addr, java.lang.String name, Namespace namespace, SourceType source) throws InvalidInputException, DuplicateNameException - Specified by:
- createSymbolin interface- SymbolTable
- Throws:
- InvalidInputException
- DuplicateNameException
 
 - 
createLabelpublic Symbol createLabel(Address addr, java.lang.String name, Namespace namespace, SourceType source) throws InvalidInputException Description copied from interface:SymbolTableCreate a label symbol with the given name associated to the given Address and namespace. The symbol will be of type SymbolType.CODE. If this is the first symbol defined for the address it becomes the primary symbol. If a symbol with that name already exists at the address, it will be returned instead with its namespace changed to the new namespace unless the new symbol is in the global space, in which case the namespace will remain as is.- Specified by:
- createLabelin interface- SymbolTable
- Parameters:
- addr- the address at which to create a symbol
- name- the name of the symbol.
- namespace- the namespace of the symbol.
- source- the source of this symbol
 Some symbol types, such as function symbols, can set the source to Symbol.DEFAULT.
- Throws:
- InvalidInputException
 
 - 
createCodeSymbolpublic Symbol createCodeSymbol(Address addr, java.lang.String name, Namespace namespace, SourceType source, java.lang.String data3) throws InvalidInputException Internal method for creating label symbols.- Parameters:
- addr- the address for the new symbol
- name- the name of the new symbol
- namespace- the namespace for the new symbol
- source- the SourceType of the new symbol
- data3- special use depending on the symbol type and whether or not it is external
- Returns:
- the new symbol
- Throws:
- InvalidInputException- if the name contains illegal characters (i.e. space)
 
 - 
createFunctionSymbolpublic Symbol createFunctionSymbol(Address addr, java.lang.String name, Namespace namespace, SourceType source, java.lang.String data3) throws InvalidInputException Internal method for creating funcions symbols.- Parameters:
- addr- the address for the new symbol
- name- the name of the new symbol
- namespace- the namespace for the new symbol
- source- the SourceType of the new symbol
- data3- special use depending on the symbol type and whether or not it is external.
- Returns:
- the new symbol
- Throws:
- InvalidInputException- if the name contains illegal characters (i.e. space)
 
 - 
getClassSymbolpublic Symbol getClassSymbol(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns the class symbol with the given name in the given namespace.- Specified by:
- getClassSymbolin interface- SymbolTable
- Parameters:
- name- the name of the class.
- namespace- the namespace to search for the class.
- Returns:
- the class symbol with the given name in the given namespace.
 
 - 
getParameterSymbolpublic Symbol getParameterSymbol(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns the parameter symbol with the given name in the given namespace.- Specified by:
- getParameterSymbolin interface- SymbolTable
- Parameters:
- name- the name of the parameter.
- namespace- the namespace (function) to search for the class.
- Returns:
- the parameter symbol with the given name in the given namespace.
 
 - 
getLocalVariableSymbolpublic Symbol getLocalVariableSymbol(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns the local variable symbol with the given name in the given namespace.- Specified by:
- getLocalVariableSymbolin interface- SymbolTable
- Parameters:
- name- the name of the local variable.
- namespace- the namespace (function) to search for the class.
- Returns:
- the local variable symbol with the given name in the given namespace.
 
 - 
getNamespaceSymbolpublic Symbol getNamespaceSymbol(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns a generic namespace symbol with the given name in the given namespace.- Specified by:
- getNamespaceSymbolin interface- SymbolTable
- Parameters:
- name- the name of the namespace symbol to retrieve.
- namespace- the namespace containing the symbol to retrieve.
- Returns:
- a generic namespace symbol with the given name in the given namespace.
 
 - 
getLabelOrFunctionSymbolspublic java.util.List<Symbol> getLabelOrFunctionSymbols(java.lang.String name, Namespace namespace) Description copied from interface:SymbolTableReturns all the label or function symbols that have the given name in the given namespace.- Specified by:
- getLabelOrFunctionSymbolsin interface- SymbolTable
- Parameters:
- name- the name of the symbols to search for.
- namespace- the namespace to search. If null, then the global namespace is assumed.
- Returns:
- a list of all the label or function symbols with the given name in the given namespace.
 
 - 
getVariableSymbolpublic Symbol getVariableSymbol(java.lang.String name, Function function) Description copied from interface:SymbolTableReturns a symbol that is either a parameter or local variable. There can be only one because these symbol types have a unique name requirement.- Specified by:
- getVariableSymbolin interface- SymbolTable
- Parameters:
- name- the naem of the variable.
- Returns:
- a parameter or local variable symbol with the given name.
 
 
- 
 
-