GDB (xrefs)
Classes | Macros | Enumerations | Functions | Variables
/tmp/gdb-8.1/gdb/solib-svr4.c File Reference
#include "defs.h"
#include "elf/external.h"
#include "elf/common.h"
#include "elf/mips.h"
#include "symtab.h"
#include "bfd.h"
#include "symfile.h"
#include "objfiles.h"
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
#include "infrun.h"
#include "regcache.h"
#include "gdbthread.h"
#include "observer.h"
#include "solist.h"
#include "solib.h"
#include "solib-svr4.h"
#include "bfd-target.h"
#include "elf-bfd.h"
#include "exec.h"
#include "auxv.h"
#include "gdb_bfd.h"
#include "probe.h"
#include "xml-support.h"

Go to the source code of this file.

Classes

struct  probe_info
 
struct  svr4_info
 
struct  svr4_library_list
 
struct  probe_and_action
 
struct  solib_svr4_ops
 

Macros

#define NUM_PROBES   ARRAY_SIZE (probe_info)
 

Enumerations

enum  probe_action { PROBES_INTERFACE_FAILED, DO_NOTHING, FULL_RELOAD, UPDATE_OR_RELOAD }
 

Functions

static struct link_map_offsetssvr4_fetch_link_map_offsets (void)
 
static int svr4_have_link_map_offsets (void)
 
static void svr4_relocate_main_executable (void)
 
static void svr4_free_library_list (void *p_list)
 
static int svr4_same_1 (const char *gdb_so_name, const char *inferior_so_name)
 
static int svr4_same (struct so_list *gdb, struct so_list *inferior)
 
static lm_info_svr4lm_info_read (CORE_ADDR lm_addr)
 
static int has_lm_dynamic_from_link_map (void)
 
static CORE_ADDR lm_addr_check (const struct so_list *so, bfd *abfd)
 
static void free_probes_table (struct svr4_info *info)
 
static void free_solib_list (struct svr4_info *info)
 
static void svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
 
static struct svr4_infoget_svr4_info (void)
 
static int match_main (const char *)
 
static gdb_byteread_program_header (int type, int *p_sect_size, int *p_arch_size, CORE_ADDR *base_addr)
 
static char * find_program_interpreter (void)
 
static int scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, CORE_ADDR *ptr_addr)
 
static int scan_dyntag_auxv (const int desired_dyntag, CORE_ADDR *ptr, CORE_ADDR *ptr_addr)
 
static CORE_ADDR elf_locate_base (void)
 
static CORE_ADDR locate_base (struct svr4_info *info)
 
static CORE_ADDR solib_svr4_r_map (struct svr4_info *info)
 
static CORE_ADDR solib_svr4_r_brk (struct svr4_info *info)
 
static CORE_ADDR solib_svr4_r_ldsomap (struct svr4_info *info)
 
static int svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
 
static int open_symbol_file_object (int from_tty)
 
static void svr4_free_so (struct so_list *so)
 
static void svr4_clear_so (struct so_list *so)
 
static struct so_listsvr4_copy_library_list (struct so_list *src)
 
static void library_list_start_library (struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
 
static void svr4_library_list_start_list (struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
 
static int svr4_parse_libraries (const char *document, struct svr4_library_list *list)
 
static int svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list, const char *annex)
 
static struct so_listsvr4_default_sos (void)
 
static int svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, struct so_list ***link_ptr_ptr, int ignore_first)
 
static struct so_listsvr4_current_sos_direct (struct svr4_info *info)
 
static struct so_listsvr4_current_sos_1 (void)
 
static struct so_listsvr4_current_sos (void)
 
CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile)
 
int svr4_in_dynsym_resolve_code (CORE_ADDR pc)
 
static CORE_ADDR exec_entry_point (struct bfd *abfd, struct target_ops *targ)
 
static hashval_t hash_probe_and_action (const void *p)
 
static int equal_probe_and_action (const void *p1, const void *p2)
 
static void register_solib_event_probe (probe *prob, CORE_ADDR address, enum probe_action action)
 
static struct probe_and_actionsolib_event_probe_at (struct svr4_info *info, CORE_ADDR address)
 
