GDB (xrefs)

Macros | Functions | Variables
/tmp/gdb-8.1/gdb/solib.c File Reference
`#include "defs.h"`
`#include <sys/types.h>`
`#include <fcntl.h>`
`#include "symtab.h"`
`#include "bfd.h"`
`#include "symfile.h"`
`#include "objfiles.h"`
`#include "gdbcore.h"`
`#include "command.h"`
`#include "target.h"`
`#include "frame.h"`
`#include "gdb_regex.h"`
`#include "inferior.h"`
`#include "environ.h"`
`#include "language.h"`
`#include "gdbcmd.h"`
`#include "completer.h"`
`#include "filenames.h"`
`#include "exec.h"`
`#include "solist.h"`
`#include "observer.h"`
`#include "readline/readline.h"`
`#include "remote.h"`
`#include "solib.h"`
`#include "interps.h"`
`#include "filesystem.h"`
`#include "gdb_bfd.h"`
`#include "filestuff.h"`

Go to the source code of this file.

## Macros
#define | DOS_BASED_FILE_SYSTEM 0

## Functions
static void * | solib_init (struct obstack *obstack)
static const struct target_so_ops * | solib_ops (struct gdbarch *gdbarch)
void | set_solib_ops (struct gdbarch *gdbarch, const struct target_so_ops *new_ops)
static void | show_solib_search_path (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static char * | solib_find_1 (const char *in_pathname, int *fd, int is_solib)
char * | exec_file_find (const char *in_pathname, int *fd)
char * | solib_find (const char *in_pathname, int *fd)
gdb_bfd_ref_ptr | solib_bfd_fopen (char *pathname, int fd)
gdb_bfd_ref_ptr | solib_bfd_open (char *pathname)
static int | solib_map_sections (struct so_list *so)
static void | clear_so (struct so_list *so)
void | free_so (struct so_list *so)
struct so_list * | master_so_list (void)
int | solib_read_symbols (struct so_list *so, symfile_add_flags flags)
static int | solib_used (const struct so_list *const known)
void | update_solib_list (int from_tty)
int | libpthread_name_p (const char *name)
static int | 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)
int | solib_contains_address_p (const struct so_list *const solib, CORE_ADDR address)
char * | solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
int | solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
void | clear_solib (void)
void | solib_create_inferior_hook (int from_tty)
int | 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)
struct block_symbol | solib_global_lookup (struct objfile *objfile, const char *name, const domain_enum domain)
CORE_ADDR | gdb_bfd_lookup_symbol_from_symtab (bfd *abfd, int(*match_sym)(const asymbol *, const void *), const void *data)
static CORE_ADDR | bfd_lookup_symbol_from_dyn_symtab (bfd *abfd, int(*match_sym)(const asymbol *, const void *), const void *data)
CORE_ADDR | gdb_bfd_lookup_symbol (bfd *abfd, int(*match_sym)(const asymbol *, const void *), const void *data)
static void | remove_user_added_objfile (struct objfile *objfile)
void | _initialize_solib (void)

## Variables
static struct gdbarch_data * | solib_data
struct target_so_ops * | current_target_so_ops
static char * | solib_search_path = NULL

## Macro Definition Documentation

## ◆ DOS_BASED_FILE_SYSTEM

#define DOS_BASED_FILE_SYSTEM 0

Definition at line 111 of file solib.c.

Referenced by solib_find_1().

## Function Documentation

## ◆ _initialize_solib()

void _initialize_solib | ( | void |  | ) |

Definition at line 1614 of file solib.c.

References _, add_alias_cmd(), add_com(), add_info(), add_info_alias(), add_setshow_boolean_cmd(), add_setshow_optional_filename_cmd(), auto_solib_add, class_files, class_support, gdb_sysroot, gdb_sysroot_changed(), gdbarch_data_register_pre_init(), info_sharedlibrary_command(), no_shared_libraries(), observer_attach_free_objfile(), reload_shared_libraries(), remove_user_added_objfile(), setlist, sharedlibrary_command(), show_auto_solib_add(), show_solib_search_path(), showlist, solib_data, solib_init(), and solib_search_path.

## ◆ bfd_lookup_symbol_from_dyn_symtab()

static CORE_ADDR bfd_lookup_symbol_from_dyn_symtab | ( | bfd * | abfd,
|  | int(*)(const asymbol *, const void *) | match_sym,
|  | const void * | data
| ) |  |
| static

Definition at line 1543 of file solib.c.

References do_cleanups(), make_cleanup(), xfree(), and xmalloc().

