diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2019-09-20 23:06:57 +0200 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2019-09-20 23:06:57 +0200 |
commit | abf516c6931af1683d1e51203de1ca01467f9f85 (patch) | |
tree | f2d4e09a3840ac22f5af5584348fbdf97e0c8aca /gdb/gdbserver | |
parent | 78e8cb91cd1374ac59cc8bf6509fa70bde74ff1a (diff) | |
download | gdb-abf516c6931af1683d1e51203de1ca01467f9f85.zip gdb-abf516c6931af1683d1e51203de1ca01467f9f85.tar.gz gdb-abf516c6931af1683d1e51203de1ca01467f9f85.tar.bz2 |
Remove Cell Broadband Engine debugging support
This patch implements removal of Cell/B.E. support, including
- Support for the spu-*-* target
- Support for native stand-alone SPU debugging
- Support for integrated debugging of combined PPU/SPU applications
- Remote debugging (gdbserver) support for all the above.
The patch also removes the TARGET_OBJECT_SPU target object type,
as this is available only on Cell/B.E. targets, including
- Native Linux support
- Core file support (including core file generation)
- Remote target support, including removal of the qXfer:spu:read
and qXfer:spu:write remote protocal packets and associated
support in gdbserver.
gdb/ChangeLog
2019-09-20 Ulrich Weigand <uweigand@de.ibm.com>
* NEWS: Mention that Cell/B.E. debugging support was removed.
* MAINTAINERS: Remove spu target.
* config/djgpp/fnchange.lst: Remove entries for removed files.
* Makefile.in (ALL_TARGET_OBS): Remove solib-spu.o,
spu-multiarch.o, and spu-tdep.o.
(HFILES_NO_SRCDIR): Remove solib-spu.h and spu-tdep.h.
(ALLDEPFILES): Remove solib-spu.c, spu-linux-nat.c,
spu-multiarch.c, and spu-tdep.c.
* spu-linux-nat.c: Remove file.
* spu-multiarch.c: Remove file.
* spu-tdep.c: Remove file.
* spu-tdep.h: Remove file.
* solib-spu.c: Remove file.
* solib-spu.h: Remove file.
* configure.host (powerpc64*-*-linux*): Remove Cell/B.E. support.
* configure.nat (spu-linux): Remove.
* configure.tgt (powerpc*-*-linux*): Remove solib-spu.o and
solib-multiarch.o from gdb_target_obs.
(spu*-*-*): Remove.
* arch/ppc-linux-common.h (struct ppc_linux_features): Remove "cell"
feature flag.
(ppc_linux_no_features): Update.
* arch/ppc-linux-common.c (ppc_linux_match_description): Remove
Cell/B.E. support.
* arch/ppc-linux-tdesc.h (tdesc_powerpc_cell32l): Remove declaration.
(tdesc_powerpc_cell64l): Likewise.
* nat/ppc-linux.h (PPC_FEATURE_CELL): Remove.
* ppc-linux-nat.c (ppc_linux_nat_target::read_description): Remove
Cell/B.E. support.
* ppc-linux-tdep.h: Do not include "solib-spu.h" or "spu-tdep.h".
Do not include "features/rs6000/powerpc-cell32l.c" or
"features/rs6000/powerpc-cell64l.c".
(ppc_linux_spu_section): Remove.
(ppc_linux_core_read_description): Remove Cell/B.E. support.
(spe_context_objfile, spe_context_lm_addr, spe_context_offset,
spe_context_cache_ptid, spe_context_cache_ptid): Remove.
(ppc_linux_spe_context_lookup): Remove.
(ppc_linux_spe_context_inferior_created): Remove.
(ppc_linux_spe_context_solib_loaded): Remove.
(ppc_linux_spe_context_solib_unloaded): Remove.
(ppc_linux_spe_context): Remove.
(struct ppu2spu_cache): Remove.
(ppu2spu_prev_arch, ppu2spu_this_id, ppu2spu_prev_register): Remove.
(struct ppu2spu_data): Remove.
(ppu2spu_unwind_register, ppu2spu_sniffer, ppu2spu_dealloc_cache,
ppu2spu_unwind): Remove.
(ppc_linux_init_abi): Remove Cell/B.E. support.
* rs6000-tdep.h (rs6000_gdbarch_init): Remove Cell/B.E. support.
* features/Makefile (rs6000/powerpc-cell32l-expedite): Remove.
(rs6000/powerpc-cell64l-expedite): Likewise
(WHICH): Remove rs6000/powerpc-cell32l and rs6000/powerpc-cell64l.
(XMLTOC): Remove rs6000/powerpc-cell32l.xml and
rs6000/powerpc-cell64l.xml.
* features/rs6000/powerpc-cell32l.xml: Remove.
* features/rs6000/powerpc-cell64l.xml: Likewise.
* features/rs6000/powerpc-cell32l.c: Remove generated file.
* features/rs6000/powerpc-cell64l.c: Likewise.
* regformats/rs6000/powerpc-cell32l.dat: Remove generated file.
* regformats/rs6000/powerpc-cell64l.dat: Likewise.
* regformats/reg-spu.dat: Remove.
* target.h (enum target_object): Remove TARGET_OBJECT_SPU.
* corelow.c (struct spuid_list): Remove.
(add_to_spuid_list): Remove.
(core_target::xfer_partial): Remove support for TARGET_OBJECT_SPU.
* remote.c (PACKET_qXfer_spu_read, PACKET_qXfer_spu_write): Remove.
(remote_protocol_features): Remove associated entries.
(_initialize_remote): No longer initialize them.
(remote_target::xfer_partial): Remove support for TARGET_OBJECT_SPU.
* linux-nat.c (SPUFS_MAGIC): Remove.
(linux_proc_xfer_spu): Remove.
(spu_enumerate_spu_ids): Remove.
(linux_nat_target::xfer_partial): Remove support for TARGET_OBJECT_SPU.
* linux-tdep.c (-linux_spu_make_corefile_notes): Remove.
(linux_make_corefile_notes): No longer call it.
* regcache.c (cooked_read_test): Remove bfd_arch_spu special case.
(cooked_write_test): Likewise.
gdb/doc/ChangeLog
2019-09-20 Ulrich Weigand <uweigand@de.ibm.com>
* doc/gdb.texinfo (Remote Configuration): Remove documentation for
qXfer:spu:read and qXfer:spu:write.
(General Query Packets): Likewise.
(Cell Broadband Engine SPU architecture): Remove subsection.
gdb/gdbserver/ChangeLog
2019-09-20 Ulrich Weigand <uweigand@de.ibm.com>
* configure.srv (ipa_ppc_linux_regobj): Remove powerpc-cell32l-ipa.o
and powerpc-cell64l-ipa.o.
(powerpc*-*-linux*): Remove powerpc-cell32l.o and powerpc-cell64l.o
from srv_regobj. Remove rs6000/powerpc-cell32l.xml and
rs6000/powerpc-cell64l.xml from srv_xmlfiles.
(spu*-*-*): Remove.
* spu-low.c: Remove file.
* linux-ppc-low.c (INSTR_SC, NR_spu_run): Remove.
(parse_spufs_run): Remove.
(ppc_get_pc): Remove Cell/B.E. support.
(ppc_set_pc): Likewise.
(ppc_breakpoint_at): Likewise.
(ppc_arch_setup): Likewise.
(ppc_get_ipa_tdesc_idx): Do not handle tdesc_powerpc_cell64l or
tdesc_powerpc_cell32l.
(initialize_low_arch): Do not call init_registers_powerpc_cell64l
or init_registers_powerpc_cell32l.
* linux-ppc-ipa.c (get_ipa_tdesc): Do not handle PPC_TDESC_CELL.
(initialize_low_tracepoint): Do not call init_registers_powerpc_cell64l
or init_registers_powerpc_cell32l.
* linux-ppc-tdesc-init.h (PPC_TDESC_CELL): Mark as unused.
(init_registers_powerpc_cell32l): Remove prototype.
(init_registers_powerpc_cell64l): Likewise.
* target.h (struct target_ops): Remove qxfer_spu member.
* server.c (handle_qxfer_spu): Remove.
(qxfer_packets): Remove entry for "spu".
(handle_query): No longer support qXfer:spu:read or qXfer:spu:write.
* linux-low.c (SPUFS_MAGIC): Remove.
(spu_enumerate_spu_ids): Remove.
(linux_qxfer_spu): Remove.
(linux_target_ops): Remove qxfer_spu member.
* lynx-low.c (lynx_target_ops): Remove qxfer_spu member.
* nto-low.c (nto_target_ops): Remove qxfer_spu member.
* win32-low.c (win32_target_ops): Remove qxfer_spu member.
gdb/testsuite/ChangeLog
2019-09-20 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.arch/spu-info.exp: Remove file.
* gdb.arch/spu-info.c: Remove file.
* gdb.arch/spu-ls.exp: Remove file.
* gdb.arch/spu-ls.c: Remove file.
* gdb.asm/asm-source.exp: Remove support for spu*-*-*.
* gdb.asm/spu.inc: Remove file.
* gdb.base/dump.exp: Remove support for spu*-*-*.
* gdb.base/stack-checking.exp: Likewise.
* gdb.base/overlays.exp: Likewise.
* gdb.base/ovlymgr.c: Likewise.
* gdb.base/spu.ld: Remove file.
* gdb.cp/bs15503.exp: Remove support for spu*-*-*.
* gdb.cp/cpexprs.exp: Likewise.
* gdb.cp/exception.exp: Likewise.
* gdb.cp/gdb2495.exp: Likewise.
* gdb.cp/mb-templates.exp: Likewise.
* gdb.cp/pr9167.exp: Likewise.
* gdb.cp/userdef.exp: Likewise.
* gdb.xml/tdesc-regs.exp: Remove support for spu*-*-*.
* gdb.cell: Remove directory.
* lib/cell.exp: Remove file.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 40 | ||||
-rw-r--r-- | gdb/gdbserver/configure.srv | 9 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 98 | ||||
-rw-r--r-- | gdb/gdbserver/linux-ppc-ipa.c | 6 | ||||
-rw-r--r-- | gdb/gdbserver/linux-ppc-low.c | 106 | ||||
-rw-r--r-- | gdb/gdbserver/linux-ppc-tdesc-init.h | 8 | ||||
-rw-r--r-- | gdb/gdbserver/lynx-low.c | 1 | ||||
-rw-r--r-- | gdb/gdbserver/nto-low.c | 1 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 20 | ||||
-rw-r--r-- | gdb/gdbserver/spu-low.c | 732 | ||||
-rw-r--r-- | gdb/gdbserver/target.h | 4 | ||||
-rw-r--r-- | gdb/gdbserver/win32-low.c | 1 |
12 files changed, 49 insertions, 977 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index faafdfd..5c76167 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,43 @@ +2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> + + * configure.srv (ipa_ppc_linux_regobj): Remove powerpc-cell32l-ipa.o + and powerpc-cell64l-ipa.o. + (powerpc*-*-linux*): Remove powerpc-cell32l.o and powerpc-cell64l.o + from srv_regobj. Remove rs6000/powerpc-cell32l.xml and + rs6000/powerpc-cell64l.xml from srv_xmlfiles. + (spu*-*-*): Remove. + + * spu-low.c: Remove file. + + * linux-ppc-low.c (INSTR_SC, NR_spu_run): Remove. + (parse_spufs_run): Remove. + (ppc_get_pc): Remove Cell/B.E. support. + (ppc_set_pc): Likewise. + (ppc_breakpoint_at): Likewise. + (ppc_arch_setup): Likewise. + (ppc_get_ipa_tdesc_idx): Do not handle tdesc_powerpc_cell64l or + tdesc_powerpc_cell32l. + (initialize_low_arch): Do not call init_registers_powerpc_cell64l + or init_registers_powerpc_cell32l. + * linux-ppc-ipa.c (get_ipa_tdesc): Do not handle PPC_TDESC_CELL. + (initialize_low_tracepoint): Do not call init_registers_powerpc_cell64l + or init_registers_powerpc_cell32l. + * linux-ppc-tdesc-init.h (PPC_TDESC_CELL): Mark as unused. + (init_registers_powerpc_cell32l): Remove prototype. + (init_registers_powerpc_cell64l): Likewise. + + * target.h (struct target_ops): Remove qxfer_spu member. + * server.c (handle_qxfer_spu): Remove. + (qxfer_packets): Remove entry for "spu". + (handle_query): No longer support qXfer:spu:read or qXfer:spu:write. + * linux-low.c (SPUFS_MAGIC): Remove. + (spu_enumerate_spu_ids): Remove. + (linux_qxfer_spu): Remove. + (linux_target_ops): Remove qxfer_spu member. + * lynx-low.c (lynx_target_ops): Remove qxfer_spu member. + * nto-low.c (nto_target_ops): Remove qxfer_spu member. + * win32-low.c (win32_target_ops): Remove qxfer_spu member. + 2019-08-23 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Add 'gdbsupport/gdb-dlfcn.c'. diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 66d3d42..1a4ab8e 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -24,7 +24,7 @@ # Default hostio_last_error implementation srv_hostio_err_objs="hostio-errno.o" -ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-isa205-ppr-dscr-vsx32l-ipa.o powerpc-isa207-vsx32l-ipa.o powerpc-isa207-htm-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o powerpc-isa205-ppr-dscr-vsx64l-ipa.o powerpc-isa207-vsx64l-ipa.o powerpc-isa207-htm-vsx64l-ipa.o" +ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-isa205-ppr-dscr-vsx32l-ipa.o powerpc-isa207-vsx32l-ipa.o powerpc-isa207-htm-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o powerpc-isa205-ppr-dscr-vsx64l-ipa.o powerpc-isa207-vsx64l-ipa.o powerpc-isa207-htm-vsx64l-ipa.o" # Linux object files. This is so we don't have to repeat # these files over and over again. @@ -186,7 +186,6 @@ case "${target}" in ;; powerpc*-*-linux*) srv_regobj="powerpc-32l.o" srv_regobj="${srv_regobj} powerpc-altivec32l.o" - srv_regobj="${srv_regobj} powerpc-cell32l.o" srv_regobj="${srv_regobj} powerpc-vsx32l.o" srv_regobj="${srv_regobj} powerpc-isa205-32l.o" srv_regobj="${srv_regobj} powerpc-isa205-altivec32l.o" @@ -197,7 +196,6 @@ case "${target}" in srv_regobj="${srv_regobj} powerpc-e500l.o" srv_regobj="${srv_regobj} powerpc-64l.o" srv_regobj="${srv_regobj} powerpc-altivec64l.o" - srv_regobj="${srv_regobj} powerpc-cell64l.o" srv_regobj="${srv_regobj} powerpc-vsx64l.o" srv_regobj="${srv_regobj} powerpc-isa205-64l.o" srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o" @@ -209,7 +207,6 @@ case "${target}" in srv_tgtobj="${srv_tgtobj} arch/ppc-linux-common.o" srv_xmlfiles="rs6000/powerpc-32l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx32l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-32l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec32l.xml" @@ -240,7 +237,6 @@ case "${target}" in srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec64l.xml" - srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell64l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx64l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-64l.xml" srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec64l.xml" @@ -340,9 +336,6 @@ case "${target}" in srv_linux_regsets=yes srv_linux_thread_db=yes ;; - spu*-*-*) srv_regobj=reg-spu.o - srv_tgtobj="spu-low.o fork-child.o fork-inferior.o" - ;; tic6x-*-uclinux) if $development; then srv_regobj="tic6x-c64xp-linux.o" srv_regobj="${srv_regobj} tic6x-c64x-linux.o" diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 3113017..d64c364 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -60,10 +60,6 @@ #endif #include "nat/linux-namespaces.h" -#ifndef SPUFS_MAGIC -#define SPUFS_MAGIC 0x23c9b64e -#endif - #ifdef HAVE_PERSONALITY # include <sys/personality.h> # if !HAVE_DECL_ADDR_NO_RANDOMIZE @@ -6358,99 +6354,6 @@ linux_supports_range_stepping (void) return (*the_low_target.supports_range_stepping) (); } -/* Enumerate spufs IDs for process PID. */ -static int -spu_enumerate_spu_ids (long pid, unsigned char *buf, CORE_ADDR offset, int len) -{ - int pos = 0; - int written = 0; - char path[128]; - DIR *dir; - struct dirent *entry; - - sprintf (path, "/proc/%ld/fd", pid); - dir = opendir (path); - if (!dir) - return -1; - - rewinddir (dir); - while ((entry = readdir (dir)) != NULL) - { - struct stat st; - struct statfs stfs; - int fd; - - fd = atoi (entry->d_name); - if (!fd) - continue; - - sprintf (path, "/proc/%ld/fd/%d", pid, fd); - if (stat (path, &st) != 0) - continue; - if (!S_ISDIR (st.st_mode)) - continue; - - if (statfs (path, &stfs) != 0) - continue; - if (stfs.f_type != SPUFS_MAGIC) - continue; - - if (pos >= offset && pos + 4 <= offset + len) - { - *(unsigned int *)(buf + pos - offset) = fd; - written += 4; - } - pos += 4; - } - - closedir (dir); - return written; -} - -/* Implements the to_xfer_partial interface for the TARGET_OBJECT_SPU - object type, using the /proc file system. */ -static int -linux_qxfer_spu (const char *annex, unsigned char *readbuf, - unsigned const char *writebuf, - CORE_ADDR offset, int len) -{ - long pid = lwpid_of (current_thread); - char buf[128]; - int fd = 0; - int ret = 0; - - if (!writebuf && !readbuf) - return -1; - - if (!*annex) - { - if (!readbuf) - return -1; - else - return spu_enumerate_spu_ids (pid, readbuf, offset, len); - } - - sprintf (buf, "/proc/%ld/fd/%s", pid, annex); - fd = open (buf, writebuf? O_WRONLY : O_RDONLY); - if (fd <= 0) - return -1; - - if (offset != 0 - && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset) - { - close (fd); - return 0; - } - - if (writebuf) - ret = write (fd, writebuf, (size_t) len); - else - ret = read (fd, readbuf, (size_t) len); - - close (fd); - return ret; -} - #if defined PT_GETDSBT || defined PTRACE_GETFDPIC struct target_loadseg { @@ -7496,7 +7399,6 @@ static struct target_ops linux_target_ops = { #else NULL, #endif - linux_qxfer_spu, hostio_last_error_from_errno, linux_qxfer_osdata, linux_xfer_siginfo, diff --git a/gdb/gdbserver/linux-ppc-ipa.c b/gdb/gdbserver/linux-ppc-ipa.c index 08adc52..f9df022 100644 --- a/gdb/gdbserver/linux-ppc-ipa.c +++ b/gdb/gdbserver/linux-ppc-ipa.c @@ -181,8 +181,6 @@ get_ipa_tdesc (int idx) return tdesc_powerpc_64l; case PPC_TDESC_ALTIVEC: return tdesc_powerpc_altivec64l; - case PPC_TDESC_CELL: - return tdesc_powerpc_cell64l; case PPC_TDESC_VSX: return tdesc_powerpc_vsx64l; case PPC_TDESC_ISA205: @@ -202,8 +200,6 @@ get_ipa_tdesc (int idx) return tdesc_powerpc_32l; case PPC_TDESC_ALTIVEC: return tdesc_powerpc_altivec32l; - case PPC_TDESC_CELL: - return tdesc_powerpc_cell32l; case PPC_TDESC_VSX: return tdesc_powerpc_vsx32l; case PPC_TDESC_ISA205: @@ -241,7 +237,6 @@ initialize_low_tracepoint (void) #ifdef __powerpc64__ init_registers_powerpc_64l (); init_registers_powerpc_altivec64l (); - init_registers_powerpc_cell64l (); init_registers_powerpc_vsx64l (); init_registers_powerpc_isa205_64l (); init_registers_powerpc_isa205_altivec64l (); @@ -252,7 +247,6 @@ initialize_low_tracepoint (void) #else init_registers_powerpc_32l (); init_registers_powerpc_altivec32l (); - init_registers_powerpc_cell32l (); init_registers_powerpc_vsx32l (); init_registers_powerpc_isa205_32l (); init_registers_powerpc_isa205_altivec32l (); diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 8a0965b..c062282 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -220,73 +220,10 @@ ppc_supply_ptrace_register (struct regcache *regcache, perror_with_name ("Unexpected byte order"); } - -#define INSTR_SC 0x44000002 -#define NR_spu_run 0x0116 - -/* If the PPU thread is currently stopped on a spu_run system call, - return to FD and ADDR the file handle and NPC parameter address - used with the system call. Return non-zero if successful. */ -static int -parse_spufs_run (struct regcache *regcache, int *fd, CORE_ADDR *addr) -{ - CORE_ADDR curr_pc; - int curr_insn; - int curr_r0; - - if (register_size (regcache->tdesc, 0) == 4) - { - unsigned int pc, r0, r3, r4; - collect_register_by_name (regcache, "pc", &pc); - collect_register_by_name (regcache, "r0", &r0); - collect_register_by_name (regcache, "orig_r3", &r3); - collect_register_by_name (regcache, "r4", &r4); - curr_pc = (CORE_ADDR) pc; - curr_r0 = (int) r0; - *fd = (int) r3; - *addr = (CORE_ADDR) r4; - } - else - { - unsigned long pc, r0, r3, r4; - collect_register_by_name (regcache, "pc", &pc); - collect_register_by_name (regcache, "r0", &r0); - collect_register_by_name (regcache, "orig_r3", &r3); - collect_register_by_name (regcache, "r4", &r4); - curr_pc = (CORE_ADDR) pc; - curr_r0 = (int) r0; - *fd = (int) r3; - *addr = (CORE_ADDR) r4; - } - - /* Fetch instruction preceding current NIP. */ - if ((*the_target->read_memory) (curr_pc - 4, - (unsigned char *) &curr_insn, 4) != 0) - return 0; - /* It should be a "sc" instruction. */ - if (curr_insn != INSTR_SC) - return 0; - /* System call number should be NR_spu_run. */ - if (curr_r0 != NR_spu_run) - return 0; - - return 1; -} - static CORE_ADDR ppc_get_pc (struct regcache *regcache) { - CORE_ADDR addr; - int fd; - - if (parse_spufs_run (regcache, &fd, &addr)) - { - unsigned int pc; - (*the_target->read_memory) (addr, (unsigned char *) &pc, 4); - return ((CORE_ADDR)1 << 63) - | ((CORE_ADDR)fd << 32) | (CORE_ADDR) (pc - 4); - } - else if (register_size (regcache->tdesc, 0) == 4) + if (register_size (regcache->tdesc, 0) == 4) { unsigned int pc; collect_register_by_name (regcache, "pc", &pc); @@ -303,15 +240,7 @@ ppc_get_pc (struct regcache *regcache) static void ppc_set_pc (struct regcache *regcache, CORE_ADDR pc) { - CORE_ADDR addr; - int fd; - - if (parse_spufs_run (regcache, &fd, &addr)) - { - unsigned int newpc = pc; - (*the_target->write_memory) (addr, (unsigned char *) &newpc, 4); - } - else if (register_size (regcache->tdesc, 0) == 4) + if (register_size (regcache->tdesc, 0) == 4) { unsigned int newpc = pc; supply_register_by_name (regcache, "pc", &newpc); @@ -348,23 +277,11 @@ ppc_breakpoint_at (CORE_ADDR where) { unsigned int insn; - if (where & ((CORE_ADDR)1 << 63)) - { - char mem_annex[32]; - sprintf (mem_annex, "%d/mem", (int)((where >> 32) & 0x7fffffff)); - (*the_target->qxfer_spu) (mem_annex, (unsigned char *) &insn, - NULL, where & 0xffffffff, 4); - if (insn == 0x3fff) - return 1; - } - else - { - (*the_target->read_memory) (where, (unsigned char *) &insn, 4); - if (insn == ppc_breakpoint) - return 1; - /* If necessary, recognize more trap instructions here. GDB only uses - the one. */ - } + (*the_target->read_memory) (where, (unsigned char *) &insn, 4); + if (insn == ppc_breakpoint) + return 1; + /* If necessary, recognize more trap instructions here. GDB only uses + the one. */ return 0; } @@ -941,9 +858,6 @@ ppc_arch_setup (void) } } - if (ppc_hwcap & PPC_FEATURE_CELL) - features.cell = true; - tdesc = ppc_linux_match_description (features); /* On 32-bit machines, check for SPE registers. @@ -3416,8 +3330,6 @@ ppc_get_ipa_tdesc_idx (void) return PPC_TDESC_BASE; if (tdesc == tdesc_powerpc_altivec64l) return PPC_TDESC_ALTIVEC; - if (tdesc == tdesc_powerpc_cell64l) - return PPC_TDESC_CELL; if (tdesc == tdesc_powerpc_vsx64l) return PPC_TDESC_VSX; if (tdesc == tdesc_powerpc_isa205_64l) @@ -3438,8 +3350,6 @@ ppc_get_ipa_tdesc_idx (void) return PPC_TDESC_BASE; if (tdesc == tdesc_powerpc_altivec32l) return PPC_TDESC_ALTIVEC; - if (tdesc == tdesc_powerpc_cell32l) - return PPC_TDESC_CELL; if (tdesc == tdesc_powerpc_vsx32l) return PPC_TDESC_VSX; if (tdesc == tdesc_powerpc_isa205_32l) @@ -3507,7 +3417,6 @@ initialize_low_arch (void) init_registers_powerpc_32l (); init_registers_powerpc_altivec32l (); - init_registers_powerpc_cell32l (); init_registers_powerpc_vsx32l (); init_registers_powerpc_isa205_32l (); init_registers_powerpc_isa205_altivec32l (); @@ -3519,7 +3428,6 @@ initialize_low_arch (void) #if __powerpc64__ init_registers_powerpc_64l (); init_registers_powerpc_altivec64l (); - init_registers_powerpc_cell64l (); init_registers_powerpc_vsx64l (); init_registers_powerpc_isa205_64l (); init_registers_powerpc_isa205_altivec64l (); diff --git a/gdb/gdbserver/linux-ppc-tdesc-init.h b/gdb/gdbserver/linux-ppc-tdesc-init.h index 4f9a7c5..299b3ce 100644 --- a/gdb/gdbserver/linux-ppc-tdesc-init.h +++ b/gdb/gdbserver/linux-ppc-tdesc-init.h @@ -27,7 +27,7 @@ enum ppc_linux_tdesc { PPC_TDESC_BASE, PPC_TDESC_ALTIVEC, - PPC_TDESC_CELL, + PPC_TDESC_CELL, /* No longer used, but kept to avoid ABI changes. */ PPC_TDESC_VSX, PPC_TDESC_ISA205, PPC_TDESC_ISA205_ALTIVEC, @@ -46,9 +46,6 @@ void init_registers_powerpc_32l (void); /* Defined in auto-generated file powerpc-altivec32l.c. */ void init_registers_powerpc_altivec32l (void); -/* Defined in auto-generated file powerpc-cell32l.c. */ -void init_registers_powerpc_cell32l (void); - /* Defined in auto-generated file powerpc-vsx32l.c. */ void init_registers_powerpc_vsx32l (void); @@ -83,9 +80,6 @@ void init_registers_powerpc_64l (void); /* Defined in auto-generated file powerpc-altivec64l.c. */ void init_registers_powerpc_altivec64l (void); -/* Defined in auto-generated file powerpc-cell64l.c. */ -void init_registers_powerpc_cell64l (void); - /* Defined in auto-generated file powerpc-vsx64l.c. */ void init_registers_powerpc_vsx64l (void); diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c index 0a8b258..2bd24e7 100644 --- a/gdb/gdbserver/lynx-low.c +++ b/gdb/gdbserver/lynx-low.c @@ -753,7 +753,6 @@ static struct target_ops lynx_target_ops = { NULL, /* stopped_data_address */ NULL, /* read_offsets */ NULL, /* get_tls_address */ - NULL, /* qxfer_spu */ NULL, /* hostio_last_error */ NULL, /* qxfer_osdata */ NULL, /* qxfer_siginfo */ diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c index 011701a..3c11306 100644 --- a/gdb/gdbserver/nto-low.c +++ b/gdb/gdbserver/nto-low.c @@ -963,7 +963,6 @@ static struct target_ops nto_target_ops = { nto_stopped_data_address, NULL, /* nto_read_offsets */ NULL, /* thread_db_set_tls_address */ - NULL, hostio_last_error_from_errno, NULL, /* nto_qxfer_osdata */ NULL, /* xfer_siginfo */ diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 127cd38..67e8e3e 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1613,22 +1613,6 @@ handle_qxfer_siginfo (const char *annex, return (*the_target->qxfer_siginfo) (annex, readbuf, writebuf, offset, len); } -/* Handle qXfer:spu:read and qXfer:spu:write. */ - -static int -handle_qxfer_spu (const char *annex, - gdb_byte *readbuf, const gdb_byte *writebuf, - ULONGEST offset, LONGEST len) -{ - if (the_target->qxfer_spu == NULL) - return -2; - - if (current_thread == NULL) - return -1; - - return (*the_target->qxfer_spu) (annex, readbuf, writebuf, offset, len); -} - /* Handle qXfer:statictrace:read. */ static int @@ -1985,7 +1969,6 @@ static const struct qxfer qxfer_packets[] = { "libraries-svr4", handle_qxfer_libraries_svr4 }, { "osdata", handle_qxfer_osdata }, { "siginfo", handle_qxfer_siginfo }, - { "spu", handle_qxfer_spu }, { "statictrace", handle_qxfer_statictrace }, { "threads", handle_qxfer_threads }, { "traceframe-info", handle_qxfer_traceframe_info }, @@ -2397,9 +2380,6 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (the_target->read_auxv != NULL) strcat (own_buf, ";qXfer:auxv:read+"); - if (the_target->qxfer_spu != NULL) - strcat (own_buf, ";qXfer:spu:read+;qXfer:spu:write+"); - if (the_target->qxfer_siginfo != NULL) strcat (own_buf, ";qXfer:siginfo:read+;qXfer:siginfo:write+"); diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c deleted file mode 100644 index 4930c59..0000000 --- a/gdb/gdbserver/spu-low.c +++ /dev/null @@ -1,732 +0,0 @@ -/* Low level interface to SPUs, for the remote server for GDB. - Copyright (C) 2006-2019 Free Software Foundation, Inc. - - Contributed by Ulrich Weigand <uweigand@de.ibm.com>. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include "server.h" - -#include "gdbsupport/gdb_wait.h" -#include <sys/ptrace.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/syscall.h> -#include "gdbsupport/filestuff.h" -#include "hostio.h" -#include "nat/fork-inferior.h" - -/* Some older glibc versions do not define this. */ -#ifndef __WNOTHREAD -#define __WNOTHREAD 0x20000000 /* Don't wait on children of other - threads in this group */ -#endif - -#define PTRACE_TYPE_RET long -#define PTRACE_TYPE_ARG3 long - -/* Number of registers. */ -#define SPU_NUM_REGS 130 -#define SPU_NUM_CORE_REGS 128 - -/* Special registers. */ -#define SPU_ID_REGNUM 128 -#define SPU_PC_REGNUM 129 - -/* PPU side system calls. */ -#define INSTR_SC 0x44000002 -#define NR_spu_run 0x0116 - -/* These are used in remote-utils.c. */ -int using_threads = 0; - -/* Defined in auto-generated file reg-spu.c. */ -void init_registers_spu (void); -extern const struct target_desc *tdesc_spu; - -/* Software breakpoint instruction. */ -static const gdb_byte breakpoint[] = { 0x00, 0x00, 0x3f, 0xff }; - -/* Fetch PPU register REGNO. */ -static CORE_ADDR -fetch_ppc_register (int regno) -{ - PTRACE_TYPE_RET res; - - int tid = current_ptid.lwp (); - -#ifndef __powerpc64__ - /* If running as a 32-bit process on a 64-bit system, we attempt - to get the full 64-bit register content of the target process. - If the PPC special ptrace call fails, we're on a 32-bit system; - just fall through to the regular ptrace call in that case. */ - { - char buf[8]; - - errno = 0; - ptrace ((PTRACE_TYPE_ARG1) PPC_PTRACE_PEEKUSR_3264, tid, - (PTRACE_TYPE_ARG3) (regno * 8), buf); - if (errno == 0) - ptrace ((PTRACE_TYPE_ARG1) PPC_PTRACE_PEEKUSR_3264, tid, - (PTRACE_TYPE_ARG3) (regno * 8 + 4), buf + 4); - if (errno == 0) - return (CORE_ADDR) *(unsigned long long *)buf; - } -#endif - - errno = 0; - res = ptrace (PT_READ_U, tid, - (PTRACE_TYPE_ARG3) (regno * sizeof (PTRACE_TYPE_RET)), 0); - if (errno != 0) - { - char mess[128]; - sprintf (mess, "reading PPC register #%d", regno); - perror_with_name (mess); - } - - return (CORE_ADDR) (unsigned long) res; -} - -/* Fetch WORD from PPU memory at (aligned) MEMADDR in thread TID. */ -static int -fetch_ppc_memory_1 (int tid, CORE_ADDR memaddr, PTRACE_TYPE_RET *word) -{ - errno = 0; - -#ifndef __powerpc64__ - if (memaddr >> 32) - { - unsigned long long addr_8 = (unsigned long long) memaddr; - ptrace ((PTRACE_TYPE_ARG1) PPC_PTRACE_PEEKTEXT_3264, tid, - (PTRACE_TYPE_ARG3) &addr_8, word); - } - else -#endif - *word = ptrace (PT_READ_I, tid, (PTRACE_TYPE_ARG3) (size_t) memaddr, 0); - - return errno; -} - -/* Store WORD into PPU memory at (aligned) MEMADDR in thread TID. */ -static int -store_ppc_memory_1 (int tid, CORE_ADDR memaddr, PTRACE_TYPE_RET word) -{ - errno = 0; - -#ifndef __powerpc64__ - if (memaddr >> 32) - { - unsigned long long addr_8 = (unsigned long long) memaddr; - ptrace ((PTRACE_TYPE_ARG1) PPC_PTRACE_POKEDATA_3264, tid, - (PTRACE_TYPE_ARG3) &addr_8, word); - } - else -#endif - ptrace (PT_WRITE_D, tid, (PTRACE_TYPE_ARG3) (size_t) memaddr, word); - - return errno; -} - -/* Fetch LEN bytes of PPU memory at MEMADDR to MYADDR. */ -static int -fetch_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len) -{ - int i, ret; - - CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_TYPE_RET); - int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1) - / sizeof (PTRACE_TYPE_RET)); - PTRACE_TYPE_RET *buffer; - - int tid = current_ptid.lwp (); - - buffer = XALLOCAVEC (PTRACE_TYPE_RET, count); - for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET)) - if ((ret = fetch_ppc_memory_1 (tid, addr, &buffer[i])) != 0) - return ret; - - memcpy (myaddr, - (char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)), - len); - - return 0; -} - -/* Store LEN bytes from MYADDR to PPU memory at MEMADDR. */ -static int -store_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len) -{ - int i, ret; - - CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_TYPE_RET); - int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1) - / sizeof (PTRACE_TYPE_RET)); - PTRACE_TYPE_RET *buffer; - - int tid = current_ptid.lwp (); - - buffer = XALLOCAVEC (PTRACE_TYPE_RET, count); - - if (addr != memaddr || len < (int) sizeof (PTRACE_TYPE_RET)) - if ((ret = fetch_ppc_memory_1 (tid, addr, &buffer[0])) != 0) - return ret; - - if (count > 1) - if ((ret = fetch_ppc_memory_1 (tid, addr + (count - 1) - * sizeof (PTRACE_TYPE_RET), - &buffer[count - 1])) != 0) - return ret; - - memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)), - myaddr, len); - - for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET)) - if ((ret = store_ppc_memory_1 (tid, addr, buffer[i])) != 0) - return ret; - - return 0; -} - - -/* If the PPU thread is currently stopped on a spu_run system call, - return to FD and ADDR the file handle and NPC parameter address - used with the system call. Return non-zero if successful. */ -static int -parse_spufs_run (int *fd, CORE_ADDR *addr) -{ - unsigned int insn; - CORE_ADDR pc = fetch_ppc_register (32); /* nip */ - - /* Fetch instruction preceding current NIP. */ - if (fetch_ppc_memory (pc-4, (char *) &insn, 4) != 0) - return 0; - /* It should be a "sc" instruction. */ - if (insn != INSTR_SC) - return 0; - /* System call number should be NR_spu_run. */ - if (fetch_ppc_register (0) != NR_spu_run) - return 0; - - /* Register 3 contains fd, register 4 the NPC param pointer. */ - *fd = fetch_ppc_register (34); /* orig_gpr3 */ - *addr = fetch_ppc_register (4); - return 1; -} - - -/* Copy LEN bytes at OFFSET in spufs file ANNEX into/from READBUF or WRITEBUF, - using the /proc file system. */ -static int -spu_proc_xfer_spu (const char *annex, unsigned char *readbuf, - const unsigned char *writebuf, - CORE_ADDR offset, int len) -{ - char buf[128]; - int fd = 0; - int ret = -1; - - if (!annex) - return 0; - - sprintf (buf, "/proc/%ld/fd/%s", current_ptid.lwp (), annex); - fd = open (buf, writebuf? O_WRONLY : O_RDONLY); - if (fd <= 0) - return -1; - - if (offset != 0 - && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset) - { - close (fd); - return 0; - } - - if (writebuf) - ret = write (fd, writebuf, (size_t) len); - else if (readbuf) - ret = read (fd, readbuf, (size_t) len); - - close (fd); - return ret; -} - -/* Callback to be used when calling fork_inferior, responsible for - actually initiating the tracing of the inferior. */ - -static void -spu_ptrace_fun () -{ - if (ptrace (PTRACE_TRACEME, 0, 0, 0) < 0) - trace_start_error_with_name ("ptrace"); - if (setpgid (0, 0) < 0) - trace_start_error_with_name ("setpgid"); -} - -/* Start an inferior process and returns its pid. - PROGRAM is the name of the program to be started, and PROGRAM_ARGS - are its arguments. */ - -static int -spu_create_inferior (const char *program, - const std::vector<char *> &program_args) -{ - int pid; - ptid_t ptid; - struct process_info *proc; - std::string str_program_args = stringify_argv (program_args); - - pid = fork_inferior (program, - str_program_args.c_str (), - get_environ ()->envp (), spu_ptrace_fun, - NULL, NULL, NULL, NULL); - - post_fork_inferior (pid, program); - - proc = add_process (pid, 0); - proc->tdesc = tdesc_spu; - - ptid = ptid_t (pid, pid, 0); - add_thread (ptid, NULL); - return pid; -} - -/* Attach to an inferior process. */ -int -spu_attach (unsigned long pid) -{ - ptid_t ptid; - struct process_info *proc; - - if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0) - { - fprintf (stderr, "Cannot attach to process %ld: %s (%d)\n", pid, - strerror (errno), errno); - fflush (stderr); - _exit (0177); - } - - proc = add_process (pid, 1); - proc->tdesc = tdesc_spu; - ptid = ptid_t (pid, pid, 0); - add_thread (ptid, NULL); - return 0; -} - -/* Kill the inferior process. */ -static int -spu_kill (process_info *process) -{ - int status, ret; - int pid = process->pid; - - ptrace (PTRACE_KILL, pid, 0, 0); - - do { - ret = waitpid (pid, &status, 0); - if (WIFEXITED (status) || WIFSIGNALED (status)) - break; - } while (ret != -1 || errno != ECHILD); - - clear_inferiors (); - remove_process (process); - return 0; -} - -/* Detach from inferior process. */ -static int -spu_detach (process_info *process) -{ - ptrace (PTRACE_DETACH, process->pid, 0, 0); - - clear_inferiors (); - remove_process (process); - return 0; -} - -static void -spu_mourn (struct process_info *process) -{ - remove_process (process); -} - -static void -spu_join (int pid) -{ - int status, ret; - - do { - ret = waitpid (pid, &status, 0); - if (WIFEXITED (status) || WIFSIGNALED (status)) - break; - } while (ret != -1 || errno != ECHILD); -} - -/* Return nonzero if the given thread is still alive. */ -static int -spu_thread_alive (ptid_t ptid) -{ - return ptid == current_ptid; -} - -/* Resume process. */ -static void -spu_resume (struct thread_resume *resume_info, size_t n) -{ - struct thread_info *thr = get_first_thread (); - size_t i; - - for (i = 0; i < n; i++) - if (resume_info[i].thread == minus_one_ptid - || resume_info[i].thread == ptid_of (thr)) - break; - - if (i == n) - return; - - /* We don't support hardware single-stepping right now, assume - GDB knows to use software single-stepping. */ - if (resume_info[i].kind == resume_step) - fprintf (stderr, "Hardware single-step not supported.\n"); - - regcache_invalidate (); - - errno = 0; - ptrace (PTRACE_CONT, ptid_of (thr).lwp (), 0, resume_info[i].sig); - if (errno) - perror_with_name ("ptrace"); -} - -/* Wait for process, returns status. */ -static ptid_t -spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options) -{ - int pid = ptid.pid (); - int w; - int ret; - - while (1) - { - ret = waitpid (pid, &w, WNOHANG | __WALL | __WNOTHREAD); - - if (ret == -1) - { - if (errno != ECHILD) - perror_with_name ("waitpid"); - } - else if (ret > 0) - break; - - usleep (1000); - } - - /* On the first wait, continue running the inferior until we are - blocked inside an spu_run system call. */ - if (!server_waiting) - { - int fd; - CORE_ADDR addr; - - while (!parse_spufs_run (&fd, &addr)) - { - ptrace (PT_SYSCALL, pid, (PTRACE_TYPE_ARG3) 0, 0); - waitpid (pid, NULL, __WALL | __WNOTHREAD); - } - } - - if (WIFEXITED (w)) - { - fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w)); - ourstatus->kind = TARGET_WAITKIND_EXITED; - ourstatus->value.integer = WEXITSTATUS (w); - clear_inferiors (); - return ptid_t (ret); - } - else if (!WIFSTOPPED (w)) - { - fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w)); - ourstatus->kind = TARGET_WAITKIND_SIGNALLED; - ourstatus->value.sig = gdb_signal_from_host (WTERMSIG (w)); - clear_inferiors (); - return ptid_t (ret); - } - - /* After attach, we may have received a SIGSTOP. Do not return this - as signal to GDB, or else it will try to continue with SIGSTOP ... */ - if (!server_waiting) - { - ourstatus->kind = TARGET_WAITKIND_STOPPED; - ourstatus->value.sig = GDB_SIGNAL_0; - return ptid_t (ret, ret, 0); - } - - ourstatus->kind = TARGET_WAITKIND_STOPPED; - ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w)); - return ptid_t (ret, ret, 0); -} - -/* Fetch inferior registers. */ -static void -spu_fetch_registers (struct regcache *regcache, int regno) -{ - int fd; - CORE_ADDR addr; - - /* We must be stopped on a spu_run system call. */ - if (!parse_spufs_run (&fd, &addr)) - return; - - /* The ID register holds the spufs file handle. */ - if (regno == -1 || regno == SPU_ID_REGNUM) - supply_register (regcache, SPU_ID_REGNUM, (char *)&fd); - - /* The NPC register is found at ADDR. */ - if (regno == -1 || regno == SPU_PC_REGNUM) - { - char buf[4]; - if (fetch_ppc_memory (addr, buf, 4) == 0) - supply_register (regcache, SPU_PC_REGNUM, buf); - } - - /* The GPRs are found in the "regs" spufs file. */ - if (regno == -1 || (regno >= 0 && regno < SPU_NUM_CORE_REGS)) - { - unsigned char buf[16*SPU_NUM_CORE_REGS]; - char annex[32]; - int i; - - sprintf (annex, "%d/regs", fd); - if (spu_proc_xfer_spu (annex, buf, NULL, 0, sizeof buf) == sizeof buf) - for (i = 0; i < SPU_NUM_CORE_REGS; i++) - supply_register (regcache, i, buf + i*16); - } -} - -/* Store inferior registers. */ -static void -spu_store_registers (struct regcache *regcache, int regno) -{ - int fd; - CORE_ADDR addr; - - /* ??? Some callers use 0 to mean all registers. */ - if (regno == 0) - regno = -1; - - /* We must be stopped on a spu_run system call. */ - if (!parse_spufs_run (&fd, &addr)) - return; - - /* The NPC register is found at ADDR. */ - if (regno == -1 || regno == SPU_PC_REGNUM) - { - char buf[4]; - collect_register (regcache, SPU_PC_REGNUM, buf); - store_ppc_memory (addr, buf, 4); - } - - /* The GPRs are found in the "regs" spufs file. */ - if (regno == -1 || (regno >= 0 && regno < SPU_NUM_CORE_REGS)) - { - unsigned char buf[16*SPU_NUM_CORE_REGS]; - char annex[32]; - int i; - - for (i = 0; i < SPU_NUM_CORE_REGS; i++) - collect_register (regcache, i, buf + i*16); - - sprintf (annex, "%d/regs", fd); - spu_proc_xfer_spu (annex, NULL, buf, 0, sizeof buf); - } -} - -/* Copy LEN bytes from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. */ -static int -spu_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) -{ - int fd, ret; - CORE_ADDR addr; - char annex[32], lslr_annex[32], buf[32]; - CORE_ADDR lslr; - - /* We must be stopped on a spu_run system call. */ - if (!parse_spufs_run (&fd, &addr)) - return 0; - - /* Use the "mem" spufs file to access SPU local store. */ - sprintf (annex, "%d/mem", fd); - ret = spu_proc_xfer_spu (annex, myaddr, NULL, memaddr, len); - if (ret > 0) - return ret == len ? 0 : EIO; - - /* SPU local store access wraps the address around at the - local store limit. We emulate this here. To avoid needing - an extra access to retrieve the LSLR, we only do that after - trying the original address first, and getting end-of-file. */ - sprintf (lslr_annex, "%d/lslr", fd); - memset (buf, 0, sizeof buf); - if (spu_proc_xfer_spu (lslr_annex, (unsigned char *)buf, NULL, - 0, sizeof buf) <= 0) - return ret; - - lslr = strtoul (buf, NULL, 16); - ret = spu_proc_xfer_spu (annex, myaddr, NULL, memaddr & lslr, len); - - return ret == len ? 0 : EIO; -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. - On failure (cannot write the inferior) - returns the value of errno. */ -static int -spu_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len) -{ - int fd, ret; - CORE_ADDR addr; - char annex[32], lslr_annex[32], buf[32]; - CORE_ADDR lslr; - - /* We must be stopped on a spu_run system call. */ - if (!parse_spufs_run (&fd, &addr)) - return 0; - - /* Use the "mem" spufs file to access SPU local store. */ - sprintf (annex, "%d/mem", fd); - ret = spu_proc_xfer_spu (annex, NULL, myaddr, memaddr, len); - if (ret > 0) - return ret == len ? 0 : EIO; - - /* SPU local store access wraps the address around at the - local store limit. We emulate this here. To avoid needing - an extra access to retrieve the LSLR, we only do that after - trying the original address first, and getting end-of-file. */ - sprintf (lslr_annex, "%d/lslr", fd); - memset (buf, 0, sizeof buf); - if (spu_proc_xfer_spu (lslr_annex, (unsigned char *)buf, NULL, - 0, sizeof buf) <= 0) - return ret; - - lslr = strtoul (buf, NULL, 16); - ret = spu_proc_xfer_spu (annex, NULL, myaddr, memaddr & lslr, len); - - return ret == len ? 0 : EIO; -} - -/* Look up special symbols -- unneded here. */ -static void -spu_look_up_symbols (void) -{ -} - -/* Send signal to inferior. */ -static void -spu_request_interrupt (void) -{ - struct thread_info *thr = get_first_thread (); - - syscall (SYS_tkill, lwpid_of (thr), SIGINT); -} - -/* Implementation of the target_ops method "sw_breakpoint_from_kind". */ - -static const gdb_byte * -spu_sw_breakpoint_from_kind (int kind, int *size) -{ - *size = sizeof breakpoint; - return breakpoint; -} - -static struct target_ops spu_target_ops = { - spu_create_inferior, - NULL, /* post_create_inferior */ - spu_attach, - spu_kill, - spu_detach, - spu_mourn, - spu_join, - spu_thread_alive, - spu_resume, - spu_wait, - spu_fetch_registers, - spu_store_registers, - NULL, /* prepare_to_access_memory */ - NULL, /* done_accessing_memory */ - spu_read_memory, - spu_write_memory, - spu_look_up_symbols, - spu_request_interrupt, - NULL, - NULL, /* supports_z_point_type */ - NULL, - NULL, - NULL, /* stopped_by_sw_breakpoint */ - NULL, /* supports_stopped_by_sw_breakpoint */ - NULL, /* stopped_by_hw_breakpoint */ - NULL, /* supports_stopped_by_hw_breakpoint */ - NULL, /* supports_hardware_single_step */ - NULL, - NULL, - NULL, - NULL, - spu_proc_xfer_spu, - hostio_last_error_from_errno, - NULL, /* qxfer_osdata */ - NULL, /* qxfer_siginfo */ - NULL, /* supports_non_stop */ - NULL, /* async */ - NULL, /* start_non_stop */ - NULL, /* supports_multi_process */ - NULL, /* supports_fork_events */ - NULL, /* supports_vfork_events */ - NULL, /* supports_exec_events */ - NULL, /* handle_new_gdb_connection */ - NULL, /* handle_monitor_command */ - NULL, /* core_of_thread */ - NULL, /* read_loadmap */ - NULL, /* process_qsupported */ - NULL, /* supports_tracepoints */ - NULL, /* read_pc */ - NULL, /* write_pc */ - NULL, /* thread_stopped */ - NULL, /* get_tib_address */ - NULL, /* pause_all */ - NULL, /* unpause_all */ - NULL, /* stabilize_threads */ - NULL, /* install_fast_tracepoint_jump_pad */ - NULL, /* emit_ops */ - NULL, /* supports_disable_randomization */ - NULL, /* get_min_fast_tracepoint_insn_len */ - NULL, /* qxfer_libraries_svr4 */ - NULL, /* support_agent */ - NULL, /* enable_btrace */ - NULL, /* disable_btrace */ - NULL, /* read_btrace */ - NULL, /* read_btrace_conf */ - NULL, /* supports_range_stepping */ - NULL, /* pid_to_exec_file */ - NULL, /* multifs_open */ - NULL, /* multifs_unlink */ - NULL, /* multifs_readlink */ - NULL, /* breakpoint_kind_from_pc */ - spu_sw_breakpoint_from_kind, -}; - -void -initialize_low (void) -{ - set_target_ops (&spu_target_ops); - init_registers_spu (); -} diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 67167cc..2df135a 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -256,10 +256,6 @@ struct target_ops int (*get_tls_address) (struct thread_info *thread, CORE_ADDR offset, CORE_ADDR load_module, CORE_ADDR *address); - /* Read/Write from/to spufs using qXfer packets. */ - int (*qxfer_spu) (const char *annex, unsigned char *readbuf, - unsigned const char *writebuf, CORE_ADDR offset, int len); - /* Fill BUF with an hostio error packet representing the last hostio error. */ void (*hostio_last_error) (char *buf); diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index 49c6cf1..7088ba4 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -1809,7 +1809,6 @@ static struct target_ops win32_target_ops = { win32_stopped_data_address, NULL, /* read_offsets */ NULL, /* get_tls_address */ - NULL, /* qxfer_spu */ #ifdef _WIN32_WCE wince_hostio_last_error, #else |