Class SymbolManager
- All Implemented Interfaces:
ManagerDB,SymbolTable
-
Constructor Summary
ConstructorsConstructorDescriptionSymbolManager(DBHandle handle, AddressMap addrMap, OpenMode openMode, ErrorHandler errHandler, Lock lock, TaskMonitor monitor) Creates a new Symbol manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalEntryPoint(Address addr) Add a memory address to the external entry points.convertNamespaceToClass(Namespace namespace) Convert the given namespace to a class namespacecreateClass(Namespace parent, String name, SourceType source) Create a class namespace in the given parent namespacecreateCodeSymbol(Address addr, String name, Namespace namespace, SourceType source, String stringData) Internal method for creating label symbols.createExternalLibrary(String name, SourceType source) Create a library namespace with the given namecreateFunctionSymbol(Address addr, String name, Namespace namespace, SourceType source, String stringData) Internal method for creating function symbolscreateLabel(Address addr, String name, Namespace namespace, SourceType source) Create a label symbol with the given name and namespace associated to the given memory address.createLabel(Address addr, String name, SourceType source) Create a label symbol with the given name in the global namespace and associated to the given memory address.createLibrarySymbol(String name, String pathname, SourceType source) Create a Library symbol with the specified name and optional pathnamecreateNameSpace(Namespace parent, String name, SourceType source) Create a new namespacecreateVariableSymbol(String name, FunctionDB function, 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.Find previously defined variable storage addressgetAllSymbols(boolean includeDynamicSymbols) Get all of the symbols, optionally including dynamic symbolsgetChildren(Symbol parentSymbol) Get all symbols that have the given parent symbolGet all class namespaces defined within the program, in no particular ordergetClassSymbol(String name, Namespace namespace) Get the class symbol with the given name in the given namespaceGet all defined symbols in no particular order.longgetDynamicSymbolID(Address addr) Get the unique symbol ID for a dynamic symbol at the specified addressGet the external entry points (addresses)getExternalSymbol(String name) Get the external symbol with the given name.Get all defined external symbols in no particular ordergetExternalSymbols(String name) Get all the external symbols with the given namegetGlobalSymbol(String name, Address addr) Get the global symbol with the given name and address.getGlobalSymbols(String name) Get a list of all global symbols with the given name.Get the complete label history of the programgetLabelHistory(Address addr) Get the label history for the given addressgetLabelOrFunctionSymbols(String name, Namespace namespace) Get all the label or function symbols that have the given name in the given parent namespace.getLibrarySymbol(String name) Get the library symbol with the given namegetLocalVariableSymbol(String name, Namespace namespace) Get the local variable symbol with the given name in the given namespacegetMaxSymbolAddress(AddressSpace space) Returns the maximum symbol address within the specified address space.getNamespace(Address addr) Get the deepest namespace containing the given addressgetNamespace(String name, Namespace namespace) Get the namespace with the given name in the given parent namespace.getNamespaceSymbol(String name, Namespace namespace) Get a generic namespace symbol with the given name in the given parent namespaceReturns the next available external symbol addressintGet the total number of symbols in the tablegetOrCreateNameSpace(Namespace parent, String name, SourceType source) Get or create the namespace with the given name in the given parentgetParameterSymbol(String name, Namespace namespace) Get the parameter symbol with the given name in the given namespacegetPrimarySymbol(Address addr) Get the primary label or function symbol at the given addressgetPrimarySymbolIterator(boolean forward) Get all primary label and function symbols defined within program memory address.getPrimarySymbolIterator(Address startAddr, boolean forward) Get all primary label and function symbols starting at the specified memory address through to the program's maximum memory address.getPrimarySymbolIterator(AddressSetView set, boolean forward) Get primary label and function symbols within the given address set.getSymbol(long symbolID) Get the symbol for the given symbol ID.Get the symbol that a given reference associatesGet the symbol with the given name, address, and namespace.Get all label symbolsgetSymbolIterator(boolean forward) Get all the symbols defined with program memory.getSymbolIterator(Address startAddr, boolean forward) Get all the symbols starting at the specified memory address.getSymbolIterator(String searchStr, boolean caseSensitive) Get an iterator over all symbols that match the given querygetSymbols(long namespaceID) Get an iterator over all the symbols in the given namespaceSymbol[]getSymbols(Address addr) Get all the symbols at the given address.getSymbols(AddressSetView set, SymbolType type, boolean forward) Get all the symbols of the given type within the given address set.getSymbols(Namespace namespace) Get an iterator over all the symbols in the given namespacegetSymbols(String name) Get all the symbols with the given namegetSymbols(String name, Namespace namespace) Get a list of all symbols with the given name in the given parent namespace.getSymbolsAsIterator(Address addr) Get an iterator over the symbols at the given address.Symbol[]getUserSymbols(Address addr) Get an array of defined symbols at the given address (i.e., those with database record).Get the variable storage manager used by this symbol tablegetVariableSymbol(String name, Function function) Get a symbol that is either a parameter or local variable.booleanhasLabelHistory(Address addr) Check if there is a history of label changes at the given addressbooleanCheck if there exists any symbol at the given addressvoidimageBaseChanged(Address oldBase, Address newBase) voidinvalidateCache(boolean all) Clears all data caches.booleanisExternalEntryPoint(Address addr) Check if the given address is an external entry pointvoidNo 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(OpenMode openMode, int currentRevision, TaskMonitor monitor) Callback from program made to each manager after the program has completed initialization.voidRemove an address from the external entry pointsbooleanRemoves the specified symbol from the symbol table.voidreplaceDataTypes(Map<Long, Long> dataTypeReplacementMap) scanSymbolsByName(String startName) Scan symbols lexicographically by namevoidsetLanguage(LanguageTranslator translator, TaskMonitor monitor) voidsetProgram(ProgramDB program) Callback from program used to indicate all manager have been created.
-
Constructor Details
-
SymbolManager
public SymbolManager(DBHandle handle, AddressMap addrMap, OpenMode openMode, ErrorHandler errHandler, Lock lock, TaskMonitor monitor) throws CancelledException, IOException, VersionException Creates a new Symbol manager.- Parameters:
handle- the database handleraddrMap- the address map.openMode- the open mode.errHandler- database error handlerlock- the program synchronization lockmonitor- the progress monitor used when upgrading.- Throws:
CancelledException- if the user cancels the upgrade.IOException- if a database io error occurs.VersionException- if the database version doesn't match the current version.
-
-
Method Details
-
findVariableStorageAddress
Find previously defined variable storage address- Parameters:
storage- variable storage- Returns:
- previously defined variable storage address or null if not found
- Throws:
IOException- if there is database exception
-
setProgram
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 interfaceManagerDB- Parameters:
program- the program is set when all the initializations have been completed.
-
programReady
public void programReady(OpenMode openMode, int currentRevision, TaskMonitor monitor) throws IOException, CancelledException Description 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 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:
IOException- if a database io error occurs.CancelledException- if the user cancelled the operation via the task monitor.
-
getVariableStorageManager
Get the variable storage manager used by this symbol table- Returns:
- varable storage manager
-
migrateFromOldVariableStorageManager
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- the task monitor- Throws:
CancelledException- if the operation is cancelled
-
getNumSymbols
public int getNumSymbols()Description copied from interface:SymbolTableGet the total number of symbols in the table- Specified by:
getNumSymbolsin interfaceSymbolTable- Returns:
- total number of symbols
-
removeSymbolSpecial
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 invoking
Symbol.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 effect and will return false.
- If no other labels exist at the function entry, the function will be renamed to the default function name.
- If another label does exist at the function entry point, that label will be removed, and the function will be renamed to that label's name.
Any reference bound to a removed symbol will lose that symbol specific binding.
- Specified by:
removeSymbolSpecialin interfaceSymbolTable- Parameters:
sym- the symbol to be removed.- Returns:
- true if a symbol is removed, false if not or in case of failure
-
hasSymbol
Description copied from interface:SymbolTableCheck if there exists any symbol at the given address- Specified by:
hasSymbolin interfaceSymbolTable- Parameters:
addr- address to check for an existing symbol- Returns:
- true if any symbol exists
-
getSymbol
Description copied from interface:SymbolTableGet the symbol for the given symbol ID.- Specified by:
getSymbolin interfaceSymbolTable- Parameters:
symbolID- the id of the symbol to be retrieved- Returns:
- null if there is no symbol with the given ID
-
getSymbolsAsIterator
Description copied from interface:SymbolTableGet an iterator over the symbols at the given address. Any dynamic symbol at the address will be excluded.Use this instead of
SymbolTable.getSymbols(Address)when you do not need to get all symbols, but rather are searching for a particular symbol. This method prevents all symbols at the given address from being loaded up front.- Specified by:
getSymbolsAsIteratorin interfaceSymbolTable- Parameters:
addr- the address of the symbols- Returns:
- an iterator over the symbols at the given address
- See Also:
-
getSymbols
Description copied from interface:SymbolTableGet all the symbols at the given address. This method will include a dynamic memory symbol if one exists at the specified address.For a memory address the primary symbol will be returned at array index 0. WARNING! Use of this method with non-memory addresses is discouraged. Example: Variable address could be used multiple times by many functions.
NOTE: unless all the symbols are needed at once, and a dynamic symbol can be ignored, consider using
SymbolTable.getSymbolsAsIterator(Address)instead.- Specified by:
getSymbolsin interfaceSymbolTable- Parameters:
addr- the address of the symbols- Returns:
- an array, possibly empty, of the symbols at the given address
- See Also:
-
getUserSymbols
Description copied from interface:SymbolTableGet an array of defined symbols at the given address (i.e., those with database record). Any dynamic memory symbol at the address will be excluded.WARNING! Use of this method with non-memory addresses is discouraged. Example: Variable address could be used multiple times by many functions.
NOTE: unless all the symbols are needed at once, consider using
SymbolTable.getSymbolsAsIterator(Address)instead.- Specified by:
getUserSymbolsin interfaceSymbolTable- Parameters:
addr- the address of the symbols- Returns:
- an array, possibly empty, of the symbols
-
getSymbol
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 only the first match.
NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type) since it mirrors the name and parent namespace of the function it thunks.
- Specified by:
getSymbolin interfaceSymbolTable- Parameters:
name- the name of the symbol to retrieveaddress- the address of the symbol to retrievenamespace- the namespace of the symbol to retrieve. May be null which indicates the global namespace.- Returns:
- the symbol which matches the specified criteria or null if not found
- See Also:
-
getGlobalSymbol
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.NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type) since it mirrors the name and parent namespace of the function it thunks.
- Specified by:
getGlobalSymbolin interfaceSymbolTable- Parameters:
name- the name of the symbol to retrieveaddr- the address of the symbol to retrieve- Returns:
- the symbol which matches the specified criteria in the global namespace or null if not found
- See Also:
-
getGlobalSymbols
Description copied from interface:SymbolTableGet a list of all global symbols with the given name. Matches against dynamic label symbols will be included.NOTE: This method will not return default thunks (i.e., thunk function symbol with default source type).
- Specified by:
getGlobalSymbolsin interfaceSymbolTable- Parameters:
name- the name of the symbols to retrieve- Returns:
- a list of all global symbols with the given name
-
getLibrarySymbol
Description copied from interface:SymbolTableGet the library symbol with the given name- Specified by:
getLibrarySymbolin interfaceSymbolTable- Parameters:
name- the name of the library symbol to retrieve- Returns:
- the library symbol with the given name
-
getSymbols
Description copied from interface:SymbolTableGet a list of all symbols with the given name in the given parent namespace. If the global namespace is specified matches against dynamic label symbols will be included.NOTE: If a function namespace is specified default parameter and local variable names will be included. If an external library or namespace is specified default external label/function symbols will be included.
NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type).
- Specified by:
getSymbolsin interfaceSymbolTable- Parameters:
name- the name of the symbols to retrievenamespace- the namespace to search for symbols- Returns:
- a list of symbols which satisfy specified criteria
-
getNamespace
Description copied from interface:SymbolTableGet the namespace with the given name in the given parent namespace.The returned namespace can be a generic namespace (
SymbolType.NAMESPACE,NamespaceSymbol), class (SymbolType.CLASS,ClassSymbol),or library (SymbolType.LIBRARY,LibrarySymbol), but not a function.There can be only one because these symbol types have a unique name requirement within their parent namespace.
- Specified by:
getNamespacein interfaceSymbolTable- Parameters:
name- the name of the namespace to be retrievednamespace- the parent namespace of the namespace to be retrieved- Returns:
- the namespace with the given name in the given parent namespace
-
getSymbols
Description copied from interface:SymbolTableGet an iterator over all the symbols in the given namespaceNOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type).
- Specified by:
getSymbolsin interfaceSymbolTable- Parameters:
namespace- the namespace to search for symbols- Returns:
- an iterator over the symbols
-
getSymbols
Description copied from interface:SymbolTableGet an iterator over all the symbols in the given namespaceNOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type).
- Specified by:
getSymbolsin interfaceSymbolTable- Parameters:
namespaceID- the namespace ID to search for symbols.- Returns:
- symbol iterator
-
getSymbols
Description copied from interface:SymbolTableGet all the symbols with the given nameNOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type). It will also not work for default local variables and parameters.
- Specified by:
getSymbolsin interfaceSymbolTable- Parameters:
name- the name of symbols to search for- Returns:
- an iterator over symbols with the given name
-
scanSymbolsByName
Description copied from interface:SymbolTableScan symbols lexicographically by nameIf a symbol with the given start name does not exist, the iterator will start at the first symbol following it. This includes only symbols whose addresses are in memory. In particular, it excludes external symbols and dynamic symbols, i.e., those generated as a reference destination.
- Specified by:
scanSymbolsByNamein interfaceSymbolTable- Parameters:
startName- the starting point- Returns:
- an iterator over the symbols in lexicographical order
-
getPrimarySymbol
Description copied from interface:SymbolTableGet the primary label or function symbol at the given addressThis method will return null if the address specified is neither a memory address nor an external address.
- Specified by:
getPrimarySymbolin interfaceSymbolTable- Parameters:
addr- the address of the symbol- Returns:
- the symbol, or null if no symbol is at the address
-
getSymbol
Description copied from interface:SymbolTableGet the symbol that a given reference associates- Specified by:
getSymbolin interfaceSymbolTable- Parameters:
ref- the reference for the associated symbol- Returns:
- the associated symbol
-
getMaxSymbolAddress
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.
-
getNextExternalSymbolAddress
Returns the next available external symbol address- Returns:
- the address
-
getPrimarySymbolIterator
public SymbolIterator getPrimarySymbolIterator(Address startAddr, boolean forward) throws IllegalArgumentException Description copied from interface:SymbolTableGet all primary label and function symbols starting at the specified memory address through to the program's maximum memory address. Iteration may span multiple memory spaces.NOTE: The returned symbols will not include any external symbols defined within the
AddressSpace.EXTERNAL_SPACE. In addition, all global dynamic label symbols will be omitted.- Specified by:
getPrimarySymbolIteratorin interfaceSymbolTable- Parameters:
startAddr- the starting memory addressforward- true means the iterator is in the forward direction- Returns:
- symbol iterator
- Throws:
IllegalArgumentException- if a non-memory address is specified
-
getPrimarySymbolIterator
Description copied from interface:SymbolTableGet primary label and function symbols within the given address set.NOTE: All external symbols will be omitted unless the full
AddressSpace.EXTERNAL_SPACErange is included within the specified address set or a null addressSet is specified. All global dynamic label symbols will be omitted.- Specified by:
getPrimarySymbolIteratorin interfaceSymbolTable- Parameters:
set- the set of address containing the symbols. A null value may be specified to include all memory and external primary symbols.forward- true means the iterator is in the forward direction- Returns:
- symbol iterator
-
getSymbols
Description copied from interface:SymbolTableGet all the symbols of the given type within the given address set.NOTE: All external symbols will be omiitted unless the full
AddressSpace.EXTERNAL_SPACErange is included within the specified address set or a null addressSet is specified. All global dynamic label symbols will be omitted.- Specified by:
getSymbolsin interfaceSymbolTable- Parameters:
set- the address set containing the symbols. A null value may be specified to include all memory and external primary symbols.type- the type of the symbolsforward- the direction of the iterator, by address- Returns:
- symbol iterator
-
getPrimarySymbolIterator
Description copied from interface:SymbolTableGet all primary label and function symbols defined within program memory address. Iteration may span multiple memory spaces.NOTE: The returned symbols will not include any external symbols defined within the
AddressSpace.EXTERNAL_SPACE. In addition, all global dynamic label symbols will be omitted.- Specified by:
getPrimarySymbolIteratorin interfaceSymbolTable- Parameters:
forward- true means the iterator is in the forward direction- Returns:
- symbol iterator
-
getSymbolIterator
public SymbolIterator getSymbolIterator(Address startAddr, boolean forward) throws IllegalArgumentException Description copied from interface:SymbolTableGet all the symbols starting at the specified memory address.NOTE: The returned symbols will not include any external symbols defined within the
AddressSpace.EXTERNAL_SPACE. In addition, all global dynamic label symbols will be omitted.- Specified by:
getSymbolIteratorin interfaceSymbolTable- Parameters:
startAddr- the starting addressforward- true means the iterator is in the forward direction- Returns:
- symbol iterator
- Throws:
IllegalArgumentException- if startAddr is not a memory address
-
getSymbolIterator
Description copied from interface:SymbolTableGet all label symbolsLabels are defined on memory locations.
- Specified by:
getSymbolIteratorin interfaceSymbolTable- Returns:
- symbol iterator
-
getAllSymbols
Description copied from interface:SymbolTableGet all of the symbols, optionally including dynamic symbols- Specified by:
getAllSymbolsin interfaceSymbolTable- Parameters:
includeDynamicSymbols- if true, the iterator will include dynamic symbols- Returns:
- an iterator over the symbols
-
getSymbolIterator
Description copied from interface:SymbolTableGet all the symbols defined with program memory.NOTE: The returned symbols will not include any external symbols defined within the
AddressSpace.EXTERNAL_SPACE. In addition, all global dynamic label symbols will be omitted.- Specified by:
getSymbolIteratorin interfaceSymbolTable- Parameters:
forward- the direction of the iterator, by address- Returns:
- symbol iterator
-
getSymbolIterator
Description copied from interface:SymbolTableGet an iterator over all symbols that match the given queryNOTE: The iterator is in the forward direction only and will not return default thunks (i.e., thunk function symbol with default source type).
- Specified by:
getSymbolIteratorin interfaceSymbolTable- Parameters:
searchStr- the query, which may contain * to match any sequence or ? to match a single charcaseSensitive- flag to specify whether the search is case sensitive- Returns:
- symbol iterator
-
addExternalEntryPoint
Description copied from interface:SymbolTableAdd a memory address to the external entry points.- Specified by:
addExternalEntryPointin interfaceSymbolTable- Parameters:
addr- the memory address to add- Throws:
IllegalArgumentException- if a non-memory is specified
-
getExternalEntryPointIterator
Description copied from interface:SymbolTableGet the external entry points (addresses)- Specified by:
getExternalEntryPointIteratorin interfaceSymbolTable- Returns:
- entry-point address iterator
-
isExternalEntryPoint
Description copied from interface:SymbolTableCheck if the given address is an external entry point- Specified by:
isExternalEntryPointin interfaceSymbolTable- Parameters:
addr- address to check- Returns:
- true if specified address has been marked as an entry point, otherwise false
-
removeExternalEntryPoint
Description copied from interface:SymbolTableRemove an address from the external entry points- Specified by:
removeExternalEntryPointin interfaceSymbolTable- Parameters:
addr- the address to remove
-
hasLabelHistory
Description copied from interface:SymbolTableCheck if there is a history of label changes at the given address- Specified by:
hasLabelHistoryin interfaceSymbolTable- Parameters:
addr- the address to check- Returns:
- true if a label history exists for specified address, otherwise false
-
getLabelHistory
Description copied from interface:SymbolTableGet the complete label history of the program- Specified by:
getLabelHistoryin interfaceSymbolTable- Returns:
- an iterator over history entries
-
getLabelHistory
Description copied from interface:SymbolTableGet the label history for the given addressEach entry records a change made to the labels at the given address
- Specified by:
getLabelHistoryin interfaceSymbolTable- Parameters:
addr- address of the label change- Returns:
- array of history objects
-
invalidateCache
public void invalidateCache(boolean all) Description copied from interface:ManagerDBClears all data caches.- Specified by:
invalidateCachein 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.
-
moveSymbolsAt
Move symbol.Only symbol address is changed. References must be moved separately.
- Parameters:
oldAddr- the old symbol memory addressnewAddr- the new symbol memory address
-
getDynamicSymbolID
Description copied from interface:SymbolTableGet the unique symbol ID for a dynamic symbol at the specified addressHaving a dynamic symbol ID does not imply that a dynamic symbol actually exists. Rather, this just gives the ID that a dynamic symbol at that address would have, should it ever exist.
NOTE: This symbol ID should not be permanently stored since the encoding may change between software releases.
- Specified by:
getDynamicSymbolIDin interfaceSymbolTable- Parameters:
addr- the dynamic symbol memory address- Returns:
- unique symbol ID
-
namespaceRemoved
public 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
-
getNamespace
Description copied from interface:SymbolTableGet the deepest namespace containing the given address- Specified by:
getNamespacein interfaceSymbolTable- Parameters:
addr- the address contained in the namespace- Returns:
- the deepest namespace which contains the address
-
getClassNamespaces
Description copied from interface:SymbolTableGet all class namespaces defined within the program, in no particular order- Specified by:
getClassNamespacesin interfaceSymbolTable- Returns:
- an iterator over the classes
-
getDefinedSymbols
Description copied from interface:SymbolTableGet all defined symbols in no particular order. All global dynamic memory labels will be excluded.- Specified by:
getDefinedSymbolsin interfaceSymbolTable- Returns:
- symbol iterator
-
getExternalSymbol
Description copied from interface:SymbolTableGet the external symbol with the given name. The first occurrence of the named symbol found within any external namespace will be returned. If all matching symbols need to be considered theSymbolTable.getExternalSymbols(String)should be used.- Specified by:
getExternalSymbolin interfaceSymbolTable- Parameters:
name- the name of the symbol- Returns:
- the symbol, or null if no external symbol has that name
-
getExternalSymbols
Description copied from interface:SymbolTableGet all the external symbols with the given name- Specified by:
getExternalSymbolsin interfaceSymbolTable- Parameters:
name- the name of symbols- Returns:
- an iterator over the symbols
-
getExternalSymbols
Description copied from interface:SymbolTableGet all defined external symbols in no particular order- Specified by:
getExternalSymbolsin interfaceSymbolTable- Returns:
- symbol iterator
-
getChildren
Description copied from interface:SymbolTableGet all symbols that have the given parent symbolNOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type) or global dynamic label symbols.
- Specified by:
getChildrenin interfaceSymbolTable- Parameters:
parentSymbol- the parent symbol- Returns:
- symbol iterator
-
setLanguage
public void setLanguage(LanguageTranslator translator, TaskMonitor monitor) throws CancelledException - Throws:
CancelledException
-
replaceDataTypes
-
moveAddressRange
public 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 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:
CancelledException- if the user cancelled the operation via the task monitor.
-
deleteAddressRange
public 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. The specified start and end addresses must form a valid range within a singleAddressSpace.- Specified by:
deleteAddressRangein 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.
-
imageBaseChanged
-
createVariableSymbol
public VariableSymbolDB createVariableSymbol(String name, FunctionDB function, 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 variablefunction- 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)
-
createClass
public GhidraClass createClass(Namespace parent, String name, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolTableCreate a class namespace in the given parent namespace- Specified by:
createClassin interfaceSymbolTable- Parameters:
parent- the parent namespace, or null for the global namespacename- the name of the namespacesource- the source of this class namespace's symbol- Returns:
- the new class namespace
- Throws:
DuplicateNameException- thrown if another non function or label symbol exists with the given nameInvalidInputException- throw if the name has invalid characters or is null
-
createExternalLibrary
public Library createExternalLibrary(String name, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolTableCreate a library namespace with the given name- Specified by:
createExternalLibraryin interfaceSymbolTable- Parameters:
name- the name of the new library namespacesource- the source of this external library's symbol- Returns:
- the new library namespace
- Throws:
DuplicateNameException- thrown if another non function or label symbol exists with the given nameInvalidInputException- if the name is invalid
-
createNameSpace
public Namespace createNameSpace(Namespace parent, String name, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolTableCreate a new namespace- Specified by:
createNameSpacein interfaceSymbolTable- Parameters:
parent- the parent of the new namespace, or null for the global namespacename- the name of the new namespacesource- the source of this namespace's symbol- Returns:
- the new namespace
- Throws:
DuplicateNameException- if another non function or label symbol exists with the given nameInvalidInputException- if the name is invalid
-
convertNamespaceToClass
Description copied from interface:SymbolTableConvert the given namespace to a class namespace- Specified by:
convertNamespaceToClassin interfaceSymbolTable- Parameters:
namespace- the namespace to convert- Returns:
- the new class
-
getOrCreateNameSpace
public Namespace getOrCreateNameSpace(Namespace parent, String name, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolTableGet or create the namespace with the given name in the given parentIf the namespace does not already exists, then it will be created.
- Specified by:
getOrCreateNameSpacein interfaceSymbolTable- Parameters:
parent- the parent namespacename- the namespace namesource- the source type for the namespace if it is created- Returns:
- the namespace
- Throws:
DuplicateNameException- if another non function or label symbol exists with the given nameInvalidInputException- if the name is invalid
-
createLibrarySymbol
public SymbolDB createLibrarySymbol(String name, String pathname, SourceType source) throws DuplicateNameException, InvalidInputException Create a Library symbol with the specified name and optional pathname- Parameters:
name- library namepathname- project file path (may be null)source- symbol source- Returns:
- library symbol
- Throws:
DuplicateNameException- if library name conflicts with another symbolInvalidInputException- if name contains white space, is zero length, or is null for non-default source. Also thrown if invalid parent namespace is specified.IllegalArgumentException- ifSourceType.DEFAULTis improperly specified, or or if the given parent namespace is from a different program than that of this symbol table.
-
createLabel
public Symbol createLabel(Address addr, String name, SourceType source) throws InvalidInputException Description copied from interface:SymbolTableCreate a label symbol with the given name in the global namespace and associated to the given memory address. (seeAddress.isMemoryAddress()).The new symbol will be of type
SymbolType.LABELorSymbolType.FUNCTIONif a default function symbol currently exists at the address. If a default function symbol exists at the specified address the function symbol will be renamed and returned. Label and function symbols do not need to be unique across multiple addresses. However, if a global symbol at the specified address already has the specified name it will be returned without changing the source type. If this is the first non-dynamic symbol defined for the address it becomes the primary symbol.- Specified by:
createLabelin interfaceSymbolTable- Parameters:
addr- the memory address at which to create a symbolname- the name of the symbolsource- the source of this symbol. In general, a source ofSourceType.DEFAULTshould never be specified using this method.- Returns:
- new labe or function symbol
- Throws:
InvalidInputException- if name contains white space, is zero length, or is null for non-default source
-
createLabel
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source) throws InvalidInputException Description copied from interface:SymbolTableCreate a label symbol with the given name and namespace associated to the given memory address. (seeAddress.isMemoryAddress()).The new symbol will be of type
SymbolType.LABELorSymbolType.FUNCTIONif a default function symbol currently exists at the address. If a default function symbol exists at the specified address the function symbol will be renamed and returned. Label and function symbols do not need to be unique across multiple addresses or namespaces. However, if a symbol at the specified address already has the specified name and namespace it will be returned without changing the source type. If this is the first non-dynamic symbol defined for the address it becomes the primary symbol.- Specified by:
createLabelin interfaceSymbolTable- Parameters:
addr- the address at which to create a symbolname- the name of the symbolnamespace- the parent namespace of the symbol, or null for the global namespace.source- the source of this symbol. In general, a source ofSourceType.DEFAULTshould never be specified using this method.- Returns:
- new label or function symbol
- Throws:
InvalidInputException- if name contains white space, is zero length, or is null for non-default source. Also thrown if invalid parent namespace is specified.
-
createCodeSymbol
public Symbol createCodeSymbol(Address addr, String name, Namespace namespace, SourceType source, String stringData) throws InvalidInputException Internal method for creating label symbols.If identical memory symbol already exists it will be returned.
- Parameters:
addr- the address for the new symbol (memory or external)name- the name of the new symbolnamespace- the namespace for the new symbol (null may be specified for global namespace)source- the SourceType of the new symbolstringData- special use depending on the symbol type and whether or not it is external- Returns:
- the new symbol
- Throws:
InvalidInputException- if name contains white space, is zero length, or is null for non-default source. Also thrown if invalid parent namespace is specified.IllegalArgumentException- ifSourceType.DEFAULTis improperly specified, or an invalid address, or if the given parent namespace is from a different program than that of this symbol table.
-
createFunctionSymbol
public Symbol createFunctionSymbol(Address addr, String name, Namespace namespace, SourceType source, String stringData) throws InvalidInputException Internal method for creating function symbols- Parameters:
addr- the address for the new symbolname- the name of the new symbolnamespace- the namespace for the new symbol (null may be specified for global namespace)source- the SourceType of the new symbolstringData- 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)
-
getClassSymbol
Description copied from interface:SymbolTableGet the class symbol with the given name in the given namespace- Specified by:
getClassSymbolin interfaceSymbolTable- Parameters:
name- the name of the classnamespace- the parent namespace to search for the class- Returns:
- the class symbol with the given name in the given namespace
-
getParameterSymbol
Description copied from interface:SymbolTableGet the parameter symbol with the given name in the given namespace- Specified by:
getParameterSymbolin interfaceSymbolTable- Parameters:
name- the name of the parameternamespace- the namespace (function) to search for the class- Returns:
- the parameter symbol with the given name in the given namespace
-
getLocalVariableSymbol
Description copied from interface:SymbolTableGet the local variable symbol with the given name in the given namespace- Specified by:
getLocalVariableSymbolin interfaceSymbolTable- Parameters:
name- the name of the local variablenamespace- the parent namespace (function) to search for the local variable- Returns:
- the local variable symbol with the given name in the given namespace
-
getNamespaceSymbol
Description copied from interface:SymbolTableGet a generic namespace symbol with the given name in the given parent namespace- Specified by:
getNamespaceSymbolin interfaceSymbolTable- Parameters:
name- the name of the namespace symbol to retrievenamespace- the namespace containing the symbol to retrieve- Returns:
- the symbol, or null
-
getLabelOrFunctionSymbols
Description copied from interface:SymbolTableGet all the label or function symbols that have the given name in the given parent namespace. If the global namespace is specified matches against dynamic label symbols will be included.NOTE: If a function namespace is specified default parameter and local variable names will be included. If an external library or namespace is specified default external label/function symbols will be included.
NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type) since it mirrors the name and parent namespace of the function it thunks.
- Specified by:
getLabelOrFunctionSymbolsin interfaceSymbolTable- Parameters:
name- the name of the symbols to search fornamespace- 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 parent namespace
-
getVariableSymbol
Description copied from interface:SymbolTableGet 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 interfaceSymbolTable- Parameters:
name- the name of the variablefunction- the function to search- Returns:
- a parameter or local variable symbol with the given name
-