GDB (xrefs)
Classes | Macros | Enumerations | Functions | Variables
/tmp/gdb-7.10/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  lm_info
 
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 struct lm_infolm_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)
 
static char * find_program_interpreter (void)
 
static int scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr)
 
static int scan_dyntag_auxv (const int desired_dyntag, CORE_ADDR *ptr)
 
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 (void *from_ttyp)
 
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 (struct probe *probe, 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, VEC(probe_p)**probes, struct objfile *objfile)
 
static void svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch, CORE_ADDR address)
 
static int cmp_name_and_sec_flags (asymbol *sym, void *data)
 
static int enable_break (struct svr4_info *info, int from_tty)
 
static void svr4_special_symbol_handling (void)
 
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 symbolelf_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
 
initialize_file_ftype _initialize_svr4_solib
 

Macro Definition Documentation

#define NUM_PROBES   ARRAY_SIZE (probe_info)

Enumeration Type Documentation

Enumerator
PROBES_INTERFACE_FAILED 
DO_NOTHING 
FULL_RELOAD 
UPDATE_OR_RELOAD 

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

Function Documentation

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

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

Referenced by enable_break().

static void disable_probes_interface_cleanup ( void *  arg)
static

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

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

Referenced by svr4_handle_solib_event().

static CORE_ADDR elf_locate_base ( void  )
static
static struct symbol* elf_lookup_lib_symbol ( struct objfile objfile,
const char *  name,
const domain_enum  domain 
)
static
static int enable_break ( struct svr4_info info,
int  from_tty 
)
static
static int equal_probe_and_action ( const void *  p1,
const void *  p2 
)
static

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

References probe_and_action::address.

Referenced by register_solib_event_probe().

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

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

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

Referenced by enable_break().

static void free_probes_table ( struct svr4_info info)
static
static void free_solib_list ( struct svr4_info info)
static
static struct svr4_info* get_svr4_info ( void  )
static
static int has_lm_dynamic_from_link_map ( void  )
static

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

References link_map_offsets::l_ld_offset, and svr4_fetch_link_map_offsets().

Referenced by lm_addr_check().

static hashval_t hash_probe_and_action ( const void *  p)
static

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

References probe_and_action::address.

Referenced by register_solib_event_probe().

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
static CORE_ADDR lm_addr_check ( const struct so_list so,
bfd *  abfd 
)
static
static struct lm_info* lm_info_read ( CORE_ADDR  lm_addr)
static
static CORE_ADDR locate_base ( struct svr4_info info)
static
static int match_main ( const char *  soname)
static

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

References main_name_list.

Referenced by svr4_read_so_list().

static int open_symbol_file_object ( void *  from_ttyp)
static
static gdb_byte* read_program_header ( int  type,
int p_sect_size,
int p_arch_size 
)
static
static gdb_byte* read_program_headers_from_bfd ( bfd *  abfd,
int phdrs_size 
)
static

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

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

Referenced by svr4_exec_displacement().

static void register_solib_event_probe ( struct probe probe,
CORE_ADDR  address,
enum probe_action  action 
)
static
static int scan_dyntag ( const int  desired_dyntag,
bfd *  abfd,
CORE_ADDR ptr 
)
static
static int scan_dyntag_auxv ( const int  desired_dyntag,
CORE_ADDR ptr 
)
static
void set_solib_svr4_fetch_link_map_offsets ( struct gdbarch gdbarch,
struct link_map_offsets *(*)(void)  flmo 
)
static enum probe_action solib_event_probe_action ( struct probe_and_action pa)
static
static struct probe_and_action* solib_event_probe_at ( struct svr4_info info,
CORE_ADDR  address 
)
static
static void* solib_svr4_init ( struct obstack *  obstack)
static

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

References solib_svr4_ops::fetch_link_map_offsets, and OBSTACK_ZALLOC.

Referenced by _initialize_svr4_solib().

