101 #if !defined(HAVE_LIBEXPAT) 106 solib_aix_parse_libraries (
const char *library)
108 static int have_warned;
113 warning (
_(
"Can not parse XML library list; XML support was disabled " 174 if (strcmp (
version,
"1.0") != 0)
176 _(
"Library list has unsupported version \"%s\""),
240 solib_aix_parse_libraries (
const char *library)
271 solib_aix_get_library_list (
struct inferior *
inf,
const char *warning_msg)
277 if (data->library_list != NULL)
278 return data->library_list;
283 if (library_document == NULL && warning_msg != NULL)
285 warning (
_(
"%s (failed to read TARGET_OBJECT_LIBRARIES_AIX)"),
292 "DEBUG: TARGET_OBJECT_LIBRARIES_AIX = \n%s\n",
293 library_document.get ());
295 data->library_list = solib_aix_parse_libraries (library_document.get ());
296 if (data->library_list == NULL && warning_msg != NULL)
298 warning (
_(
"%s (missing XML support?)"), warning_msg);
302 return data->library_list;
332 struct bfd_section *data_sect, *bss_sect;
334 data_sect = bfd_get_section_by_name (abfd,
".data");
335 if (data_sect == NULL)
338 bss_sect = bfd_get_section_by_name (abfd,
".bss");
339 if (bss_sect == NULL)
346 if (bfd_section_vma (abfd, bss_sect)
347 < bfd_section_vma (abfd, data_sect))
350 if (bfd_section_vma (abfd, bss_sect)
351 < bfd_section_vma (abfd, data_sect) + bfd_get_section_size (data_sect))
352 return ((bfd_section_vma (abfd, data_sect)
353 + bfd_get_section_size (data_sect))
354 - bfd_section_vma (abfd, bss_sect));
366 bfd *abfd = bfd_sect->owner;
367 const char *section_name = bfd_section_name (abfd, bfd_sect);
370 if (strcmp (section_name,
".text") == 0)
377 sec->
addr += bfd_sect->filepos;
379 else if (strcmp (section_name,
".data") == 0)
384 else if (strcmp (section_name,
".bss") == 0)
393 struct bfd_section *data_sect
394 = bfd_get_section_by_name (abfd,
".data");
397 if (data_sect != NULL)
398 data_offset = info->
data_addr - bfd_section_vma (abfd, data_sect);
400 sec->
addr = bfd_section_vma (abfd, bfd_sect) + data_offset;
402 sec->
endaddr = sec->
addr + bfd_section_size (abfd, bfd_sect);
407 sec->
addr = bfd_section_vma (abfd, bfd_sect);
408 sec->
endaddr = sec->
addr + bfd_section_size (abfd, bfd_sect);
453 struct bfd_section *sect
457 = info->
text_addr + sect->filepos - bfd_section_vma (abfd, sect);
464 struct bfd_section *sect
468 = info->
data_addr - bfd_section_vma (abfd, sect);
495 const char *warning_msg =
"unable to relocate main executable";
503 if (library_list == NULL)
508 warning (
_(
"unable to relocate main executable (no info from loader)"));
530 struct so_list *start = NULL, *last = NULL;
536 if (library_list == NULL)
573 last = start = new_solib;
576 last->
next = new_solib;
611 const int path_len = strlen (pathname);
615 char *found_pathname;
617 if (pathname[path_len - 1] !=
')')
621 sep = strrchr (pathname,
'(');
627 warning (
_(
"missing '(' in shared object pathname: %s"), pathname);
630 filename_len = sep - pathname;
639 found_pathname =
solib_find (filename.c_str (), &found_file);
640 if (found_pathname == NULL)
643 if (archive_bfd == NULL)
645 warning (
_(
"Could not open `%s' as an executable file: %s"),
646 filename.c_str (), bfd_errmsg (bfd_get_error ()));
650 if (bfd_check_format (archive_bfd.
get (), bfd_object))
653 if (! bfd_check_format (archive_bfd.
get (), bfd_archive))
655 warning (
_(
"\"%s\": not in executable format: %s."),
656 filename.c_str (), bfd_errmsg (bfd_get_error ()));
662 while (object_bfd != NULL)
664 if (member_name == object_bfd->filename)
671 if (object_bfd == NULL)
673 warning (
_(
"\"%s\": member \"%s\" missing."), filename.c_str (),
674 member_name.c_str ());
678 if (! bfd_check_format (object_bfd.
get (), bfd_object))
680 warning (
_(
"%s(%s): not in object format: %s."),
681 filename.c_str (), member_name.c_str (),
682 bfd_errmsg (bfd_get_error ()));
690 xfree (bfd_get_filename (object_bfd.
get ()));
692 bfd_get_filename (archive_bfd.
get ()),
725 if (pc_osect == NULL)
726 error (
_(
"unable to find TOC entry for pc %s " 727 "(no section contains this PC)"),
731 if (data_osect == NULL)
732 error (
_(
"unable to find TOC entry for pc %s " 733 "(%s has no data section)"),
740 "DEBUG: solib_aix_get_toc_value (pc=%s) -> %s\n",
796 Control the debugging traces for the solib-aix module."),
_(
"\ 797 Show whether solib-aix debugging traces are enabled."),
_(
"\ 798 When on, solib-aix debugging traces are enabled."),
gdb_bfd_ref_ptr solib_bfd_fopen(char *pathname, int fd)
static VEC(lm_info_aix_p)
static void solib_aix_relocate_section_addresses(struct so_list *so, struct target_section *sec)
lm_info_aix * lm_info_aix_p
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_section * the_bfd_section
static const struct gdb_xml_attribute library_attributes[]
void warning(const char *fmt,...)
static int solib_aix_in_dynsym_resolve_code(CORE_ADDR pc)
void(* relocate_section_addresses)(struct so_list *so, struct target_section *)
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)
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)
#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)
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)
gdb::unique_xmalloc_ptr< char > target_read_stralloc(struct target_ops *ops, enum target_object object, const char *annex)
gdb_bfd_ref_ptr(* bfd_open)(char *pathname)
void(* clear_solib)(void)
void _initialize_solib_aix(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[]
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
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
struct gdb_xml_value * xml_find_attribute(VEC(gdb_xml_value_s) *attributes, const char *name)
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 int solib_aix_open_symbol_file_object(int from_tty)
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]
#define VEC_index(T, V, I)
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)
static struct section_offsets * solib_aix_get_section_offsets(struct objfile *objfile, lm_info_aix *info)
CORE_ADDR solib_aix_get_toc_value(CORE_ADDR pc)
static const struct gdb_xml_element library_list_elements[]
void gdb_xml_error(struct gdb_xml_parser *parser, const char *format,...)
static gdb_bfd_ref_ptr solib_aix_bfd_open(char *pathname)
static void solib_aix_free_library_list(void *p)
int(* open_symbol_file_object)(int from_ttyp)
static int solib_aix_debug
void discard_cleanups(struct cleanup *old_chain)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
char * solib_find(const char *in_pathname, int *fd)
void(* free_so)(struct so_list *so)
#define obj_section_addr(s)
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_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static CORE_ADDR solib_aix_bss_data_overlap(bfd *abfd)
std::string string_printf(const char *fmt,...)
struct inferior * current_inferior(void)
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
gdb_bfd_ref_ptr solib_bfd_open(char *pathname)
gdb_bfd_ref_ptr gdb_bfd_openr_next_archived_file(bfd *archive, bfd *previous)
static struct so_list * solib_aix_current_sos(void)
void error(const char *fmt,...)
void do_cleanups(struct cleanup *old_chain)
static struct solib_aix_inferior_data * get_solib_aix_inferior_data(struct inferior *inf)