|
Ghidra 11.4.2
Ghidra internal decompiler documentation.
|
A Symbol representing an executable function. More...
#include <database.hh>
Public Member Functions | |
| FunctionSymbol (Scope *sc, const string &nm, int4 size) | |
| Construct given the name. | |
| FunctionSymbol (Scope *sc, int4 size) | |
| Constructor for use with decode. | |
| Funcdata * | getFunction (void) |
| Get the underlying Funcdata object. | |
| virtual void | encode (Encoder &encoder) const |
| Encode this Symbol to a stream. | |
| virtual void | decode (Decoder &decoder) |
| Decode this Symbol from a stream. | |
| virtual int4 | getBytesConsumed (void) const |
| Get number of bytes consumed within the address->symbol map. | |
Public Member Functions inherited from ghidra::Symbol | |
| Symbol (Scope *sc, const string &nm, Datatype *ct) | |
| Construct given a name and data-type. | |
| Symbol (Scope *sc) | |
| Construct for use with decode() | |
| const string & | getName (void) const |
| Get the local name of the symbol. | |
| const string & | getDisplayName (void) const |
| Get the name to display in output. | |
| Datatype * | getType (void) const |
| Get the data-type. | |
| uint8 | 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 | isVolatile (void) const |
| Is the Symbol volatile. | |
| bool | isThisPointer (void) const |
| Is this the "this" pointer. | |
| 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. | |
| bool | isMultiEntry (void) const |
| Does this have more than one entire mapping. | |
| bool | hasMergeProblems (void) const |
| Were some SymbolEntrys not merged. | |
| void | setMergeProblems (void) |
| Mark that some SymbolEntrys could not be merged. | |
| bool | isIsolated (void) const |
| Return true if this is isolated from speculative merging. | |
| void | setIsolated (bool val) |
| Set whether this Symbol should be speculatively merged. | |
| Scope * | getScope (void) const |
| Get the scope owning this Symbol. | |
| SymbolEntry * | getFirstWholeMap (void) const |
| Get the first entire mapping of the symbol. | |
| SymbolEntry * | getMapEntry (const Address &addr) const |
| Get first mapping of the symbol that contains the given Address. | |
| int4 | numEntries (void) const |
| Return the number of SymbolEntrys. | |
| SymbolEntry * | getMapEntry (int4 i) const |
| Return the i-th SymbolEntry for this Symbol. | |
| int4 | getMapEntryPosition (const SymbolEntry *entry) const |
| Position of given SymbolEntry within this multi-entry Symbol. | |
| int4 | getResolutionDepth (const Scope *useScope) const |
| Get number of scope names needed to resolve this symbol. | |
| void | encodeHeader (Encoder &encoder) const |
| Encode basic Symbol properties as attributes. | |
| void | decodeHeader (Decoder &decoder) |
| Decode basic Symbol properties from a <symbol> element. | |
| void | encodeBody (Encoder &encoder) const |
| Encode details of the Symbol to a stream. | |
| void | decodeBody (Decoder &decoder) |
| Decode details of the Symbol from a <symbol> element. | |
Private Member Functions | |
| void | buildType (void) |
| Build the data-type associated with this Symbol. | |
Private Attributes | |
| Funcdata * | fd |
| The underlying meta-data object for the function. | |
| int4 | consumeSize |
| Minimum number of bytes to consume with the start address. | |
Additional Inherited Members | |
Public Types inherited from ghidra::Symbol | |
| enum | { force_hex = 1 , force_dec = 2 , force_oct = 3 , force_bin = 4 , force_char = 5 , size_typelock = 8 , isolate = 16 , merge_problems = 32 , is_this_ptr = 64 } |
| Possible display (dispflag) properties for a Symbol. More... | |
| enum | { no_category = -1 , function_parameter = 0 , equate = 1 , union_facet = 2 , fake_input = 3 } |
| The possible specialize Symbol categories. More... | |
Static Public Attributes inherited from ghidra::Symbol | |
| static uint8 | ID_BASE = 0x4000000000000000L |
| Base of internal ID's. | |
Protected Member Functions inherited from ghidra::Symbol | |
| virtual | ~Symbol (void) |
| Destructor. | |
| void | setDisplayFormat (uint4 val) |
| Set the display format for this Symbol. | |
| void | checkSizeTypeLock (void) |
| Calculate if size_typelock property is on. | |
| void | setThisPointer (bool val) |
| Toggle whether this is the "this" pointer for a class method. | |
Protected Attributes inherited from ghidra::Symbol | |
| Scope * | scope |
| The scope that owns this symbol. | |
| string | name |
| The local name of the symbol. | |
| string | displayName |
| Name to use when displaying symbol in output. | |
| Datatype * | type |
| The symbol's data-type. | |
| uint4 | nameDedup |
| id to distinguish symbols with the same name | |
| uint4 | flags |
| Varnode-like properties of the symbol. | |
| uint4 | dispflags |
| Flags affecting the display of this symbol. | |
| int2 | category |
| Special category (function_parameter, equate, etc.) | |
| uint2 | catindex |
| Index within category. | |
| uint8 | symbolId |
| Unique id, 0=unassigned. | |
| vector< list< SymbolEntry >::iterator > | mapentry |
| List of storage locations labeled with this Symbol. | |
| const Scope * | depthScope |
| Scope associated with current depth resolution. | |
| int4 | depthResolution |
| Number of namespace elements required to resolve symbol in current scope. | |
| uint4 | wholeCount |
| Number of SymbolEntries that map to the whole Symbol. | |
A Symbol representing an executable function.
This Symbol owns the Funcdata object for the function it represents. The formal Symbol is thus associated with all the meta-data about the function.
| ghidra::FunctionSymbol::FunctionSymbol | ( | Scope * | sc, |
| const string & | nm, | ||
| int4 | size | ||
| ) |
Construct given the name.
Build a function shell, made up of just the name of the function and a placeholder data-type, without the underlying Funcdata object. A SymbolEntry for a function has a small size starting at the entry address, in order to deal with non-contiguous functions. We need a size (slightly) larger than 1 to accommodate pointer constants that encode extra information in the lower bit(s) of an otherwise aligned pointer. If the encoding is not initially detected, it is interpreted as a straight address that comes up 1 (or more) bytes off of the start of the function In order to detect this, we need to lay down a slightly larger size than 1
| sc | is the Scope that will contain the new Symbol |
| nm | is the name of the new Symbol |
| size | is the number of bytes a SymbolEntry should consume |
References buildType(), consumeSize, ghidra::Symbol::displayName, fd, and ghidra::Symbol::name.
|
virtual |
Decode this Symbol from a stream.
Parse a Symbol from the next element in the stream
| decoder | is the stream decoder |
Reimplemented from ghidra::Symbol.
References ghidra::Decoder::closeElement(), consumeSize, ghidra::Funcdata::decode(), ghidra::Symbol::displayName, fd, ghidra::Funcdata::getAddress(), ghidra::Funcdata::getDisplayName(), ghidra::Funcdata::getName(), ghidra::Decoder::getNextAttributeId(), ghidra::Funcdata::getSize(), ghidra::Symbol::name, ghidra::Decoder::openElement(), ghidra::Decoder::peekElement(), ghidra::Decoder::readString(), ghidra::Decoder::readUnsignedInteger(), ghidra::Symbol::scope, and ghidra::Symbol::symbolId.
|
virtual |
Encode this Symbol to a stream.
| encoder | is the stream encoder |
Reimplemented from ghidra::Symbol.
References ghidra::Encoder::closeElement(), ghidra::Funcdata::encode(), fd, ghidra::Symbol::name, ghidra::Encoder::openElement(), ghidra::Symbol::symbolId, ghidra::Encoder::writeString(), and ghidra::Encoder::writeUnsignedInteger().
|
inlinevirtual |
Get number of bytes consumed within the address->symbol map.
Get the number of bytes consumed by a SymbolEntry representing this Symbol. By default, this is the number of bytes consumed by the Symbol's data-type. This gives the amount of leeway a search has when the address queried does not match the exact address of the Symbol. With functions, the bytes consumed by a SymbolEntry may not match the data-type size.
Reimplemented from ghidra::Symbol.
References consumeSize.