Referenced by gdb_bfd_lookup_symbol().

## ◆ clear_so()

static void clear_so | ( | struct so_list * | so | ) |
| static

Definition at line 613 of file solib.c.

References so_list::abfd, so_list::addr_high, so_list::addr_low, target_so_ops::clear_so, gdb_bfd_unref(), so_list::objfile, so_list::sections, so_list::sections_end, so_list::so_name, so_list::so_original_name, solib_ops(), so_list::symbols_loaded, target_gdbarch(), and xfree().

Referenced by free_so(), and reload_shared_libraries_1().

## ◆ clear_solib()

void clear_solib | ( | void |  | ) |

Definition at line 1203 of file solib.c.

References target_so_ops::clear_solib, disable_breakpoints_in_shlibs(), free_so(), so_list::next, observer_notify_solib_unloaded(), remove_target_sections(), so_list_head, solib_ops(), and target_gdbarch().

Referenced by core_close(), and no_shared_libraries().

## ◆ exec_file_find()

char* exec_file_find | ( | const char * | in_pathname,
|  | int * | fd
| ) |  |

Definition at line 382 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 exec_file_locate_attach(), and follow_exec().

## ◆ free_so()

void free_so | ( | struct so_list * | so | ) |

Definition at line 653 of file solib.c.

References clear_so(), target_so_ops::free_so, solib_ops(), target_gdbarch(), and xfree().

Referenced by clear_solib(), so_deleter::operator()(), svr4_current_sos(), svr4_free_library_list(), and update_solib_list().

## ◆ gdb_bfd_lookup_symbol()

CORE_ADDR gdb_bfd_lookup_symbol | ( | bfd * | abfd,
|  | int(*)(const asymbol *, const void *) | match_sym,
|  | const void * | data
| ) |  |

Definition at line 1582 of file solib.c.

References bfd_lookup_symbol_from_dyn_symtab(), and gdb_bfd_lookup_symbol_from_symtab().

Referenced by enable_break(), and enable_break2().

## ◆ gdb_bfd_lookup_symbol_from_symtab()

CORE_ADDR gdb_bfd_lookup_symbol_from_symtab | ( | bfd * | abfd,
|  | int(*)(const asymbol *, const void *) | match_sym,
|  | const void * | data
| ) |  |

Definition at line 1483 of file solib.c.

References do_cleanups(), gdbarch_elf_make_msymbol_special(), gdbarch_elf_make_msymbol_special_p(), make_cleanup(), memset(), MSYMBOL_VALUE_RAW_ADDRESS, SET_MSYMBOL_VALUE_ADDRESS, target_gdbarch(), xfree(), and xmalloc().

Referenced by gdb_bfd_lookup_symbol().

## ◆ gdb_sysroot_changed()

static void gdb_sysroot_changed | ( | const char * | ignored,
|  | int | from_tty,
|  | struct cmd_list_element * | e
| ) |  |
| static

Definition at line 1427 of file solib.c.

References _, gdb_assert, gdb_sysroot, reload_shared_libraries(), startswith(), TARGET_SYSROOT_PREFIX, and warning().

Referenced by _initialize_solib().

## ◆ handle_solib_event()

void handle_solib_event | ( | void |  | ) |

Definition at line 1286 of file solib.c.

References auto_solib_add, clear_program_space_solib_cache(), current_inferior(), target_so_ops::handle_event, target_terminal::inferior(), target_terminal::ours_for_output(), solib_add(), solib_ops(), and target_gdbarch().

Referenced by bpstat_stop_status(), and handle_inferior_event_1().

## ◆ in_solib_dynsym_resolve_code()

int in_solib_dynsym_resolve_code | ( | CORE_ADDR | pc | ) |

Definition at line 1239 of file solib.c.

References target_so_ops::in_dynsym_resolve_code, solib_ops(), and target_gdbarch().

Referenced by process_event_stop_test().

## ◆ info_sharedlibrary_command()

static void info_sharedlibrary_command | ( | const char * | pattern,
|  | int | from_tty
| ) |  |
| static

Definition at line 1048 of file solib.c.

References _, so_list::addr_high, so_list::addr_low, ALL_SO_LIBS, current_uiout, error(), ui_out::field_core_addr(), ui_out::field_skip(), ui_out::field_string(), gdbarch_ptr_bit(), interp_ui_out(), ui_out::is_mi_like_p(), ui_out::message(), so_list::next, so_list::objfile, objfile_has_symbols(), re_comp(), so_list_head, so_list::so_name, so_list::symbols_loaded, ui_out::table_body(), ui_out::table_header(), target_gdbarch(), ui_out::text(), top_level_interpreter(), ui_left, ui_noalign, and update_solib_list().

