decompiler  1.0.0
Classes | Typedefs | Enumerations | Functions
type.hh File Reference

Classes for describing and printing data-types. More...

#include "address.hh"

Classes

class  Datatype
 The base datatype class for the decompiler. More...
 
struct  TypeField
 Specifies subfields of a structure or what a pointer points to. More...
 
struct  DatatypeCompare
 Compare two Datatype pointers for equivalence of their description. More...
 
struct  DatatypeNameCompare
 Compare two Datatype pointers: first by name, then by id. More...
 
class  TypeBase
 Base class for the fundamental atomic types. More...
 
class  TypeChar
 Base type for character data-types: i.e. char. More...
 
class  TypeUnicode
 The unicode data-type: i.e. wchar. More...
 
class  TypeVoid
 Formal "void" data-type object. More...
 
class  TypePointer
 Datatype object representing a pointer. More...
 
class  TypeArray
 Datatype object representing an array of elements. More...
 
class  TypeEnum
 An enumerated Datatype object: an integer with named values. More...
 
class  TypeStruct
 A composite Datatype object: A "structure" with component "fields". More...
 
class  TypeCode
 Datatype object representing executable code. More...
 
class  TypeSpacebase
 Special Datatype object used to describe pointers that index into the symbol table. More...
 
class  TypeFactory
 Container class for all Datatype objects in an Architecture. More...
 

Typedefs

typedef set< Datatype *, DatatypeCompareDatatypeSet
 A set of data-types sorted by function.
 
typedef set< Datatype *, DatatypeNameCompareDatatypeNameSet
 A set of data-types sorted by name.
 

Enumerations

enum  type_metatype {
  TYPE_VOID = 10, TYPE_SPACEBASE = 9, TYPE_UNKNOWN = 8, TYPE_INT = 7,
  TYPE_UINT = 6, TYPE_BOOL = 5, TYPE_CODE = 4, TYPE_FLOAT = 3,
  TYPE_PTR = 2, TYPE_ARRAY = 1, TYPE_STRUCT = 0
}
 

Functions

void print_data (ostream &s, uint1 *buffer, int4 size, const Address &baseaddr)
 Print a hex dump of a data buffer to stream. More...
 
void metatype2string (type_metatype metatype, string &res)
 Convert type meta-type to name. More...
 
type_metatype string2metatype (const string &metastring)
 Convert string to type meta-type. More...
 

Detailed Description

Classes for describing and printing data-types.

Enumeration Type Documentation

◆ type_metatype

The core meta-types supported by the decompiler. These are sizeless templates for the elements making up the type algebra. Ordering is important: The lower the number, the more specific the type, in calculations involving the generality of a type.

Enumerator
TYPE_VOID 

Standard "void" type, absence of type.

TYPE_SPACEBASE 

Placeholder for symbol/type look-up calculations.

TYPE_UNKNOWN 

An unknown low-level type. Treated as an unsigned integer.

TYPE_INT 

Signed integer. Signed is considered less specific than unsigned in C.

TYPE_UINT 

Unsigned integer.

TYPE_BOOL 

Boolean.

TYPE_CODE 

Data is actual executable code.

TYPE_FLOAT 

Floating-point.

TYPE_PTR 

Pointer data-type.

TYPE_ARRAY 

Array data-type, made up of a sequence of "element" datatype.

TYPE_STRUCT 

Structure data-type, made up of component datatypes.

Function Documentation

◆ metatype2string()

void metatype2string ( type_metatype  metatype,
string &  res 
)

Convert type meta-type to name.

Convert a type meta-type into the string name of the meta-type

Parameters
metatypeis the encoded type meta-type
reswill hold the resulting string

References TYPE_ARRAY, TYPE_BOOL, TYPE_CODE, TYPE_FLOAT, TYPE_INT, TYPE_PTR, TYPE_SPACEBASE, TYPE_STRUCT, TYPE_UINT, TYPE_UNKNOWN, and TYPE_VOID.

Referenced by Datatype::saveXmlBasic().

◆ print_data()

void print_data ( ostream &  s,
uint1 *  buffer,
int4  size,
const Address baseaddr 
)

Print a hex dump of a data buffer to stream.

Display an array of bytes as a hex dump at a given address. Each line displays an address and 16 bytes in hexadecimal

Parameters
sis the stream to write to
bufferis a pointer to the bytes
sizeis the number of bytes
baseaddris the address of the first byte in the buffer

References Address::getOffset().

◆ string2metatype()

type_metatype string2metatype ( const string &  metastring)

Convert string to type meta-type.

Given a string description of a type meta-type. Return the meta-type.

Parameters
metastringis the description of the meta-type
Returns
the encoded type meta-type

References TYPE_ARRAY, TYPE_BOOL, TYPE_CODE, TYPE_FLOAT, TYPE_INT, TYPE_PTR, TYPE_SPACEBASE, TYPE_STRUCT, TYPE_UINT, TYPE_UNKNOWN, and TYPE_VOID.

Referenced by ParamEntry::restoreXml(), Datatype::restoreXmlBasic(), and TypeFactory::restoreXmlTypeNoRef().