static enum probe_action solib_event_probe_action (struct probe_and_action *pa)
 
static int solist_update_full (struct svr4_info *info)
 
static int solist_update_incremental (struct svr4_info *info, CORE_ADDR lm)
 
static void disable_probes_interface_cleanup (void *arg)
 
static void svr4_handle_solib_event (void)
 
static int svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg)
 
static void svr4_update_solib_event_breakpoints (void)
 
static void svr4_create_probe_breakpoints (struct gdbarch *gdbarch, const std::vector< probe *> *probes, struct objfile *objfile)
 
static void svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch, CORE_ADDR address)
 
static int cmp_name_and_sec_flags (const asymbol *sym, const void *data)
 
static int enable_break (struct svr4_info *info, int from_tty)
 
static gdb_byteread_program_headers_from_bfd (bfd *abfd, int *phdrs_size)
 
static int svr4_exec_displacement (CORE_ADDR *displacementp)
 
static void svr4_solib_create_inferior_hook (int from_tty)
 
static void svr4_clear_solib (void)
 
static CORE_ADDR svr4_truncate_ptr (CORE_ADDR addr)
 
static void svr4_relocate_section_addresses (struct so_list *so, struct target_section *sec)
 
static void * solib_svr4_init (struct obstack *obstack)
 
void set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
 
struct link_map_offsetssvr4_ilp32_fetch_link_map_offsets (void)
 
struct link_map_offsetssvr4_lp64_fetch_link_map_offsets (void)
 
static struct block_symbol elf_lookup_lib_symbol (struct objfile *objfile, const char *name, const domain_enum domain)
 
void _initialize_svr4_solib (void)
 

Variables

static const char *const solib_break_names []
 
static const char *const bkpt_names []
 
static const char *const main_name_list []
 
static const struct probe_info probe_info []
 
static const struct program_space_data * solib_svr4_pspace_data
 
static const struct gdb_xml_attribute svr4_library_attributes []
 
static const struct gdb_xml_element svr4_library_list_children []
 
static const struct gdb_xml_attribute svr4_library_list_attributes []
 
static const struct gdb_xml_element svr4_library_list_elements []
 
static struct gdbarch_datasolib_svr4_data
 
struct target_so_ops svr4_so_ops
 

Macro Definition Documentation

◆ NUM_PROBES

#define NUM_PROBES   ARRAY_SIZE (probe_info)

Enumeration Type Documentation

◆ probe_action

Enumerator
PROBES_INTERFACE_FAILED 
DO_NOTHING 
FULL_RELOAD 
UPDATE_OR_RELOAD 

Definition at line 90 of file solib-svr4.c.

Function Documentation

◆ _initialize_svr4_solib()

void _initialize_svr4_solib ( void  )

◆ cmp_name_and_sec_flags()

static int cmp_name_and_sec_flags ( const asymbol *  sym,
const void *  data 
)
static

Definition at line 2186 of file solib-svr4.c.

Referenced by enable_break().

◆ disable_probes_interface_cleanup()

static void disable_probes_interface_cleanup ( void *  arg)
static

Definition at line 1870 of file solib-svr4.c.

References _, free_probes_table(), free_solib_list(), get_svr4_info(), and warning().

Referenced by svr4_handle_solib_event().

◆ elf_locate_base()

static CORE_ADDR elf_locate_base ( void  )
static

◆ elf_lookup_lib_symbol()

static struct block_symbol elf_lookup_lib_symbol ( struct objfile objfile,
const char *  name,
const domain_enum  domain 
)
static

◆ enable_break()

static int enable_break ( struct svr4_info info,
int  from_tty 
)
static

◆ equal_probe_and_action()

static int equal_probe_and_action ( const void *  p1,
const void *  p2 
)
static

Definition at line 1690 of file solib-svr4.c.

References probe_and_action::address.

Referenced by register_solib_event_probe().

◆ exec_entry_point()

static CORE_ADDR exec_entry_point ( struct bfd *  abfd,
struct target_ops targ 
)
static

◆ find_program_interpreter()

static char* find_program_interpreter ( void  )
static

Definition at line 572 of file solib-svr4.c.

References exec_bfd, read_program_header(), and xmalloc().

