|
Ghidra 11.4.2
Ghidra internal decompiler documentation.
|
An implementation of the TypeFactory interface, query a Ghidra client for data-type information. More...
#include <typegrp_ghidra.hh>
Public Member Functions | |
| TypeFactoryGhidra (ArchitectureGhidra *g) | |
| Constructor. | |
Public Member Functions inherited from ghidra::TypeFactory | |
| TypeFactory (Architecture *g) | |
| Construct a factory. | |
| void | setupSizes (void) |
| Derive some size information from Architecture. | |
| void | clear (void) |
| Clear out all types. | |
| void | clearNoncore (void) |
| Clear out non-core types. | |
| virtual | ~TypeFactory (void) |
| Destructor. | |
| int4 | getAlignment (uint4 size) const |
| Get data-type alignment based on size. | |
| int4 | getPrimitiveAlignSize (uint4 size) const |
| Get the aligned size of a primitive data-type. | |
| int4 | getSizeOfInt (void) const |
| Get the size of the default "int". | |
| int4 | getSizeOfLong (void) const |
| Get the size of the default "long". | |
| int4 | getSizeOfChar (void) const |
| Get the size of the default "char". | |
| int4 | getSizeOfWChar (void) const |
| Get the size of the default "wchar_t". | |
| int4 | getSizeOfPointer (void) const |
| Get the size of pointers. | |
| int4 | getSizeOfAltPointer (void) const |
| Get size of alternate pointers (or 0) | |
| Architecture * | getArch (void) const |
| Get the Architecture object. | |
| Datatype * | findByName (const string &n) |
| Return type of given name. | |
| Datatype * | setName (Datatype *ct, const string &n) |
| Set the given types name. | |
| void | setDisplayFormat (Datatype *ct, uint4 format) |
| Set the display format associated with the given data-type. | |
| void | setFields (const vector< TypeField > &fd, TypeStruct *ot, int4 newSize, int4 newAlign, uint4 flags) |
| Set fields on a TypeStruct. | |
| void | setFields (const vector< TypeField > &fd, TypeUnion *ot, int4 newSize, int4 newAlign, uint4 flags) |
| Set fields on a TypeUnion. | |
| void | setPrototype (const FuncProto *fp, TypeCode *newCode, uint4 flags) |
| Set the prototype on a TypeCode. | |
| void | setEnumValues (const map< uintb, string > &nmap, TypeEnum *te) |
| Set named values for an enumeration. | |
| Datatype * | decodeType (Decoder &decoder) |
| Restore Datatype from a stream. | |
| Datatype * | decodeTypeWithCodeFlags (Decoder &decoder, bool isConstructor, bool isDestructor) |
| Restore data-type from an element and extra "code" flags. | |
| TypeVoid * | getTypeVoid (void) |
| Get the "void" data-type. | |
| Datatype * | getBaseNoChar (int4 s, type_metatype m) |
| Get atomic type excluding "char". | |
| Datatype * | getBase (int4 s, type_metatype m) |
| Get atomic type. | |
| Datatype * | getBase (int4 s, type_metatype m, const string &n) |
| Get named atomic type. | |
| Datatype * | getTypeChar (int4 s) |
| Get a character data-type by size. | |
| TypeCode * | getTypeCode (void) |
| Get an "anonymous" function data-type. | |
| TypePointer * | getTypePointerStripArray (int4 s, Datatype *pt, uint4 ws) |
| Construct a pointer data-type, stripping an ARRAY level. | |
| TypePointer * | getTypePointer (int4 s, Datatype *pt, uint4 ws) |
| Construct an absolute pointer data-type. | |
| TypePointer * | getTypePointer (int4 s, Datatype *pt, uint4 ws, const string &n) |
| Construct a named pointer data-type. | |
| TypeArray * | getTypeArray (int4 as, Datatype *ao) |
| Construct an array data-type. | |
| TypeStruct * | getTypeStruct (const string &n) |
| Create an (empty) structure. | |
| TypePartialStruct * | getTypePartialStruct (Datatype *contain, int4 off, int4 sz) |
| Create a partial structure. | |
| TypeUnion * | getTypeUnion (const string &n) |
| Create an (empty) union. | |
| TypePartialUnion * | getTypePartialUnion (TypeUnion *contain, int4 off, int4 sz) |
| Create a partial union. | |
| TypeEnum * | getTypeEnum (const string &n) |
| Create an (empty) enumeration. | |
| TypePartialEnum * | getTypePartialEnum (TypeEnum *contain, int4 off, int4 sz) |
| Create a partial enumeration. | |
| TypeSpacebase * | getTypeSpacebase (AddrSpace *id, const Address &addr) |
| Create a "spacebase" type. | |
| TypeCode * | getTypeCode (const PrototypePieces &proto) |
| Create a "function" datatype. | |
| Datatype * | getTypedef (Datatype *ct, const string &name, uint8 id, uint4 format) |
| Create a new typedef data-type. | |
| TypePointerRel * | getTypePointerRel (TypePointer *parentPtr, Datatype *ptrTo, int4 off) |
| Get pointer offset relative to a container. | |
| TypePointerRel * | getTypePointerRel (int4 sz, Datatype *parent, Datatype *ptrTo, int4 ws, int4 off, const string &nm) |
| Build a named pointer offset into a larger container. | |
| TypePointer * | getTypePointerWithSpace (Datatype *ptrTo, AddrSpace *spc, const string &nm) |
| Build a named pointer with an address space attribute. | |
| TypePointer * | resizePointer (TypePointer *ptr, int4 newSize) |
| Build a resized pointer based on the given pointer. | |
| Datatype * | getExactPiece (Datatype *ct, int4 offset, int4 size) |
| Get the data-type associated with piece of a structured data-type. | |
| void | destroyType (Datatype *ct) |
| Remove a data-type from this. | |
| Datatype * | concretize (Datatype *ct) |
| Convert given data-type to concrete form. | |
| void | dependentOrder (vector< Datatype * > &deporder) const |
| Place all data-types in dependency order. | |
| void | encode (Encoder &encoder) const |
| Encode this container to stream. | |
| void | encodeCoreTypes (Encoder &encoder) const |
| Encode core types to stream. | |
| void | decode (Decoder &decoder) |
| Decode this from a <typegrp> element. | |
| void | decodeCoreTypes (Decoder &decoder) |
| Initialize basic data-types from a stream. | |
| void | decodeDataOrganization (Decoder &decoder) |
| Parse a <data_organization> element. | |
| void | parseEnumConfig (Decoder &decoder) |
| Parse the <enum> tag. | |
| void | setCoreType (const string &name, int4 size, type_metatype meta, bool chartp) |
| Create a core data-type. | |
| void | cacheCoreTypes (void) |
| Cache common types. | |
| list< DatatypeWarning >::const_iterator | beginWarnings (void) const |
| Start of data-type warnings. | |
| list< DatatypeWarning >::const_iterator | endWarnings (void) const |
| End of data-type warnings. | |
Protected Member Functions | |
| virtual Datatype * | findById (const string &n, uint8 id, int4 sz) |
| Search by name and/or id. | |
Protected Member Functions inherited from ghidra::TypeFactory | |
| Datatype * | findByIdLocal (const string &nm, uint8 id) const |
| Search locally by name and id. | |
Additional Inherited Members | |
Protected Attributes inherited from ghidra::TypeFactory | |
| Architecture * | glb |
| The Architecture object that owns this TypeFactory. | |
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.
|
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.
| n | is the name of the data-type |
| id | is the type id of the data-type |
| sz | is the given distinguishing size if non-zero |
Reimplemented from ghidra::TypeFactory.
References ghidra::TypeFactory::decodeType(), ghidra::DecoderError::explain, ghidra::TypeFactory::findById(), ghidra::ArchitectureGhidra::getDataType(), and ghidra::TypeFactory::glb.