Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_bin.h>
#include <rz_demangler.h>
#include <rz_util.h>
#include <rz_lib.h>
#include <rz_io.h>
#include <config.h>
#include "i/private.h"
Go to the source code of this file.
Macros | |
#define | DB a->sdb; |
#define | RBINLISTFREE(x) |
#define | ARCHS_KEY "archs" |
Variables | |
static RzBinPlugin * | bin_static_plugins [] = { RZ_BIN_STATIC_PLUGINS } |
static RzBinXtrPlugin * | bin_xtr_static_plugins [] = { RZ_BIN_XTR_STATIC_PLUGINS } |
|
static |
Definition at line 843 of file bin.c.
References NULL, rz_bin_get_section_at(), and rz_return_val_if_fail.
Referenced by rz_bin_bind().
Definition at line 37 of file bin.c.
References a, rz_bin_plugin_t::get_name, setup::idx, NULL, rz_bin_cur(), rz_bin_file_cur_plugin(), and type.
Referenced by rz_bin_bind().
Definition at line 28 of file bin.c.
References a, rz_bin_plugin_t::get_offset, setup::idx, rz_bin_cur(), rz_bin_file_cur_plugin(), type, and UT64_MAX.
Referenced by rz_bin_bind().
|
static |
Definition at line 486 of file bin.c.
References rz_bin_xtr_plugin_t::desc, rz_bin_xtr_plugin_t::license, rz_bin_xtr_plugin_t::name, pj_end(), pj_free(), pj_ks(), pj_new(), pj_o(), and pj_string().
Referenced by rz_bin_list_plugin().
RZ_API void rz_bin_arch_options_init | ( | RzBinArchOptions * | opt, |
const char * | arch, | ||
int | bits | ||
) |
Definition at line 84 of file bin.c.
References rz_bin_arch_options_t::arch, arch, rz_bin_arch_options_t::bits, bits(), RZ_SYS_ARCH, and RZ_SYS_BITS.
Referenced by create(), and rz_main_rz_bin().
Definition at line 851 of file bin.c.
References __get_vsection_at(), __getname(), __getoffset(), b, rz_bin_demangle(), and rz_bin_get_sections().
Referenced by rz_core_init().
RZ_API RzBuffer* rz_bin_create | ( | RzBin * | bin, |
const char * | p, | ||
const ut8 * | code, | ||
int | codelen, | ||
const ut8 * | data, | ||
int | datalen, | ||
RzBinArchOptions * | opt | ||
) |
Definition at line 862 of file bin.c.
References rz_bin_plugin_t::create, NULL, p, rz_bin_get_binplugin_by_name(), RZ_LOG_WARN, RZ_MAX, and rz_return_val_if_fail.
Referenced by create(), and rz_main_rz_bin().
Definition at line 895 of file bin.c.
References NULL, and rz_return_val_if_fail.
Referenced by __getname(), __getoffset(), add_new_bin_string(), add_new_func_symbol(), basefind_create_array_of_addresses(), bin_class_print_rizin(), bin_trycatch(), cb_binmaxstr(), cb_binmaxstrbuf(), cb_binminstr(), cb_binstrenc(), classes_as_source_print(), get_bin_info(), get_va_symbol(), getFunctionName(), GetHeapGlobalsOffset(), meta_string_guess_add(), print_cmd_analysis_after_traps_print(), rabin_do_operation(), rabin_extract(), rebase_helper(), rz_bin_cur_object(), rz_bin_section_flag_to_list(), rz_bin_section_type_to_string(), rz_bin_select(), rz_bin_set_baddr(), rz_cmd_debug_dmi(), rz_cmd_info_handler(), rz_cmd_info_whole_strings_handler(), rz_core_analysis_calls(), rz_core_bin_archs_print(), rz_core_bin_export_info(), rz_core_bin_headers_print(), rz_core_bin_load(), rz_core_bin_raise(), rz_core_bin_set_arch_bits(), rz_core_bin_set_by_fd(), rz_core_bin_set_by_name(), rz_core_bin_signatures_print(), rz_core_bin_update_arch_bits(), rz_core_get_reloc_to(), rz_core_getreloc(), rz_core_io_file_open(), rz_core_meta_pascal_string_add(), rz_main_rizin(), and rz_open_binary_rebase_handler().
RZ_API RzBinObject* rz_bin_cur_object | ( | RzBin * | bin | ) |
Definition at line 900 of file bin.c.
References NULL, rz_bin_file_t::o, rz_bin_cur(), and rz_return_val_if_fail.
Referenced by core_file_do_load_for_debug(), core_file_do_load_for_io_plugin(), do_iter_sections(), ds_print_ptr(), is_apple_target(), meta_string_guess_add(), num_callback(), prompt_add_section(), recover_string_at(), rz_analysis_set_stringrefs(), rz_analyze_symbols_entries_handler(), rz_bin_get_classes(), rz_bin_get_entries(), rz_bin_get_fields(), rz_bin_get_imports(), rz_bin_get_info(), rz_bin_get_laddr(), rz_bin_get_libs(), rz_bin_get_mem(), rz_bin_get_sections(), rz_bin_get_size(), rz_bin_get_strings(), rz_bin_get_symbols(), rz_bin_is_static(), rz_bin_set_baddr(), rz_cmd_debug_step_prog_handler(), rz_cmd_info_kuery(), rz_cmd_info_section_bars_handler(), rz_core_analysis_datarefs(), rz_core_analysis_hasrefs_to_depth(), rz_core_analysis_importxrefs(), rz_core_analysis_sigdb_apply(), rz_core_arch_bits_at(), rz_core_bin_load(), rz_core_cmd_foreach3(), rz_core_get_boundaries_prot(), rz_core_get_section_name(), rz_core_visual_cmd(), rz_main_rizin(), strings_print(), and update_sdb().
RZ_API RZ_OWN char* rz_bin_demangle | ( | RZ_NULLABLE RzBinFile * | bf, |
RZ_NULLABLE const char * | language, | ||
RZ_NULLABLE const char * | symbol, | ||
ut64 | vaddr, | ||
bool | libs | ||
) |
Demangles a symbol based on the language or the RzBinFile data.
This function demangles a symbol based on the language or the RzBinFile data When C++ or rust is selected as the language, it will add methods into the RzBinFile structure based on the demangled symbol. When libs is set to true, the demangled symbol will be appended to the library name <libname>_<demangled symbol>.
bf | RzBinFile data to be used for demangling |
language | Language to be used for demanglind |
symbol | Symbol to be demangled |
vaddr | vaddr of the symbol to be demangled |
libs | Append the library name to the demangled symbol, if set to true |
symbol
Definition at line 1295 of file bin.c.
References d, found, free(), rz_bin_object_t::info, rz_bin_info_t::lang, len, libs(), rz_bin_object_t::libs, NULL, RZ_BIN_LANGUAGE_CXX, RZ_BIN_LANGUAGE_DART, RZ_BIN_LANGUAGE_GROOVY, RZ_BIN_LANGUAGE_JAVA, RZ_BIN_LANGUAGE_KOTLIN, RZ_BIN_LANGUAGE_MASK, RZ_BIN_LANGUAGE_MSVC, RZ_BIN_LANGUAGE_OBJC, RZ_BIN_LANGUAGE_RUST, RZ_BIN_LANGUAGE_SWIFT, rz_bin_language_to_id(), rz_bin_language_to_string(), RZ_BIN_LANGUAGE_UNKNOWN, rz_demangler_java(), rz_demangler_msvc(), rz_demangler_objc(), rz_demangler_resolve(), RZ_STR_ISEMPTY, rz_str_ncasecmp(), rz_str_newf(), and type.
Referenced by ds_print_relocs(), ds_show_flags(), ds_show_functions(), reloc_set_flag(), rz_bin_bind(), rz_bin_filter_sym(), rz_core_analysis_fcn_name(), rz_core_bin_imports_print(), rz_core_bin_relocs_print(), rz_core_sym_name_init(), symbols(), and symbols_from_mach0().
Definition at line 912 of file bin.c.
References NULL, RZ_BIN_ENTRY_TYPE_FINI, RZ_BIN_ENTRY_TYPE_INIT, RZ_BIN_ENTRY_TYPE_MAIN, RZ_BIN_ENTRY_TYPE_PREINIT, RZ_BIN_ENTRY_TYPE_PROGRAM, and RZ_BIN_ENTRY_TYPE_TLS.
Referenced by entries_initfini_print(), and rz_core_bin_apply_entry().
RZ_API void rz_bin_field_free | ( | RzBinField * | field | ) |
Definition at line 950 of file bin.c.
References rz_bin_field_t::comment, rz_bin_field_t::format, free(), rz_bin_field_t::name, rz_bin_field_t::type, and rz_bin_field_t::visibility_str.
Referenced by dex_resolve_fields_in_class(), fields(), get_ivar_list_t(), MACH0_(), rz_bin_dex_fields(), and rz_bin_java_class_fields_as_binfields().
RZ_API RzBinField* rz_bin_field_new | ( | ut64 | paddr, |
ut64 | vaddr, | ||
int | size, | ||
const char * | name, | ||
const char * | comment, | ||
const char * | format, | ||
bool | format_named | ||
) |
Definition at line 935 of file bin.c.
References rz_bin_field_t::comment, rz_bin_field_t::format, rz_bin_field_t::format_named, rz_bin_field_t::name, NULL, rz_bin_field_t::paddr, RZ_NEW0, rz_bin_field_t::size, strdup(), and rz_bin_field_t::vaddr.
Referenced by classes_from_symbols(), fields(), MACH0_(), and rz_bin_java_class_fields_as_binfields().
Definition at line 1160 of file bin.c.
References rz_bin_file_load_options_t::baseaddr, map(), NULL, rz_bin_file_t::o, rz_bin_object_t::opts, rz_bin_object_get_map_at(), and rz_bin_file_t::size.
Referenced by rz_core_binfiles_delete(), rz_core_seek(), and rz_open_binary_show_handler().
RZ_IPI void rz_bin_file_free | ( | void * | _bf | ) |
Definition at line 44 of file bfile.c.
References rz_bin_file_t::buf, rz_bin_t::cur, rz_bin_file_t::curxtr, rz_bin_xtr_plugin_t::destroy, rz_bin_plugin_t::destroy, rz_bin_file_t::file, free(), rz_bin_xtr_plugin_t::free_xtr, rz_bin_file_t::id, rz_bin_t::ids, NULL, rz_bin_file_t::o, rz_id_storage_t::pool, rz_bin_file_t::rbin, rz_bin_file_cur_plugin(), rz_bin_object_free(), rz_buf_free(), rz_id_pool_kick_id(), rz_list_free(), rz_bin_file_t::sdb, sdb_free(), rz_bin_file_t::xtr_data, and rz_bin_file_t::xtr_obj.
Referenced by rz_bin_file_close(), and rz_bin_new().
RZ_API void rz_bin_file_hash_free | ( | RzBinFileHash * | fhash | ) |
Definition at line 89 of file bin.c.
References free(), rz_bin_file_hash_t::hex, RZ_FREE, and rz_bin_file_hash_t::type.
Referenced by rz_bin_file_compute_hashes().
Definition at line 906 of file bin.c.
References free(), name, NULL, rz_return_if_fail, and strdup().
Referenced by cb_binforce(), rz_main_rizin(), and rz_main_rz_bin().
Definition at line 440 of file bin.c.
References free(), NULL, rz_demangler_free(), rz_event_free(), rz_hash_free(), rz_id_storage_free(), rz_list_free(), rz_str_constpool_fini(), and sdb_free().
Referenced by create(), download_pdb(), rz_core_fini(), rz_diff_file_close(), rz_diff_file_open(), and rzfind_open_file().
Definition at line 536 of file bin.c.
References rz_bin_file_get_baddr(), rz_return_val_if_fail, and UT64_MAX.
Referenced by entries_initfini_print(), rz_core_bin_apply_all_info(), rz_core_bin_info_print(), rz_core_file_reopen_remote_debug(), and rz_core_pdb_load_info().
RZ_API RzBinPlugin* rz_bin_get_binplugin_by_buffer | ( | RzBin * | bin, |
RzBuffer * | buf | ||
) |
Definition at line 349 of file bin.c.
References rz_bin_plugin_t::check_buffer, NULL, and rz_return_val_if_fail.
Referenced by cmd_search_bin(), and get_plugin_from_buffer().
RZ_IPI RzBinPlugin* rz_bin_get_binplugin_by_filename | ( | RzBin * | bin | ) |
Definition at line 365 of file bin.c.
References rz_bin_plugin_t::check_filename, NULL, rz_return_val_if_fail, and RZ_SYS_DIR.
Referenced by get_plugin_from_buffer().
RZ_IPI RzBinPlugin* rz_bin_get_binplugin_by_name | ( | RzBin * | bin, |
const char * | name | ||
) |
Definition at line 335 of file bin.c.
References rz_bin_plugin_t::name, NULL, and rz_return_val_if_fail.
Referenced by get_plugin_from_buffer(), and rz_bin_create().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_classes | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 883 of file bin.c.
References rz_bin_object_t::classes, NULL, rz_bin_cur_object(), and rz_return_val_if_fail.
Referenced by findClassBounds(), rz_analysis_class_recover_from_rzbin(), rz_core_visual_classes(), and rz_core_visual_hudclasses().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_entries | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 567 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_entries(), and rz_return_val_if_fail.
Referenced by initializeEsil(), and rz_core_analysis_all().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_fields | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 573 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_fields(), and rz_return_val_if_fail.
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_imports | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 579 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_imports(), and rz_return_val_if_fail.
Referenced by rz_core_bin_load(), and rz_core_cmd_foreach3().
RZ_DEPRECATE RZ_API RZ_BORROW RzBinInfo* rz_bin_get_info | ( | RzBin * | bin | ) |
Definition at line 585 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_info(), and rz_return_val_if_fail.
Referenced by bin_versioninfo(), core_bin_file_print(), get_main_arena_with_symbol(), GetHeapGlobalsOffset(), initializeEsil(), rz_bin_pdb_download(), rz_cmd_info_hashes_handler(), rz_core_bin_info_print(), rz_core_bin_pdb_get_filename(), and rz_core_file_info_print().
Definition at line 542 of file bin.c.
References rz_bin_file_load_options_t::loadaddr, rz_bin_object_t::opts, rz_bin_cur_object(), rz_return_val_if_fail, and UT64_MAX.
Referenced by entries_initfini_print(), rabin_do_operation(), rz_bin_use_arch(), and rz_core_bin_info_print().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_libs | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 591 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_libs(), and rz_return_val_if_fail.
Referenced by rz_core_bin_load().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_mem | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 702 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_mem(), and rz_return_val_if_fail.
Definition at line 961 of file bin.c.
References NULL, RZ_BIN_METH_ABSTRACT, RZ_BIN_METH_BRIDGE, RZ_BIN_METH_CLASS, RZ_BIN_METH_CONST, RZ_BIN_METH_CONSTRUCTOR, RZ_BIN_METH_DECLARED_SYNCHRONIZED, RZ_BIN_METH_FILEPRIVATE, RZ_BIN_METH_FINAL, RZ_BIN_METH_INTERNAL, RZ_BIN_METH_MIRANDA, RZ_BIN_METH_MUTATING, RZ_BIN_METH_NATIVE, RZ_BIN_METH_OPEN, RZ_BIN_METH_PRIVATE, RZ_BIN_METH_PROTECTED, RZ_BIN_METH_PUBLIC, RZ_BIN_METH_STATIC, RZ_BIN_METH_STRICT, RZ_BIN_METH_SYNCHRONIZED, RZ_BIN_METH_SYNTHETIC, RZ_BIN_METH_VARARGS, and RZ_BIN_METH_VIRTUAL.
Referenced by flags_to_json(), resolve_method_flags(), and rz_core_bin_method_flags_str().
RZ_API RZ_BORROW RzBinSection* rz_bin_get_section_at | ( | RzBinObject * | o, |
ut64 | off, | ||
int | va | ||
) |
Find the binary section at offset off
.
o | Reference to the RzBinObject instance |
off | Address to search |
va | When 0 the offset off is considered a physical address, otherwise a virtual address |
RzBinSection
containing the address Definition at line 611 of file bin.c.
References from, NULL, off, rz_bin_object_addr_with_base(), rz_return_val_if_fail, rz_bin_object_t::sections, section::size, to, and ut64().
Referenced by __get_vsection_at(), ds_print_lines_left(), ds_print_ptr(), num_callback(), print_bin_string(), print_string(), prompt_add_section(), recover_string_at(), rz_bin_object_get_vaddr(), rz_cmd_debug_step_prog_handler(), rz_core_analysis_datarefs(), rz_core_analysis_hasrefs_to_depth(), rz_core_arch_bits_at(), rz_core_get_section_name(), rz_core_visual_cmd(), and strings_print().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_sections | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 597 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_sections_all(), and rz_return_val_if_fail.
Referenced by __dumpSections(), __save_old_sections(), cb_iova(), core_objc_new(), rz_bin_bind(), rz_core_analysis_recover_golang_functions(), and rz_main_rizin().
Definition at line 889 of file bin.c.
References rz_bin_cur_object(), rz_return_val_if_fail, rz_bin_object_t::size, and UT64_MAX.
Referenced by rz_core_bin_info_print(), and rz_core_bin_size_print().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_strings | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 690 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_strings(), and rz_return_val_if_fail.
Referenced by core_bin_strings(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), and rz_core_cmd_foreach3().
RZ_DEPRECATE RZ_API RZ_BORROW RzList* rz_bin_get_symbols | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 696 of file bin.c.
References NULL, rz_bin_cur_object(), rz_bin_object_get_symbols(), and rz_return_val_if_fail.
Referenced by __core_analysis_fcn(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), get_va_symbol(), rabin_dump_symbols(), rz_cmd_debug_dmi(), rz_core_analysis_get_stats(), rz_core_analysis_recover_golang_functions(), rz_core_bin_apply_symbols(), rz_core_cmd_foreach3(), and rz_core_debug_bp_add_noreturn_func().
RZ_IPI RzBinXtrPlugin* rz_bin_get_xtrplugin_by_name | ( | RzBin * | bin, |
const char * | name | ||
) |
Definition at line 383 of file bin.c.
References rz_bin_xtr_plugin_t::name, NULL, and rz_return_val_if_fail.
Referenced by rz_bin_file_new().
RZ_API RzBinImport* rz_bin_import_clone | ( | RzBinImport * | o | ) |
Definition at line 125 of file bin.c.
References rz_bin_import_t::classname, rz_bin_import_t::descriptor, rz_bin_import_t::name, NULL, rz_mem_dup(), rz_return_val_if_fail, and RZ_STR_DUP.
RZ_API void rz_bin_import_free | ( | RzBinImport * | imp | ) |
Definition at line 137 of file bin.c.
References rz_bin_import_t::classname, rz_bin_import_t::descriptor, free(), rz_bin_import_t::libname, rz_bin_import_t::name, and RZ_FREE.
Referenced by imports(), load_buffer(), rz_bin_dex_imports(), rz_bin_java_class_const_pool_as_imports(), rz_bin_le_get_imports(), rz_bin_le_get_relocs(), and rz_bin_ne_get_imports().
Definition at line 97 of file bin.c.
References rz_bin_info_t::actual_checksum, rz_bin_info_t::arch, rz_bin_info_t::bclass, rz_bin_info_t::claimed_checksum, rz_bin_info_t::compiler, rz_bin_info_t::cpu, rz_bin_info_t::debug_file_name, rz_bin_info_t::default_cc, rz_bin_info_t::features, rz_bin_info_t::file, rz_bin_info_t::file_hashes, free(), rz_bin_info_t::guid, rz_bin_info_t::head_flag, rz_bin_info_t::intrp, rz_bin_info_t::machine, rz_bin_info_t::os, rz_bin_info_t::rclass, rz_bin_info_t::rpath, rz_list_free(), rz_bin_info_t::subsystem, and rz_bin_info_t::type.
Referenced by load_buffer(), rz_bin_object_free(), and rz_core_bin_load().
RZ_DEPRECATE RZ_API int rz_bin_is_static | ( | RZ_NONNULL RzBin * | bin | ) |
Definition at line 708 of file bin.c.
References rz_bin_cur_object(), rz_bin_object_is_static(), and rz_return_val_if_fail.
Referenced by rz_core_bin_info_print().
Definition at line 510 of file bin.c.
References __printXtrPluginDetails(), rz_bin_xtr_plugin_t::name, rz_bin_plugin_t::name, rz_bin_print_plugin_details(), RZ_LOG_ERROR, rz_return_val_if_fail, and rz_str_cmp().
Referenced by __listPlugins().
Definition at line 930 of file bin.c.
Referenced by rz_main_rz_bin().
Definition at line 1023 of file bin.c.
Referenced by get_maps_unpatched(), load_buffer(), maps(), and rz_bin_maps_of_file_sections().
RZ_API RZ_OWN RzList* rz_bin_maps_of_file_sections | ( | RZ_NONNULL RzBinFile * | binfile | ) |
Create a list of RzBinMap from RzBinSections queried from the given file.
Some binary formats have a 1:1 correspondence of mapping and their RzBinSections. This is not always the case (e.g. ELF) but if it is, plugins can use this function as their maps callback, which will generate mappings for sections.
Definition at line 1040 of file bin.c.
References map(), rz_bin_section_t::name, NULL, rz_bin_section_t::paddr, rz_bin_section_t::perm, r, rz_bin_map_free(), rz_list_free(), rz_list_newf(), rz_list_push(), RZ_NEW0, rz_return_val_if_fail, sections(), rz_bin_section_t::size, strdup(), rz_bin_section_t::vaddr, and rz_bin_section_t::vsize.
Referenced by maps().
Definition at line 716 of file bin.c.
References bin_static_plugins, bin_xtr_static_plugins, free(), i, NULL, printf(), RZ_ARRAY_SIZE, rz_bin_file_free(), rz_bin_plugin_add(), rz_bin_plugin_free(), rz_bin_xtr_add(), rz_demangler_free(), rz_demangler_new(), rz_event_free(), rz_event_new(), rz_hash_new(), rz_id_storage_free(), rz_id_storage_new(), rz_list_free(), rz_list_new(), rz_list_newf(), RZ_NEW0, rz_str_constpool_fini(), rz_str_constpool_init(), sdb_new0(), ST32_MAX, and UT64_MAX.
Referenced by create(), download_pdb(), rz_core_init(), rz_diff_file_open(), and rzfind_open_file().
RZ_API RZ_BORROW RzBinMap* rz_bin_object_get_map_at | ( | RZ_NONNULL RzBinObject * | o, |
ut64 | off, | ||
bool | va | ||
) |
Find the last binary map at offset off
.
This function returns the last binary map that contains offset off
, because it assumes that maps are sorted by priority, thus the last one will be the most important one.
o | Reference to the RzBinObject instance |
off | Address to search |
va | When false the offset off is considered a physical address, otherwise a virtual address |
RzBinMap
containing the address Definition at line 643 of file bin.c.
References from, map(), NULL, off, rz_bin_object_addr_with_base(), rz_return_val_if_fail, to, and ut64().
Referenced by rz_bin_file_at(), rz_bin_object_p2v(), and rz_bin_object_v2p().
Find all binary maps at offset off
.
o | Reference to the RzBinObject instance |
off | Address to search |
va | When false the offset off is considered a physical address, otherwise a virtual address |
RzBinMap
pointers Definition at line 668 of file bin.c.
References from, map(), rz_bin_object_t::maps, NULL, off, rz_bin_object_addr_with_base(), rz_pvector_new(), rz_pvector_push(), rz_return_val_if_fail, to, and ut64().
Referenced by rz_bin_object_p2v_all().
Definition at line 200 of file bin.c.
References rz_io_bind_t::desc_get, rz_io_bind_t::fd_open, rz_io_bind_t::io, NULL, rz_bin_open_io(), RZ_LOG_ERROR, RZ_PERM_R, and rz_return_val_if_fail.
Referenced by core_file_do_load_for_debug(), download_pdb(), get_va_symbol(), rz_core_bin_load_structs(), rz_debug_dmp_frames(), rz_main_rz_bin(), and rzfind_open_file().
Definition at line 238 of file bin.c.
References rz_bin_xtr_plugin_t::check_buffer, rz_bin_xtr_plugin_t::extract_from_buffer, rz_bin_xtr_plugin_t::extract_from_bytes, rz_bin_xtr_plugin_t::extractall_from_buffer, rz_bin_xtr_plugin_t::extractall_from_bytes, bin::fd, rz_bin_file_t::id, rz_bin_xtr_plugin_t::name, NULL, rz_bin_file_new_from_buffer(), rz_bin_file_set_cur_binfile(), rz_bin_file_xtr_load_buffer(), rz_id_storage_set(), RZ_LOG_ERROR, rz_return_val_if_fail, and UT64_MAX.
Referenced by rz_bin_open_io(), and rz_bin_reload().
Definition at line 283 of file bin.c.
References bin::fd, rz_io_bind_t::fd_get_name, rz_io_bind_t::fd_is_dbg, create_tags_rz::fname, rz_io_bind_t::io, NULL, O_RDONLY, rz_bin_open_buf(), rz_buf_free(), rz_buf_new_file(), rz_buf_new_slice(), rz_buf_new_with_io_fd(), rz_buf_size(), rz_return_val_if_fail, st64, and UT64_MAX.
Referenced by cmd_search_bin(), core_file_do_load_for_io_plugin(), get_bin_info(), GetHeapGlobalsOffset(), map_multi_dex(), rz_bin_open(), rz_diff_file_open(), rz_main_rizin(), rz_open_binary_add_handler(), and rz_open_binary_file_handler().
RZ_API void rz_bin_options_init | ( | RzBinOptions * | opt, |
int | fd, | ||
ut64 | baseaddr, | ||
ut64 | loadaddr, | ||
bool | patch_relocs | ||
) |
Definition at line 75 of file bin.c.
References baseaddr, fd, memset(), and patch_relocs().
Referenced by core_file_do_load_for_debug(), get_va_symbol(), rz_bin_reload(), rz_core_bin_options_init(), rz_diff_file_open(), rz_main_rz_bin(), and rzfind_open_file().
RZ_API bool rz_bin_plugin_add | ( | RzBin * | bin, |
RzBinPlugin * | foo | ||
) |
Definition at line 404 of file bin.c.
References foo, memcpy(), rz_bin_plugin_t::name, rz_main_t::name, rz_list_append(), RZ_NEW0, and rz_return_val_if_fail.
Referenced by __lib_bin_cb(), and rz_bin_new().
|
static |
RZ_API const RzBinPlugin* rz_bin_plugin_get | ( | RZ_NONNULL RzBin * | bin, |
RZ_NONNULL const char * | name | ||
) |
Get a RzBinPlugin by name.
Definition at line 1197 of file bin.c.
References rz_bin_plugin_t::name, NULL, and rz_return_val_if_fail.
Referenced by rz_cmd_info_plugins_handler().
|
static |
Definition at line 461 of file bin.c.
References rz_bin_plugin_t::author, rz_bin_plugin_t::desc, rz_bin_plugin_t::license, rz_bin_plugin_t::name, pj_end(), pj_ks(), pj_o(), and rz_bin_plugin_t::version.
Referenced by rz_bin_list_plugin().
Definition at line 216 of file bin.c.
References baseaddr, rz_bin_file_load_options_t::big_endian, rz_bin_file_t::buf, rz_bin_file_load_options_t::elf_checks_sections, rz_bin_file_load_options_t::elf_checks_segments, rz_bin_file_load_options_t::elf_load_sections, rz_bin_file_t::fd, rz_bin_file_t::file, rz_bin_file_t::loadaddr, NULL, rz_bin_file_t::o, rz_bin_object_t::opts, patch_relocs(), rz_bin_file_load_options_t::patch_relocs, rz_bin_file_delete(), rz_bin_open_buf(), rz_bin_options_init(), rz_buf_seek(), RZ_BUF_SET, and rz_return_val_if_fail.
Referenced by core_bin_reload().
RZ_API void rz_bin_reloc_free | ( | RzBinReloc * | reloc | ) |
Definition at line 188 of file bin.c.
References free().
Referenced by rz_bin_le_get_relocs(), and rz_bin_reloc_storage_free().
RZ_API void rz_bin_resource_free | ( | RzBinResource * | res | ) |
Definition at line 147 of file bin.c.
References free(), rz_bin_resource_t::language, rz_bin_resource_t::name, RZ_FREE, rz_bin_resource_t::time, and rz_bin_resource_t::type.
Converts the RzBinSection flags to a list of string representations.
Some binary formats have a function interface called "section_flag_to_rzlist" The returned string flag names are different between formats
bin | RzBin instance |
flag | A flag field of the RzBinSection (differs between formats) |
Definition at line 1151 of file bin.c.
References a, NULL, rz_bin_cur(), rz_bin_file_cur_plugin(), and rz_bin_plugin_t::section_flag_to_rzlist.
Referenced by sections_print_json(), and sections_print_table().
RZ_API void rz_bin_section_free | ( | RzBinSection * | bs | ) |
Definition at line 1116 of file bin.c.
References rz_bin_section_t::format, free(), and rz_bin_section_t::name.
Referenced by get_segments(), load_buffer(), rz_bin_dex_sections(), rz_bin_le_get_sections(), rz_bin_mz_get_segments(), rz_bin_ne_get_segments(), rz_bin_sections_of_maps(), section_free(), and sections().
RZ_API RzBinSection* rz_bin_section_new | ( | const char * | name | ) |
Converts the RzBinSection type to the string representation.
Some binary formats have a function interface called "section_type_to_string" The returned string type name is different between formats
bin | RzBin instance |
type | A type field of the RzBinSection (differs between formats) |
Definition at line 1133 of file bin.c.
References a, NULL, rz_bin_cur(), rz_bin_file_cur_plugin(), rz_bin_plugin_t::section_type_to_string, and type.
Referenced by sections_print_json(), and sections_print_table().
Create a list of RzBinSection from RzBinMaps.
Some binary formats have a 1:1 correspondence of mapping and some of their RzBinSections, but also want to add some unmapped sections. In this case, they can implement their mapped sections in their maps callback, then in their sections callback use this function to create sections from them and add some additional ones. See also rz_bin_maps_of_file_sections() for the inverse, when no additional sections should be added.
Definition at line 1084 of file bin.c.
References map(), maps(), rz_bin_section_t::name, NULL, rz_bin_section_t::paddr, rz_bin_section_t::perm, rz_bin_section_free(), rz_list_append(), rz_list_newf(), RZ_NEW0, rz_return_val_if_fail, rz_bin_section_t::size, strdup(), rz_bin_section_t::vaddr, and rz_bin_section_t::vsize.
Referenced by sections().
Definition at line 813 of file bin.c.
References arch, bits(), rz_bin_file_t::file, name, NULL, rz_bin_cur(), rz_bin_file_find_by_arch_bits(), rz_bin_file_set_obj(), rz_bin_object_find_by_arch_bits(), and rz_return_val_if_fail.
Referenced by rz_main_rz_bin().
Definition at line 833 of file bin.c.
References NULL, rz_bin_file_find_by_id(), rz_bin_file_set_obj(), and rz_return_val_if_fail.
Referenced by rz_core_bin_raise(), and rz_core_seek().
RZ_API int rz_bin_select_object | ( | RzBinFile * | binfile, |
const char * | arch, | ||
int | bits, | ||
const char * | name | ||
) |
Definition at line 826 of file bin.c.
References arch, bits(), rz_bin_file_t::rbin, rz_bin_file_set_obj(), rz_bin_object_find_by_arch_bits(), and rz_return_val_if_fail.
Definition at line 549 of file bin.c.
References baddr(), rz_bin_plugin_t::baddr, rz_bin_object_t::baddr_shift, rz_bin_file_load_options_t::baseaddr, rz_bin_object_t::opts, rz_bin_object_t::plugin, rz_bin_cur(), rz_bin_cur_object(), rz_return_if_fail, ut64(), and UT64_MAX.
Referenced by rebase_helper(), rz_bin_object_new(), rz_cmd_debug_dmi(), and rz_main_rz_bin().
Definition at line 839 of file bin.c.
Referenced by rz_core_init().
RZ_API void rz_bin_string_free | ( | void * | _str | ) |
Definition at line 192 of file bin.c.
References free(), and cmd_descs_generate::str.
Referenced by add_new_bin_string(), create_string_search_thread(), rz_bin_dex_strings(), rz_bin_file_strings(), rz_bin_java_class_strings(), rz_bin_string_database_new(), and search_string_thread_runner().
RZ_API void rz_bin_symbol_free | ( | RzBinSymbol * | sym | ) |
Definition at line 175 of file bin.c.
References rz_bin_symbol_t::classname, rz_bin_symbol_t::dname, free(), rz_bin_symbol_t::libname, rz_bin_symbol_t::name, and rz_bin_symbol_t::visibility_str.
Referenced by add_new_func_symbol(), dex_resolve_fields_in_class_as_symbols(), dex_resolve_methods_in_class(), get_symbols_list(), le_get_symbol(), le_get_symbols_at(), load_buffer(), luac_build_info(), resolve_mig_subsystem(), resolve_syscalls(), rz_bin_dex_symbols(), rz_bin_java_class_const_pool_as_symbols(), rz_bin_java_class_fields_as_symbols(), rz_bin_java_class_methods_as_symbols(), rz_bin_le_get_symbols(), rz_bin_ne_get_symbols(), rz_bin_pe_get_clr_symbols(), symbols(), and walkSymbols().
RZ_API const char* rz_bin_symbol_name | ( | RzBinSymbol * | s | ) |
RZ_API RzBinSymbol* rz_bin_symbol_new | ( | const char * | name, |
ut64 | paddr, | ||
ut64 | vaddr | ||
) |
Definition at line 165 of file bin.c.
References rz_bin_symbol_t::name, NULL, rz_bin_symbol_t::paddr, RZ_NEW0, strdup(), and rz_bin_symbol_t::vaddr.
Referenced by add_new_func_symbol(), rz_bin_java_class_const_pool_as_symbols(), rz_bin_java_class_fields_as_symbols(), and rz_bin_java_class_methods_as_symbols().
RZ_API void rz_bin_trycatch_free | ( | RzBinTrycatch * | tc | ) |
RZ_API RzBinTrycatch* rz_bin_trycatch_new | ( | ut64 | source, |
ut64 | from, | ||
ut64 | to, | ||
ut64 | handler, | ||
ut64 | filter | ||
) |
Definition at line 1178 of file bin.c.
References rz_bin_trycatch_t::filter, filter(), rz_bin_trycatch_t::from, from, rz_bin_trycatch_t::handler, RZ_NEW0, rz_bin_trycatch_t::source, source, rz_bin_trycatch_t::to, and to.
Referenced by trycatch().
Definition at line 787 of file bin.c.
References arch, rz_bin_file_load_options_t::baseaddr, bits(), rz_bin_xtr_extract_t::loaded, rz_bin_file_t::o, rz_bin_file_find_by_arch_bits(), rz_bin_file_object_new_from_xtr_data(), rz_bin_file_set_obj(), rz_bin_get_laddr(), rz_bin_object_find_by_arch_bits(), rz_list_get_n(), RZ_LOG_WARN, rz_return_val_if_fail, UT64_MAX, and rz_bin_file_t::xtr_data.
Referenced by rz_core_bin_set_arch_bits().
RZ_API void rz_bin_virtual_file_free | ( | RzBinVirtualFile * | vfile | ) |
Definition at line 1012 of file bin.c.
References rz_bin_virtual_file_t::buf, rz_bin_virtual_file_t::buf_owned, free(), rz_bin_virtual_file_t::name, and rz_buf_free().
Referenced by get_virtual_files(), and virtual_files().
RZ_API bool rz_bin_xtr_add | ( | RzBin * | bin, |
RzBinXtrPlugin * | foo | ||
) |
Definition at line 421 of file bin.c.
References foo, rz_bin_xtr_plugin_t::name, rz_main_t::name, rz_list_append(), and rz_return_val_if_fail.
Referenced by __lib_bin_xtr_cb(), and rz_bin_new().
RZ_API void rz_bin_xtrdata_free | ( | void * | data_ | ) |
Definition at line 61 of file bin.c.
References rz_bin_xtr_metadata_t::arch, rz_bin_xtr_extract_t::buf, rz_bin_xtr_extract_t::file, free(), rz_bin_xtr_metadata_t::libname, rz_bin_xtr_metadata_t::machine, rz_bin_xtr_extract_t::metadata, rz_buf_free(), and rz_return_if_fail.
Referenced by oneshotall(), oneshotall_buffer(), and rz_bin_file_new().
RZ_API RzBinXtrData* rz_bin_xtrdata_new | ( | RzBuffer * | buf, |
ut64 | offset, | ||
ut64 | size, | ||
ut32 | file_count, | ||
RzBinXtrMetadata * | metadata | ||
) |
Definition at line 47 of file bin.c.
References rz_bin_xtr_extract_t::buf, rz_bin_xtr_extract_t::file_count, rz_bin_xtr_extract_t::loaded, rz_bin_xtr_extract_t::metadata, rz_bin_xtr_extract_t::offset, rz_buf_ref(), RZ_NEW0, and rz_bin_xtr_extract_t::size.
Referenced by extract(), oneshot(), and oneshot_buffer().
RZ_API const RzBinXtrPlugin* rz_bin_xtrplugin_get | ( | RZ_NONNULL RzBin * | bin, |
RZ_NONNULL const char * | name | ||
) |
Get a RzBinXtrPlugin by name.
Definition at line 1214 of file bin.c.
References rz_bin_xtr_plugin_t::name, NULL, and rz_return_val_if_fail.
Referenced by rz_cmd_info_plugins_handler().
RZ_LIB_VERSION | ( | rz_bin | ) |
|
static |
Definition at line 25 of file bin.c.
Referenced by rz_bin_new().
|
static |
Definition at line 26 of file bin.c.
Referenced by rz_bin_new().