Package ghidra.program.model.pcode
Class GlobalSymbolMap
java.lang.Object
ghidra.program.model.pcode.GlobalSymbolMap
A container for global symbols in the decompiler's model of a function. It contains
HighSymbol objects for any symbol accessed by the particular function that is in either
the global scope or some other global namespace. Currently the container is populated
indirectly from the HighGlobal objects marshaled back from the decompiler, using either
the populateSymbol() or newSymbol() methods. HighSymbols are stored by Address and by id,
which matches the formal SymbolDB id when it exists.
-
Constructor Summary
ConstructorDescriptionConstruct a global symbol map attached to a particular function model. -
Method Summary
Modifier and TypeMethodDescriptiongetSymbol
(long id) Retrieve a HighSymbol based on an idRetrieve a HighSymbol based on an AddressGet an iterator over all HighSymbols in this containerCreate a HighSymbol corresponding to an underlying Data object.void
Some Varnode annotations refer to global symbols.populateSymbol
(long id, DataType dataType, int sz) Create a HighSymbol based on the id of the underlying Ghidra Symbol.
-
Constructor Details
-
GlobalSymbolMap
Construct a global symbol map attached to a particular function model.- Parameters:
f
- is the decompiler function model
-
-
Method Details
-
populateSymbol
Create a HighSymbol based on the id of the underlying Ghidra Symbol. The Symbol is looked up in the SymbolTable and then a HighSymbol is created with the name and dataType associated with the Symbol. If a Symbol cannot be found, null is returned.- Parameters:
id
- is the database id of the CodeSymboldataType
- is the recovered data-type of the symbolsz
- is the size in bytes of the desired symbol- Returns:
- the CodeSymbol wrapped as a HighSymbol or null
-
populateAnnotation
Some Varnode annotations refer to global symbols. Check if there is symbol at the Varnode address and, if there is, create a corresponding HighSymbol- Parameters:
vn
- is the annotation Varnode
-
newSymbol
Create a HighSymbol corresponding to an underlying Data object. The name of the symbol is generated dynamically. A symbol is always returned unless the address is invalid, in which case null is returned.- Parameters:
id
- is the id to associate with the new symboladdr
- is the address of the Data objectdataType
- is the recovered data-type of the symbolsz
- is the size in bytes of the symbol- Returns:
- the new HighSymbol or null
-
getSymbol
Retrieve a HighSymbol based on an id- Parameters:
id
- is the id- Returns:
- the matching HighSymbol or null
-
getSymbol
Retrieve a HighSymbol based on an Address- Parameters:
addr
- is the given Address- Returns:
- the matching HighSymbol or null
-
getSymbols
Get an iterator over all HighSymbols in this container- Returns:
- the iterator
-