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

◆ create_typedef() [1/2]

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 7159 of file hexrays.hpp.

References hexdsp.

◆ create_typedef() [2/2]

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 755 of file hexrays.hpp.

◆ dummy_ptrtype()

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 7137 of file hexrays.hpp.

References hexdsp.

◆ get_float_type()

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 7113 of file hexrays.hpp.

References hexdsp.

◆ get_int_type_by_width_and_sign()

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 7121 of file hexrays.hpp.

References hexdsp.

◆ get_member_type()

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 7145 of file hexrays.hpp.

References hexdsp.

◆ get_type()

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 7167 of file hexrays.hpp.

References hexdsp.

◆ get_unk_type()

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 7129 of file hexrays.hpp.

References hexdsp.

◆ is_bool_type()

bool is_bool_type ( const tinfo_t &  type)

Is a boolean type?

Returns
true if the type is a boolean type

Definition at line 7101 of file hexrays.hpp.

References hexdsp.

◆ is_nonbool_type()

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 7095 of file hexrays.hpp.

References hexdsp.

◆ is_small_struni()

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 7089 of file hexrays.hpp.

References hexdsp.

◆ is_type_correct()

bool is_type_correct ( const type_t *  ptr)

Verify a type string.

Returns
true if type string is correct

Definition at line 7083 of file hexrays.hpp.

References hexdsp.

◆ make_pointer()

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 7151 of file hexrays.hpp.

References hexdsp.

◆ partial_type_num()

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 7107 of file hexrays.hpp.

References hexdsp.

◆ set_type()

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 7173 of file hexrays.hpp.

References hexdsp.