IDA C++ SDK 9.2
Loading...
Searching...
No Matches
typeinf.hpp File Reference

Type information in IDA. More...

Go to the source code of this file.

Classes

struct  type_attr_t
struct  til_t
 Type Information Library. More...
struct  rrel_t
 Register-relative argument location. More...
struct  custloc_desc_t
 Description of a custom argloc. More...
class  argloc_t
 Describes an argument location. More...
struct  argpart_t
 Subsection of an argument location. More...
class  scattered_aloc_t
 Used to manage arguments that are described by multiple locations (also see ALOC_DIST) More...
struct  aloc_visitor_t
 Visit all argument locations. More...
struct  const_aloc_visitor_t
 Same as aloc_visitor_t, but may not modify the argloc. More...
struct  stkarg_area_info_t
struct  custom_callcnv_t
 Description of a custom calling convention. More...
class  callregs_t
 Register allocation calling convention. More...
class  tinfo_t
 Primary mechanism for managing type information. More...
struct  simd_info_t
 SIMD type info. More...
struct  ptr_type_data_t
 Pointer type information (see tinfo_t::get_ptr_details()) More...
struct  array_type_data_t
 Array type information (see tinfo_t::get_array_details()) More...
struct  funcarg_t
 Information about a single function argument. More...
struct  func_type_data_t
 Function type information (see tinfo_t::get_func_details()) More...
struct  edm_t
 This structure describes an enum value. More...
struct  enum_type_data_t
 Enum type information (see tinfo_t::get_enum_details()) More...
struct  typedef_type_data_t
 Type information for typedefs. More...
struct  custom_data_type_info_t
struct  value_repr_t
 Visual representation of a member of a complex type (struct/union/enum) More...
struct  udm_t
 An object to represent struct or union members. More...
struct  udtmembervec_t
 vector of udt member objects More...
struct  udt_type_data_t
struct  udm_visitor_t
struct  bitfield_type_data_t
 Bitfield type information (see tinfo_t::get_bitfield_details()) More...
struct  type_mods_t
 Information about how to modify the current type, used by tinfo_visitor_t. More...
struct  tinfo_visitor_t
 Visit all subtypes of a type. Derive your visitor from this class and use apply_to() More...
struct  regobj_t
 Object that represents a register. More...
struct  regobjs_t
struct  argtinfo_helper_t
class  lowertype_helper_t
 Interface class - see ida_lowertype_helper_t. More...
class  ida_lowertype_helper_t
 An implementation of lowertype_helper_t that has access to the IDB, and thus can help spot holes in the stack arguments. More...
struct  format_data_info_t
 See format_cdata() More...
struct  valinfo_t
 Additional information about the output lines. More...
class  valstr_t
 Text representation of a data value (value string). More...
struct  valstrs_t
 Collection of value strings. More...
struct  text_sink_t
 Flush formatted text. More...
struct  til_symbol_t
 A symbol in a type library. More...
struct  predicate_t
 Helper class for choose_named_type(). More...
struct  til_type_ref_t

Typedefs

typedef uchar p_string
 Inside a type string, a pascal-like string: dt length, characters.
typedef uint64 bmask64_t
 unsigned value that describes a bitmask
typedef uchar bte_t
 Enum type flags.
typedef qvector< type_attr_ttype_attrs_t
 this vector must be sorted by keys
typedef int type_sign_t
 type signedness
typedef qvector< argloc_targlocs_t
 vector of argument locations
typedef qvector< argpart_targpartvec_t
typedef qvector< comp_tcompvec_t
 Collection of compiler descriptions.
typedef int idaapi h2ti_type_cb(const char *name, const tinfo_t &tif, const char *cmt, const uint64 *value, void *cb_data)
 This callback will be called for each type/variable declaration.
typedef idaman int ida_export h2ti(til_t *ti, lexer_t *lx, const char *input, int flags=HTI_HIGH, h2ti_type_cb *type_cb=nullptr, h2ti_type_cb *var_cb=nullptr, printer_t *print_cb=nullptr, void *_cb_data=nullptr, abs_t _isabs=ABS_UNK)
 Convert declarations to type_t*.
typedef uint64 typid_t
typedef qvector< tinfo_ttinfovec_t
 vector of tinfo objects
typedef qvector< simd_info_tsimd_info_vec_t
typedef qvector< funcarg_tfuncargvec_t
 vector of function argument objects
typedef qvector< edm_tedmvec_t
 vector of enum values.
typedef qvector< regobj_tregobjvec_t
typedef qvector< valstr_tvalstrvec_t
typedef qvector< uint32ordvec_t
typedef int idaapi local_tinfo_predicate_t(uint32 ord, const tinfo_t &type, void *ud)
 Controls which types are displayed/selected when choosing local types.
using enum_type_visitor_t = std::function<ssize_t(const struct enum_type_data_t &ei, size_t idx, uint64 value, uint64 bmask)>
 Callback for visit_edms.

Enumerations

enum  argreg_policy_t {
  ARGREGS_POLICY_UNDEFINED , ARGREGS_GP_ONLY , ARGREGS_INDEPENDENT , ARGREGS_BY_SLOTS ,
  ARGREGS_FP_MASKS_GP , ARGREGS_MIPS_O32 , ARGREGS_RISCV
}
 Function argument passing: how GP & FP registers cooperate with each other. More...
enum  abs_t { ABS_UNK , ABS_NO , ABS_YES }
 abstractness of declaration (see h2ti()) More...
enum  sclass_t {
  SC_UNK = 0 , SC_TYPE = 1 , SC_EXT = 2 , SC_STAT = 3 ,
  SC_REG = 4 , SC_AUTO = 5 , SC_FRIEND = 6 , SC_VIRT = 7
}
 < storage class More...
enum  tinfo_code_t {
  TERR_OK = 0 , TERR_SAVE_ERROR = -1 , TERR_SERIALIZE = -2 , TERR_BAD_NAME = -3 ,
  TERR_BAD_ARG = -4 , TERR_BAD_TYPE = -5 , TERR_BAD_SIZE = -6 , TERR_BAD_INDEX = -7 ,
  TERR_BAD_ARRAY = -8 , TERR_BAD_BF = -9 , TERR_BAD_OFFSET = -10 , TERR_BAD_UNIVAR = -11 ,
  TERR_BAD_VARLAST = -12 , TERR_OVERLAP = -13 , TERR_BAD_SUBTYPE = -14 , TERR_BAD_VALUE = -15 ,
  TERR_NO_BMASK = -16 , TERR_BAD_BMASK = -17 , TERR_BAD_MSKVAL = -18 , TERR_BAD_REPR = -19 ,
  TERR_GRP_NOEMPTY = -20 , TERR_DUPNAME = -21 , TERR_UNION_BF = -22 , TERR_BAD_TAH = -23 ,
  TERR_BAD_BASE = -24 , TERR_BAD_GAP = -25 , TERR_NESTED = -26 , TERR_NOT_COMPAT = -27 ,
  TERR_BAD_LAYOUT = -28 , TERR_BAD_GROUPS = -29 , TERR_BAD_SERIAL = -30 , TERR_ALIEN_NAME = -31 ,
  TERR_STOCK = -32 , TERR_ENUM_SIZE = -33 , TERR_NOT_IMPL = -34 , TERR_TYPE_WORSE = -35 ,
  TERR_BAD_FX_SIZE = -36 , TERR_STRUCT_SIZE = -37 , TERR_NOT_FOUND = -38 , TERR_COUNT = 39
}
 Error codes various tinfo functions: More...
enum  stock_type_id_t {
  STI_PCHAR , STI_PUCHAR , STI_PCCHAR , STI_PCUCHAR ,
  STI_PBYTE , STI_PINT , STI_PUINT , STI_PVOID ,
  STI_PPVOID , STI_PCVOID , STI_ACHAR , STI_AUCHAR ,
  STI_ACCHAR , STI_ACUCHAR , STI_FPURGING , STI_FDELOP ,
  STI_MSGSEND , STI_AEABI_LCMP , STI_AEABI_ULCMP , STI_DONT_USE ,
  STI_SIZE_T , STI_SSIZE_T , STI_AEABI_MEMCPY , STI_AEABI_MEMSET ,
  STI_AEABI_MEMCLR , STI_RTC_CHECK_2 , STI_RTC_CHECK_4 , STI_RTC_CHECK_8 ,
  STI_COMPLEX64 , STI_COMPLEX128 , STI_PUNKNOWN , STI_LAST
}
 IDs for common types. More...
enum  etf_flag_t : uint {
  ETF_NO_SAVE = 0x00000001 , ETF_NO_LAYOUT = 0x00000002 , ETF_MAY_DESTROY = 0x00000004 , ETF_COMPATIBLE = 0x00000008 ,
  ETF_FUNCARG = 0x00000010 , ETF_FORCENAME = 0x00000020 , ETF_AUTONAME = 0x00000040 , ETF_BYTIL = 0x00000080 ,
  ETF_NO_ARRAY = 0x00000100
}
enum  gtd_udt_t { GTD_CALC_LAYOUT = 0 , GTD_NO_LAYOUT = BTM_VOLATILE , GTD_DEL_BITFLDS = BTM_CONST }
 Constants to be used with get_udt_details() More...
enum  gtd_func_t { GTD_CALC_ARGLOCS = 0 , GTD_NO_ARGLOCS = BTM_VOLATILE }
 Constants to be used with get_func_details() More...
enum  gts_code_t { GTS_NESTED = 0x01 , GTS_BASECLASS = 0x02 }
 Constants to be used with get_size() More...
enum  format_functype_t { FMTFUNC_PRINTF , FMTFUNC_SCANF , FMTFUNC_STRFTIME , FMTFUNC_STRFMON }
 Function index for the 'format' attribute. More...
enum  update_type_t { UTP_ENUM , UTP_STRUCT }
 See begin_type_updating() More...

Functions

THREAD_SAFE bool is_type_const (type_t t)
 See BTM_CONST.
THREAD_SAFE bool is_type_volatile (type_t t)
 See BTM_VOLATILE.
THREAD_SAFE type_t get_base_type (type_t t)
 Get get basic type bits (TYPE_BASE_MASK)
THREAD_SAFE type_t get_type_flags (type_t t)
 Get type flags (TYPE_FLAGS_MASK)
THREAD_SAFE type_t get_full_type (type_t t)
 Get basic type bits + type flags (TYPE_FULL_MASK)
THREAD_SAFE bool is_typeid_last (type_t t)
 Is the type_t the last byte of type declaration?
THREAD_SAFE bool is_type_partial (type_t t)
 Identifies an unknown or void type with a known size (see Basic type: unknown & void)
THREAD_SAFE bool is_type_void (type_t t)
 See BTF_VOID.
THREAD_SAFE bool is_type_unknown (type_t t)
 See BT_UNKNOWN.
THREAD_SAFE bool is_type_ptr (type_t t)
 See BT_PTR.
THREAD_SAFE bool is_type_complex (type_t t)
 See BT_COMPLEX.
THREAD_SAFE bool is_type_func (type_t t)
 See BT_FUNC.
