decompiler  1.0.0
Public Member Functions | Protected Member Functions | List of all members
ghidra::TypeFactoryGhidra Class Reference

An implementation of the TypeFactory interface, query a Ghidra client for data-type information. More...

#include <typegrp_ghidra.hh>

Inheritance diagram for ghidra::TypeFactoryGhidra:
ghidra::TypeFactory

Public Member Functions

 TypeFactoryGhidra (ArchitectureGhidra *g)
 Constructor.
 
- Public Member Functions inherited from ghidra::TypeFactory
 TypeFactory (Architecture *g)
 Construct a factory. More...
 
void setupSizes (void)
 Derive some size information from Architecture. More...
 
void clear (void)
 Clear out all types. More...
 
void clearNoncore (void)
 Clear out non-core types. More...
 
virtual ~TypeFactory (void)
 Destructor.
 
void setStructAlign (int4 al)
 Set the default structure alignment.
 
int4 getStructAlign (void) const
 Get the default structure alignment.
 
int4 getSizeOfInt (void) const
 Get the size of the default "int".
 
int4 getSizeOfLong (void) const
 Get the size of the default "long".
 
int4 getSizeOfPointer (void) const
 Get the size of pointers.
 
int4 getSizeOfAltPointer (void) const
 Get size of alternate pointers (or 0)
 
ArchitecturegetArch (void) const
 Get the Architecture object.
 
DatatypefindByName (const string &n)
 Return type of given name. More...
 
DatatypesetName (Datatype *ct, const string &n)
 Set the given types name. More...
 
void setDisplayFormat (Datatype *ct, uint4 format)
 Set the display format associated with the given data-type. More...
 
bool setFields (vector< TypeField > &fd, TypeStruct *ot, int4 fixedsize, uint4 flags)
 Set fields on a TypeStruct. More...
 
bool setFields (vector< TypeField > &fd, TypeUnion *ot, int4 fixedsize, uint4 flags)
 Set fields on a TypeUnion. More...
 
void setPrototype (const FuncProto *fp, TypeCode *newCode, uint4 flags)
 Set the prototype on a TypeCode. More...
 
bool setEnumValues (const vector< string > &namelist, const vector< uintb > &vallist, const vector< bool > &assignlist, TypeEnum *te)
 Set named values for an enumeration. More...
 
DatatypedecodeType (Decoder &decoder)
 Restore Datatype from a stream. More...
 
DatatypedecodeTypeWithCodeFlags (Decoder &decoder, bool isConstructor, bool isDestructor)
 Restore data-type from an element and extra "code" flags. More...
 
TypeVoidgetTypeVoid (void)
 Get the "void" data-type. More...
 
DatatypegetBaseNoChar (int4 s, type_metatype m)
 Get atomic type excluding "char". More...
 
DatatypegetBase (int4 s, type_metatype m)
 Get atomic type. More...
 
DatatypegetBase (int4 s, type_metatype m, const string &n)
 Get named atomic type. More...
 
TypeCodegetTypeCode (void)
 Get an "anonymous" function data-type. More...
 
TypePointergetTypePointerStripArray (int4 s, Datatype *pt, uint4 ws)
 Construct a pointer data-type, stripping an ARRAY level. More...
 
TypePointergetTypePointer (int4 s, Datatype *pt, uint4 ws)
 Construct an absolute pointer data-type. More...
 
TypePointergetTypePointer (int4 s, Datatype *pt, uint4 ws, const string &n)
 Construct a named pointer data-type. More...
 
TypePointergetTypePointerNoDepth (int4 s, Datatype *pt, uint4 ws)
 Construct a depth limited pointer data-type. More...
 
TypeArraygetTypeArray (int4 as, Datatype *ao)
 Construct an array data-type. More...
 
TypeStructgetTypeStruct (const string &n)
 Create an (empty) structure. More...
 
TypePartialStructgetTypePartialStruct (Datatype *contain, int4 off, int4 sz)
 Create a partial structure.
 
TypeUniongetTypeUnion (const string &n)
 Create an (empty) union. More...
 
