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

A mapping from a Symbol to a specific Varnode. More...

#include <database.hh>

Inheritance diagram for ghidra::DynamicEntry:
ghidra::SymbolEntry

Public Member Functions

 DynamicEntry (Symbol *sym, uint4 exfl, uint8 h, int4 off, int4 sz, const RangeList &rnglist)
 Constructor. More...
 
 DynamicEntry (Symbol *sym)
 Constructor for use with decode()
 
virtual Datatype * getSizedType (const Address &addr, int4 sz) const
 Get the data-type associated with (a piece of) this. More...
 
virtual void printEntry (ostream &s) const
 Print a one-line description of this to a debug stream. More...
 
virtual void encode (Encoder &encoder) const
 Encode storage element internal to <mapsym> More...
 
virtual void decode (Decoder &decoder)
 Decode storage element internal to <mapsym> More...
 
uint8 getHash (void) const
 Get the hash used to identify this storage.
 
- Public Member Functions inherited from ghidra::SymbolEntry
 SymbolEntry (Symbol *sym)
 Construct an uninitialized SymbolEntry. More...
 
 SymbolEntry (Symbol *sym, uint4 exflags, int4 sz, int4 off, const RangeList &use)
 Constructor. More...
 
bool isPiece (void) const
 Is this a proper piece of the whole Symbol.
 
bool isDynamic (void) const
 Is storage dynamic.
 
bool isConflict (void) const
 Does storage have potential Symbol conflicts.
 
virtual Datatype * getSizedType (const Address &addr, int4 sz) const =0
 Get the data-type associated with (a piece of) this. More...
 
virtual void printEntry (ostream &s) const =0
 Print a one-line description of this to a debug stream. More...
 
virtual void encode (Encoder &encoder) const =0
 Encode storage element internal to <mapsym> More...
 
virtual void decode (Decoder &decoder)=0
 Decode storage element internal to <mapsym> More...
 
uint4 getAllFlags (void) const
 Get all Varnode flags for this storage. More...
 
int4 getOffset (void) const
 Get offset of this within the Symbol.
 
Symbol * getSymbol (void) const
 Get the Symbol associated with this.
 
int4 getSize (void) const
 Get the number of bytes consumed by this storage.
 
bool inUse (const Address &usepoint) const
 Is this storage valid for the given code address. More...
 
const RangeList & getUseLimit (void) const
 Get the set of valid code addresses for this storage.
 
Address getFirstUseAddress (void) const
 Get the first code address where this storage is valid.
 
void setUseLimit (const RangeList &uselim)
 Set the range of code addresses where this is valid.
 
bool isAddrTied (void) const
 Is this storage address tied.
 
bool updateType (Varnode *vn) const
 Update a Varnode data-type from this. More...
 

Private Attributes

uint8 hash
 A dynamic storage address.
 
list< DynamicEntry * >::iterator dynIterator
 Position within container.
 

Friends

class Scope
 
class ScopeInternal
 

Additional Inherited Members

- Protected Types inherited from ghidra::SymbolEntry
enum  { map_entry = 0 , conflict_entry = 1 , dynamic_entry = 2 }
 The type (derived class) of SymbolEntry. More...
 
- Protected Attributes inherited from ghidra::SymbolEntry
Symbol * symbol
 Symbol object being mapped.
 
RangeList uselimit
 Code address ranges where this storage is valid.
 
uint4 extraflags
 Varnode flags specific to this storage location.
 
int4 offset
 Offset into the Symbol that this covers.
 
int4 size
 Number of bytes consumed by this (piece of the) storage.
 
uint2 entrytype
 Type of SymbolEntry.
 
bool is_piece
 Is this a piece of the whole symbol.
 

Detailed Description

A mapping from a Symbol to a specific Varnode.

For a constant or temporary register that is not strongly linked to a particular storage address, this allows a representative Varnode to be discovered dynamically. Storage for the Symbol is tied to the particular Varnode and p-code operator using the value.

Constructor & Destructor Documentation

◆ DynamicEntry()

ghidra::DynamicEntry::DynamicEntry ( Symbol *  sym,
uint4  exfl,
uint8  h,
int4  off,
int4  sz,
const RangeList &  rnglist 
)

Constructor.

This is used specifically for dynamic Symbol objects, where the storage location is attached to a temporary register or a constant. The main address field (addr) is set to invalid, and the hash becomes the primary location information.

Parameters
symis the underlying Symbol
exflare the Varnode flags associated with the storage location
his the hash
offif the offset into the Symbol for this (piece of) storage
szis the size in bytes of this (piece of) storage
rnglistis the set of code addresses where this SymbolEntry represents the Symbol

References ghidra::SymbolEntry::dynamic_entry, ghidra::SymbolEntry::entrytype, and hash.

Member Function Documentation

◆ decode()

void ghidra::DynamicEntry::decode ( Decoder &  decoder)
virtual

◆ encode()

void ghidra::DynamicEntry::encode ( Encoder &  encoder) const
virtual

◆ getSizedType()

Datatype * ghidra::DynamicEntry::getSizedType ( const Address &  addr,
int4  sz 
) const
virtual

Get the data-type associated with (a piece of) this.

Return the data-type that matches the given size and address within this storage. NULL is returned if there is no valid sub-type matching the size.

Parameters
addris the given address
szis the given size (in bytes)
Returns
the matching data-type or NULL

Implements ghidra::SymbolEntry.

References ghidra::Scope::getArch(), ghidra::TypeFactory::getExactPiece(), ghidra::Symbol::getScope(), ghidra::Symbol::getType(), ghidra::SymbolEntry::offset, ghidra::SymbolEntry::symbol, and ghidra::Architecture::types.

◆ printEntry()

void ghidra::DynamicEntry::printEntry ( ostream &  s) const
virtual

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