THREAD_SAFE bool is_type_array (type_t t)
 See BT_ARRAY.
THREAD_SAFE bool is_type_typedef (type_t t)
 See BTF_TYPEDEF.
THREAD_SAFE bool is_type_sue (type_t t)
 Is the type a struct/union/enum?
THREAD_SAFE bool is_type_struct (type_t t)
 See BTF_STRUCT.
THREAD_SAFE bool is_type_union (type_t t)
 See BTF_UNION.
THREAD_SAFE bool is_type_struni (type_t t)
 Is the type a struct or union?
THREAD_SAFE bool is_type_enum (type_t t)
 See BTF_ENUM.
THREAD_SAFE bool is_type_bitfld (type_t t)
 See BT_BITFIELD.
THREAD_SAFE bool is_type_int (type_t bt)
 Does the type_t specify one of the basic types in Basic type: integer?
THREAD_SAFE bool is_type_int128 (type_t t)
 Does the type specify a 128-bit value? (signed or unsigned, see Basic type: integer)
THREAD_SAFE bool is_type_int64 (type_t t)
 Does the type specify a 64-bit value? (signed or unsigned, see Basic type: integer)
THREAD_SAFE bool is_type_int32 (type_t t)
 Does the type specify a 32-bit value? (signed or unsigned, see Basic type: integer)
THREAD_SAFE bool is_type_int16 (type_t t)
 Does the type specify a 16-bit value? (signed or unsigned, see Basic type: integer)
THREAD_SAFE bool is_type_char (type_t t)
 Does the type specify a char value? (signed or unsigned, see Basic type: integer)
THREAD_SAFE bool is_type_paf (type_t t)
 Is the type a pointer, array, or function type?
THREAD_SAFE bool is_type_ptr_or_array (type_t t)
 Is the type a pointer or array type?
THREAD_SAFE bool is_type_floating (type_t t)
 Is the type a floating point type?
THREAD_SAFE bool is_type_integral (type_t t)
 Is the type an integral type (char/short/int/long/bool)?
THREAD_SAFE bool is_type_ext_integral (type_t t)
 Is the type an extended integral type? (integral or enum)
THREAD_SAFE bool is_type_arithmetic (type_t t)
 Is the type an arithmetic type? (floating or integral)
THREAD_SAFE bool is_type_ext_arithmetic (type_t t)
 Is the type an extended arithmetic type? (arithmetic or enum)
THREAD_SAFE bool is_type_uint (type_t t)
 See BTF_UINT.
THREAD_SAFE bool is_type_uchar (type_t t)
 See BTF_UCHAR.
THREAD_SAFE bool is_type_uint16 (type_t t)
 See BTF_UINT16.
THREAD_SAFE bool is_type_uint32 (type_t t)
 See BTF_UINT32.
THREAD_SAFE bool is_type_uint64 (type_t t)
 See BTF_UINT64.
THREAD_SAFE bool is_type_uint128 (type_t t)
 See BTF_UINT128.
THREAD_SAFE bool is_type_ldouble (type_t t)
 See BTF_LDOUBLE.
THREAD_SAFE bool is_type_double (type_t t)
 See BTF_DOUBLE.
THREAD_SAFE bool is_type_float (type_t t)
 See BTF_FLOAT.
THREAD_SAFE bool is_type_tbyte (type_t t)
 See BTF_FLOAT.
THREAD_SAFE bool is_type_bool (type_t t)
 See BTF_BOOL.
THREAD_SAFE bool is_tah_byte (type_t t)
 The TAH byte (type attribute header byte) denotes the start of type attributes.
THREAD_SAFE bool is_sdacl_byte (type_t t)
 Identify an sdacl byte.
THREAD_SAFE bool operator< (const bytevec_t &v1, const bytevec_t &v2)
 Compare two bytevecs with '<'.
 DECLARE_TYPE_AS_MOVABLE (type_attr_t)
idaman bool ida_export append_argloc (qtype *out, const argloc_t &vloc)
 Serialize argument location.
idaman bool ida_export extract_argloc (argloc_t *vloc, const type_t **ptype, bool forbid_stkoff)
 Deserialize an argument location.
idaman const type_t *ida_export resolve_typedef (const til_t *til, const type_t *type)
bool is_restype_void (const til_t *til, const type_t *type)
bool is_restype_enum (const til_t *til, const type_t *type)
bool is_restype_struni (const til_t *til, const type_t *type)
bool is_restype_struct (const til_t *til, const type_t *type)
idaman type_t ida_export get_scalar_bt (int size)
idaman til_t *ida_export new_til (const char *name, const char *desc)
 Initialize a til.
idaman int ida_export add_base_tils (qstring *errbuf, til_t *ti, const char *tildir, const char *bases, bool gen_events)
 Add multiple base tils.
idaman til_t *ida_export load_til (const char *name, qstring *errbuf, const char *tildir=nullptr)
 Load til from a file without adding it to the database list (see also add_til).
idaman bool ida_export sort_til (til_t *ti)
 Sort til (use after modifying it).
idaman bool ida_export compact_til (til_t *ti)
 Collect garbage in til.
idaman bool ida_export store_til (til_t *ti, const char *tildir, const char *name)
 Store til to a file.
idaman void ida_export free_til (til_t *ti)
 Free memory allocated by til.
idaman til_t *ida_export load_til_header (const char *tildir, const char *name, qstring *errbuf)
 Get human-readable til description.
THREAD_SAFE bool is_code_far (cm_t cm)
 Does the given model specify far code?.
THREAD_SAFE bool is_data_far (cm_t cm)
 Does the given model specify far data?.
idaman int ida_export install_custom_argloc (const custloc_desc_t *custloc)
 Save a custom argloc.
idaman bool ida_export remove_custom_argloc (int idx)
 Delete the custom argloc at the given index.
idaman const custloc_desc_t *ida_export retrieve_custom_argloc (int idx)
 Retrieve the custom argloc at the given index.
 DECLARE_TYPE_AS_MOVABLE (argloc_t)
 DECLARE_TYPE_AS_MOVABLE (argpart_t)
 DECLARE_TYPE_AS_MOVABLE (scattered_aloc_t)
idaman int ida_export verify_argloc (const argloc_t &vloc, int size, const rangeset_t *gaps)
 Verify argloc_t.
idaman bool ida_export optimize_argloc (argloc_t *vloc, int size, const rangeset_t *gaps)
 Verify and optimize scattered argloc into simple form.
idaman size_t ida_export print_argloc (char *buf, size_t bufsize, const argloc_t &vloc, int size=0, int vflags=0)
 Convert an argloc to human readable form.
idaman int ida_export for_all_arglocs (aloc_visitor_t &vv, argloc_t &vloc, int size, int off=0)
 Compress larger argloc types and initiate the aloc visitor.
int idaapi for_all_const_arglocs (const_aloc_visitor_t &vv, const argloc_t &vloc, int size, int off=0)
 See for_all_arglocs()
callcnv_t helper_get_cc (cm_t cm, callcnv_t new_callcnv)
void helper_set_cc (cm_t *cm, callcnv_t *new_callcnv, callcnv_t cc)
callcnv_t get_effective_cc (callcnv_t cc)
 Get effective calling convention (with respect to default CC)
constexpr THREAD_SAFE bool is_user_cc (callcnv_t cc)
 Does the calling convention specify argument locations explicitly?
constexpr THREAD_SAFE bool is_vararg_cc (callcnv_t cc)
 Does the calling convention use ellipsis?
constexpr THREAD_SAFE bool is_purging_cc (callcnv_t cc)
 Does the calling convention clean the stack arguments upon return?
constexpr bool is_golang_cc (callcnv_t cc)
 GO language calling convention (return value in stack)?
bool is_custom_callcnv (callcnv_t cc)
 Is custom calling convention?
constexpr bool is_swift_cc (callcnv_t cc)
 Swift calling convention (arguments and return values in registers)?
idaman bool ida_export get_stkarg_area_info (stkarg_area_info_t *out, callcnv_t cc)
 Some calling conventions foresee special areas on the stack for call arguments.
 DECLARE_TYPE_AS_MOVABLE (custom_callcnv_t)
idaman callcnv_t ida_export register_custom_callcnv (const custom_callcnv_t &ccinf)
 Register a calling convention.
idaman bool ida_export unregister_custom_callcnv (callcnv_t callcnv)
 Unregister a calling convention.
idaman const custom_callcnv_t *ida_export get_custom_callcnv (callcnv_t callcnv)
 Retrieve custom calling convention details.
idaman callcnv_t ida_export find_custom_callcnv (const char *name)
 Find a calling convention by its name.
idaman size_t ida_export get_custom_callcnvs (qstrvec_t *names, callcnvs_t *codes)
 Get all custom calling conventions.
THREAD_SAFE comp_t get_comp (comp_t comp)
 Get compiler bits.
idaman const char *ida_export get_compiler_name (comp_t id)
 Get full compiler name.
idaman const char *ida_export get_compiler_abbr (comp_t id)
 Get abbreviated compiler name.
idaman void ida_export get_compilers (compvec_t *ids, qstrvec_t *names, qstrvec_t *abbrs)
 Get names of all built-in compilers.
THREAD_SAFE comp_t is_comp_unsure (comp_t comp)
 See COMP_UNSURE.
comp_t default_compiler ()
 Get compiler specified by inf.cc.
bool is_gcc ()
 Is the target compiler COMP_GNU?
bool is_gcc32 ()
 Is the target compiler 32 bit gcc?
bool is_gcc64 ()
 Is the target compiler 64 bit gcc?
bool gcc_layout ()
 Should use the struct/union layout as done by gcc?
idaman bool ida_export set_compiler (const compiler_info_t &cc, int flags, const char *abiname=nullptr)
 Change current compiler.
bool idaapi set_compiler_id (comp_t id, const char *abiname=nullptr)
 Set the compiler id (see Compiler IDs)
bool idaapi set_abi_name (const char *abiname, bool user_level=false)
 Set abi name (see Compiler IDs)
idaman ssize_t ida_export get_abi_name (qstring *out)
 Get ABI name.
idaman bool ida_export append_abi_opts (const char *abi_opts, bool user_level=false)
 Add/remove/check ABI option General form of full abi name: abiname-opt1-opt2-... or -opt1-opt2-...
idaman bool ida_export remove_abi_opts (const char *abi_opts, bool user_level=false)
idaman bool ida_export set_compiler_string (const char *compstr, bool user_level)
bool use_golang_cc ()
 is GOLANG calling convention used by default?
void switch_to_golang ()
 switch to GOLANG calling convention (to be used as default CC)
