Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_analysis.h>
Go to the source code of this file.
Classes | |
struct | InstVarsRelocateCtx |
Macros | |
#define | MIN_MATCH_LEN 4 |
#define MIN_MATCH_LEN 4 |
Definition at line 383 of file function.c.
|
static |
Definition at line 29 of file function.c.
References addr, f, found, rz_analysis_t::ht_addr_fun, rz_analysis_t::ht_name_fun, PFMT64x, RZ_LOG_ERROR, RZ_LOG_INFO, and UT64_MAX.
Referenced by rz_analysis_add_function().
|
static |
Definition at line 432 of file function.c.
References rz_str_isnumber(), and rz_str_lchr().
Referenced by rz_analysis_function_name_guess().
|
static |
Definition at line 298 of file function.c.
References rz_analysis_fcn_meta_t::_max, rz_analysis_fcn_meta_t::_min, rz_analysis_bb_t::addr, rz_analysis_function_t::bbs, rz_analysis_function_t::meta, rz_analysis_bb_t::size, ut64(), UT64_MAX, and UT64_MIN.
Referenced by rz_analysis_function_linear_size(), rz_analysis_function_max_addr(), rz_analysis_function_min_addr(), and rz_analysis_function_size_from_entry().
|
static |
Definition at line 350 of file function.c.
References rz_analysis_bb_t::fcns.
Referenced by rz_analysis_function_contains().
|
static |
Definition at line 385 of file function.c.
References MIN_MATCH_LEN, NULL, rz_type_func_exist(), and strdup().
Referenced by rz_analysis_function_name_guess().
|
static |
Definition at line 7 of file function.c.
References rz_analysis_bb_t::fcns, list(), rz_list_contains(), and rz_list_push().
Referenced by rz_analysis_get_functions_in().
Definition at line 399 of file function.c.
Referenced by rz_analysis_function_is_autonamed(), and strip_rz_prefixes().
|
static |
Definition at line 57 of file function.c.
References rz_pvector_free().
Referenced by rz_analysis_function_new(), and rz_analysis_function_relocate().
Definition at line 198 of file function.c.
Referenced by rz_analysis_function_relocate().
Definition at line 395 of file function.c.
References rz_str_startswith().
Referenced by rz_analysis_function_is_autonamed(), and rz_analysis_function_name_guess().
|
static |
Definition at line 65 of file function.c.
References free().
Referenced by rz_analysis_function_new().
|
static |
Definition at line 61 of file function.c.
References free().
Referenced by rz_analysis_function_new().
RZ_API bool rz_analysis_add_function | ( | RzAnalysis * | analysis, |
RzAnalysisFunction * | fcn | ||
) |
Definition at line 129 of file function.c.
References __fcn_exists(), rz_analysis_function_t::addr, rz_analysis_t::cb, rz_analysis_t::core, rz_flag_bind_t::f, rz_analysis_t::fcns, rz_analysis_t::flb, rz_analysis_t::flg_fcn_set, rz_analysis_t::ht_addr_fun, rz_analysis_t::ht_name_fun, rz_analysis_function_t::is_noreturn, rz_analysis_function_t::name, rz_analysis_callbacks_t::on_fcn_new, rz_analysis_function_size_from_entry(), rz_analysis_noreturn_at_addr(), and rz_list_append().
Referenced by __core_analysis_fcn(), and rz_analysis_create_function().
RZ_API RzAnalysisFunction* rz_analysis_create_function | ( | RzAnalysis * | analysis, |
const char * | name, | ||
ut64 | addr, | ||
int | type, | ||
RzAnalysisDiff * | diff | ||
) |
Definition at line 146 of file function.c.
References addr, rz_analysis_diff_t::addr, rz_analysis_function_t::addr, rz_analysis_function_t::bits, rz_analysis_t::bits, rz_analysis_function_t::cc, rz_core_bind_t::cfgGet, rz_analysis_t::constpool, rz_core_bind_t::core, rz_analysis_t::coreb, rz_analysis_function_t::diff, free(), rz_analysis_diff_t::name, rz_analysis_function_t::name, NULL, PFMT64x, rz_analysis_add_function(), rz_analysis_cc_default(), rz_analysis_function_free(), rz_analysis_function_new(), RZ_FREE, rz_str_constpool_get(), rz_str_newf(), strdup(), type, rz_analysis_diff_t::type, and rz_analysis_function_t::type.
Referenced by rz_analysis_function_create_handler().
RZ_API void rz_analysis_function_add_block | ( | RzAnalysisFunction * | fcn, |
RzAnalysisBlock * | bb | ||
) |
Definition at line 264 of file function.c.
References rz_analysis_fcn_meta_t::_max, rz_analysis_fcn_meta_t::_min, rz_analysis_bb_t::addr, rz_analysis_function_t::analysis, rz_analysis_function_t::bbs, rz_analysis_t::cb, rz_analysis_t::core, rz_analysis_bb_t::fcns, rz_analysis_function_t::meta, rz_analysis_callbacks_t::on_fcn_bb_new, rz_analysis_block_ref(), rz_list_append(), rz_list_contains(), rz_analysis_bb_t::size, and UT64_MAX.
Referenced by fcn_append_basic_block(), fcn_takeover_block_recursive_followthrough_cb(), function_load_cb(), module_match_buffer(), rz_analysis_block_split(), rz_analysis_fcn_add_bb(), and rz_core_analysis_fcn_merge().
RZ_API bool rz_analysis_function_contains | ( | RzAnalysisFunction * | fcn, |
ut64 | addr | ||
) |
Definition at line 361 of file function.c.
References addr, rz_analysis_function_t::analysis, fcn_in_cb(), and rz_analysis_blocks_foreach_in().
Referenced by analyze_noreturn_function(), ds_setup_pre(), fcn_print_trace_info(), fcnIn(), print_meta_list(), rz_analysis_fcn_del_locs(), rz_analysis_get_fcn_in_bounds(), rz_analysis_trim_jmprefs(), rz_core_analysis_fcn(), and rz_core_analysis_fcn_clean().
RZ_API bool rz_analysis_function_delete | ( | RzAnalysisFunction * | fcn | ) |
Definition at line 180 of file function.c.
References rz_analysis_function_t::analysis, rz_analysis_t::fcns, and rz_list_delete_data().
Referenced by module_match_buffer(), rz_analysis_fcn_del(), rz_analysis_fcn_del_locs(), rz_core_analysis_fcn_clean(), rz_core_analysis_fcn_merge(), and rz_core_gdiff_2_files().
RZ_API void rz_analysis_function_free | ( | void * | _fcn | ) |
Definition at line 92 of file function.c.
References rz_analysis_function_t::addr, rz_analysis_function_t::analysis, rz_analysis_function_t::bbs, rz_analysis_function_t::diff, rz_analysis_bb_t::fcns, rz_analysis_function_t::fingerprint, free(), rz_analysis_t::ht_addr_fun, rz_analysis_t::ht_name_fun, rz_analysis_function_t::imports, rz_analysis_function_t::inst_vars, rz_analysis_function_t::label_addrs, rz_analysis_function_t::labels, rz_analysis_function_t::name, NULL, rz_analysis_block_unref(), rz_analysis_diff_free(), rz_analysis_function_delete_all_vars(), rz_list_delete_data(), and rz_list_free().
Referenced by __core_analysis_fcn(), rz_analysis_create_function(), rz_analysis_new(), and rz_analysis_purge().
RZ_API bool rz_analysis_function_is_autonamed | ( | RZ_NONNULL char * | name | ) |
Checks if the function name was generated by Rizin automatically.
Definition at line 443 of file function.c.
References has_rz_prefixes(), is_auto_named(), len, and MIN_MATCH_LEN.
Referenced by rz_analysis_fcn_vars_add_types().
RZ_API ut64 rz_analysis_function_linear_size | ( | RzAnalysisFunction * | fcn | ) |
Definition at line 318 of file function.c.
References rz_analysis_fcn_meta_t::_max, rz_analysis_fcn_meta_t::_min, ensure_fcn_range(), and rz_analysis_function_t::meta.
Referenced by __core_analysis_fcn(), cmd_analysis_esil(), core_analysis_graph_nodes(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), draw_graph_nodes(), ds_setup_pre(), fcn_print_info(), flirt_module_new(), function_list_print(), function_list_print_as_cmd(), function_list_print_to_table(), function_print_to_json(), getpcfromstack(), module_match_buffer(), node_match_functions(), num_callback(), run_basic_block_analysis(), rz_analysis_function_list_ascii_handler(), rz_cmd_disassembly_function_handler(), rz_cmd_disassembly_function_summary_handler(), rz_cmd_print(), rz_core_analysis_callgraph(), rz_core_analysis_get_stats(), rz_core_analysis_undefine(), rz_core_cmd_foreach3(), and rz_sign_flirt_node_new().
RZ_API RZ_BORROW RzList* rz_analysis_function_list | ( | RzAnalysis * | analysis | ) |
Definition at line 378 of file function.c.
References rz_analysis_t::fcns, NULL, and rz_return_val_if_fail.
Referenced by rz_analysis_function_list_ascii_handler(), rz_analysis_function_list_calls_handler(), and rz_analysis_function_list_handler().
RZ_API ut64 rz_analysis_function_max_addr | ( | RzAnalysisFunction * | fcn | ) |
Definition at line 328 of file function.c.
References rz_analysis_fcn_meta_t::_max, ensure_fcn_range(), and rz_analysis_function_t::meta.
Referenced by __core_analysis_fcn(), ds_setup_pre(), function_list_print_to_table(), function_print_to_json(), num_callback(), rz_cmd_disassembly_function_handler(), rz_core_analysis_esil_references_all_functions(), rz_core_print_disasm_json(), and rz_seek_function_handler().
RZ_API ut64 rz_analysis_function_min_addr | ( | RzAnalysisFunction * | fcn | ) |
Definition at line 323 of file function.c.
References rz_analysis_fcn_meta_t::_min, ensure_fcn_range(), and rz_analysis_function_t::meta.
Referenced by cmd_analysis_esil(), ds_setup_pre(), function_list_print_to_table(), function_print_to_json(), rz_analysis_function_list_ascii_handler(), rz_core_analysis_esil_references_all_functions(), and rz_core_analysis_undefine().
RZ_API RZ_OWN char* rz_analysis_function_name_guess | ( | RzTypeDB * | typedb, |
RZ_NONNULL char * | name | ||
) |
Checks if varions function name variations present in the database.
Tries to remove different prefixes from the Rizin autonames, standard libraries prefixes, various Windows-specific prefixes and checks every attempt in the function database. If there is a match - returns it.
typedb | RzTypeDB instance |
name | Function name to check |
Definition at line 458 of file function.c.
References clean_function_name(), free(), function_name_try_guess(), is_auto_named(), MIN_MATCH_LEN, name, NULL, rz_return_val_if_fail, cmd_descs_generate::str, strdup(), strip_common_prefixes_stdlib(), strip_dll_prefix(), and strip_rz_prefixes().
Referenced by ds_print_calls_hints(), extract_arg(), propagate_types_among_used_variables(), resolve_fcn_name(), rz_analysis_extract_rarg(), rz_analysis_fcn_format_sig(), rz_analysis_function_clone_type(), rz_analysis_noreturn_add(), and rz_analysis_noreturn_at_name().
RZ_API RzAnalysisFunction* rz_analysis_function_new | ( | RzAnalysis * | analysis | ) |
Definition at line 70 of file function.c.
References rz_analysis_fcn_meta_t::_min, rz_analysis_function_t::addr, rz_analysis_function_t::analysis, rz_analysis_function_t::bbs, rz_analysis_function_t::bits, rz_analysis_t::bits, rz_analysis_function_t::bp_frame, rz_analysis_function_t::cc, rz_analysis_t::constpool, rz_analysis_function_t::diff, rz_analysis_function_t::has_changed, rz_analysis_function_t::inst_vars, inst_vars_kv_free(), rz_analysis_function_t::is_noreturn, rz_analysis_function_t::label_addrs, label_addrs_kv_free(), rz_analysis_function_t::labels, labels_kv_free(), rz_analysis_function_t::meta, NULL, rz_analysis_cc_default(), rz_analysis_diff_new(), rz_list_new(), RZ_NEW0, rz_pvector_init(), rz_str_constpool_get(), UT64_MAX, and rz_analysis_function_t::vars.
Referenced by __core_analysis_fcn(), function_load_cb(), and rz_analysis_create_function().
RZ_API ut64 rz_analysis_function_realsize | ( | const RzAnalysisFunction * | fcn | ) |
Definition at line 338 of file function.c.
References rz_analysis_function_t::bbs, rz_analysis_bb_t::size, and ut64().
Referenced by __core_analysis_fcn(), compareSize(), core_walk_function_blocks(), ds_show_functions(), fcn_print_info(), func_walk_blocks(), function_list_print(), function_list_print_to_table(), function_print_to_json(), num_callback(), rz_analysis_function_size_sum_handler(), rz_cmd_disassembly_function_handler(), rz_cmd_disassembly_function_summary_handler(), rz_core_analysis_coverage_count(), rz_core_diff_show(), rz_core_print_function_disasm_json(), and var_functions_show().
RZ_API bool rz_analysis_function_relocate | ( | RzAnalysisFunction * | fcn, |
ut64 | addr | ||
) |
Definition at line 204 of file function.c.
References rz_analysis_var_t::accesses, addr, rz_analysis_function_t::addr, rz_analysis_function_t::analysis, delta, rz_analysis_t::ht_addr_fun, rz_analysis_function_t::inst_vars, inst_vars_kv_free(), inst_vars_relocate_cb(), NULL, rz_analysis_var_access_t::offset, rz_analysis_get_function_at(), rz_pvector_foreach, rz_vector_foreach, st64, and rz_analysis_function_t::vars.
Referenced by __rebase_everything(), and rz_core_analysis_fcn_merge().
RZ_API void rz_analysis_function_remove_block | ( | RzAnalysisFunction * | fcn, |
RzAnalysisBlock * | bb | ||
) |
Definition at line 286 of file function.c.
References rz_analysis_fcn_meta_t::_max, rz_analysis_fcn_meta_t::_min, rz_analysis_bb_t::addr, rz_analysis_function_t::bbs, rz_analysis_bb_t::fcns, rz_analysis_function_t::meta, rz_analysis_block_unref(), rz_list_delete_data(), rz_analysis_bb_t::size, and UT64_MAX.
Referenced by calc_reachable_and_remove_block(), fcn_takeover_block_recursive_followthrough_cb(), noreturn_remove_unreachable_cb(), run_basic_block_analysis(), rz_analysis_block_merge(), rz_analysis_delete_block(), rz_analysis_function_blocks_del_all_handler(), rz_analysis_function_blocks_del_handler(), rz_analysis_function_resize(), and update_analysis().
RZ_API bool rz_analysis_function_rename | ( | RzAnalysisFunction * | fcn, |
const char * | name | ||
) |
Definition at line 240 of file function.c.
References rz_analysis_function_t::analysis, free(), rz_analysis_t::ht_name_fun, rz_analysis_function_t::name, NULL, and strdup().
Referenced by module_match_buffer(), rz_analysis_dwarf_integrate_functions(), rz_core_analysis_function_rename(), and set_fcn_name_from_flag().
RZ_API ut64 rz_analysis_function_size_from_entry | ( | RzAnalysisFunction * | fcn | ) |
Definition at line 333 of file function.c.
References rz_analysis_fcn_meta_t::_max, rz_analysis_fcn_meta_t::_min, rz_analysis_function_t::addr, ensure_fcn_range(), rz_analysis_function_t::meta, and UT64_MAX.
Referenced by analysis_fcn_data(), analysis_fcn_data_gaps(), function_rename(), rz_analysis_add_function(), rz_core_analysis_flag_every_function(), rz_core_analysis_function_rename(), and rz_core_get_boundaries_prot().
RZ_API bool rz_analysis_function_was_modified | ( | RzAnalysisFunction * | fcn | ) |
Definition at line 366 of file function.c.
References rz_analysis_function_t::bbs, rz_analysis_block_was_modified(), and rz_return_val_if_fail.
Referenced by check_function_modified().
RZ_API RzAnalysisFunction* rz_analysis_get_function_at | ( | RzAnalysis * | analysis, |
ut64 | addr | ||
) |
Definition at line 184 of file function.c.
References addr, f, found, rz_analysis_t::ht_addr_fun, and NULL.
Referenced by __reset_status(), analysis_get_function_in(), cmd_analysis_ucall_ref(), ds_print_esil_analysis(), ds_print_offset(), ds_print_ptr(), ds_show_flags(), ds_show_functions(), ds_show_refs(), ds_show_xrefs(), ds_sub_jumps(), exists_var(), module_match_buffer(), num_callback(), recovery_apply_vtable(), run_basic_block_analysis(), rz_analysis_class_method_recover(), rz_analysis_dwarf_integrate_functions(), rz_analysis_extract_rarg(), rz_analysis_function_all_opcode_stat_handler(), rz_analysis_function_blocks_add_handler(), rz_analysis_function_relocate(), rz_analysis_noreturn_add(), rz_analysis_noreturn_at(), rz_analyze_function_linked_offsets_handler(), rz_cmd_search(), rz_core_analysis_bytes(), rz_core_analysis_fcn_merge(), rz_core_analysis_function_add(), rz_core_analysis_function_rename(), rz_core_analysis_name(), rz_core_analysis_propagate_noreturn(), rz_core_analysis_rename(), rz_core_cmd_foreach(), rz_core_diff_show_function(), rz_core_gdiff_function_1_file(), rz_core_gdiff_function_2_files(), rz_core_print_disasm(), rz_core_print_func_args(), rz_core_visual_define(), and types_xrefs_function().
RZ_API RzList* rz_analysis_get_functions_in | ( | RzAnalysis * | analysis, |
ut64 | addr | ||
) |
Definition at line 20 of file function.c.
References addr, get_functions_block_cb(), list(), NULL, rz_analysis_blocks_foreach_in(), and rz_list_new().
Referenced by analysis_get_function_in(), rz_analysis_function_describe_offset_handler(), rz_analysis_function_info_handler(), rz_analysis_function_list_in_handler(), rz_analysis_get_fcn_in(), rz_analysis_get_used_function_var(), rz_core_analysis_type_match(), and rz_core_types_link().
RZ_IPI void rz_analysis_var_free | ( | RzAnalysisVar * | av | ) |
|
static |
Definition at line 412 of file function.c.
References rz_str_startswith().
Referenced by rz_analysis_function_name_guess().
|
static |
Definition at line 424 of file function.c.
References autogen_x86imm::tmp.
Referenced by rz_analysis_function_name_guess().
|
static |
Definition at line 403 of file function.c.
References has_rz_prefixes().
Referenced by rz_analysis_function_name_guess().