decompiler  1.0.0
Public Member Functions | Protected Member Functions | List of all members
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 TypeFactoryGhidra:
TypeFactory

Public Member Functions

 TypeFactoryGhidra (ArchitectureGhidra *g)
 Constructor.
 
- Public Member Functions inherited from 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".
 
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...
 
bool setFields (vector< TypeField > &fd, TypeStruct *ot, int4 fixedsize, uint4 flags)
 Set fields on a TypeStruct. More...
 
bool setEnumValues (const vector< string > &namelist, const vector< uintb > &vallist, const vector< bool > &assignlist, TypeEnum *te)
 Set named values for an enumeration. More...
 
DatatyperestoreXmlType (const Element *el)
 Restore Datatype from XML. More...
 
DatatyperestoreXmlTypeWithCodeFlags (const Element *el, bool isConstructor, bool isDestructor)
 Restore data-type from XML with 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...
 
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...
 
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...
 
void destroyType (Datatype *ct)
 Remove a data-type from this. More...
 
DatatypedownChain (Datatype *ptrtype, uintb &off)
 Find a sub-type matching a pointer and offset. 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 saveXml (ostream &s) const
 Save this container to stream. More...
 
void saveXmlCoreTypes (ostream &s) const
 Save core types to stream. More...
 
void restoreXml (const Element *el)
 Restore this container from a stream. More...
 
void restoreXmlCoreTypes (const Element *el)
 Initialize basic type names. More...
 
void parseDataOrganization (const Element *el)
 Parse the <data_organization> tag. More...
 
void parseEnumConfig (const Element *el)
 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)
 Search by name and id. More...
 
- Protected Member Functions inherited from TypeFactory
DatatypefindByIdLocal (const string &nm, uint8 id) const
 Search locally by name and id. More...
 

Additional Inherited Members

- Protected Attributes inherited from 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

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

Search by name and id.

Search for a Datatype by name and/or id. Derived classes may search outside this container.

Parameters
nis the name of the data-type
idis the type id of the data-type
Returns
the matching Datatype object

Reimplemented from TypeFactory.

References XmlError::explain, TypeFactory::findById(), Document::getRoot(), TypeFactory::glb, and TypeFactory::restoreXmlType().


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