Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_core.h>
Go to the source code of this file.
Classes | |
struct | seek_flag_offset_t |
Functions | |
RZ_API void | rz_core_seek_item_free (RzCoreSeekItem *item) |
static void | get_current_seek_state (RzCore *core, RzCoreSeekItem *elem) |
static void | set_current_seek_state (RzCore *core, RzCoreSeekItem *elem) |
static void | add_seek_history (RzCore *core) |
static bool | seek_check_save (RzCore *core, ut64 addr, bool rb, bool save) |
RZ_API bool | rz_core_seek_mark (RzCore *core) |
Mark current state (offset+cursor) as the next state to save in history. More... | |
static bool | need_add2history (RzCore *core, ut64 addr) |
static bool | seek_save (RzCore *core, ut64 addr) |
RZ_API bool | rz_core_seek_save (RzCore *core) |
Save last marked position, if any, in the seek history. More... | |
RZ_API bool | rz_core_seek_and_save (RzCore *core, ut64 addr, bool rb) |
Save currently marked state in seek history and seek to addr . More... | |
RZ_API bool | rz_core_seek (RzCore *core, ut64 addr, bool rb) |
Seek to addr . More... | |
RZ_API bool | rz_core_seek_opt (RzCore *core, ut64 addr, bool rb, bool save) |
Seek to addr and optionally save the current offset in seek history. More... | |
RZ_API bool | rz_core_seek_delta (RzCore *core, st64 delta, bool save) |
Seek relative to current offset and optionally save the current offset in seek history. More... | |
RZ_API int | rz_core_seek_base (RzCore *core, const char *hex, bool save) |
Seek to a new address composed of current offset with last hex digits replaced with those of hex . More... | |
static bool | seek_flag_offset (RzFlagItem *fi, void *user) |
RZ_API bool | rz_core_seek_next (RzCore *core, const char *type, bool save) |
Seek to the next type of item from current offset. More... | |
RZ_API bool | rz_core_seek_prev (RzCore *core, const char *type, bool save) |
Seek to the previous type of item from current offset. More... | |
RZ_API bool | rz_core_seek_align (RzCore *core, ut64 align, bool save) |
Seek to current offset aligned to align . More... | |
RZ_API bool | rz_core_seek_analysis_bb (RzCore *core, ut64 addr, bool save) |
Seek to basic block that contains address addr . More... | |
RZ_API bool | rz_core_seek_undo (RzCore *core) |
RZ_API bool | rz_core_seek_redo (RzCore *core) |
static RzCoreSeekItem * | get_current_item (RzCore *core) |
static RzCoreSeekItem * | dup_seek_history_item (RzCoreSeekItem *item, int i) |
RZ_API RzCoreSeekItem * | rz_core_seek_peek (RzCore *core, int idx) |
Return a element in the undo/redo list. More... | |
RZ_API void | rz_core_seek_reset (RzCore *core) |
RZ_API void | rz_core_seek_free (RzCore *core) |
RZ_API RzList * | rz_core_seek_list (RzCore *core) |
Return the seek history. More... | |
RZ_IPI bool | rz_core_seek_bb_instruction (RzCore *core, int index) |
|
static |
Definition at line 22 of file seek.c.
References rz_core_t::config, rz_core_seek_undo_t::cursor, NULL, rz_core_seek_undo_t::offset, rz_core_seek_history_t::redos, rz_config_get_i(), rz_vector_clear(), rz_vector_empty(), rz_vector_index_ptr(), rz_vector_len(), rz_vector_push(), rz_vector_remove_at(), rz_core_seek_history_t::saved_item, rz_core_t::seek_history, rz_core_seek_history_t::undos, and ut64().
Referenced by seek_save().
|
static |
Definition at line 339 of file seek.c.
References rz_core_seek_undo_t::cursor, i, rz_core_seek_undo_t::idx, rz_core_seek_undo_t::is_current, NULL, rz_core_seek_undo_t::offset, and RZ_NEW0.
Referenced by rz_core_seek_list(), and rz_core_seek_peek().
|
static |
Definition at line 328 of file seek.c.
References get_current_seek_state(), rz_core_seek_undo_t::idx, rz_core_seek_undo_t::is_current, NULL, and RZ_NEW0.
Referenced by rz_core_seek_list(), and rz_core_seek_peek().
|
static |
Definition at line 11 of file seek.c.
References rz_print_t::cur_enabled, rz_core_seek_undo_t::cursor, rz_core_seek_undo_t::is_current, rz_core_seek_undo_t::offset, rz_core_t::offset, rz_core_t::print, and rz_print_get_cursor().
Referenced by get_current_item(), rz_core_seek_mark(), rz_core_seek_redo(), and rz_core_seek_undo().
Definition at line 67 of file seek.c.
References addr, rz_core_seek_undo_t::cursor, rz_core_seek_undo_t::offset, rz_core_seek_history_t::saved_item, rz_core_seek_history_t::saved_set, and rz_core_t::seek_history.
Referenced by seek_save().
Seek to addr
.
core | RzCore reference |
addr | Address where to move to |
rb | If true read the block |
Definition at line 116 of file seek.c.
References addr, rz_core_t::bin, rz_core_t::binat, rz_bin_t::cur, rz_bin_file_t::id, rz_core_t::io, NULL, rz_core_t::offset, rz_bin_file_at(), rz_bin_select_bfid(), rz_core_block_read(), rz_io_seek(), and RZ_IO_SEEK_SET.
Referenced by __direction_disassembly_cb(), __disasm(), __handleComment(), __panels_process(), __print_disassembly_cb(), __print_hexdump_cb(), _cb_hit(), _CbInRangeSearchV(), backup_current_addr(), cmd_pCd(), cmd_pCD(), cmd_print_pv(), core_disassembly(), core_perform_auto_analysis(), cursor_prevrow(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), do_analysis_search(), do_iter_offsets(), do_iter_sections(), do_ref_search(), do_syscall_search(), fix_cursor(), foreach_pairs(), foreachOffset(), get_cgnodes(), goto_asmqjmps(), iter_dbt_commands(), list_vars(), on_fcn_delete(), on_fcn_new(), on_fcn_rename(), restore_current_addr(), rz_analysis_aefa(), rz_analysis_function_type_matching_handler(), rz_analysis_function_vars_dis_refs_handler(), rz_analysis_function_xrefs_handler(), rz_analyze_all_consecutive_functions_in_section_handler(), rz_cmd_alias(), rz_cmd_disassemble_recursively_no_function_handler(), rz_cmd_disassembly_all_methods_class_handler(), rz_cmd_disassembly_function_summary_handler(), rz_cmd_disassembly_n_instrs_as_text_json_handler(), rz_cmd_print(), rz_cmd_sizes_of_n_instructions_handler(), rz_core_agraph_print_interactive(), rz_core_analysis_esil_emulate(), rz_core_analysis_esil_init_mem(), rz_core_analysis_everything(), rz_core_analysis_types_propagation(), rz_core_bin_apply_entry(), rz_core_bin_load(), rz_core_block_size(), rz_core_cmd_foreach(), rz_core_cmd_foreach3(), rz_core_cmd_lastcmd_repeat(), rz_core_cmd_subst(), rz_core_cmd_subst_i(), rz_core_debug_print_status(), rz_core_disasm_pdi(), rz_core_disasm_pdi_with_buf(), rz_core_file_reopen(), rz_core_graph_print(), rz_core_handle_backwards_disasm(), rz_core_link_stroff(), rz_core_magic(), rz_core_magic_at(), rz_core_print_disasm_instructions(), rz_core_print_disasm_instructions_with_buf(), rz_core_print_disasm_json(), rz_core_seek_and_save(), rz_core_seek_bb_instruction(), rz_core_seek_opcode_backward(), rz_core_serve(), rz_core_shift_block(), rz_core_visual(), rz_core_visual_analysis(), rz_core_visual_classes(), rz_core_visual_cmd(), rz_core_visual_debugtraces(), rz_core_visual_graph(), rz_core_visual_hudclasses(), rz_core_visual_hudstuff(), rz_core_visual_mark_seek(), rz_core_visual_title(), rz_core_visual_view_graph(), rz_core_visual_view_rop(), rz_core_yank(), rz_core_yank_string(), rz_main_rizin(), rz_seek_asz_handler(), seek_check_save(), set_current_seek_state(), variable_rename(), visual_nkey(), and visual_refresh().
Seek to current offset aligned to align
.
core | RzCore reference |
align | Value to align the current offset |
save | If true save the current state in seek history before seeking |
Definition at line 274 of file seek.c.
References rz_core_t::offset, save, and seek_check_save().
Referenced by rz_seek_asz_handler().
Seek to basic block that contains address addr
.
core | RzCore reference |
addr | Address that needs to be in the basicblock |
save | If true save the current state in seek history before seeking |
Definition at line 289 of file seek.c.
References addr, rz_analysis_bb_t::addr, rz_core_t::analysis, rz_analysis_find_most_relevant_block_in(), save, and seek_check_save().
Referenced by rz_seek_basicblock_handler().
Save currently marked state in seek history and seek to addr
.
If rz_core_seek_mark
is used to mark a position, that position will be saved in the history, otherwise the current state is used.
core | RzCore reference |
addr | Address where to move to |
rb | If true read the block |
Definition at line 101 of file seek.c.
References addr, rz_core_seek(), rz_core_seek_mark(), rz_core_seek_history_t::saved_set, rz_core_t::seek_history, and seek_save().
Referenced by __core_visual_gogo(), __handle_mouse_on_panel(), __handleComment(), findNextWord(), follow_ref(), goto_asmqjmps(), rz_core_analysis_bb_seek(), rz_core_visual_cmd(), rz_core_visual_comments(), rz_core_visual_offset(), rz_core_visual_seek_animation(), rz_core_visual_trackflags(), rz_seek_begin_handler(), rz_seek_end_handler(), rz_seek_function_current_handler(), rz_seek_function_handler(), rz_seek_handler(), and seek_check_save().
Seek to a new address composed of current offset with last hex digits replaced with those of hex
.
core | RzCore reference |
hex | New final part of the address (in hex) |
save | If true save the current state in seek history before seeking |
Definition at line 171 of file seek.c.
References addr, hex, rz_core_t::num, rz_core_t::offset, rz_num_tail(), save, seek_check_save(), and ut64().
Referenced by rz_core_visual_offset(), and rz_seek_base_handler().
Definition at line 453 of file seek.c.
References rz_core_t::analysis, rz_analysis_bb_t::ninstr, rz_core_t::offset, PFMT64x, rz_analysis_block_get_op_addr(), rz_analysis_find_most_relevant_block_in(), rz_core_seek(), RZ_LOG_ERROR, and ut64().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), rz_core_cmd_subst_i(), and rz_core_visual_graph().
Seek relative to current offset and optionally save the current offset in seek history.
core | RzCore reference |
delta | Delta address added to the current offset |
save | If true save the current state in seek history before seeking |
Definition at line 152 of file seek.c.
References delta, rz_core_t::offset, RZ_ABS, save, seek_check_save(), ut64(), UT64_ADD_OVFCHK, and UT64_MAX.
Referenced by __direction_disassembly_cb(), __fix_cursor_down(), __fix_cursor_up(), fix_cursor(), rz_core_seek_opcode_forward(), rz_core_visual_cmd(), rz_core_write_at(), rz_seek_blocksize_backward_handler(), rz_seek_blocksize_forward_handler(), and rz_seek_delta_handler().
Free seek history data
Definition at line 398 of file seek.c.
References rz_core_seek_history_t::redos, rz_vector_fini(), rz_core_t::seek_history, and rz_core_seek_history_t::undos.
Referenced by rz_core_fini().
RZ_API void rz_core_seek_item_free | ( | RzCoreSeekItem * | item | ) |
Definition at line 7 of file seek.c.
References free().
Referenced by rz_core_seek_list(), rz_line_hist_offset_down(), and rz_line_hist_offset_up().
Return the seek history.
The list is composed of some items with negative idx which are Undos items (potentially none), then there is an item with is_current=true that is the current state, followed by some items with positive idx which are Redos items.
Definition at line 411 of file seek.c.
References dup, dup_seek_history_item(), err, get_current_item(), i, NULL, rz_core_seek_history_t::redos, rz_core_seek_item_free(), rz_list_append(), rz_list_free(), rz_list_newf(), rz_vector_foreach, rz_vector_foreach_prev, rz_vector_len(), rz_core_t::seek_history, and rz_core_seek_history_t::undos.
Referenced by rz_seek_history_list_handler().
Mark current state (offset+cursor) as the next state to save in history.
The saving can be disabled if eval var cfg.seek.silent is set to true. The state saved here is actually saved in history once rz_core_seek_and_save
is called (or other functions with the save
argument set to true).
core | RzCore reference |
Definition at line 57 of file seek.c.
References rz_core_t::config, get_current_seek_state(), rz_config_get_i(), rz_core_seek_history_t::saved_item, rz_core_seek_history_t::saved_set, and rz_core_t::seek_history.
Referenced by rz_core_seek_and_save(), rz_core_seek_opcode_forward(), rz_seek_asz_handler(), and rz_seek_handler().
Seek to the next type
of item from current offset.
core | RzCore reference |
type | Type of next "item" to seek to (could be "opc", "fun", "hit", "flag") |
save | If true save the current state in seek history before seeking |
Definition at line 203 of file seek.c.
References rz_analysis_function_t::addr, rz_core_t::analysis, rz_core_t::block, rz_core_t::blocksize, rz_core_t::config, eprintf, rz_analysis_t::fcns, rz_core_t::flags, seek_flag_offset_t::next, seek_flag_offset_t::offset, rz_core_t::offset, rz_analysis_op(), RZ_ANALYSIS_OP_MASK_BASIC, rz_config_get(), rz_flag_foreach(), rz_flag_foreach_prefix(), save, seek_check_save(), seek_flag_offset(), rz_analysis_op_t::size, type, ut64(), and UT64_MAX.
Referenced by __panels_process(), rz_core_visual_cmd(), rz_core_visual_graph(), and rz_seek_next_handler().
Seek to addr
and optionally save the current offset in seek history.
core | RzCore reference |
addr | Address where to move to |
rb | If true read the block |
save | If true save the current state in seek history before seeking |
Definition at line 141 of file seek.c.
References addr, save, and seek_check_save().
Referenced by loadGP(), rz_core_seek_opcode_backward(), and rz_core_seek_to_register().
RZ_API RzCoreSeekItem* rz_core_seek_peek | ( | RzCore * | core, |
int | idx | ||
) |
Return a element in the undo/redo list.
The element is not removed from the list nor it is restored as the current state. Useful if you want to inspect the undo history. The object shall be freed by the caller.
core | Reference to RzCore |
idx | Index of the element. 0 references the current seek, <0 are undos, >0 redos |
Definition at line 361 of file seek.c.
References dup_seek_history_item(), get_current_item(), i, setup::idx, len, NULL, rz_core_seek_history_t::redos, RZ_ABS, rz_vector_index_ptr(), rz_vector_len(), rz_core_t::seek_history, and rz_core_seek_history_t::undos.
Referenced by rz_line_hist_offset_down(), and rz_line_hist_offset_up().
Seek to the previous type
of item from current offset.
core | RzCore reference |
type | Type of previous "item" to seek to (could be "opc", "fun", "hit", "flag") |
save | If true save the current state in seek history before seeking |
Definition at line 241 of file seek.c.
References rz_analysis_function_t::addr, rz_core_t::analysis, rz_core_t::config, eprintf, rz_analysis_t::fcns, rz_core_t::flags, seek_flag_offset_t::next, seek_flag_offset_t::offset, rz_core_t::offset, rz_config_get(), rz_flag_foreach(), rz_flag_foreach_prefix(), save, seek_check_save(), seek_flag_offset(), type, and ut64().
Referenced by __panels_process(), rz_core_visual_cmd(), rz_core_visual_graph(), and rz_seek_prev_handler().
Redo the last undone entry in the seek history
Definition at line 316 of file seek.c.
References get_current_seek_state(), rz_core_seek_history_t::redos, rz_vector_empty(), rz_vector_pop(), rz_vector_push(), rz_core_t::seek_history, set_current_seek_state(), and rz_core_seek_history_t::undos.
Referenced by rz_core_visual_graph(), rz_core_visual_seek_animation_redo(), and rz_seek_redo_handler().
Remove all seek history entries
Definition at line 388 of file seek.c.
References NULL, rz_core_seek_history_t::redos, rz_vector_fini(), rz_vector_init(), rz_core_t::seek_history, and rz_core_seek_history_t::undos.
Referenced by rz_core_init(), and rz_seek_undo_reset_handler().
Save last marked position, if any, in the seek history.
core | RzCore reference |
Definition at line 87 of file seek.c.
References rz_core_t::offset, and seek_save().
Referenced by rz_core_seek_opcode_forward().
Undo the last entry in the seek history
Definition at line 301 of file seek.c.
References get_current_seek_state(), rz_core_seek_history_t::redos, rz_vector_empty(), rz_vector_pop(), rz_vector_push(), rz_core_t::seek_history, set_current_seek_state(), and rz_core_seek_history_t::undos.
Referenced by rz_core_analysis_everything(), rz_core_visual_graph(), rz_core_visual_seek_animation_undo(), and rz_seek_undo_handler().
Definition at line 40 of file seek.c.
References addr, rz_core_seek(), rz_core_seek_and_save(), and save.
Referenced by rz_core_seek_align(), rz_core_seek_analysis_bb(), rz_core_seek_base(), rz_core_seek_delta(), rz_core_seek_next(), rz_core_seek_opt(), and rz_core_seek_prev().
|
static |
Definition at line 182 of file seek.c.
References seek_flag_offset_t::is_next, seek_flag_offset_t::next, seek_flag_offset_t::offset, and rz_flag_item_t::offset.
Referenced by rz_core_seek_next(), and rz_core_seek_prev().
Definition at line 72 of file seek.c.
References add_seek_history(), addr, need_add2history(), rz_core_seek_history_t::saved_set, and rz_core_t::seek_history.
Referenced by rz_core_seek_and_save(), and rz_core_seek_save().
|
static |
Definition at line 17 of file seek.c.
References rz_print_t::cur, rz_core_seek_undo_t::cursor, rz_core_seek_undo_t::offset, rz_core_t::print, and rz_core_seek().
Referenced by rz_core_seek_redo(), and rz_core_seek_undo().