71 memcpy (result, info,
sizeof (
struct lm_info));
101 VEC (lm_info_p) *library_list;
115 data = inferior_data (inf, solib_aix_inferior_data_handle);
119 set_inferior_data (inf, solib_aix_inferior_data_handle, data);
125 #if !defined(HAVE_LIBEXPAT)
129 static VEC (lm_info_p) *
130 solib_aix_parse_libraries (
const char *library)
132 static int have_warned;
137 warning (
_(
"Can not parse XML library list; XML support was disabled "
163 VEC (lm_info_p) **list = user_data;
198 if (strcmp (version,
"1.0") != 0)
200 _(
"Library list has unsupported version \"%s\""),
209 VEC (lm_info_p) **result = p;
216 for (ix = 0;
VEC_iterate (lm_info_p, *result, ix, info); ix++)
263 solib_aix_parse_libraries (
const char *library)
265 VEC (lm_info_p) *result = NULL;
270 library_list_elements, library, &result) == 0)
293 static VEC (lm_info_p) *
294 solib_aix_get_library_list (
struct inferior *inf,
const char *warning_msg)
297 char *library_document;
298 struct cleanup *cleanup;
302 if (data->library_list != NULL)
303 return data->library_list;
308 if (library_document == NULL && warning_msg != NULL)
310 warning (
_(
"%s (failed to read TARGET_OBJECT_LIBRARIES_AIX)"),
318 "DEBUG: TARGET_OBJECT_LIBRARIES_AIX = \n%s\n",
321 data->library_list = solib_aix_parse_libraries (library_document);
322 if (data->library_list == NULL && warning_msg != NULL)
324 warning (
_(
"%s (missing XML support?)"), warning_msg);
330 return data->library_list;
360 struct bfd_section *data_sect, *bss_sect;
362 data_sect = bfd_get_section_by_name (abfd,
".data");
363 if (data_sect == NULL)
366 bss_sect = bfd_get_section_by_name (abfd,
".bss");
367 if (bss_sect == NULL)
374 if (bfd_section_vma (abfd, bss_sect)
375 < bfd_section_vma (abfd, data_sect))
378 if (bfd_section_vma (abfd, bss_sect)
379 < bfd_section_vma (abfd, data_sect) + bfd_get_section_size (data_sect))
380 return ((bfd_section_vma (abfd, data_sect)
381 + bfd_get_section_size (data_sect))
382 - bfd_section_vma (abfd, bss_sect));
394 bfd *abfd = bfd_sect->owner;
395 const char *section_name = bfd_section_name (abfd, bfd_sect);
398 if (strcmp (section_name,
".text") == 0)
405 sec->
addr += bfd_sect->filepos;
407 else if (strcmp (section_name,
".data") == 0)
412 else if (strcmp (section_name,
".bss") == 0)
421 struct bfd_section *data_sect
422 = bfd_get_section_by_name (abfd,
".data");
425 if (data_sect != NULL)
426 data_offset = info->
data_addr - bfd_section_vma (abfd, data_sect);
428 sec->
addr = bfd_section_vma (abfd, bfd_sect) + data_offset;
430 sec->
endaddr = sec->
addr + bfd_section_size (abfd, bfd_sect);
435 sec->
addr = bfd_section_vma (abfd, bfd_sect);
436 sec->
endaddr = sec->
addr + bfd_section_size (abfd, bfd_sect);
470 bfd *abfd = objfile->
obfd;
479 struct bfd_section *sect
483 = info->
text_addr + sect->filepos - bfd_section_vma (abfd, sect);
490 struct bfd_section *sect
494 = info->
data_addr - bfd_section_vma (abfd, sect);
521 const char *warning_msg =
"unable to relocate main executable";
522 VEC (lm_info_p) *library_list;
529 if (library_list == NULL)
534 warning (
_(
"unable to relocate main executable (no info from loader)"));
538 exec_info =
VEC_index (lm_info_p, library_list, 0);
564 struct so_list *start = NULL, *last = NULL;
565 VEC (lm_info_p) *library_list;
570 if (library_list == NULL)
576 for (ix = 1;
VEC_iterate (lm_info_p, library_list, ix, info); ix++)
606 last = start = new_solib;
609 last->
next = new_solib;
644 const int path_len = strlen (pathname);
649 bfd *archive_bfd, *object_bfd;
650 struct cleanup *cleanup;
652 if (pathname[path_len - 1] !=
')')
656 sep = strrchr (pathname,
'(');
662 warning (
_(
"missing '(' in shared object pathname: %s"), pathname);
665 filename_len = sep - pathname;
667 filename =
xstrprintf (
"%.*s", filename_len, pathname);
669 member_name =
xstrprintf (
"%.*s", path_len - filename_len - 2, sep + 1);
673 if (archive_bfd == NULL)
675 warning (
_(
"Could not open `%s' as an executable file: %s"),
676 filename, bfd_errmsg (bfd_get_error ()));
681 if (bfd_check_format (archive_bfd, bfd_object))
687 if (! bfd_check_format (archive_bfd, bfd_archive))
689 warning (
_(
"\"%s\": not in executable format: %s."),
690 filename, bfd_errmsg (bfd_get_error ()));
697 while (object_bfd != NULL)
701 if (strcmp (member_name, object_bfd->filename) == 0)
709 if (object_bfd == NULL)
711 warning (
_(
"\"%s\": member \"%s\" missing."), filename, member_name);
717 if (! bfd_check_format (object_bfd, bfd_object))
719 warning (
_(
"%s(%s): not in object format: %s."),
720 filename, member_name, bfd_errmsg (bfd_get_error ()));
731 xfree (bfd_get_filename (object_bfd));
732 object_bfd->filename = xstrdup (pathname);
766 if (pc_osect == NULL)
767 error (
_(
"unable to find TOC entry for pc %s "
768 "(no section contains this PC)"),
772 if (data_osect == NULL)
773 error (
_(
"unable to find TOC entry for pc %s "
774 "(%s has no data section)"),
781 "DEBUG: solib_aix_get_toc_value (pc=%s) -> %s\n",
835 solib_aix_inferior_data_handle = register_inferior_data ();
841 &solib_aix_debug,
_(
"\
842 Control the debugging traces for the solib-aix module."),
_(
"\
843 Show whether solib-aix debugging traces are enabled."),
_(
"\
844 When on, solib-aix debugging traces are enabled."),
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 solib_aix_relocate_section_addresses(struct so_list *so, struct target_section *sec)
struct bfd_section * the_bfd_section
static const struct gdb_xml_attribute library_attributes[]
void warning(const char *fmt,...)
static void solib_aix_xfree_lm_info(struct lm_info *info)
static int solib_aix_in_dynsym_resolve_code(CORE_ADDR pc)
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)
void objfile_relocate(struct objfile *objfile, const struct section_offsets *new_offsets)
bfd *(* bfd_open)(char *pathname)
struct lm_info * lm_info_p
#define ALL_OBJFILE_OSECTIONS(objfile, osect)
#define VEC_safe_push(T, V, O)
#define SO_NAME_MAX_PATH_SIZE
static void show_solib_aix_debug(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
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)
struct bfd * gdb_bfd_open(const char *name, const char *target, int fd)
CORE_ADDR xcoff_get_toc_offset(struct objfile *objfile)
static void solib_aix_normal_stop_observer(struct bpstats *unused_1, int unused_2)
static void solib_aix_clear_solib(void)
int(* open_symbol_file_object)(void *from_ttyp)
#define obj_section_addr(s)
void(* clear_solib)(void)
#define VEC_iterate(T, V, I, P)
int(* in_dynsym_resolve_code)(CORE_ADDR pc)
static const struct inferior_data * solib_aix_inferior_data_handle
struct target_so_ops solib_aix_so_ops
static const struct gdb_xml_attribute library_list_attributes[]
static struct section_offsets * solib_aix_get_section_offsets(struct objfile *objfile, struct lm_info *info)
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 gdb_bfd_unref(struct bfd *abfd)
void initialize_file_ftype(void)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static struct obj_section * data_obj_section_from_objfile(struct objfile *objfile)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
static void solib_aix_free_so(struct so_list *so)
char so_original_name[SO_NAME_MAX_PATH_SIZE]
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
struct obj_section * sections
static const struct gdb_xml_element library_list_children[]
static void solib_aix_solib_create_inferior_hook(int from_tty)
static struct tui_gen_win_info exec_info[2]
char so_name[SO_NAME_MAX_PATH_SIZE]
char * target_read_stralloc(struct target_ops *ops, enum target_object object, const char *annex)
#define VEC_index(T, V, I)
bfd * gdb_bfd_openr_next_archived_file(bfd *archive, bfd *previous)
static void solib_aix_special_symbol_handling(void)
char * xstrprintf(const char *format,...)
struct cmd_list_element * setdebuglist
struct obj_section * find_pc_section(CORE_ADDR pc)
struct bfd_section * the_bfd_section
const char * objfile_name(const struct objfile *objfile)
struct ui_file * gdb_stdlog
void(* special_symbol_handling)(void)
CORE_ADDR solib_aix_get_toc_value(CORE_ADDR pc)
void gdb_xml_error(struct gdb_xml_parser *parser, const char *format,...)
static void solib_aix_free_library_list(void *p)
initialize_file_ftype _initialize_solib_aix
struct gdb_xml_value * xml_find_attribute(VEC(gdb_xml_value_s)*attributes, const char *name)
static int solib_aix_debug
void discard_cleanups(struct cleanup *old_chain)
static int solib_aix_open_symbol_file_object(void *from_ttyp)
void(* free_so)(struct so_list *so)
static CORE_ADDR solib_aix_bss_data_overlap(bfd *abfd)
struct inferior * current_inferior(void)
static bfd * solib_aix_bfd_open(char *pathname)
gdb_xml_attribute_handler gdb_xml_parse_attr_ulongest
unsigned long long ULONGEST
struct observer * observer_attach_normal_stop(observer_normal_stop_ftype *f)
const char * core_addr_to_string(const CORE_ADDR addr)
struct cmd_list_element * showdebuglist
static struct so_list * solib_aix_current_sos(void)
void error(const char *fmt,...)
bfd * solib_bfd_open(char *pathname)
void do_cleanups(struct cleanup *old_chain)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static struct solib_aix_inferior_data * get_solib_aix_inferior_data(struct inferior *inf)
static struct lm_info * solib_aix_new_lm_info(struct lm_info *info)