Referenced by enable_break().

◆ free_probes_table()

static void free_probes_table ( struct svr4_info info)
static

◆ free_solib_list()

static void free_solib_list ( struct svr4_info info)
static

◆ get_svr4_info()

static struct svr4_info* get_svr4_info ( void  )
static

◆ has_lm_dynamic_from_link_map()

static int has_lm_dynamic_from_link_map ( void  )
static

Definition at line 212 of file solib-svr4.c.

References link_map_offsets::l_ld_offset, and svr4_fetch_link_map_offsets().

Referenced by lm_addr_check().

◆ hash_probe_and_action()

static hashval_t hash_probe_and_action ( const void *  p)
static

Definition at line 1679 of file solib-svr4.c.

References probe_and_action::address.

Referenced by register_solib_event_probe().

◆ library_list_start_library()

static void library_list_start_library ( struct gdb_xml_parser parser,
const struct gdb_xml_element element,
void *  user_data,
VEC(gdb_xml_value_s) *  attributes 
)
static

◆ lm_addr_check()

static CORE_ADDR lm_addr_check ( const struct so_list so,
bfd *  abfd 
)
static

◆ lm_info_read()

static lm_info_svr4* lm_info_read ( CORE_ADDR  lm_addr)
static

◆ locate_base()

static CORE_ADDR locate_base ( struct svr4_info info)
static

◆ match_main()

static int match_main ( const char *  soname)
static

Definition at line 1611 of file solib-svr4.c.

References main_name_list.

Referenced by svr4_read_so_list().

◆ open_symbol_file_object()

static int open_symbol_file_object ( int  from_tty)
static

◆ read_program_header()

static gdb_byte* read_program_header ( int  type,
int *  p_sect_size,
int *  p_arch_size,
CORE_ADDR base_addr 
)
static

◆ read_program_headers_from_bfd()

static gdb_byte* read_program_headers_from_bfd ( bfd *  abfd,
int *  phdrs_size 
)
static

Definition at line 2522 of file solib-svr4.c.

References SEEK_SET, xfree(), and xmalloc().

Referenced by svr4_exec_displacement().

◆ register_solib_event_probe()

static void register_solib_event_probe ( probe prob,
CORE_ADDR  address,
enum probe_action  action 
)
static

◆ scan_dyntag()

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

◆ scan_dyntag_auxv()

static int scan_dyntag_auxv ( const int  desired_dyntag,
CORE_ADDR ptr,
CORE_ADDR ptr_addr 
)
static

◆ set_solib_svr4_fetch_link_map_offsets()

void set_solib_svr4_fetch_link_map_offsets ( struct gdbarch gdbarch,
struct link_map_offsets *(*)(void)  flmo 
)

◆ solib_event_probe_action()

static enum probe_action solib_event_probe_action ( struct probe_and_action pa)
static

◆ solib_event_probe_at()

static struct probe_and_action* solib_event_probe_at ( struct svr4_info info,
CORE_ADDR  address 
)
static

◆ solib_svr4_init()

static void* solib_svr4_init ( struct obstack *  obstack)
static

Definition at line 3124 of file solib-svr4.c.

References solib_svr4_ops::fetch_link_map_offsets, and OBSTACK_ZALLOC.

Referenced by _initialize_svr4_solib().

◆ solib_svr4_r_brk()

static CORE_ADDR solib_svr4_r_brk ( struct svr4_info info)
static

◆ solib_svr4_r_ldsomap()

static CORE_ADDR solib_svr4_r_ldsomap ( struct svr4_info info)
static

◆ solib_svr4_r_map()

static CORE_ADDR solib_svr4_r_map ( struct svr4_info info)
static

◆ solist_update_full()

static int solist_update_full ( struct svr4_info info)
static

◆ solist_update_incremental()

static int solist_update_incremental ( struct svr4_info info,
CORE_ADDR  lm 
)
static

◆ svr4_clear_so()

static void svr4_clear_so ( struct so_list so)
static

Definition at line 1085 of file solib-svr4.c.

References if(), lm_info_svr4::l_addr_p, and so_list::lm_info.

Referenced by _initialize_svr4_solib().

◆ svr4_clear_solib()

static void svr4_clear_solib ( void  )
static

