GDB (xrefs)
Loading...
Searching...
No Matches
Macros | Typedefs | Functions | Variables
solib.c File Reference
#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_mapcbfd_soname_build_id_data_key
 

Macro Definition Documentation

◆ DOS_BASED_FILE_SYSTEM

#define DOS_BASED_FILE_SYSTEM   0

Definition at line 73 of file solib.c.

Referenced by solib_find_1().

Typedef Documentation

◆ soname_build_id_map

typedef std::unordered_map<std::string, std::string> soname_build_id_map

Definition at line 480 of file solib.c.

Function Documentation

◆ _initialize_solib()

void _initialize_solib ( )

Definition at line 1750 of file solib.c.

Referenced by initialize_all_files().

◆ bfd_lookup_symbol_from_dyn_symtab()

static CORE_ADDR bfd_lookup_symbol_from_dyn_symtab ( bfd * abfd,
gdb::function_view< bool(const asymbol *)> match_sym )
static

Definition at line 1683 of file solib.c.

Referenced by gdb_bfd_lookup_symbol().

◆ clear_so()

static void clear_so ( struct so_list * so)
static

◆ clear_solib()

void clear_solib ( void )

◆ exec_file_find()

gdb::unique_xmalloc_ptr< char > exec_file_find ( const char * in_pathname,
int * fd )

◆ free_so()

void free_so ( struct so_list * so)

◆ gdb_bfd_lookup_symbol()

CORE_ADDR gdb_bfd_lookup_symbol ( bfd * abfd,
gdb::function_view< bool(const asymbol *)> match_sym )

◆ gdb_bfd_lookup_symbol_from_symtab()

CORE_ADDR gdb_bfd_lookup_symbol_from_symtab ( bfd * abfd,
gdb::function_view< bool(const asymbol *)> match_sym )

◆ gdb_bfd_read_elf_soname()

gdb::unique_xmalloc_ptr< char > gdb_bfd_read_elf_soname ( const char * filename)

◆ gdb_bfd_scan_elf_dyntag()

int gdb_bfd_scan_elf_dyntag ( const int desired_dyntag,
bfd * abfd,
CORE_ADDR * ptr,
CORE_ADDR * ptr_addr )

◆ gdb_sysroot_changed()

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

Definition at line 1447 of file solib.c.

References gdb_sysroot, reload_shared_libraries(), and TARGET_SYSROOT_PREFIX.

◆ get_cbfd_soname_build_id()

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().

◆ handle_solib_event()

void handle_solib_event ( void )

◆ in_solib_dynsym_resolve_code()

bool in_solib_dynsym_resolve_code ( CORE_ADDR pc)

◆ info_sharedlibrary_command()

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

◆ libpthread_name_p()

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().

◆ libpthread_solib_p()

static bool libpthread_solib_p ( struct so_list * so)
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().

◆ no_shared_libraries()

void no_shared_libraries ( const char * ignored,
int from_tty )

◆ notify_solib_loaded()

static void notify_solib_loaded ( so_list * so)
static

Definition at line 757 of file solib.c.

References interps_notify_solib_loaded(), and gdb::observers::solib_loaded.

Referenced by update_solib_list().

◆ notify_solib_unloaded()

static void notify_solib_unloaded ( program_space * pspace,
so_list * so )
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().

◆ reload_shared_libraries()

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

◆ reload_shared_libraries_1()

static void reload_shared_libraries_1 ( int from_tty)
static

◆ remove_user_added_objfile()

static void remove_user_added_objfile ( struct objfile * objfile)
static

Definition at line 1738 of file solib.c.

References objfile::flags, OBJF_USERLOADED, objfile::pspace, and program_space::solibs().

◆ set_cbfd_soname_build_id()

void set_cbfd_soname_build_id ( gdb_bfd_ref_ptr abfd,
const char * soname,
const bfd_build_id * build_id )

◆ sharedlibrary_command()

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

Definition at line 1272 of file solib.c.

References dont_repeat(), and solib_add().

◆ 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 1474 of file solib.c.

References gdb_printf().

◆ 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 61 of file solib.c.

References gdb_printf().

◆ solib_add()

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

◆ solib_bfd_fopen()

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().

◆ solib_bfd_open()

gdb_bfd_ref_ptr solib_bfd_open ( const char * pathname)

◆ solib_contains_address_p()

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().

◆ solib_create_inferior_hook()

void solib_create_inferior_hook ( int from_tty)

◆ solib_find()

gdb::unique_xmalloc_ptr< char > solib_find ( const char * in_pathname,
int * fd )

◆ solib_find_1()

static gdb::unique_xmalloc_ptr< char > solib_find_1 ( const char * in_pathname,
int * fd,
bool is_solib )
static

◆ solib_keep_data_in_core()

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().

◆ solib_map_sections()

static int solib_map_sections ( struct so_list * so)
static

◆ solib_name_from_address()

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

◆ solib_read_symbols()

bool solib_read_symbols ( struct so_list * so,
symfile_add_flags flags )

◆ solib_used()

static bool solib_used ( const struct so_list *const known)
static

◆ update_solib_breakpoints()

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().

◆ update_solib_list()

void update_solib_list ( int from_tty)

Variable Documentation

◆ cbfd_soname_build_id_data_key

const struct registry< bfd >::key<soname_build_id_map> cbfd_soname_build_id_data_key
static

Definition at line 485 of file solib.c.

Referenced by get_cbfd_soname_build_id(), and set_cbfd_soname_build_id().

◆ debug_solib

bool debug_solib

Definition at line 54 of file solib.c.

◆ solib_search_path

std::string solib_search_path
static

Definition at line 59 of file solib.c.

Referenced by solib_find_1().