decompiler
1.0.0
|
The base class for a symbol in a symbol table or scope. More...
#include <database.hh>
Public Types | |
enum | { force_hex = 1, force_dec = 2, force_oct = 3, force_bin = 4, force_char = 5, size_typelock = 8 } |
Possible display (dispflag) properties for a Symbol. More... | |
Public Member Functions | |
Symbol (Scope *sc, const string &nm, Datatype *ct) | |
Construct given a name and data-type. | |
Symbol (Scope *sc) | |
Construct for use with restoreXml() | |
const string & | getName (void) const |
Get the local name of the symbol. | |
Datatype * | getType (void) const |
Get the data-type. | |
uint4 | getId (void) const |
Get a unique id for the symbol. | |
uint4 | getFlags (void) const |
Get the boolean properties of the Symbol. | |
uint4 | getDisplayFormat (void) const |
Get the format to display the Symbol in. | |
int2 | getCategory (void) const |
Get the Symbol category. | |
uint2 | getCategoryIndex (void) const |
Get the position of the Symbol within its category. | |
bool | isTypeLocked (void) const |
Is the Symbol type-locked. | |
bool | isNameLocked (void) const |
Is the Symbol name-locked. | |
bool | isSizeTypeLocked (void) const |
Is the Symbol size type-locked. | |
bool | isIndirectStorage (void) const |
Is storage really a pointer to the true Symbol. | |
bool | isHiddenReturn (void) const |
Is this a reference to the function return value. | |
bool | isNameUndefined (void) const |
Does this have an undefined name. More... | |
Scope * | getScope (void) const |
Get the scope owning this Symbol. | |
SymbolEntry * | getFirstWholeMap (void) const |
Get the first entire mapping of the symbol. More... | |
SymbolEntry * | getMapEntry (const Address &addr) const |
Get first mapping of the symbol that contains the given Address. More... | |
void | saveXmlHeader (ostream &s) const |
Save basic Symbol properties as XML attributes. More... | |
void | restoreXmlHeader (const Element *el) |
Restore basic Symbol properties from XML. More... | |
void | saveXmlBody (ostream &s) const |
Save details of the Symbol to XML. More... | |
void | restoreXmlBody (List::const_iterator iter) |
Restore details of the Symbol from XML. More... | |
virtual void | saveXml (ostream &s) const |
Save this Symbol to an XML stream. More... | |
virtual void | restoreXml (const Element *el) |
Restore this Symbol from an XML stream. More... | |
Protected Member Functions | |
virtual | ~Symbol (void) |
Destructor. | |
void | setDisplayFormat (uint4 val) |
Set the display format for this Symbol. More... | |
void | checkSizeTypeLock (void) |
Calculate if size_typelock property is on. More... | |
Protected Attributes | |
Scope * | scope |
The scope that owns this symbol. | |
string | name |
The local name of the symbol. | |
uint4 | nameDedup |
id to distinguish symbols with the same name | |
Datatype * | type |
The symbol's data-type. | |
uint4 | flags |
Varnode-like properties of the symbol. | |
uint4 | dispflags |
Flags affecting the display of this symbol. | |
int2 | category |
Special category (-1==none 0=parameter 1=equate) | |
uint2 | catindex |
Index within category. | |
vector< list< SymbolEntry >::iterator > | mapentry |
List of storage locations labeled with this Symbol. | |
Friends | |
class | Scope |
class | ScopeInternal |
class | SymbolCompareName |
The base class for a symbol in a symbol table or scope.
At its most basic, a Symbol is a name and a data-type. Practically a Symbol knows what Scope its in, how it should be displayed, and the symbols category. A category is a subset of symbols that are stored together for quick access. The category field can be:
anonymous enum |
Possible display (dispflag) properties for a Symbol.
|
protected |
Calculate if size_typelock property is on.
Examine the data-type to decide if the Symbol has the special property called size_typelock, which indicates the size of the Symbol is locked, but the data-type is not locked (and can float)
References dispflags, Datatype::getMetatype(), isTypeLocked(), size_typelock, type, and TYPE_UNKNOWN.
Referenced by EquateSymbol::restoreXml(), restoreXmlBody(), and ScopeInternal::retypeSymbol().
SymbolEntry * Symbol::getFirstWholeMap | ( | void | ) | const |
Get the first entire mapping of the symbol.
References mapentry, and name.
Referenced by ScopeGhidra::dump2Cache(), Funcdata::findHigh(), ParameterSymbol::getAddress(), FunctionSymbol::getFunction(), ParameterSymbol::getSize(), PrintC::pushPartialSymbol(), PrintC::pushSymbol(), ScopeGhidra::resolveExternalRefFunction(), ScopeInternal::restoreXml(), and ProtoStoreSymbol::setInput().
SymbolEntry * Symbol::getMapEntry | ( | const Address & | addr | ) | const |
Get first mapping of the symbol that contains the given Address.
This method may return a partial entry, where the SymbolEntry is only holding part of the whole Symbol.
addr | is an address within the desired storage location of the Symbol |
References SymbolEntry::getAddr(), Address::getOffset(), SymbolEntry::getSize(), Address::getSpace(), and mapentry.
Referenced by ScopeGhidra::findAddr(), and ScopeGhidra::findContainer().
bool Symbol::isNameUndefined | ( | void | ) | const |
Does this have an undefined name.
The name for a Symbol can be unspecified. See ScopeInternal::buildUndefinedName
References name.
Referenced by ActionNameVars::apply(), ActionDynamicSymbols::apply(), ScopeInternal::clearUnlocked(), ScopeInternal::clearUnlockedCategory(), PrintC::emitScopeVarDecls(), ParameterSymbol::isNameUndefined(), ActionNameVars::lookForFuncParamNames(), and ParameterSymbol::setTypeLock().
|
virtual |
Restore this Symbol from an XML stream.
el | is the root XML tag of the symbol |
Reimplemented in ExternRefSymbol, LabSymbol, EquateSymbol, and FunctionSymbol.
References restoreXmlBody(), and restoreXmlHeader().
Referenced by Scope::addMapSym().
void Symbol::restoreXmlBody | ( | List::const_iterator | iter | ) |
Restore details of the Symbol from XML.
iter | iterates over XML children of the root <symbol> tag |
References checkSizeTypeLock(), Scope::getArch(), TypeFactory::restoreXmlType(), scope, type, and Architecture::types.
Referenced by restoreXml().
void Symbol::restoreXmlHeader | ( | const Element * | el | ) |
Restore basic Symbol properties from XML.
el | is the XML <symbol> element |
References category, catindex, dispflags, flags, force_bin, force_char, force_dec, force_hex, force_oct, Varnode::hiddenretparm, Varnode::indirectstorage, name, Varnode::namelock, Varnode::readonly, Varnode::typelock, and Varnode::volatil.
Referenced by restoreXml(), EquateSymbol::restoreXml(), and LabSymbol::restoreXml().
|
virtual |
Save this Symbol to an XML stream.
s | is the output stream |
Reimplemented in ExternRefSymbol, LabSymbol, EquateSymbol, and FunctionSymbol.
References saveXmlBody(), and saveXmlHeader().
Referenced by ScopeInternal::saveXml().
void Symbol::saveXmlBody | ( | ostream & | s | ) | const |
Save details of the Symbol to XML.
Save the data-type for the Symbol
s | is the output stream |
References Datatype::saveXmlRef(), and type.
Referenced by saveXml().
void Symbol::saveXmlHeader | ( | ostream & | s | ) | const |
Save basic Symbol properties as XML attributes.
s | is the output stream |
References category, catindex, flags, force_bin, force_char, force_dec, force_hex, force_oct, getDisplayFormat(), getId(), Varnode::hiddenretparm, Varnode::indirectstorage, name, Varnode::namelock, Varnode::readonly, Varnode::typelock, and Varnode::volatil.
Referenced by saveXml(), EquateSymbol::saveXml(), and LabSymbol::saveXml().
|
inlineprotected |
Set the display format for this Symbol.
Force a specific display format for constant symbols
val | is the format: force_hex, force_dec, force_oct, etc. |
References dispflags.
Referenced by ScopeInternal::setDisplayFormat().