Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | list_kind |
Functions | |
RZ_API void | rz_type_base_enum_case_free (void *e, void *user) |
RZ_API void | rz_type_base_struct_member_free (void *e, void *user) |
RZ_API void | rz_type_base_union_member_free (void *e, void *user) |
RZ_API RZ_BORROW const char * | rz_type_base_type_kind_as_string (RzBaseTypeKind kind) |
Returns string representing the kind of base type. More... | |
RZ_API RZ_BORROW RzBaseType * | rz_type_db_get_base_type (const RzTypeDB *typedb, RZ_NONNULL const char *name) |
Searches for the RzBaseType in the types database given the name. More... | |
RZ_API bool | rz_type_db_delete_base_type (RzTypeDB *typedb, RZ_NONNULL RzBaseType *type) |
Removes RzBaseType from the Types DB. More... | |
static bool | base_type_kind_collect_cb (void *user, const void *k, const void *v) |
RZ_API RZ_OWN RzList * | rz_type_db_get_base_types_of_kind (const RzTypeDB *typedb, RzBaseTypeKind kind) |
Returns the list of all basic types of the chosen kind. More... | |
static bool | base_type_collect_cb (void *user, const void *k, const void *v) |
RZ_API RZ_OWN RzList * | rz_type_db_get_base_types (const RzTypeDB *typedb) |
Returns the list of all basic types. More... | |
RZ_API void | rz_type_base_type_free (RzBaseType *type) |
Frees the RzBaseType instance and all of its members. More... | |
RZ_API RZ_OWN RzBaseType * | rz_type_base_type_new (RzBaseTypeKind kind) |
Allocates a new instance of RzBaseType given the kind. More... | |
RZ_API void | rz_type_db_save_base_type (const RzTypeDB *typedb, const RzBaseType *type) |
Saves RzBaseType into the Types DB. More... | |
RZ_API RZ_OWN char * | rz_type_db_base_type_as_string (const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *btype) |
Returns C representation as string of RzBaseType (see rz_type_db_base_type_as_pretty_string for cusom print options) More... | |
RZ_API RZ_OWN char * | rz_type_db_base_type_as_pretty_string (RZ_NONNULL const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *btype, unsigned int opts, int unfold_level) |
Returns C representation as string of RzBaseType. More... | |
RZ_API RZ_BORROW RzBaseType * | rz_type_db_get_compound_type (const RzTypeDB *typedb, RZ_NONNULL const char *name) |
Searches for the compound RzBaseType in the types database given the name. More... | |
Definition at line 108 of file base.c.
References k, rz_list_append(), rz_return_val_if_fail, and v.
Referenced by rz_type_db_get_base_types().
Definition at line 85 of file base.c.
References rz_base_type_t::kind, list_kind::kind, rz_list_append(), list_kind::types, and v.
Referenced by rz_type_db_get_base_types_of_kind().
RZ_API void rz_type_base_enum_case_free | ( | void * | e, |
void * | user | ||
) |
Definition at line 8 of file base.c.
References e, free(), and rz_type_enum_case_t::name.
Referenced by parse_enum(), parse_enum_type(), and rz_type_base_type_new().
RZ_API void rz_type_base_struct_member_free | ( | void * | e, |
void * | user | ||
) |
Definition at line 14 of file base.c.
References e, free(), rz_type_struct_member_t::name, rz_type_free(), and rz_type_struct_member_t::type.
Referenced by parse_structure(), and rz_type_base_type_new().
RZ_API void rz_type_base_type_free | ( | RzBaseType * | type | ) |
Frees the RzBaseType instance and all of its members.
type | RzBaseType pointer |
Definition at line 132 of file base.c.
References NULL, RZ_BASE_TYPE_KIND_ATOMIC, RZ_BASE_TYPE_KIND_ENUM, RZ_BASE_TYPE_KIND_STRUCT, RZ_BASE_TYPE_KIND_TYPEDEF, RZ_BASE_TYPE_KIND_UNION, RZ_FREE, rz_return_if_fail, rz_type_free(), rz_vector_fini(), and type.
Referenced by c_parser_new_enum_type(), c_parser_new_primitive_type(), c_parser_new_structure_type(), c_parser_new_typedef(), c_parser_new_union_type(), get_atomic_type(), get_enum_type(), get_struct_type(), get_typedef_type(), get_union_type(), parse_enum(), parse_enum_type(), parse_sole_type_name(), parse_structure(), parse_structure_type(), parse_typedef(), parse_union(), rz_type_db_edit_base_type(), and types_ht_free().
RZ_API RZ_BORROW const char* rz_type_base_type_kind_as_string | ( | RzBaseTypeKind | kind | ) |
Returns string representing the kind of base type.
kind | RzBaseTypeKind to return string representation of |
Definition at line 33 of file base.c.
References RZ_BASE_TYPE_KIND_ATOMIC, RZ_BASE_TYPE_KIND_ENUM, RZ_BASE_TYPE_KIND_STRUCT, RZ_BASE_TYPE_KIND_TYPEDEF, RZ_BASE_TYPE_KIND_UNION, and rz_warn_if_reached.
Referenced by parse_enum(), parse_structure(), and parse_union().
RZ_API RZ_OWN RzBaseType* rz_type_base_type_new | ( | RzBaseTypeKind | kind | ) |
Allocates a new instance of RzBaseType given the kind.
kind | Kind of RzBaseType to create |
Definition at line 162 of file base.c.
References list_kind::kind, NULL, RZ_BASE_TYPE_KIND_ENUM, RZ_BASE_TYPE_KIND_STRUCT, RZ_BASE_TYPE_KIND_UNION, RZ_NEW0, rz_type_base_enum_case_free(), rz_type_base_struct_member_free(), rz_type_base_union_member_free(), rz_vector_init(), and type.
Referenced by c_parser_new_enum_type(), c_parser_new_primitive_type(), c_parser_new_structure_type(), c_parser_new_typedef(), c_parser_new_union_type(), get_atomic_type(), get_enum_type(), get_struct_type(), get_typedef_type(), get_union_type(), parse_atomic_type(), parse_enum(), parse_enum_type(), parse_structure(), parse_structure_type(), parse_type_nest(), parse_typedef(), and parse_union().
RZ_API void rz_type_base_union_member_free | ( | void * | e, |
void * | user | ||
) |
Definition at line 21 of file base.c.
References e, free(), rz_type_union_member_t::name, rz_type_free(), and rz_type_union_member_t::type.
Referenced by parse_union(), and rz_type_base_type_new().
RZ_API RZ_OWN char* rz_type_db_base_type_as_pretty_string | ( | RZ_NONNULL const RzTypeDB * | typedb, |
RZ_NONNULL const RzBaseType * | btype, | ||
unsigned int | opts, | ||
int | unfold_level | ||
) |
Returns C representation as string of RzBaseType.
typedb | type database instance |
btype | RzBaseType to convert |
opts | options for pretty printing (see RzTypePrintOpts) |
unfold_level | level of unfolding to do in case of nested structures/unions (any negative number means maximum unfolding, i.e. INT32_MAX. 0 means no unfolding, just the typename and identifier, if any) |
rz_type_as_pretty_string
, but for RzBaseType) Definition at line 219 of file base.c.
References NULL, rz_return_val_if_fail, rz_type_as_pretty_string(), rz_type_identifier_of_base_type(), and type.
Referenced by pdb_types_print_standard(), rz_core_base_type_as_c(), rz_core_types_enum_as_c(), rz_core_types_struct_as_c(), rz_core_types_typedef_as_c(), and rz_core_types_union_as_c().
RZ_API RZ_OWN char* rz_type_db_base_type_as_string | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const RzBaseType * | btype | ||
) |
Returns C representation as string of RzBaseType (see rz_type_db_base_type_as_pretty_string for cusom print options)
typedb | type database instance |
btype | RzBaseType to convert |
Definition at line 203 of file base.c.
References NULL, rz_return_val_if_fail, rz_type_as_pretty_string(), rz_type_identifier_of_base_type(), RZ_TYPE_PRINT_NO_END_SEMICOLON, RZ_TYPE_PRINT_ZERO_VLA, and type.
RZ_API bool rz_type_db_delete_base_type | ( | RzTypeDB * | typedb, |
RZ_NONNULL RzBaseType * | type | ||
) |
Removes RzBaseType from the Types DB.
typedb | Type Database instance |
type | RzBaseType to remove |
Definition at line 74 of file base.c.
References rz_return_val_if_fail, type, and rz_type_db_t::types.
Referenced by parse_enum(), parse_structure(), parse_union(), and rz_type_db_del().
RZ_API RZ_BORROW RzBaseType* rz_type_db_get_base_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const char * | name | ||
) |
Searches for the RzBaseType in the types database given the name.
typedb | Type Database instance |
name | Name of the RzBaseType |
Definition at line 57 of file base.c.
References found, NULL, rz_return_val_if_fail, and rz_type_db_t::types.
Referenced by get_base_type_typeclass(), get_tpitype_basetype(), get_type_typeclass(), parse_type_nest(), resolve_type_links(), rz_core_types_as_c(), rz_type_array_of_base_type_str(), rz_type_atomic_eq(), rz_type_atomic_str_eq(), rz_type_db_del(), rz_type_db_enum_get_bitfield(), rz_type_db_enum_member_by_name(), rz_type_db_enum_member_by_val(), rz_type_db_get_bitsize(), rz_type_db_get_compound_type(), rz_type_db_get_enum(), rz_type_db_get_struct(), rz_type_db_get_typedef(), rz_type_db_get_union(), rz_type_db_struct_member_offset(), rz_type_db_struct_member_packed_offset(), rz_type_exists(), rz_type_format(), rz_type_get_base_type(), rz_type_identifier_of_base_type_str(), rz_type_integral_set_sign(), rz_type_is_atomic(), rz_type_is_strictly_atomic(), rz_type_kind(), rz_type_new_default(), rz_type_pointer_of_base_type_str(), structured_member_walker(), type_as_pretty_string(), type_decl_as_pretty_string(), type_paths_collect_by_address_cb(), type_paths_collect_by_offset_cb(), type_to_format_pair(), and var_add_structure_fields_to_list().
Returns the list of all basic types.
typedb | Types Database instance |
Definition at line 120 of file base.c.
References base_type_collect_cb(), NULL, rz_list_new(), rz_return_val_if_fail, types, and rz_type_db_t::types.
Referenced by rz_core_types_print_all(), rz_type_db_all(), and rz_type_db_get_by_offset().
RZ_API RZ_OWN RzList* rz_type_db_get_base_types_of_kind | ( | const RzTypeDB * | typedb, |
RzBaseTypeKind | kind | ||
) |
Returns the list of all basic types of the chosen kind.
typedb | Types Database instance |
kind | Kind of the types to list |
Definition at line 100 of file base.c.
References base_type_kind_collect_cb(), list_kind::kind, NULL, rz_list_new(), rz_return_val_if_fail, types, and rz_type_db_t::types.
Referenced by rz_core_types_enum_as_c_all(), rz_core_types_enum_print_all(), rz_core_types_struct_as_c_all(), rz_core_types_struct_print_all(), rz_core_types_struct_print_format_all(), rz_core_types_typedef_as_c_all(), rz_core_types_typedef_print_all(), rz_core_types_union_as_c_all(), rz_core_types_union_print_all(), rz_core_types_union_print_format_all(), rz_type_db_enum_names(), rz_type_db_find_enums_by_val(), rz_type_db_struct_names(), rz_type_db_typedef_names(), and rz_type_db_union_names().
RZ_API RZ_BORROW RzBaseType* rz_type_db_get_compound_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const char * | name | ||
) |
Searches for the compound RzBaseType in the types database given the name.
Returns all types except atomic - structures, unions, enums, typedefs
typedb | Type Database instance |
name | Name of the RzBaseType |
Definition at line 234 of file base.c.
References rz_base_type_t::kind, NULL, RZ_BASE_TYPE_KIND_ATOMIC, RZ_LOG_ERROR, rz_return_val_if_fail, and rz_type_db_get_base_type().
Referenced by rz_type_db_edit_base_type(), and rz_types_open_editor().
RZ_API void rz_type_db_save_base_type | ( | const RzTypeDB * | typedb, |
const RzBaseType * | type | ||
) |
Saves RzBaseType into the Types DB.
typedb | Type Database instance |
type | RzBaseType to save |
Definition at line 191 of file base.c.
References rz_return_if_fail, type, and rz_type_db_t::types.
Referenced by parse_atomic_type(), parse_enum(), parse_enum_type(), parse_structure(), parse_structure_type(), parse_type_nest(), parse_typedef(), and parse_union().