TypePartialUniongetTypePartialUnion (TypeUnion *contain, int4 off, int4 sz)
 Create a partial union.
 
TypeEnumgetTypeEnum (const string &n)
 Create an (empty) enumeration. More...
 
TypeSpacebasegetTypeSpacebase (AddrSpace *id, const Address &addr)
 Create a "spacebase" type. More...
 
TypeCodegetTypeCode (ProtoModel *model, Datatype *outtype, const vector< Datatype *> &intypes, bool dotdotdot)
 Create a "function" datatype. More...
 
DatatypegetTypedef (Datatype *ct, const string &name, uint8 id, uint4 format)
 Create a new typedef data-type. More...
 
TypePointerRelgetTypePointerRel (TypePointer *parentPtr, Datatype *ptrTo, int4 off)
 Get pointer offset relative to a container. More...
 
TypePointerRelgetTypePointerRel (int4 sz, Datatype *parent, Datatype *ptrTo, int4 ws, int4 off, const string &nm)
 Build a named pointer offset into a larger container. More...
 
TypePointergetTypePointerWithSpace (Datatype *ptrTo, AddrSpace *spc, const string &nm)
 Build a named pointer with an address space attribute. More...
 
TypePointerresizePointer (TypePointer *ptr, int4 newSize)
 Build a resized pointer based on the given pointer. More...
 
DatatypegetExactPiece (Datatype *ct, int4 offset, int4 size)
 Get the data-type associated with piece of a structured data-type. More...
 
void destroyType (Datatype *ct)
 Remove a data-type from this. More...
 
Datatypeconcretize (Datatype *ct)
 Convert given data-type to concrete form. More...
 
void dependentOrder (vector< Datatype *> &deporder) const
 Place all data-types in dependency order. More...
 
void encode (Encoder &encoder) const
 Encode this container to stream. More...
 
void encodeCoreTypes (Encoder &encoder) const
 Encode core types to stream. More...
 
void decode (Decoder &decoder)
 Decode this from a <typegrp> element. More...
 
void decodeCoreTypes (Decoder &decoder)
 Initialize basic data-types from a stream. More...
 
void decodeDataOrganization (Decoder &decoder)
 Parse a <data_organization> element. More...
 
void parseEnumConfig (Decoder &decoder)
 Parse the <enum> tag. More...
 
void setCoreType (const string &name, int4 size, type_metatype meta, bool chartp)
 Create a core data-type. More...
 
void cacheCoreTypes (void)
 Cache common types. More...
 

Protected Member Functions

virtual DatatypefindById (const string &n, uint8 id, int4 sz)
 Search by name and/or id. More...
 
- Protected Member Functions inherited from ghidra::TypeFactory
DatatypefindByIdLocal (const string &nm, uint8 id) const
 Search locally by name and id. More...
 

Additional Inherited Members

- Protected Attributes inherited from ghidra::TypeFactory
Architectureglb
 The Architecture object that owns this TypeFactory.
 

Detailed Description

An implementation of the TypeFactory interface, query a Ghidra client for data-type information.

Requests for a specific data-type name and id are marshaled to the Ghidra client, which sends back a description of the data-type. The description is parsed and converted into a Datatype object and cached in this object.

Member Function Documentation

◆ findById()

Datatype * ghidra::TypeFactoryGhidra::findById ( const string &  n,
uint8  id,
int4  sz 
)
protectedvirtual

Search by name and/or id.

The id is expected to resolve uniquely. Internally, different length instances of a variable length data-type are stored as separate Datatype objects. A non-zero size can be given to distinguish these cases. Derived classes may search outside this container.

Parameters
nis the name of the data-type
idis the type id of the data-type
szis the given distinguishing size if non-zero
Returns
the matching Datatype object

Reimplemented from ghidra::TypeFactory.

References ghidra::TypeFactory::decodeType(), ghidra::DecoderError::explain, ghidra::TypeFactory::findById(), ghidra::ArchitectureGhidra::getDataType(), and ghidra::TypeFactory::glb.


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