Rizin
unix-like reverse engineering framework and cli tools
|
#include <string.h>
#include <rz_types.h>
#include <rz_list.h>
#include <rz_flag.h>
#include <rz_core.h>
#include <rz_bin.h>
#include <ht_uu.h>
#include <rz_util/rz_graph_drawable.h>
#include "core_private.h"
Go to the source code of this file.
Classes | |
struct | il_print_t |
Macros | |
#define | p_sb(x) ((RzStrBuf *)x) |
#define | p_tbl(x) ((RzTable *)x) |
#define | p_pj(x) ((PJ *)x) |
Typedefs | |
typedef struct il_print_t | ILPrint |
typedef struct il_print_t ILPrint |
|
static |
Definition at line 18 of file cil.c.
References rz_core_t::analysis, rz_core_t::config, rz_analysis_t::esil, free(), NULL, rz_analysis_esil_new(), rz_analysis_esil_setup(), rz_config_get(), rz_config_get_i(), rz_config_set(), s, strdup(), verbose, and rz_analysis_esil_t::verbose.
Referenced by rz_core_analysis_esil_init(), and rz_core_analysis_esil_reinit().
|
static |
Definition at line 111 of file cil.c.
References addr, rz_core_t::config, rz_core_t::io, map(), rz_core_t::offset, PFMT64x, rz_config_get_i(), rz_io_map_get(), rz_io_map_next_available(), RZ_STR_ISEMPTY, rz_str_newf(), UT32_MAX, ut64(), and UT64_MAX.
Referenced by rz_core_analysis_esil_init_mem(), and rz_core_analysis_esil_init_mem_del().
Definition at line 76 of file cil.c.
References addr, rz_core_t::config, eprintf, free(), i, NULL, PFMT64d, PFMT64u, PFMT64x, rz_config_get(), rz_core_cmdf(), rz_core_write_at(), rz_debruijn_pattern(), RZ_MIN, and ut64().
Referenced by rz_core_analysis_esil_init_mem(), and rz_core_analysis_esil_init_mem_p().
Definition at line 409 of file cil.c.
References rz_core_t::config, eprintf, from, list(), map(), NULL, rz_config_get(), rz_config_get_i(), rz_core_analysis_esil(), rz_core_get_boundaries_prot(), rz_list_free(), RZ_PERM_X, to, and ut64().
Referenced by objc_analyze(), and rz_analysis_all_esil_handler().
RZ_API void rz_core_analysis_esil_deinit | ( | RZ_NONNULL RzCore * | core | ) |
Deinitialize ESIL.
core | RzCore reference |
Definition at line 66 of file cil.c.
References rz_analysis_esil_t::analysis, rz_analysis_t::esil, NULL, rz_analysis_esil_free(), rz_return_if_fail, sdb_reset(), and rz_analysis_esil_t::stats.
Referenced by rz_analysis_esil_deinit_handler().
Emulate n_instr
instructions from addr
. If until_addr
is specified and that address is met before all the instructions are emulated, stop there.
Definition at line 305 of file cil.c.
References addr, rz_analysis_op_t::addr, rz_search_t::align, rz_core_t::analysis, rz_core_t::blocksize, rz_core_t::config, e, eprintf, rz_analysis_t::esil, rz_analysis_op_t::esil, flags, free(), i, if(), rz_core_t::io, malloc(), NULL, off, rz_core_t::offset, pc, PFMT64x, rz_analysis_t::reg, rz_analysis_archinfo(), RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE, rz_analysis_esil_new(), rz_analysis_esil_parse(), rz_analysis_esil_setup(), rz_analysis_op(), rz_analysis_op_fini(), RZ_ANALYSIS_OP_MASK_BASIC, RZ_ANALYSIS_OP_MASK_DISASM, RZ_ANALYSIS_OP_MASK_ESIL, RZ_ANALYSIS_OP_MASK_HINT, RZ_ANALYSIS_OP_TYPE_CALL, rz_config_get_i(), rz_cons_is_breaked(), rz_core_seek(), rz_io_read_at(), RZ_MAX, rz_reg_get_name(), rz_reg_getv(), RZ_REG_NAME_PC, rz_reg_setv(), RZ_STRBUF_SAFEGET, rz_core_t::search, rz_analysis_op_t::size, rz_analysis_op_t::type, and ut64().
Referenced by rz_core_analysis_esil_emulate_bb(), rz_il_step_evaluate_handler(), and rz_il_step_handler().
Definition at line 380 of file cil.c.
References rz_analysis_bb_t::addr, rz_core_t::analysis, rz_analysis_bb_t::ninstr, rz_core_t::offset, PFMT64x, rz_analysis_find_most_relevant_block_in(), rz_core_analysis_esil_emulate(), RZ_LOG_ERROR, and UT64_MAX.
Referenced by cmd_analysis_esil().
Definition at line 43 of file cil.c.
References rz_core_t::analysis, core_esil_init(), and rz_analysis_t::esil.
Referenced by rz_cmd_debug_trace_esil_handler(), rz_cmd_debug_trace_esils_handler(), rz_cmd_debug_traces_esil_delete_handler(), rz_cmd_debug_traces_esil_i_handler(), rz_core_analysis_esil_init_mem(), rz_core_analysis_esil_init_mem_del(), rz_core_analysis_esil_init_mem_p(), and rz_core_analysis_types_propagation().
RZ_API void rz_core_analysis_esil_init_mem | ( | RZ_NONNULL RzCore * | core, |
RZ_NULLABLE const char * | name, | ||
ut64 | addr, | ||
ut32 | size | ||
) |
Initialize ESIL memory stack region.
core | RzCore reference |
name | Optional name of the memory stack region. If NULL, a name is computed automatically based on addr and size |
addr | Base address of the stack region, if UT64_MAX it is automatically computed |
size | Size of the stack region, if UT32_MAX it is automatically computed |
Definition at line 149 of file cil.c.
References addr, rz_analysis_esil_t::analysis, eprintf, rz_analysis_t::esil, fd, free(), get_esil_stack_name(), initialize_stack(), PFMT64x, rz_config_get(), rz_config_set_b(), rz_core_analysis_esil_init(), rz_core_cmdf(), rz_core_reg_update_flags(), rz_core_seek(), rz_io_fd_close(), rz_io_fd_open(), rz_io_map_add(), rz_io_map_set_name(), RZ_PERM_RW, RZ_REG_NAME_BP, RZ_REG_NAME_PC, RZ_REG_NAME_SP, rz_reg_set_value_by_role(), rz_return_if_fail, rz_strf, sdb_atoi(), sdb_const_get(), sdb_itoa(), sdb_set(), rz_analysis_esil_t::stack_addr, rz_analysis_esil_t::stack_fd, rz_analysis_esil_t::stack_size, UT32_MAX, ut64(), UT64_MAX, v, and val.
Referenced by __analysis_esil_function(), __esil_init(), rz_analysis_aefa(), rz_analysis_esil_init_mem_handler(), rz_core_analysis_esil(), rz_core_analysis_esil_init_mem_p(), rz_core_analysis_types_propagation(), rz_core_disasm_pde(), and rz_core_link_stroff().
RZ_API void rz_core_analysis_esil_init_mem_del | ( | RZ_NONNULL RzCore * | core, |
RZ_NULLABLE const char * | name, | ||
ut64 | addr, | ||
ut32 | size | ||
) |
Remove ESIL VM stack.
core | RzCore reference |
name | Optional name of the memory stack region. If NULL, a name is computed automatically based on addr and size |
addr | Base address of the stack region, if UT64_MAX it is automatically computed |
size | Size of the stack region, if UT32_MAX it is automatically computed |
Definition at line 241 of file cil.c.
References addr, rz_analysis_esil_t::analysis, eprintf, rz_analysis_t::esil, free(), get_esil_stack_name(), rz_core_analysis_esil_init(), rz_flag_unset_name(), rz_io_fd_close(), rz_return_if_fail, sdb_unset(), and rz_analysis_esil_t::stack_fd.
Referenced by rz_analysis_esil_init_mem_remove_handler(), rz_core_analysis_types_propagation(), and rz_core_link_stroff().
Definition at line 213 of file cil.c.
References addr, rz_core_t::analysis, rz_analysis_t::esil, rz_core_t::flags, initialize_stack(), NULL, rz_flag_item_t::offset, rz_core_analysis_esil_init(), rz_core_analysis_esil_init_mem(), rz_flag_get(), rz_flag_item_t::size, rz_analysis_esil_t::stack_addr, rz_analysis_esil_t::stack_size, UT32_MAX, ut64(), and UT64_MAX.
Referenced by rz_analysis_esil_init_mem_p_handler().
RZ_API void rz_core_analysis_esil_init_regs | ( | RZ_NONNULL RzCore * | core | ) |
Initialize ESIL registers.
core | RzCore reference |
Definition at line 264 of file cil.c.
References rz_core_analysis_set_reg(), and rz_return_if_fail.
Referenced by __esil_init().
Definition at line 290 of file cil.c.
References rz_core_t::analysis, rz_analysis_t::fcns, from, rz_analysis_function_max_addr(), rz_analysis_function_min_addr(), rz_core_analysis_esil(), to, and ut64().
Referenced by rz_analysis_all_esil_functions_handler(), and rz_core_analysis_everything().
RZ_API void rz_core_analysis_esil_reinit | ( | RZ_NONNULL RzCore * | core | ) |
Reinitialize ESIL.
core | RzCore reference |
Definition at line 54 of file cil.c.
References core_esil_init(), rz_analysis_esil_free(), RZ_REG_NAME_PC, rz_reg_set_value_by_role(), and rz_return_if_fail.
Referenced by do_esil_search(), rz_analysis_esil_init_handler(), rz_core_analysis_esil(), rz_core_debug_esil(), and rz_core_disasm_pde().
RZ_API void rz_core_analysis_esil_step_over | ( | RZ_NONNULL RzCore * | core | ) |
Definition at line 269 of file cil.c.
References NULL, rz_analysis_op_free(), RZ_ANALYSIS_OP_MASK_BASIC, RZ_ANALYSIS_OP_MASK_HINT, RZ_ANALYSIS_OP_TYPE_CALL, rz_core_analysis_op(), rz_core_esil_step(), rz_core_reg_update_flags(), rz_reg_get_name(), rz_reg_getv(), RZ_REG_NAME_PC, ut64(), and UT64_MAX.
Referenced by rz_analysis_aefa(), rz_core_debug_single_step_over(), rz_core_debug_step_over(), and rz_il_step_over_handler().
Definition at line 280 of file cil.c.
References addr, NULL, rz_core_esil_step(), and rz_core_reg_update_flags().
Referenced by rz_il_step_over_until_addr_handler(), rz_il_step_skip_handler(), and rz_il_step_skip_until_addr_handler().
Definition at line 285 of file cil.c.
References expr(), NULL, rz_core_esil_step(), rz_core_reg_update_flags(), and UT64_MAX.
Referenced by rz_il_step_skip_until_expr_handler(), and rz_il_step_until_expr_handler().
Definition at line 434 of file cil.c.
References rz_core_t::analysis, rz_analysis_t::il_vm, rz_core_t::offset, rz_analysis_t::reg, rz_analysis_il_vm_setup(), rz_core_reg_update_flags(), RZ_REG_NAME_PC, and rz_reg_set_value_by_role().
Referenced by rz_il_vm_initialize_handler().
Perform a single step at the PC given by analysis->reg in RzIL and print any events that happened
Definition at line 655 of file cil.c.
References rz_core_t::analysis, rz_core_t::config, rz_il_vm_t::events, rz_analysis_t::il_vm, NULL, rz_config_get_b(), rz_core_il_step(), rz_il_event_json(), RZ_IL_EVENT_MEM_READ, rz_il_event_stringify(), RZ_IL_EVENT_VAR_READ, RZ_LOG_ERROR, rz_strbuf_append(), rz_strbuf_free(), rz_strbuf_get(), rz_strbuf_new(), sb, rz_il_vm_event_t::type, and rz_analysis_il_vm_t::vm.
Referenced by rz_il_vm_step_with_events_handler().
Set a vm variable from user input.
Sets the given var, or "PC" to the given value. The type of the variable is handled dynamically. This is intended for setting from user input only.
Definition at line 451 of file cil.c.
References rz_core_t::analysis, rz_il_sort_pure_t::bv, rz_analysis_t::il_vm, bitvector_t::len, NULL, rz_il_vm_t::pc, rz_il_sort_pure_t::props, rz_bv_free(), rz_bv_new_from_ut64(), rz_il_bool_new(), RZ_IL_TYPE_PURE_BITVECTOR, RZ_IL_TYPE_PURE_BOOL, rz_il_value_new_bitv(), rz_il_value_new_bool(), RZ_IL_VAR_KIND_GLOBAL, rz_il_vm_get_var(), rz_il_vm_set_global_var(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_il_var_t::sort, rz_il_sort_pure_t::type, val, value, and rz_analysis_il_vm_t::vm.
Referenced by rz_il_vm_status_handler().
RZ_IPI void rz_core_analysis_il_vm_status | ( | RzCore * | core, |
const char * | var_name, | ||
RzOutputMode | mode | ||
) |
Definition at line 531 of file cil.c.
References rz_core_t::analysis, free(), rz_analysis_t::il_vm, rz_il_var_t::name, NULL, out, p, p_pj, p_sb, p_tbl, rz_il_vm_t::pc, pj_drain(), pj_end(), pj_new(), pj_o(), rz_cons_printf(), RZ_IL_TYPE_PURE_BITVECTOR, RZ_IL_TYPE_PURE_BOOL, RZ_IL_VAR_KIND_GLOBAL, rz_il_vm_get_all_vars(), rz_il_vm_get_var_value(), RZ_LOG_ERROR, RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_STANDARD, RZ_OUTPUT_MODE_TABLE, rz_pvector_foreach, rz_pvector_free(), rz_strbuf_drain(), rz_strbuf_fini(), rz_strbuf_free(), rz_strbuf_get(), rz_strbuf_length(), rz_strbuf_new(), rz_table_free(), rz_table_new(), rz_table_set_columnsf(), rz_table_tostring(), rz_warn_if_reached, rzil_print_register_bitv(), rzil_print_register_bool(), val, and rz_analysis_il_vm_t::vm.
Referenced by rz_il_vm_status_handler().
Definition at line 389 of file cil.c.
References rz_core_t::analysis, eprintf, r, rz_analysis_t::reg, regname(), rz_core_reg_update_flags(), rz_reg_get(), rz_reg_get_name(), rz_reg_get_name_idx(), rz_reg_set_value(), and val.
Referenced by cmd_analysis_esil(), rz_analysis_aefa(), rz_analysis_esil_init_p_handler(), rz_core_analysis_esil_init_regs(), and rz_core_visual_cmd().
Perform a single step at the PC given by analysis->reg in RzIL
Definition at line 630 of file cil.c.
References rz_core_t::analysis, rz_analysis_t::il_vm, PFMT64x, r, rz_analysis_t::reg, RZ_ANALYSIS_IL_STEP_INVALID_OP, RZ_ANALYSIS_IL_STEP_RESULT_SUCCESS, rz_analysis_il_vm_step(), rz_core_reg_update_flags(), RZ_LOG_ERROR, rz_reg_get_value_by_role(), and RZ_REG_NAME_PC.
Referenced by rz_core_analysis_il_step_with_events(), rz_il_vm_step_handler(), and rz_il_vm_step_until_addr_handler().
|
static |
Definition at line 512 of file cil.c.
References free(), hex, p, p_pj, p_sb, p_tbl, pj_ks(), rz_bv_as_hex_string(), rz_cons_printf(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_STANDARD, RZ_OUTPUT_MODE_TABLE, rz_strbuf_appendf(), and rz_table_add_rowf().
Referenced by rz_core_analysis_il_vm_status().
Definition at line 495 of file cil.c.
References p, p_pj, p_sb, p_tbl, pj_kb(), rz_cons_printf(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_STANDARD, RZ_OUTPUT_MODE_TABLE, rz_str_bool(), rz_strbuf_appendf(), rz_table_add_rowf(), and value.
Referenced by rz_core_analysis_il_vm_status().