Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_util/rz_serialize.h>
#include <rz_list.h>
#include <rz_vector.h>
#include <rz_type.h>
#include <sdb.h>
Go to the source code of this file.
Classes | |
struct | TypeFormatPair |
struct | typedb_sdb |
Definition at line 604 of file serialize_types.c.
References s, sdb_save_base_type(), and v.
Referenced by types_export_sdb().
|
static |
Definition at line 278 of file serialize_types.c.
References error(), TypeFormatPair::format, rz_type_t::identifier, key, rz_type_t::kind, rz_base_type_t::name, NULL, RZ_BASE_TYPE_KIND_ATOMIC, RZ_NEW0, rz_return_val_if_fail, RZ_STR_ISNOTEMPTY, rz_strbuf_fini(), rz_strbuf_initf(), rz_strbuf_setf(), rz_type_base_type_free(), rz_type_base_type_new(), RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, rz_type_typeclass_from_string(), RZ_TYPE_TYPECLASS_NONE, sdb_const_get(), sdb_num_get(), set_base_type_typeclass(), rz_base_type_t::size, strdup(), rz_base_type_t::type, and TypeFormatPair::type.
Referenced by sdb_load_base_types().
|
inlinestatic |
Definition at line 15 of file serialize_types.c.
References rz_return_val_if_fail, RZ_TYPE_ATTRIBUTE_TYPECLASS_MASK, RZ_TYPE_TYPECLASS_INVALID, and type.
Referenced by save_atomic_type().
|
static |
Definition at line 36 of file serialize_types.c.
References rz_base_type_enum_t::cases, rz_base_type_t::enum_data, error(), TypeFormatPair::format, free(), get_type_data(), key, rz_type_enum_case_t::name, rz_base_type_t::name, NULL, RZ_BASE_TYPE_KIND_ENUM, RZ_NEW0, rz_return_val_if_fail, RZ_STR_ISNOTEMPTY, rz_str_newf(), rz_strbuf_fini(), rz_strbuf_initf(), rz_type_base_type_free(), rz_type_base_type_new(), rz_vector_push(), rz_vector_reserve(), sdb_aforeach, sdb_aforeach_next, sdb_alen(), sdb_const_get(), sdb_get(), strdup(), TypeFormatPair::type, and value.
Referenced by sdb_load_base_types().
|
static |
Definition at line 95 of file serialize_types.c.
References error(), TypeFormatPair::format, free(), get_type_data(), key, rz_base_type_struct_t::members, rz_type_struct_member_t::name, rz_base_type_t::name, NULL, rz_type_db_t::parser, RZ_BASE_TYPE_KIND_STRUCT, RZ_NEW0, rz_return_val_if_fail, RZ_STR_ISNOTEMPTY, rz_str_newf(), rz_strbuf_fini(), rz_strbuf_initf(), rz_type_base_type_free(), rz_type_base_type_new(), rz_type_parse_string_single(), rz_vector_push(), rz_vector_reserve(), sdb_aforeach, sdb_aforeach_next, sdb_alen(), sdb_anext(), sdb_get(), strdup(), rz_base_type_t::struct_data, type, and TypeFormatPair::type.
Referenced by sdb_load_base_types().
Definition at line 25 of file serialize_types.c.
References free(), key, NULL, rz_return_val_if_fail, RZ_STR_ISNOTEMPTY, rz_str_newf(), sdb_get(), and type.
Referenced by get_enum_type(), get_struct_type(), get_typedef_type(), and get_union_type().
|
static |
Definition at line 240 of file serialize_types.c.
References error(), TypeFormatPair::format, free(), get_type_data(), key, rz_base_type_t::name, NULL, rz_type_db_t::parser, RZ_BASE_TYPE_KIND_TYPEDEF, RZ_NEW0, rz_return_val_if_fail, RZ_STR_ISNOTEMPTY, rz_strbuf_fini(), rz_strbuf_initf(), rz_type_base_type_free(), rz_type_base_type_new(), rz_type_parse_string_single(), sdb_get(), strdup(), type, rz_base_type_t::type, and TypeFormatPair::type.
Referenced by sdb_load_base_types().
|
static |
Definition at line 171 of file serialize_types.c.
References error(), TypeFormatPair::format, free(), get_type_data(), key, rz_base_type_union_t::members, rz_type_union_member_t::name, rz_base_type_t::name, NULL, rz_type_db_t::parser, RZ_BASE_TYPE_KIND_UNION, RZ_NEW0, rz_return_val_if_fail, RZ_STR_ISNOTEMPTY, rz_str_newf(), rz_strbuf_fini(), rz_strbuf_initf(), rz_type_base_type_free(), rz_type_base_type_new(), rz_type_parse_string_single(), rz_vector_push(), rz_vector_reserve(), sdb_aforeach, sdb_aforeach_next, sdb_alen(), sdb_anext(), sdb_get(), strdup(), TypeFormatPair::type, rz_base_type_t::union_data, and value.
Referenced by sdb_load_base_types().
RZ_API bool rz_serialize_types_load | ( | RZ_NONNULL Sdb * | db, |
RZ_NONNULL RzTypeDB * | typedb, | ||
RZ_NULLABLE RzSerializeResultInfo * | res | ||
) |
Loads the types from SDB.
db | A SDB database object |
typedb | RzTypeDB instance |
res | A structure where the result is stored |
Definition at line 688 of file serialize_types.c.
References rz_return_val_if_fail, typedb_sdb::typedb, and types_load_sdb().
Referenced by rz_serialize_analysis_types_load().
RZ_API void rz_serialize_types_save | ( | RZ_NONNULL Sdb * | db, |
RZ_NONNULL const RzTypeDB * | typedb | ||
) |
Saves the types into SDB.
db | A SDB database object |
typedb | RzTypeDB instance |
Definition at line 676 of file serialize_types.c.
References rz_return_if_fail, typedb_sdb::typedb, and types_export_sdb().
Referenced by rz_serialize_analysis_types_save().
RZ_API bool rz_type_db_load_sdb | ( | RzTypeDB * | typedb, |
RZ_NONNULL const char * | path | ||
) |
Loads the types from compiled SDB specified by path.
typedb | RzTypeDB instance |
path | A path to the compiled SDB containing serialized types |
Definition at line 648 of file serialize_types.c.
References path, rz_file_exists(), rz_return_val_if_fail, sdb_load_by_path(), and typedb_sdb::typedb.
Referenced by rz_type_db_init(), and rz_type_open_sdb_handler().
RZ_API bool rz_type_db_load_sdb_str | ( | RzTypeDB * | typedb, |
RZ_NONNULL const char * | str | ||
) |
Loads the types from SDB KV string.
typedb | RzTypeDB instance |
str | A string in Key-Value format as for non-compiled SDB |
Definition at line 662 of file serialize_types.c.
References rz_return_val_if_fail, RZ_STR_ISEMPTY, sdb_load_from_string(), cmd_descs_generate::str, and typedb_sdb::typedb.
|
static |
Definition at line 504 of file serialize_types.c.
References get_base_type_typeclass(), key, PFMT64u, RZ_BASE_TYPE_KIND_ATOMIC, rz_return_if_fail, rz_strbuf_fini(), rz_strbuf_init(), rz_strbuf_setf(), rz_type_db_format_get(), rz_type_typeclass_as_string(), sdb_set(), type, and val.
Referenced by sdb_save_base_type().
|
static |
Definition at line 453 of file serialize_types.c.
References free(), i, key, rz_type_enum_case_t::name, PFMT64x, RZ_BASE_TYPE_KIND_ENUM, rz_return_if_fail, rz_str_newf(), rz_str_sanitize_sdb_key(), rz_strbuf_appendf(), rz_strbuf_fini(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_setf(), rz_vector_foreach, sdb_set(), type, and rz_type_enum_case_t::val.
Referenced by sdb_save_base_type().
|
static |
Definition at line 357 of file serialize_types.c.
References free(), i, key, rz_type_struct_member_t::name, rz_type_struct_member_t::offset, RZ_BASE_TYPE_KIND_STRUCT, rz_return_if_fail, rz_str_newf(), rz_str_sanitize_sdb_key(), rz_strbuf_appendf(), rz_strbuf_fini(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_setf(), rz_type_as_string(), rz_vector_foreach, sdb_set(), type, and rz_type_struct_member_t::type.
Referenced by sdb_save_base_type().
|
static |
Definition at line 538 of file serialize_types.c.
References free(), key, RZ_BASE_TYPE_KIND_TYPEDEF, rz_return_if_fail, rz_strbuf_fini(), rz_strbuf_init(), rz_strbuf_setf(), rz_type_as_string(), sdb_set(), type, and val.
Referenced by sdb_save_base_type().
|
static |
Definition at line 405 of file serialize_types.c.
References free(), i, key, rz_type_union_member_t::name, rz_type_union_member_t::offset, RZ_BASE_TYPE_KIND_UNION, rz_return_if_fail, rz_str_newf(), rz_str_sanitize_sdb_key(), rz_strbuf_appendf(), rz_strbuf_fini(), rz_strbuf_get(), rz_strbuf_init(), rz_strbuf_setf(), rz_type_as_string(), rz_vector_foreach, sdb_set(), type, and rz_type_union_member_t::type.
Referenced by sdb_save_base_type().
Definition at line 319 of file serialize_types.c.
References TypeFormatPair::format, rz_type_db_t::formats, free(), get_atomic_type(), get_enum_type(), get_struct_type(), get_typedef_type(), get_union_type(), ls_foreach, ls_free(), rz_base_type_t::name, NULL, RZ_LOG_DEBUG, rz_return_val_if_fail, sdb_foreach_list(), sdbkv_key(), sdbkv_value(), TypeFormatPair::type, and rz_type_db_t::types.
Referenced by types_load_sdb().
|
static |
Definition at line 617 of file serialize_types.c.
References path, rz_return_val_if_fail, RZ_STR_ISEMPTY, sdb_close(), sdb_free(), sdb_new(), typedb_sdb::typedb, and types_load_sdb().
Referenced by rz_type_db_load_sdb().
|
static |
Definition at line 629 of file serialize_types.c.
References rz_return_val_if_fail, RZ_STR_ISEMPTY, sdb_close(), sdb_free(), sdb_new0(), sdb_query_lines(), typedb_sdb::typedb, and types_load_sdb().
Referenced by rz_type_db_load_sdb_str().
void sdb_save_base_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL Sdb * | sdb, | ||
const RzBaseType * | type | ||
) |
Definition at line 566 of file serialize_types.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, RZ_LOG_DEBUG, rz_return_if_fail, save_atomic_type(), save_enum(), save_struct(), save_typedef(), save_union(), and type.
Referenced by export_base_type_cb().
|
inlinestatic |
Definition at line 20 of file serialize_types.c.
References rz_return_if_fail, RZ_TYPE_TYPECLASS_INVALID, and type.
Referenced by get_atomic_type().
|
static |
Definition at line 611 of file serialize_types.c.
References export_base_type_cb(), typedb_sdb::typedb, and rz_type_db_t::types.
Referenced by rz_serialize_types_save().
RZ_IPI bool types_load_sdb | ( | RZ_NONNULL Sdb * | db, |
RZ_NONNULL RzTypeDB * | typedb | ||
) |
Definition at line 595 of file serialize_types.c.
References sdb_load_base_types().
Referenced by rz_serialize_types_load(), sdb_load_by_path(), and sdb_load_from_string().