Enumerations | Functions
Type string related declarations

Type related functions and class. More...

Enumerations

enum  type_source_t {
  GUESSED_NONE, GUESSED_WEAK, GUESSED_FUNC, GUESSED_DATA,
  TS_NOELL = 0x8000000, TS_SHRINK = 0x4000000, TS_MASK = 0xC000000
}
 Type source (where the type information comes from)
 

Functions

bool is_type_correct (const type_t *ptr)
 Verify a type string. More...
 
bool is_small_struni (const tinfo_t &tif)
 Is a small structure or union? More...
 
bool is_nonbool_type (const tinfo_t &type)
 Is definitely a non-boolean type? More...
 
bool is_bool_type (const tinfo_t &type)
 Is a boolean type? More...
 
bool is_ptr_or_array (type_t t)
 Is a pointer or array type?
 
bool is_paf (type_t t)
 Is a pointer, array, or function type?
 
bool is_inplace_def (const tinfo_t &type)
 Is struct/union/enum definition (not declaration)?
 
int partial_type_num (const tinfo_t &type)
 Calculate number of partial subtypes. More...
 
tinfo_t get_float_type (int width)
 Get a type of a floating point value with the specified width. More...
 
tinfo_t get_int_type_by_width_and_sign (int srcwidth, type_sign_t sign)
 Create a type info by width and sign. More...
 
tinfo_t get_unk_type (int size)
 Create a partial type info by width. More...
 
tinfo_t dummy_ptrtype (int ptrsize, bool isfp)
 Generate a dummy pointer type. More...
 
bool get_member_type (const member_t *mptr, tinfo_t *type)
 Get type of a structure field. More...
 
tinfo_t make_pointer (const tinfo_t &type)
 Create a pointer type. More...
 
tinfo_t create_typedef (const char *name)
 Create a reference to a named type. More...
 
tinfo_t create_typedef (int n)
 Create a reference to an ordinal type. More...
 
int compare_typsrc (type_source_t s1, type_source_t s2)
 
bool get_type (uval_t id, tinfo_t *tif, type_source_t guess)
 Get a global type. More...
 
bool set_type (uval_t id, const tinfo_t &tif, type_source_t source, bool force=false)
 Set a global type. More...
 

Detailed Description

Type related functions and class.

Function Documentation

tinfo_t create_typedef ( const char *  name)

Create a reference to a named type.

Parameters
nametype name
Returns
type which refers to the specified name. For example, if name is "DWORD", the type info which refers to "DWORD" is created.

Definition at line 4632 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

tinfo_t create_typedef ( int  n)

Create a reference to an ordinal type.

Parameters
nordinal number of the type
Returns
type which refers to the specified ordianl. For example, if n is 1, the type info which refers to ordinal type 1 is created.

Definition at line 319 of file hexrays.hpp.

tinfo_t dummy_ptrtype ( int  ptrsize,
bool  isfp 
)

Generate a dummy pointer type.

Parameters
ptrsizesize of pointed object
isfpis floating point object?

Definition at line 4610 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

tinfo_t get_float_type ( int  width)

Get a type of a floating point value with the specified width.

Returns
type info object
Parameters
widthwidth of the desired type

Definition at line 4586 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

tinfo_t get_int_type_by_width_and_sign ( int  srcwidth,
type_sign_t  sign 
)

Create a type info by width and sign.

Returns a simple type (examples: int, short) with the given width and sign.

Parameters
srcwidthsize of the type in bytes
signsign of the type

Definition at line 4594 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

bool get_member_type ( const member_t *  mptr,
tinfo_t *  type 
)

Get type of a structure field.

This function performs validity checks of the field type. Wrong types are rejected.

Parameters
mptrstructure field
typepointer to the variable where the type is returned. This parameter can be NULL.
Returns
false if failed

Definition at line 4618 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

bool get_type ( uval_t  id,
tinfo_t *  tif,
type_source_t  guess 
)

Get a global type.

Global types are types of addressable objects and struct/union/enum types

Parameters
idaddress or id of the object
tifbuffer for the answer
guesswhat kind of types to consider
Returns
success

Definition at line 4640 of file hexrays.hpp.

References hexdsp.

tinfo_t get_unk_type ( int  size)

Create a partial type info by width.

Returns a partially defined type (examples: _DWORD, _BYTE) with the given width.

Parameters
sizesize of the type in bytes

Definition at line 4602 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

bool is_bool_type ( const tinfo_t &  type)

Is a boolean type?

Returns
true if the type is a boolean type

Definition at line 4574 of file hexrays.hpp.

References hexdsp.

Referenced by qstring_printer_t::qstring_printer_t().

bool is_nonbool_type ( const tinfo_t &  type)

Is definitely a non-boolean type?

Returns
true if the type is a non-boolean type (non bool and well defined)

Definition at line 4568 of file hexrays.hpp.

References hexdsp.

Referenced by qstring_printer_t::qstring_printer_t().

bool is_small_struni ( const tinfo_t &  tif)

Is a small structure or union?

Returns
true if the type is a small UDT (user defined type). Small UDTs fit into a register (or pair or registers) as a rule.

Definition at line 4562 of file hexrays.hpp.

References hexdsp.

Referenced by qstring_printer_t::qstring_printer_t().

bool is_type_correct ( const type_t *  ptr)

Verify a type string.

Returns
true if type string is correct

Definition at line 4556 of file hexrays.hpp.

References hexdsp.

Referenced by qstring_printer_t::qstring_printer_t().

tinfo_t make_pointer ( const tinfo_t &  type)

Create a pointer type.

This function performs the following conversion: "type" -> "type*"

Parameters
typeobject type.
Returns
"type*". for example, if 'char' is passed as the argument,

Definition at line 4624 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

int partial_type_num ( const tinfo_t &  type)

Calculate number of partial subtypes.

Returns
number of partial subtypes. The bigger is this number, the uglier is the type.

Definition at line 4580 of file hexrays.hpp.

References hexdsp.

Referenced by is_inplace_def().

bool set_type ( uval_t  id,
const tinfo_t &  tif,
type_source_t  source,
bool  force = false 
)

Set a global type.

Parameters
idaddress or id of the object
tifnew type info
sourcewhere the type comes from
forcetrue means to set the type as is, false means to merge the new type with the possibly existing old type info.
Returns
success

Definition at line 4646 of file hexrays.hpp.

References hexdsp.