55 #if !defined(HAVE_LIBEXPAT)
57 static VEC(lm_info_p) *
58 solib_target_parse_libraries (
const char *library)
60 static int have_warned;
65 warning (
_(
"Can not parse XML library list; XML support was disabled "
83 VEC(lm_info_p) **list = user_data;
88 if (last->section_bases != NULL)
90 _(
"Library list with both segments and sections"));
100 VEC(lm_info_p) **list = user_data;
105 if (last->segment_bases != NULL)
107 _(
"Library list with both segments and sections"));
119 VEC(lm_info_p) **list = user_data;
123 item->
name = xstrdup (name);
130 void *user_data,
const char *body_text)
132 VEC(lm_info_p) **list = user_data;
135 if (lm_info->segment_bases == NULL
136 && lm_info->section_bases == NULL)
138 _(
"No segment or section bases defined"));
154 const char *
string = version->
value;
156 if (strcmp (
string,
"1.0") != 0)
158 _(
"Library list has unsupported version \"%s\""),
168 VEC(lm_info_p) **result = p;
172 for (ix = 0;
VEC_iterate (lm_info_p, *result, ix, info); ix++)
230 solib_target_parse_libraries (
const char *library)
232 VEC(lm_info_p) *result = NULL;
237 library_list_elements, library, &result) == 0)
252 struct so_list *new_solib, *start = NULL, *last = NULL;
253 char *library_document;
255 VEC(lm_info_p) *library_list;
263 if (library_document == NULL)
270 library_list = solib_target_parse_libraries (library_document);
275 if (library_list == NULL)
279 for (ix = 0;
VEC_iterate (lm_info_p, library_list, ix, info); ix++)
281 new_solib = XCNEW (
struct so_list);
295 last = start = new_solib;
298 last->
next = new_solib;
344 if (so->
lm_info->offsets == NULL)
350 if (so->
lm_info->section_bases)
354 int num_section_bases
356 int num_alloc_sections = 0;
358 for (i = 0, sect = so->
abfd->sections;
360 i++, sect = sect->next)
361 if ((bfd_get_section_flags (so->
abfd, sect) & SEC_ALLOC))
362 num_alloc_sections++;
364 if (num_alloc_sections != num_section_bases)
366 Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
379 for (i = 0, sect = so->
abfd->sections;
381 i++, sect = sect->next)
383 if (!(bfd_get_section_flags (so->
abfd, sect) & SEC_ALLOC))
385 if (bfd_section_size (so->
abfd, sect) > 0)
389 low = section_bases[i];
390 high = low + bfd_section_size (so->
abfd, sect) - 1;
392 if (low < so->addr_low)
399 so->
lm_info->offsets->offsets[i]
400 = section_bases[bases_index];
408 else if (so->
lm_info->segment_bases)
415 Could not relocate shared library \"%s\": no segments"), so->
so_name);
429 num_bases, segment_bases))
431 Could not relocate shared library \"%s\": bad offsets"), so->
so_name);
static const struct gdb_xml_attribute library_list_attributes[]
static void solib_target_relocate_section_addresses(struct so_list *so, struct target_section *sec)
static const struct gdb_xml_attribute section_attributes[]
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)
int gdb_bfd_section_index(bfd *abfd, asection *section)
void warning(const char *fmt,...)
CORE_ADDR * segment_bases
initialize_file_ftype _initialize_solib_target
void(* relocate_section_addresses)(struct so_list *so, struct target_section *)
void(* solib_create_inferior_hook)(int from_tty)
struct so_list *(* current_sos)(void)
bfd *(* bfd_open)(char *pathname)
#define VEC_safe_push(T, V, O)
#define SO_NAME_MAX_PATH_SIZE
int(* open_symbol_file_object)(void *from_ttyp)
static const struct gdb_xml_element library_list_children[]
void(* clear_solib)(void)
struct target_so_ops solib_target_so_ops
#define SIZEOF_N_SECTION_OFFSETS(n)
#define VEC_iterate(T, V, I, P)
int(* in_dynsym_resolve_code)(CORE_ADDR pc)
static int solib_target_open_symbol_file_object(void *from_ttyp)
int gdb_xml_parse_quick(const char *name, const char *dtd_name, const struct gdb_xml_element *elements, const char *document, void *user_data)
struct target_ops current_target
void initialize_file_ftype(void)
static const struct gdb_xml_element library_children[]
struct symfile_segment_data * get_symfile_segment_data(bfd *abfd)
void * xzalloc(size_t size)
static void library_list_end_library(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, const char *body_text)
static void solib_target_special_symbol_handling(void)
char so_original_name[SO_NAME_MAX_PATH_SIZE]
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
char so_name[SO_NAME_MAX_PATH_SIZE]
char * target_read_stralloc(struct target_ops *ops, enum target_object object, const char *annex)
static void solib_target_free_library_list(void *p)
struct bfd_section * the_bfd_section
static void library_list_start_list(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s)*attributes)
void(* special_symbol_handling)(void)
void gdb_xml_error(struct gdb_xml_parser *parser, const char *format,...)
static const struct gdb_xml_attribute segment_attributes[]
static void solib_target_free_so(struct so_list *so)
static void solib_target_clear_solib(void)
struct gdb_xml_value * xml_find_attribute(VEC(gdb_xml_value_s)*attributes, const char *name)
void discard_cleanups(struct cleanup *old_chain)
static int in_plt_section(CORE_ADDR pc)
int gdb_bfd_count_sections(bfd *abfd)
void(* free_so)(struct so_list *so)
struct target_so_ops * current_target_so_ops
#define VEC_address(T, V)
static void library_list_start_section(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s)*attributes)
gdb_xml_attribute_handler gdb_xml_parse_attr_ulongest
unsigned long long ULONGEST
static void solib_target_solib_create_inferior_hook(int from_tty)
static const struct gdb_xml_attribute library_attributes[]
void free_symfile_segment_data(struct symfile_segment_data *data)
struct lm_info * lm_info_p
static void library_list_start_segment(struct gdb_xml_parser *parser, const struct gdb_xml_element *element, void *user_data, VEC(gdb_xml_value_s)*attributes)
CORE_ADDR * segment_sizes
int symfile_map_offsets_to_segments(bfd *abfd, const struct symfile_segment_data *data, struct section_offsets *offsets, int num_segment_bases, const CORE_ADDR *segment_bases)
static int solib_target_in_dynsym_resolve_code(CORE_ADDR pc)
bfd * solib_bfd_open(char *pathname)
static struct so_list * solib_target_current_sos(void)
void do_cleanups(struct cleanup *old_chain)