◆ svr4_copy_library_list()

static struct so_list* svr4_copy_library_list ( struct so_list src)
static

Definition at line 1112 of file solib-svr4.c.

References so_list::lm_info, so_list::next, and XNEW.

Referenced by svr4_current_sos_1().

◆ svr4_create_probe_breakpoints()

static void svr4_create_probe_breakpoints ( struct gdbarch gdbarch,
const std::vector< probe *> *  probes,
struct objfile objfile 
)
static

◆ svr4_create_solib_event_breakpoints()

static void svr4_create_solib_event_breakpoints ( struct gdbarch gdbarch,
CORE_ADDR  address 
)
static

◆ svr4_current_sos()

static struct so_list* svr4_current_sos ( void  )
static

◆ svr4_current_sos_1()

static struct so_list* svr4_current_sos_1 ( void  )
static

◆ svr4_current_sos_direct()

static struct so_list* svr4_current_sos_direct ( struct svr4_info info)
static

◆ svr4_current_sos_via_xfer_libraries()

static int svr4_current_sos_via_xfer_libraries ( struct svr4_library_list list,
const char *  annex 
)
static

◆ svr4_default_sos()

static struct so_list* svr4_default_sos ( void  )
static

◆ svr4_exec_displacement()

static int svr4_exec_displacement ( CORE_ADDR displacementp)
static

◆ svr4_fetch_link_map_offsets()

static struct link_map_offsets * svr4_fetch_link_map_offsets ( void  )
static

◆ svr4_fetch_objfile_link_map()

CORE_ADDR svr4_fetch_objfile_link_map ( struct objfile objfile)

◆ svr4_free_library_list()

static void svr4_free_library_list ( void *  p_list)
static

Definition at line 1096 of file solib-svr4.c.

References free_so(), and so_list::next.

Referenced by free_solib_list(), svr4_current_sos_direct(), and svr4_parse_libraries().

◆ svr4_free_so()

static void svr4_free_so ( struct so_list so)
static

Definition at line 1075 of file solib-svr4.c.

References so_list::lm_info.

Referenced by _initialize_svr4_solib().

◆ svr4_handle_solib_event()

static void svr4_handle_solib_event ( void  )
static

◆ svr4_have_link_map_offsets()

static int svr4_have_link_map_offsets ( void  )
static

◆ svr4_ilp32_fetch_link_map_offsets()

struct link_map_offsets* svr4_ilp32_fetch_link_map_offsets ( void  )

◆ svr4_in_dynsym_resolve_code()

int svr4_in_dynsym_resolve_code ( CORE_ADDR  pc)

◆ svr4_keep_data_in_core()

static int svr4_keep_data_in_core ( CORE_ADDR  vaddr,
unsigned long  size 
)
static

◆ svr4_library_list_start_list()

static void svr4_library_list_start_list ( struct gdb_xml_parser parser,
const struct gdb_xml_element element,
void *  user_data,
VEC(gdb_xml_value_s) *  attributes 
)
static

◆ svr4_lp64_fetch_link_map_offsets()

struct link_map_offsets* svr4_lp64_fetch_link_map_offsets ( void  )

◆ svr4_parse_libraries()

static int svr4_parse_libraries ( const char *  document,
struct svr4_library_list list 
)
static

◆ svr4_pspace_data_cleanup()

static void svr4_pspace_data_cleanup ( struct program_space pspace,
void *  arg 
)
static

Definition at line 387 of file solib-svr4.c.

References free_probes_table(), free_solib_list(), and xfree().

Referenced by _initialize_svr4_solib().

◆ svr4_read_so_list()

static int svr4_read_so_list ( CORE_ADDR  lm,
CORE_ADDR  prev_lm,
struct so_list ***  link_ptr_ptr,
int  ignore_first 
)
static

◆ svr4_relocate_main_executable()

static void svr4_relocate_main_executable ( void  )
static

◆ svr4_relocate_section_addresses()

static void svr4_relocate_section_addresses ( struct so_list so,
struct target_section sec 
)
static

◆ svr4_same()

static int svr4_same ( struct so_list gdb,
struct so_list inferior 
)
static

Definition at line 166 of file solib-svr4.c.