static CORE_ADDR solib_svr4_r_brk ( struct svr4_info info)
static
static CORE_ADDR solib_svr4_r_ldsomap ( struct svr4_info info)
static
static CORE_ADDR solib_svr4_r_map ( struct svr4_info info)
static
static int solist_update_full ( struct svr4_info info)
static
static int solist_update_incremental ( struct svr4_info info,
CORE_ADDR  lm 
)
static
static void svr4_clear_so ( struct so_list so)
static

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

References lm_info::l_addr_p, and so_list::lm_info.

Referenced by _initialize_svr4_solib().

static void svr4_clear_solib ( void  )
static
static struct so_list* svr4_copy_library_list ( struct so_list src)
static

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

References so_list::lm_info, so_list::next, and xmalloc().

Referenced by svr4_current_sos_1().

static void svr4_create_probe_breakpoints ( struct gdbarch gdbarch,
VEC(probe_p)**  probes,
struct objfile objfile 
)
static
static void svr4_create_solib_event_breakpoints ( struct gdbarch gdbarch,
CORE_ADDR  address 
)
static
static struct so_list* svr4_current_sos ( void  )
static
static struct so_list* svr4_current_sos_1 ( void  )
static
static struct so_list* svr4_current_sos_direct ( struct svr4_info info)
static
static int svr4_current_sos_via_xfer_libraries ( struct svr4_library_list list,
const char *  annex 
)
static
static struct so_list* svr4_default_sos ( void  )
static
static int svr4_exec_displacement ( CORE_ADDR displacementp)
static
static struct link_map_offsets * svr4_fetch_link_map_offsets ( void  )
static
CORE_ADDR svr4_fetch_objfile_link_map ( struct objfile objfile)
static void svr4_free_library_list ( void *  p_list)
static

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

static void svr4_free_so ( struct so_list so)
static

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

References so_list::lm_info, and xfree().

Referenced by _initialize_svr4_solib().

static void svr4_handle_solib_event ( void  )
static
static int svr4_have_link_map_offsets ( void  )
static
struct link_map_offsets* svr4_ilp32_fetch_link_map_offsets ( void  )
int svr4_in_dynsym_resolve_code ( CORE_ADDR  pc)
static int svr4_keep_data_in_core ( CORE_ADDR  vaddr,
unsigned long  size 
)
static
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
struct link_map_offsets* svr4_lp64_fetch_link_map_offsets ( void  )
static int svr4_parse_libraries ( const char *  document,
struct svr4_library_list list 
)
static
static void svr4_pspace_data_cleanup ( struct program_space pspace,
void *  arg 
)
static

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

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

Referenced by _initialize_svr4_solib().

static int svr4_read_so_list ( CORE_ADDR  lm,
CORE_ADDR  prev_lm,
struct so_list ***  link_ptr_ptr,
int  ignore_first 
)
static
static void svr4_relocate_main_executable ( void  )
static
static void svr4_relocate_section_addresses ( struct so_list so,
struct target_section sec 
)
static
static int svr4_same ( struct so_list gdb,
struct so_list inferior 
)
static

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

References so_list::so_original_name, and svr4_same_1().

Referenced by _initialize_svr4_solib().

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

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

Referenced by enable_break(), and svr4_same().

static void svr4_solib_create_inferior_hook ( int  from_tty)
static
static void svr4_special_symbol_handling ( void  )
static

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

Referenced by _initialize_svr4_solib().

static CORE_ADDR svr4_truncate_ptr ( CORE_ADDR  addr)
static

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

References gdbarch_ptr_bit(), and target_gdbarch().

Referenced by svr4_relocate_section_addresses().

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

Variable Documentation

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

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

Referenced by enable_break().

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

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

Referenced by match_main().

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 145 of file solib-svr4.c.

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 83 of file solib-svr4.c.

Referenced by enable_break().

struct gdbarch_data* solib_svr4_data
static

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

const struct program_space_data* solib_svr4_pspace_data
static
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 1177 of file solib-svr4.c.

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 1196 of file solib-svr4.c.

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 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:1129
static const struct gdb_xml_attribute svr4_library_attributes[]
Definition: solib-svr4.c:1177

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

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:1196
static const struct gdb_xml_element svr4_library_list_children[]
Definition: solib-svr4.c:1186
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:1157

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

struct target_so_ops svr4_so_ops