Referenced by _initialize_solib().

## ◆ libpthread_name_p()

int libpthread_name_p | ( | const char * | name | ) |

Definition at line 938 of file solib.c.

References name.

Referenced by has_libpthread(), libpthread_solib_p(), thread_db_new_objfile(), and try_thread_db_load_from_pdir().

## ◆ libpthread_solib_p()

static int libpthread_solib_p | ( | struct so_list * | so | ) |
| static

Definition at line 946 of file solib.c.

References libpthread_name_p(), and so_list::so_name.

Referenced by reload_shared_libraries_1(), and solib_add().

## ◆ master_so_list()

struct so_list* master_so_list | ( | void |  | ) |

Definition at line 666 of file solib.c.

References so_list_head.

Referenced by enable_break(), free_all_objfiles(), frv_fdpic_find_canonical_descriptor(), frv_fdpic_find_global_pointer(), frv_fetch_objfile_link_map(), and svr4_fetch_objfile_link_map().

## ◆ no_shared_libraries()

void no_shared_libraries | ( | const char * | ignored,
|  | int | from_tty
| ) |  |

Definition at line 1261 of file solib.c.

References clear_solib(), and objfile_purge_solibs().

Referenced by _initialize_solib(), detach_command(), disconnect_command(), follow_exec(), release_program_space(), remote_open_1(), symbol_file_clear(), and target_pre_inferior().

## ◆ reload_shared_libraries()

static void reload_shared_libraries | ( | const char * | ignored,
|  | int | from_tty,
|  | struct cmd_list_element * | e
| ) |  |
| static

Definition at line 1372 of file solib.c.

References auto_solib_add, breakpoint_re_set(), target_so_ops::clear_solib, reinit_frame_cache(), reload_shared_libraries_1(), remove_solib_event_breakpoints(), solib_add(), solib_create_inferior_hook(), solib_ops(), target_gdbarch(), and target_has_execution.

Referenced by _initialize_solib(), and gdb_sysroot_changed().

## ◆ reload_shared_libraries_1()

static void reload_shared_libraries_1 | ( | int | from_tty | ) |
| static

Definition at line 1307 of file solib.c.

References _, so_list::abfd, auto_solib_add, CATCH, clear_so(), END_CATCH, exception_fprintf(), objfile::flags, gdb_stderr, libpthread_solib_p(), so_list::next, OBJF_USERLOADED, so_list::objfile, print_symbol_loading_p(), printf_unfiltered(), remove_target_sections(), RETURN_MASK_ERROR, so_list_head, so_list::so_name, so_list::so_original_name, solib_bfd_open(), solib_map_sections(), solib_read_symbols(), solib_used(), so_list::symbols_loaded, SYMFILE_DEFER_BP_RESET, SYMFILE_VERBOSE, and TRY.

Referenced by reload_shared_libraries().

## ◆ remove_user_added_objfile()

static void remove_user_added_objfile | ( | struct objfile * | objfile | ) |
| static

Definition at line 1601 of file solib.c.

References objfile::flags, so_list::next, OBJF_USERLOADED, so_list::objfile, and so_list_head.

Referenced by _initialize_solib().

## ◆ set_solib_ops()

void set_solib_ops | ( | struct gdbarch * | gdbarch,
|  | const struct target_so_ops * | new_ops
| ) |  |

Definition at line 77 of file solib.c.

References solib_data.

Referenced by arm_symbian_init_abi(), dicos_init_abi(), frv_gdbarch_init(), i386_darwin_init_abi(), i386nto_init_abi(), mips_linux_init_abi(), ppc_linux_init_abi(), rs6000_aix_init_osabi(), set_solib_svr4_fetch_link_map_offsets(), set_spu_solib_ops(), tic6x_uclinux_init_abi(), windows_init_abi(), and x86_darwin_init_abi_64().

## ◆ sharedlibrary_command()

