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_DONTREF = 0x2000000 , TS_MASK = 0xE000000 } |
Type source (where the type information comes from) More... | |
Functions | |
const char * | dstr (const tinfo_t *tif) |
Print the specified type info. More... | |
bool | is_type_correct (const type_t *ptr) |
Verify a type string. More... | |
bool | is_small_udt (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... | |
THREAD_SAFE bool | is_ptr_or_array (type_t t) |
Is a pointer or array type? More... | |
THREAD_SAFE bool | is_paf (type_t t) |
Is a pointer, array, or function type? More... | |
THREAD_SAFE bool | is_inplace_def (const tinfo_t &type) |
Is struct/union/enum definition (not declaration)? More... | |
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... | |
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.
Enumeration Type Documentation
◆ type_source_t
enum type_source_t |
Type source (where the type information comes from)
Definition at line 1038 of file hexrays.hpp.
Function Documentation
◆ create_typedef() [1/2]
tinfo_t create_typedef | ( | const char * | name | ) |
Create a reference to a named type.
- Parameters
-
name type 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 9968 of file hexrays.hpp.
◆ create_typedef() [2/2]
tinfo_t create_typedef | ( | int | n | ) |
Create a reference to an ordinal type.
- Parameters
-
n ordinal number of the type
- Returns
- type which refers to the specified ordinal. For example, if n is 1, the type info which refers to ordinal type 1 is created.
Definition at line 1030 of file hexrays.hpp.
◆ dstr()
const char * dstr | ( | const tinfo_t * | tif | ) |
Print the specified type info.
This function can be used from a debugger by typing "tif->dstr()"
- Examples
- hexrays_sample18.cpp.
Definition at line 9886 of file hexrays.hpp.
◆ dummy_ptrtype()
tinfo_t dummy_ptrtype | ( | int | ptrsize, |
bool | isfp | ||
) |
Generate a dummy pointer type.
- Parameters
-
ptrsize size of pointed object isfp is floating point object?
Definition at line 9946 of file hexrays.hpp.
◆ 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
-
width width of the desired type
Definition at line 9922 of file hexrays.hpp.
◆ 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
-
srcwidth size of the type in bytes sign sign of the type
Definition at line 9930 of file hexrays.hpp.
◆ 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
-
mptr structure field type pointer to the variable where the type is returned. This parameter can be nullptr.
- Returns
- false if failed
Definition at line 9954 of file hexrays.hpp.
◆ 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
-
id address or id of the object tif buffer for the answer guess what kind of types to consider
- Returns
- success
Definition at line 9976 of file hexrays.hpp.
◆ 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
-
size size of the type in bytes
Definition at line 9938 of file hexrays.hpp.
◆ 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 9910 of file hexrays.hpp.
◆ is_inplace_def()
THREAD_SAFE bool is_inplace_def | ( | const tinfo_t & | type | ) |
Is struct/union/enum definition (not declaration)?
Definition at line 959 of file hexrays.hpp.
◆ 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 9904 of file hexrays.hpp.
◆ is_paf()
THREAD_SAFE bool is_paf | ( | type_t | t | ) |
Is a pointer, array, or function type?
Definition at line 953 of file hexrays.hpp.
References is_ptr_or_array().
◆ is_ptr_or_array()
THREAD_SAFE bool is_ptr_or_array | ( | type_t | t | ) |
◆ is_small_udt()
bool is_small_udt | ( | 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 9898 of file hexrays.hpp.
◆ 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 9892 of file hexrays.hpp.
◆ make_pointer()
tinfo_t make_pointer | ( | const tinfo_t & | type | ) |
Create a pointer type.
This function performs the following conversion: "type" -> "type*"
- Parameters
-
type object type.
- Returns
- "type*". for example, if 'char' is passed as the argument,
Definition at line 9960 of file hexrays.hpp.
◆ 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 9916 of file hexrays.hpp.
◆ set_type()
bool set_type | ( | uval_t | id, |
const tinfo_t & | tif, | ||
type_source_t | source, | ||
bool | force = false |
||
) |
Set a global type.
- Parameters
-
id address or id of the object tif new type info source where the type comes from force true 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 9982 of file hexrays.hpp.