GDB (xrefs)
|
#include "defs.h"
#include <fcntl.h>
#include "symtab.h"
#include "bfd.h"
#include "build-id.h"
#include "symfile.h"
#include "objfiles.h"
#include "gdbcore.h"
#include "command.h"
#include "target.h"
#include "frame.h"
#include "inferior.h"
#include "gdbsupport/environ.h"
#include "cli/cli-cmds.h"
#include "elf/external.h"
#include "elf/common.h"
#include "filenames.h"
#include "exec.h"
#include "solist.h"
#include "observable.h"
#include "readline/tilde.h"
#include "solib.h"
#include "interps.h"
#include "filesystem.h"
#include "gdb_bfd.h"
#include "gdbsupport/filestuff.h"
#include "gdbsupport/scoped_fd.h"
#include "debuginfod-support.h"
#include "source.h"
#include "cli/cli-style.h"
Go to the source code of this file.
Macros | |
#define | DOS_BASED_FILE_SYSTEM 0 |
Typedefs | |
typedef std::unordered_map< std::string, std::string > | soname_build_id_map |
Functions | |
static void | show_solib_search_path (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static gdb::unique_xmalloc_ptr< char > | solib_find_1 (const char *in_pathname, int *fd, bool is_solib) |
gdb::unique_xmalloc_ptr< char > | exec_file_find (const char *in_pathname, int *fd) |
gdb::unique_xmalloc_ptr< char > | solib_find (const char *in_pathname, int *fd) |
gdb_bfd_ref_ptr | solib_bfd_fopen (const char *pathname, int fd) |
gdb_bfd_ref_ptr | solib_bfd_open (const char *pathname) |
void | set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname, const bfd_build_id *build_id) |
gdb::unique_xmalloc_ptr< char > | get_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname) |
static int | solib_map_sections (struct so_list *so) |
static void | clear_so (struct so_list *so) |
void | free_so (struct so_list *so) |
bool | solib_read_symbols (struct so_list *so, symfile_add_flags flags) |
static bool | solib_used (const struct so_list *const known) |
static void | notify_solib_loaded (so_list *so) |
static void | notify_solib_unloaded (program_space *pspace, so_list *so) |
void | update_solib_list (int from_tty) |
bool | libpthread_name_p (const char *name) |
static bool | libpthread_solib_p (struct so_list *so) |
void | solib_add (const char *pattern, int from_tty, int readsyms) |
static void | info_sharedlibrary_command (const char *pattern, int from_tty) |
bool | solib_contains_address_p (const struct so_list *const solib, CORE_ADDR address) |
const char * | solib_name_from_address (struct program_space *pspace, CORE_ADDR address) |
bool | solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size) |
void | clear_solib (void) |
void | solib_create_inferior_hook (int from_tty) |
bool | in_solib_dynsym_resolve_code (CORE_ADDR pc) |
static void | sharedlibrary_command (const char *args, int from_tty) |
void | no_shared_libraries (const char *ignored, int from_tty) |
void | update_solib_breakpoints (void) |
void | handle_solib_event (void) |
static void | reload_shared_libraries_1 (int from_tty) |
static void | reload_shared_libraries (const char *ignored, int from_tty, struct cmd_list_element *e) |
static void | gdb_sysroot_changed (const char *ignored, int from_tty, struct cmd_list_element *e) |
static void | show_auto_solib_add (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
CORE_ADDR | gdb_bfd_lookup_symbol_from_symtab (bfd *abfd, gdb::function_view< bool(const asymbol *)> match_sym) |
int | gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, CORE_ADDR *ptr_addr) |
gdb::unique_xmalloc_ptr< char > | gdb_bfd_read_elf_soname (const char *filename) |
static CORE_ADDR | bfd_lookup_symbol_from_dyn_symtab (bfd *abfd, gdb::function_view< bool(const asymbol *)> match_sym) |
CORE_ADDR | gdb_bfd_lookup_symbol (bfd *abfd, gdb::function_view< bool(const asymbol *)> match_sym) |
static void | remove_user_added_objfile (struct objfile *objfile) |
void | _initialize_solib () |
Variables | |
bool | debug_solib |
static std::string | solib_search_path |
static const struct registry< bfd >::key< soname_build_id_map > | cbfd_soname_build_id_data_key |
#define DOS_BASED_FILE_SYSTEM 0 |
Definition at line 73 of file solib.c.
Referenced by solib_find_1().
typedef std::unordered_map<std::string, std::string> soname_build_id_map |
void _initialize_solib | ( | ) |
Definition at line 1750 of file solib.c.
Referenced by initialize_all_files().
|
static |
Definition at line 1683 of file solib.c.
Referenced by gdb_bfd_lookup_symbol().
|
static |
Definition at line 634 of file solib.c.
References so_list::abfd, so_list::addr_high, so_list::addr_low, target_so_ops::clear_so, gdb_bfd_unref(), gdbarch_so_ops(), so_list::objfile, so_list::sections, so_list::so_name, so_list::so_original_name, so_list::symbols_loaded, and target_gdbarch().
Referenced by free_so(), and reload_shared_libraries_1().
void clear_solib | ( | void | ) |
Definition at line 1227 of file solib.c.
References target_so_ops::clear_solib, current_program_space, disable_breakpoints_in_shlibs(), free_so(), gdbarch_so_ops(), so_list::next, notify_solib_unloaded(), program_space::remove_target_sections(), program_space::so_list, and target_gdbarch().
Referenced by core_target::clear_core(), and no_shared_libraries().
gdb::unique_xmalloc_ptr< char > exec_file_find | ( | const char * | in_pathname, |
int * | fd ) |
Definition at line 334 of file solib.c.
References effective_target_file_system_kind(), file_system_kind_dos_based, gdb_sysroot, IS_TARGET_ABSOLUTE_PATH, solib_find_1(), and source_full_path_of().
Referenced by core_target::build_file_mappings(), exec_file_locate_attach(), and follow_exec().
void free_so | ( | struct so_list * | so | ) |
Definition at line 671 of file solib.c.
References clear_so(), target_so_ops::free_so, gdbarch_so_ops(), target_gdbarch(), and xfree().
Referenced by clear_solib(), so_deleter::operator()(), rocm_free_solib_list(), svr4_current_sos(), svr4_free_library_list(), and update_solib_list().
CORE_ADDR gdb_bfd_lookup_symbol | ( | bfd * | abfd, |
gdb::function_view< bool(const asymbol *)> | match_sym ) |
Definition at line 1719 of file solib.c.
References bfd_lookup_symbol_from_dyn_symtab(), and gdb_bfd_lookup_symbol_from_symtab().
Referenced by enable_break(), enable_break(), and enable_break2().
CORE_ADDR gdb_bfd_lookup_symbol_from_symtab | ( | bfd * | abfd, |
gdb::function_view< bool(const asymbol *)> | match_sym ) |
Definition at line 1488 of file solib.c.
References gdbarch_elf_make_msymbol_special(), gdbarch_elf_make_msymbol_special_p(), general_symbol_info::set_value_address(), target_gdbarch(), and minimal_symbol::unrelocated_address().
Referenced by gdb_bfd_lookup_symbol().
gdb::unique_xmalloc_ptr< char > gdb_bfd_read_elf_soname | ( | const char * | filename | ) |
Definition at line 1643 of file solib.c.
References gdb_bfd_get_full_section_contents(), gdb_bfd_open(), gdb_bfd_scan_elf_dyntag(), and gnutarget.
Referenced by core_target::build_file_mappings().
int gdb_bfd_scan_elf_dyntag | ( | const int | desired_dyntag, |
bfd * | abfd, | ||
CORE_ADDR * | ptr, | ||
CORE_ADDR * | ptr_addr ) |
Definition at line 1541 of file solib.c.
References target_section::addr, builtin_type::builtin_data_ptr, builtin_type(), current_program_space, extract_typed_address(), target_gdbarch(), target_read_memory(), program_space::target_sections(), and target_section::the_bfd_section.
Referenced by elf_locate_base(), gdb_bfd_read_elf_soname(), lm_base(), and svr4_iterate_over_objfiles_in_search_order().
|
static |
Definition at line 1447 of file solib.c.
References gdb_sysroot, reload_shared_libraries(), and TARGET_SYSROOT_PREFIX.
gdb::unique_xmalloc_ptr< char > get_cbfd_soname_build_id | ( | gdb_bfd_ref_ptr | abfd, |
const char * | soname ) |
Definition at line 509 of file solib.c.
References cbfd_soname_build_id_data_key, and registry< T >::get().
Referenced by solib_map_sections().
void handle_solib_event | ( | void | ) |
Definition at line 1309 of file solib.c.
References auto_solib_add, program_space::clear_solib_cache(), current_inferior(), gdbarch_so_ops(), target_so_ops::handle_event, target_terminal::inferior(), target_terminal::ours_for_output(), inferior::pspace, solib_add(), and target_gdbarch().
Referenced by bpstat_stop_status(), handle_inferior_event(), and process_one_event().
bool in_solib_dynsym_resolve_code | ( | CORE_ADDR | pc | ) |
Definition at line 1262 of file solib.c.
References gdbarch_so_ops(), target_so_ops::in_dynsym_resolve_code, and target_gdbarch().
Referenced by process_event_stop_test().
|
static |
Definition at line 1075 of file solib.c.
References current_program_space, current_uiout, ui_out::field_core_addr(), ui_out::field_skip(), ui_out::field_string(), file_name_style, gdbarch_ptr_bit(), ui_out::is_mi_like_p(), ui_out::message(), objfile_has_symbols(), re_comp(), program_space::solibs(), cli_style_option::style(), ui_out::table_body(), ui_out::table_header(), target_gdbarch(), ui_out::text(), top_level_interpreter(), ui_left, ui_noalign, and update_solib_list().
bool libpthread_name_p | ( | const char * | name | ) |
Definition at line 966 of file solib.c.
References name.
Referenced by libpthread_objfile_p(), and libpthread_solib_p().
|
static |
Definition at line 975 of file solib.c.
References libpthread_name_p(), and so_list::so_name.
Referenced by reload_shared_libraries_1(), and solib_add().
void no_shared_libraries | ( | const char * | ignored, |
int | from_tty ) |
Definition at line 1284 of file solib.c.
References clear_solib(), and objfile_purge_solibs().
Referenced by detach_command(), disconnect_command(), follow_exec(), remote_target::open_1(), symbol_file_clear(), target_pre_inferior(), and program_space::~program_space().
|
static |
Definition at line 757 of file solib.c.
References interps_notify_solib_loaded(), and gdb::observers::solib_loaded.
Referenced by update_solib_list().
|
static |
Definition at line 766 of file solib.c.
References interps_notify_solib_unloaded(), and gdb::observers::solib_unloaded.
Referenced by clear_solib(), and update_solib_list().
|
static |
Definition at line 1392 of file solib.c.
References auto_solib_add, breakpoint_re_set(), target_so_ops::clear_solib, gdbarch_so_ops(), reinit_frame_cache(), reload_shared_libraries_1(), remove_solib_event_breakpoints(), solib_add(), solib_create_inferior_hook(), target_gdbarch(), and target_has_execution().
Referenced by gdb_sysroot_changed().
|
static |
Definition at line 1330 of file solib.c.
References auto_solib_add, clear_so(), current_program_space, exception_fprintf(), gdb_printf(), gdb_stderr, libpthread_solib_p(), OBJF_USERLOADED, print_symbol_loading_p(), program_space::remove_target_sections(), solib_bfd_open(), solib_map_sections(), solib_read_symbols(), solib_used(), program_space::solibs(), SYMFILE_DEFER_BP_RESET, and SYMFILE_VERBOSE.
Referenced by reload_shared_libraries().
|
static |
Definition at line 1738 of file solib.c.
References objfile::flags, OBJF_USERLOADED, objfile::pspace, and program_space::solibs().
void set_cbfd_soname_build_id | ( | gdb_bfd_ref_ptr | abfd, |
const char * | soname, | ||
const bfd_build_id * | build_id ) |
Definition at line 490 of file solib.c.
References build_id_to_string(), cbfd_soname_build_id_data_key, and registry< T >::get().
Referenced by core_target::build_file_mappings().
|
static |
Definition at line 1272 of file solib.c.
References dont_repeat(), and solib_add().
|
static |
Definition at line 1474 of file solib.c.
References gdb_printf().
|
static |
Definition at line 61 of file solib.c.
References gdb_printf().
void solib_add | ( | const char * | pattern, |
int | from_tty, | ||
int | readsyms ) |
Definition at line 990 of file solib.c.
References breakpoint_re_set(), current_program_space, gdb_printf(), info_verbose, libpthread_solib_p(), print_symbol_loading_p(), re_comp(), reinit_frame_cache(), program_space::solib_add_generation, solib_read_symbols(), program_space::solibs(), SYMFILE_DEFER_BP_RESET, SYMFILE_VERBOSE, and update_solib_list().
Referenced by enable_break(), frv_fetch_objfile_link_map(), handle_solib_event(), post_create_inferior(), reload_shared_libraries(), rocm_solib_target_inferior_created(), sharedlibrary_command(), remote_target::start_remote_1(), and svr4_fetch_objfile_link_map().
gdb_bfd_ref_ptr solib_bfd_fopen | ( | const char * | pathname, |
int | fd ) |
Definition at line 423 of file solib.c.
References gdb_bfd_open(), and gnutarget.
Referenced by darwin_bfd_open(), solib_aix_bfd_open(), and solib_bfd_open().
gdb_bfd_ref_ptr solib_bfd_open | ( | const char * | pathname | ) |
Definition at line 440 of file solib.c.
References gdbarch_bfd_arch_info(), solib_bfd_fopen(), solib_find(), and target_gdbarch().
Referenced by enable_break(), enable_break(), enable_break2(), reload_shared_libraries_1(), and solib_aix_bfd_open().
bool solib_contains_address_p | ( | const struct so_list *const | solib, |
CORE_ADDR | address ) |
Definition at line 1175 of file solib.c.
References so_list::sections.
Referenced by disable_breakpoints_in_unloaded_shlib(), and solib_name_from_address().
void solib_create_inferior_hook | ( | int | from_tty | ) |
Definition at line 1252 of file solib.c.
References gdbarch_so_ops(), target_so_ops::solib_create_inferior_hook, and target_gdbarch().
Referenced by nto_procfs_target::create_inferior(), nto_procfs_target::post_attach(), post_create_inferior(), reload_shared_libraries(), and symbol_file_command().
gdb::unique_xmalloc_ptr< char > solib_find | ( | const char * | in_pathname, |
int * | fd ) |
Definition at line 384 of file solib.c.
References gdbarch_solib_symbols_extension(), solib_find_1(), and target_gdbarch().
Referenced by darwin_bfd_open(), solib_aix_bfd_open(), and solib_bfd_open().
|
static |
Definition at line 112 of file solib.c.
References current_inferior(), DOS_BASED_FILE_SYSTEM, effective_target_file_system_kind(), file_system_kind_dos_based, target_so_ops::find_and_open_solib, gdb_sysroot, gdbarch_so_ops(), HAS_TARGET_DRIVE_SPEC, IS_TARGET_ABSOLUTE_PATH, IS_TARGET_DIR_SEPARATOR, is_target_filename(), O_BINARY, openp(), OPF_RETURN_REALPATH, OPF_TRY_CWD_FIRST, solib_search_path, target_filesystem_is_local(), target_gdbarch(), target_lbasename(), and TARGET_SYSROOT_PREFIX.
Referenced by exec_file_find(), and solib_find().
bool solib_keep_data_in_core | ( | CORE_ADDR | vaddr, |
unsigned long | size ) |
Definition at line 1214 of file solib.c.
References gdbarch_so_ops(), target_so_ops::keep_data_in_core, size, and target_gdbarch().
Referenced by gcore_create_callback().
|
static |
Definition at line 540 of file solib.c.
References so_list::abfd, program_space::add_target_sections(), so_list::addr_high, so_list::addr_low, target_so_ops::bfd_open, build_id_to_string(), build_section_table(), program_space::cbfd, current_program_space, debuginfod_exec_query(), file_name_style, gdbarch_so_ops(), get_cbfd_soname_build_id(), target_so_ops::relocate_section_addresses, so_list::sections, so_list::so_name, SO_NAME_MAX_PATH_SIZE, cli_style_option::style(), styled_string(), and target_gdbarch().
Referenced by reload_shared_libraries_1(), and update_solib_list().
const char * solib_name_from_address | ( | struct program_space * | pspace, |
CORE_ADDR | address ) |
Definition at line 1200 of file solib.c.
References so_list::next, program_space::so_list, so_list::so_name, and solib_contains_address_p().
Referenced by disable_breakpoints_in_shlibs(), insert_bp_location(), pspy_solib_name(), and remove_breakpoint_1().
bool solib_read_symbols | ( | struct so_list * | so, |
symfile_add_flags | flags ) |
Definition at line 686 of file solib.c.
References so_list::abfd, objfile::addr_low, so_list::addr_low, build_section_addr_info_from_section_table(), current_inferior(), current_program_space, exception_fprintf(), flags, gdb_stderr, OBJF_SHARED, so_list::objfile, objfile_name(), program_space::objfiles(), so_list::sections, so_list::so_name, symbol_file_add_from_bfd(), so_list::symbols_loaded, and inferior::symfile_flags.
Referenced by bsd_uthread_solib_loaded(), reload_shared_libraries_1(), and solib_add().
|
static |
Definition at line 746 of file solib.c.
References current_program_space, so_list::objfile, and program_space::solibs().
Referenced by reload_shared_libraries_1(), and update_solib_list().
void update_solib_breakpoints | ( | void | ) |
Definition at line 1298 of file solib.c.
References gdbarch_so_ops(), target_gdbarch(), and target_so_ops::update_breakpoints.
Referenced by set_stop_on_solib_events().
void update_solib_list | ( | int | from_tty | ) |
Definition at line 775 of file solib.c.
References program_space::added_solibs, current_inferior(), current_program_space, target_so_ops::current_sos, program_space::deleted_solibs, exception_fprintf(), free_so(), gdb_stderr, gdbarch_so_ops(), inferior_ptid, so_list::next, notify_solib_loaded(), notify_solib_unloaded(), OBJF_USERLOADED, target_so_ops::open_symbol_file_object, program_space::remove_target_sections(), target_so_ops::same, program_space::so_list, so_list::so_original_name, solib_map_sections(), solib_used(), program_space::symfile_object_file, target_gdbarch(), and target_has_execution().
Referenced by info_sharedlibrary_command(), mi_cmd_file_list_shared_libraries(), and solib_add().
|
static |
Definition at line 485 of file solib.c.
Referenced by get_cbfd_soname_build_id(), and set_cbfd_soname_build_id().
|
static |
Definition at line 59 of file solib.c.
Referenced by solib_find_1().