static void sharedlibrary_command | ( | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 1249 of file solib.c.

References dont_repeat(), and solib_add().

Referenced by _initialize_solib().

## ◆ show_auto_solib_add()

static void show_auto_solib_add | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 1454 of file solib.c.

References _, and fprintf_filtered().

Referenced by _initialize_solib().

## ◆ show_solib_search_path()

static void show_solib_search_path | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 99 of file solib.c.

References _, and fprintf_filtered().

Referenced by _initialize_solib().

## ◆ solib_add()

void solib_add | ( | const char * | pattern,
|  | int | from_tty,
|  | int | readsyms
| ) |  |

Definition at line 961 of file solib.c.

References _, breakpoint_re_set(), current_program_space, error(), info_verbose, libpthread_solib_p(), print_symbol_loading_p(), printf_unfiltered(), re_comp(), reinit_frame_cache(), so_list_head, program_space::solib_add_generation, solib_read_symbols(), 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(), remote_start_remote(), sharedlibrary_command(), and svr4_fetch_objfile_link_map().

## ◆ solib_bfd_fopen()

gdb_bfd_ref_ptr solib_bfd_fopen | ( | char * | pathname,
|  | int | fd
| ) |  |

Definition at line 474 of file solib.c.

References _, error(), gdb_bfd_has_target_filename(), gdb_bfd_open(), gdb::ref_ptr< T, Policy >::get(), gnutarget, make_cleanup(), and xfree().

Referenced by darwin_bfd_open(), solib_aix_bfd_open(), and solib_bfd_open().

## ◆ solib_bfd_open()

gdb_bfd_ref_ptr solib_bfd_open | ( | char * | pathname | ) |

Definition at line 496 of file solib.c.

References _, error(), gdbarch_bfd_arch_info(), gdb::ref_ptr< T, Policy >::get(), perror_with_name(), solib_bfd_fopen(), solib_find(), target_gdbarch(), and warning().

Referenced by _initialize_dsbt_solib(), _initialize_frv_solib(), _initialize_solib_target(), _initialize_svr4_solib(), enable_break(), enable_break2(), reload_shared_libraries_1(), and solib_aix_bfd_open().

## ◆ solib_contains_address_p()

int solib_contains_address_p | ( | const struct so_list *const | solib,
|  | CORE_ADDR | address
| ) |  |

Definition at line 1148 of file solib.c.

References target_section::addr, target_section::endaddr, and so_list::sections.

Referenced by disable_breakpoints_in_unloaded_shlib(), and solib_name_from_address().

## ◆ solib_create_inferior_hook()

void solib_create_inferior_hook | ( | int | from_tty | ) |

Definition at line 1228 of file solib.c.

References target_so_ops::solib_create_inferior_hook, solib_ops(), and target_gdbarch().

Referenced by follow_exec(), follow_fork_inferior(), post_create_inferior(), procfs_create_inferior(), procfs_post_attach(), and reload_shared_libraries().

## ◆ solib_find()

char* solib_find | ( | const char * | in_pathname,
|  | int * | fd
| ) |  |

Definition at line 433 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().

## ◆ solib_find_1()

static char* solib_find_1 | ( | const char * | in_pathname,
|  | int * | fd,
|  | int | is_solib
| ) |  |
| static

Definition at line 152 of file solib.c.

References current_inferior(), do_cleanups(), DOS_BASED_FILE_SYSTEM, effective_target_file_system_kind(), file_system_kind_dos_based, target_so_ops::find_and_open_solib, gdb_open_cloexec(), gdb_sysroot, HAS_TARGET_DRIVE_SPEC, IS_TARGET_ABSOLUTE_PATH, IS_TARGET_DIR_SEPARATOR, is_target_filename(), make_cleanup(), null_cleanup(), O_BINARY, openp(), OPF_RETURN_REALPATH, OPF_TRY_CWD_FIRST, savestring(), SLASH_STRING, solib_ops(), solib_search_path, target_filesystem_is_local, target_gdbarch(), target_lbasename(), TARGET_SYSROOT_PREFIX, and xfree().

Referenced by exec_file_find(), and solib_find().

## ◆ solib_global_lookup()

struct block_symbol solib_global_lookup | ( | struct objfile * | objfile,
|  | const char * | name,
|  | const domain_enum | domain
| ) |  |

Definition at line 1466 of file solib.c.

References target_so_ops::lookup_lib_global_symbol, name, solib_ops(), and target_gdbarch().

Referenced by lookup_global_symbol().

## ◆ solib_init()

static void* solib_init | ( | struct obstack * | obstack | ) |
| static

Definition at line 56 of file solib.c.

References current_target_so_ops, and OBSTACK_ZALLOC.

Referenced by _initialize_solib().

## ◆ solib_keep_data_in_core()

int solib_keep_data_in_core | ( | CORE_ADDR | vaddr,
|  | unsigned long | size
| ) |  |

Definition at line 1190 of file solib.c.

References target_so_ops::keep_data_in_core, size, solib_ops(), and target_gdbarch().

Referenced by gcore_create_callback().

## ◆ solib_map_sections()

static int solib_map_sections | ( | struct so_list * | so | ) |
| static

Definition at line 546 of file solib.c.

References _, so_list::abfd, add_target_sections(), target_section::addr, so_list::addr_high, so_list::addr_low, target_so_ops::bfd_open, build_section_table(), target_section::endaddr, error(), gdb::ref_ptr< T, Policy >::release(), target_so_ops::relocate_section_addresses, so_list::sections, so_list::sections_end, so_list::so_name, SO_NAME_MAX_PATH_SIZE, solib_ops(), target_gdbarch(), and target_section::the_bfd_section.

Referenced by reload_shared_libraries_1(), and update_solib_list().

## ◆ solib_name_from_address()

char* solib_name_from_address | ( | struct program_space * | pspace,
|  | CORE_ADDR | address
| ) |  |

Definition at line 1172 of file solib.c.

References so_list::next, so_list::pspace, program_space::so_list, so_list::so_name, and solib_contains_address_p().

Referenced by disable_breakpoints_in_shlibs(), gdbpy_solib_name(), insert_bp_location(), print_frame(), and remove_breakpoint_1().

## ◆ solib_ops()

static const struct target_so_ops* solib_ops | ( | struct gdbarch * | gdbarch | ) |
| static

Definition at line 66 of file solib.c.

References solib_data.

Referenced by clear_so(), clear_solib(), free_so(), handle_solib_event(), in_solib_dynsym_resolve_code(), reload_shared_libraries(), solib_create_inferior_hook(), solib_find_1(), solib_global_lookup(), solib_keep_data_in_core(), solib_map_sections(), update_solib_breakpoints(), and update_solib_list().

## ◆ solib_read_symbols()

int solib_read_symbols | ( | struct so_list * | so,
|  | symfile_add_flags | flags
| ) |  |

Definition at line 676 of file solib.c.

References _, so_list::abfd, so_list::addr_low, objfile::addr_low, ALL_OBJFILES, build_section_addr_info_from_section_table(), CATCH, current_inferior(), END_CATCH, exception_fprintf(), flags, free_section_addr_info(), gdb_stderr, OBJF_SHARED, so_list::objfile, objfile_name(), RETURN_MASK_ERROR, so_list::sections, so_list::sections_end, so_list::so_name, symbol_file_add_from_bfd(), so_list::symbols_loaded, inferior::symfile_flags, and TRY.

Referenced by bsd_uthread_solib_loaded(), ppc_linux_spe_context_solib_loaded(), reload_shared_libraries_1(), solib_add(), and spu_solib_loaded().

## ◆ solib_used()

static int solib_used | ( | const struct so_list *const | known | ) |
| static

Definition at line 734 of file solib.c.

References so_list::next, so_list::objfile, and so_list_head.

Referenced by reload_shared_libraries_1(), and update_solib_list().

## ◆ update_solib_breakpoints()

void update_solib_breakpoints | ( | void |  | ) |

Definition at line 1275 of file solib.c.

References solib_ops(), target_gdbarch(), and target_so_ops::update_breakpoints.

Referenced by set_stop_on_solib_events().

## ◆ update_solib_list()

void update_solib_list | ( | int | from_tty | ) |

Definition at line 747 of file solib.c.

References _, CATCH, current_inferior(), current_program_space, target_so_ops::current_sos, END_CATCH, exception_fprintf(), free_so(), gdb_stderr, inferior_ptid, so_list::next, null_ptid, OBJF_USERLOADED, observer_notify_solib_loaded(), observer_notify_solib_unloaded(), target_so_ops::open_symbol_file_object, so_list::pspace, ptid_equal(), remove_target_sections(), RETURN_MASK_ALL, RETURN_MASK_ERROR, target_so_ops::same, so_list_head, so_list::so_original_name, solib_map_sections(), solib_ops(), solib_used(), symfile_objfile, target_gdbarch(), target_has_execution, TRY, VEC_safe_push, and warning().

Referenced by info_sharedlibrary_command(), mi_cmd_file_list_shared_libraries(), and solib_add().

## Variable Documentation

## ◆ current_target_so_ops

struct target_so_ops* current_target_so_ops

Definition at line 90 of file solib.c.

Referenced by _initialize_solib_target(), and solib_init().

## ◆ solib_data

struct gdbarch_data* solib_data
| static

Definition at line 53 of file solib.c.

Referenced by _initialize_solib(), set_solib_ops(), and solib_ops().

## ◆ solib_search_path

char* solib_search_path = NULL
| static

Definition at line 97 of file solib.c.

Referenced by _initialize_solib(), and solib_find_1().