typedef AS_PRINTF (1, 2) int printer_t(const char *format
 Specify a printing callback when parsing types.
THREAD_SAFE int convert_pt_flags_to_hti (int pt_flags)
 Convert Type parsing flags to Type formatting flags.
idaman bool ida_export parse_decl (tinfo_t *out_tif, qstring *out_name, til_t *til, const char *decl, int pt_flags)
 Parse ONE declaration.
idaman int ida_export parse_decls (til_t *til, const char *input, printer_t *printer, int hti_flags)
 Parse many declarations and store them in a til.
idaman bool ida_export print_type (qstring *out, ea_t ea, int prtype_flags)
 Get type declaration for the specified address.
idaman int ida_export get_named_type (const til_t *ti, const char *name, int ntf_flags, const type_t **type=nullptr, const p_list **fields=nullptr, const char **cmt=nullptr, const p_list **fieldcmts=nullptr, sclass_t *sclass=nullptr, uint32 *value=nullptr)
 Get named typeinfo.
int idaapi get_named_type64 (const til_t *ti, const char *name, int ntf_flags, const type_t **type=nullptr, const p_list **fields=nullptr, const char **cmt=nullptr, const p_list **fieldcmts=nullptr, sclass_t *sclass=nullptr, uint64 *value=nullptr)
 See get_named_type() above.
idaman const char *ida_export tinfo_errstr (tinfo_code_t code)
 Helper function to convert an error code into a printable string.
idaman bool ida_export del_named_type (til_t *ti, const char *name, int ntf_flags)
 Delete information about a symbol.
idaman const char *ida_export first_named_type (const til_t *ti, int ntf_flags)
 Enumerate types.
idaman const char *ida_export next_named_type (const til_t *ti, const char *name, int ntf_flags)
 Enumerate types.
idaman uint32 ida_export copy_named_type (til_t *dsttil, const til_t *srctil, const char *name)
 Copy a named type from one til to another.
idaman bool ida_export decorate_name (qstring *out, const char *name, bool should_decorate, callcnv_t cc=CM_CC_UNKNOWN, const tinfo_t *type=nullptr)
 Decorate/undecorate a C symbol name.
idaman bool ida_export gen_decorate_name (qstring *out, const char *name, bool should_decorate, callcnv_t cc, const tinfo_t *type)
 Generic function for decorate_name() (may be used in IDP modules)
idaman ssize_t ida_export calc_c_cpp_name (qstring *out, const char *name, const tinfo_t *type, int ccn_flags)
 Get C or C++ form of the name.
idaman bool ida_export enable_numbered_types (til_t *ti, bool enable)
 Enable the use of numbered types in til.
idaman bool ida_export get_numbered_type (const til_t *ti, uint32 ordinal, const type_t **type=nullptr, const p_list **fields=nullptr, const char **cmt=nullptr, const p_list **fieldcmts=nullptr, sclass_t *sclass=nullptr)
 Retrieve a type by its ordinal number.
idaman uint32 ida_export alloc_type_ordinals (til_t *ti, int qty)
 Allocate a range of ordinal numbers for new types.
uint32 alloc_type_ordinal (til_t *ti)
 alloc_type_ordinals(ti, 1)
idaman uint32 ida_export get_ordinal_limit (const til_t *ti=nullptr)
 Get number of allocated ordinals + 1.
uint32 get_ordinal_count (const til_t *ti=nullptr)
 Get number of allocated ordinals.
idaman bool ida_export del_numbered_type (til_t *ti, uint32 ordinal)
 Delete a numbered type.
idaman bool ida_export set_type_alias (til_t *ti, uint32 src_ordinal, uint32 dst_ordinal)
 Create a type alias.
idaman uint32 ida_export get_alias_target (const til_t *ti, uint32 ordinal)
 Find the final alias destination.
idaman int32 ida_export get_type_ordinal (const til_t *ti, const char *name)
 Get type ordinal by its name.
idaman const char *ida_export get_numbered_type_name (const til_t *ti, uint32 ordinal)
 Get type name (if exists) by its ordinal.
idaman ssize_t ida_export create_numbered_type_name (qstring *buf, int32 ord)
 Create anonymous name for numbered type.
idaman bool ida_export is_ordinal_name (const char *name, uint32 *ord=nullptr)
 Check if the name is an ordinal name.
idaman void ida_export build_anon_type_name (qstring *buf, const type_t *type, const p_list *fields)
 Generate a name like $hex_numbers based on the field types and names.
idaman int ida_export compact_numbered_types (til_t *ti, uint32 min_ord=0, intvec_t *p_ordmap=nullptr, int flags=0)
 Compact numbered types to get rid of empty slots.
idaman bool ida_export is_type_choosable (const til_t *ti, uint32 ordinal)
 Check if a struct/union type is choosable.
idaman void ida_export set_type_choosable (til_t *ti, uint32 ordinal, bool value)
 Enable/disable 'choosability' flag for a struct/union type.
idaman ea_t ida_export get_vftable_ea (uint32 ordinal)
 Get address of a virtual function table.
idaman uint32 ida_export get_vftable_ordinal (ea_t vftable_ea)
 Get ordinal number of the virtual function table.
idaman bool ida_export set_vftable_ea (uint32 ordinal, ea_t vftable_ea)
 Set the address of a vftable instance for a vftable type.
bool del_vftable_ea (uint32 ordinal)
 Delete the address of a vftable instance for a vftable type.
size_t get_default_align ()
 Get default alignment for structure fields.
THREAD_SAFE void align_size (size_t &cur_tot_size, size_t elem_size, size_t algn)
 Get alignment delta for the a structure field.
idaman bool ida_export deref_ptr (ea_t *ptr_ea, const tinfo_t &tif, ea_t *closure_obj=nullptr)
 Dereference a pointer.
idaman bool ida_export remove_tinfo_pointer (tinfo_t *tif, const char **pname, const til_t *til=nullptr)
 Remove pointer of a type.
idaman int ida_export add_til (const char *name, int flags)
 Load a til file and add it the database type libraries list.
idaman bool ida_export del_til (const char *name)
 Unload a til file.
idaman bool ida_export apply_named_type (ea_t ea, const char *name)
 Apply the specified named type to the address.
idaman bool ida_export apply_tinfo (ea_t ea, const tinfo_t &tif, uint32 flags)
 Apply the specified type to the specified address.
idaman bool ida_export apply_cdecl (til_t *til, ea_t ea, const char *decl, int flags=0)
 Apply the specified type to the address.
idaman bool ida_export apply_callee_tinfo (ea_t caller, const tinfo_t &tif)
 Apply the type of the called function to the calling instruction.
idaman bool ida_export get_arg_addrs (eavec_t *out, ea_t caller)
 Retrieve argument initialization addresses.
idaman bool ida_export apply_once_tinfo_and_name (ea_t dea, const tinfo_t &tif, const char *name)
 Apply the specified type and name to the address.
idaman int ida_export guess_tinfo (tinfo_t *out, tid_t id)
 Generate a type information about the id from the disassembly.
void set_c_header_path (const char *incdir)
 Set include directory path the target compiler.
ssize_t get_c_header_path (qstring *buf)
 Get the include directory path of the target compiler.
void set_c_macros (const char *macros)
 Set predefined macros for the target compiler.
ssize_t get_c_macros (qstring *buf)
 Get predefined macros for the target compiler.
idaman til_t *ida_export get_idati ()
 Pointer to the local type library - this til is private for each IDB file Functions that accept til_t* default to idati when is nullptr provided.
idaman bool ida_export get_idainfo_by_type (size_t *out_size, flags64_t *out_flags, opinfo_t *out_mt, const tinfo_t &tif, size_t *out_alsize=nullptr)
 Extract information from a tinfo_t.
idaman bool ida_export get_tinfo_by_flags (tinfo_t *out, flags64_t flags)
 Get tinfo object that corresponds to data flags.
 DECLARE_TYPE_AS_MOVABLE (tinfo_t)
 DECLARE_TYPE_AS_MOVABLE (simd_info_t)
idaman callcnv_t ida_export guess_func_cc (const func_type_data_t &fti, int npurged, int cc_flags)
 Use func_type_data_t::guess_cc()
idaman bool ida_export dump_func_type_data (qstring *out, const func_type_data_t &fti, int praloc_bits)
 Use func_type_data_t::dump()
idaman bool ida_export calc_retloc (func_type_data_t *fti)
idaman bool ida_export calc_arglocs (func_type_data_t *fti)
idaman bool ida_export calc_varglocs (func_type_data_t *fti, regobjs_t *regs, relobj_t *stkargs, int nfixed)
 DECLARE_TYPE_AS_MOVABLE (ptr_type_data_t)
 DECLARE_TYPE_AS_MOVABLE (array_type_data_t)
 DECLARE_TYPE_AS_MOVABLE (funcarg_t)
 DECLARE_TYPE_AS_MOVABLE (edm_t)
 DECLARE_TYPE_AS_MOVABLE (enum_type_data_t)
 DECLARE_TYPE_AS_MOVABLE (typedef_type_data_t)
 DECLARE_TYPE_AS_MOVABLE (udm_t)
 DECLARE_TYPE_AS_MOVABLE (udt_type_data_t)
bool stroff_as_size (int plen, const tinfo_t &tif, asize_t value)
 Should display a structure offset expression as the structure size?
idaman int ida_export visit_stroff_udms (udm_visitor_t &sfv, const tid_t *path, int plen, adiff_t *disp, bool appzero)
 Visit structure fields in a stroff expression or in a reference to a struct data variable.
 DECLARE_TYPE_AS_MOVABLE (bitfield_type_data_t)
THREAD_SAFE bool is_one_bit_mask (uval_t mask)
 Is bitmask one bit?
bool inf_pack_stkargs (callcnv_t cc)
bool inf_big_arg_align (callcnv_t cc)
bool inf_huge_arg_align (callcnv_t cc)
int get_arg_align (int type_align, int slotsize, callcnv_t cc=CM_CC_UNKNOWN)
int get_arg_align (const tinfo_t &tif, int slotsize, callcnv_t cc=CM_CC_UNKNOWN)
sval_t align_stkarg_up (sval_t spoff, int type_align, int slotsize, callcnv_t cc=CM_CC_UNKNOWN)
sval_t align_stkarg_up (sval_t spoff, const tinfo_t &tif, int slotsize, callcnv_t cc=CM_CC_UNKNOWN)
tinfo_t remove_pointer (const tinfo_t &tif)
 BT_PTR: If the current type is a pointer, return the pointed object.
 DECLARE_TYPE_AS_MOVABLE (regobj_t)
idaman error_t ida_export unpack_idcobj_from_idb (idc_value_t *obj, const tinfo_t &tif, ea_t ea, const bytevec_t *off0, int pio_flags=0)
 Collection of register objects.
idaman error_t ida_export unpack_idcobj_from_bv (idc_value_t *obj, const tinfo_t &tif, const bytevec_t &bytes, int pio_flags=0)
 Read a typed idc object from the byte vector.
idaman error_t ida_export pack_idcobj_to_idb (const idc_value_t *obj, const tinfo_t &tif, ea_t ea, int pio_flags=0)
 Write a typed idc object to the database.
idaman error_t ida_export pack_idcobj_to_bv (const idc_value_t *obj, const tinfo_t &tif, relobj_t *bytes, void *objoff, int pio_flags=0)
 Write a typed idc object to the byte vector.
idaman bool ida_export apply_tinfo_to_stkarg (const insn_t &insn, const op_t &x, uval_t v, const tinfo_t &tif, const char *name)
 Helper function for the processor modules.
idaman void ida_export gen_use_arg_tinfos (struct argtinfo_helper_t *_this, ea_t caller, func_type_data_t *fti, funcargvec_t *rargs)
 Do not call this function directly, use argtinfo_helper_t.
idaman bool ida_export func_has_stkframe_hole (ea_t ea, const func_type_data_t &fti)
 Looks for a hole at the beginning of the stack arguments.
idaman int ida_export lower_type (til_t *til, tinfo_t *tif, const char *name=nullptr, lowertype_helper_t *_helper=nullptr)
 Lower type.
idaman int ida_export replace_ordinal_typerefs (til_t *til, tinfo_t *tif)
 Replace references to ordinal types by name references.
idaman void ida_export begin_type_updating (update_type_t utp)
 Mark the beginning of a large update operation on the types.
idaman void ida_export end_type_updating (update_type_t utp)
 Mark the end of a large update operation on the types (see begin_type_updating())
idaman tid_t ida_export get_named_type_tid (const char *name)
 Get named local type TID.
idaman bool ida_export get_tid_name (qstring *out, tid_t tid)
 Get a type name for the specified TID.
idaman uint32 ida_export get_tid_ordinal (tid_t tid)
 Get type ordinal number for TID.
idaman ssize_t ida_export get_udm_by_fullname (udm_t *udm, const char *fullname)
 Get udt member by full name.
idaman bool ida_export get_idainfo_by_udm (flags64_t *flags, opinfo_t *ti, const udm_t &udm, ea_t refinfo_ea=BADADDR)
 Calculate IDA info from udt member.
tid_t create_enum_type (const char *enum_name, enum_type_data_t &ei, int enum_width, type_sign_t sign, bool convert_to_bitmask, const char *enum_cmt=nullptr)
 Create type enum.
 DECLARE_TYPE_AS_MOVABLE (valinfo_t)
 DECLARE_TYPE_AS_MOVABLE (valstr_t)
idaman bool ida_export format_cdata (qstrvec_t *outvec, const idc_value_t &idc_value, const tinfo_t *tif, valstr_t *vtree=nullptr, const format_data_info_t *fdi=nullptr)
 Format a data value as a C initializer.
idaman int ida_export print_cdata (text_sink_t &printer, const idc_value_t &idc_value, const tinfo_t *tif, const format_data_info_t *fdi=nullptr)
 The same as format_cdata(), but instead of returning the answer in a vector, print it.
idaman int ida_export print_decls (text_sink_t &printer, const til_t *til, const ordvec_t *ordinals, uint32 pdf_flags)
 Print types (and possibly their dependencies) in a format suitable for using in a header file.
idaman int ida_export calc_number_of_children (const argloc_t &loc, const tinfo_t &tif, bool dont_deref_ptr=false)
 Calculate max number of lines of a formatted c data, when expanded (#PTV_EXPAND).
idaman bool ida_export get_enum_member_expr (qstring *buf, const tinfo_t &tif, int serial, uint64 value)
 Return a C expression that can be used to represent an enum member.
 DECLARE_TYPE_AS_MOVABLE (til_symbol_t)
idaman bool ida_export choose_named_type (til_symbol_t *out_sym, const til_t *root_til, const char *title, int ntf_flags, predicate_t *predicate=nullptr)
 Choose a type from a type library.
idaman uint32 ida_export choose_local_tinfo (const til_t *ti, const char *title, local_tinfo_predicate_t *func=nullptr, uint32 def_ord=0, void *ud=nullptr)
 Choose a type from the local type library.
idaman uint32 ida_export choose_local_tinfo_and_delta (int32 *delta, const til_t *ti, const char *title, local_tinfo_predicate_t *func=nullptr, uint32 def_ord=0, void *ud=nullptr)
 Choose a type from the local type library and specify the pointer shift value.
idaman ssize_t ida_export visit_edms (const tinfo_t &tif, uint64 value, int nbytes, uchar serial, const enum_type_visitor_t &visitor)
 Visit enum members having the specified value.
bool calc_retloc (argloc_t *retloc, const tinfo_t &rettype, callcnv_t cc)

Variables

const type_t TYPE_BASE_MASK = 0x0F
 the low 4 bits define the basic type
const type_t TYPE_FLAGS_MASK = 0x30
 type flags - they have different meaning depending on the basic type
const type_t TYPE_MODIF_MASK = 0xC0
 modifiers.
const type_t TYPE_FULL_MASK = (TYPE_BASE_MASK | TYPE_FLAGS_MASK)
 basic type with type flags
const type_t BT_UNK = 0x00
 unknown
const type_t BT_VOID = 0x01
 void
const type_t BTMT_SIZE0 = 0x00
 BT_VOID - normal void; BT_UNK - don't use
const type_t BTMT_SIZE12 = 0x10
 size = 1 byte if BT_VOID; 2 if BT_UNK
const type_t BTMT_SIZE48 = 0x20
 size = 4 bytes if BT_VOID; 8 if BT_UNK
const type_t BTMT_SIZE128 = 0x30
 size = 16 bytes if BT_VOID; unknown if BT_UNK (IN struct alignment - see below)
const type_t BT_INT8 = 0x02
 __int8
const type_t BT_INT16 = 0x03
 __int16
const type_t BT_INT32 = 0x04
 __int32
const type_t BT_INT64 = 0x05
 __int64
const type_t BT_INT128 = 0x06
 __int128 (for alpha & future use)
const type_t BT_INT = 0x07
 natural int. (size provided by idp module)
const type_t BTMT_UNKSIGN = 0x00
 unknown signedness
const type_t BTMT_SIGNED = 0x10
 signed
const type_t BTMT_USIGNED = 0x20
 unsigned
const type_t BTMT_UNSIGNED = BTMT_USIGNED
const type_t BTMT_CHAR = 0x30
 specify char or segment register
const type_t BT_BOOL = 0x08
 bool
const type_t BTMT_DEFBOOL = 0x00
 size is model specific or unknown(?)
const type_t BTMT_BOOL1 = 0x10
 size 1byte
const type_t BTMT_BOOL2 = 0x20
 size 2bytes - !inf_is_64bit()
const type_t BTMT_BOOL8 = 0x20
 size 8bytes - inf_is_64bit()
const type_t BTMT_BOOL4 = 0x30
 size 4bytes
const type_t BT_FLOAT = 0x09
 float
const type_t BTMT_FLOAT = 0x00
 float (4 bytes)
const type_t BTMT_DOUBLE = 0x10
 double (8 bytes)
const type_t BTMT_LNGDBL = 0x20
 long double (compiler specific)
const type_t BTMT_SPECFLT = 0x30
 float (variable size).
const type_t _BT_LAST_BASIC = BT_FLOAT
 the last basic type, all basic types may be followed by [tah-typeattrs]
const type_t BT_PTR = 0x0A
 pointer.
const type_t BTMT_DEFPTR = 0x00
 default for model
const type_t BTMT_NEAR = 0x10
 near
const type_t BTMT_FAR = 0x20
 far
const type_t BTMT_CLOSURE = 0x30
 closure.
const type_t BT_ARRAY = 0x0B
 array
const type_t BTMT_NONBASED = 0x10
const type_t BTMT_ARRESERV = 0x20
 reserved bit
const type_t BT_FUNC = 0x0C
 function.
const type_t BTMT_DEFCALL = 0x00
 call method - default for model or unknown
const type_t BTMT_NEARCALL = 0x10
 function returns by retn
const type_t BTMT_FARCALL = 0x20
 function returns by retf
const type_t BTMT_INTCALL = 0x30
 function returns by iret in this case cc MUST be 'unknown'
const type_t BT_COMPLEX = 0x0D
 struct/union/enum/typedef.
const type_t BTMT_STRUCT = 0x00
 struct: MCNT records: type_t; [sdacl-typeattrs];
const type_t BTMT_UNION = 0x10
 union: MCNT records: type_t...
const type_t BTMT_ENUM = 0x20
 enum: next byte bte_t (see below) N records: de delta(s) OR blocks (see below)
const type_t BTMT_TYPEDEF = 0x30
 named reference always p_string name
const type_t BT_BITFIELD = 0x0E
 bitfield (only in struct) ['bitmasked' enum see below] next byte is dt ((size in bits << 1) | (unsigned ?
const type_t BTMT_BFLDI8 = 0x00
 __int8
const type_t BTMT_BFLDI16 = 0x10
 __int16
const type_t BTMT_BFLDI32 = 0x20
 __int32
const type_t BTMT_BFLDI64 = 0x30
 __int64
const type_t BT_RESERVED = 0x0F
 RESERVED.
const type_t BTM_CONST = 0x40
 const
const type_t BTM_VOLATILE = 0x80
 volatile
const bte_t BTE_SIZE_MASK = 0x07
 storage size.
const bte_t BTE_RESERVED = 0x08
 must be 0, in order to distinguish from a tah-byte
const bte_t BTE_BITMASK = 0x10
 'subarrays'.
const bte_t BTE_OUT_MASK = 0x60
 output style mask
const bte_t BTE_HEX = 0x00
 hex
const bte_t BTE_CHAR = 0x20
 char or hex
const bte_t BTE_SDEC = 0x40
 signed decimal
const bte_t BTE_UDEC = 0x60
 unsigned decimal
const bte_t BTE_ALWAYS = 0x80
 this bit MUST be present
const type_t BT_SEGREG = (BT_INT | BTMT_CHAR)
 segment register
const type_t BT_UNK_BYTE = (BT_VOID | BTMT_SIZE12)
 1 byte
const type_t BT_UNK_WORD = (BT_UNK | BTMT_SIZE12)
 2 bytes
const type_t BT_UNK_DWORD = (BT_VOID | BTMT_SIZE48)
 4 bytes
const type_t BT_UNK_QWORD = (BT_UNK | BTMT_SIZE48)
 8 bytes
const type_t BT_UNK_OWORD = (BT_VOID | BTMT_SIZE128)
 16 bytes
const type_t BT_UNKNOWN = (BT_UNK | BTMT_SIZE128)
 unknown size - for parameters
const type_t BTF_BYTE = BT_UNK_BYTE
 byte
const type_t BTF_UNK = BT_UNKNOWN
 unknown
const type_t BTF_VOID = BT_VOID | BTMT_SIZE0
 void
const type_t BTF_INT8 = BT_INT8 | BTMT_SIGNED
 signed byte
const type_t BTF_CHAR = BT_INT8 | BTMT_CHAR
 signed char
const type_t BTF_UCHAR = BT_INT8 | BTMT_USIGNED
 unsigned char
const type_t BTF_UINT8 = BT_INT8 | BTMT_USIGNED
 unsigned byte
const type_t BTF_INT16 = BT_INT16 | BTMT_SIGNED
 signed short
const type_t BTF_UINT16 = BT_INT16 | BTMT_USIGNED
 unsigned short
const type_t BTF_INT32 = BT_INT32 | BTMT_SIGNED
 signed int
const type_t BTF_UINT32 = BT_INT32 | BTMT_USIGNED
 unsigned int
const type_t BTF_INT64 = BT_INT64 | BTMT_SIGNED
 signed long
const type_t BTF_UINT64 = BT_INT64 | BTMT_USIGNED
 unsigned long
const type_t BTF_INT128 = BT_INT128 | BTMT_SIGNED
 signed 128-bit value
const type_t BTF_UINT128 = BT_INT128 | BTMT_USIGNED
 unsigned 128-bit value
const type_t BTF_INT = BT_INT | BTMT_UNKSIGN
 int, unknown signedness
const type_t BTF_UINT = BT_INT | BTMT_USIGNED
 unsigned int
const type_t BTF_SINT = BT_INT | BTMT_SIGNED
 singed int
const type_t BTF_BOOL = BT_BOOL
 boolean
const type_t BTF_FLOAT = BT_FLOAT | BTMT_FLOAT
 float
const type_t BTF_DOUBLE = BT_FLOAT | BTMT_DOUBLE
 double
const type_t BTF_LDOUBLE = BT_FLOAT | BTMT_LNGDBL
 long double
const type_t BTF_TBYTE = BT_FLOAT | BTMT_SPECFLT
 see BTMT_SPECFLT
const type_t BTF_STRUCT = BT_COMPLEX | BTMT_STRUCT
 struct
const type_t BTF_UNION = BT_COMPLEX | BTMT_UNION
 union
const type_t BTF_ENUM = BT_COMPLEX | BTMT_ENUM
 enum
const type_t BTF_TYPEDEF = BT_COMPLEX | BTMT_TYPEDEF
 typedef
const type_sign_t no_sign = 0
 no sign, or unknown
const type_sign_t type_signed = 1
 signed type
const type_sign_t type_unsigned = 2
 unsigned type
const cm_t CM_MASK = 0x03
const cm_t CM_UNKNOWN = 0x00
 unknown
const cm_t CM_N8_F16 = 0x01
 if sizeof(int)<=2: near 1 byte, far 2 bytes
const cm_t CM_N64 = 0x01
 if sizeof(int)>2: near 8 bytes, far 8 bytes
const cm_t CM_N16_F32 = 0x02
 near 2 bytes, far 4 bytes
const cm_t CM_N32_F48 = 0x03
 near 4 bytes, far 6 bytes
const cm_t CM_M_MASK = 0x0C
const cm_t CM_M_NN = 0x00
 small: code=near, data=near (or unknown if CM_UNKNOWN)
const cm_t CM_M_FF = 0x04
 large: code=far, data=far
const cm_t CM_M_NF = 0x08
 compact: code=near, data=far
const cm_t CM_M_FN = 0x0C
 medium: code=far, data=near
const callcnv_t CM_CC_MASK = 0xF0
const callcnv_t CM_CC_INVALID = 0x00
 this value is invalid
const callcnv_t CM_CC_UNKNOWN = 0x10
 unknown calling convention
const callcnv_t CM_CC_VOIDARG = 0x20
 function without arguments if has other cc and argnum == 0, represent as f() - unknown list
const callcnv_t CM_CC_CDECL = 0x30
 stack
const callcnv_t CM_CC_ELLIPSIS = 0x40
 cdecl + ellipsis
const callcnv_t CM_CC_STDCALL = 0x50
 stack, purged
const callcnv_t CM_CC_PASCAL = 0x60
 stack, purged, reverse order of args
const callcnv_t CM_CC_FASTCALL = 0x70
 stack, purged (x86), first args are in regs (compiler-dependent)
const callcnv_t CM_CC_THISCALL = 0x80
 stack, purged (x86), first arg is in reg (compiler-dependent)
const callcnv_t CM_CC_SWIFT = 0x90
 (Swift) arguments and return values in registers (compiler-dependent)
const callcnv_t CM_CC_SPOILED = 0xA0
 This is NOT a cc!
const callcnv_t CM_CC_GOLANG = 0xB0
 (Go) arguments and return value reg/stack depending on version
const callcnv_t CM_CC_RESERVE3 = 0xC0
 reserved; used for internal needs
const callcnv_t CM_CC_SPECIALE = 0xD0
 CM_CC_SPECIAL with ellipsis
const callcnv_t CM_CC_SPECIALP = 0xE0
 Equal to CM_CC_SPECIAL, but with purged stack.
const callcnv_t CM_CC_SPECIAL = 0xF0
 usercall: locations of all arguments and the return value are explicitly specified
const callcnv_t CM_CC_LAST_USERCALL = 0xFF
const callcnv_t CM_CC_GOSTK = 0x100
 (Go) arguments and return value in stack
const callcnv_t CM_CC_FIRST_PLAIN_CUSTOM = 0x200
const type_t BFA_NORET = 0x01
 __noreturn
const type_t BFA_PURE = 0x02
 __pure
const type_t BFA_HIGH = 0x04
 high level prototype (with possibly hidden args)
const type_t BFA_STATIC = 0x08
 static
const type_t BFA_VIRTUAL = 0x10
 virtual
const cm_t BFA_FUNC_MARKER = 0x0F
 This is NOT a cc! (used internally as a marker)
const type_t BFA_FUNC_EXT_FORMAT = 0x80
 This is NOT a real attribute (used internally as marker for extended format)
const cm_t C_PC_TINY = (CM_N16_F32 | CM_M_NN)
const cm_t C_PC_SMALL = (CM_N16_F32 | CM_M_NN)
const cm_t C_PC_COMPACT = (CM_N16_F32 | CM_M_NF)
const cm_t C_PC_MEDIUM = (CM_N16_F32 | CM_M_FN)
const cm_t C_PC_LARGE = (CM_N16_F32 | CM_M_FF)
const cm_t C_PC_HUGE = (CM_N16_F32 | CM_M_FF)
const cm_t C_PC_FLAT = (CM_N32_F48 | CM_M_NN)
const comp_t COMP_MASK = 0x0F
const comp_t COMP_UNK = 0x00
 Unknown.
const comp_t COMP_MS = 0x01
 Visual C++.
const comp_t COMP_BC = 0x02
 Borland C++.
const comp_t COMP_WATCOM = 0x03
 Watcom C++.
const comp_t COMP_GNU = 0x06
 GNU C++.
const comp_t COMP_VISAGE = 0x07
 Visual Age C++.
const comp_t COMP_BP = 0x08
 Delphi.
const comp_t COMP_UNSURE = 0x80
 uncertain compiler id
const size_t BADSIZE = size_t(-1)
 bad type size
const uchar MAX_ENUM_SERIAL = 255
 Max number of identical constants allowed for one enum type.
const argloc_type_t ALOC_NONE = 0
 none
const argloc_type_t ALOC_STACK = 1
 stack offset
const argloc_type_t ALOC_DIST = 2
 distributed (scattered)
const argloc_type_t ALOC_REG1 = 3
 one register (and offset within it)
const argloc_type_t ALOC_REG2 = 4
 register pair
const argloc_type_t ALOC_RREL = 5
 register relative
const argloc_type_t ALOC_STATIC = 6
 global address
const argloc_type_t ALOC_CUSTOM = 7
 custom argloc (7 or higher)
const int TYPID_ISREF = 0x100
 Identifies that a type that is a typeref.
const int TYPID_SHIFT = 9
 First type detail bit.

Detailed Description

Type information in IDA.

In IDA, types are represented by and manipulated through tinfo_t objects.

A tinfo_t can represent a simple type (e.g., int, float), a complex type (a structure, enum, union, typedef), or even an array, or a function prototype.

The key types in this file are:

  • til_t - a type info library. Holds type information in serialized form.
  • tinfo_t - information about a type (simple, complex, ...)

Glossary

All throughout this file, there are certain terms that will keep appearing:

  • udt: "user-defined type": a structure or union - but not enums. See udt_type_data_t
  • udm: "udt member": i.e., a structure or union member. See udm_t
  • edm: "enum member": i.e., an enumeration member - i.e., an enumerator. See edm_t

Under the hood

The tinfo_t type provides a lot of useful methods already, but it's possible to achieve even more by retrieving its contents into the container classes:

Attached & detached tinfo_t objects

tinfo_t objects can be attached to a til_t library, or can be created without using any til_t.

Here is an example, assigning a function prototype:

 func_type_data_t func_info;

 funcarg_t argc;
 argc.name = "argc";
 argc.type = tinfo_t(BT_INT);
 func_info.push_back(argc);

 funcarg_t argv;
 argc.name = "argv";
 argc.type = tinfo_t("const char **");
 func_info.push_back(argv)

 tinfo_t tif;
 if ( tif.create_func(func_info) )
 {
   ea_t ea = // get address of "main"
   apply_tinfo(ea, tif, TINFO_DEFINITE);
 }

This code manipulates a "detached" tinfo_t object, which does not depend on any til_t file. However, any complex type will require a til_t file. In IDA, there is always a default til_t file for each idb file. This til_t file can be specified by nullptr.

On the other hand, the following code manipulates an "attached" tinfo_t object, and any operation that modifies it, will also modify it in the hosting til_t:

 tinfo_t tif;

Load type from the "Local Types" til_t. Note: we could have used get_idati() instead of nullptr if ( tif.get_named_type(nullptr, "my_struct_t") ) tif.add_udm("extra_field", "unsigned long long");

You can check if a tinfo_t instance is attached to a type in a til_t file by calling tinfo_t::is_typeref

Typedef Documentation

◆ p_string

typedef uchar p_string

Inside a type string, a pascal-like string: dt length, characters.

◆ bmask64_t

typedef uint64 bmask64_t

unsigned value that describes a bitmask

◆ typid_t

typedef uint64 typid_t

◆ tinfovec_t

vector of tinfo objects

◆ simd_info_vec_t

◆ funcargvec_t

vector of function argument objects

◆ edmvec_t

vector of enum values.

for regular enums, no sorting order is defined. for bitmasks, the vector consists of bitmask groups. each non-trivial group (having more than one member or more than one bit in the value) starts with a mask member, the rest of the group has no defined sorting order.

◆ regobjvec_t

◆ valstrvec_t

◆ ordvec_t

◆ local_tinfo_predicate_t

typedef int idaapi local_tinfo_predicate_t(uint32 ord, const tinfo_t &type, void *ud)

Controls which types are displayed/selected when choosing local types.

Return values
0skip type
1include

◆ enum_type_visitor_t

using enum_type_visitor_t = std::function<ssize_t(const struct enum_type_data_t &ei, size_t idx, uint64 value, uint64 bmask)>

Callback for visit_edms.

Parameters
eienum type details
idxconstant index
valueapplied value
bmaskgroup bitmask
Returns
0 to continue, stop visiting enum members otherwise

Enumeration Type Documentation

◆ abs_t

enum abs_t

abstractness of declaration (see h2ti())

Enumerator
ABS_UNK 
ABS_NO 
ABS_YES 

◆ sclass_t

enum sclass_t

< storage class

Enumerator
SC_UNK 

unknown

SC_TYPE 

typedef

SC_EXT 

extern

SC_STAT 

static

SC_REG 

register

SC_AUTO 

auto

SC_FRIEND 

friend

SC_VIRT 

virtual

◆ stock_type_id_t

IDs for common types.

Enumerator
STI_PCHAR 

char *

STI_PUCHAR 

uint8 *

STI_PCCHAR 

const char *

STI_PCUCHAR 

const uint8 *

STI_PBYTE 

_BYTE *

STI_PINT 

int *

STI_PUINT 

unsigned int *

STI_PVOID 

void *

STI_PPVOID 

void **

STI_PCVOID 

const void *

STI_ACHAR 

char[]

STI_AUCHAR 

uint8[]

STI_ACCHAR 

const char[]

STI_ACUCHAR 

const uint8[]

STI_FPURGING 

void __userpurge(int)

STI_FDELOP 

void __cdecl(void *)

STI_MSGSEND 

void *(void *, const char *, ...)

STI_AEABI_LCMP 

int __fastcall __pure(int64 x, int64 y)

STI_AEABI_ULCMP 

int __fastcall __pure(uint64 x, uint64 y)

STI_DONT_USE 

unused stock type id; should not be used

STI_SIZE_T 

size_t

STI_SSIZE_T 

ssize_t

STI_AEABI_MEMCPY 

void __fastcall(void *, const void *, size_t)

STI_AEABI_MEMSET 

void __fastcall(void *, size_t, int)

STI_AEABI_MEMCLR 

void __fastcall(void *, size_t)

STI_RTC_CHECK_2 

int16 __fastcall(int16 x)

STI_RTC_CHECK_4 

int32 __fastcall(int32 x)

STI_RTC_CHECK_8 

int64 __fastcall(int64 x)

STI_COMPLEX64 

struct complex64_t { float real, imag; }

STI_COMPLEX128 

struct complex128_t { double real, imag; }

STI_PUNKNOWN 

_UNKNOWN *

STI_LAST 

◆ gtd_udt_t

enum gtd_udt_t

Constants to be used with get_udt_details()

Enumerator
GTD_CALC_LAYOUT 

calculate udt layout

GTD_NO_LAYOUT 

don't calculate udt layout please note that udt layout may have been calculated earlier

GTD_DEL_BITFLDS 

delete udt bitfields

◆ gtd_func_t

enum gtd_func_t

Constants to be used with get_func_details()

Enumerator
GTD_CALC_ARGLOCS 

calculate func arg locations

GTD_NO_ARGLOCS 

don't calculate func arg locations please note that the locations may have been calculated earlier

◆ gts_code_t

enum gts_code_t

Constants to be used with get_size()

Enumerator
GTS_NESTED 

nested type (embedded into a udt)

GTS_BASECLASS 

is baseclass of a udt

◆ format_functype_t

Function index for the 'format' attribute.

Enumerator
FMTFUNC_PRINTF 
FMTFUNC_SCANF 
FMTFUNC_STRFTIME 
FMTFUNC_STRFMON 

◆ update_type_t

See begin_type_updating()

Enumerator
UTP_ENUM 
UTP_STRUCT 

Function Documentation

◆ is_type_const()

THREAD_SAFE bool is_type_const ( type_t t)
inline

See BTM_CONST.

◆ is_type_volatile()

THREAD_SAFE bool is_type_volatile ( type_t t)
inline

◆ get_base_type()

THREAD_SAFE type_t get_base_type ( type_t t)
inline

Get get basic type bits (TYPE_BASE_MASK)

◆ get_type_flags()

THREAD_SAFE type_t get_type_flags ( type_t t)
inline

Get type flags (TYPE_FLAGS_MASK)

◆ get_full_type()

THREAD_SAFE type_t get_full_type ( type_t t)
inline

Get basic type bits + type flags (TYPE_FULL_MASK)

◆ is_typeid_last()

THREAD_SAFE bool is_typeid_last ( type_t t)
inline

Is the type_t the last byte of type declaration?

(there are no additional bytes after a basic type, see _BT_LAST_BASIC)

◆ is_type_partial()

THREAD_SAFE bool is_type_partial ( type_t t)
inline

Identifies an unknown or void type with a known size (see Basic type: unknown & void)

◆ is_type_void()

THREAD_SAFE bool is_type_void ( type_t t)
inline

See BTF_VOID.

◆ is_type_unknown()

THREAD_SAFE bool is_type_unknown ( type_t t)
inline

See BT_UNKNOWN.

◆ is_type_ptr()

THREAD_SAFE bool is_type_ptr ( type_t t)
inline

See BT_PTR.

◆ is_type_complex()

THREAD_SAFE bool is_type_complex ( type_t t)
inline

See BT_COMPLEX.

◆ is_type_func()

THREAD_SAFE bool is_type_func ( type_t t)
inline

See BT_FUNC.

◆ is_type_array()

THREAD_SAFE bool is_type_array ( type_t t)
inline

See BT_ARRAY.

◆ is_type_typedef()

THREAD_SAFE bool is_type_typedef ( type_t t)
inline

◆ is_type_sue()

THREAD_SAFE bool is_type_sue ( type_t t)
inline

Is the type a struct/union/enum?

◆ is_type_struct()

THREAD_SAFE bool is_type_struct ( type_t t)
inline

See BTF_STRUCT.

◆ is_type_union()

THREAD_SAFE bool is_type_union ( type_t t)
inline

See BTF_UNION.

◆ is_type_struni()

THREAD_SAFE bool is_type_struni ( type_t t)
inline

Is the type a struct or union?

◆ is_type_enum()

THREAD_SAFE bool is_type_enum ( type_t t)
inline

See BTF_ENUM.

◆ is_type_bitfld()

THREAD_SAFE bool is_type_bitfld ( type_t t)
inline

◆ is_type_int()

THREAD_SAFE bool is_type_int ( type_t bt)
inline

Does the type_t specify one of the basic types in Basic type: integer?

◆ is_type_int128()

THREAD_SAFE bool is_type_int128 ( type_t t)
inline

Does the type specify a 128-bit value? (signed or unsigned, see Basic type: integer)

◆ is_type_int64()

THREAD_SAFE bool is_type_int64 ( type_t t)
inline

Does the type specify a 64-bit value? (signed or unsigned, see Basic type: integer)

◆ is_type_int32()

THREAD_SAFE bool is_type_int32 ( type_t t)
inline

Does the type specify a 32-bit value? (signed or unsigned, see Basic type: integer)

◆ is_type_int16()

THREAD_SAFE bool is_type_int16 ( type_t t)
inline

Does the type specify a 16-bit value? (signed or unsigned, see Basic type: integer)

◆ is_type_char()

THREAD_SAFE bool is_type_char ( type_t t)
inline

Does the type specify a char value? (signed or unsigned, see Basic type: integer)

◆ is_type_paf()

THREAD_SAFE bool is_type_paf ( type_t t)
inline

Is the type a pointer, array, or function type?

◆ is_type_ptr_or_array()

THREAD_SAFE bool is_type_ptr_or_array ( type_t t)
inline

Is the type a pointer or array type?

◆ is_type_floating()

THREAD_SAFE bool is_type_floating ( type_t t)
inline

Is the type a floating point type?

◆ is_type_integral()

THREAD_SAFE bool is_type_integral ( type_t t)
inline

Is the type an integral type (char/short/int/long/bool)?

◆ is_type_ext_integral()

THREAD_SAFE bool is_type_ext_integral ( type_t t)
inline

Is the type an extended integral type? (integral or enum)

◆ is_type_arithmetic()

THREAD_SAFE bool is_type_arithmetic ( type_t t)
inline

Is the type an arithmetic type? (floating or integral)

◆ is_type_ext_arithmetic()

THREAD_SAFE bool is_type_ext_arithmetic ( type_t t)
inline

Is the type an extended arithmetic type? (arithmetic or enum)

◆ is_type_uint()

THREAD_SAFE bool is_type_uint ( type_t t)
inline

See BTF_UINT.

◆ is_type_uchar()

THREAD_SAFE bool is_type_uchar ( type_t t)
inline

See BTF_UCHAR.

◆ is_type_uint16()

THREAD_SAFE bool is_type_uint16 ( type_t t)
inline

See BTF_UINT16.

◆ is_type_uint32()

THREAD_SAFE bool is_type_uint32 ( type_t t)
inline

See BTF_UINT32.

◆ is_type_uint64()

THREAD_SAFE bool is_type_uint64 ( type_t t)
inline

See BTF_UINT64.

◆ is_type_uint128()

THREAD_SAFE bool is_type_uint128 ( type_t t)
inline

◆ is_type_ldouble()

THREAD_SAFE bool is_type_ldouble ( type_t t)
inline

◆ is_type_double()

THREAD_SAFE bool is_type_double ( type_t t)
inline

See BTF_DOUBLE.

◆ is_type_float()

THREAD_SAFE bool is_type_float ( type_t t)
inline

See BTF_FLOAT.

◆ is_type_tbyte()

THREAD_SAFE bool is_type_tbyte ( type_t t)
inline

See BTF_FLOAT.

◆ is_type_bool()

THREAD_SAFE bool is_type_bool ( type_t t)
inline

See BTF_BOOL.

◆ is_tah_byte()

THREAD_SAFE bool is_tah_byte ( type_t t)
inline

The TAH byte (type attribute header byte) denotes the start of type attributes.

(see "tah-typeattrs" in the type bit definitions)

◆ is_sdacl_byte()

THREAD_SAFE bool is_sdacl_byte ( type_t t)
inline

Identify an sdacl byte.

The first sdacl byte has the following format: 11xx000x. The sdacl bytes are appended to udt fields. They indicate the start of type attributes (as the tah-bytes do). The sdacl bytes are used in the udt headers instead of the tah-byte. This is done for compatibility with old databases, they were already using sdacl bytes in udt headers and as udt field postfixes. (see "sdacl-typeattrs" in the type bit definitions)

◆ operator<()

THREAD_SAFE bool operator< ( const bytevec_t & v1,
const bytevec_t & v2 )
inline

Compare two bytevecs with '<'.

v1 is considered less than v2 if either:

  • v1.size() < v2.size()
  • there is some i such that v1[i] < v2[i]

◆ append_argloc()

idaman bool ida_export append_argloc ( qtype * out,
const argloc_t & vloc )

Serialize argument location.

◆ extract_argloc()

idaman bool ida_export extract_argloc ( argloc_t * vloc,
const type_t ** ptype,
bool forbid_stkoff )

Deserialize an argument location.

Argument FORBID_STKOFF checks location type. It can be used, for example, to check the return location of a function that cannot return a value in the stack

◆ resolve_typedef()

idaman const type_t *ida_export resolve_typedef ( const til_t * til,
const type_t * type )

◆ is_restype_void()

bool is_restype_void ( const til_t * til,
const type_t * type )
inline

◆ is_restype_enum()

bool is_restype_enum ( const til_t * til,
const type_t * type )
inline

◆ is_restype_struni()

bool is_restype_struni ( const til_t * til,
const type_t * type )
inline

◆ is_restype_struct()

bool is_restype_struct ( const til_t * til,
const type_t * type )
inline

◆ get_scalar_bt()

idaman type_t ida_export get_scalar_bt ( int size)

◆ new_til()

idaman til_t *ida_export new_til ( const char * name,
const char * desc )

Initialize a til.

◆ add_base_tils()

idaman int ida_export add_base_tils ( qstring * errbuf,
til_t * ti,
const char * tildir,
const char * bases,
bool gen_events )

Add multiple base tils.

Parameters
[out]errbuferror message
titarget til
tildirdirectory where specified tils can be found. nullptr means all default til subdirectories.
basescomma separated list of til names
gen_eventsgenerate corresponding IDB events
Returns
one of Add TIL result codes

◆ load_til()

idaman til_t *ida_export load_til ( const char * name,
qstring * errbuf,
const char * tildir = nullptr )

Load til from a file without adding it to the database list (see also add_til).

Failure to load base tils are reported into 'errbuf'. They do not prevent loading of the main til.

Parameters
namefilename of the til. If it's an absolute path, tildir is ignored.
  • NB: the file extension is forced to .til
[out]errbuferror message
tildirdirectory where to load the til from. nullptr means default til subdirectories.
Returns
pointer to resulting til, nullptr if failed and error message is in errbuf

◆ sort_til()

idaman bool ida_export sort_til ( til_t * ti)

Sort til (use after modifying it).

Returns
false if no memory or bad parameter

◆ compact_til()

idaman bool ida_export compact_til ( til_t * ti)

Collect garbage in til.

Must be called before storing the til.

Returns
true if any memory was freed

◆ store_til()

idaman bool ida_export store_til ( til_t * ti,
const char * tildir,
const char * name )

Store til to a file.

If the til contains garbage, it will be collected before storing the til. Your plugin should call compact_til() before calling store_til().

Parameters
titype library to store
tildirdirectory where to store the til. nullptr means current directory.
namefilename of the til. If it's an absolute path, tildir is ignored.
  • NB: the file extension is forced to .til
Returns
success

◆ free_til()

idaman void ida_export free_til ( til_t * ti)

Free memory allocated by til.

◆ load_til_header()

idaman til_t *ida_export load_til_header ( const char * tildir,
const char * name,
qstring * errbuf )

Get human-readable til description.

◆ get_default_align()

size_t get_default_align ( )
inline

Get default alignment for structure fields.

Returns
one of 1,2,4,8,...

◆ align_size()

THREAD_SAFE void align_size ( size_t & cur_tot_size,
size_t elem_size,
size_t algn )
inline

Get alignment delta for the a structure field.

Parameters
cur_tot_sizethe structure size calculated so far
elem_sizesize of the current field. the whole structure should be calculated
algnthe structure alignment (0,1,2,4,8...)

◆ deref_ptr()

idaman bool ida_export deref_ptr ( ea_t * ptr_ea,
const tinfo_t & tif,
ea_t * closure_obj = nullptr )

Dereference a pointer.

Parameters
[out]ptr_eain/out parameter
  • in: address of the pointer
  • out: the pointed address
tiftype of the pointer
[out]closure_objclosure object (not used yet)
Returns
success

◆ remove_tinfo_pointer()

idaman bool ida_export remove_tinfo_pointer ( tinfo_t * tif,
const char ** pname,
const til_t * til = nullptr )

Remove pointer of a type.

(i.e. convert "char *" into "char"). Optionally remove the "lp" (or similar) prefix of the input name. If the input type is not a pointer, then fail.

◆ add_til()

idaman int ida_export add_til ( const char * name,
int flags )

Load a til file and add it the database type libraries list.

IDA will also apply function prototypes for matching function names.

Parameters
nametil name
flagscombination of Load TIL flags
Returns
one of Load TIL result codes

◆ del_til()

idaman bool ida_export del_til ( const char * name)

Unload a til file.

◆ apply_named_type()

idaman bool ida_export apply_named_type ( ea_t ea,
const char * name )

Apply the specified named type to the address.

Parameters
ealinear address
namethe type name, e.g. "FILE"
Returns
success

◆ apply_tinfo()

idaman bool ida_export apply_tinfo ( ea_t ea,
const tinfo_t & tif,
uint32 flags )

Apply the specified type to the specified address.

This function sets the type and tries to convert the item at the specified address to conform the type.

Parameters
ealinear address
tifnew type
flagscombination of Apply tinfo flags
Returns
success

◆ apply_cdecl()

idaman bool ida_export apply_cdecl ( til_t * til,
ea_t ea,
const char * decl,
int flags = 0 )

Apply the specified type to the address.

This function parses the declaration and calls apply_tinfo()

Parameters
tiltype library
ealinear address
decltype declaration in C form
flagsflags to pass to apply_tinfo (#TINFO_DEFINITE is always passed)
Returns
success

◆ apply_callee_tinfo()

idaman bool ida_export apply_callee_tinfo ( ea_t caller,
const tinfo_t & tif )

Apply the type of the called function to the calling instruction.

This function will append parameter comments and rename the local variables of the calling function. It also stores information about the instructions that initialize call arguments in the database. Use get_arg_addrs() to retrieve it if necessary. Alternatively it is possible to hook to processor_t::arg_addrs_ready event.

Parameters
callerlinear address of the calling instruction. must belong to a function.
tiftype info
Returns
success

◆ get_arg_addrs()

idaman bool ida_export get_arg_addrs ( eavec_t * out,
ea_t caller )

Retrieve argument initialization addresses.

This function retrieves information about argument addresses. This information is stored in the database by apply_callee_tinfo().

Parameters
outlinear addresses of the instructions that load call arguments
calleraddress of the call instruction
Returns
success

◆ apply_once_tinfo_and_name()

idaman bool ida_export apply_once_tinfo_and_name ( ea_t dea,
const tinfo_t & tif,
const char * name )

Apply the specified type and name to the address.

This function checks if the address already has a type. If the old type
does not exist or the new type is 'better' than the old type, then the
new type will be applied. A type is considered better if it has more
information (e.g. BTMT_STRUCT is better than BT_INT).
The same logic is with the name: if the address already have a meaningful
name, it will be preserved. Only if the old name does not exist or it
is a dummy name like byte_123, it will be replaced by the new name.

Parameters
dealinear address
tifnew type
namenew name for the address
Returns
success

◆ guess_tinfo()

idaman int ida_export guess_tinfo ( tinfo_t * out,
tid_t id )

Generate a type information about the id from the disassembly.

id can be a structure/union/enum id or an address.

Returns
one of Guess tinfo codes

◆ set_c_header_path()

void set_c_header_path ( const char * incdir)
inline

Set include directory path the target compiler.

◆ get_c_header_path()

ssize_t get_c_header_path ( qstring * buf)
inline

Get the include directory path of the target compiler.

◆ set_c_macros()

void set_c_macros ( const char * macros)
inline

Set predefined macros for the target compiler.

◆ get_c_macros()

ssize_t get_c_macros ( qstring * buf)
inline

Get predefined macros for the target compiler.

◆ get_idati()

idaman til_t *ida_export get_idati ( )

Pointer to the local type library - this til is private for each IDB file Functions that accept til_t* default to idati when is nullptr provided.

◆ get_idainfo_by_type()

idaman bool ida_export get_idainfo_by_type ( size_t * out_size,
flags64_t * out_flags,
opinfo_t * out_mt,
const tinfo_t & tif,
size_t * out_alsize = nullptr )

Extract information from a tinfo_t.

Parameters
[out]out_sizesize of tif
[out]out_flagsdescription of type using flags64_t
[out]out_mtinfo for non-scalar types
tifthe type to inspect
[out]out_alsizealignment

◆ get_tinfo_by_flags()

idaman bool ida_export get_tinfo_by_flags ( tinfo_t * out,
flags64_t flags )

Get tinfo object that corresponds to data flags.

Parameters
[out]outtype info
flagssimple flags (byte, word, ..., zword)

◆ DECLARE_TYPE_AS_MOVABLE() [1/15]

DECLARE_TYPE_AS_MOVABLE ( tinfo_t )

◆ DECLARE_TYPE_AS_MOVABLE() [2/15]

DECLARE_TYPE_AS_MOVABLE ( simd_info_t )

◆ guess_func_cc()

idaman callcnv_t ida_export guess_func_cc ( const func_type_data_t & fti,
int npurged,
int cc_flags )

◆ dump_func_type_data()

idaman bool ida_export dump_func_type_data ( qstring * out,
const func_type_data_t & fti,
int praloc_bits )

◆ calc_retloc() [1/2]

idaman bool ida_export calc_retloc ( func_type_data_t * fti)

◆ calc_arglocs()

idaman bool ida_export calc_arglocs ( func_type_data_t * fti)

◆ calc_varglocs()

idaman bool ida_export calc_varglocs ( func_type_data_t * fti,
regobjs_t * regs,
relobj_t * stkargs,
int nfixed )

◆ DECLARE_TYPE_AS_MOVABLE() [3/15]

DECLARE_TYPE_AS_MOVABLE ( ptr_type_data_t )

◆ DECLARE_TYPE_AS_MOVABLE() [4/15]

DECLARE_TYPE_AS_MOVABLE ( array_type_data_t )

◆ DECLARE_TYPE_AS_MOVABLE() [5/15]

DECLARE_TYPE_AS_MOVABLE ( funcarg_t )

◆ DECLARE_TYPE_AS_MOVABLE() [6/15]

DECLARE_TYPE_AS_MOVABLE ( edm_t )

◆ DECLARE_TYPE_AS_MOVABLE() [7/15]

DECLARE_TYPE_AS_MOVABLE ( enum_type_data_t )

◆ DECLARE_TYPE_AS_MOVABLE() [8/15]

DECLARE_TYPE_AS_MOVABLE ( typedef_type_data_t )

◆ DECLARE_TYPE_AS_MOVABLE() [9/15]

DECLARE_TYPE_AS_MOVABLE ( udm_t )

◆ DECLARE_TYPE_AS_MOVABLE() [10/15]

DECLARE_TYPE_AS_MOVABLE ( udt_type_data_t )

◆ stroff_as_size()

bool stroff_as_size ( int plen,
const tinfo_t & tif,
asize_t value )
inline

Should display a structure offset expression as the structure size?

◆ visit_stroff_udms()

idaman int ida_export visit_stroff_udms ( udm_visitor_t & sfv,
const tid_t * path,
int plen,
adiff_t * disp,
bool appzero )

Visit structure fields in a stroff expression or in a reference to a struct data variable.

This function can be used to enumerate all components of an expression like 'a.b.c'.

Parameters
sfvvisitor object
pathstruct path (path[0] contains the initial struct id)
plenlen
[in,out]dispoffset into structure
appzeroshould visit field at offset zero?
Returns
visitor result

◆ DECLARE_TYPE_AS_MOVABLE() [11/15]

DECLARE_TYPE_AS_MOVABLE ( bitfield_type_data_t )

◆ is_one_bit_mask()

THREAD_SAFE bool is_one_bit_mask ( uval_t mask)
inline

Is bitmask one bit?

◆ inf_pack_stkargs()

bool inf_pack_stkargs ( callcnv_t cc)
inline

◆ inf_big_arg_align()

bool inf_big_arg_align ( callcnv_t cc)
inline

◆ inf_huge_arg_align()

bool inf_huge_arg_align ( callcnv_t cc)
inline

◆ get_arg_align() [1/2]

int get_arg_align ( int type_align,
int slotsize,
callcnv_t cc = CM_CC_UNKNOWN )
inline

◆ get_arg_align() [2/2]

int get_arg_align ( const tinfo_t & tif,
int slotsize,
callcnv_t cc = CM_CC_UNKNOWN )
inline

◆ align_stkarg_up() [1/2]

sval_t align_stkarg_up ( sval_t spoff,
int type_align,
int slotsize,
callcnv_t cc = CM_CC_UNKNOWN )
inline

◆ align_stkarg_up() [2/2]

sval_t align_stkarg_up ( sval_t spoff,
const tinfo_t & tif,
int slotsize,
callcnv_t cc = CM_CC_UNKNOWN )
inline

◆ remove_pointer()

tinfo_t remove_pointer ( const tinfo_t & tif)
inline

BT_PTR: If the current type is a pointer, return the pointed object.

If the current type is not a pointer, return the current type. See also get_ptrarr_object() and get_pointed_object()

◆ DECLARE_TYPE_AS_MOVABLE() [12/15]

DECLARE_TYPE_AS_MOVABLE ( regobj_t )

◆ unpack_idcobj_from_idb()

idaman error_t ida_export unpack_idcobj_from_idb ( idc_value_t * obj,
const tinfo_t & tif,
ea_t ea,
const bytevec_t * off0,
int pio_flags = 0 )

Collection of register objects.

Read a typed idc object from the database

◆ unpack_idcobj_from_bv()

idaman error_t ida_export unpack_idcobj_from_bv ( idc_value_t * obj,
const tinfo_t & tif,
const bytevec_t & bytes,
int pio_flags = 0 )

Read a typed idc object from the byte vector.

◆ pack_idcobj_to_idb()

idaman error_t ida_export pack_idcobj_to_idb ( const idc_value_t * obj,
const tinfo_t & tif,
ea_t ea,
int pio_flags = 0 )

Write a typed idc object to the database.

◆ pack_idcobj_to_bv()

idaman error_t ida_export pack_idcobj_to_bv ( const idc_value_t * obj,
const tinfo_t & tif,
relobj_t * bytes,
void * objoff,
int pio_flags = 0 )

Write a typed idc object to the byte vector.

Byte vector may be non-empty, this function will append data to it

◆ apply_tinfo_to_stkarg()

idaman bool ida_export apply_tinfo_to_stkarg ( const insn_t & insn,
const op_t & x,
uval_t v,
const tinfo_t & tif,
const char * name )

Helper function for the processor modules.

to be called from processor_t::use_stkarg_type

◆ gen_use_arg_tinfos()

idaman void ida_export gen_use_arg_tinfos ( struct argtinfo_helper_t * _this,
ea_t caller,
func_type_data_t * fti,
funcargvec_t * rargs )

Do not call this function directly, use argtinfo_helper_t.

◆ func_has_stkframe_hole()

idaman bool ida_export func_has_stkframe_hole ( ea_t ea,
const func_type_data_t & fti )

Looks for a hole at the beginning of the stack arguments.

Will make use of the IDB's func_t function at that place (if present) to help determine the presence of such a hole.

◆ lower_type()

idaman int ida_export lower_type ( til_t * til,
tinfo_t * tif,
const char * name = nullptr,
lowertype_helper_t * _helper = nullptr )

Lower type.

Inspect the type and lower all function subtypes using lower_func_type().
We call the prototypes usually encountered in source files "high level"
They may have implicit arguments, array arguments, big structure retvals, etc
We introduce explicit arguments (i.e. 'this' pointer) and call the result
"low level prototype". See #FTI_HIGH.

In order to improve heuristics for recognition of big structure retvals,
it is recommended to pass a helper that will be used to make decisions.
That helper will be used only for lowering 'tif', and not for the children
types walked through by recursion.

Return values
1removed #FTI_HIGH,
2made substantial changes
-1failure

◆ replace_ordinal_typerefs()

idaman int ida_export replace_ordinal_typerefs ( til_t * til,
tinfo_t * tif )

Replace references to ordinal types by name references.

This function 'unties' the type from the current local type library and makes it easier to export it.

Parameters
tiltype library to use. may be nullptr.
tiftype to modify (in/out)
Return values
numberof replaced subtypes, -1 on failure

◆ begin_type_updating()

idaman void ida_export begin_type_updating ( update_type_t utp)

Mark the beginning of a large update operation on the types.

Can be used with add_enum_member(), add_struc_member, etc... Also see end_type_updating()

◆ end_type_updating()

idaman void ida_export end_type_updating ( update_type_t utp)

Mark the end of a large update operation on the types (see begin_type_updating())

◆ DECLARE_TYPE_AS_MOVABLE() [13/15]

DECLARE_TYPE_AS_MOVABLE ( valinfo_t )

◆ DECLARE_TYPE_AS_MOVABLE() [14/15]

DECLARE_TYPE_AS_MOVABLE ( valstr_t )

◆ format_cdata()

idaman bool ida_export format_cdata ( qstrvec_t * outvec,
const idc_value_t & idc_value,
const tinfo_t * tif,
valstr_t * vtree = nullptr,
const format_data_info_t * fdi = nullptr )

Format a data value as a C initializer.

Parameters
outvecbuffer for the formatted string(s). may be nullptr
idc_valuevalue to format
tiftype of the data to format. if nullptr and #PTV_DEREF is specified, take tinfo from idb
vtreemore detailed output info
fdiformatting options
Returns
success. if failed, see qerrno for more info

◆ print_cdata()

idaman int ida_export print_cdata ( text_sink_t & printer,
const idc_value_t & idc_value,
const tinfo_t * tif,
const format_data_info_t * fdi = nullptr )

The same as format_cdata(), but instead of returning the answer in a vector, print it.

This function can handle very huge data volume without using too much memory. As soon as the output text becomes too long, the function prints it and flushes its internal buffers.

Return values
0ok
-1printing failed, check qerrno
elsecode returned by text_sink_t::print()

◆ print_decls()

idaman int ida_export print_decls ( text_sink_t & printer,
const til_t * til,
const ordvec_t * ordinals,
uint32 pdf_flags )

Print types (and possibly their dependencies) in a format suitable for using in a header file.

This is the reverse parse_decls().

Parameters
printera handler for printing text
tilthe type library holding the ordinals
ordinalsordinals of types to export. nullptr means: all ordinals in til
pdf_flagsflags for the algorithm. A combination of PDF_ constants
Return values
>0the number of types exported
0an error occurred
<0the negated number of types exported. There were minor errors and the resulting output might not be compilable.

◆ calc_number_of_children()

idaman int ida_export calc_number_of_children ( const argloc_t & loc,
const tinfo_t & tif,
bool dont_deref_ptr = false )

Calculate max number of lines of a formatted c data, when expanded (#PTV_EXPAND).

Parameters
loclocation of the data (ALOC_STATIC or ALOC_CUSTOM)
tiftype info
dont_deref_ptrconsider 'ea' as the ptr value
Return values
0data is not expandable
-1error, see qerrno
elsethe max number of lines

◆ get_enum_member_expr()

idaman bool ida_export get_enum_member_expr ( qstring * buf,
const tinfo_t & tif,
int serial,
uint64 value )

Return a C expression that can be used to represent an enum member.

If the value does not correspond to any single enum member, this function tries to find a bitwise combination of enum members that correspond to it. If more than half of value bits do not match any enum members, it fails.

Parameters
bufoutput buffer
tifenumeration type
serialwhich enumeration member to use (0 means the first with the given value)
valuevalue to search in the enumeration type
Returns
success

◆ DECLARE_TYPE_AS_MOVABLE() [15/15]

DECLARE_TYPE_AS_MOVABLE ( til_symbol_t )

◆ choose_named_type()

idaman bool ida_export choose_named_type ( til_symbol_t * out_sym,
const til_t * root_til,
const char * title,
int ntf_flags,
predicate_t * predicate = nullptr )

Choose a type from a type library.

Parameters
out_sympointer to be filled with the chosen type
root_tilpointer to starting til (the function will inspect the base tils if allowed by flags)
titletitle of listbox to display
ntf_flagscombination of Flags for named types
predicatepredicate to select types to display (maybe nullptr)
Returns
false if nothing is chosen, otherwise true

◆ choose_local_tinfo()

idaman uint32 ida_export choose_local_tinfo ( const til_t * ti,
const char * title,
local_tinfo_predicate_t * func = nullptr,
uint32 def_ord = 0,
void * ud = nullptr )

Choose a type from the local type library.

Parameters
tipointer to til
titletitle of listbox to display
funcpredicate to select types to display (maybe nullptr)
def_ordordinal to position cursor before choose
uduser data
Returns
== 0 means nothing is chosen, otherwise an ordinal number

◆ choose_local_tinfo_and_delta()

idaman uint32 ida_export choose_local_tinfo_and_delta ( int32 * delta,
const til_t * ti,
const char * title,
local_tinfo_predicate_t * func = nullptr,
uint32 def_ord = 0,
void * ud = nullptr )

Choose a type from the local type library and specify the pointer shift value.

Parameters
deltapointer shift value
tipointer to til
titletitle of listbox to display
funcpredicate to select types to display (maybe nullptr)
def_ordordinal to position cursor before choose
uduser data
Returns
== 0 means nothing is chosen, otherwise an ordinal number

◆ visit_edms()

idaman ssize_t ida_export visit_edms ( const tinfo_t & tif,
uint64 value,
int nbytes,
uchar serial,
const enum_type_visitor_t & visitor )

Visit enum members having the specified value.

Parameters
tifenum type
valuevalue to visit
nbytessize of value in bytes
serialuse the enum constant with the specified serial; if it does not exist, use serial 0
visitorthe visitor function
Returns
-1 if TIF is not a enum type; code from VISITOR or 0 if no member was visited
Note
  1. For ordinary enums, two values are checked for equality:
    • the zero-extended VALUE
    • the sign-extended VALUE
  2. For bitmask enums, the following members are visited:
    • the regular member of the bitmask group
    • the bitmask itself
  3. Enum constant with value 0 is acceptable

◆ calc_retloc() [2/2]

bool calc_retloc ( argloc_t * retloc,
const tinfo_t & rettype,
callcnv_t cc )
inline

Variable Documentation

◆ BADSIZE

const size_t BADSIZE = size_t(-1)

bad type size

◆ TYPID_ISREF

const int TYPID_ISREF = 0x100

Identifies that a type that is a typeref.

◆ TYPID_SHIFT

const int TYPID_SHIFT = 9

First type detail bit.

◆ MAX_ENUM_SERIAL

const uchar MAX_ENUM_SERIAL = 255

Max number of identical constants allowed for one enum type.