decompiler
1.0.0
|
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. 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) | |
Architecture * | getArch (void) const |
Get the Architecture object. | |
Datatype * | findByName (const string &n) |
Return type of given name. More... | |
Datatype * | setName (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... | |
Datatype * | decodeType (Decoder &decoder) |
Restore Datatype from a stream. More... | |
Datatype * | decodeTypeWithCodeFlags (Decoder &decoder, bool isConstructor, bool isDestructor) |
Restore data-type from an element and extra "code" flags. More... | |
TypeVoid * | getTypeVoid (void) |
Get the "void" data-type. More... | |
Datatype * | getBaseNoChar (int4 s, type_metatype m) |
Get atomic type excluding "char". More... | |
Datatype * | getBase (int4 s, type_metatype m) |
Get atomic type. More... | |
Datatype * | getBase (int4 s, type_metatype m, const string &n) |
Get named atomic type. More... | |
TypeCode * | getTypeCode (void) |
Get an "anonymous" function data-type. More... | |
TypePointer * | getTypePointerStripArray (int4 s, Datatype *pt, uint4 ws) |
Construct a pointer data-type, stripping an ARRAY level. More... | |
TypePointer * | getTypePointer (int4 s, Datatype *pt, uint4 ws) |
Construct an absolute pointer data-type. More... | |
TypePointer * | getTypePointer (int4 s, Datatype *pt, uint4 ws, const string &n) |
Construct a named pointer data-type. More... | |
TypePointer * | getTypePointerNoDepth (int4 s, Datatype *pt, uint4 ws) |
Construct a depth limited pointer data-type. More... | |
TypeArray * | getTypeArray (int4 as, Datatype *ao) |
Construct an array data-type. More... | |
TypeStruct * | getTypeStruct (const string &n) |
Create an (empty) structure. More... | |
TypePartialStruct * | getTypePartialStruct (Datatype *contain, int4 off, int4 sz) |
Create a partial structure. | |
TypeUnion * | getTypeUnion (const string &n) |
Create an (empty) union. More... | |
TypePartialUnion * | getTypePartialUnion (TypeUnion *contain, int4 off, int4 sz) |
Create a partial union. | |
TypeEnum * | getTypeEnum (const string &n) |
Create an (empty) enumeration. More... | |
TypeSpacebase * | getTypeSpacebase (AddrSpace *id, const Address &addr) |
Create a "spacebase" type. More... | |
TypeCode * | getTypeCode (ProtoModel *model, Datatype *outtype, const vector< Datatype *> &intypes, bool dotdotdot) |
Create a "function" datatype. More... | |
Datatype * | getTypedef (Datatype *ct, const string &name, uint8 id, uint4 format) |
Create a new typedef data-type. More... | |
TypePointerRel * | getTypePointerRel (TypePointer *parentPtr, Datatype *ptrTo, int4 off) |
Get pointer offset relative to a container. More... | |
TypePointerRel * | getTypePointerRel (int4 sz, Datatype *parent, Datatype *ptrTo, int4 ws, int4 off, const string &nm) |
Build a named pointer offset into a larger container. More... | |
TypePointer * | getTypePointerWithSpace (Datatype *ptrTo, AddrSpace *spc, const string &nm) |
Build a named pointer with an address space attribute. More... | |
TypePointer * | resizePointer (TypePointer *ptr, int4 newSize) |
Build a resized pointer based on the given pointer. More... | |
Datatype * | getExactPiece (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... | |
Datatype * | concretize (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 Datatype * | findById (const string &n, uint8 id, int4 sz) |
Search by name and/or id. More... | |
Protected Member Functions inherited from ghidra::TypeFactory | |
Datatype * | findByIdLocal (const string &nm, uint8 id) const |
Search locally by name and id. More... | |
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.