References svr4_same_1().

Referenced by _initialize_svr4_solib().

◆ svr4_same_1()

static int svr4_same_1 ( const char *  gdb_so_name,
const char *  inferior_so_name 
)
static

Definition at line 141 of file solib-svr4.c.

Referenced by enable_break(), and svr4_same().

◆ svr4_solib_create_inferior_hook()

static void svr4_solib_create_inferior_hook ( int  from_tty)
static

◆ svr4_truncate_ptr()

static CORE_ADDR svr4_truncate_ptr ( CORE_ADDR  addr)
static

Definition at line 3088 of file solib-svr4.c.

References gdbarch_ptr_bit(), and target_gdbarch().

Referenced by svr4_relocate_section_addresses().

◆ svr4_update_solib_event_breakpoint()

static int svr4_update_solib_event_breakpoint ( struct breakpoint b,
void *  arg 
)
static

◆ svr4_update_solib_event_breakpoints()

static void svr4_update_solib_event_breakpoints ( void  )
static

Variable Documentation

◆ bkpt_names

const char* const bkpt_names[]
static
Initial value:
=
{
"_start",
"__start",
"main",
NULL
}

Definition at line 74 of file solib-svr4.c.

Referenced by enable_break().

◆ main_name_list

const char* const main_name_list[]
static
Initial value:
=
{
"main_$main",
NULL
}

Definition at line 82 of file solib-svr4.c.

Referenced by match_main().

◆ probe_info

const struct probe_info probe_info[]
static
Initial value:
=
{
{ "init_start", DO_NOTHING },
{ "init_complete", FULL_RELOAD },
{ "map_start", DO_NOTHING },
{ "map_failed", DO_NOTHING },
{ "reloc_complete", UPDATE_OR_RELOAD },
{ "unmap_start", DO_NOTHING },
{ "unmap_complete", FULL_RELOAD },
}

Definition at line 124 of file solib-svr4.c.

◆ solib_break_names

const char* const solib_break_names[]
static
Initial value:
=
{
"r_debug_state",
"_r_debug_state",
"_dl_debug_state",
"rtld_db_dlactivity",
"__dl_rtld_db_dlactivity",
"_rtld_debug_state",
NULL
}

Definition at line 62 of file solib-svr4.c.

Referenced by enable_break().

◆ solib_svr4_data

struct gdbarch_data* solib_svr4_data
static

◆ solib_svr4_pspace_data

const struct program_space_data* solib_svr4_pspace_data
static

◆ svr4_library_attributes

const struct gdb_xml_attribute svr4_library_attributes[]
static
Initial value:
=
{
{ "name", GDB_XML_AF_NONE, NULL, NULL },
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
}
gdb_xml_attribute_handler gdb_xml_parse_attr_ulongest

Definition at line 1199 of file solib-svr4.c.

◆ svr4_library_list_attributes

const struct gdb_xml_attribute svr4_library_list_attributes[]
static
Initial value:
=
{
{ "version", GDB_XML_AF_NONE, NULL, NULL },
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
}
gdb_xml_attribute_handler gdb_xml_parse_attr_ulongest

Definition at line 1218 of file solib-svr4.c.

◆ svr4_library_list_children

const struct gdb_xml_element svr4_library_list_children[]
static
Initial value:
=
{
{
"library", svr4_library_attributes, NULL,
},
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
}
static const struct gdb_xml_attribute svr4_library_attributes[]
Definition: solib-svr4.c:1199
static void library_list_start_library(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
Definition: solib-svr4.c:1145

Definition at line 1208 of file solib-svr4.c.

◆ svr4_library_list_elements

const struct gdb_xml_element svr4_library_list_elements[]
static
Initial value:
=
{
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
}
static const struct gdb_xml_attribute svr4_library_list_attributes[]
Definition: solib-svr4.c:1218
static void svr4_library_list_start_list(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s) *attributes)
Definition: solib-svr4.c:1178
static const struct gdb_xml_element svr4_library_list_children[]
Definition: solib-svr4.c:1208

Definition at line 1225 of file solib-svr4.c.

Referenced by svr4_parse_libraries().

◆ svr4_so_ops

struct target_so_ops svr4_so_ops