- case TARGET_OBJECT_SPU:
- if (readbuf && annex)
- {
- /* When the SPU contexts are stored in a core file, BFD
- represents this with a fake section called
- "SPU/<annex>". */
-
- struct bfd_section *section;
- bfd_size_type size;
- char sectionstr[100];
-
- xsnprintf (sectionstr, sizeof sectionstr, "SPU/%s", annex);
-
- section = bfd_get_section_by_name (core_bfd, sectionstr);
- if (section == NULL)
- return TARGET_XFER_E_IO;
-
- size = bfd_section_size (core_bfd, section);
- if (offset >= size)
- return TARGET_XFER_EOF;
- size -= offset;
- if (size > len)
- size = len;
-
- if (size == 0)
- return TARGET_XFER_EOF;
- if (!bfd_get_section_contents (core_bfd, section, readbuf,
- (file_ptr) offset, size))
- {
- warning (_("Couldn't read SPU section in core file."));
- return TARGET_XFER_E_IO;
- }
-
- *xfered_len = (ULONGEST) size;
- return TARGET_XFER_OK;
- }
- else if (readbuf)
- {
- /* NULL annex requests list of all present spuids. */
- struct spuid_list list;
-
- list.buf = readbuf;
- list.offset = offset;
- list.len = len;
- list.pos = 0;
- list.written = 0;
- bfd_map_over_sections (core_bfd, add_to_spuid_list, &list);
-
- if (list.written == 0)
- return TARGET_XFER_EOF;
- else
- {
- *xfered_len = (ULONGEST) list.written;
- return TARGET_XFER_OK;
- }
- }
- return TARGET_XFER_E_IO;
-