Rizin
unix-like reverse engineering framework and cli tools
|
#include "rz_vector.h"
Go to the source code of this file.
Macros | |
#define | INITIAL_VECTOR_LEN 4 |
#define | NEXT_VECTOR_CAPACITY |
#define | RESIZE_OR_RETURN_NULL(next_capacity) |
#define | VEC_INDEX(a, i) (char *)a + elem_size *(i) |
#define NEXT_VECTOR_CAPACITY |
#define RESIZE_OR_RETURN_NULL | ( | next_capacity | ) |
|
static |
|
static |
Definition at line 387 of file vector.c.
References a, cmp(), i, and n.
Referenced by rz_pvector_sort().
Definition at line 326 of file vector.c.
References rz_return_if_fail, rz_vector_clear(), and rz_pvector_t::v.
Referenced by clear_bb_vars(), cmd_desc_free(), interact(), run_rz_test(), rz_analysis_block_recurse(), rz_analysis_block_recurse_followthrough(), rz_analysis_block_shortest_path(), rz_analysis_function_delete_all_vars(), rz_analysis_rtti_msvc_recover_all(), rz_io_cache_reset(), rz_io_map_fini(), rz_io_map_priorize_for_fd(), rz_line_completion_clear(), rz_serialize_analysis_load(), rz_subprocess_fini(), rz_test_main(), rz_test_run_asm_test(), and rz_test_test_database_free().
Definition at line 344 of file vector.c.
References rz_vector_t::a, i, rz_vector_t::len, NULL, rz_return_val_if_fail, rz_pvector_t::v, and x.
Referenced by rz_analysis_var_set_access(), and rz_pvector_remove_data().
Definition at line 331 of file vector.c.
References rz_return_if_fail, rz_vector_fini(), and rz_pvector_t::v.
Referenced by __cons_pal_update_event(), bin_section_map_fini(), core_cmd_tsrzcmd(), parse_line_header_source(), print_source_info(), rz_analysis_il_config_free(), rz_bin_reloc_storage_new(), rz_bin_source_line_info_builder_build_and_fini(), rz_core_file_free(), rz_core_recover_vars(), rz_il_vm_fini(), rz_io_cache_fini(), and rz_line_ns_completion_result_free().
Definition at line 336 of file vector.c.
References free(), rz_vector_fini(), and rz_pvector_t::v.
Referenced by bin_pe_dotnet_destroy_clr(), can_emulate_metadata(), core_analysis_bytes_json(), core_analysis_bytes_standard(), database_load(), del(), ds_disassemble(), ds_print_meta_infos(), fcn_takeover_block_recursive_followthrough_cb(), get_relocs(), inst_vars_kv_free(), mach0_free(), requires_op_size(), rz_analysis_esil_trace_free(), rz_analysis_fcn(), rz_analysis_function_args(), rz_analysis_function_delete_unused_vars(), rz_analysis_function_derive_args(), rz_analysis_function_set_type(), rz_analysis_il_trace_instruction_free(), rz_analysis_reflines_get(), rz_analysis_rzil_trace_free(), rz_analysis_var_resolve_overlaps(), rz_annotated_code_line_offsets(), rz_bin_dex_free(), rz_bin_object_p2v_all(), rz_cmd_debug_traces_esil_delete_handler(), rz_core_analysis_bytes(), rz_core_analysis_esil(), rz_core_analysis_get_stats(), rz_core_analysis_il_vm_status(), rz_core_meta_print_list_at(), rz_core_print_disasm_json(), rz_core_visual_analysis(), rz_il_validate_global_context_new_from_vm(), rz_pvector_new_with_len(), rz_table_columns(), rz_table_row_fini(), rz_test_load_asm_test_file(), rz_test_load_cmd_test_file(), rz_test_main(), rz_tree_bfs(), rz_type_callable_free(), and var_functions_show().
RZ_API void rz_pvector_init | ( | RzPVector * | vec, |
RzPVectorFree | free | ||
) |
Definition at line 298 of file vector.c.
References free(), NULL, pvector_free_elem(), rz_vector_init(), and rz_pvector_t::v.
Referenced by __cons_pal_update_event(), core_cmd_tsrzcmd(), core_file_new(), create_cmd_desc(), interact(), parse_line_header_source(), print_source_info(), run_rz_test(), rz_analysis_block_recurse(), rz_analysis_block_recurse_followthrough(), rz_analysis_block_shortest_path(), rz_analysis_function_new(), rz_analysis_il_config_new(), rz_analysis_rtti_msvc_recover_all(), rz_bin_object_sections_mapping_list(), rz_bin_reloc_storage_new(), rz_bin_source_line_info_builder_build_and_fini(), rz_core_recover_vars(), rz_il_vm_init(), rz_io_cache_init(), rz_io_map_init(), rz_io_map_priorize_for_fd(), rz_line_completion_init(), rz_line_ns_completion_result_new(), rz_pvector_new(), rz_serialize_analysis_load(), rz_subprocess_init(), rz_test_main(), rz_test_run_asm_test(), and rz_test_test_database_new().
RZ_API RzPVector* rz_pvector_new | ( | RzPVectorFree | free | ) |
Definition at line 302 of file vector.c.
References free(), NULL, RZ_NEW, rz_pvector_init(), and v.
Referenced by analysis_class_print(), bin_pe_dotnet_init_metadata(), c_parser_new_callable(), c_parser_new_naked_callable(), capture_filter_keywords(), collect_nodes_at(), collect_nodes_in(), collect_nodes_intersect(), del(), get_patchable_relocs(), get_token_patterns(), parse_type_mfunction(), parse_type_procedure(), print_stats(), rz_analysis_esil_trace_new(), rz_analysis_function_all_opcode_stat_handler(), rz_analysis_function_args(), rz_analysis_il_trace_instruction_new(), rz_analysis_rzil_trace_new(), rz_analysis_var_set_access(), rz_annotated_code_annotations_in(), rz_annotated_code_annotations_range(), rz_bin_dex_new(), rz_bin_object_get_maps_at(), rz_cmd_debug_traces_esil_delete_handler(), rz_core_analysis_bytes(), rz_il_var_set_get_all(), rz_pvector_new_with_len(), rz_table_add_row(), rz_table_add_row_columnsf(), rz_table_add_rowf(), rz_table_columns(), rz_test_load_asm_test_file(), rz_test_load_cmd_test_file(), rz_test_load_json_test_file(), rz_test_main(), rz_tree_bfs(), rz_type_callable_clone(), and rz_type_callable_new().
RZ_API RzPVector* rz_pvector_new_with_len | ( | RzPVectorFree | free, |
size_t | length | ||
) |
Definition at line 311 of file vector.c.
References free(), length, memset(), NULL, p, rz_pvector_free(), rz_pvector_new(), rz_pvector_reserve(), and v.
Referenced by get_relocs().
Definition at line 372 of file vector.c.
References rz_vector_t::len, NULL, r, rz_pvector_at(), rz_return_val_if_fail, rz_vector_pop(), and rz_pvector_t::v.
Referenced by analysis_block_on_exit(), rz_analysis_block_recurse(), rz_analysis_block_recurse_followthrough(), rz_core_visual_cmd(), rz_test_run_asm_test(), substitute_args_fini(), and worker_th().
Definition at line 379 of file vector.c.
References NULL, r, rz_pvector_at(), rz_return_val_if_fail, rz_vector_pop_front(), and rz_pvector_t::v.
Referenced by rz_core_disasm_pde(), and rz_tree_bfs().
Definition at line 355 of file vector.c.
References NULL, r, rz_pvector_at(), rz_return_val_if_fail, rz_vector_remove_at(), and rz_pvector_t::v.
Referenced by rz_analysis_function_delete_vars_by_kind(), rz_analysis_var_delete(), rz_io_map_cleanup(), rz_io_map_del(), rz_io_map_del_for_fd(), rz_io_map_depriorize(), rz_io_map_priorize(), rz_io_map_priorize_for_fd(), and rz_test_main().
Definition at line 362 of file vector.c.
References rz_vector_t::a, NULL, rz_pvector_contains(), rz_vector_remove_at(), rz_pvector_t::v, and x.
Referenced by cmd_desc_unset_parent(), rz_analysis_function_delete_var(), rz_analysis_var_clear_accesses(), rz_analysis_var_remove_access_at(), rz_core_file_bin_file_deleted(), rz_core_file_io_desc_closed(), rz_core_file_io_map_deleted(), rz_io_cache_invalidate(), and rz_subprocess_free().
RZ_API void rz_pvector_sort | ( | RzPVector * | vec, |
RzPVectorComparator | cmp | ||
) |
Definition at line 408 of file vector.c.
References rz_vector_t::a, cmp(), rz_vector_t::len, quick_sort(), rz_return_if_fail, and rz_pvector_t::v.
Referenced by __cons_pal_update_event(), cmd_desc_set_parent(), print_source_info(), rz_bin_reloc_storage_new(), rz_bin_source_line_info_builder_build_and_fini(), and sort_groups().
Definition at line 114 of file vector.c.
References rz_vector_t::elem_size, memcpy(), p, and rz_return_if_fail.
Referenced by rz_vector_assign_at(), rz_vector_insert(), rz_vector_pop(), rz_vector_push(), and rz_vector_remove_at().
Definition at line 119 of file vector.c.
References p, rz_vector_assign(), and rz_vector_index_ptr().
Definition at line 68 of file vector.c.
References rz_vector_t::a, rz_vector_t::capacity, RZ_FREE, rz_return_if_fail, and vector_free_elems().
Referenced by add_seek_history(), nextword(), parse_enum(), parse_structure(), parse_union(), recovery_complete_object_locator_free(), rz_analysis_block_recurse_depth_first(), rz_analysis_var_clear_accesses(), rz_analysis_vtable_info_free(), rz_annotated_code_free(), rz_event_send(), rz_pvector_clear(), rz_skyline_clear(), and rz_vector_fini().
Definition at line 101 of file vector.c.
References free(), NULL, RZ_NEW, rz_return_val_if_fail, and vector_clone().
Referenced by clear_bb_vars(), fcn_takeover_block_recursive_followthrough_cb(), rz_analysis_function_delete_unused_vars(), rz_analysis_function_set_type(), rz_analysis_var_resolve_overlaps(), rz_asm_token_string_clone(), and rz_core_disasm_pde().
Definition at line 61 of file vector.c.
References rz_vector_t::free, rz_vector_t::free_user, NULL, rz_return_if_fail, and rz_vector_clear().
Referenced by analyze_function_locally(), backtrace_windows_x64(), buf_sparse_fini(), dmp_close(), init_module_runtime_functions(), note_segment_free(), parse_line_header_source(), parse_line_raw(), rz_analysis_fcn(), rz_analysis_get_delta_jmptbl_info(), rz_analysis_il_init_state_free(), rz_analysis_var_global_free(), rz_bflt_free(), rz_bin_elf_dt_dynamic_free(), rz_bin_elf_notes_new(), rz_bin_source_line_info_builder_build_and_fini(), rz_bin_source_line_info_builder_fini(), rz_core_analysis_stats_free(), rz_core_seek_free(), rz_core_seek_reset(), rz_core_visual_graph(), rz_debug_dmp_pids(), rz_event_free(), rz_il_reg_binding_derive(), rz_pvector_fini(), rz_pvector_free(), rz_skyline_fini(), rz_type_base_type_free(), rz_vector_free(), and var_free().
Turn the vector into a fixed-size array. This will clear the vector and return an array of its original contents whose ownership is transferred to the caller. This is useful when RzVector is used for its dynamically growing functionality as an intermediate step to generate a fixed-size array in the end.
Definition at line 230 of file vector.c.
References rz_vector_t::a, rz_vector_t::capacity, rz_vector_t::len, NULL, r, rz_return_val_if_fail, and rz_vector_shrink().
Referenced by parse_line_header_source(), parse_line_raw(), rz_bin_source_line_info_builder_build_and_fini(), rz_il_reg_binding_derive(), and rz_pvector_flush().
Definition at line 75 of file vector.c.
References free(), and rz_vector_fini().
Referenced by addr_hint_record_ht_free(), analysis_class_print(), analysis_class_print_as_cmd(), analysis_class_print_to_json(), convert_sections_from_shdr(), detect_constructor_destructor(), get_gnu_debugdata_elf_symbols(), get_sections_from_dt_dynamic(), get_segments_from_phdr(), ht_callback_free(), htup_vector_free(), init(), kv_array_free(), list_all_functions_at_vtable_offset(), rz_analysis_class_base_delete_class_cb(), rz_analysis_class_base_get_all(), rz_analysis_class_base_list_handler(), rz_analysis_class_base_rename_class_cb(), rz_analysis_class_base_set(), rz_analysis_class_get_inheritance_graph(), rz_analysis_class_method_exists_by_addr(), rz_analysis_class_method_get_all(), rz_analysis_class_method_get_by_addr(), rz_analysis_class_vtable_get_all(), rz_analysis_class_vtable_list_handler(), rz_analysis_class_vtable_set(), rz_asm_token_string_free(), rz_bin_elf_compute_symbols(), rz_bin_elf_convert_sections(), rz_bin_elf_free(), rz_bin_elf_notes_new(), rz_bin_elf_relocs_new(), rz_bin_elf_sections_new(), rz_core_bin_sections_mapping_print(), rz_debug_session_free(), rz_id_pool_free(), rz_id_pool_grab_id(), rz_table_columns(), rz_table_filter_columns(), and rz_table_free().
RZ_API void rz_vector_init | ( | RzVector * | vec, |
size_t | elem_size, | ||
RzVectorFree | free, | ||
void * | free_user | ||
) |
Definition at line 33 of file vector.c.
References rz_vector_t::a, rz_vector_t::capacity, rz_vector_t::elem_size, rz_vector_t::free, free(), rz_vector_t::free_user, rz_vector_t::len, NULL, and rz_return_if_fail.
Referenced by agraph_init(), analyze_function_locally(), backtrace_windows_x64(), buf_sparse_init(), dmp_open(), global_var_load_cb(), init_module_runtime_functions(), parse_line_header_source(), parse_line_raw(), recovery_complete_object_locator_new(), rz_analysis_block_recurse_depth_first(), rz_analysis_fcn(), rz_analysis_function_set_var(), rz_analysis_get_delta_jmptbl_info(), rz_analysis_il_init_state_new(), rz_analysis_vtable_parse_at(), rz_annotated_code_new(), rz_bflt_init(), rz_bin_elf_dt_dynamic_new(), rz_bin_elf_notes_new(), rz_bin_source_line_info_builder_init(), rz_core_analysis_get_stats(), rz_core_seek_reset(), rz_debug_dmp_pids(), rz_event_new(), rz_il_reg_binding_derive(), rz_pvector_init(), rz_serialize_analysis_var_load(), rz_skyline_init(), rz_type_base_type_new(), and rz_vector_new().
Definition at line 151 of file vector.c.
References rz_vector_t::capacity, rz_vector_t::elem_size, len, rz_vector_t::len, NEXT_VECTOR_CAPACITY, NULL, p, RESIZE_OR_RETURN_NULL, rz_return_val_if_fail, rz_vector_assign(), rz_vector_index_ptr(), and x.
Referenced by rz_analysis_var_set_access(), rz_pvector_insert(), rz_skyline_add(), rz_vector_push_front(), and sparse_write().
Definition at line 167 of file vector.c.
References rz_vector_t::capacity, count, rz_vector_t::elem_size, len, rz_vector_t::len, memcpy(), NEXT_VECTOR_CAPACITY, NULL, p, RESIZE_OR_RETURN_NULL, RZ_MAX, rz_return_val_if_fail, and rz_vector_index_ptr().
Referenced by rz_core_analysis_get_stats(), and rz_pvector_insert_range().
RZ_API RzVector* rz_vector_new | ( | size_t | elem_size, |
RzVectorFree | free, | ||
void * | free_user | ||
) |
Definition at line 42 of file vector.c.
References free(), NULL, RZ_NEW, and rz_vector_init().
Referenced by add_mem_change(), add_reg_change(), array_add(), convert_sections_from_shdr(), deserialize_memory_cb(), deserialize_registers_cb(), ensure_addr_hint_record(), get_cbs(), get_sections_from_dt_dynamic(), get_segments_from_phdr(), rz_analysis_class_base_get_all(), rz_analysis_class_method_get_all(), rz_analysis_class_vtable_get_all(), rz_annotated_code_line_offsets(), rz_asm_token_string_new(), rz_bin_elf_compute_symbols(), rz_bin_elf_notes_new(), rz_bin_elf_relocs_new(), rz_bin_elf_sections_new(), rz_bin_object_p2v_all(), rz_bin_object_sections_mapping_list(), rz_debug_session_add_mem_change(), rz_debug_session_add_reg_change(), rz_debug_session_new(), rz_id_pool_kick_id(), rz_table_columns(), rz_table_filter_columns(), and rz_table_new().
Definition at line 184 of file vector.c.
References rz_vector_t::len, rz_return_if_fail, rz_vector_assign(), and rz_vector_index_ptr().
Referenced by rz_analysis_block_recurse_depth_first(), rz_analysis_run_tasks(), rz_core_seek_redo(), rz_core_seek_undo(), and rz_pvector_pop().
Definition at line 192 of file vector.c.
References rz_return_if_fail, and rz_vector_remove_at().
Referenced by rz_id_pool_grab_id(), and rz_pvector_pop_front().
Definition at line 197 of file vector.c.
References rz_vector_t::capacity, rz_vector_t::len, NEXT_VECTOR_CAPACITY, NULL, p, RESIZE_OR_RETURN_NULL, rz_return_val_if_fail, rz_vector_assign(), rz_vector_index_ptr(), and x.
Referenced by add_dt_dynamic_entry(), add_mem_change(), add_reg_change(), add_seek_history(), add_token(), analyze_function_locally(), array_add(), bflt_load_relocs(), compute_symbols_from_segment(), convert_sections_from_shdr(), create_section_from_phdr(), deserialize_checkpoints_cb(), deserialize_memory_cb(), deserialize_registers_cb(), ensure_addr_hint_record(), get_enum_type(), get_gnu_debugdata_elf_symbols(), get_relocs_entry(), get_segments_from_phdr(), get_struct_type(), get_union_type(), global_var_load_cb(), init_module_runtime_functions(), nextword(), parse_enum(), parse_enum_node(), parse_enum_type(), parse_line_header_source(), parse_note_file(), parse_note_prstatus(), parse_opcodes(), parse_struct_node(), parse_structure(), parse_structure_type(), parse_union(), parse_union_node(), recovery_analysis_complete_object_locator(), rz_analysis_block_recurse_depth_first(), rz_analysis_class_base_get_all(), rz_analysis_class_method_get_all(), rz_analysis_class_vtable_get_all(), rz_analysis_get_delta_jmptbl_info(), rz_analysis_il_init_state_set_var(), rz_analysis_task_item_new(), rz_analysis_var_add_constraint(), rz_analysis_var_global_add_constraint(), rz_analysis_vtable_parse_at(), rz_annotated_code_add_annotation(), rz_annotated_code_line_offsets(), rz_bin_elf_notes_new(), rz_bin_elf_sections_new(), rz_bin_object_p2v_all(), rz_bin_object_sections_mapping_list(), rz_bin_source_line_info_builder_push_sample(), rz_core_seek_redo(), rz_core_seek_undo(), rz_debug_add_checkpoint(), rz_debug_dmp_init(), rz_debug_dmp_pids(), rz_debug_session_add_mem_change(), rz_debug_session_add_reg_change(), rz_event_hook(), rz_event_unhook(), rz_id_pool_kick_id(), rz_il_reg_binding_derive(), rz_pvector_push(), rz_serialize_analysis_var_load(), rz_table_add_column(), rz_table_add_row(), rz_table_add_row_vec(), and rz_table_columns().
Definition at line 209 of file vector.c.
References NULL, rz_return_val_if_fail, rz_vector_insert(), and x.
Referenced by rz_pvector_push_front().
Definition at line 127 of file vector.c.
References rz_vector_t::elem_size, len, rz_vector_t::len, p, rz_return_if_fail, rz_vector_assign(), and rz_vector_index_ptr().
Referenced by add_seek_history(), del_hook(), rz_analysis_var_remove_access_at(), rz_pvector_remove_at(), rz_pvector_remove_data(), rz_skyline_add(), rz_table_filter(), rz_table_group(), rz_vector_pop_front(), and unset_addr_hint_record().
remove all elements in the given range and write the contents to into (must be appropriately large). It is the caller's responsibility to free potential resources associated with the elements.
Definition at line 139 of file vector.c.
References count, rz_vector_t::elem_size, len, rz_vector_t::len, memcpy(), p, rz_return_if_fail, and rz_vector_index_ptr().
Referenced by buf_sparse_resize(), and sparse_write().
Definition at line 214 of file vector.c.
References rz_vector_t::a, rz_vector_t::capacity, NULL, RESIZE_OR_RETURN_NULL, and rz_return_val_if_fail.
Referenced by c_parser_new_enum_type(), c_parser_new_structure_type(), c_parser_new_union_type(), get_enum_type(), get_struct_type(), get_union_type(), init_module_runtime_functions(), recovery_analysis_complete_object_locator(), rz_analysis_class_base_get_all(), rz_analysis_class_method_get_all(), rz_analysis_class_vtable_get_all(), rz_bin_object_sections_mapping_list(), rz_id_pool_kick_id(), and rz_pvector_reserve().
Definition at line 222 of file vector.c.
References rz_vector_t::a, rz_vector_t::capacity, rz_vector_t::len, NULL, RESIZE_OR_RETURN_NULL, and rz_return_val_if_fail.
Referenced by rz_pvector_shrink(), and rz_vector_flush().
RZ_API void rz_vector_sort | ( | RzVector * | vec, |
RzVectorComparator | cmp, | ||
bool | reverse | ||
) |
Sort function for RzVector.
vec | pointer to RzVector |
cmp | function used for comparing elements while sorting |
reverse | sort order, ascending order when reverse = False |
Definition at line 285 of file vector.c.
References rz_vector_t::a, cmp(), rz_vector_t::elem_size, rz_vector_t::len, make_dist_html::reverse, rz_return_if_fail, and vector_quick_sort().
Referenced by rz_asm_tokenize_asm_regex(), rz_table_sort(), and rz_table_sortlen().
Definition at line 82 of file vector.c.
References dst, malloc(), memcpy(), NULL, rz_return_val_if_fail, and src.
Referenced by rz_vector_clone().
|
static |
Definition at line 51 of file vector.c.
References rz_vector_t::free, rz_vector_t::free_user, rz_vector_t::len, and rz_vector_index_ptr().
Referenced by rz_vector_clear().
|
static |
Definition at line 241 of file vector.c.
References a, cmp(), free(), i, len, malloc(), memcpy(), make_dist_html::reverse, RZ_FREE, RZ_LOG_ERROR, rz_return_if_fail, and VEC_INDEX.
Referenced by rz_vector_sort().