Package ghidra.program.model.pcode
Class LocalSymbolMap
- java.lang.Object
-
- ghidra.program.model.pcode.LocalSymbolMap
-
public class LocalSymbolMap extends java.lang.ObjectLocal variables visible to a function. This includes mapped (on the stack) and unmapped (only stored in a register).
-
-
Constructor Summary
Constructors Constructor Description LocalSymbolMap(HighFunction highFunc, java.lang.String spcname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringbuildLocalDbXML()booleancontainsVariableWithName(java.lang.String name)HighSymbolfindLocal(Address addr, Address pc)Find any local variable (including input params) by addressHighSymbolfindLocal(VariableStorage store, Address pc)Find any local variable (including input params) by addressHighFunctiongetHighFunction()intgetNumParams()HighParamgetParam(int i)MappedSymbolgetParamSymbol(int i)HighSymbolgetSymbol(int id)Lookup high variable based upon its symbol-idjava.util.Iterator<HighSymbol>getSymbols()Get all the symbols mapped for this program, Param, Locals.voidgrabFromFunction(boolean includeDefaultNames)Populate the local variable map from information attached to the Program DB's function.DynamicSymbolnewDynamicSymbol(java.lang.String nm, DataType dt, int sz, long hash, Address pcaddr, int format, int id)MappedSymbolnewMappedSymbol(java.lang.String nm, DataType dt, VariableStorage store, Address pcaddr, int slot, int id)voidparseScopeXML(XmlPullParser parser)Parse a local symbol scope in XML from the <localdb> tag.voidparseSymbolList(XmlPullParser parser)Add mapped symbols to this LocalVariableMap, by parsing the <symbollist> and <mapsym> tags.
-
-
-
Constructor Detail
-
LocalSymbolMap
public LocalSymbolMap(HighFunction highFunc, java.lang.String spcname)
- Parameters:
highFunc- HighFunction the local variables are defined within.spcname- space name the local variables are defined within.
-
-
Method Detail
-
getHighFunction
public HighFunction getHighFunction()
-
grabFromFunction
public void grabFromFunction(boolean includeDefaultNames)
Populate the local variable map from information attached to the Program DB's function.- Parameters:
includeDefaultNames- is true if default symbol names should be considered locked
-
parseScopeXML
public void parseScopeXML(XmlPullParser parser) throws PcodeXMLException
Parse a local symbol scope in XML from the <localdb> tag.- Parameters:
parser- is the XML parser- Throws:
PcodeXMLException- for problems parsing individual tags
-
parseSymbolList
public void parseSymbolList(XmlPullParser parser) throws PcodeXMLException
Add mapped symbols to this LocalVariableMap, by parsing the <symbollist> and <mapsym> tags.- Parameters:
parser- is the XML parser- Throws:
PcodeXMLException- for problems parsing a tag
-
buildLocalDbXML
public java.lang.String buildLocalDbXML()
- Returns:
- an XML document string representing this local variable map.
-
getSymbols
public java.util.Iterator<HighSymbol> getSymbols()
Get all the symbols mapped for this program, Param, Locals. The HighSymbol can either be a HighParam, or HighLocal- Returns:
- an iterator over all mapped symbols.
-
findLocal
public HighSymbol findLocal(VariableStorage store, Address pc)
Find any local variable (including input params) by address- Parameters:
store- - variable storagepc- = Address of first use, or null if address is valid throughout the entire scope- Returns:
- HighLocal or null
-
findLocal
public HighSymbol findLocal(Address addr, Address pc)
Find any local variable (including input params) by address- Parameters:
addr- - variable storage addresspc- = Address of first use, or null if address is valid throughout the entire scope- Returns:
- HighLocal or null
-
getSymbol
public HighSymbol getSymbol(int id)
Lookup high variable based upon its symbol-id- Parameters:
id- symbol-id- Returns:
- variable or null if not found
-
getNumParams
public int getNumParams()
-
getParamSymbol
public MappedSymbol getParamSymbol(int i)
-
getParam
public HighParam getParam(int i)
-
containsVariableWithName
public boolean containsVariableWithName(java.lang.String name)
-
newMappedSymbol
public MappedSymbol newMappedSymbol(java.lang.String nm, DataType dt, VariableStorage store, Address pcaddr, int slot, int id)
-
newDynamicSymbol
public DynamicSymbol newDynamicSymbol(java.lang.String nm, DataType dt, int sz, long hash, Address pcaddr, int format, int id)
-
-