-/* Assuming ABFD refers to a core file, return the LdInfo data
- stored in that core file. Raises an error if the data could
- not be read or extracted.
-
- The returned value much be deallocated after use. */
-
-static LdInfo *
-rs6000_core_ldinfo (bfd *abfd)
-{
- struct bfd_section *ldinfo_sec;
- int ldinfo_size;
- gdb_byte *ldinfo_buf;
- struct cleanup *cleanup;
-
- ldinfo_sec = bfd_get_section_by_name (abfd, ".ldinfo");
- if (ldinfo_sec == NULL)
- error (_("cannot find .ldinfo section from core file: %s"),
- bfd_errmsg (bfd_get_error ()));
- ldinfo_size = bfd_get_section_size (ldinfo_sec);
-
- ldinfo_buf = xmalloc (ldinfo_size);
- cleanup = make_cleanup (xfree, ldinfo_buf);
-
- if (! bfd_get_section_contents (abfd, ldinfo_sec,
- ldinfo_buf, 0, ldinfo_size))
- error (_("unable to read .ldinfo section from core file: %s"),
- bfd_errmsg (bfd_get_error ()));
-
- discard_cleanups (cleanup);
- return (LdInfo *) ldinfo_buf;
-}
-
-/* Append to OBJSTACK an XML string description of the shared library
- corresponding to LDI, following the TARGET_OBJECT_LIBRARIES_AIX
- format. */
-
-static void
-rs6000_xfer_shared_library (LdInfo *ldi, struct obstack *obstack)
-{
- const int arch64 = ARCH64 ();
- const char *archive_name = LDI_FILENAME (ldi, arch64);
- const char *member_name = archive_name + strlen (archive_name) + 1;
- CORE_ADDR text_addr, data_addr;
- ULONGEST text_size, data_size;
- char *p;
-
- if (arch64)
- {
- text_addr = ldi->l64.ldinfo_textorg;
- text_size = ldi->l64.ldinfo_textsize;
- data_addr = ldi->l64.ldinfo_dataorg;
- data_size = ldi->l64.ldinfo_datasize;
- }
- else
- {
- /* The text and data addresses are defined as pointers.
- To avoid sign-extending their value in the assignments
- below, we cast their value to unsigned long first. */
- text_addr = (unsigned long) ldi->l32.ldinfo_textorg;
- text_size = ldi->l32.ldinfo_textsize;
- data_addr = (unsigned long) ldi->l32.ldinfo_dataorg;
- data_size = ldi->l32.ldinfo_datasize;
- }
-
- obstack_grow_str (obstack, "<library name=\"");
- p = xml_escape_text (archive_name);
- obstack_grow_str (obstack, p);
- xfree (p);
- obstack_grow_str (obstack, "\"");
-
- if (member_name[0] != '\0')
- {
- obstack_grow_str (obstack, " member=\"");
- p = xml_escape_text (member_name);
- obstack_grow_str (obstack, p);
- xfree (p);
- obstack_grow_str (obstack, "\"");
- }
-
- obstack_grow_str (obstack, " text_addr=\"");
- obstack_grow_str (obstack, core_addr_to_string (text_addr));
- obstack_grow_str (obstack, "\"");
-
- obstack_grow_str (obstack, " text_size=\"");
- obstack_grow_str (obstack, pulongest (text_size));
- obstack_grow_str (obstack, "\"");
-
- obstack_grow_str (obstack, " data_addr=\"");
- obstack_grow_str (obstack, core_addr_to_string (data_addr));
- obstack_grow_str (obstack, "\"");
-
- obstack_grow_str (obstack, " data_size=\"");
- obstack_grow_str (obstack, pulongest (data_size));
- obstack_grow_str (obstack, "\"");
-
- obstack_grow_str (obstack, "></library>");
-}
-