Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_analysis.h>
#include <rz_util.h>
#include <rz_list.h>
#include <rz_util/rz_path.h>
#include <config.h>
Go to the source code of this file.
Macros | |
#define | K_NORET_ADDR(x) sdb_fmt("addr.%" PFMT64x ".noreturn", x) |
#define | K_NORET_FUNC(x) sdb_fmt("func.%s.noreturn", x) |
Variables | |
static RzAnalysisPlugin * | analysis_static_plugins [] = { RZ_ANALYSIS_STATIC_PLUGINS } |
Definition at line 463 of file analysis.c.
Definition at line 464 of file analysis.c.
void __block_free_rb | ( | RBNode * | node, |
void * | user | ||
) |
Definition at line 85 of file block.c.
References block_free(), and unwrap.
Referenced by rz_analysis_block_merge(), rz_analysis_block_unref(), and rz_analysis_free().
|
static |
Definition at line 229 of file analysis.c.
References free(), rz_analysis_t::os, rz_path_system(), rz_return_val_if_fail, RZ_SDB_TYPES, RZ_SYS_OS, rz_type_db_reload(), rz_type_db_set_os(), strdup(), and rz_analysis_t::typedb.
Referenced by rz_analysis_set_triplet().
|
static |
Definition at line 58 of file analysis.c.
References free(), and rz_analysis_var_global_free().
Referenced by rz_analysis_new().
|
static |
Definition at line 260 of file analysis.c.
References rz_analysis_t::bits, bits(), and rz_analysis_t::cpu.
Referenced by rz_analysis_set_bits().
Definition at line 35 of file analysis.c.
References container_of, rz_space_event_t::count, rz_space_event_t::data, rz_space_event_t::res, rz_meta_space_count_for(), s, and rz_event_t::user.
Referenced by rz_analysis_new().
Definition at line 28 of file analysis.c.
References container_of, rz_space_event_t::data, rz_meta_space_unset_for(), s, rz_space_event_t::unset, and rz_event_t::user.
Referenced by rz_analysis_new().
|
static |
Definition at line 561 of file analysis.c.
References addr, rz_io_bind_t::io, rz_analysis_t::iob, PFMT64x, rz_io_bind_t::read_at, rz_analysis_noreturn_at(), rz_analysis_op(), RZ_ANALYSIS_OP_MASK_BASIC, RZ_ANALYSIS_OP_MASK_VAL, RZ_ANALYSIS_OP_TYPE_CALL, RZ_ANALYSIS_OP_TYPE_CCALL, RZ_ANALYSIS_OP_TYPE_ICALL, RZ_ANALYSIS_OP_TYPE_IRCALL, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_MASK, RZ_ANALYSIS_OP_TYPE_RCALL, RZ_ANALYSIS_OP_TYPE_UCALL, RZ_LOG_ERROR, ut64(), and UT64_MAX.
Referenced by rz_analysis_noreturn_at().
RZ_API void plugin_fini | ( | RzAnalysis * | analysis | ) |
Definition at line 127 of file analysis.c.
References rz_analysis_t::cur, NULL, p, rz_analysis_t::plugin_data, and RZ_LOG_ERROR.
Referenced by rz_analysis_free(), and rz_analysis_use().
RZ_API int rz_analysis_add | ( | RzAnalysis * | analysis, |
RzAnalysisPlugin * | p | ||
) |
Definition at line 179 of file analysis.c.
References p, rz_analysis_t::plugins, and rz_list_append().
Referenced by __lib_analysis_cb(), and rz_analysis_new().
RZ_API void rz_analysis_add_import | ( | RzAnalysis * | analysis, |
const char * | imp | ||
) |
Definition at line 693 of file analysis.c.
References rz_analysis_t::imports, rz_list_push(), and strdup().
Referenced by import_load_cb(), and rz_global_imports_handler().
RZ_API int rz_analysis_archinfo | ( | RzAnalysis * | analysis, |
int | query | ||
) |
Definition at line 449 of file analysis.c.
References rz_analysis_plugin_t::archinfo, rz_analysis_t::cur, RZ_ANALYSIS_ARCHINFO_ALIGN, RZ_ANALYSIS_ARCHINFO_MAX_OP_SIZE, RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE, and rz_return_val_if_fail.
Referenced by _analysis_calls(), _CbInRangeAav(), alignCheck(), cb_analysis_cpu(), cb_asmarch(), cb_asmbits(), cmd_aea(), do_syscall_search(), prevop_addr(), rz_analysis_set_bits(), rz_analysis_set_cpu(), rz_analysis_update_analysis_range(), rz_core_analysis_bytes(), rz_core_analysis_esil_emulate(), rz_core_analysis_resolve_golang_strings(), rz_core_analysis_type_match(), rz_core_analysis_value_pointers(), rz_core_bin_apply_config(), rz_core_bin_info_print(), rz_core_disasm_pde(), rz_core_esil_step(), rz_core_get_stacksz(), rz_core_link_stroff(), rz_core_seek_opcode_backward(), and rz_debug_step_soft().
RZ_API void rz_analysis_bind | ( | RzAnalysis * | analysis, |
RzAnalysisBind * | b | ||
) |
Definition at line 661 of file analysis.c.
References b, rz_analysis_get_fcn_in(), and rz_analysis_hint_get().
Referenced by rz_core_init().
RZ_API RzAnalysis* rz_analysis_free | ( | RzAnalysis * | a | ) |
Definition at line 137 of file analysis.c.
References __block_free_rb(), a, free(), NULL, plugin_fini(), rz_analysis_esil_free(), rz_analysis_hint_storage_fini(), rz_analysis_il_vm_cleanup(), rz_hash_free(), rz_interval_tree_fini(), rz_list_free(), rz_platform_target_free(), rz_platform_target_index_free(), rz_rbtree_free(), rz_reg_free(), rz_spaces_fini(), rz_str_constpool_fini(), rz_syscall_free(), rz_type_db_free(), sdb_free(), and set_u_free().
Referenced by __as_free(), and rz_core_fini().
RZ_API int rz_analysis_get_address_bits | ( | RzAnalysis * | analysis | ) |
The actual size of an address in bits.
This may differ from analysis.bits in some cases such as arm thumb being identified as bits=16, but still using 32-bit addresses, or "8-bit" architectures like 6502 which still use 16-bit addresses.
Definition at line 303 of file analysis.c.
References rz_analysis_plugin_t::address_bits, rz_analysis_t::bits, rz_analysis_t::cur, and r.
Referenced by rz_analysis_set_bits(), rz_core_reg_flags_candidates(), and rz_print_hexword_references_handler().
RZ_API RzList* rz_analysis_get_fcns | ( | RzAnalysis * | analysis | ) |
Definition at line 392 of file analysis.c.
References rz_analysis_t::fcns, rz_list_t::free, and NULL.
Referenced by rz_core_diff_show().
RZ_API char* rz_analysis_get_reg_profile | ( | RzAnalysis * | analysis | ) |
Definition at line 212 of file analysis.c.
References rz_analysis_t::cur, rz_analysis_plugin_t::get_reg_profile, and NULL.
Referenced by __esil_reg_profile(), __io_reg_profile(), and rz_analysis_set_reg_profile().
void rz_analysis_hint_storage_fini | ( | RzAnalysis * | a | ) |
Definition at line 79 of file hint.c.
References a, arch_hint_record_free_rb(), bits_hint_record_free_rb(), NULL, and rz_rbtree_free().
Referenced by rz_analysis_free(), and rz_analysis_hint_clear().
void rz_analysis_hint_storage_init | ( | RzAnalysis * | a | ) |
Definition at line 72 of file hint.c.
References a, addr_hint_record_ht_free(), and NULL.
Referenced by rz_analysis_hint_clear(), and rz_analysis_new().
|
static |
Definition at line 534 of file analysis.c.
References K_NORET_FUNC, NULL, rz_type_func_is_noreturn(), sdb_bool_get(), rz_analysis_t::sdb_noret, and rz_analysis_t::typedb.
Referenced by rz_analysis_noreturn_at_name().
Definition at line 676 of file analysis.c.
References rz_search_keyword_t::bin_keyword, rz_search_keyword_t::keyword_length, len, rz_analysis_preludes(), and rz_list_free().
Referenced by run_basic_block_analysis(), and rz_analysis_check_fcn().
Definition at line 334 of file analysis.c.
References rz_analysis_plugin_t::analysis_mask, rz_analysis_t::cur, setup::idx, malloc(), memset(), NULL, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_free(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_BASIC, rz_analysis_op_new(), and UT64_MAX.
Referenced by rz_core_analysis_bytes(), and rz_sign_flirt_node_new().
RZ_API RzAnalysis* rz_analysis_new | ( | void | ) |
Definition at line 63 of file analysis.c.
References analysis_static_plugins, rz_analysis_t::arch_target, rz_analysis_t::bb_tree, rz_analysis_t::constpool, rz_analysis_t::cpp_abi, rz_analysis_options_t::depth, rz_analysis_t::diff_thbb, rz_analysis_t::diff_thfcn, rz_analysis_t::esil_goto_limit, rz_spaces_t::event, rz_analysis_t::fcns, rz_analysis_t::flb, free(), global_kv_free(), rz_analysis_t::global_var_tree, rz_analysis_t::gp, rz_analysis_t::hash, rz_analysis_options_t::hpskip, rz_analysis_t::ht_addr_fun, rz_analysis_t::ht_global_var, rz_analysis_t::ht_name_fun, i, rz_analysis_t::il_vm, rz_analysis_t::imports, rz_analysis_t::iob, rz_analysis_t::last_disasm_reg, rz_analysis_t::leaddrs, rz_analysis_t::lineswidth, rz_analysis_t::meta, meta_count_for(), rz_analysis_t::meta_spaces, meta_unset_for(), rz_analysis_options_t::noncode, rz_analysis_options_t::nopskip, NULL, rz_analysis_t::opt, rz_analysis_t::os, rz_analysis_t::platform_target, rz_analysis_t::plugins, rz_analysis_t::reg, rz_analysis_add(), RZ_ANALYSIS_CPP_ABI_ITANIUM, RZ_ANALYSIS_ESIL_GOTO_LIMIT, rz_analysis_function_free(), rz_analysis_hint_storage_init(), rz_analysis_set_bits(), rz_analysis_xrefs_init(), RZ_ARRAY_SIZE, rz_event_hook(), rz_flag_bind_init, rz_hash_new(), rz_interval_tree_init(), rz_io_bind_init, rz_list_newf(), rz_meta_item_free(), RZ_NEW0, rz_platform_target_index_new(), rz_platform_target_new(), rz_reg_new(), RZ_SPACE_EVENT_COUNT, RZ_SPACE_EVENT_UNSET, rz_spaces_init(), rz_str_constpool_init(), RZ_SYS_OS, rz_syscall_new(), rz_type_db_new(), rz_analysis_t::sdb, rz_analysis_t::sdb_cc, rz_analysis_t::sdb_classes, rz_analysis_t::sdb_classes_attrs, rz_analysis_t::sdb_fmts, sdb_new0(), rz_analysis_t::sdb_noret, sdb_ns(), rz_analysis_t::stackptr, strdup(), rz_analysis_t::syscall, rz_analysis_t::type_links, and rz_analysis_t::typedb.
Referenced by __as_new(), and rz_core_init().
RZ_API bool rz_analysis_noreturn_add | ( | RzAnalysis * | analysis, |
const char * | name, | ||
ut64 | addr | ||
) |
Definition at line 466 of file analysis.c.
References addr, rz_flag_bind_t::f, rz_analysis_t::flb, free(), rz_flag_bind_t::get_at, rz_analysis_function_t::is_noreturn, K_NORET_ADDR, K_NORET_FUNC, name, rz_analysis_function_t::name, rz_flag_item_t::name, NULL, PFMT64x, rz_analysis_function_name_guess(), rz_analysis_get_fcn_in(), rz_analysis_get_function_at(), RZ_LOG_ERROR, rz_type_func_exist(), sdb_bool_set(), rz_analysis_t::sdb_noret, strdup(), rz_analysis_t::typedb, and UT64_MAX.
Referenced by reanalyze_fcns_cb(), relocation_function_process_noreturn(), rz_core_analysis_propagate_noreturn(), and rz_type_list_noreturn_handler().
RZ_API bool rz_analysis_noreturn_at | ( | RzAnalysis * | analysis, |
ut64 | addr | ||
) |
Definition at line 597 of file analysis.c.
References addr, rz_flag_bind_t::f, f, rz_analysis_t::flag_get, rz_analysis_t::flb, rz_flag_item_t::name, noreturn_recurse(), rz_flag_item_t::realname, rz_analysis_t::recursive_noreturn, rz_analysis_get_function_at(), rz_analysis_noreturn_at_addr(), rz_analysis_noreturn_at_name(), and UT64_MAX.
Referenced by noreturn_recurse(), run_basic_block_analysis(), and rz_core_debug_bp_add_noreturn_func().
RZ_API bool rz_analysis_noreturn_at_addr | ( | RzAnalysis * | analysis, |
ut64 | addr | ||
) |
Definition at line 557 of file analysis.c.
References addr, K_NORET_ADDR, NULL, sdb_bool_get(), and rz_analysis_t::sdb_noret.
Referenced by rz_analysis_add_function(), rz_analysis_function_get_json(), and rz_analysis_noreturn_at().
|
static |
Definition at line 539 of file analysis.c.
References free(), rz_analysis_function_name_guess(), rz_analysis_is_noreturn(), rz_str_startswith(), autogen_x86imm::tmp, and rz_analysis_t::typedb.
Referenced by rz_analysis_noreturn_at().
RZ_API bool rz_analysis_noreturn_drop | ( | RzAnalysis * | analysis, |
const char * | expr | ||
) |
Definition at line 514 of file analysis.c.
References expr(), K_NORET_ADDR, K_NORET_FUNC, n, rz_analysis_function_t::name, NULL, rz_analysis_get_fcn_in(), rz_num_math(), rz_str_trim_head_ro(), rz_analysis_t::sdb_noret, sdb_unset(), and ut64().
RZ_API RzList* rz_analysis_noreturn_functions | ( | RzAnalysis * | analysis | ) |
Definition at line 623 of file analysis.c.
References addr, d, free(), k, ls_foreach, ls_free(), NULL, off, rz_list_append(), rz_return_val_if_fail, rz_str_newf(), rz_type_noreturn_function_names(), s, sdb_foreach_list(), rz_analysis_t::sdb_noret, sdbkv_key(), strdup(), and rz_analysis_t::typedb.
Referenced by rz_core_analysis_propagate_noreturn_relocs().
RZ_API RzAnalysisOp* rz_analysis_op_hexstr | ( | RzAnalysis * | analysis, |
ut64 | addr, | ||
const char * | str | ||
) |
Definition at line 398 of file analysis.c.
References addr, calloc(), free(), len, NULL, op, rz_analysis_op(), RZ_ANALYSIS_OP_MASK_BASIC, rz_hex_str2bin(), RZ_NEW0, and cmd_descs_generate::str.
RZ_API bool rz_analysis_op_is_eob | ( | RzAnalysisOp * | op | ) |
Definition at line 414 of file analysis.c.
References RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_IJMP, RZ_ANALYSIS_OP_TYPE_IRJMP, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_RJMP, RZ_ANALYSIS_OP_TYPE_TRAP, and RZ_ANALYSIS_OP_TYPE_UJMP.
Referenced by num_callback().
RZ_API RzList* rz_analysis_preludes | ( | RzAnalysis * | analysis | ) |
Definition at line 669 of file analysis.c.
References rz_analysis_t::cur, NULL, and rz_analysis_plugin_t::preludes.
Referenced by rz_analysis_is_prelude(), and rz_core_search_preludes().
RZ_API void rz_analysis_purge | ( | RzAnalysis * | analysis | ) |
Definition at line 433 of file analysis.c.
References rz_analysis_t::fcns, rz_analysis_t::meta, rz_analysis_function_free(), rz_analysis_hint_clear(), rz_analysis_purge_imports(), rz_interval_tree_fini(), rz_interval_tree_init(), rz_list_free(), rz_list_newf(), rz_meta_item_free(), rz_type_db_purge(), rz_analysis_t::sdb_cc, rz_analysis_t::sdb_classes, rz_analysis_t::sdb_classes_attrs, rz_analysis_t::sdb_noret, sdb_reset(), rz_analysis_t::type_links, and rz_analysis_t::typedb.
Referenced by rz_open_close_all_handler(), and rz_serialize_analysis_load().
RZ_API void rz_analysis_purge_imports | ( | RzAnalysis * | analysis | ) |
Definition at line 719 of file analysis.c.
References rz_analysis_t::imports, and rz_list_purge().
Referenced by rz_analysis_purge(), and rz_delete_global_imports_handler().
RZ_API void rz_analysis_remove_import | ( | RzAnalysis * | analysis, |
const char * | imp | ||
) |
Definition at line 708 of file analysis.c.
References rz_analysis_t::imports, and rz_list_delete().
RZ_API int rz_analysis_set_big_endian | ( | RzAnalysis * | analysis, |
int | bigend | ||
) |
Definition at line 325 of file analysis.c.
References rz_analysis_t::big_endian, rz_reg_t::big_endian, rz_analysis_t::reg, rz_type_db_set_endian(), and rz_analysis_t::typedb.
Referenced by cb_asmarch(), cb_bigendian(), and rz_main_rz_asm().
RZ_API bool rz_analysis_set_bits | ( | RzAnalysis * | analysis, |
int | bits | ||
) |
Definition at line 270 of file analysis.c.
References rz_analysis_t::bits, bits(), free(), is_arm_thumb_hack(), rz_analysis_t::pcalign, rz_analysis_archinfo(), RZ_ANALYSIS_ARCHINFO_ALIGN, rz_analysis_get_address_bits(), rz_analysis_set_reg_profile(), RZ_MAX, rz_path_system(), RZ_SDB_TYPES, rz_type_db_reload(), rz_type_db_set_address_bits(), rz_type_db_set_bits(), rz_analysis_t::typedb, and v.
Referenced by __as_set_archbits(), cb_asmbits(), rz_analysis_new(), rz_analysis_set_triplet(), and rz_main_rz_asm().
RZ_API void rz_analysis_set_cpu | ( | RzAnalysis * | analysis, |
const char * | cpu | ||
) |
Definition at line 311 of file analysis.c.
References cpu, rz_analysis_t::cpu, free(), NULL, rz_analysis_t::pcalign, rz_analysis_archinfo(), RZ_ANALYSIS_ARCHINFO_ALIGN, rz_analysis_set_reg_profile(), rz_path_system(), RZ_SDB_TYPES, rz_type_db_reload(), rz_type_db_set_cpu(), strdup(), rz_analysis_t::typedb, and v.
Referenced by cb_analysis_cpu(), and rz_main_rz_asm().
RZ_API void rz_analysis_set_limits | ( | RzAnalysis * | analysis, |
ut64 | from, | ||
ut64 | to | ||
) |
Definition at line 15 of file analysis.c.
References free(), rz_analysis_range_t::from, from, rz_analysis_t::limit, RZ_NEW0, rz_analysis_range_t::to, and to.
Referenced by cb_analysis_from(), and cb_analysis_limits().
RZ_API bool rz_analysis_set_os | ( | RzAnalysis * | analysis, |
const char * | os | ||
) |
Definition at line 256 of file analysis.c.
References NULL, and rz_analysis_set_triplet().
Referenced by cb_asmos().
RZ_API bool rz_analysis_set_reg_profile | ( | RzAnalysis * | analysis | ) |
Definition at line 218 of file analysis.c.
References free(), p, rz_analysis_t::reg, rz_analysis_get_reg_profile(), and rz_reg_set_profile_string().
Referenced by cb_asmbits(), rz_analysis_set_bits(), rz_analysis_set_cpu(), and rz_analysis_use().
RZ_API bool rz_analysis_set_triplet | ( | RzAnalysis * | analysis, |
const char * | os, | ||
const char * | arch, | ||
int | bits | ||
) |
Definition at line 243 of file analysis.c.
References analysis_set_os(), rz_analysis_plugin_t::arch, arch, rz_analysis_t::bits, bits(), rz_analysis_t::cur, rz_analysis_set_bits(), rz_analysis_use(), rz_return_val_if_fail, and RZ_SYS_ARCH.
Referenced by rz_analysis_set_os().
RZ_API void rz_analysis_trace_bb | ( | RzAnalysis * | analysis, |
ut64 | addr | ||
) |
Definition at line 377 of file analysis.c.
References addr, rz_analysis_bb_t::addr, rz_analysis_function_t::bbs, rz_analysis_get_fcn_in(), rz_analysis_bb_t::size, and rz_analysis_bb_t::traced.
Referenced by rz_debug_trace_add().
RZ_API void rz_analysis_unset_limits | ( | RzAnalysis * | analysis | ) |
Definition at line 24 of file analysis.c.
References rz_analysis_t::limit, and RZ_FREE.
Referenced by cb_analysis_limits().
RZ_API bool rz_analysis_use | ( | RzAnalysis * | analysis, |
const char * | name | ||
) |
Definition at line 184 of file analysis.c.
References rz_analysis_t::cur, h, rz_analysis_t::il_vm, rz_analysis_plugin_t::name, rz_analysis_t::plugin_data, plugin_fini(), rz_analysis_t::plugins, rz_analysis_il_vm_setup(), rz_analysis_set_reg_profile(), and RZ_LOG_ERROR.
Referenced by __as_set_archbits(), cb_analysis_arch(), rz_analysis_set_triplet(), rz_core_init(), and rz_main_rz_asm().
RZ_LIB_VERSION | ( | rz_analysis | ) |
|
static |
Definition at line 46 of file analysis.c.
References free(), and rz_analysis_meta_item_t::str.
Referenced by rz_meta_item_free().
|
static |
Definition at line 50 of file analysis.c.
References free(), and rz_meta_item_fini().
Referenced by rz_analysis_new(), and rz_analysis_purge().
|
static |
Definition at line 13 of file analysis.c.
Referenced by rz_analysis_new().