Package ghidra.program.model.pcode
Class GlobalSymbolMap
- java.lang.Object
-
- ghidra.program.model.pcode.GlobalSymbolMap
-
public class GlobalSymbolMap extends java.lang.Object
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
Constructors Constructor Description GlobalSymbolMap(HighFunction f)
Construct a global symbol map attached to a particular function model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HighSymbol
getSymbol(long id)
Retrieve a HighSymbol based on an idHighSymbol
getSymbol(Address addr)
Retrieve a HighSymbol based on an Addressjava.util.Iterator<HighSymbol>
getSymbols()
Get an iterator over all HighSymbols in this containerHighCodeSymbol
newSymbol(long id, Address addr, DataType dataType, int sz)
Create a HighSymbol corresponding to an underlying Data object.HighSymbol
populateSymbol(long id, DataType dataType, int sz)
Create a HighSymbol based on the id of the underlying Ghidra Symbol.
-
-
-
Constructor Detail
-
GlobalSymbolMap
public GlobalSymbolMap(HighFunction f)
Construct a global symbol map attached to a particular function model.- Parameters:
f
- is the decompiler function model
-
-
Method Detail
-
populateSymbol
public HighSymbol populateSymbol(long id, DataType dataType, int sz)
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
-
newSymbol
public HighCodeSymbol newSymbol(long id, Address addr, DataType dataType, int sz)
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
public HighSymbol getSymbol(long id)
Retrieve a HighSymbol based on an id- Parameters:
id
- is the id- Returns:
- the matching HighSymbol or null
-
getSymbol
public HighSymbol getSymbol(Address addr)
Retrieve a HighSymbol based on an Address- Parameters:
addr
- is the given Address- Returns:
- the matching HighSymbol or null
-
getSymbols
public java.util.Iterator<HighSymbol> getSymbols()
Get an iterator over all HighSymbols in this container- Returns:
- the iterator
-
-