25 extern void print_data(ostream &s,uint1 *buffer,int4 size,
const Address &baseaddr);
87 static uint8
hashName(
const string &nm);
108 virtual void printRaw(ostream &s)
const;
112 virtual void printNameBase(ostream &s)
const {
if (!name.empty()) s<<name[0]; }
116 virtual void saveXml(ostream &s)
const;
136 if (res != 0)
return (res<0);
145 if (res != 0)
return (res < 0);
183 virtual void saveXml(ostream &s)
const;
199 virtual void saveXml(ostream &s)
const;
215 virtual void saveXml(ostream &s)
const;
234 virtual void printRaw(ostream &s)
const;
241 virtual void saveXml(ostream &s)
const;
258 arraysize = n; arrayof = ao; }
261 Datatype *getSubEntry(int4 off,int4 sz,int4 *newoff,int4 *el)
const;
262 virtual void printRaw(ostream &s)
const;
270 virtual void saveXml(ostream &s)
const;
282 void setNameMap(
const map<uintb,string> &nmap);
291 map<uintb,string>::const_iterator
beginEnum(
void)
const {
return namemap.begin(); }
292 map<uintb,string>::const_iterator
endEnum(
void)
const {
return namemap.end(); }
293 bool getMatches(uintb val,vector<string> &matchname)
const;
297 virtual void saveXml(ostream &s)
const;
305 void setFields(
const vector<TypeField> &fd);
306 int4 getFieldIter(int4 off)
const;
311 vector<TypeField>::const_iterator
beginField(
void)
const {
return field.begin(); }
312 vector<TypeField>::const_iterator
endField(
void)
const {
return field.end(); }
313 const TypeField *getField(int4 off,int4 sz,int4 *newoff)
const;
315 virtual int4
numDepend(
void)
const {
return field.size(); }
320 virtual void saveXml(ostream &s)
const;
334 Datatype *outtype,
const vector<Datatype *> &intypes,
340 int4 compareBasic(
const TypeCode *op)
const;
342 void setProperties(
bool hasThisPtr,
bool isConstructor,
bool isDestructor);
344 virtual void printRaw(ostream &s)
const;
348 virtual void saveXml(ostream &s)
const;
365 spaceid = op.spaceid; localframe=op.localframe; glb=op.glb;
370 Scope *getMap(
void)
const;
376 virtual void saveXml(ostream &s)
const;
395 void clearCache(
void);
396 TypeChar *getTypeChar(
const string &n);
398 TypeCode *getTypeCode(
const string &n);
401 Datatype *findByIdLocal(
const string &nm,uint8
id)
const;
402 virtual Datatype *findById(
const string &n,uint8
id);
405 void setupSizes(
void);
407 void clearNoncore(
void);
413 Datatype *findByName(
const string &n);
415 bool setFields(vector<TypeField> &fd,
TypeStruct *ot,int4 fixedsize);
416 bool setEnumValues(
const vector<string> &namelist,
417 const vector<uintb> &vallist,
418 const vector<bool> &assignlist,
421 Datatype *restoreXmlTypeWithCodeFlags(
const Element *el,
bool hasThisPtr,
bool isConstructor,
bool isDestructor);
432 TypeEnum *getTypeEnum(
const string &n);
435 const vector<Datatype *> &intypes,
440 void dependentOrder(vector<Datatype *> &deporder)
const;
441 void saveXml(ostream &s)
const;
442 void saveXmlCoreTypes(ostream &s)
const;
444 void restoreXmlCoreTypes(
const Element *el);
445 void parseDataOrganization(
const Element *el);
446 void parseEnumConfig(
const Element *el);
448 void cacheCoreTypes(
void);
460 if (
this == &op)
return 0;
virtual void printNameBase(ostream &s) const
Print name as short prefix.
Definition: type.hh:112
Data is actual executable code.
Definition: type.hh:40
A region where processor data is stored.
Definition: space.hh:73
virtual Datatype * getDepend(int4 index) const
Return the i-th component sub-type.
Definition: type.hh:265
bool isCharPrint(void) const
Does this print as a 'char'.
Definition: type.hh:97
An unknown low-level type. Treated as an unsigned integer.
Definition: type.hh:36
string name
Name of type.
Definition: type.hh:81
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:182
bool isUTF16(void) const
Does this print as UTF16 'wchar'.
Definition: type.hh:101
The base datatype class for the decompiler.
Definition: type.hh:62
bool operator<(const TypeField &op2) const
Compare based on offset.
Definition: type.hh:128
TypeSpacebase(const TypeSpacebase &op)
Construct from another TypeSpacebase.
Definition: type.hh:364
virtual Datatype * getDepend(int4 index) const
Return the i-th component sub-type.
Definition: type.hh:316
map< uintb, string > namemap
Map from integer to name.
Definition: type.hh:280
Signed integer. Signed is considered less specific than unsigned in C.
Definition: type.hh:37
uint4 flags
Boolean properties of the type.
Definition: type.hh:83
type_metatype getMetatype(void) const
Get the type meta-type.
Definition: type.hh:104
A composite Datatype object: A "structure" with component "fields".
Definition: type.hh:301
void metatype2string(type_metatype metatype, string &res)
Convert type meta-type to name.
Definition: type.cc:129
TypeSpacebase(AddrSpace *id, const Address &frame, Architecture *g)
Construct given an address space, scope, and architecture.
Definition: type.hh:368
Base class for the fundamental atomic types.
Definition: type.hh:158
void saveXmlRef(ostream &s) const
Write an XML reference of this to stream.
Definition: type.cc:257
virtual Datatype * getDepend(int4 index) const
Return the i-th component sub-type.
Definition: type.hh:236
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:319
vector< TypeField >::const_iterator beginField(void) const
Beginning of fields.
Definition: type.hh:311
Datatype object representing a pointer.
Definition: type.hh:219
int4 typeOrder(const Datatype &op) const
Order this with -op- datatype.
Definition: type.hh:117
Pointer data-type.
Definition: type.hh:43
int4 numElements(void) const
Get the number of elements.
Definition: type.hh:260
A prototype model: a model for passing parameters between functions.
Definition: fspec.hh:615
virtual ~Datatype(void)
Destructor.
Definition: type.hh:95
virtual void saveXml(ostream &s) const
Serialize the data-type to XML.
Definition: type.cc:228
void print_data(ostream &s, uint1 *buffer, int4 size, const Address &baseaddr)
Print a hex dump of a data buffer to stream.
Definition: type.cc:27
map< uintb, string >::const_iterator endEnum(void) const
End of name map.
Definition: type.hh:292
set< Datatype *, DatatypeCompare > DatatypeSet
A set of data-types sorted by function.
Definition: type.hh:150
TypeEnum(int4 s, type_metatype m)
Construct from a size and meta-type (TYPE_INT or TYPE_UINT)
Definition: type.hh:288
Unsigned integer.
Definition: type.hh:38
16-bit wide chars in unicode UTF16
Definition: type.hh:75
int4 arraysize
Number of elements in the array.
Definition: type.hh:249
TypeArray(const TypeArray &op)
Construct from another TypeArray.
Definition: type.hh:255
uint4 getInheritable(void) const
Get properties pointers inherit.
Definition: type.hh:103
Specifies subfields of a structure or what a pointer points to.
Definition: type.hh:124
type_metatype
Definition: type.hh:33
TypeBase(int4 s, type_metatype m)
Construct TypeBase from a size and meta-type.
Definition: type.hh:165
Structure data-type, made up of component datatypes.
Definition: type.hh:45
virtual int4 numDepend(void) const
Return number of component sub-types.
Definition: type.hh:264
Floating-point.
Definition: type.hh:41
Datatype * getPtrTo(void) const
Get the pointed-to Datatype.
Definition: type.hh:232
Special Datatype object used to describe pointers that index into the symbol table.
Definition: type.hh:356
Boolean.
Definition: type.hh:39
int4 offset
Offset (into containing struct) of subfield.
Definition: type.hh:125
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:198
void restoreXmlBasic(const Element *el)
Recover basic data-type properties.
Definition: type.cc:273
Datatype * ptrto
Type being pointed to.
Definition: type.hh:222
uint8 id
A unique id for the type (or 0 if an id is not assigned)
Definition: type.hh:84
vector< TypeField > field
The list of fields.
Definition: type.hh:304
int4 size
Size (of variable holding a value of this type)
Definition: type.hh:80
An enumeration type where all values are of 2^^n form.
Definition: type.hh:74
int4 getStructAlign(void) const
Get the default structure alignment.
Definition: type.hh:410
uint4 getWordSize(void) const
Get the wordsize of the pointer.
Definition: type.hh:233
static uint8 hashName(const string &nm)
Produce a data-type id by hashing the type name.
Definition: type.cc:313
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:214
Datatype(int4 s, type_metatype m)
Construct the base data-type providing size and meta-type.
Definition: type.hh:92
FuncProto * proto
If non-null, this describes the prototype of the underlying function.
Definition: type.hh:332
type_metatype metatype
Meta-type - type disregarding size.
Definition: type.hh:82
32-bit wide chars in unicode UTF32
Definition: type.hh:76
bool isEnumType(void) const
Is this an enumerated type.
Definition: type.hh:98
bool operator()(const Datatype *a, const Datatype *b) const
Comparison operator.
Definition: type.hh:143
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:168
const FuncProto * getPrototype(void) const
Get the function prototype.
Definition: type.hh:341
Array data-type, made up of a sequence of "element" datatype.
Definition: type.hh:44
int4 getSize(void) const
Get the type size.
Definition: type.hh:106
Datatype(int4 s, type_metatype m, const string &n)
Construct the base data-type providing size, meta-type, and name.
Definition: type.hh:94
Datatype(const Datatype &op)
Construct the base data-type copying low-level properties of another.
Definition: type.hh:90
bool setFields(vector< TypeField > &fd, TypeStruct *ot, int4 fixedsize)
Set fields on a TypeStruct.
Definition: type.cc:1487
bool isPowerOfTwo(void) const
Is this a flag-based enumeration.
Definition: type.hh:99
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
TypeStruct(const string &n)
Construct empty TypeStruct from a name.
Definition: type.hh:310
virtual void printNameBase(ostream &s) const
Print name as short prefix.
Definition: type.hh:237
bool isUTF32(void) const
Does this print as UTF32 'wchar'.
Definition: type.hh:102
Classes for specifying addresses and other low-level constants.
Placeholder for symbol/type look-up calculations.
Definition: type.hh:35
TypeChar(const TypeChar &op)
Construct TypeChar copying properties from another data-type.
Definition: type.hh:179
Datatype * arrayof
type of which we have an array
Definition: type.hh:248
The unicode data-type: i.e. wchar.
Definition: type.hh:189
Standard "void" type, absence of type.
Definition: type.hh:34
Compare two Datatype pointers: first by name, then by id.
Definition: type.hh:141
Manager for all the major decompiler subsystems.
Definition: architecture.hh:117
TypeBase(int4 s, type_metatype m, const string &n)
Construct TypeBase from a size, meta-type, and name.
Definition: type.hh:167
This is a basic type which will never be redefined.
Definition: type.hh:66
Datatype object representing an array of elements.
Definition: type.hh:245
Compare two Datatype pointers for equivalence of their description.
Definition: type.hh:132
type_metatype string2metatype(const string &metastring)
Convert string to type meta-type.
Definition: type.cc:174
virtual Datatype * getSubType(uintb off, uintb *newoff) const
Recover component data-type one-level down.
Definition: type.cc:86
string name
Name of subfield.
Definition: type.hh:126
Architecture * glb
The Architecture object that owns this TypeFactory.
Definition: type.hh:400
const string & getName(void) const
Get the type name.
Definition: type.hh:107
An XML element. A node in the DOM tree.
Definition: xml.hh:150
void setStructAlign(int4 al)
Set the default structure alignment.
Definition: type.hh:409
uint8 getId(void) const
Get the type id.
Definition: type.hh:105
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:240
vector< uintb > masklist
Masks for each bitfield within the enum.
Definition: type.hh:281
TypeUnicode(void)
For use with restoreXml.
Definition: type.hh:195
Datatype object representing executable code.
Definition: type.hh:329
virtual void printRaw(ostream &s) const
Print a description of the type to stream.
Definition: type.cc:69
virtual int4 compare(const Datatype &op, int4 level) const
Compare for functional equivalence.
Definition: type.cc:99
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:347
void saveXmlBasic(ostream &s) const
Save basic data-type properties.
Definition: type.cc:239
bool operator()(const Datatype *a, const Datatype *b) const
Comparison operator.
Definition: type.hh:134
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:296
virtual Datatype * getDepend(int4 index) const
Return the i-th component sub-type.
Definition: type.hh:111
TypeArray(int4 n, Datatype *ao)
Construct given an array size and element data-type.
Definition: type.hh:257
TypeVoid(const TypeVoid &op)
Construct from another TypeVoid.
Definition: type.hh:211
TypeBase(const TypeBase &op)
Construct TypeBase copying properties from another data-type.
Definition: type.hh:163
vector< TypeField >::const_iterator endField(void) const
End of fields.
Definition: type.hh:312
ASCII character data.
Definition: type.hh:72
virtual int4 numDepend(void) const
Return number of component sub-types.
Definition: type.hh:315
A function prototype.
Definition: fspec.hh:1147
Container class for all Datatype objects in an Architecture.
Definition: type.hh:380
Datatype * getBase(void) const
Get the element data-type.
Definition: type.hh:259
bool isCoreType(void) const
Is this a core data-type.
Definition: type.hh:96
virtual int4 compareDependency(const Datatype &op) const
Compare for storage in tree structure.
Definition: type.cc:110
TypeUnicode(const TypeUnicode &op)
Construct from another TypeUnicode.
Definition: type.hh:196
TypeVoid(void)
Constructor.
Definition: type.hh:213
TypeEnum(int4 s, type_metatype m, const string &nm)
Construct from a size, meta-type, and name.
Definition: type.hh:290
Base type for character data-types: i.e. char.
Definition: type.hh:174
map< uintb, string >::const_iterator beginEnum(void) const
Beginning of name map.
Definition: type.hh:291
virtual Datatype * clone(void) const =0
Clone the data-type.
virtual void restoreXml(const Element *el, TypeFactory &typegrp)
Restore data-type from XML.
Definition: type.cc:303
set< Datatype *, DatatypeNameCompare > DatatypeNameSet
A set of data-types sorted by name.
Definition: type.hh:153
int4 getSizeOfInt(void) const
Get the size of the default "int".
Definition: type.hh:411
TypeArray(void)
Internal constructor for restoreXml.
Definition: type.hh:252
An enumerated Datatype object: an integer with named values.
Definition: type.hh:277
bool isASCII(void) const
Does this print as an ASCII 'char'.
Definition: type.hh:100
TypePointer(void)
Internal constructor for use with restoreXml.
Definition: type.hh:226
virtual void printNameBase(ostream &s) const
Print name as short prefix.
Definition: type.hh:266
TypePointer(int4 s, Datatype *pt, uint4 ws)
Construct from a size, pointed-to type, and wordsize.
Definition: type.hh:231
int4 typeOrderBool(const Datatype &op) const
Order this with -op-, treating bool data-type as special.
Definition: type.hh:457
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:375
uint4 wordsize
What size unit does the pointer address.
Definition: type.hh:223
Formal "void" data-type object.
Definition: type.hh:206
virtual int4 numDepend(void) const
Return number of component sub-types.
Definition: type.hh:110
virtual int4 numDepend(void) const
Return number of component sub-types.
Definition: type.hh:235
An enumeration type (as well as an integer)
Definition: type.hh:73
Datatype * type
type of subfield
Definition: type.hh:127
virtual Datatype * clone(void) const
Clone the data-type.
Definition: type.hh:269
TypePointer(const TypePointer &op)
Construct from another TypePointer.
Definition: type.hh:229
TypeChar(const string &n)
Construct a char (always 1-byte) given a name.
Definition: type.hh:181
A collection of Symbol objects within a single (namespace or functional) scope.
Definition: database.hh:413
Architecture * getArch(void) const
Get the Architecture object.
Definition: type.hh:412