decompiler  1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ghidra::ProtoStoreSymbol Class Reference

A collection of parameter descriptions backed by Symbol information. More...

#include <fspec.hh>

Inheritance diagram for ghidra::ProtoStoreSymbol:
ghidra::ProtoStore

Public Member Functions

 ProtoStoreSymbol (Scope *sc, const Address &usepoint)
 Constructor. More...
 
virtual ProtoParametersetInput (int4 i, const string &nm, const ParameterPieces &pieces)
 Establish name, data-type, storage of a specific input parameter. More...
 
virtual void clearInput (int4 i)
 Clear the input parameter at the specified slot. More...
 
virtual void clearAllInputs (void)
 Clear all input parameters (and any backing symbols)
 
virtual int4 getNumInputs (void) const
 Get the number of input parameters for this prototype.
 
virtual ProtoParametergetInput (int4 i)
 Get the i-th input parameter (or NULL if it doesn't exist)
 
virtual ProtoParametersetOutput (const ParameterPieces &piece)
 Establish the data-type and storage of the return value. More...
 
virtual void clearOutput (void)
 Clear the return value to TYPE_VOID.
 
virtual ProtoParametergetOutput (void)
 Get the return-value description.
 
virtual ProtoStoreclone (void) const
 Clone the entire collection of parameter descriptions.
 
virtual void encode (Encoder &encoder) const
 Encode any parameters that are not backed by symbols to a stream. More...
 
virtual void decode (Decoder &decoder, ProtoModel *model)
 Restore any internal parameter descriptions from a stream. More...
 
- Public Member Functions inherited from ghidra::ProtoStore
virtual ~ProtoStore (void)
 Constructor.
 

Private Member Functions

ParameterSymbolgetSymbolBacked (int4 i)
 Fetch or allocate the parameter for the indicated slot. More...
 

Private Attributes

Scopescope
 Backing Scope for input parameters.
 
Address restricted_usepoint
 A usepoint reference for storage locations (usually function entry -1)
 
vector< ProtoParameter * > inparam
 Cache of allocated input parameters.
 
ProtoParameteroutparam
 The return-value parameter.
 

Detailed Description

A collection of parameter descriptions backed by Symbol information.

Input parameters are determined by symbols a function Scope (category 0). Information about the return-value is stored internally. ProtoParameter objects are constructed on the fly as requested and cached.

Constructor & Destructor Documentation

◆ ProtoStoreSymbol()

ghidra::ProtoStoreSymbol::ProtoStoreSymbol ( Scope sc,
const Address usepoint 
)

Constructor.

Parameters
scis the function Scope that will back this store
usepointis the starting address of the function (-1)

References ghidra::ParameterPieces::flags, setOutput(), and ghidra::ParameterPieces::type.

Member Function Documentation

◆ clearInput()

void ghidra::ProtoStoreSymbol::clearInput ( int4  i)
virtual

Clear the input parameter at the specified slot.

The parameter is excised, any following parameters are shifted to fill its spot. If there is a backing Symbol, it is removed from the SymbolTable

Parameters
iis the specified parameter slot to remove

Implements ghidra::ProtoStore.

References ghidra::Symbol::function_parameter, and ghidra::Symbol::no_category.

◆ decode()

void ghidra::ProtoStoreSymbol::decode ( Decoder decoder,
ProtoModel model 
)
virtual

Restore any internal parameter descriptions from a stream.

Parse an <internallist> element containing <param> and <retparam> child elements.

Parameters
decoderis the stream decoder
modelis prototype model for determining storage for unassigned parameters

Implements ghidra::ProtoStore.

◆ encode()

void ghidra::ProtoStoreSymbol::encode ( Encoder encoder) const
virtual

Encode any parameters that are not backed by symbols to a stream.

Symbols are stored elsewhere, so symbol backed parameters are not serialized. If there are any internal parameters an <internallist> element is emitted.

Parameters
encoderis the stream encoder

Implements ghidra::ProtoStore.

◆ getSymbolBacked()

ParameterSymbol * ghidra::ProtoStoreSymbol::getSymbolBacked ( int4  i)
private

Fetch or allocate the parameter for the indicated slot.

Retrieve the specified ProtoParameter object, making sure it is a ParameterSymbol. If it doesn't exist, or if the object in the specific slot is not a ParameterSymbol, allocate an (uninitialized) parameter.

Parameters
iis the specified input slot
Returns
the corresponding parameter

◆ setInput()

ProtoParameter * ghidra::ProtoStoreSymbol::setInput ( int4  i,
const string &  nm,
const ParameterPieces pieces 
)
virtual

Establish name, data-type, storage of a specific input parameter.

This either allocates a new parameter or replaces the existing one at the specified input slot. If there is a backing symbol table, a Symbol is created or modified.

Parameters
iis the specified input slot
nmis the (optional) name of the parameter
piecesholds the raw storage address and data-type to set
Returns
the new/modified ProtoParameter

Implements ghidra::ProtoStore.

References ghidra::ParameterPieces::addr, ghidra::ParameterPieces::flags, ghidra::Symbol::function_parameter, ghidra::SymbolEntry::getAddr(), ghidra::Symbol::getFirstWholeMap(), ghidra::Symbol::getName(), ghidra::SymbolEntry::getSize(), ghidra::Datatype::getSize(), ghidra::Symbol::getType(), ghidra::Varnode::hiddenretparm, ghidra::ParameterPieces::hiddenretparm, ghidra::Varnode::indirectstorage, ghidra::ParameterPieces::indirectstorage, ghidra::Symbol::isHiddenReturn(), ghidra::Symbol::isIndirectStorage(), ghidra::ParameterSymbol::sym, and ghidra::ParameterPieces::type.

◆ setOutput()

ProtoParameter * ghidra::ProtoStoreSymbol::setOutput ( const ParameterPieces piece)
virtual

Establish the data-type and storage of the return value.

This either allocates a new parameter or replaces the existing one. A void return value can be specified with an invalid address and TYPE_VOID data-type.

Parameters
pieceholds the raw storage address and data-type to set
Returns
the new/modified ProtoParameter

Implements ghidra::ProtoStore.

References ghidra::ParameterPieces::addr, ghidra::ParameterPieces::flags, and ghidra::ParameterPieces::type.

Referenced by ProtoStoreSymbol().


The documentation for this class was generated from the following files: