|
Ghidra 11.4.2
Ghidra internal decompiler documentation.
|
An in-memory implementation of the Scope interface. More...
#include <database.hh>
Public Member Functions | |
| ScopeInternal (uint8 id, const string &nm, Architecture *g) | |
| Construct the Scope. | |
| ScopeInternal (uint8 id, const string &nm, Architecture *g, Scope *own) | |
| Construct as a cache. | |
| virtual void | clear (void) |
| Clear all symbols from this scope. | |
| virtual void | categorySanity (void) |
| Make sure Symbol categories are sane. | |
| virtual void | clearCategory (int4 cat) |
| Clear all symbols of the given category from this scope. | |
| virtual void | clearUnlocked (void) |
| Clear all unlocked symbols from this scope. | |
| virtual void | clearUnlockedCategory (int4 cat) |
| Clear unlocked symbols of the given category from this scope. | |
| virtual void | adjustCaches (void) |
| Let scopes internally adjust any caches. | |
| virtual MapIterator | begin (void) const |
| Beginning iterator to mapped SymbolEntrys. | |
| virtual MapIterator | end (void) const |
| Ending iterator to mapped SymbolEntrys. | |
| virtual list< SymbolEntry >::const_iterator | beginDynamic (void) const |
| Beginning iterator to dynamic SymbolEntrys. | |
| virtual list< SymbolEntry >::const_iterator | endDynamic (void) const |
| Ending iterator to dynamic SymbolEntrys. | |
| virtual list< SymbolEntry >::iterator | beginDynamic (void) |
| Beginning iterator to dynamic SymbolEntrys. | |
| virtual list< SymbolEntry >::iterator | endDynamic (void) |
| Ending iterator to dynamic SymbolEntrys. | |
| virtual void | removeSymbolMappings (Symbol *symbol) |
| Remove all SymbolEntrys from the given Symbol. | |
| virtual void | removeSymbol (Symbol *symbol) |
| Remove the given Symbol from this Scope. | |
| virtual void | renameSymbol (Symbol *sym, const string &newname) |
| Rename a Symbol within this Scope. | |
| virtual void | retypeSymbol (Symbol *sym, Datatype *ct) |
| Change the data-type of a Symbol within this Scope. | |
| virtual void | setAttribute (Symbol *sym, uint4 attr) |
| Set boolean Varnode properties on a Symbol. | |
| virtual void | clearAttribute (Symbol *sym, uint4 attr) |
| Clear boolean Varnode properties on a Symbol. | |
| virtual void | setDisplayFormat (Symbol *sym, uint4 attr) |
| Set the display format for a Symbol. | |
| virtual SymbolEntry * | findAddr (const Address &addr, const Address &usepoint) const |
| Find a Symbol at a given address and usepoint. | |
| virtual SymbolEntry * | findContainer (const Address &addr, int4 size, const Address &usepoint) const |
| Find the smallest Symbol containing the given memory range. | |
| virtual SymbolEntry * | findClosestFit (const Address &addr, int4 size, const Address &usepoint) const |
| Find Symbol which is the closest fit to the given memory range. | |
| virtual Funcdata * | findFunction (const Address &addr) const |
| Find the function starting at the given address. | |
| virtual ExternRefSymbol * | findExternalRef (const Address &addr) const |
| Find an external reference at the given address. | |
| virtual LabSymbol * | findCodeLabel (const Address &addr) const |
| Find a label Symbol at the given address. | |
| virtual SymbolEntry * | findOverlap (const Address &addr, int4 size) const |
| Find first Symbol overlapping the given memory range. | |
| virtual void | findByName (const string &nm, vector< Symbol * > &res) const |
| Find a Symbol by name within this Scope. | |
| virtual bool | isNameUsed (const string &nm, const Scope *op2) const |
| Check if the given name is occurs within the given scope path. | |
| virtual Funcdata * | resolveExternalRefFunction (ExternRefSymbol *sym) const |
| Convert an external reference to the referenced function. | |
| virtual string | buildVariableName (const Address &addr, const Address &pc, Datatype *ct, int4 &index, uint4 flags) const |
| Given an address and data-type, build a suitable generic symbol name. | |
| virtual string | buildUndefinedName (void) const |
| Build a formal undefined name, used internally when a Symbol is not given a name. | |
| virtual string | makeNameUnique (const string &nm) const |
| Produce a version of the given symbol name that won't collide with other names in this Scope. | |
| virtual void | encode (Encoder &encoder) const |
| Encode this as a <scope> element. | |
| virtual void | decode (Decoder &decoder) |
| Decode this Scope from a <scope> element. | |
| virtual void | printEntries (ostream &s) const |
| Dump a description of all SymbolEntry objects to a stream. | |
| virtual int4 | getCategorySize (int4 cat) const |
| Get the number of Symbols in the given category. | |
| virtual Symbol * | getCategorySymbol (int4 cat, int4 ind) const |
| Retrieve a Symbol by index within a specific category. | |
| virtual void | setCategory (Symbol *sym, int4 cat, int4 ind) |
| Set the category and index for the given Symbol. | |
| void | assignDefaultNames (int4 &base) |
| Assign a default name (via buildVariableName) to any unnamed symbol. | |
| set< Symbol * >::const_iterator | beginMultiEntry (void) const |
| Start of symbols with more than one entry. | |
| set< Symbol * >::const_iterator | endMultiEntry (void) const |
| End of symbols with more than one entry. | |
Public Member Functions inherited from ghidra::Scope | |
| Scope (uint8 id, const string &nm, Architecture *g, Scope *own) | |
| Construct an empty scope, given a name and Architecture. | |
| virtual | ~Scope (void) |
| Destructor. | |
| virtual bool | inScope (const Address &addr, int4 size, const Address &usepoint) const |
| Query if the given range is owned by this Scope. | |
| virtual void | decodeWrappingAttributes (Decoder &decoder) |
| Restore attributes for this from a parent element that is not a Scope. | |
| virtual SymbolEntry * | addSymbol (const string &nm, Datatype *ct, const Address &addr, const Address &usepoint) |
| Add a new Symbol to this Scope, given a name, data-type, and a single mapping. | |
| const string & | getName (void) const |
| Get the name of the Scope. | |
| const string & | getDisplayName (void) const |
| Get name displayed in output. | |
| uint8 | getId (void) const |
| Get the globally unique id. | |
| bool | isGlobal (void) const |
| Return true if this scope is global. | |
| void | queryByName (const string &nm, vector< Symbol * > &res) const |
| Look-up symbols by name. | |
| Funcdata * | queryFunction (const string &nm) const |
| Look-up a function by name. | |
| SymbolEntry * | queryByAddr (const Address &addr, const Address &usepoint) const |
| Get Symbol with matching address. | |
| SymbolEntry * | queryContainer (const Address &addr, int4 size, const Address &usepoint) const |
| Find the smallest containing Symbol. | |
| SymbolEntry * | queryProperties (const Address &addr, int4 size, const Address &usepoint, uint4 &flags) const |
| Find a Symbol or properties at the given address. | |
| Funcdata * | queryFunction (const Address &addr) const |
| Look-up a function by address. | |
| Funcdata * | queryExternalRefFunction (const Address &addr) const |
| Look-up a function thru an external reference. | |
| LabSymbol * | queryCodeLabel (const Address &addr) const |
| Look-up a code label by address. | |
| Scope * | resolveScope (const string &nm, bool strategy) const |
| Find a child Scope of this. | |
| Scope * | discoverScope (const Address &addr, int4 sz, const Address &usepoint) |
| Find the owning Scope of a given memory range. | |
| ScopeMap::const_iterator | childrenBegin () const |
| Beginning iterator of child scopes. | |
| ScopeMap::const_iterator | childrenEnd () const |
| Ending iterator of child scopes. | |
| void | encodeRecursive (Encoder &encoder, bool onlyGlobal) const |
| Encode all contained scopes to a stream. | |
| void | overrideSizeLockType (Symbol *sym, Datatype *ct) |
| Change the data-type of a Symbol that is sizelocked. | |
| void | resetSizeLockType (Symbol *sym) |
| Clear a Symbol's size-locked data-type. | |
| void | setThisPointer (Symbol *sym, bool val) |
| Toggle the given Symbol as the "this" pointer. | |
| bool | isSubScope (const Scope *scp) const |
| Is this a sub-scope of the given Scope. | |
| string | getFullName (void) const |
| Get the full name of this Scope. | |
| void | getScopePath (vector< const Scope * > &vec) const |
| Get the ordered list of scopes up to this. | |
| const Scope * | findDistinguishingScope (const Scope *op2) const |
| Find first ancestor of this not shared by given scope. | |
| Architecture * | getArch (void) const |
| Get the Architecture associated with this. | |
| Scope * | getParent (void) const |
| Get the parent Scope (or NULL if this is the global Scope) | |
| Symbol * | addSymbol (const string &nm, Datatype *ct) |
| Add a new Symbol without mapping it to an address. | |
| SymbolEntry * | addMapPoint (Symbol *sym, const Address &addr, const Address &usepoint) |
| Map a Symbol to a specific address. | |
| Symbol * | addMapSym (Decoder &decoder) |
| Parse a mapped Symbol from a <mapsym> element. | |
| FunctionSymbol * | addFunction (const Address &addr, const string &nm) |
| Create a function Symbol at the given address in this Scope. | |
| ExternRefSymbol * | addExternalRef (const Address &addr, const Address &refaddr, const string &nm) |
| LabSymbol * | addCodeLabel (const Address &addr, const string &nm) |
| Create a code label at the given address in this Scope. | |
| Symbol * | addDynamicSymbol (const string &nm, Datatype *ct, const Address &caddr, uint8 hash) |
| Create a dynamically mapped Symbol attached to a specific data-flow. | |
| Symbol * | addEquateSymbol (const string &nm, uint4 format, uintb value, const Address &addr, uint8 hash) |
| Create a symbol that forces display conversion on a constant. | |
| Symbol * | addUnionFacetSymbol (const string &nm, Datatype *dt, int4 fieldNum, const Address &addr, uint8 hash) |
| Create a symbol forcing a field interpretation for a specific access to a variable with union data-type. | |
| string | buildDefaultName (Symbol *sym, int4 &base, Varnode *vn) const |
| Create a default name for the given Symbol. | |
| bool | isReadOnly (const Address &addr, int4 size, const Address &usepoint) const |
| Is the given memory range marked as read-only. | |
| void | printBounds (ostream &s) const |
| Print a description of this Scope's owned memory ranges. | |
Protected Member Functions | |
| virtual Scope * | buildSubScope (uint8 id, const string &nm) |
| Build an unattached Scope to be associated as a sub-scope of this. | |
| virtual void | addSymbolInternal (Symbol *sym) |
| Put a Symbol into the name map. | |
| virtual SymbolEntry * | addMapInternal (Symbol *sym, uint4 exfl, const Address &addr, int4 off, int4 sz, const RangeList &uselim) |
| Create a new SymbolEntry for a Symbol given a memory range. | |
| virtual SymbolEntry * | addDynamicMapInternal (Symbol *sym, uint4 exfl, uint8 hash, int4 off, int4 sz, const RangeList &uselim) |
| Create a new SymbolEntry for a Symbol given a dynamic hash. | |
Protected Member Functions inherited from ghidra::Scope | |
| const RangeList & | getRangeTree (void) const |
| Access the address ranges owned by this Scope. | |
| virtual void | restrictScope (Funcdata *f) |
| Convert this to a local Scope. | |
| virtual void | addRange (AddrSpace *spc, uintb first, uintb last) |
| Add a memory range to the ownership of this Scope. | |
| virtual void | removeRange (AddrSpace *spc, uintb first, uintb last) |
| Remove a memory range from the ownership of this Scope. | |
| SymbolEntry * | addMap (SymbolEntry &entry) |
| Integrate a SymbolEntry into the range maps. | |
| void | setSymbolId (Symbol *sym, uint8 id) const |
| Adjust the id associated with a symbol. | |
| void | setDisplayName (const string &nm) |
| Change name displayed in output. | |
Protected Attributes | |
| SymbolNameTree | nametree |
| The set of Symbol objects, sorted by name. | |
| vector< EntryMap * > | maptable |
| Rangemaps of SymbolEntry, one map for each address space. | |
| vector< vector< Symbol * > > | category |
| References to Symbol objects organized by category. | |
| list< SymbolEntry > | dynamicentry |
| Dynamic symbol entries. | |
| SymbolNameTree | multiEntrySet |
| Set of symbols with multiple entries. | |
| uint8 | nextUniqueId |
| Next available symbol id. | |
Protected Attributes inherited from ghidra::Scope | |
| Architecture * | glb |
| Architecture of this scope. | |
| string | name |
| Name of this scope. | |
| string | displayName |
| Name to display in output. | |
| Funcdata * | fd |
| (If non-null) the function which this is the local Scope for | |
| uint8 | uniqueId |
| Unique id for the scope, for deduping scope names, assigning symbol ids. | |
Private Member Functions | |
| void | decodeHole (Decoder &decoder) |
| Parse a <hole> element describing boolean properties of a memory range. | |
| void | decodeCollision (Decoder &decoder) |
| Parse a <collision> element indicating a named symbol with no storage or data-type info. | |
| void | insertNameTree (Symbol *sym) |
| Insert a Symbol into the nametree. | |
| SymbolNameTree::const_iterator | findFirstByName (const string &nm) const |
| Find an iterator pointing to the first Symbol in the ordering with a given name. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from ghidra::Scope | |
| static const Scope * | stackAddr (const Scope *scope1, const Scope *scope2, const Address &addr, const Address &usepoint, SymbolEntry **addrmatch) |
| Query for Symbols starting at a given address, which match a given usepoint. | |
| static const Scope * | stackContainer (const Scope *scope1, const Scope *scope2, const Address &addr, int4 size, const Address &usepoint, SymbolEntry **addrmatch) |
| static const Scope * | stackClosestFit (const Scope *scope1, const Scope *scope2, const Address &addr, int4 size, const Address &usepoint, SymbolEntry **addrmatch) |
| static const Scope * | stackFunction (const Scope *scope1, const Scope *scope2, const Address &addr, Funcdata **addrmatch) |
| static const Scope * | stackExternalRef (const Scope *scope1, const Scope *scope2, const Address &addr, ExternRefSymbol **addrmatch) |
| static const Scope * | stackCodeLabel (const Scope *scope1, const Scope *scope2, const Address &addr, LabSymbol **addrmatch) |
An in-memory implementation of the Scope interface.
This can act as a stand-alone Scope object or serve as an in-memory cache for another implementation. This implements a nametree, which is a a set of Symbol objects (the set owns the Symbol objects). It also implements a maptable, which is a list of rangemaps that own the SymbolEntry objects.
| ghidra::ScopeInternal::ScopeInternal | ( | uint8 | id, |
| const string & | nm, | ||
| Architecture * | g | ||
| ) |
Construct the Scope.
| id | is the globally unique id associated with the scope |
| nm | is the name of the Scope |
| g | is the Architecture it belongs to |
References maptable, nextUniqueId, and ghidra::AddrSpaceManager::numSpaces().
|
protectedvirtual |
Create a new SymbolEntry for a Symbol given a dynamic hash.
The SymbolEntry is specified in terms of a hash and usepoint, which describe how to find the temporary Varnode holding the symbol value.
| sym | is the given Symbol being mapped |
| exfl | are any boolean Varnode properties |
| hash | is the given dynamic hash |
| off | is the byte offset of the new SymbolEntry (relative to the whole Symbol) |
| sz | is the number of bytes occupied by the Varnode |
| uselim | is the given usepoint |
Implements ghidra::Scope.
References dynamicentry, ghidra::Datatype::getSize(), ghidra::Symbol::mapentry, multiEntrySet, ghidra::Symbol::type, and ghidra::Symbol::wholeCount.
Referenced by ghidra::ScopeLocal::remapSymbolDynamic().
|
protectedvirtual |
Create a new SymbolEntry for a Symbol given a memory range.
The SymbolEntry is specified in terms of a memory range and usepoint
| sym | is the given Symbol being mapped |
| exfl | are any boolean Varnode properties specific to the memory range |
| addr | is the starting address of the given memory range |
| off | is the byte offset of the new SymbolEntry (relative to the whole Symbol) |
| sz | is the number of bytes in the range |
| uselim | is the given usepoint (which may be invalid) |
Implements ghidra::Scope.
Reimplemented in ghidra::ScopeGhidraNamespace.
References ghidra::AddrSpace::getIndex(), ghidra::Symbol::getName(), ghidra::Address::getOffset(), ghidra::Datatype::getSize(), ghidra::Address::getSpace(), ghidra::rangemap< _recordtype >::insert(), ghidra::Symbol::mapentry, maptable, multiEntrySet, ghidra::Symbol::type, and ghidra::Symbol::wholeCount.
Referenced by ghidra::ScopeGhidraNamespace::addMapInternal(), and ghidra::ScopeLocal::remapSymbol().
|
protectedvirtual |
Put a Symbol into the name map.
| sym | is the preconstructed Symbol |
Implements ghidra::Scope.
References buildUndefinedName(), ghidra::Symbol::category, category, ghidra::Symbol::catindex, ghidra::Symbol::displayName, ghidra::Symbol::getName(), ghidra::Datatype::getSize(), ghidra::Symbol::getType(), ghidra::Symbol::ID_BASE, insertNameTree(), ghidra::Symbol::name, nextUniqueId, ghidra::Symbol::symbolId, and ghidra::Scope::uniqueId.
|
virtual |
Let scopes internally adjust any caches.
This is called once after Architecture configuration is complete.
Implements ghidra::Scope.
References ghidra::Scope::glb, maptable, and ghidra::AddrSpaceManager::numSpaces().
Referenced by ghidra::ScopeGhidra::adjustCaches().
| void ghidra::ScopeInternal::assignDefaultNames | ( | int4 & | base | ) |
Assign a default name (via buildVariableName) to any unnamed symbol.
Run through all the symbols whose name is undefined. Build a variable name, uniquify it, and rename the variable.
| base | is the base index to start at for generating generic names |
References ghidra::Scope::buildDefaultName(), ghidra::Symbol::isNameUndefined(), nametree, and renameSymbol().
Referenced by ghidra::ActionNameVars::apply().
|
virtual |
|
virtual |
|
virtual |
Beginning iterator to dynamic SymbolEntrys.
Implements ghidra::Scope.
References dynamicentry.
Referenced by ghidra::ActionDynamicMapping::apply(), and ghidra::ActionDynamicSymbols::apply().
|
protectedvirtual |
Build an unattached Scope to be associated as a sub-scope of this.
Implements ghidra::Scope.
References ghidra::Scope::glb.
|
virtual |
Build a formal undefined name, used internally when a Symbol is not given a name.
Implements ghidra::Scope.
References nametree.
Referenced by addSymbolInternal(), ghidra::ScopeGhidra::buildUndefinedName(), clearUnlocked(), and clearUnlockedCategory().
|
virtual |
Given an address and data-type, build a suitable generic symbol name.
| addr | is the given address |
| pc | is the address at which the name is getting used |
| ct | is a data-type used to inform the name |
| index | is a reference to an index used to make the name unique, which will be updated |
| flags | are boolean properties of the variable we need the name for |
Implements ghidra::Scope.
Reimplemented in ghidra::ScopeLocal.
References ghidra::Varnode::addrtied, ghidra::AddrSpace::byteToAddress(), findFirstByName(), ghidra::Address::getAddrSize(), ghidra::AddrSpace::getName(), ghidra::Address::getOffset(), ghidra::Translate::getRegisterName(), ghidra::Datatype::getSize(), ghidra::Address::getSpace(), ghidra::AddrSpace::getWordSize(), ghidra::Scope::glb, ghidra::Varnode::indirect_creation, ghidra::Varnode::input, makeNameUnique(), nametree, ghidra::Varnode::persist, ghidra::Datatype::printNameBase(), ghidra::Varnode::return_address, ghidra::Architecture::translate, and ghidra::Varnode::unaffected.
Referenced by ghidra::ScopeLocal::buildVariableName(), and ghidra::ScopeGhidra::buildVariableName().
|
virtual |
Make sure Symbol categories are sane.
Look for NULL entries in the category tables. If there are, clear out the entire category, marking all symbols as uncategorized
References category, ghidra::Symbol::no_category, and setCategory().
Referenced by decode().
|
virtual |
Clear all symbols from this scope.
Implements ghidra::Scope.
References ghidra::Scope::begin(), nametree, nextUniqueId, and removeSymbol().
Referenced by ghidra::ScopeGhidra::clear().
|
virtual |
Clear boolean Varnode properties on a Symbol.
Implements ghidra::Scope.
References ghidra::Symbol::checkSizeTypeLock(), ghidra::Symbol::flags, ghidra::Varnode::hiddenretparm, ghidra::Varnode::incidental_copy, ghidra::Varnode::indirectstorage, ghidra::Varnode::namelock, ghidra::Varnode::nolocalalias, ghidra::Varnode::readonly, ghidra::Varnode::typelock, and ghidra::Varnode::volatil.
Referenced by ghidra::ScopeGhidra::clearAttribute(), and clearUnlocked().
|
virtual |
Clear all symbols of the given category from this scope.
Implements ghidra::Scope.
References category, ghidra::Symbol::getCategory(), nametree, and removeSymbol().
Referenced by ghidra::ActionInputPrototype::apply(), and ghidra::ScopeLocal::restructureVarnode().
|
virtual |
Clear all unlocked symbols from this scope.
Implements ghidra::Scope.
References buildUndefinedName(), clearAttribute(), ghidra::Symbol::equate, ghidra::Symbol::getCategory(), ghidra::Symbol::isNameLocked(), ghidra::Symbol::isNameUndefined(), ghidra::Symbol::isSizeTypeLocked(), ghidra::Symbol::isTypeLocked(), nametree, ghidra::Varnode::nolocalalias, removeSymbol(), renameSymbol(), and ghidra::Scope::resetSizeLockType().
Referenced by ghidra::Funcdata::clear(), and ghidra::Funcdata::startProcessing().
|
virtual |
Clear unlocked symbols of the given category from this scope.
Implements ghidra::Scope.
References buildUndefinedName(), category, ghidra::Symbol::getCategory(), ghidra::Symbol::isNameLocked(), ghidra::Symbol::isNameUndefined(), ghidra::Symbol::isSizeTypeLocked(), ghidra::Symbol::isTypeLocked(), nametree, removeSymbol(), renameSymbol(), and ghidra::Scope::resetSizeLockType().
Referenced by ghidra::ScopeLocal::restructureVarnode().
|
virtual |
Decode this Scope from a <scope> element.
Implements ghidra::Scope.
Reimplemented in ghidra::ScopeLocal.
References ghidra::Scope::addMapSym(), ghidra::Database::addRange(), categorySanity(), ghidra::Decoder::closeElement(), ghidra::RangeList::decode(), decodeCollision(), decodeHole(), ghidra::SymbolEntry::getAddr(), ghidra::SymbolEntry::getFirst(), ghidra::Symbol::getFirstWholeMap(), ghidra::SymbolEntry::getLast(), ghidra::Address::getSpace(), ghidra::Scope::glb, ghidra::Decoder::openElement(), ghidra::Decoder::peekElement(), ghidra::Database::setRange(), ghidra::Decoder::skipElement(), and ghidra::Architecture::symboltab.
Referenced by ghidra::ScopeLocal::decode().
|
private |
Parse a <collision> element indicating a named symbol with no storage or data-type info.
Let the decompiler know that a name is occupied within the scope for isNameUsed queries, without specifying storage and data-type information about the symbol. This is modeled currently by creating an unmapped symbol.
| decoder | is the stream decoder |
References ghidra::Scope::addSymbol(), ghidra::Decoder::closeElement(), findFirstByName(), ghidra::TypeFactory::getBase(), ghidra::Scope::glb, nametree, ghidra::Decoder::openElement(), ghidra::Decoder::readString(), ghidra::TYPE_INT, and ghidra::Architecture::types.
Referenced by decode().
|
private |
Parse a <hole> element describing boolean properties of a memory range.
The <scope> element is allowed to contain <hole> elements, which are really descriptions of memory globally. This method parses them and passes the info to the Database object.
| decoder | is the stream decoder |
References ghidra::Decoder::closeElement(), ghidra::Range::decodeFromAttributes(), ghidra::Decoder::getNextAttributeId(), ghidra::Scope::glb, ghidra::Decoder::openElement(), ghidra::Decoder::readBool(), ghidra::Varnode::readonly, ghidra::Decoder::rewindAttributes(), ghidra::Database::setPropertyRange(), ghidra::Architecture::symboltab, and ghidra::Varnode::volatil.
Referenced by decode().
|
virtual |
Encode this as a <scope> element.
Implements ghidra::Scope.
Reimplemented in ghidra::ScopeLocal.
References ghidra::Encoder::closeElement(), ghidra::RangeList::encode(), ghidra::SymbolEntry::encode(), ghidra::Symbol::encode(), ghidra::Symbol::equate, ghidra::Symbol::getCategory(), ghidra::Scope::getId(), ghidra::Scope::getParent(), ghidra::Scope::getRangeTree(), ghidra::SymbolEntry::isDynamic(), ghidra::Symbol::mapentry, ghidra::Scope::name, nametree, ghidra::Encoder::openElement(), ghidra::Symbol::union_facet, ghidra::Scope::uniqueId, ghidra::Encoder::writeString(), and ghidra::Encoder::writeUnsignedInteger().
Referenced by ghidra::ScopeLocal::encode().
|
virtual |
Ending iterator to mapped SymbolEntrys.
Implements ghidra::Scope.
References maptable.
Referenced by findContainer().
|
virtual |
|
virtual |
Ending iterator to dynamic SymbolEntrys.
Implements ghidra::Scope.
References dynamicentry.
Referenced by ghidra::ActionDynamicMapping::apply(), and ghidra::ActionDynamicSymbols::apply().
|
virtual |
Find a Symbol at a given address and usepoint.
| addr | is the given address |
| usepoint | is the point at which the Symbol is accessed (may be invalid) |
Implements ghidra::Scope.
References ghidra::rangemap< _recordtype >::find(), ghidra::SymbolEntry::getAddr(), ghidra::AddrSpace::getIndex(), ghidra::Address::getOffset(), ghidra::Address::getSpace(), ghidra::SymbolEntry::inUse(), ghidra::Address::isInvalid(), and maptable.
Referenced by ghidra::ScopeGhidra::findAddr(), and ghidra::ScopeGhidra::findCodeLabel().
|
virtual |
Find a Symbol by name within this Scope.
If there are multiple Symbols with the same name, all are passed back.
| nm | is the name to search for |
| res | will contain any matching Symbols |
Implements ghidra::Scope.
References findFirstByName(), ghidra::Symbol::name, and nametree.
|
virtual |
Find Symbol which is the closest fit to the given memory range.
| addr | is the starting address of the given memory range |
| size | is the number of bytes in the range |
| usepoint | is the point at which the Symbol is accessed (may be invalid) |
Implements ghidra::Scope.
References ghidra::rangemap< _recordtype >::find(), ghidra::AddrSpace::getIndex(), ghidra::SymbolEntry::getLast(), ghidra::Address::getOffset(), ghidra::SymbolEntry::getSize(), ghidra::Address::getSpace(), ghidra::SymbolEntry::inUse(), ghidra::Address::isInvalid(), and maptable.
Referenced by ghidra::ScopeGhidra::findContainer().
Find a label Symbol at the given address.
| addr | is the given address |
Implements ghidra::Scope.
References ghidra::rangemap< _recordtype >::find(), ghidra::SymbolEntry::getAddr(), ghidra::AddrSpace::getIndex(), ghidra::Address::getOffset(), ghidra::Address::getSpace(), ghidra::SymbolEntry::getSymbol(), ghidra::SymbolEntry::inUse(), and maptable.
Referenced by ghidra::ScopeGhidra::findCodeLabel().
|
virtual |
Find the smallest Symbol containing the given memory range.
| addr | is the starting address of the given memory range |
| size | is the number of bytes in the range |
| usepoint | is the point at which the Symbol is accessed (may be invalid) |
Implements ghidra::Scope.
References end(), ghidra::rangemap< _recordtype >::find(), ghidra::AddrSpace::getIndex(), ghidra::SymbolEntry::getLast(), ghidra::Address::getOffset(), ghidra::SymbolEntry::getSize(), ghidra::Address::getSpace(), ghidra::SymbolEntry::inUse(), ghidra::Address::isInvalid(), and maptable.
Referenced by ghidra::ScopeGhidra::findAddr(), ghidra::ScopeGhidra::findExternalRef(), and ghidra::ScopeGhidra::findFunction().
|
virtual |
Find an external reference at the given address.
| addr | is the given address |
Implements ghidra::Scope.
References ghidra::rangemap< _recordtype >::find(), ghidra::SymbolEntry::getAddr(), ghidra::AddrSpace::getIndex(), ghidra::Address::getOffset(), ghidra::Address::getSpace(), ghidra::SymbolEntry::getSymbol(), and maptable.
Referenced by ghidra::ScopeGhidra::findExternalRef().
|
private |
Find an iterator pointing to the first Symbol in the ordering with a given name.
| nm | is the name to search for |
References nametree.
Referenced by buildVariableName(), decodeCollision(), findByName(), and makeNameUnique().
Find the function starting at the given address.
| addr | is the given starting address |
Implements ghidra::Scope.
References ghidra::rangemap< _recordtype >::find(), ghidra::SymbolEntry::getAddr(), ghidra::FunctionSymbol::getFunction(), ghidra::AddrSpace::getIndex(), ghidra::Address::getOffset(), ghidra::Address::getSpace(), ghidra::SymbolEntry::getSymbol(), and maptable.
Referenced by ghidra::ScopeGhidra::findFunction(), and ghidra::ScopeGhidra::resolveExternalRefFunction().
|
virtual |
Find first Symbol overlapping the given memory range.
| addr | is the starting address of the given range |
| size | is the number of bytes in the range |
Implements ghidra::Scope.
References ghidra::rangemap< _recordtype >::end(), ghidra::rangemap< _recordtype >::find_overlap(), ghidra::AddrSpace::getIndex(), ghidra::Address::getOffset(), ghidra::Address::getSpace(), and maptable.
Referenced by ghidra::ScopeLocal::adjustFit(), ghidra::ScopeLocal::markNotMapped(), ghidra::ScopeLocal::recoverNameRecommendationsForSymbols(), and ghidra::Funcdata::syncVarnodesWithSymbols().
|
virtual |
Get the number of Symbols in the given category.
| cat | is the Symbol category |
Implements ghidra::Scope.
References category.
Referenced by ghidra::ScopeLocal::fakeInputSymbols().
|
virtual |
|
private |
Insert a Symbol into the nametree.
Duplicate symbol names are allowed for by establishing a deduplication id for the Symbol.
| sym | is the Symbol to insert |
References ghidra::Symbol::name, ghidra::Symbol::nameDedup, and nametree.
Referenced by addSymbolInternal(), and renameSymbol().
|
virtual |
Check if the given name is occurs within the given scope path.
Test for the presence of a symbol with the given name in either this scope or an ancestor scope up to but not including the given terminating scope. If the name is used true is returned.
| nm | is the given name to test |
| op2 | is the terminating ancestor scope (or null) |
Implements ghidra::Scope.
Reimplemented in ghidra::ScopeGhidraNamespace.
References ghidra::Scope::getParent(), ghidra::Scope::isNameUsed(), and nametree.
|
virtual |
Produce a version of the given symbol name that won't collide with other names in this Scope.
| nm | is the given name |
Implements ghidra::Scope.
References findFirstByName(), ghidra::Symbol::getName(), ghidra::Symbol::nameDedup, and nametree.
Referenced by buildVariableName(), ghidra::ScopeLocal::buildVariableName(), ghidra::ActionNameVars::lookForBadJumpTables(), ghidra::ActionNameVars::lookForFuncParamNames(), and ghidra::ScopeLocal::recoverNameRecommendationsForSymbols().
|
virtual |
Dump a description of all SymbolEntry objects to a stream.
Implements ghidra::Scope.
References ghidra::rangemap< _recordtype >::begin_list(), ghidra::rangemap< _recordtype >::end_list(), maptable, and ghidra::Scope::name.
Referenced by ghidra::ActionRestructureVarnode::apply(), and ghidra::ActionInputPrototype::apply().
|
virtual |
Remove the given Symbol from this Scope.
Implements ghidra::Scope.
References ghidra::Symbol::category, category, ghidra::Symbol::catindex, nametree, and removeSymbolMappings().
Referenced by ghidra::ScopeLocal::addRecommendName(), clear(), clearCategory(), clearUnlocked(), clearUnlockedCategory(), and ghidra::ScopeLocal::markNotMapped().
|
virtual |
Remove all SymbolEntrys from the given Symbol.
Implements ghidra::Scope.
References dynamicentry, ghidra::rangemap< _recordtype >::erase(), ghidra::AddrSpace::getIndex(), ghidra::Symbol::mapentry, maptable, multiEntrySet, and ghidra::Symbol::wholeCount.
Referenced by ghidra::ScopeLocal::remapSymbol(), ghidra::ScopeLocal::remapSymbolDynamic(), and removeSymbol().
|
virtual |
Rename a Symbol within this Scope.
Implements ghidra::Scope.
References ghidra::Symbol::displayName, insertNameTree(), multiEntrySet, ghidra::Symbol::name, nametree, and ghidra::Symbol::wholeCount.
Referenced by assignDefaultNames(), clearUnlocked(), clearUnlockedCategory(), and ghidra::ScopeLocal::recoverNameRecommendationsForSymbols().
|
virtual |
Convert an external reference to the referenced function.
| sym | is the Symbol marking the external reference |
Implements ghidra::Scope.
References ghidra::ExternRefSymbol::getRefAddr(), and ghidra::Scope::queryFunction().
Change the data-type of a Symbol within this Scope.
If the size of the Symbol changes, any mapping (SymbolEntry) is adjusted
| sym | is the given Symbol |
| ct | is the new data-type |
Implements ghidra::Scope.
References ghidra::Scope::addMapPoint(), ghidra::Symbol::checkSizeTypeLock(), ghidra::rangemap< _recordtype >::erase(), ghidra::Datatype::getSize(), ghidra::Datatype::getStripped(), ghidra::Datatype::hasStripped(), ghidra::Symbol::mapentry, maptable, ghidra::Symbol::name, ghidra::Symbol::type, and ghidra::Symbol::wholeCount.
Referenced by ghidra::Funcdata::attemptDynamicMappingLate().
|
virtual |
Set boolean Varnode properties on a Symbol.
Implements ghidra::Scope.
References ghidra::Symbol::checkSizeTypeLock(), ghidra::Symbol::flags, ghidra::Varnode::hiddenretparm, ghidra::Varnode::incidental_copy, ghidra::Varnode::indirectstorage, ghidra::Varnode::namelock, ghidra::Varnode::nolocalalias, ghidra::Varnode::readonly, ghidra::Varnode::typelock, and ghidra::Varnode::volatil.
Referenced by ghidra::ScopeLocal::recoverNameRecommendationsForSymbols(), and ghidra::ScopeGhidra::setAttribute().
|
virtual |
Set the category and index for the given Symbol.
| sym | is the given Symbol |
| cat | is the category to set for the Symbol |
| ind | is, for the function_parameter category, the index position to set, and is unused for other categories |
Implements ghidra::Scope.
References ghidra::Symbol::category, category, and ghidra::Symbol::catindex.
Referenced by categorySanity(), and ghidra::ScopeLocal::fakeInputSymbols().
|
virtual |
Set the display format for a Symbol.
Implements ghidra::Scope.
References ghidra::Symbol::setDisplayFormat().
Referenced by ghidra::ScopeGhidra::setDisplayFormat().