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 | |
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.
108 files changed, 189 insertions, 11285 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index adaa123..9c8ceba 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,89 @@ +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. + 2019-09-20 Tom Tromey <tom@tromey.com> * NEWS: Mention case-sensitivity of TUI commands. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index fd24cb7..3efcb71 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -319,9 +319,6 @@ the native maintainer when resolving ABI issues. sparc --target=sparc64-solaris2.10 ,-Werror (--target=sparc-elf broken) - spu --target=spu-elf ,-Werror - Ulrich Weigand uweigand@de.ibm.com - tic6x --target=tic6x-elf ,-Werror Yao Qi qiyao@sourceware.org diff --git a/gdb/Makefile.in b/gdb/Makefile.in index e7e26a4..877a9cc 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -776,7 +776,6 @@ ALL_TARGET_OBS = \ solib-darwin.o \ solib-dsbt.o \ solib-frv.o \ - solib-spu.o \ solib-svr4.o \ sparc-linux-tdep.o \ sparc-nbsd-tdep.o \ @@ -784,8 +783,6 @@ ALL_TARGET_OBS = \ sparc-ravenscar-thread.o \ sparc-sol2-tdep.o \ sparc-tdep.o \ - spu-multiarch.o \ - spu-tdep.o \ symfile-mem.o \ tic6x-linux-tdep.o \ tic6x-tdep.o \ @@ -1382,7 +1379,6 @@ HFILES_NO_SRCDIR = \ solib.h \ solib-aix.h \ solib-darwin.h \ - solib-spu.h \ solib-svr4.h \ solib-target.h \ solist.h \ @@ -1392,7 +1388,6 @@ HFILES_NO_SRCDIR = \ sparc-ravenscar-thread.h \ sparc-tdep.h \ sparc64-tdep.h \ - spu-tdep.h \ stabsread.h \ stack.h \ stap-probe.h \ @@ -2304,7 +2299,6 @@ ALLDEPFILES = \ sh-tdep.c \ sol2-tdep.c \ solib-aix.c \ - solib-spu.c \ solib-svr4.c \ sparc-linux-nat.c \ sparc-linux-tdep.c \ @@ -2327,9 +2321,6 @@ ALLDEPFILES = \ sparc64-obsd-tdep.c \ sparc64-sol2-tdep.c \ sparc64-tdep.c \ - spu-linux-nat.c \ - spu-multiarch.c \ - spu-tdep.c \ tilegx-linux-nat.c \ tilegx-linux-tdep.c \ tilegx-tdep.c \ @@ -330,6 +330,12 @@ focus, winheight, +, -, >, < from .inputrc to bind keys in this keymap. This feature is only available when gdb is built against GNU readline 8.0 or later. +* Removed targets and native configurations + + GDB no longer supports debugging the Cell Broadband Engine. This includes + both debugging standalone Cell/B.E. SPU applications and integrated debugging + of Cell/B.E. applications that use both the PPU and SPU architectures. + *** Changes in GDB 8.3 * GDB and GDBserver now support access to additional registers on diff --git a/gdb/arch/ppc-linux-common.c b/gdb/arch/ppc-linux-common.c index 8af30e3..20b3580 100644 --- a/gdb/arch/ppc-linux-common.c +++ b/gdb/arch/ppc-linux-common.c @@ -50,9 +50,7 @@ ppc_linux_match_description (struct ppc_linux_features features) if (features.wordsize == 8) { - if (features.cell) - tdesc = tdesc_powerpc_cell64l; - else if (features.vsx) + if (features.vsx) tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx64l : features.isa207? tdesc_powerpc_isa207_vsx64l : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l @@ -69,9 +67,7 @@ ppc_linux_match_description (struct ppc_linux_features features) { gdb_assert (features.wordsize == 4); - if (features.cell) - tdesc = tdesc_powerpc_cell32l; - else if (features.vsx) + if (features.vsx) tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx32l : features.isa207? tdesc_powerpc_isa207_vsx32l : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l diff --git a/gdb/arch/ppc-linux-common.h b/gdb/arch/ppc-linux-common.h index fe332ac..1f91ff0 100644 --- a/gdb/arch/ppc-linux-common.h +++ b/gdb/arch/ppc-linux-common.h @@ -58,7 +58,6 @@ struct ppc_linux_features bool ppr_dscr; bool isa207; bool htm; - bool cell; }; /* Base value for ppc_linux_features variables. */ @@ -70,7 +69,6 @@ const struct ppc_linux_features ppc_linux_no_features = { false, false, false, - false, }; /* Return a target description that matches FEATURES. */ diff --git a/gdb/arch/ppc-linux-tdesc.h b/gdb/arch/ppc-linux-tdesc.h index 5c9242f..5014131 100644 --- a/gdb/arch/ppc-linux-tdesc.h +++ b/gdb/arch/ppc-linux-tdesc.h @@ -24,7 +24,6 @@ struct target_desc; extern struct target_desc *tdesc_powerpc_32l; extern struct target_desc *tdesc_powerpc_altivec32l; -extern struct target_desc *tdesc_powerpc_cell32l; extern struct target_desc *tdesc_powerpc_vsx32l; extern struct target_desc *tdesc_powerpc_isa205_32l; extern struct target_desc *tdesc_powerpc_isa205_altivec32l; @@ -36,7 +35,6 @@ extern struct target_desc *tdesc_powerpc_e500l; extern struct target_desc *tdesc_powerpc_64l; extern struct target_desc *tdesc_powerpc_altivec64l; -extern struct target_desc *tdesc_powerpc_cell64l; extern struct target_desc *tdesc_powerpc_vsx64l; extern struct target_desc *tdesc_powerpc_isa205_64l; extern struct target_desc *tdesc_powerpc_isa205_altivec64l; diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 12fb082..7608218 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -199,8 +199,6 @@ @V@/gdb/features/rs6000/powerpc-vsx32l.c @V@/gdb/features/rs6000/ppc-v32l.c @V@/gdb/features/rs6000/powerpc-vsx64.c @V@/gdb/features/rs6000/ppc-v64.c @V@/gdb/features/rs6000/powerpc-vsx64l.c @V@/gdb/features/rs6000/ppc-v64l.c -@V@/gdb/features/rs6000/powerpc-cell32l.c @V@/gdb/features/rs6000/ppc-c32l.c -@V@/gdb/features/rs6000/powerpc-cell64l.c @V@/gdb/features/rs6000/ppc-c64l.c @V@/gdb/features/rs6000/powerpc-32.xml @V@/gdb/features/rs6000/ppc-32.xml @V@/gdb/features/rs6000/powerpc-32l.xml @V@/gdb/features/rs6000/ppc-32l.xml @V@/gdb/features/rs6000/powerpc-403.xml @V@/gdb/features/rs6000/ppc-403.xml @@ -231,8 +229,6 @@ @V@/gdb/features/rs6000/powerpc-vsx32l.xml @V@/gdb/features/rs6000/ppc-v32l.xml @V@/gdb/features/rs6000/powerpc-vsx64.xml @V@/gdb/features/rs6000/ppc-v64.xml @V@/gdb/features/rs6000/powerpc-vsx64l.xml @V@/gdb/features/rs6000/ppc-v64l.xml -@V@/gdb/features/rs6000/powerpc-cell32l.xml @V@/gdb/features/rs6000/ppc-c32l.xml -@V@/gdb/features/rs6000/powerpc-cell64l.xml @V@/gdb/features/rs6000/ppc-c64l.xml @V@/gdb/features/i386/amd64-avx-linux.c @V@/gdb/features/i386/a64-al.c @V@/gdb/features/i386/amd64-avx.c @V@/gdb/features/i386/a64-a.c @V@/gdb/features/i386/amd64-avx-linux.xml @V@/gdb/features/i386/a64-al.xml @@ -356,8 +352,6 @@ @V@/gdb/regformats/rs6000/powerpc-isa205-vsx64l.dat @V@/gdb/regformats/rs6000/ppciv64l.dat @V@/gdb/regformats/rs6000/powerpc-vsx32l.dat @V@/gdb/regformats/rs6000/ppc-v32l.dat @V@/gdb/regformats/rs6000/powerpc-vsx64l.dat @V@/gdb/regformats/rs6000/ppc-v64l.dat -@V@/gdb/regformats/rs6000/powerpc-cell32l.dat @V@/gdb/regformats/rs6000/ppc-c32l.dat -@V@/gdb/regformats/rs6000/powerpc-cell64l.dat @V@/gdb/regformats/rs6000/ppc-c64l.dat @V@/gdb/regformats/tic6x-c62x.dat @V@/gdb/regformats/c6x-62x.dat @V@/gdb/regformats/tic6x-c64x.dat @V@/gdb/regformats/c6x-64x.dat @V@/gdb/regformats/tic6x-c64xp.dat @V@/gdb/regformats/c6xc64xp.dat @@ -452,9 +446,6 @@ @V@/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp @V@/gdb/testsuite/gdb.base/wpcondg.exp @V@/gdb/testsuite/gdb.base/watchpoint-cond-gone.c @V@/gdb/testsuite/gdb.base/wpcondg.c @V@/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c @V@/gdb/testsuite/gdb.base/wpcondgs.c -@V@/gdb/testsuite/gdb.cell/coremaker-spu.c @V@/gdb/testsuite/gdb.cell/core-spu.c -@V@/gdb/testsuite/gdb.cell/ea-cache-spu.c @V@/gdb/testsuite/gdb.cell/ea-spu.c -@V@/gdb/testsuite/gdb.cell/mem-access-spu.c @V@/gdb/testsuite/gdb.cell/mem-spu.c @V@/gdb/testsuite/gdb.cp/m-static1.cc @V@/gdb/testsuite/gdb.cp/m-stat1.cc @V@/gdb/testsuite/gdb.cp/namespace1.cc @V@/gdb/testsuite/gdb.cp/namesp1.cc @V@/gdb/testsuite/gdb.cp/namespace-nested-import.cc @V@/gdb/testsuite/gdb.cp/nnested.cc diff --git a/gdb/configure.host b/gdb/configure.host index c87f997..f382cad 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -140,13 +140,7 @@ powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu) gdb_host=nbsd ;; powerpc-*-openbsd*) gdb_host=obsd ;; -powerpc64*-*-linux*) gdb_host=ppc64-linux - # Support 'pseudo-native' debugging on the Cell BE - if test "${target_cpu}" = "spu"; then - gdb_host=spu-linux - gdb_native=yes - fi - ;; +powerpc64*-*-linux*) gdb_host=ppc64-linux ;; powerpc*-*-linux*) gdb_host=linux ;; riscv*-*-freebsd*) gdb_host=fbsd ;; diff --git a/gdb/configure.nat b/gdb/configure.nat index 64ee101..77a2ee8 100644 --- a/gdb/configure.nat +++ b/gdb/configure.nat @@ -484,21 +484,4 @@ case ${gdb_host} in ;; esac ;; - spu-linux) - case ${gdb_host_cpu} in - powerpc) - # Target: Cell BE (PowerPC64 + SPU) - # This implements a 'pseudo-native' GDB running on the - # PPU side of the Cell BE and debugging the SPU side. - NAT_FILE= - NAT_CDEPS= - LOADLIBES= - NATDEPFILES='spu-linux-nat.o \ - inf-ptrace.o fork-child.o nat/fork-inferior.o \ - nat/linux-procfs.o nat/linux-ptrace.o \ - nat/linux-waitpid.o \ - nat/linux-personality.o nat/linux-namespaces.o' - ;; - esac - ;; esac diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 7c0215e..2edfe3b 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -514,8 +514,7 @@ powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) powerpc*-*-linux*) # Target: PowerPC running Linux gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o \ - ppc64-tdep.o solib-svr4.o solib-spu.o \ - spu-multiarch.o \ + ppc64-tdep.o solib-svr4.o \ glibc-tdep.o symfile-mem.o linux-tdep.o \ ravenscar-thread.o ppc-ravenscar-thread.o \ linux-record.o \ @@ -668,12 +667,6 @@ sparc64-*-*) ravenscar-thread.o sparc-ravenscar-thread.o" ;; -spu*-*-*) - # Target: Cell BE SPU - gdb_target_obs="spu-tdep.o" - build_gdbserver=yes - ;; - s12z-*-*) # Target: Freescale S12z gdb_target_obs="s12z-tdep.o" diff --git a/gdb/corelow.c b/gdb/corelow.c index b30b91b..cea9210 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -709,36 +709,6 @@ core_target::files_info () print_section_info (&m_core_section_table, core_bfd); } -struct spuid_list -{ - gdb_byte *buf; - ULONGEST offset; - LONGEST len; - ULONGEST pos; - ULONGEST written; -}; - -static void -add_to_spuid_list (bfd *abfd, asection *asect, void *list_p) -{ - struct spuid_list *list = (struct spuid_list *) list_p; - enum bfd_endian byte_order - = bfd_big_endian (abfd) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; - int fd, pos = 0; - - sscanf (bfd_section_name (asect), "SPU/%d/regs%n", &fd, &pos); - if (pos == 0) - return; - - if (list->pos >= list->offset && list->pos + 4 <= list->offset + list->len) - { - store_unsigned_integer (list->buf + list->pos - list->offset, - 4, byte_order, fd); - list->written += 4; - } - list->pos += 4; -} - enum target_xfer_status core_target::xfer_partial (enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, @@ -865,64 +835,6 @@ core_target::xfer_partial (enum target_object object, const char *annex, } /* FALL THROUGH */ - 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 (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; - case TARGET_OBJECT_SIGNAL_INFO: if (readbuf) { diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 8eaaab3..0a10fa3 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +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. + 2019-09-18 Tom Tromey <tom@tromey.com> * gdb.texinfo (Editing): Document readline application name. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a129ea0..f2713c0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -22563,14 +22563,6 @@ are: @tab @code{qXfer:sdata:read} @tab @code{print $_sdata} -@item @code{read-spu-object} -@tab @code{qXfer:spu:read} -@tab @code{info spu} - -@item @code{write-spu-object} -@tab @code{qXfer:spu:write} -@tab @code{info spu} - @item @code{read-siginfo-object} @tab @code{qXfer:siginfo:read} @tab @code{print $_siginfo} @@ -24438,7 +24430,6 @@ all uses of @value{GDBN} with the architecture, both native and cross. * Alpha:: * MIPS:: * HPPA:: HP PA architecture -* SPU:: Cell Broadband Engine SPU architecture * PowerPC:: * Nios II:: * Sparc64:: @@ -24753,69 +24744,6 @@ given @var{address}. @end table -@node SPU -@subsection Cell Broadband Engine SPU architecture -@cindex Cell Broadband Engine -@cindex SPU - -When @value{GDBN} is debugging the Cell Broadband Engine SPU architecture, -it provides the following special commands: - -@table @code -@item info spu event -@kindex info spu -Display SPU event facility status. Shows current event mask -and pending event status. - -@item info spu signal -Display SPU signal notification facility status. Shows pending -signal-control word and signal notification mode of both signal -notification channels. - -@item info spu mailbox -Display SPU mailbox facility status. Shows all pending entries, -in order of processing, in each of the SPU Write Outbound, -SPU Write Outbound Interrupt, and SPU Read Inbound mailboxes. - -@item info spu dma -Display MFC DMA status. Shows all pending commands in the MFC -DMA queue. For each entry, opcode, tag, class IDs, effective -and local store addresses and transfer size are shown. - -@item info spu proxydma -Display MFC Proxy-DMA status. Shows all pending commands in the MFC -Proxy-DMA queue. For each entry, opcode, tag, class IDs, effective -and local store addresses and transfer size are shown. - -@end table - -When @value{GDBN} is debugging a combined PowerPC/SPU application -on the Cell Broadband Engine, it provides in addition the following -special commands: - -@table @code -@item set spu stop-on-load @var{arg} -@kindex set spu -Set whether to stop for new SPE threads. When set to @code{on}, @value{GDBN} -will give control to the user when a new SPE thread enters its @code{main} -function. The default is @code{off}. - -@item show spu stop-on-load -@kindex show spu -Show whether to stop for new SPE threads. - -@item set spu auto-flush-cache @var{arg} -Set whether to automatically flush the software-managed cache. When set to -@code{on}, @value{GDBN} will automatically cause the SPE software-managed -cache to be flushed whenever SPE execution stops. This provides a consistent -view of PowerPC memory that is accessed via the cache. If an application -does not use the software-managed cache, this option has no effect. - -@item show spu auto-flush-cache -Show whether to automatically flush the software-managed cache. - -@end table - @node PowerPC @subsection PowerPC @cindex PowerPC architecture @@ -40110,16 +40038,6 @@ These are the currently defined stub features and their properties: @tab @samp{-} @tab Yes -@item @samp{qXfer:spu:read} -@tab No -@tab @samp{-} -@tab Yes - -@item @samp{qXfer:spu:write} -@tab No -@tab @samp{-} -@tab Yes - @item @samp{qXfer:siginfo:read} @tab No @tab @samp{-} @@ -40352,14 +40270,6 @@ The remote stub understands the @samp{qXfer:memory-map:read} packet The remote stub understands the @samp{qXfer:sdata:read} packet (@pxref{qXfer sdata read}). -@item qXfer:spu:read -The remote stub understands the @samp{qXfer:spu:read} packet -(@pxref{qXfer spu read}). - -@item qXfer:spu:write -The remote stub understands the @samp{qXfer:spu:write} packet -(@pxref{qXfer spu write}). - @item qXfer:siginfo:read The remote stub understands the @samp{qXfer:siginfo:read} packet (@pxref{qXfer siginfo read}). @@ -40805,18 +40715,6 @@ This packet is not probed by default; the remote stub must request it, by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}). -@item qXfer:spu:read:@var{annex}:@var{offset},@var{length} -@anchor{qXfer spu read} -Read contents of an @code{spufs} file on the target system. The -annex specifies which file to read; it must be of the form -@file{@var{id}/@var{name}}, where @var{id} specifies an SPU context ID -in the target process, and @var{name} identifes the @code{spufs} file -in that context to be accessed. - -This packet is not probed by default; the remote stub must request it, -by supplying an appropriate @samp{qSupported} response -(@pxref{qSupported}). - @item qXfer:threads:read::@var{offset},@var{length} @anchor{qXfer threads read} Access the list of threads on target. @xref{Thread List Format}. The @@ -40902,17 +40800,6 @@ empty (@pxref{qXfer write}). This packet is not probed by default; the remote stub must request it, by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}). - -@item qXfer:spu:write:@var{annex}:@var{offset}:@var{data}@dots{} -@anchor{qXfer spu write} -Write @var{data} to an @code{spufs} file on the target system. The -annex specifies which file to write; it must be of the form -@file{@var{id}/@var{name}}, where @var{id} specifies an SPU context ID -in the target process, and @var{name} identifes the @code{spufs} file -in that context to be accessed. - -This packet is not probed by default; the remote stub must request it, -by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}). @end table @item qXfer:@var{object}:@var{operation}:@dots{} diff --git a/gdb/features/Makefile b/gdb/features/Makefile index 2b65d46..52318d4 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -53,7 +53,7 @@ WHICH = arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \ rs6000/powerpc-32 \ rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \ rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \ - rs6000/powerpc-vsx64l rs6000/powerpc-cell32l rs6000/powerpc-cell64l \ + rs6000/powerpc-vsx64l \ rs6000/powerpc-isa205-32l rs6000/powerpc-isa205-64l \ rs6000/powerpc-isa205-altivec32l rs6000/powerpc-isa205-altivec64l \ rs6000/powerpc-isa205-vsx32l rs6000/powerpc-isa205-vsx64l \ @@ -84,8 +84,6 @@ microblaze-expedite = r1,rpc nios2-linux-expedite = sp,pc or1k-expedite = r1,npc powerpc-expedite = r1,pc -rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4 -rs6000/powerpc-cell64l-expedite = r1,pc,r0,orig_r3,r4 s390-linux32-expedite = r14,r15,pswa s390-linux32v1-expedite = r14,r15,pswa s390-linux32v2-expedite = r14,r15,pswa @@ -140,8 +138,6 @@ XMLTOC = \ rs6000/powerpc-altivec32l.xml \ rs6000/powerpc-altivec64.xml \ rs6000/powerpc-altivec64l.xml \ - rs6000/powerpc-cell32l.xml \ - rs6000/powerpc-cell64l.xml \ rs6000/powerpc-e500.xml \ rs6000/powerpc-e500l.xml \ rs6000/powerpc-isa205-32l.xml \ diff --git a/gdb/features/rs6000/powerpc-cell32l.c b/gdb/features/rs6000/powerpc-cell32l.c deleted file mode 100644 index 74c42f9..0000000 --- a/gdb/features/rs6000/powerpc-cell32l.c +++ /dev/null @@ -1,162 +0,0 @@ -/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: - Original: powerpc-cell32l.xml */ - -#include "defs.h" -#include "osabi.h" -#include "target-descriptions.h" - -struct target_desc *tdesc_powerpc_cell32l; -static void -initialize_tdesc_powerpc_cell32l (void) -{ - struct target_desc *result = allocate_target_description (); - set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common")); - - tdesc_add_compatible (result, bfd_scan_arch ("spu:256K")); - - struct tdesc_feature *feature; - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.core"); - tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "pc", 64, 1, NULL, 32, "code_ptr"); - tdesc_create_reg (feature, "msr", 65, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "lr", 67, 1, NULL, 32, "code_ptr"); - tdesc_create_reg (feature, "ctr", 68, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu"); - tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux"); - tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 32, "int"); - tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - tdesc_type *element_type; - element_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", element_type, 4); - - element_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", element_type, 4); - - element_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", element_type, 8); - - element_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", element_type, 16); - - tdesc_type_with_fields *type_with_fields; - type_with_fields = tdesc_create_union (feature, "vec128"); - tdesc_type *field_type; - field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type_with_fields, "uint128", field_type); - field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type_with_fields, "v4_float", field_type); - field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type_with_fields, "v4_int32", field_type); - field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type_with_fields, "v8_int16", field_type); - field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type_with_fields, "v16_int8", field_type); - - tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int"); - tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int"); - - tdesc_powerpc_cell32l = result; -} diff --git a/gdb/features/rs6000/powerpc-cell32l.xml b/gdb/features/rs6000/powerpc-cell32l.xml deleted file mode 100644 index 57b4806..0000000 --- a/gdb/features/rs6000/powerpc-cell32l.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<!-- Copyright (C) 2009-2019 Free Software Foundation, Inc. - - Copying and distribution of this file, with or without modification, - are permitted in any medium without royalty provided the copyright - notice and this notice are preserved. --> - -<!-- Cell/B.E. architecture. Identical to the PowerPC 32-bit Linux UISA, - but adds support for the SPU as compatible architecture. --> - -<!DOCTYPE target SYSTEM "gdb-target.dtd"> -<target> - <architecture>powerpc:common</architecture> - <compatible>spu</compatible> - <xi:include href="power-core.xml"/> - <xi:include href="power-fpu.xml"/> - <xi:include href="power-linux.xml"/> - <xi:include href="power-altivec.xml"/> -</target> diff --git a/gdb/features/rs6000/powerpc-cell64l.c b/gdb/features/rs6000/powerpc-cell64l.c deleted file mode 100644 index cbfda4c..0000000 --- a/gdb/features/rs6000/powerpc-cell64l.c +++ /dev/null @@ -1,162 +0,0 @@ -/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: - Original: powerpc-cell64l.xml */ - -#include "defs.h" -#include "osabi.h" -#include "target-descriptions.h" - -struct target_desc *tdesc_powerpc_cell64l; -static void -initialize_tdesc_powerpc_cell64l (void) -{ - struct target_desc *result = allocate_target_description (); - set_tdesc_architecture (result, bfd_scan_arch ("powerpc:common64")); - - tdesc_add_compatible (result, bfd_scan_arch ("spu:256K")); - - struct tdesc_feature *feature; - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.core"); - tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "pc", 64, 1, NULL, 64, "code_ptr"); - tdesc_create_reg (feature, "msr", 65, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "cr", 66, 1, NULL, 32, "uint32"); - tdesc_create_reg (feature, "lr", 67, 1, NULL, 64, "code_ptr"); - tdesc_create_reg (feature, "ctr", 68, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "xer", 69, 1, NULL, 32, "uint32"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.fpu"); - tdesc_create_reg (feature, "f0", 32, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f1", 33, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f2", 34, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f3", 35, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f4", 36, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f5", 37, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f6", 38, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f7", 39, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f8", 40, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f9", 41, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f10", 42, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f11", 43, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f12", 44, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f13", 45, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f14", 46, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f15", 47, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f16", 48, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f17", 49, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f18", 50, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f19", 51, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f20", 52, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f21", 53, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f22", 54, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f23", 55, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f24", 56, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f25", 57, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f26", 58, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f27", 59, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f28", 60, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f29", 61, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f30", 62, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "f31", 63, 1, NULL, 64, "ieee_double"); - tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.linux"); - tdesc_create_reg (feature, "orig_r3", 71, 1, NULL, 64, "int"); - tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.power.altivec"); - tdesc_type *element_type; - element_type = tdesc_named_type (feature, "ieee_single"); - tdesc_create_vector (feature, "v4f", element_type, 4); - - element_type = tdesc_named_type (feature, "int32"); - tdesc_create_vector (feature, "v4i32", element_type, 4); - - element_type = tdesc_named_type (feature, "int16"); - tdesc_create_vector (feature, "v8i16", element_type, 8); - - element_type = tdesc_named_type (feature, "int8"); - tdesc_create_vector (feature, "v16i8", element_type, 16); - - tdesc_type_with_fields *type_with_fields; - type_with_fields = tdesc_create_union (feature, "vec128"); - tdesc_type *field_type; - field_type = tdesc_named_type (feature, "uint128"); - tdesc_add_field (type_with_fields, "uint128", field_type); - field_type = tdesc_named_type (feature, "v4f"); - tdesc_add_field (type_with_fields, "v4_float", field_type); - field_type = tdesc_named_type (feature, "v4i32"); - tdesc_add_field (type_with_fields, "v4_int32", field_type); - field_type = tdesc_named_type (feature, "v8i16"); - tdesc_add_field (type_with_fields, "v8_int16", field_type); - field_type = tdesc_named_type (feature, "v16i8"); - tdesc_add_field (type_with_fields, "v16_int8", field_type); - - tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr1", 74, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr2", 75, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr3", 76, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr4", 77, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr5", 78, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr6", 79, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr7", 80, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr8", 81, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr9", 82, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr10", 83, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr11", 84, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr12", 85, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr13", 86, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr14", 87, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr15", 88, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr16", 89, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr17", 90, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr18", 91, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr19", 92, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr20", 93, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr21", 94, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr22", 95, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr23", 96, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr24", 97, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr25", 98, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr26", 99, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr27", 100, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr28", 101, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr29", 102, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr30", 103, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vr31", 104, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "vscr", 105, 1, "vector", 32, "int"); - tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int"); - - tdesc_powerpc_cell64l = result; -} diff --git a/gdb/features/rs6000/powerpc-cell64l.xml b/gdb/features/rs6000/powerpc-cell64l.xml deleted file mode 100644 index c2add44..0000000 --- a/gdb/features/rs6000/powerpc-cell64l.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<!-- Copyright (C) 2009-2019 Free Software Foundation, Inc. - - Copying and distribution of this file, with or without modification, - are permitted in any medium without royalty provided the copyright - notice and this notice are preserved. --> - -<!-- Cell/B.E. architecture. Identical to the PowerPC 64-bit Linux UISA, - but adds support for the SPU as compatible architecture. --> - -<!DOCTYPE target SYSTEM "gdb-target.dtd"> -<target> - <architecture>powerpc:common64</architecture> - <compatible>spu</compatible> - <xi:include href="power64-core.xml"/> - <xi:include href="power-fpu.xml"/> - <xi:include href="power64-linux.xml"/> - <xi:include href="power-altivec.xml"/> -</target> 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 diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 945c19f..cd5cf18 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -68,10 +68,6 @@ #include "gdbsupport/fileio.h" #include "gdbsupport/scope-exit.h" -#ifndef SPUFS_MAGIC -#define SPUFS_MAGIC 0x23c9b64e -#endif - /* This comment documents high-level logic of this file. Waiting for events in sync mode @@ -3842,12 +3838,6 @@ linux_nat_xfer_osdata (enum target_object object, ULONGEST *xfered_len); static enum target_xfer_status -linux_proc_xfer_spu (enum target_object object, - const char *annex, gdb_byte *readbuf, - const gdb_byte *writebuf, - ULONGEST offset, ULONGEST len, ULONGEST *xfered_len); - -static enum target_xfer_status linux_proc_xfer_partial (enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, @@ -3879,10 +3869,6 @@ linux_nat_target::xfer_partial (enum target_object object, return linux_nat_xfer_osdata (object, annex, readbuf, writebuf, offset, len, xfered_len); - if (object == TARGET_OBJECT_SPU) - return linux_proc_xfer_spu (object, annex, readbuf, writebuf, - offset, len, xfered_len); - /* GDB calculates all addresses in the largest possible address width. The address width must be masked before its final use - either by @@ -4020,121 +4006,6 @@ linux_proc_xfer_partial (enum target_object object, } -/* Enumerate spufs IDs for process PID. */ -static LONGEST -spu_enumerate_spu_ids (int pid, gdb_byte *buf, ULONGEST offset, ULONGEST len) -{ - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - LONGEST pos = 0; - LONGEST written = 0; - char path[128]; - DIR *dir; - struct dirent *entry; - - xsnprintf (path, sizeof path, "/proc/%d/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; - - xsnprintf (path, sizeof path, "/proc/%d/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) - { - store_unsigned_integer (buf + pos - offset, 4, byte_order, fd); - written += 4; - } - pos += 4; - } - - closedir (dir); - return written; -} - -/* Implement the to_xfer_partial interface for the TARGET_OBJECT_SPU - object type, using the /proc file system. */ - -static enum target_xfer_status -linux_proc_xfer_spu (enum target_object object, - const char *annex, gdb_byte *readbuf, - const gdb_byte *writebuf, - ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) -{ - char buf[128]; - int fd = 0; - int ret = -1; - int pid = inferior_ptid.lwp (); - - if (!annex) - { - if (!readbuf) - return TARGET_XFER_E_IO; - else - { - LONGEST l = spu_enumerate_spu_ids (pid, readbuf, offset, len); - - if (l < 0) - return TARGET_XFER_E_IO; - else if (l == 0) - return TARGET_XFER_EOF; - else - { - *xfered_len = (ULONGEST) l; - return TARGET_XFER_OK; - } - } - } - - xsnprintf (buf, sizeof buf, "/proc/%d/fd/%s", pid, annex); - fd = gdb_open_cloexec (buf, writebuf? O_WRONLY : O_RDONLY, 0); - if (fd <= 0) - return TARGET_XFER_E_IO; - - if (offset != 0 - && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset) - { - close (fd); - return TARGET_XFER_EOF; - } - - if (writebuf) - ret = write (fd, writebuf, (size_t) len); - else if (readbuf) - ret = read (fd, readbuf, (size_t) len); - - close (fd); - - if (ret < 0) - return TARGET_XFER_E_IO; - else if (ret == 0) - return TARGET_XFER_EOF; - else - { - *xfered_len = (ULONGEST) ret; - return TARGET_XFER_OK; - } -} - - /* Parse LINE as a signal set and add its set bits to SIGS. */ static void diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 63a9bd3..567b01c 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1413,73 +1413,6 @@ find_signalled_thread (struct thread_info *info, void *data) return 0; } -/* Generate corefile notes for SPU contexts. */ - -static char * -linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size) -{ - static const char *spu_files[] = - { - "object-id", - "mem", - "regs", - "fpcr", - "lslr", - "decr", - "decr_status", - "signal1", - "signal1_type", - "signal2", - "signal2_type", - "event_mask", - "event_status", - "mbox_info", - "ibox_info", - "wbox_info", - "dma_info", - "proxydma_info", - }; - - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - - /* Determine list of SPU ids. */ - gdb::optional<gdb::byte_vector> - spu_ids = target_read_alloc (current_top_target (), - TARGET_OBJECT_SPU, NULL); - - if (!spu_ids) - return note_data; - - /* Generate corefile notes for each SPU file. */ - for (size_t i = 0; i < spu_ids->size (); i += 4) - { - int fd = extract_unsigned_integer (spu_ids->data () + i, 4, byte_order); - - for (size_t j = 0; j < sizeof (spu_files) / sizeof (spu_files[0]); j++) - { - char annex[32], note_name[32]; - - xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[j]); - gdb::optional<gdb::byte_vector> spu_data - = target_read_alloc (current_top_target (), TARGET_OBJECT_SPU, annex); - - if (spu_data && !spu_data->empty ()) - { - xsnprintf (note_name, sizeof note_name, "SPU/%s", annex); - note_data = elfcore_write_note (obfd, note_data, note_size, - note_name, NT_SPU, - spu_data->data (), - spu_data->size ()); - - if (!note_data) - return nullptr; - } - } - } - - return note_data; -} - /* This is used to pass information from linux_make_mappings_corefile_notes through linux_find_memory_regions_full. */ @@ -2008,11 +1941,6 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) return NULL; } - /* SPU information. */ - note_data = linux_spu_make_corefile_notes (obfd, note_data, note_size); - if (!note_data) - return NULL; - /* File mappings. */ note_data = linux_make_mappings_corefile_notes (gdbarch, obfd, note_data, note_size); diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h index f1561b3..508395c 100644 --- a/gdb/nat/ppc-linux.h +++ b/gdb/nat/ppc-linux.h @@ -33,9 +33,6 @@ If they aren't, we can provide them ourselves (their values are fixed because they are part of the kernel ABI). They are used in the AT_HWCAP entry of the AUXV. */ -#ifndef PPC_FEATURE_CELL -#define PPC_FEATURE_CELL 0x00010000 -#endif #ifndef PPC_FEATURE_BOOKE #define PPC_FEATURE_BOOKE 0x00008000 #endif diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index deb31d4..53406f6 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -2646,9 +2646,6 @@ ppc_linux_nat_target::read_description () perror_with_name (_("Unable to fetch AltiVec registers")); } - if (hwcap & PPC_FEATURE_CELL) - features.cell = true; - features.isa205 = ppc_linux_has_isa205 (hwcap); if ((hwcap2 & PPC_FEATURE2_DSCR) diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index c6181c9..ce3c727 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -31,7 +31,6 @@ #include "osabi.h" #include "regset.h" #include "solib-svr4.h" -#include "solib-spu.h" #include "solib.h" #include "solist.h" #include "ppc-tdep.h" @@ -48,7 +47,6 @@ #include "elf/common.h" #include "elf/ppc64.h" #include "arch-utils.h" -#include "spu-tdep.h" #include "xml-syscall.h" #include "linux-tdep.h" #include "linux-record.h" @@ -66,7 +64,6 @@ #include "features/rs6000/powerpc-32l.c" #include "features/rs6000/powerpc-altivec32l.c" -#include "features/rs6000/powerpc-cell32l.c" #include "features/rs6000/powerpc-vsx32l.c" #include "features/rs6000/powerpc-isa205-32l.c" #include "features/rs6000/powerpc-isa205-altivec32l.c" @@ -76,7 +73,6 @@ #include "features/rs6000/powerpc-isa207-htm-vsx32l.c" #include "features/rs6000/powerpc-64l.c" #include "features/rs6000/powerpc-altivec64l.c" -#include "features/rs6000/powerpc-cell64l.c" #include "features/rs6000/powerpc-vsx64l.c" #include "features/rs6000/powerpc-isa205-64l.c" #include "features/rs6000/powerpc-isa205-altivec64l.c" @@ -1555,19 +1551,12 @@ ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) regcache_cooked_write_unsigned (regcache, PPC_TRAP_REGNUM, -1); } -static int -ppc_linux_spu_section (bfd *abfd, asection *asect, void *user_data) -{ - return startswith (bfd_section_name (asect), "SPU/"); -} - static const struct target_desc * ppc_linux_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd) { struct ppc_linux_features features = ppc_linux_no_features; - asection *cell = bfd_sections_find_if (abfd, ppc_linux_spu_section, NULL); asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx"); asection *vsx = bfd_get_section_by_name (abfd, ".reg-ppc-vsx"); asection *section = bfd_get_section_by_name (abfd, ".reg"); @@ -1592,9 +1581,6 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch, return NULL; } - if (cell) - features.cell = true; - if (altivec) features.altivec = true; @@ -1743,287 +1729,6 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch, return 1; } -/* Cell/B.E. active SPE context tracking support. */ - -static struct objfile *spe_context_objfile = NULL; -static CORE_ADDR spe_context_lm_addr = 0; -static CORE_ADDR spe_context_offset = 0; - -static ptid_t spe_context_cache_ptid; -static CORE_ADDR spe_context_cache_address; - -/* Hook into inferior_created, solib_loaded, and solib_unloaded observers - to track whether we've loaded a version of libspe2 (as static or dynamic - library) that provides the __spe_current_active_context variable. */ -static void -ppc_linux_spe_context_lookup (struct objfile *objfile) -{ - struct bound_minimal_symbol sym; - - if (!objfile) - { - spe_context_objfile = NULL; - spe_context_lm_addr = 0; - spe_context_offset = 0; - spe_context_cache_ptid = minus_one_ptid; - spe_context_cache_address = 0; - return; - } - - sym = lookup_minimal_symbol ("__spe_current_active_context", NULL, objfile); - if (sym.minsym) - { - spe_context_objfile = objfile; - spe_context_lm_addr = svr4_fetch_objfile_link_map (objfile); - spe_context_offset = MSYMBOL_VALUE_RAW_ADDRESS (sym.minsym); - spe_context_cache_ptid = minus_one_ptid; - spe_context_cache_address = 0; - return; - } -} - -static void -ppc_linux_spe_context_inferior_created (struct target_ops *t, int from_tty) -{ - ppc_linux_spe_context_lookup (NULL); - for (objfile *objfile : current_program_space->objfiles ()) - ppc_linux_spe_context_lookup (objfile); -} - -static void -ppc_linux_spe_context_solib_loaded (struct so_list *so) -{ - if (strstr (so->so_original_name, "/libspe") != NULL) - { - solib_read_symbols (so, 0); - ppc_linux_spe_context_lookup (so->objfile); - } -} - -static void -ppc_linux_spe_context_solib_unloaded (struct so_list *so) -{ - if (so->objfile == spe_context_objfile) - ppc_linux_spe_context_lookup (NULL); -} - -/* Retrieve contents of the N'th element in the current thread's - linked SPE context list into ID and NPC. Return the address of - said context element, or 0 if not found. */ -static CORE_ADDR -ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order, - int n, int *id, unsigned int *npc) -{ - CORE_ADDR spe_context = 0; - gdb_byte buf[16]; - int i; - - /* Quick exit if we have not found __spe_current_active_context. */ - if (!spe_context_objfile) - return 0; - - /* Look up cached address of thread-local variable. */ - if (spe_context_cache_ptid != inferior_ptid) - { - struct target_ops *target = current_top_target (); - - try - { - /* We do not call target_translate_tls_address here, because - svr4_fetch_objfile_link_map may invalidate the frame chain, - which must not do while inside a frame sniffer. - - Instead, we have cached the lm_addr value, and use that to - directly call the target's to_get_thread_local_address. */ - spe_context_cache_address - = target->get_thread_local_address (inferior_ptid, - spe_context_lm_addr, - spe_context_offset); - spe_context_cache_ptid = inferior_ptid; - } - - catch (const gdb_exception_error &ex) - { - return 0; - } - } - - /* Read variable value. */ - if (target_read_memory (spe_context_cache_address, buf, wordsize) == 0) - spe_context = extract_unsigned_integer (buf, wordsize, byte_order); - - /* Cyle through to N'th linked list element. */ - for (i = 0; i < n && spe_context; i++) - if (target_read_memory (spe_context + align_up (12, wordsize), - buf, wordsize) == 0) - spe_context = extract_unsigned_integer (buf, wordsize, byte_order); - else - spe_context = 0; - - /* Read current context. */ - if (spe_context - && target_read_memory (spe_context, buf, 12) != 0) - spe_context = 0; - - /* Extract data elements. */ - if (spe_context) - { - if (id) - *id = extract_signed_integer (buf, 4, byte_order); - if (npc) - *npc = extract_unsigned_integer (buf + 4, 4, byte_order); - } - - return spe_context; -} - - -/* Cell/B.E. cross-architecture unwinder support. */ - -struct ppu2spu_cache -{ - struct frame_id frame_id; - readonly_detached_regcache *regcache; -}; - -static struct gdbarch * -ppu2spu_prev_arch (struct frame_info *this_frame, void **this_cache) -{ - struct ppu2spu_cache *cache = (struct ppu2spu_cache *) *this_cache; - return cache->regcache->arch (); -} - -static void -ppu2spu_this_id (struct frame_info *this_frame, - void **this_cache, struct frame_id *this_id) -{ - struct ppu2spu_cache *cache = (struct ppu2spu_cache *) *this_cache; - *this_id = cache->frame_id; -} - -static struct value * -ppu2spu_prev_register (struct frame_info *this_frame, - void **this_cache, int regnum) -{ - struct ppu2spu_cache *cache = (struct ppu2spu_cache *) *this_cache; - struct gdbarch *gdbarch = cache->regcache->arch (); - gdb_byte *buf; - - buf = (gdb_byte *) alloca (register_size (gdbarch, regnum)); - - cache->regcache->cooked_read (regnum, buf); - return frame_unwind_got_bytes (this_frame, regnum, buf); -} - -struct ppu2spu_data -{ - struct gdbarch *gdbarch; - int id; - unsigned int npc; - gdb_byte gprs[128*16]; -}; - -static enum register_status -ppu2spu_unwind_register (ppu2spu_data *data, int regnum, gdb_byte *buf) -{ - enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch); - - if (regnum >= 0 && regnum < SPU_NUM_GPRS) - memcpy (buf, data->gprs + 16*regnum, 16); - else if (regnum == SPU_ID_REGNUM) - store_unsigned_integer (buf, 4, byte_order, data->id); - else if (regnum == SPU_PC_REGNUM) - store_unsigned_integer (buf, 4, byte_order, data->npc); - else - return REG_UNAVAILABLE; - - return REG_VALID; -} - -static int -ppu2spu_sniffer (const struct frame_unwind *self, - struct frame_info *this_frame, void **this_prologue_cache) -{ - struct gdbarch *gdbarch = get_frame_arch (this_frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - struct ppu2spu_data data; - struct frame_info *fi; - CORE_ADDR base, func, backchain, spe_context; - gdb_byte buf[8]; - int n = 0; - - /* Count the number of SPU contexts already in the frame chain. */ - for (fi = get_next_frame (this_frame); fi; fi = get_next_frame (fi)) - if (get_frame_type (fi) == ARCH_FRAME - && gdbarch_bfd_arch_info (get_frame_arch (fi))->arch == bfd_arch_spu) - n++; - - base = get_frame_sp (this_frame); - func = get_frame_pc (this_frame); - if (target_read_memory (base, buf, tdep->wordsize)) - return 0; - backchain = extract_unsigned_integer (buf, tdep->wordsize, byte_order); - - spe_context = ppc_linux_spe_context (tdep->wordsize, byte_order, - n, &data.id, &data.npc); - if (spe_context && base <= spe_context && spe_context < backchain) - { - char annex[32]; - - /* Find gdbarch for SPU. */ - struct gdbarch_info info; - gdbarch_info_init (&info); - info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu); - info.byte_order = BFD_ENDIAN_BIG; - info.osabi = GDB_OSABI_LINUX; - info.id = &data.id; - data.gdbarch = gdbarch_find_by_info (info); - if (!data.gdbarch) - return 0; - - xsnprintf (annex, sizeof annex, "%d/regs", data.id); - if (target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - data.gprs, 0, sizeof data.gprs) - == sizeof data.gprs) - { - auto cooked_read = [&data] (int regnum, gdb_byte *out_buf) - { - return ppu2spu_unwind_register (&data, regnum, out_buf); - }; - struct ppu2spu_cache *cache - = FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache); - std::unique_ptr<readonly_detached_regcache> regcache - (new readonly_detached_regcache (data.gdbarch, cooked_read)); - - cache->frame_id = frame_id_build (base, func); - cache->regcache = regcache.release (); - *this_prologue_cache = cache; - return 1; - } - } - - return 0; -} - -static void -ppu2spu_dealloc_cache (struct frame_info *self, void *this_cache) -{ - struct ppu2spu_cache *cache = (struct ppu2spu_cache *) this_cache; - delete cache->regcache; -} - -static const struct frame_unwind ppu2spu_unwind = { - ARCH_FRAME, - default_frame_unwind_stop_reason, - ppu2spu_this_id, - ppu2spu_prev_register, - NULL, - ppu2spu_sniffer, - ppu2spu_dealloc_cache, - ppu2spu_prev_arch, -}; - /* Initialize linux_record_tdep if not initialized yet. WORDSIZE is 4 or 8 for 32- or 64-bit PowerPC Linux respectively. Sizes of data structures are initialized accordingly. */ @@ -2439,21 +2144,6 @@ ppc_linux_init_abi (struct gdbarch_info info, } } - /* Enable Cell/B.E. if supported by the target. */ - if (tdesc_compatible_p (info.target_desc, - bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu))) - { - /* Cell/B.E. multi-architecture support. */ - set_spu_solib_ops (gdbarch); - - /* Cell/B.E. cross-architecture unwinder support. */ - frame_unwind_prepend_unwinder (gdbarch, &ppu2spu_unwind); - - /* We need to support more than "addr_bit" significant address bits - in order to support SPUADDR_ADDR encoded values. */ - set_gdbarch_significant_addr_bit (gdbarch, 64); - } - set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location); @@ -2478,15 +2168,9 @@ _initialize_ppc_linux_tdep (void) gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX, ppc_linux_init_abi); - /* Attach to observers to track __spe_current_active_context. */ - gdb::observers::inferior_created.attach (ppc_linux_spe_context_inferior_created); - gdb::observers::solib_loaded.attach (ppc_linux_spe_context_solib_loaded); - gdb::observers::solib_unloaded.attach (ppc_linux_spe_context_solib_unloaded); - /* Initialize the Linux target descriptions. */ initialize_tdesc_powerpc_32l (); initialize_tdesc_powerpc_altivec32l (); - initialize_tdesc_powerpc_cell32l (); initialize_tdesc_powerpc_vsx32l (); initialize_tdesc_powerpc_isa205_32l (); initialize_tdesc_powerpc_isa205_altivec32l (); @@ -2496,7 +2180,6 @@ _initialize_ppc_linux_tdep (void) initialize_tdesc_powerpc_isa207_htm_vsx32l (); initialize_tdesc_powerpc_64l (); initialize_tdesc_powerpc_altivec64l (); - initialize_tdesc_powerpc_cell64l (); initialize_tdesc_powerpc_vsx64l (); initialize_tdesc_powerpc_isa205_64l (); initialize_tdesc_powerpc_isa205_altivec64l (); diff --git a/gdb/regcache.c b/gdb/regcache.c index 7184c74..2e8b52e 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1605,10 +1605,7 @@ cooked_read_test (struct gdbarch *gdbarch) SELF_CHECK (mock_target.fetch_registers_called == 0); SELF_CHECK (mock_target.store_registers_called == 0); - - /* Some SPU pseudo registers are got via TARGET_OBJECT_SPU. */ - if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) - SELF_CHECK (mock_target.xfer_partial_called == 0); + SELF_CHECK (mock_target.xfer_partial_called == 0); mock_target.reset (); } @@ -1724,16 +1721,12 @@ cooked_write_test (struct gdbarch *gdbarch) auto bfd_arch = gdbarch_bfd_arch_info (gdbarch)->arch; - if ((bfd_arch == bfd_arch_sparc - /* SPARC64_CWP_REGNUM, SPARC64_PSTATE_REGNUM, - SPARC64_ASI_REGNUM and SPARC64_CCR_REGNUM are hard to test. */ - && gdbarch_ptr_bit (gdbarch) == 64 - && (regnum >= gdbarch_num_regs (gdbarch) - && regnum <= gdbarch_num_regs (gdbarch) + 4)) - || (bfd_arch == bfd_arch_spu - /* SPU pseudo registers except SPU_SP_REGNUM are got by - TARGET_OBJECT_SPU. */ - && regnum >= gdbarch_num_regs (gdbarch) && regnum != 130)) + if (bfd_arch == bfd_arch_sparc + /* SPARC64_CWP_REGNUM, SPARC64_PSTATE_REGNUM, + SPARC64_ASI_REGNUM and SPARC64_CCR_REGNUM are hard to test. */ + && gdbarch_ptr_bit (gdbarch) == 64 + && (regnum >= gdbarch_num_regs (gdbarch) + && regnum <= gdbarch_num_regs (gdbarch) + 4)) continue; std::vector<gdb_byte> expected (register_size (gdbarch, regnum), 0); diff --git a/gdb/regformats/reg-spu.dat b/gdb/regformats/reg-spu.dat deleted file mode 100644 index fb69119..0000000 --- a/gdb/regformats/reg-spu.dat +++ /dev/null @@ -1,133 +0,0 @@ -name:spu -xmlarch:spu -expedite:r0,r1,npc -128:r0 -128:r1 -128:r2 -128:r3 -128:r4 -128:r5 -128:r6 -128:r7 -128:r8 -128:r9 -128:r10 -128:r11 -128:r12 -128:r13 -128:r14 -128:r15 -128:r16 -128:r17 -128:r18 -128:r19 -128:r20 -128:r21 -128:r22 -128:r23 -128:r24 -128:r25 -128:r26 -128:r27 -128:r28 -128:r29 -128:r30 -128:r31 -128:r32 -128:r33 -128:r34 -128:r35 -128:r36 -128:r37 -128:r38 -128:r39 -128:r40 -128:r41 -128:r42 -128:r43 -128:r44 -128:r45 -128:r46 -128:r47 -128:r48 -128:r49 -128:r50 -128:r51 -128:r52 -128:r53 -128:r54 -128:r55 -128:r56 -128:r57 -128:r58 -128:r59 -128:r60 -128:r61 -128:r62 -128:r63 -128:r64 -128:r65 -128:r66 -128:r67 -128:r68 -128:r69 -128:r70 -128:r71 -128:r72 -128:r73 -128:r74 -128:r75 -128:r76 -128:r77 -128:r78 -128:r79 -128:r80 -128:r81 -128:r82 -128:r83 -128:r84 -128:r85 -128:r86 -128:r87 -128:r88 -128:r89 -128:r90 -128:r91 -128:r92 -128:r93 -128:r94 -128:r95 -128:r96 -128:r97 -128:r98 -128:r99 -128:r100 -128:r101 -128:r102 -128:r103 -128:r104 -128:r105 -128:r106 -128:r107 -128:r108 -128:r109 -128:r110 -128:r111 -128:r112 -128:r113 -128:r114 -128:r115 -128:r116 -128:r117 -128:r118 -128:r119 -128:r120 -128:r121 -128:r122 -128:r123 -128:r124 -128:r125 -128:r126 -128:r127 -32:id -32:npc diff --git a/gdb/regformats/rs6000/powerpc-cell32l.dat b/gdb/regformats/rs6000/powerpc-cell32l.dat deleted file mode 100644 index bd28505..0000000 --- a/gdb/regformats/rs6000/powerpc-cell32l.dat +++ /dev/null @@ -1,112 +0,0 @@ -# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: -# Generated from: rs6000/powerpc-cell32l.xml -name:powerpc_cell32l -xmltarget:powerpc-cell32l.xml -expedite:r1,pc,r0,orig_r3,r4 -32:r0 -32:r1 -32:r2 -32:r3 -32:r4 -32:r5 -32:r6 -32:r7 -32:r8 -32:r9 -32:r10 -32:r11 -32:r12 -32:r13 -32:r14 -32:r15 -32:r16 -32:r17 -32:r18 -32:r19 -32:r20 -32:r21 -32:r22 -32:r23 -32:r24 -32:r25 -32:r26 -32:r27 -32:r28 -32:r29 -32:r30 -32:r31 -64:f0 -64:f1 -64:f2 -64:f3 -64:f4 -64:f5 -64:f6 -64:f7 -64:f8 -64:f9 -64:f10 -64:f11 -64:f12 -64:f13 -64:f14 -64:f15 -64:f16 -64:f17 -64:f18 -64:f19 -64:f20 -64:f21 -64:f22 -64:f23 -64:f24 -64:f25 -64:f26 -64:f27 -64:f28 -64:f29 -64:f30 -64:f31 -32:pc -32:msr -32:cr -32:lr -32:ctr -32:xer -32:fpscr -32:orig_r3 -32:trap -128:vr0 -128:vr1 -128:vr2 -128:vr3 -128:vr4 -128:vr5 -128:vr6 -128:vr7 -128:vr8 -128:vr9 -128:vr10 -128:vr11 -128:vr12 -128:vr13 -128:vr14 -128:vr15 -128:vr16 -128:vr17 -128:vr18 -128:vr19 -128:vr20 -128:vr21 -128:vr22 -128:vr23 -128:vr24 -128:vr25 -128:vr26 -128:vr27 -128:vr28 -128:vr29 -128:vr30 -128:vr31 -32:vscr -32:vrsave diff --git a/gdb/regformats/rs6000/powerpc-cell64l.dat b/gdb/regformats/rs6000/powerpc-cell64l.dat deleted file mode 100644 index b5b162e..0000000 --- a/gdb/regformats/rs6000/powerpc-cell64l.dat +++ /dev/null @@ -1,112 +0,0 @@ -# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: -# Generated from: rs6000/powerpc-cell64l.xml -name:powerpc_cell64l -xmltarget:powerpc-cell64l.xml -expedite:r1,pc,r0,orig_r3,r4 -64:r0 -64:r1 -64:r2 -64:r3 -64:r4 -64:r5 -64:r6 -64:r7 -64:r8 -64:r9 -64:r10 -64:r11 -64:r12 -64:r13 -64:r14 -64:r15 -64:r16 -64:r17 -64:r18 -64:r19 -64:r20 -64:r21 -64:r22 -64:r23 -64:r24 -64:r25 -64:r26 -64:r27 -64:r28 -64:r29 -64:r30 -64:r31 -64:f0 -64:f1 -64:f2 -64:f3 -64:f4 -64:f5 -64:f6 -64:f7 -64:f8 -64:f9 -64:f10 -64:f11 -64:f12 -64:f13 -64:f14 -64:f15 -64:f16 -64:f17 -64:f18 -64:f19 -64:f20 -64:f21 -64:f22 -64:f23 -64:f24 -64:f25 -64:f26 -64:f27 -64:f28 -64:f29 -64:f30 -64:f31 -64:pc -64:msr -32:cr -64:lr -64:ctr -32:xer -32:fpscr -64:orig_r3 -64:trap -128:vr0 -128:vr1 -128:vr2 -128:vr3 -128:vr4 -128:vr5 -128:vr6 -128:vr7 -128:vr8 -128:vr9 -128:vr10 -128:vr11 -128:vr12 -128:vr13 -128:vr14 -128:vr15 -128:vr16 -128:vr17 -128:vr18 -128:vr19 -128:vr20 -128:vr21 -128:vr22 -128:vr23 -128:vr24 -128:vr25 -128:vr26 -128:vr27 -128:vr28 -128:vr29 -128:vr30 -128:vr31 -32:vscr -32:vrsave diff --git a/gdb/remote.c b/gdb/remote.c index 980864e..21160e1 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1970,8 +1970,6 @@ enum { PACKET_qXfer_libraries, PACKET_qXfer_libraries_svr4, PACKET_qXfer_memory_map, - PACKET_qXfer_spu_read, - PACKET_qXfer_spu_write, PACKET_qXfer_osdata, PACKET_qXfer_threads, PACKET_qXfer_statictrace_read, @@ -5083,10 +5081,6 @@ static const struct protocol_feature remote_protocol_features[] = { remote_supported_packet, PACKET_augmented_libraries_svr4_read_feature }, { "qXfer:memory-map:read", PACKET_DISABLE, remote_supported_packet, PACKET_qXfer_memory_map }, - { "qXfer:spu:read", PACKET_DISABLE, remote_supported_packet, - PACKET_qXfer_spu_read }, - { "qXfer:spu:write", PACKET_DISABLE, remote_supported_packet, - PACKET_qXfer_spu_write }, { "qXfer:osdata:read", PACKET_DISABLE, remote_supported_packet, PACKET_qXfer_osdata }, { "qXfer:threads:read", PACKET_DISABLE, remote_supported_packet, @@ -10858,19 +10852,6 @@ remote_target::xfer_partial (enum target_object object, xfered_len); } - /* Handle SPU memory using qxfer packets. */ - if (object == TARGET_OBJECT_SPU) - { - if (readbuf) - return remote_read_qxfer ("spu", annex, readbuf, offset, len, - xfered_len, &remote_protocol_packets - [PACKET_qXfer_spu_read]); - else - return remote_write_qxfer ("spu", annex, writebuf, offset, len, - xfered_len, &remote_protocol_packets - [PACKET_qXfer_spu_write]); - } - /* Handle extra signal info using qxfer packets. */ if (object == TARGET_OBJECT_SIGNAL_INFO) { @@ -14481,12 +14462,6 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL, add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_memory_map], "qXfer:memory-map:read", "memory-map", 0); - add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_spu_read], - "qXfer:spu:read", "read-spu-object", 0); - - add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_spu_write], - "qXfer:spu:write", "write-spu-object", 0); - add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_osdata], "qXfer:osdata:read", "osdata", 0); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 47a232f..9123a3d 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -6141,16 +6141,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) int num_pseudoregs = 0; int cur_reg; - /* INFO may refer to a binary that is not of the PowerPC architecture, - e.g. when debugging a stand-alone SPE executable on a Cell/B.E. system. - In this case, we must not attempt to infer properties of the (PowerPC - side) of the target system from properties of that executable. Trust - the target description instead. */ - if (info.abfd - && bfd_get_arch (info.abfd) != bfd_arch_powerpc - && bfd_get_arch (info.abfd) != bfd_arch_rs6000) - info.abfd = NULL; - from_xcoff_exec = info.abfd && info.abfd->format == bfd_object && bfd_get_flavour (info.abfd) == bfd_target_xcoff_flavour; diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c deleted file mode 100644 index 49e470a..0000000 --- a/gdb/solib-spu.c +++ /dev/null @@ -1,547 +0,0 @@ -/* Cell SPU GNU/Linux support -- shared library handling. - Copyright (C) 2009-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 "defs.h" -#include "solib-spu.h" -#include "gdbcore.h" -#include <sys/stat.h> -#include "arch-utils.h" -#include "bfd.h" -#include "symtab.h" -#include "solib.h" -#include "solib-svr4.h" -#include "solist.h" -#include "inferior.h" -#include "objfiles.h" -#include "observable.h" -#include "breakpoint.h" -#include "gdbthread.h" -#include "gdb_bfd.h" - -#include "spu-tdep.h" - -/* Highest SPE id (file handle) the inferior may have. */ -#define MAX_SPE_FD 1024 - -/* Stand-alone SPE executable? */ -#define spu_standalone_p() \ - (symfile_objfile && symfile_objfile->obfd \ - && bfd_get_arch (symfile_objfile->obfd) == bfd_arch_spu) - - -/* Relocate main SPE executable. */ -static void -spu_relocate_main_executable (int spufs_fd) -{ - struct section_offsets *new_offsets; - int i; - - if (symfile_objfile == NULL) - return; - - new_offsets = XALLOCAVEC (struct section_offsets, - symfile_objfile->num_sections); - - for (i = 0; i < symfile_objfile->num_sections; i++) - new_offsets->offsets[i] = SPUADDR (spufs_fd, 0); - - objfile_relocate (symfile_objfile, new_offsets); -} - -/* When running a stand-alone SPE executable, we may need to skip one more - exec event on startup, to get past the binfmt_misc loader. */ -static void -spu_skip_standalone_loader (void) -{ - if (target_has_execution && !current_inferior ()->attach_flag) - { - struct target_waitstatus ws; - - /* Only some kernels report an extra SIGTRAP with the binfmt_misc - loader; others do not. In addition, if we have attached to an - already running inferior instead of starting a new one, we will - not see the extra SIGTRAP -- and we cannot readily distinguish - the two cases, in particular with the extended-remote target. - - Thus we issue a single-step here. If no extra SIGTRAP was pending, - this will step past the first instruction of the stand-alone SPE - executable loader, but we don't care about that. */ - - inferior_thread ()->control.in_infcall = 1; /* Suppress MI messages. */ - - target_resume (inferior_ptid, 1, GDB_SIGNAL_0); - target_wait (minus_one_ptid, &ws, 0); - set_executing (minus_one_ptid, 0); - - inferior_thread ()->control.in_infcall = 0; - } -} - -static objfile_key<CORE_ADDR, gdb::noop_deleter<CORE_ADDR>> - ocl_program_data_key; - -/* Appends OpenCL programs to the list of `struct so_list' objects. */ -static void -append_ocl_sos (struct so_list **link_ptr) -{ - CORE_ADDR *ocl_program_addr_base; - - for (objfile *objfile : current_program_space->objfiles ()) - { - ocl_program_addr_base = ocl_program_data_key.get (objfile); - if (ocl_program_addr_base != NULL) - { - enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)? - BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; - try - { - CORE_ADDR data = - read_memory_unsigned_integer (*ocl_program_addr_base, - sizeof (CORE_ADDR), - byte_order); - if (data != 0x0) - { - struct so_list *newobj; - - /* Allocate so_list structure. */ - newobj = XCNEW (struct so_list); - - /* Encode FD and object ID in path name. */ - xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>", - hex_string (data), - SPUADDR_SPU (*ocl_program_addr_base)); - strcpy (newobj->so_original_name, newobj->so_name); - - *link_ptr = newobj; - link_ptr = &newobj->next; - } - } - catch (const gdb_exception &ex) - { - /* Ignore memory errors. */ - switch (ex.error) - { - case MEMORY_ERROR: - break; - default: - throw; - break; - } - } - } - } -} - -/* Build a list of `struct so_list' objects describing the shared - objects currently loaded in the inferior. */ -static struct so_list * -spu_current_sos (void) -{ - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - struct so_list *head; - struct so_list **link_ptr; - - gdb_byte buf[MAX_SPE_FD * 4]; - int i, size; - - /* First, retrieve the SVR4 shared library list. */ - head = svr4_so_ops.current_sos (); - - /* Append our libraries to the end of the list. */ - for (link_ptr = &head; *link_ptr; link_ptr = &(*link_ptr)->next) - ; - - /* Determine list of SPU ids. */ - size = target_read (current_top_target (), TARGET_OBJECT_SPU, NULL, - buf, 0, sizeof buf); - - /* Do not add stand-alone SPE executable context as shared library, - but relocate main SPE executable objfile. */ - if (spu_standalone_p ()) - { - if (size == 4) - { - int fd = extract_unsigned_integer (buf, 4, byte_order); - - spu_relocate_main_executable (fd); - - /* Re-enable breakpoints after main SPU context was established; - see also comments in spu_solib_create_inferior_hook. */ - enable_breakpoints_after_startup (); - } - - return head; - } - - /* Create an so_list entry for each SPU id. */ - for (i = 0; i < size; i += 4) - { - int fd = extract_unsigned_integer (buf + i, 4, byte_order); - struct so_list *newobj; - - unsigned long long addr; - char annex[32], id[100]; - int len; - - /* Read object ID. There's a race window where the inferior may have - already created the SPE context, but not installed the object-id - yet. Skip such entries; we'll be back for them later. */ - xsnprintf (annex, sizeof annex, "%d/object-id", fd); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - (gdb_byte *) id, 0, sizeof id); - if (len <= 0 || len >= sizeof id) - continue; - id[len] = 0; - if (sscanf (id, "0x%llx", &addr) != 1 || !addr) - continue; - - /* Allocate so_list structure. */ - newobj = XCNEW (struct so_list); - - /* Encode FD and object ID in path name. Choose the name so as not - to conflict with any (normal) SVR4 library path name. */ - xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>", - hex_string (addr), fd); - strcpy (newobj->so_original_name, newobj->so_name); - - *link_ptr = newobj; - link_ptr = &newobj->next; - } - - /* Append OpenCL sos. */ - append_ocl_sos (link_ptr); - - return head; -} - -/* Free so_list information. */ -static void -spu_free_so (struct so_list *so) -{ - if (so->so_original_name[0] != '@') - svr4_so_ops.free_so (so); -} - -/* Relocate section addresses. */ -static void -spu_relocate_section_addresses (struct so_list *so, - struct target_section *sec) -{ - if (so->so_original_name[0] != '@') - svr4_so_ops.relocate_section_addresses (so, sec); - else - { - unsigned long long addr; - int fd; - - /* Set addr_low/high to just LS offset for display. */ - if (so->addr_low == 0 && so->addr_high == 0 - && strcmp (sec->the_bfd_section->name, ".text") == 0) - { - so->addr_low = sec->addr; - so->addr_high = sec->endaddr; - } - - /* Decode object ID. */ - if (sscanf (so->so_original_name, "@0x%llx <%d>", &addr, &fd) != 2) - internal_error (__FILE__, __LINE__, "bad object ID"); - - sec->addr = SPUADDR (fd, sec->addr); - sec->endaddr = SPUADDR (fd, sec->endaddr); - } -} - - -/* Inferior memory should contain an SPE executable image at location ADDR. - Allocate a BFD representing that executable. Return NULL on error. */ - -static void * -spu_bfd_iovec_open (bfd *nbfd, void *open_closure) -{ - return open_closure; -} - -static int -spu_bfd_iovec_close (bfd *nbfd, void *stream) -{ - xfree (stream); - - /* Zero means success. */ - return 0; -} - -static file_ptr -spu_bfd_iovec_pread (bfd *abfd, void *stream, void *buf, - file_ptr nbytes, file_ptr offset) -{ - CORE_ADDR addr = *(CORE_ADDR *)stream; - int ret; - - ret = target_read_memory (addr + offset, (gdb_byte *) buf, nbytes); - if (ret != 0) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - return nbytes; -} - -static int -spu_bfd_iovec_stat (bfd *abfd, void *stream, struct stat *sb) -{ - /* We don't have an easy way of finding the size of embedded spu - images. We could parse the in-memory ELF header and section - table to find the extent of the last section but that seems - pointless when the size is needed only for checks of other - parsed values in dbxread.c. */ - memset (sb, 0, sizeof (struct stat)); - sb->st_size = INT_MAX; - return 0; -} - -static gdb_bfd_ref_ptr -spu_bfd_fopen (const char *name, CORE_ADDR addr) -{ - CORE_ADDR *open_closure = XNEW (CORE_ADDR); - - *open_closure = addr; - - gdb_bfd_ref_ptr nbfd (gdb_bfd_openr_iovec (name, "elf32-spu", - spu_bfd_iovec_open, open_closure, - spu_bfd_iovec_pread, - spu_bfd_iovec_close, - spu_bfd_iovec_stat)); - if (nbfd == NULL) - return NULL; - - if (!bfd_check_format (nbfd.get (), bfd_object)) - return NULL; - - return nbfd; -} - -/* Open shared library BFD. */ -static gdb_bfd_ref_ptr -spu_bfd_open (const char *pathname) -{ - const char *original_name = strrchr (pathname, '@'); - asection *spu_name; - unsigned long long addr; - int fd; - - /* Handle regular SVR4 libraries. */ - if (!original_name) - return svr4_so_ops.bfd_open (pathname); - - /* Decode object ID. */ - if (sscanf (original_name, "@0x%llx <%d>", &addr, &fd) != 2) - internal_error (__FILE__, __LINE__, "bad object ID"); - - /* Open BFD representing SPE executable. */ - gdb_bfd_ref_ptr abfd (spu_bfd_fopen (original_name, (CORE_ADDR) addr)); - if (abfd == NULL) - error (_("Cannot read SPE executable at %s"), original_name); - - /* Retrieve SPU name note. */ - spu_name = bfd_get_section_by_name (abfd.get (), ".note.spu_name"); - if (spu_name) - { - int sect_size = bfd_section_size (spu_name); - - if (sect_size > 20) - { - char *buf - = (char *) alloca (sect_size - 20 + strlen (original_name) + 1); - - bfd_get_section_contents (abfd.get (), spu_name, buf, 20, - sect_size - 20); - buf[sect_size - 20] = '\0'; - - strcat (buf, original_name); - - bfd_set_filename (abfd.get (), xstrdup (buf)); - } - } - - return abfd; -} - -/* Lookup global symbol in a SPE executable. */ -static struct block_symbol -spu_lookup_lib_symbol (struct objfile *objfile, - const char *name, - const domain_enum domain) -{ - if (bfd_get_arch (objfile->obfd) == bfd_arch_spu) - return lookup_global_symbol_from_objfile (objfile, GLOBAL_BLOCK, name, - domain); - - if (svr4_so_ops.lookup_lib_global_symbol != NULL) - return svr4_so_ops.lookup_lib_global_symbol (objfile, name, domain); - return {}; -} - -/* Enable shared library breakpoint. */ -static int -spu_enable_break (struct objfile *objfile) -{ - struct bound_minimal_symbol spe_event_sym; - - /* The libspe library will call __spe_context_update_event whenever any - SPE context is allocated or destroyed. */ - spe_event_sym = lookup_minimal_symbol ("__spe_context_update_event", - NULL, objfile); - - /* Place a solib_event breakpoint on the symbol. */ - if (spe_event_sym.minsym) - { - CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (spe_event_sym); - - addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), addr, - current_top_target ()); - create_solib_event_breakpoint (target_gdbarch (), addr); - return 1; - } - - return 0; -} - -/* Enable shared library breakpoint for the - OpenCL runtime running on the SPU. */ -static void -ocl_enable_break (struct objfile *objfile) -{ - struct bound_minimal_symbol event_sym; - struct bound_minimal_symbol addr_sym; - - /* The OpenCL runtime on the SPU will call __opencl_program_update_event - whenever an OpenCL program is loaded. */ - event_sym = lookup_minimal_symbol ("__opencl_program_update_event", NULL, - objfile); - /* The PPU address of the OpenCL program can be found - at opencl_elf_image_address. */ - addr_sym = lookup_minimal_symbol ("opencl_elf_image_address", NULL, objfile); - - if (event_sym.minsym && addr_sym.minsym) - { - /* Place a solib_event breakpoint on the symbol. */ - CORE_ADDR event_addr = BMSYMBOL_VALUE_ADDRESS (event_sym); - create_solib_event_breakpoint (get_objfile_arch (objfile), event_addr); - - /* Store the address of the symbol that will point to OpenCL program - using the per-objfile private data mechanism. */ - if (ocl_program_data_key.get (objfile) == NULL) - { - CORE_ADDR *ocl_program_addr_base = OBSTACK_CALLOC ( - &objfile->objfile_obstack, - objfile->sections_end - objfile->sections, - CORE_ADDR); - *ocl_program_addr_base = BMSYMBOL_VALUE_ADDRESS (addr_sym); - ocl_program_data_key.set (objfile, ocl_program_addr_base); - } - } -} - -/* Create inferior hook. */ -static void -spu_solib_create_inferior_hook (int from_tty) -{ - /* Handle SPE stand-alone executables. */ - if (spu_standalone_p ()) - { - /* After an SPE stand-alone executable was loaded, we'll receive - an additional trap due to the binfmt_misc handler. Make sure - to skip that trap. */ - spu_skip_standalone_loader (); - - /* If the user established breakpoints before starting the inferior, GDB - would attempt to insert those now. This would fail because the SPU - context has not yet been created and the SPU executable has not yet - been loaded. To prevent such failures, we disable all user-created - breakpoints now; they will be re-enabled in spu_current_sos once the - main SPU context has been detected. */ - disable_breakpoints_before_startup (); - - /* A special case arises when re-starting an executable, because at - this point it still resides at the relocated address range that was - determined during its last execution. We need to undo the relocation - so that that multi-architecture target recognizes the stand-alone - initialization special case. */ - spu_relocate_main_executable (-1); - } - - /* Call SVR4 hook -- this will re-insert the SVR4 solib breakpoints. */ - svr4_so_ops.solib_create_inferior_hook (from_tty); - - /* If the inferior is statically linked against libspe, we need to install - our own solib breakpoint right now. Otherwise, it will be installed by - the solib_loaded observer below as soon as libspe is loaded. */ - spu_enable_break (NULL); -} - -/* Install SPE "shared library" handling. This is called by -tdep code - that wants to support SPU as a secondary architecture. */ -void -set_spu_solib_ops (struct gdbarch *gdbarch) -{ - static struct target_so_ops spu_so_ops; - - /* Initialize this lazily, to avoid an initialization order - dependency on solib-svr4.c's _initialize routine. */ - if (spu_so_ops.current_sos == NULL) - { - spu_so_ops = svr4_so_ops; - spu_so_ops.solib_create_inferior_hook = spu_solib_create_inferior_hook; - spu_so_ops.relocate_section_addresses = spu_relocate_section_addresses; - spu_so_ops.free_so = spu_free_so; - spu_so_ops.current_sos = spu_current_sos; - spu_so_ops.bfd_open = spu_bfd_open; - spu_so_ops.lookup_lib_global_symbol = spu_lookup_lib_symbol; - } - - set_solib_ops (gdbarch, &spu_so_ops); -} - -/* Observer for the solib_loaded event. Used to install our breakpoint - if libspe is a shared library. */ -static void -spu_solib_loaded (struct so_list *so) -{ - if (strstr (so->so_original_name, "/libspe") != NULL) - { - solib_read_symbols (so, 0); - spu_enable_break (so->objfile); - } - /* In case the OpenCL runtime is loaded we install a breakpoint - to get notified whenever an OpenCL program gets loaded. */ - if (strstr (so->so_name, "CLRuntimeAccelCellSPU@") != NULL) - { - solib_read_symbols (so, 0); - ocl_enable_break (so->objfile); - } -} - -void -_initialize_spu_solib (void) -{ - gdb::observers::solib_loaded.attach (spu_solib_loaded); -} - diff --git a/gdb/solib-spu.h b/gdb/solib-spu.h deleted file mode 100644 index a7a6533..0000000 --- a/gdb/solib-spu.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Cell SPU GNU/Linux support -- shared library handling. - - Copyright (C) 2009-2019 Free Software Foundation, Inc. - - 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/>. */ - -#ifndef SOLIB_SPU_H -#define SOLIB_SPU_H - -extern void set_spu_solib_ops (struct gdbarch *gdbarch); - -#endif diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c deleted file mode 100644 index 635366b..0000000 --- a/gdb/spu-linux-nat.c +++ /dev/null @@ -1,661 +0,0 @@ -/* SPU native-dependent code for GDB, the GNU debugger. - 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 "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "inferior.h" -#include "inf-child.h" -#include "inf-ptrace.h" -#include "regcache.h" -#include "symfile.h" -#include "gdbsupport/gdb_wait.h" -#include "gdbthread.h" -#include "gdb_bfd.h" - -#include "nat/gdb_ptrace.h" -#include <asm/ptrace.h> -#include <sys/types.h> - -#include "spu-tdep.h" - -/* PPU side system calls. */ -#define INSTR_SC 0x44000002 -#define NR_spu_run 0x0116 - -class spu_linux_nat_target final : public inf_ptrace_target -{ -public: - void fetch_registers (struct regcache *regcache, int regnum) override; - void store_registers (struct regcache *regcache, int regnum) override; - - void post_attach (int) override; - void post_startup_inferior (ptid_t) override; - - ptid_t wait (ptid_t, struct target_waitstatus *, int options) override; - - enum target_xfer_status xfer_partial (enum target_object object, - const char *annex, - gdb_byte *readbuf, - const gdb_byte *writebuf, - ULONGEST offset, ULONGEST len, - ULONGEST *xfered_len) override; - - int can_use_hw_breakpoint (enum bptype, int, int) override; -}; - -static spu_linux_nat_target the_spu_linux_nat_target; - -/* Fetch PPU register REGNO. */ -static ULONGEST -fetch_ppc_register (int regno) -{ - PTRACE_TYPE_RET res; - - int tid = inferior_ptid.lwp (); - if (tid == 0) - tid = inferior_ptid.pid (); - -#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. */ - { - gdb_byte buf[8]; - - errno = 0; - ptrace (PPC_PTRACE_PEEKUSR_3264, tid, - (PTRACE_TYPE_ARG3) (regno * 8), buf); - if (errno == 0) - ptrace (PPC_PTRACE_PEEKUSR_3264, tid, - (PTRACE_TYPE_ARG3) (regno * 8 + 4), buf + 4); - if (errno == 0) - return (ULONGEST) *(uint64_t *)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]; - xsnprintf (mess, sizeof mess, "reading PPC register #%d", regno); - perror_with_name (_(mess)); - } - - return (ULONGEST) (unsigned long) res; -} - -/* Fetch WORD from PPU memory at (aligned) MEMADDR in thread TID. */ -static int -fetch_ppc_memory_1 (int tid, ULONGEST memaddr, PTRACE_TYPE_RET *word) -{ - errno = 0; - -#ifndef __powerpc64__ - if (memaddr >> 32) - { - uint64_t addr_8 = (uint64_t) memaddr; - ptrace (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, ULONGEST memaddr, PTRACE_TYPE_RET word) -{ - errno = 0; - -#ifndef __powerpc64__ - if (memaddr >> 32) - { - uint64_t addr_8 = (uint64_t) memaddr; - ptrace (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 (ULONGEST memaddr, gdb_byte *myaddr, int len) -{ - int i, ret; - - ULONGEST addr = memaddr & -(ULONGEST) sizeof (PTRACE_TYPE_RET); - int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1) - / sizeof (PTRACE_TYPE_RET)); - PTRACE_TYPE_RET *buffer; - - int tid = inferior_ptid.lwp (); - if (tid == 0) - tid = inferior_ptid.pid (); - - buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET)); - for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET)) - { - ret = fetch_ppc_memory_1 (tid, addr, &buffer[i]); - if (ret) - 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 (ULONGEST memaddr, const gdb_byte *myaddr, int len) -{ - int i, ret; - - ULONGEST addr = memaddr & -(ULONGEST) sizeof (PTRACE_TYPE_RET); - int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1) - / sizeof (PTRACE_TYPE_RET)); - PTRACE_TYPE_RET *buffer; - - int tid = inferior_ptid.lwp (); - if (tid == 0) - tid = inferior_ptid.pid (); - - buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET)); - - if (addr != memaddr || len < (int) sizeof (PTRACE_TYPE_RET)) - { - ret = fetch_ppc_memory_1 (tid, addr, &buffer[0]); - if (ret) - return ret; - } - - if (count > 1) - { - ret = fetch_ppc_memory_1 (tid, addr + (count - 1) - * sizeof (PTRACE_TYPE_RET), - &buffer[count - 1]); - if (ret) - return ret; - } - - memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)), - myaddr, len); - - for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET)) - { - ret = store_ppc_memory_1 (tid, addr, buffer[i]); - if (ret) - 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, ULONGEST *addr) -{ - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - gdb_byte buf[4]; - ULONGEST pc = fetch_ppc_register (32); /* nip */ - - /* Fetch instruction preceding current NIP. */ - if (fetch_ppc_memory (pc-4, buf, 4) != 0) - return 0; - /* It should be a "sc" instruction. */ - if (extract_unsigned_integer (buf, 4, byte_order) != 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; -} - - -/* Implement the to_xfer_partial target_ops method for TARGET_OBJECT_SPU. - Copy LEN bytes at OFFSET in spufs file ANNEX into/from READBUF or WRITEBUF, - using the /proc file system. */ - -static enum target_xfer_status -spu_proc_xfer_spu (const char *annex, gdb_byte *readbuf, - const gdb_byte *writebuf, - ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) -{ - char buf[128]; - int fd = 0; - int ret = -1; - int pid = inferior_ptid.pid (); - - if (!annex) - return TARGET_XFER_EOF; - - xsnprintf (buf, sizeof buf, "/proc/%d/fd/%s", pid, annex); - fd = open (buf, writebuf? O_WRONLY : O_RDONLY); - if (fd <= 0) - return TARGET_XFER_E_IO; - - if (offset != 0 - && lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset) - { - close (fd); - return TARGET_XFER_EOF; - } - - if (writebuf) - ret = write (fd, writebuf, (size_t) len); - else if (readbuf) - ret = read (fd, readbuf, (size_t) len); - - close (fd); - if (ret < 0) - return TARGET_XFER_E_IO; - else if (ret == 0) - return TARGET_XFER_EOF; - else - { - *xfered_len = (ULONGEST) ret; - return TARGET_XFER_OK; - } -} - - -/* Inferior memory should contain an SPE executable image at location ADDR. - Allocate a BFD representing that executable. Return NULL on error. */ - -static void * -spu_bfd_iovec_open (struct bfd *nbfd, void *open_closure) -{ - return open_closure; -} - -static int -spu_bfd_iovec_close (struct bfd *nbfd, void *stream) -{ - xfree (stream); - - /* Zero means success. */ - return 0; -} - -static file_ptr -spu_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf, - file_ptr nbytes, file_ptr offset) -{ - ULONGEST addr = *(ULONGEST *)stream; - - if (fetch_ppc_memory (addr + offset, (gdb_byte *)buf, nbytes) != 0) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - return nbytes; -} - -static int -spu_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb) -{ - /* We don't have an easy way of finding the size of embedded spu - images. We could parse the in-memory ELF header and section - table to find the extent of the last section but that seems - pointless when the size is needed only for checks of other - parsed values in dbxread.c. */ - memset (sb, 0, sizeof (struct stat)); - sb->st_size = INT_MAX; - return 0; -} - -static gdb_bfd_ref_ptr -spu_bfd_open (ULONGEST addr) -{ - asection *spu_name; - - ULONGEST *open_closure = XNEW (ULONGEST); - *open_closure = addr; - - gdb_bfd_ref_ptr nbfd (gdb_bfd_openr_iovec ("<in-memory>", "elf32-spu", - spu_bfd_iovec_open, open_closure, - spu_bfd_iovec_pread, - spu_bfd_iovec_close, - spu_bfd_iovec_stat)); - if (nbfd == NULL) - return NULL; - - if (!bfd_check_format (nbfd.get (), bfd_object)) - return NULL; - - /* Retrieve SPU name note and update BFD name. */ - spu_name = bfd_get_section_by_name (nbfd.get (), ".note.spu_name"); - if (spu_name) - { - int sect_size = bfd_section_size (spu_name); - if (sect_size > 20) - { - char *buf = (char *)alloca (sect_size - 20 + 1); - bfd_get_section_contents (nbfd.get (), spu_name, buf, 20, - sect_size - 20); - buf[sect_size - 20] = '\0'; - - bfd_set_filename (nbfd.get (), xstrdup (buf)); - } - } - - return nbfd; -} - -/* INFERIOR_FD is a file handle passed by the inferior to the - spu_run system call. Assuming the SPE context was allocated - by the libspe library, try to retrieve the main SPE executable - file from its copy within the target process. */ -static void -spu_symbol_file_add_from_memory (int inferior_fd) -{ - ULONGEST addr; - - gdb_byte id[128]; - char annex[32]; - ULONGEST len; - enum target_xfer_status status; - - /* Read object ID. */ - xsnprintf (annex, sizeof annex, "%d/object-id", inferior_fd); - status = spu_proc_xfer_spu (annex, id, NULL, 0, sizeof id, &len); - if (status != TARGET_XFER_OK || len >= sizeof id) - return; - id[len] = 0; - addr = strtoulst ((const char *) id, NULL, 16); - if (!addr) - return; - - /* Open BFD representing SPE executable and read its symbols. */ - gdb_bfd_ref_ptr nbfd (spu_bfd_open (addr)); - if (nbfd != NULL) - { - symbol_file_add_from_bfd (nbfd.get (), bfd_get_filename (nbfd), - SYMFILE_VERBOSE | SYMFILE_MAINLINE, - NULL, 0, NULL); - } -} - - -/* Override the post_startup_inferior routine to continue running - the inferior until the first spu_run system call. */ -void -spu_linux_nat_target::post_startup_inferior (ptid_t ptid) -{ - int fd; - ULONGEST addr; - - int tid = ptid.lwp (); - if (tid == 0) - tid = ptid.pid (); - - while (!parse_spufs_run (&fd, &addr)) - { - ptrace (PT_SYSCALL, tid, (PTRACE_TYPE_ARG3) 0, 0); - waitpid (tid, NULL, __WALL | __WNOTHREAD); - } -} - -/* Override the post_attach routine to try load the SPE executable - file image from its copy inside the target process. */ -void -spu_linux_nat_target::post_attach (int pid) -{ - int fd; - ULONGEST addr; - - /* Like child_post_startup_inferior, if we happened to attach to - the inferior while it wasn't currently in spu_run, continue - running it until we get back there. */ - while (!parse_spufs_run (&fd, &addr)) - { - ptrace (PT_SYSCALL, pid, (PTRACE_TYPE_ARG3) 0, 0); - waitpid (pid, NULL, __WALL | __WNOTHREAD); - } - - /* If the user has not provided an executable file, try to extract - the image from inside the target process. */ - if (!get_exec_file (0)) - spu_symbol_file_add_from_memory (fd); -} - -/* Wait for child PTID to do something. Return id of the child, - minus_one_ptid in case of error; store status into *OURSTATUS. */ -ptid_t -spu_linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, - int options) -{ - int save_errno; - int status; - pid_t pid; - - do - { - set_sigint_trap (); /* Causes SIGINT to be passed on to the - attached process. */ - - pid = waitpid (ptid.pid (), &status, 0); - if (pid == -1 && errno == ECHILD) - /* Try again with __WCLONE to check cloned processes. */ - pid = waitpid (ptid.pid (), &status, __WCLONE); - - save_errno = errno; - - /* Make sure we don't report an event for the exit of the - original program, if we've detached from it. */ - if (pid != -1 && !WIFSTOPPED (status) - && pid != inferior_ptid.pid ()) - { - pid = -1; - save_errno = EINTR; - } - - clear_sigint_trap (); - } - while (pid == -1 && save_errno == EINTR); - - if (pid == -1) - { - warning (_("Child process unexpectedly missing: %s"), - safe_strerror (save_errno)); - - /* Claim it exited with unknown signal. */ - ourstatus->kind = TARGET_WAITKIND_SIGNALLED; - ourstatus->value.sig = GDB_SIGNAL_UNKNOWN; - return inferior_ptid; - } - - store_waitstatus (ourstatus, status); - return ptid_t (pid); -} - -/* Override the fetch_inferior_register routine. */ -void -spu_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) -{ - int fd; - ULONGEST addr; - - /* Since we use functions that rely on inferior_ptid, we need to set and - restore it. */ - scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache->ptid ()); - - /* 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) - { - struct gdbarch *gdbarch = regcache->arch (); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - gdb_byte buf[4]; - store_unsigned_integer (buf, 4, byte_order, fd); - regcache->raw_supply (SPU_ID_REGNUM, buf); - } - - /* The NPC register is found at ADDR. */ - if (regno == -1 || regno == SPU_PC_REGNUM) - { - gdb_byte buf[4]; - if (fetch_ppc_memory (addr, buf, 4) == 0) - regcache->raw_supply (SPU_PC_REGNUM, buf); - } - - /* The GPRs are found in the "regs" spufs file. */ - if (regno == -1 || (regno >= 0 && regno < SPU_NUM_GPRS)) - { - gdb_byte buf[16 * SPU_NUM_GPRS]; - char annex[32]; - int i; - ULONGEST len; - - xsnprintf (annex, sizeof annex, "%d/regs", fd); - if ((spu_proc_xfer_spu (annex, buf, NULL, 0, sizeof buf, &len) - == TARGET_XFER_OK) - && len == sizeof buf) - for (i = 0; i < SPU_NUM_GPRS; i++) - regcache->raw_supply (i, buf + i*16); - } -} - -/* Override the store_inferior_register routine. */ -void -spu_linux_nat_target::store_registers (struct regcache *regcache, int regno) -{ - int fd; - ULONGEST addr; - - /* Since we use functions that rely on inferior_ptid, we need to set and - restore it. */ - scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache->ptid ()); - - /* 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) - { - gdb_byte buf[4]; - regcache->raw_collect (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_GPRS)) - { - gdb_byte buf[16 * SPU_NUM_GPRS]; - char annex[32]; - int i; - ULONGEST len; - - for (i = 0; i < SPU_NUM_GPRS; i++) - regcache->raw_collect (i, buf + i*16); - - xsnprintf (annex, sizeof annex, "%d/regs", fd); - spu_proc_xfer_spu (annex, NULL, buf, 0, sizeof buf, &len); - } -} - -/* Override the to_xfer_partial routine. */ -enum target_xfer_status -spu_linux_nat_target::xfer_partial (enum target_object object, const char *annex, - gdb_byte *readbuf, const gdb_byte *writebuf, - ULONGEST offset, ULONGEST len, - ULONGEST *xfered_len) -{ - if (object == TARGET_OBJECT_SPU) - return spu_proc_xfer_spu (annex, readbuf, writebuf, offset, len, - xfered_len); - - if (object == TARGET_OBJECT_MEMORY) - { - int fd; - ULONGEST addr; - char mem_annex[32], lslr_annex[32]; - gdb_byte buf[32]; - ULONGEST lslr; - enum target_xfer_status ret; - - /* We must be stopped on a spu_run system call. */ - if (!parse_spufs_run (&fd, &addr)) - return TARGET_XFER_EOF; - - /* Use the "mem" spufs file to access SPU local store. */ - xsnprintf (mem_annex, sizeof mem_annex, "%d/mem", fd); - ret = spu_proc_xfer_spu (mem_annex, readbuf, writebuf, offset, len, - xfered_len); - if (ret == TARGET_XFER_OK) - return ret; - - /* 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. */ - xsnprintf (lslr_annex, sizeof lslr_annex, "%d/lslr", fd); - memset (buf, 0, sizeof buf); - if (spu_proc_xfer_spu (lslr_annex, buf, NULL, 0, sizeof buf, xfered_len) - != TARGET_XFER_OK) - return ret; - - lslr = strtoulst ((const char *) buf, NULL, 16); - return spu_proc_xfer_spu (mem_annex, readbuf, writebuf, - offset & lslr, len, xfered_len); - } - - return TARGET_XFER_E_IO; -} - -/* Override the to_can_use_hw_breakpoint routine. */ -int -spu_linux_nat_target::can_use_hw_breakpoint (enum bptype type, - int cnt, int othertype) -{ - return 0; -} - -/* Initialize SPU native target. */ -void -_initialize_spu_nat (void) -{ - add_inf_child_target (&the_spu_linux_nat_target); -} diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c deleted file mode 100644 index 88ad291..0000000 --- a/gdb/spu-multiarch.c +++ /dev/null @@ -1,417 +0,0 @@ -/* Cell SPU GNU/Linux multi-architecture debugging support. - Copyright (C) 2009-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 "defs.h" -#include "gdbcore.h" -#include "gdbcmd.h" -#include "arch-utils.h" -#include "observable.h" -#include "inferior.h" -#include "regcache.h" -#include "symfile.h" -#include "objfiles.h" -#include "solib.h" -#include "solist.h" - -#include "ppc-tdep.h" -#include "ppc-linux-tdep.h" -#include "spu-tdep.h" - -/* The SPU multi-architecture support target. */ - -static const target_info spu_multiarch_target_info = { - "spu", - N_("SPU multi-architecture support."), - N_("SPU multi-architecture support.") -}; - -struct spu_multiarch_target final : public target_ops -{ - const target_info &info () const override - { return spu_multiarch_target_info; } - - strata stratum () const override { return arch_stratum; } - - void mourn_inferior () override; - - void fetch_registers (struct regcache *, int) override; - void store_registers (struct regcache *, int) override; - - enum target_xfer_status xfer_partial (enum target_object object, - const char *annex, - gdb_byte *readbuf, - const gdb_byte *writebuf, - ULONGEST offset, ULONGEST len, - ULONGEST *xfered_len) override; - - int search_memory (CORE_ADDR start_addr, ULONGEST search_space_len, - const gdb_byte *pattern, ULONGEST pattern_len, - CORE_ADDR *found_addrp) override; - - int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; - - struct gdbarch *thread_architecture (ptid_t) override; -}; - -static spu_multiarch_target spu_ops; - -/* Number of SPE objects loaded into the current inferior. */ -static int spu_nr_solib; - -/* Stand-alone SPE executable? */ -#define spu_standalone_p() \ - (symfile_objfile && symfile_objfile->obfd \ - && bfd_get_arch (symfile_objfile->obfd) == bfd_arch_spu) - -/* PPU side system calls. */ -#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 (ptid_t ptid, int *fd, CORE_ADDR *addr) -{ - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - struct gdbarch_tdep *tdep; - struct regcache *regcache; - gdb_byte buf[4]; - ULONGEST regval; - - /* If we're not on PPU, there's nothing to detect. */ - if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_powerpc) - return 0; - - /* If we're called too early (e.g. after fork), we cannot - access the inferior yet. */ - if (find_inferior_ptid (ptid) == NULL) - return 0; - - /* Get PPU-side registers. */ - regcache = get_thread_arch_regcache (ptid, target_gdbarch ()); - tdep = gdbarch_tdep (target_gdbarch ()); - - /* Fetch instruction preceding current NIP. */ - { - scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); - inferior_ptid = ptid; - regval = target_read_memory (regcache_read_pc (regcache) - 4, buf, 4); - } - if (regval != 0) - return 0; - /* It should be a "sc" instruction. */ - if (extract_unsigned_integer (buf, 4, byte_order) != INSTR_SC) - return 0; - /* System call number should be NR_spu_run. */ - regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum, ®val); - if (regval != NR_spu_run) - return 0; - - /* Register 3 contains fd, register 4 the NPC param pointer. */ - regcache_cooked_read_unsigned (regcache, PPC_ORIG_R3_REGNUM, ®val); - *fd = (int) regval; - regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 4, ®val); - *addr = (CORE_ADDR) regval; - return 1; -} - -/* Find gdbarch for SPU context SPUFS_FD. */ -static struct gdbarch * -spu_gdbarch (int spufs_fd) -{ - struct gdbarch_info info; - gdbarch_info_init (&info); - info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu); - info.byte_order = BFD_ENDIAN_BIG; - info.osabi = GDB_OSABI_LINUX; - info.id = &spufs_fd; - return gdbarch_find_by_info (info); -} - -/* Override the to_thread_architecture routine. */ -struct gdbarch * -spu_multiarch_target::thread_architecture (ptid_t ptid) -{ - int spufs_fd; - CORE_ADDR spufs_addr; - - if (parse_spufs_run (ptid, &spufs_fd, &spufs_addr)) - return spu_gdbarch (spufs_fd); - - return beneath ()->thread_architecture (ptid); -} - -/* Override the to_region_ok_for_hw_watchpoint routine. */ - -int -spu_multiarch_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -{ - /* We cannot watch SPU local store. */ - if (SPUADDR_SPU (addr) != -1) - return 0; - - return beneath ()->region_ok_for_hw_watchpoint (addr, len); -} - -/* Override the to_fetch_registers routine. */ - -void -spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno) -{ - struct gdbarch *gdbarch = regcache->arch (); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int spufs_fd; - CORE_ADDR spufs_addr; - - /* Since we use functions that rely on inferior_ptid, we need to set and - restore it. */ - scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache->ptid ()); - - /* This version applies only if we're currently in spu_run. */ - if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) - { - beneath ()->fetch_registers (regcache, regno); - return; - } - - /* We must be stopped on a spu_run system call. */ - if (!parse_spufs_run (inferior_ptid, &spufs_fd, &spufs_addr)) - return; - - /* The ID register holds the spufs file handle. */ - if (regno == -1 || regno == SPU_ID_REGNUM) - { - gdb_byte buf[4]; - store_unsigned_integer (buf, 4, byte_order, spufs_fd); - regcache->raw_supply (SPU_ID_REGNUM, buf); - } - - /* The NPC register is found in PPC memory at SPUFS_ADDR. */ - if (regno == -1 || regno == SPU_PC_REGNUM) - { - gdb_byte buf[4]; - - if (target_read (beneath (), TARGET_OBJECT_MEMORY, NULL, - buf, spufs_addr, sizeof buf) == sizeof buf) - regcache->raw_supply (SPU_PC_REGNUM, buf); - } - - /* The GPRs are found in the "regs" spufs file. */ - if (regno == -1 || (regno >= 0 && regno < SPU_NUM_GPRS)) - { - gdb_byte buf[16 * SPU_NUM_GPRS]; - char annex[32]; - int i; - - xsnprintf (annex, sizeof annex, "%d/regs", spufs_fd); - if (target_read (beneath (), TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf) == sizeof buf) - for (i = 0; i < SPU_NUM_GPRS; i++) - regcache->raw_supply (i, buf + i*16); - } -} - -/* Override the to_store_registers routine. */ - -void -spu_multiarch_target::store_registers (struct regcache *regcache, int regno) -{ - struct gdbarch *gdbarch = regcache->arch (); - int spufs_fd; - CORE_ADDR spufs_addr; - - /* Since we use functions that rely on inferior_ptid, we need to set and - restore it. */ - scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache->ptid ()); - - /* This version applies only if we're currently in spu_run. */ - if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) - { - beneath ()->store_registers (regcache, regno); - return; - } - - /* We must be stopped on a spu_run system call. */ - if (!parse_spufs_run (inferior_ptid, &spufs_fd, &spufs_addr)) - return; - - /* The NPC register is found in PPC memory at SPUFS_ADDR. */ - if (regno == -1 || regno == SPU_PC_REGNUM) - { - gdb_byte buf[4]; - regcache->raw_collect (SPU_PC_REGNUM, buf); - - target_write (beneath (), TARGET_OBJECT_MEMORY, NULL, - buf, spufs_addr, sizeof buf); - } - - /* The GPRs are found in the "regs" spufs file. */ - if (regno == -1 || (regno >= 0 && regno < SPU_NUM_GPRS)) - { - gdb_byte buf[16 * SPU_NUM_GPRS]; - char annex[32]; - int i; - - for (i = 0; i < SPU_NUM_GPRS; i++) - regcache->raw_collect (i, buf + i*16); - - xsnprintf (annex, sizeof annex, "%d/regs", spufs_fd); - target_write (beneath (), TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); - } -} - -/* Override the to_xfer_partial routine. */ - -enum target_xfer_status -spu_multiarch_target::xfer_partial (enum target_object object, - const char *annex, gdb_byte *readbuf, - const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, - ULONGEST *xfered_len) -{ - struct target_ops *ops_beneath = this->beneath (); - - /* Use the "mem" spufs file to access SPU local store. */ - if (object == TARGET_OBJECT_MEMORY) - { - int fd = SPUADDR_SPU (offset); - CORE_ADDR addr = SPUADDR_ADDR (offset); - char mem_annex[32], lslr_annex[32]; - gdb_byte buf[32]; - ULONGEST lslr; - enum target_xfer_status ret; - - if (fd >= 0) - { - xsnprintf (mem_annex, sizeof mem_annex, "%d/mem", fd); - ret = ops_beneath->xfer_partial (TARGET_OBJECT_SPU, - mem_annex, readbuf, writebuf, - addr, len, xfered_len); - if (ret == TARGET_XFER_OK) - return ret; - - /* 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. */ - xsnprintf (lslr_annex, sizeof lslr_annex, "%d/lslr", fd); - memset (buf, 0, sizeof buf); - if (ops_beneath->xfer_partial (TARGET_OBJECT_SPU, - lslr_annex, buf, NULL, - 0, sizeof buf, xfered_len) - != TARGET_XFER_OK) - return ret; - - lslr = strtoulst ((char *) buf, NULL, 16); - return ops_beneath->xfer_partial (TARGET_OBJECT_SPU, - mem_annex, readbuf, writebuf, - addr & lslr, len, xfered_len); - } - } - - return ops_beneath->xfer_partial (object, annex, - readbuf, writebuf, offset, len, xfered_len); -} - -/* Override the to_search_memory routine. */ -int -spu_multiarch_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len, - const gdb_byte *pattern, ULONGEST pattern_len, - CORE_ADDR *found_addrp) -{ - /* For SPU local store, always fall back to the simple method. */ - if (SPUADDR_SPU (start_addr) >= 0) - return simple_search_memory (this, start_addr, search_space_len, - pattern, pattern_len, found_addrp); - - return beneath ()->search_memory (start_addr, search_space_len, - pattern, pattern_len, found_addrp); -} - - -/* Push and pop the SPU multi-architecture support target. */ - -static void -spu_multiarch_activate (void) -{ - /* If GDB was configured without SPU architecture support, - we cannot install SPU multi-architecture support either. */ - if (spu_gdbarch (-1) == NULL) - return; - - push_target (&spu_ops); - - /* Make sure the thread architecture is re-evaluated. */ - registers_changed (); -} - -static void -spu_multiarch_deactivate (void) -{ - unpush_target (&spu_ops); - - /* Make sure the thread architecture is re-evaluated. */ - registers_changed (); -} - -static void -spu_multiarch_inferior_created (struct target_ops *ops, int from_tty) -{ - if (spu_standalone_p ()) - spu_multiarch_activate (); -} - -static void -spu_multiarch_solib_loaded (struct so_list *so) -{ - if (!spu_standalone_p ()) - if (so->abfd && bfd_get_arch (so->abfd) == bfd_arch_spu) - if (spu_nr_solib++ == 0) - spu_multiarch_activate (); -} - -static void -spu_multiarch_solib_unloaded (struct so_list *so) -{ - if (!spu_standalone_p ()) - if (so->abfd && bfd_get_arch (so->abfd) == bfd_arch_spu) - if (--spu_nr_solib == 0) - spu_multiarch_deactivate (); -} - -void -spu_multiarch_target::mourn_inferior () -{ - beneath ()->mourn_inferior (); - spu_multiarch_deactivate (); -} - -void -_initialize_spu_multiarch (void) -{ - /* Install observers to watch for SPU objects. */ - gdb::observers::inferior_created.attach (spu_multiarch_inferior_created); - gdb::observers::solib_loaded.attach (spu_multiarch_solib_loaded); - gdb::observers::solib_unloaded.attach (spu_multiarch_solib_unloaded); -} - diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c deleted file mode 100644 index 5360efb..0000000 --- a/gdb/spu-tdep.c +++ /dev/null @@ -1,2835 +0,0 @@ -/* SPU target-dependent code for GDB, the GNU debugger. - Copyright (C) 2006-2019 Free Software Foundation, Inc. - - Contributed by Ulrich Weigand <uweigand@de.ibm.com>. - Based on a port by Sid Manning <sid@us.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 "defs.h" -#include "arch-utils.h" -#include "gdbtypes.h" -#include "gdbcmd.h" -#include "gdbcore.h" -#include "frame.h" -#include "frame-unwind.h" -#include "frame-base.h" -#include "trad-frame.h" -#include "symtab.h" -#include "symfile.h" -#include "value.h" -#include "inferior.h" -#include "dis-asm.h" -#include "disasm.h" -#include "objfiles.h" -#include "language.h" -#include "regcache.h" -#include "reggroups.h" -#include "block.h" -#include "observable.h" -#include "infcall.h" -#include "dwarf2.h" -#include "dwarf2-frame.h" -#include "ax.h" -#include "spu-tdep.h" -#include "location.h" - -/* The list of available "set spu " and "show spu " commands. */ -static struct cmd_list_element *setspucmdlist = NULL; -static struct cmd_list_element *showspucmdlist = NULL; - -/* Whether to stop for new SPE contexts. */ -static bool spu_stop_on_load_p = false; -/* Whether to automatically flush the SW-managed cache. */ -static bool spu_auto_flush_cache_p = true; - - -/* The tdep structure. */ -struct gdbarch_tdep -{ - /* The spufs ID identifying our address space. */ - int id; - - /* SPU-specific vector type. */ - struct type *spu_builtin_type_vec128; -}; - - -/* SPU-specific vector type. */ -static struct type * -spu_builtin_type_vec128 (struct gdbarch *gdbarch) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - if (!tdep->spu_builtin_type_vec128) - { - const struct builtin_type *bt = builtin_type (gdbarch); - struct type *t; - - t = arch_composite_type (gdbarch, - "__spu_builtin_type_vec128", TYPE_CODE_UNION); - append_composite_type_field (t, "uint128", bt->builtin_int128); - append_composite_type_field (t, "v2_int64", - init_vector_type (bt->builtin_int64, 2)); - append_composite_type_field (t, "v4_int32", - init_vector_type (bt->builtin_int32, 4)); - append_composite_type_field (t, "v8_int16", - init_vector_type (bt->builtin_int16, 8)); - append_composite_type_field (t, "v16_int8", - init_vector_type (bt->builtin_int8, 16)); - append_composite_type_field (t, "v2_double", - init_vector_type (bt->builtin_double, 2)); - append_composite_type_field (t, "v4_float", - init_vector_type (bt->builtin_float, 4)); - - TYPE_VECTOR (t) = 1; - TYPE_NAME (t) = "spu_builtin_type_vec128"; - - tdep->spu_builtin_type_vec128 = t; - } - - return tdep->spu_builtin_type_vec128; -} - - -/* The list of available "info spu " commands. */ -static struct cmd_list_element *infospucmdlist = NULL; - -/* Registers. */ - -static const char * -spu_register_name (struct gdbarch *gdbarch, int reg_nr) -{ - static const char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", - "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", - "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", - "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", - "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", - "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63", - "r64", "r65", "r66", "r67", "r68", "r69", "r70", "r71", - "r72", "r73", "r74", "r75", "r76", "r77", "r78", "r79", - "r80", "r81", "r82", "r83", "r84", "r85", "r86", "r87", - "r88", "r89", "r90", "r91", "r92", "r93", "r94", "r95", - "r96", "r97", "r98", "r99", "r100", "r101", "r102", "r103", - "r104", "r105", "r106", "r107", "r108", "r109", "r110", "r111", - "r112", "r113", "r114", "r115", "r116", "r117", "r118", "r119", - "r120", "r121", "r122", "r123", "r124", "r125", "r126", "r127", - "id", "pc", "sp", "fpscr", "srr0", "lslr", "decr", "decr_status" - }; - - if (reg_nr < 0) - return NULL; - if (reg_nr >= sizeof register_names / sizeof *register_names) - return NULL; - - return register_names[reg_nr]; -} - -static struct type * -spu_register_type (struct gdbarch *gdbarch, int reg_nr) -{ - if (reg_nr < SPU_NUM_GPRS) - return spu_builtin_type_vec128 (gdbarch); - - switch (reg_nr) - { - case SPU_ID_REGNUM: - return builtin_type (gdbarch)->builtin_uint32; - - case SPU_PC_REGNUM: - return builtin_type (gdbarch)->builtin_func_ptr; - - case SPU_SP_REGNUM: - return builtin_type (gdbarch)->builtin_data_ptr; - - case SPU_FPSCR_REGNUM: - return builtin_type (gdbarch)->builtin_uint128; - - case SPU_SRR0_REGNUM: - return builtin_type (gdbarch)->builtin_uint32; - - case SPU_LSLR_REGNUM: - return builtin_type (gdbarch)->builtin_uint32; - - case SPU_DECR_REGNUM: - return builtin_type (gdbarch)->builtin_uint32; - - case SPU_DECR_STATUS_REGNUM: - return builtin_type (gdbarch)->builtin_uint32; - - default: - internal_error (__FILE__, __LINE__, _("invalid regnum")); - } -} - -/* Pseudo registers for preferred slots - stack pointer. */ - -static enum register_status -spu_pseudo_register_read_spu (readable_regcache *regcache, const char *regname, - gdb_byte *buf) -{ - struct gdbarch *gdbarch = regcache->arch (); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - enum register_status status; - gdb_byte reg[32]; - char annex[32]; - ULONGEST id; - ULONGEST ul; - - status = regcache->raw_read (SPU_ID_REGNUM, &id); - if (status != REG_VALID) - return status; - xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname); - memset (reg, 0, sizeof reg); - target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - reg, 0, sizeof reg); - - ul = strtoulst ((char *) reg, NULL, 16); - store_unsigned_integer (buf, 4, byte_order, ul); - return REG_VALID; -} - -static enum register_status -spu_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, - int regnum, gdb_byte *buf) -{ - gdb_byte reg[16]; - char annex[32]; - ULONGEST id; - enum register_status status; - - switch (regnum) - { - case SPU_SP_REGNUM: - status = regcache->raw_read (SPU_RAW_SP_REGNUM, reg); - if (status != REG_VALID) - return status; - memcpy (buf, reg, 4); - return status; - - case SPU_FPSCR_REGNUM: - status = regcache->raw_read (SPU_ID_REGNUM, &id); - if (status != REG_VALID) - return status; - xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id); - target_read (current_top_target (), TARGET_OBJECT_SPU, annex, buf, 0, 16); - return status; - - case SPU_SRR0_REGNUM: - return spu_pseudo_register_read_spu (regcache, "srr0", buf); - - case SPU_LSLR_REGNUM: - return spu_pseudo_register_read_spu (regcache, "lslr", buf); - - case SPU_DECR_REGNUM: - return spu_pseudo_register_read_spu (regcache, "decr", buf); - - case SPU_DECR_STATUS_REGNUM: - return spu_pseudo_register_read_spu (regcache, "decr_status", buf); - - default: - internal_error (__FILE__, __LINE__, _("invalid regnum")); - } -} - -static void -spu_pseudo_register_write_spu (struct regcache *regcache, const char *regname, - const gdb_byte *buf) -{ - struct gdbarch *gdbarch = regcache->arch (); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - char reg[32]; - char annex[32]; - ULONGEST id; - - regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id); - xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname); - xsnprintf (reg, sizeof reg, "0x%s", - phex_nz (extract_unsigned_integer (buf, 4, byte_order), 4)); - target_write (current_top_target (), TARGET_OBJECT_SPU, annex, - (gdb_byte *) reg, 0, strlen (reg)); -} - -static void -spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, - int regnum, const gdb_byte *buf) -{ - gdb_byte reg[16]; - char annex[32]; - ULONGEST id; - - switch (regnum) - { - case SPU_SP_REGNUM: - regcache->raw_read (SPU_RAW_SP_REGNUM, reg); - memcpy (reg, buf, 4); - regcache->raw_write (SPU_RAW_SP_REGNUM, reg); - break; - - case SPU_FPSCR_REGNUM: - regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id); - xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id); - target_write (current_top_target (), TARGET_OBJECT_SPU, annex, buf, 0, 16); - break; - - case SPU_SRR0_REGNUM: - spu_pseudo_register_write_spu (regcache, "srr0", buf); - break; - - case SPU_LSLR_REGNUM: - spu_pseudo_register_write_spu (regcache, "lslr", buf); - break; - - case SPU_DECR_REGNUM: - spu_pseudo_register_write_spu (regcache, "decr", buf); - break; - - case SPU_DECR_STATUS_REGNUM: - spu_pseudo_register_write_spu (regcache, "decr_status", buf); - break; - - default: - internal_error (__FILE__, __LINE__, _("invalid regnum")); - } -} - -static int -spu_ax_pseudo_register_collect (struct gdbarch *gdbarch, - struct agent_expr *ax, int regnum) -{ - switch (regnum) - { - case SPU_SP_REGNUM: - ax_reg_mask (ax, SPU_RAW_SP_REGNUM); - return 0; - - case SPU_FPSCR_REGNUM: - case SPU_SRR0_REGNUM: - case SPU_LSLR_REGNUM: - case SPU_DECR_REGNUM: - case SPU_DECR_STATUS_REGNUM: - return -1; - - default: - internal_error (__FILE__, __LINE__, _("invalid regnum")); - } -} - -static int -spu_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, - struct agent_expr *ax, int regnum) -{ - switch (regnum) - { - case SPU_SP_REGNUM: - ax_reg (ax, SPU_RAW_SP_REGNUM); - return 0; - - case SPU_FPSCR_REGNUM: - case SPU_SRR0_REGNUM: - case SPU_LSLR_REGNUM: - case SPU_DECR_REGNUM: - case SPU_DECR_STATUS_REGNUM: - return -1; - - default: - internal_error (__FILE__, __LINE__, _("invalid regnum")); - } -} - - -/* Value conversion -- access scalar values at the preferred slot. */ - -static struct value * -spu_value_from_register (struct gdbarch *gdbarch, struct type *type, - int regnum, struct frame_id frame_id) -{ - struct value *value = default_value_from_register (gdbarch, type, - regnum, frame_id); - LONGEST len = TYPE_LENGTH (type); - - if (regnum < SPU_NUM_GPRS && len < 16) - { - int preferred_slot = len < 4 ? 4 - len : 0; - set_value_offset (value, preferred_slot); - } - - return value; -} - -/* Register groups. */ - -static int -spu_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) -{ - /* Registers displayed via 'info regs'. */ - if (group == general_reggroup) - return 1; - - /* Registers displayed via 'info float'. */ - if (group == float_reggroup) - return 0; - - /* Registers that need to be saved/restored in order to - push or pop frames. */ - if (group == save_reggroup || group == restore_reggroup) - return 1; - - return default_register_reggroup_p (gdbarch, regnum, group); -} - -/* DWARF-2 register numbers. */ - -static int -spu_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) -{ - /* Use cooked instead of raw SP. */ - return (reg == SPU_RAW_SP_REGNUM)? SPU_SP_REGNUM : reg; -} - - -/* Address handling. */ - -static int -spu_gdbarch_id (struct gdbarch *gdbarch) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - int id = tdep->id; - - /* The objfile architecture of a standalone SPU executable does not - provide an SPU ID. Retrieve it from the objfile's relocated - address range in this special case. */ - if (id == -1 - && symfile_objfile && symfile_objfile->obfd - && bfd_get_arch (symfile_objfile->obfd) == bfd_arch_spu - && symfile_objfile->sections != symfile_objfile->sections_end) - id = SPUADDR_SPU (obj_section_addr (symfile_objfile->sections)); - - return id; -} - -static int -spu_address_class_type_flags (int byte_size, int dwarf2_addr_class) -{ - if (dwarf2_addr_class == 1) - return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; - else - return 0; -} - -static const char * -spu_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags) -{ - if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) - return "__ea"; - else - return NULL; -} - -static int -spu_address_class_name_to_type_flags (struct gdbarch *gdbarch, - const char *name, int *type_flags_ptr) -{ - if (strcmp (name, "__ea") == 0) - { - *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; - return 1; - } - else - return 0; -} - -static void -spu_address_to_pointer (struct gdbarch *gdbarch, - struct type *type, gdb_byte *buf, CORE_ADDR addr) -{ - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, - SPUADDR_ADDR (addr)); -} - -static CORE_ADDR -spu_pointer_to_address (struct gdbarch *gdbarch, - struct type *type, const gdb_byte *buf) -{ - int id = spu_gdbarch_id (gdbarch); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - ULONGEST addr - = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); - - /* Do not convert __ea pointers. */ - if (TYPE_ADDRESS_CLASS_1 (type)) - return addr; - - return addr? SPUADDR (id, addr) : 0; -} - -static CORE_ADDR -spu_integer_to_address (struct gdbarch *gdbarch, - struct type *type, const gdb_byte *buf) -{ - int id = spu_gdbarch_id (gdbarch); - ULONGEST addr = unpack_long (type, buf); - - return SPUADDR (id, addr); -} - - -/* Decoding SPU instructions. */ - -enum - { - op_lqd = 0x34, - op_lqx = 0x3c4, - op_lqa = 0x61, - op_lqr = 0x67, - op_stqd = 0x24, - op_stqx = 0x144, - op_stqa = 0x41, - op_stqr = 0x47, - - op_il = 0x081, - op_ila = 0x21, - op_a = 0x0c0, - op_ai = 0x1c, - - op_selb = 0x8, - - op_br = 0x64, - op_bra = 0x60, - op_brsl = 0x66, - op_brasl = 0x62, - op_brnz = 0x42, - op_brz = 0x40, - op_brhnz = 0x46, - op_brhz = 0x44, - op_bi = 0x1a8, - op_bisl = 0x1a9, - op_biz = 0x128, - op_binz = 0x129, - op_bihz = 0x12a, - op_bihnz = 0x12b, - }; - -static int -is_rr (unsigned int insn, int op, int *rt, int *ra, int *rb) -{ - if ((insn >> 21) == op) - { - *rt = insn & 127; - *ra = (insn >> 7) & 127; - *rb = (insn >> 14) & 127; - return 1; - } - - return 0; -} - -static int -is_rrr (unsigned int insn, int op, int *rt, int *ra, int *rb, int *rc) -{ - if ((insn >> 28) == op) - { - *rt = (insn >> 21) & 127; - *ra = (insn >> 7) & 127; - *rb = (insn >> 14) & 127; - *rc = insn & 127; - return 1; - } - - return 0; -} - -static int -is_ri7 (unsigned int insn, int op, int *rt, int *ra, int *i7) -{ - if ((insn >> 21) == op) - { - *rt = insn & 127; - *ra = (insn >> 7) & 127; - *i7 = (((insn >> 14) & 127) ^ 0x40) - 0x40; - return 1; - } - - return 0; -} - -static int -is_ri10 (unsigned int insn, int op, int *rt, int *ra, int *i10) -{ - if ((insn >> 24) == op) - { - *rt = insn & 127; - *ra = (insn >> 7) & 127; - *i10 = (((insn >> 14) & 0x3ff) ^ 0x200) - 0x200; - return 1; - } - - return 0; -} - -static int -is_ri16 (unsigned int insn, int op, int *rt, int *i16) -{ - if ((insn >> 23) == op) - { - *rt = insn & 127; - *i16 = (((insn >> 7) & 0xffff) ^ 0x8000) - 0x8000; - return 1; - } - - return 0; -} - -static int -is_ri18 (unsigned int insn, int op, int *rt, int *i18) -{ - if ((insn >> 25) == op) - { - *rt = insn & 127; - *i18 = (((insn >> 7) & 0x3ffff) ^ 0x20000) - 0x20000; - return 1; - } - - return 0; -} - -static int -is_branch (unsigned int insn, int *offset, int *reg) -{ - int rt, i7, i16; - - if (is_ri16 (insn, op_br, &rt, &i16) - || is_ri16 (insn, op_brsl, &rt, &i16) - || is_ri16 (insn, op_brnz, &rt, &i16) - || is_ri16 (insn, op_brz, &rt, &i16) - || is_ri16 (insn, op_brhnz, &rt, &i16) - || is_ri16 (insn, op_brhz, &rt, &i16)) - { - *reg = SPU_PC_REGNUM; - *offset = i16 << 2; - return 1; - } - - if (is_ri16 (insn, op_bra, &rt, &i16) - || is_ri16 (insn, op_brasl, &rt, &i16)) - { - *reg = -1; - *offset = i16 << 2; - return 1; - } - - if (is_ri7 (insn, op_bi, &rt, reg, &i7) - || is_ri7 (insn, op_bisl, &rt, reg, &i7) - || is_ri7 (insn, op_biz, &rt, reg, &i7) - || is_ri7 (insn, op_binz, &rt, reg, &i7) - || is_ri7 (insn, op_bihz, &rt, reg, &i7) - || is_ri7 (insn, op_bihnz, &rt, reg, &i7)) - { - *offset = 0; - return 1; - } - - return 0; -} - - -/* Prolog parsing. */ - -struct spu_prologue_data - { - /* Stack frame size. -1 if analysis was unsuccessful. */ - int size; - - /* How to find the CFA. The CFA is equal to SP at function entry. */ - int cfa_reg; - int cfa_offset; - - /* Offset relative to CFA where a register is saved. -1 if invalid. */ - int reg_offset[SPU_NUM_GPRS]; - }; - -static CORE_ADDR -spu_analyze_prologue (struct gdbarch *gdbarch, - CORE_ADDR start_pc, CORE_ADDR end_pc, - struct spu_prologue_data *data) -{ - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int found_sp = 0; - int found_fp = 0; - int found_lr = 0; - int found_bc = 0; - int reg_immed[SPU_NUM_GPRS]; - gdb_byte buf[16]; - CORE_ADDR prolog_pc = start_pc; - CORE_ADDR pc; - int i; - - - /* Initialize DATA to default values. */ - data->size = -1; - - data->cfa_reg = SPU_RAW_SP_REGNUM; - data->cfa_offset = 0; - - for (i = 0; i < SPU_NUM_GPRS; i++) - data->reg_offset[i] = -1; - - /* Set up REG_IMMED array. This is non-zero for a register if we know its - preferred slot currently holds this immediate value. */ - for (i = 0; i < SPU_NUM_GPRS; i++) - reg_immed[i] = 0; - - /* Scan instructions until the first branch. - - The following instructions are important prolog components: - - - The first instruction to set up the stack pointer. - - The first instruction to set up the frame pointer. - - The first instruction to save the link register. - - The first instruction to save the backchain. - - We return the instruction after the latest of these four, - or the incoming PC if none is found. The first instruction - to set up the stack pointer also defines the frame size. - - Note that instructions saving incoming arguments to their stack - slots are not counted as important, because they are hard to - identify with certainty. This should not matter much, because - arguments are relevant only in code compiled with debug data, - and in such code the GDB core will advance until the first source - line anyway, using SAL data. - - For purposes of stack unwinding, we analyze the following types - of instructions in addition: - - - Any instruction adding to the current frame pointer. - - Any instruction loading an immediate constant into a register. - - Any instruction storing a register onto the stack. - - These are used to compute the CFA and REG_OFFSET output. */ - - for (pc = start_pc; pc < end_pc; pc += 4) - { - unsigned int insn; - int rt, ra, rb, rc, immed; - - if (target_read_memory (pc, buf, 4)) - break; - insn = extract_unsigned_integer (buf, 4, byte_order); - - /* AI is the typical instruction to set up a stack frame. - It is also used to initialize the frame pointer. */ - if (is_ri10 (insn, op_ai, &rt, &ra, &immed)) - { - if (rt == data->cfa_reg && ra == data->cfa_reg) - data->cfa_offset -= immed; - - if (rt == SPU_RAW_SP_REGNUM && ra == SPU_RAW_SP_REGNUM - && !found_sp) - { - found_sp = 1; - prolog_pc = pc + 4; - - data->size = -immed; - } - else if (rt == SPU_FP_REGNUM && ra == SPU_RAW_SP_REGNUM - && !found_fp) - { - found_fp = 1; - prolog_pc = pc + 4; - - data->cfa_reg = SPU_FP_REGNUM; - data->cfa_offset -= immed; - } - } - - /* A is used to set up stack frames of size >= 512 bytes. - If we have tracked the contents of the addend register, - we can handle this as well. */ - else if (is_rr (insn, op_a, &rt, &ra, &rb)) - { - if (rt == data->cfa_reg && ra == data->cfa_reg) - { - if (reg_immed[rb] != 0) - data->cfa_offset -= reg_immed[rb]; - else - data->cfa_reg = -1; /* We don't know the CFA any more. */ - } - - if (rt == SPU_RAW_SP_REGNUM && ra == SPU_RAW_SP_REGNUM - && !found_sp) - { - found_sp = 1; - prolog_pc = pc + 4; - - if (reg_immed[rb] != 0) - data->size = -reg_immed[rb]; - } - } - - /* We need to track IL and ILA used to load immediate constants - in case they are later used as input to an A instruction. */ - else if (is_ri16 (insn, op_il, &rt, &immed)) - { - reg_immed[rt] = immed; - - if (rt == SPU_RAW_SP_REGNUM && !found_sp) - found_sp = 1; - } - - else if (is_ri18 (insn, op_ila, &rt, &immed)) - { - reg_immed[rt] = immed & 0x3ffff; - - if (rt == SPU_RAW_SP_REGNUM && !found_sp) - found_sp = 1; - } - - /* STQD is used to save registers to the stack. */ - else if (is_ri10 (insn, op_stqd, &rt, &ra, &immed)) - { - if (ra == data->cfa_reg) - data->reg_offset[rt] = data->cfa_offset - (immed << 4); - - if (ra == data->cfa_reg && rt == SPU_LR_REGNUM - && !found_lr) - { - found_lr = 1; - prolog_pc = pc + 4; - } - - if (ra == SPU_RAW_SP_REGNUM - && (found_sp? immed == 0 : rt == SPU_RAW_SP_REGNUM) - && !found_bc) - { - found_bc = 1; - prolog_pc = pc + 4; - } - } - - /* _start uses SELB to set up the stack pointer. */ - else if (is_rrr (insn, op_selb, &rt, &ra, &rb, &rc)) - { - if (rt == SPU_RAW_SP_REGNUM && !found_sp) - found_sp = 1; - } - - /* We terminate if we find a branch. */ - else if (is_branch (insn, &immed, &ra)) - break; - } - - - /* If we successfully parsed until here, and didn't find any instruction - modifying SP, we assume we have a frameless function. */ - if (!found_sp) - data->size = 0; - - /* Return cooked instead of raw SP. */ - if (data->cfa_reg == SPU_RAW_SP_REGNUM) - data->cfa_reg = SPU_SP_REGNUM; - - return prolog_pc; -} - -/* Return the first instruction after the prologue starting at PC. */ -static CORE_ADDR -spu_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) -{ - struct spu_prologue_data data; - return spu_analyze_prologue (gdbarch, pc, (CORE_ADDR)-1, &data); -} - -/* Return the frame pointer in use at address PC. */ -static void -spu_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, - int *reg, LONGEST *offset) -{ - struct spu_prologue_data data; - spu_analyze_prologue (gdbarch, pc, (CORE_ADDR)-1, &data); - - if (data.size != -1 && data.cfa_reg != -1) - { - /* The 'frame pointer' address is CFA minus frame size. */ - *reg = data.cfa_reg; - *offset = data.cfa_offset - data.size; - } - else - { - /* ??? We don't really know ... */ - *reg = SPU_SP_REGNUM; - *offset = 0; - } -} - -/* Implement the stack_frame_destroyed_p gdbarch method. - - 1) scan forward from the point of execution: - a) If you find an instruction that modifies the stack pointer - or transfers control (except a return), execution is not in - an epilogue, return. - b) Stop scanning if you find a return instruction or reach the - end of the function or reach the hard limit for the size of - an epilogue. - 2) scan backward from the point of execution: - a) If you find an instruction that modifies the stack pointer, - execution *is* in an epilogue, return. - b) Stop scanning if you reach an instruction that transfers - control or the beginning of the function or reach the hard - limit for the size of an epilogue. */ - -static int -spu_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) -{ - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR scan_pc, func_start, func_end, epilogue_start, epilogue_end; - bfd_byte buf[4]; - unsigned int insn; - int rt, ra, rb, immed; - - /* Find the search limits based on function boundaries and hard limit. - We assume the epilogue can be up to 64 instructions long. */ - - const int spu_max_epilogue_size = 64 * 4; - - if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) - return 0; - - if (pc - func_start < spu_max_epilogue_size) - epilogue_start = func_start; - else - epilogue_start = pc - spu_max_epilogue_size; - - if (func_end - pc < spu_max_epilogue_size) - epilogue_end = func_end; - else - epilogue_end = pc + spu_max_epilogue_size; - - /* Scan forward until next 'bi $0'. */ - - for (scan_pc = pc; scan_pc < epilogue_end; scan_pc += 4) - { - if (target_read_memory (scan_pc, buf, 4)) - return 0; - insn = extract_unsigned_integer (buf, 4, byte_order); - - if (is_branch (insn, &immed, &ra)) - { - if (immed == 0 && ra == SPU_LR_REGNUM) - break; - - return 0; - } - - if (is_ri10 (insn, op_ai, &rt, &ra, &immed) - || is_rr (insn, op_a, &rt, &ra, &rb) - || is_ri10 (insn, op_lqd, &rt, &ra, &immed)) - { - if (rt == SPU_RAW_SP_REGNUM) - return 0; - } - } - - if (scan_pc >= epilogue_end) - return 0; - - /* Scan backward until adjustment to stack pointer (R1). */ - - for (scan_pc = pc - 4; scan_pc >= epilogue_start; scan_pc -= 4) - { - if (target_read_memory (scan_pc, buf, 4)) - return 0; - insn = extract_unsigned_integer (buf, 4, byte_order); - - if (is_branch (insn, &immed, &ra)) - return 0; - - if (is_ri10 (insn, op_ai, &rt, &ra, &immed) - || is_rr (insn, op_a, &rt, &ra, &rb) - || is_ri10 (insn, op_lqd, &rt, &ra, &immed)) - { - if (rt == SPU_RAW_SP_REGNUM) - return 1; - } - } - - return 0; -} - - -/* Normal stack frames. */ - -struct spu_unwind_cache -{ - CORE_ADDR func; - CORE_ADDR frame_base; - CORE_ADDR local_base; - - struct trad_frame_saved_reg *saved_regs; -}; - -static struct spu_unwind_cache * -spu_frame_unwind_cache (struct frame_info *this_frame, - void **this_prologue_cache) -{ - struct gdbarch *gdbarch = get_frame_arch (this_frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - struct spu_unwind_cache *info; - struct spu_prologue_data data; - CORE_ADDR id = tdep->id; - gdb_byte buf[16]; - - if (*this_prologue_cache) - return (struct spu_unwind_cache *) *this_prologue_cache; - - info = FRAME_OBSTACK_ZALLOC (struct spu_unwind_cache); - *this_prologue_cache = info; - info->saved_regs = trad_frame_alloc_saved_regs (this_frame); - info->frame_base = 0; - info->local_base = 0; - - /* Find the start of the current function, and analyze its prologue. */ - info->func = get_frame_func (this_frame); - if (info->func == 0) - { - /* Fall back to using the current PC as frame ID. */ - info->func = get_frame_pc (this_frame); - data.size = -1; - } - else - spu_analyze_prologue (gdbarch, info->func, get_frame_pc (this_frame), - &data); - - /* If successful, use prologue analysis data. */ - if (data.size != -1 && data.cfa_reg != -1) - { - CORE_ADDR cfa; - int i; - - /* Determine CFA via unwound CFA_REG plus CFA_OFFSET. */ - get_frame_register (this_frame, data.cfa_reg, buf); - cfa = extract_unsigned_integer (buf, 4, byte_order) + data.cfa_offset; - cfa = SPUADDR (id, cfa); - - /* Call-saved register slots. */ - for (i = 0; i < SPU_NUM_GPRS; i++) - if (i == SPU_LR_REGNUM - || (i >= SPU_SAVED1_REGNUM && i <= SPU_SAVEDN_REGNUM)) - if (data.reg_offset[i] != -1) - info->saved_regs[i].addr = cfa - data.reg_offset[i]; - - /* Frame bases. */ - info->frame_base = cfa; - info->local_base = cfa - data.size; - } - - /* Otherwise, fall back to reading the backchain link. */ - else - { - CORE_ADDR reg; - LONGEST backchain; - ULONGEST lslr; - int status; - - /* Get local store limit. */ - lslr = get_frame_register_unsigned (this_frame, SPU_LSLR_REGNUM); - if (!lslr) - lslr = (ULONGEST) -1; - - /* Get the backchain. */ - reg = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); - status = safe_read_memory_integer (SPUADDR (id, reg), 4, byte_order, - &backchain); - - /* A zero backchain terminates the frame chain. Also, sanity - check against the local store size limit. */ - if (status && backchain > 0 && backchain <= lslr) - { - /* Assume the link register is saved into its slot. */ - if (backchain + 16 <= lslr) - info->saved_regs[SPU_LR_REGNUM].addr = SPUADDR (id, - backchain + 16); - - /* Frame bases. */ - info->frame_base = SPUADDR (id, backchain); - info->local_base = SPUADDR (id, reg); - } - } - - /* If we didn't find a frame, we cannot determine SP / return address. */ - if (info->frame_base == 0) - return info; - - /* The previous SP is equal to the CFA. */ - trad_frame_set_value (info->saved_regs, SPU_SP_REGNUM, - SPUADDR_ADDR (info->frame_base)); - - /* Read full contents of the unwound link register in order to - be able to determine the return address. */ - if (trad_frame_addr_p (info->saved_regs, SPU_LR_REGNUM)) - target_read_memory (info->saved_regs[SPU_LR_REGNUM].addr, buf, 16); - else - get_frame_register (this_frame, SPU_LR_REGNUM, buf); - - /* Normally, the return address is contained in the slot 0 of the - link register, and slots 1-3 are zero. For an overlay return, - slot 0 contains the address of the overlay manager return stub, - slot 1 contains the partition number of the overlay section to - be returned to, and slot 2 contains the return address within - that section. Return the latter address in that case. */ - if (extract_unsigned_integer (buf + 8, 4, byte_order) != 0) - trad_frame_set_value (info->saved_regs, SPU_PC_REGNUM, - extract_unsigned_integer (buf + 8, 4, byte_order)); - else - trad_frame_set_value (info->saved_regs, SPU_PC_REGNUM, - extract_unsigned_integer (buf, 4, byte_order)); - - return info; -} - -static void -spu_frame_this_id (struct frame_info *this_frame, - void **this_prologue_cache, struct frame_id *this_id) -{ - struct spu_unwind_cache *info = - spu_frame_unwind_cache (this_frame, this_prologue_cache); - - if (info->frame_base == 0) - return; - - *this_id = frame_id_build (info->frame_base, info->func); -} - -static struct value * -spu_frame_prev_register (struct frame_info *this_frame, - void **this_prologue_cache, int regnum) -{ - struct spu_unwind_cache *info - = spu_frame_unwind_cache (this_frame, this_prologue_cache); - - /* Special-case the stack pointer. */ - if (regnum == SPU_RAW_SP_REGNUM) - regnum = SPU_SP_REGNUM; - - return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); -} - -static const struct frame_unwind spu_frame_unwind = { - NORMAL_FRAME, - default_frame_unwind_stop_reason, - spu_frame_this_id, - spu_frame_prev_register, - NULL, - default_frame_sniffer -}; - -static CORE_ADDR -spu_frame_base_address (struct frame_info *this_frame, void **this_cache) -{ - struct spu_unwind_cache *info - = spu_frame_unwind_cache (this_frame, this_cache); - return info->local_base; -} - -static const struct frame_base spu_frame_base = { - &spu_frame_unwind, - spu_frame_base_address, - spu_frame_base_address, - spu_frame_base_address -}; - -static CORE_ADDR -spu_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - CORE_ADDR pc = frame_unwind_register_unsigned (next_frame, SPU_PC_REGNUM); - /* Mask off interrupt enable bit. */ - return SPUADDR (tdep->id, pc & -4); -} - -static CORE_ADDR -spu_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - CORE_ADDR sp = frame_unwind_register_unsigned (next_frame, SPU_SP_REGNUM); - return SPUADDR (tdep->id, sp); -} - -static CORE_ADDR -spu_read_pc (readable_regcache *regcache) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ()); - ULONGEST pc; - - regcache->cooked_read (SPU_PC_REGNUM, &pc); - /* Mask off interrupt enable bit. */ - return SPUADDR (tdep->id, pc & -4); -} - -static void -spu_write_pc (struct regcache *regcache, CORE_ADDR pc) -{ - /* Keep interrupt enabled state unchanged. */ - ULONGEST old_pc; - - regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &old_pc); - regcache_cooked_write_unsigned (regcache, SPU_PC_REGNUM, - (SPUADDR_ADDR (pc) & -4) | (old_pc & 3)); -} - - -/* Cell/B.E. cross-architecture unwinder support. */ - -struct spu2ppu_cache -{ - struct frame_id frame_id; - readonly_detached_regcache *regcache; -}; - -static struct gdbarch * -spu2ppu_prev_arch (struct frame_info *this_frame, void **this_cache) -{ - struct spu2ppu_cache *cache = (struct spu2ppu_cache *) *this_cache; - return cache->regcache->arch (); -} - -static void -spu2ppu_this_id (struct frame_info *this_frame, - void **this_cache, struct frame_id *this_id) -{ - struct spu2ppu_cache *cache = (struct spu2ppu_cache *) *this_cache; - *this_id = cache->frame_id; -} - -static struct value * -spu2ppu_prev_register (struct frame_info *this_frame, - void **this_cache, int regnum) -{ - struct spu2ppu_cache *cache = (struct spu2ppu_cache *) *this_cache; - struct gdbarch *gdbarch = cache->regcache->arch (); - gdb_byte *buf; - - buf = (gdb_byte *) alloca (register_size (gdbarch, regnum)); - cache->regcache->cooked_read (regnum, buf); - return frame_unwind_got_bytes (this_frame, regnum, buf); -} - -static int -spu2ppu_sniffer (const struct frame_unwind *self, - struct frame_info *this_frame, void **this_prologue_cache) -{ - struct gdbarch *gdbarch = get_frame_arch (this_frame); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR base, func, backchain; - gdb_byte buf[4]; - - if (gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_spu) - return 0; - - base = get_frame_sp (this_frame); - func = get_frame_pc (this_frame); - if (target_read_memory (base, buf, 4)) - return 0; - backchain = extract_unsigned_integer (buf, 4, byte_order); - - if (!backchain) - { - struct frame_info *fi; - - struct spu2ppu_cache *cache - = FRAME_OBSTACK_CALLOC (1, struct spu2ppu_cache); - - cache->frame_id = frame_id_build (base + 16, func); - - for (fi = get_next_frame (this_frame); fi; fi = get_next_frame (fi)) - if (gdbarch_bfd_arch_info (get_frame_arch (fi))->arch != bfd_arch_spu) - break; - - if (fi) - { - cache->regcache = frame_save_as_regcache (fi).release (); - *this_prologue_cache = cache; - return 1; - } - else - { - struct regcache *regcache; - regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ()); - cache->regcache = new readonly_detached_regcache (*regcache); - *this_prologue_cache = cache; - return 1; - } - } - - return 0; -} - -static void -spu2ppu_dealloc_cache (struct frame_info *self, void *this_cache) -{ - struct spu2ppu_cache *cache = (struct spu2ppu_cache *) this_cache; - delete cache->regcache; -} - -static const struct frame_unwind spu2ppu_unwind = { - ARCH_FRAME, - default_frame_unwind_stop_reason, - spu2ppu_this_id, - spu2ppu_prev_register, - NULL, - spu2ppu_sniffer, - spu2ppu_dealloc_cache, - spu2ppu_prev_arch, -}; - - -/* Function calling convention. */ - -static CORE_ADDR -spu_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) -{ - return sp & ~15; -} - -static CORE_ADDR -spu_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, - struct value **args, int nargs, struct type *value_type, - CORE_ADDR *real_pc, CORE_ADDR *bp_addr, - struct regcache *regcache) -{ - /* Allocate space sufficient for a breakpoint, keeping the stack aligned. */ - sp = (sp - 4) & ~15; - /* Store the address of that breakpoint */ - *bp_addr = sp; - /* The call starts at the callee's entry point. */ - *real_pc = funaddr; - - return sp; -} - -static int -spu_scalar_value_p (struct type *type) -{ - switch (TYPE_CODE (type)) - { - case TYPE_CODE_INT: - case TYPE_CODE_ENUM: - case TYPE_CODE_RANGE: - case TYPE_CODE_CHAR: - case TYPE_CODE_BOOL: - case TYPE_CODE_PTR: - case TYPE_CODE_REF: - case TYPE_CODE_RVALUE_REF: - return TYPE_LENGTH (type) <= 16; - - default: - return 0; - } -} - -static void -spu_value_to_regcache (struct regcache *regcache, int regnum, - struct type *type, const gdb_byte *in) -{ - int len = TYPE_LENGTH (type); - - if (spu_scalar_value_p (type)) - { - int preferred_slot = len < 4 ? 4 - len : 0; - regcache->cooked_write_part (regnum, preferred_slot, len, in); - } - else - { - while (len >= 16) - { - regcache->cooked_write (regnum++, in); - in += 16; - len -= 16; - } - - if (len > 0) - regcache->cooked_write_part (regnum, 0, len, in); - } -} - -static void -spu_regcache_to_value (struct regcache *regcache, int regnum, - struct type *type, gdb_byte *out) -{ - int len = TYPE_LENGTH (type); - - if (spu_scalar_value_p (type)) - { - int preferred_slot = len < 4 ? 4 - len : 0; - regcache->cooked_read_part (regnum, preferred_slot, len, out); - } - else - { - while (len >= 16) - { - regcache->cooked_read (regnum++, out); - out += 16; - len -= 16; - } - - if (len > 0) - regcache->cooked_read_part (regnum, 0, len, out); - } -} - -static CORE_ADDR -spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - struct regcache *regcache, CORE_ADDR bp_addr, - int nargs, struct value **args, CORE_ADDR sp, - function_call_return_method return_method, - CORE_ADDR struct_addr) -{ - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR sp_delta; - int i; - int regnum = SPU_ARG1_REGNUM; - int stack_arg = -1; - gdb_byte buf[16]; - - /* Set the return address. */ - memset (buf, 0, sizeof buf); - store_unsigned_integer (buf, 4, byte_order, SPUADDR_ADDR (bp_addr)); - regcache->cooked_write (SPU_LR_REGNUM, buf); - - /* If STRUCT_RETURN is true, then the struct return address (in - STRUCT_ADDR) will consume the first argument-passing register. - Both adjust the register count and store that value. */ - if (return_method == return_method_struct) - { - memset (buf, 0, sizeof buf); - store_unsigned_integer (buf, 4, byte_order, SPUADDR_ADDR (struct_addr)); - regcache->cooked_write (regnum++, buf); - } - - /* Fill in argument registers. */ - for (i = 0; i < nargs; i++) - { - struct value *arg = args[i]; - struct type *type = check_typedef (value_type (arg)); - const gdb_byte *contents = value_contents (arg); - int n_regs = align_up (TYPE_LENGTH (type), 16) / 16; - - /* If the argument doesn't wholly fit into registers, it and - all subsequent arguments go to the stack. */ - if (regnum + n_regs - 1 > SPU_ARGN_REGNUM) - { - stack_arg = i; - break; - } - - spu_value_to_regcache (regcache, regnum, type, contents); - regnum += n_regs; - } - - /* Overflow arguments go to the stack. */ - if (stack_arg != -1) - { - CORE_ADDR ap; - - /* Allocate all required stack size. */ - for (i = stack_arg; i < nargs; i++) - { - struct type *type = check_typedef (value_type (args[i])); - sp -= align_up (TYPE_LENGTH (type), 16); - } - - /* Fill in stack arguments. */ - ap = sp; - for (i = stack_arg; i < nargs; i++) - { - struct value *arg = args[i]; - struct type *type = check_typedef (value_type (arg)); - int len = TYPE_LENGTH (type); - int preferred_slot; - - if (spu_scalar_value_p (type)) - preferred_slot = len < 4 ? 4 - len : 0; - else - preferred_slot = 0; - - target_write_memory (ap + preferred_slot, value_contents (arg), len); - ap += align_up (TYPE_LENGTH (type), 16); - } - } - - /* Allocate stack frame header. */ - sp -= 32; - - /* Store stack back chain. */ - regcache->cooked_read (SPU_RAW_SP_REGNUM, buf); - target_write_memory (sp, buf, 16); - - /* Finally, update all slots of the SP register. */ - sp_delta = sp - extract_unsigned_integer (buf, 4, byte_order); - for (i = 0; i < 4; i++) - { - CORE_ADDR sp_slot = extract_unsigned_integer (buf + 4*i, 4, byte_order); - store_unsigned_integer (buf + 4*i, 4, byte_order, sp_slot + sp_delta); - } - regcache->cooked_write (SPU_RAW_SP_REGNUM, buf); - - return sp; -} - -static struct frame_id -spu_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - CORE_ADDR pc = get_frame_register_unsigned (this_frame, SPU_PC_REGNUM); - CORE_ADDR sp = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); - return frame_id_build (SPUADDR (tdep->id, sp), SPUADDR (tdep->id, pc & -4)); -} - -/* Function return value access. */ - -static enum return_value_convention -spu_return_value (struct gdbarch *gdbarch, struct value *function, - struct type *type, struct regcache *regcache, - gdb_byte *out, const gdb_byte *in) -{ - struct type *func_type = function ? value_type (function) : NULL; - enum return_value_convention rvc; - int opencl_vector = 0; - - if (func_type) - { - func_type = check_typedef (func_type); - - if (TYPE_CODE (func_type) == TYPE_CODE_PTR) - func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); - - if (TYPE_CODE (func_type) == TYPE_CODE_FUNC - && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GDB_IBM_OpenCL - && TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_VECTOR (type)) - opencl_vector = 1; - } - - if (TYPE_LENGTH (type) <= (SPU_ARGN_REGNUM - SPU_ARG1_REGNUM + 1) * 16) - rvc = RETURN_VALUE_REGISTER_CONVENTION; - else - rvc = RETURN_VALUE_STRUCT_CONVENTION; - - if (in) - { - switch (rvc) - { - case RETURN_VALUE_REGISTER_CONVENTION: - if (opencl_vector && TYPE_LENGTH (type) == 2) - regcache->cooked_write_part (SPU_ARG1_REGNUM, 2, 2, in); - else - spu_value_to_regcache (regcache, SPU_ARG1_REGNUM, type, in); - break; - - case RETURN_VALUE_STRUCT_CONVENTION: - error (_("Cannot set function return value.")); - break; - } - } - else if (out) - { - switch (rvc) - { - case RETURN_VALUE_REGISTER_CONVENTION: - if (opencl_vector && TYPE_LENGTH (type) == 2) - regcache->cooked_read_part (SPU_ARG1_REGNUM, 2, 2, out); - else - spu_regcache_to_value (regcache, SPU_ARG1_REGNUM, type, out); - break; - - case RETURN_VALUE_STRUCT_CONVENTION: - error (_("Function return value unknown.")); - break; - } - } - - return rvc; -} - - -/* Breakpoints. */ -constexpr gdb_byte spu_break_insn[] = { 0x00, 0x00, 0x3f, 0xff }; - -typedef BP_MANIPULATION (spu_break_insn) spu_breakpoint; - -static int -spu_memory_remove_breakpoint (struct gdbarch *gdbarch, - struct bp_target_info *bp_tgt) -{ - /* We work around a problem in combined Cell/B.E. debugging here. Consider - that in a combined application, we have some breakpoints inserted in SPU - code, and now the application forks (on the PPU side). GDB common code - will assume that the fork system call copied all breakpoints into the new - process' address space, and that all those copies now need to be removed - (see breakpoint.c:detach_breakpoints). - - While this is certainly true for PPU side breakpoints, it is not true - for SPU side breakpoints. fork will clone the SPU context file - descriptors, so that all the existing SPU contexts are in accessible - in the new process. However, the contents of the SPU contexts themselves - are *not* cloned. Therefore the effect of detach_breakpoints is to - remove SPU breakpoints from the *original* SPU context's local store - -- this is not the correct behaviour. - - The workaround is to check whether the PID we are asked to remove this - breakpoint from (i.e. inferior_ptid.pid ()) is different from the - PID of the current inferior (i.e. current_inferior ()->pid). This is only - true in the context of detach_breakpoints. If so, we simply do nothing. - [ Note that for the fork child process, it does not matter if breakpoints - remain inserted, because those SPU contexts are not runnable anyway -- - the Linux kernel allows only the original process to invoke spu_run. */ - - if (inferior_ptid.pid () != current_inferior ()->pid) - return 0; - - return default_memory_remove_breakpoint (gdbarch, bp_tgt); -} - - -/* Software single-stepping support. */ - -static std::vector<CORE_ADDR> -spu_software_single_step (struct regcache *regcache) -{ - struct gdbarch *gdbarch = regcache->arch (); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR pc, next_pc; - unsigned int insn; - int offset, reg; - gdb_byte buf[4]; - ULONGEST lslr; - std::vector<CORE_ADDR> next_pcs; - - pc = regcache_read_pc (regcache); - - if (target_read_memory (pc, buf, 4)) - throw_error (MEMORY_ERROR, _("Could not read instruction at %s."), - paddress (gdbarch, pc)); - - insn = extract_unsigned_integer (buf, 4, byte_order); - - /* Get local store limit. */ - if ((regcache_cooked_read_unsigned (regcache, SPU_LSLR_REGNUM, &lslr) - != REG_VALID) || !lslr) - lslr = (ULONGEST) -1; - - /* Next sequential instruction is at PC + 4, except if the current - instruction is a PPE-assisted call, in which case it is at PC + 8. - Wrap around LS limit to be on the safe side. */ - if ((insn & 0xffffff00) == 0x00002100) - next_pc = (SPUADDR_ADDR (pc) + 8) & lslr; - else - next_pc = (SPUADDR_ADDR (pc) + 4) & lslr; - - next_pcs.push_back (SPUADDR (SPUADDR_SPU (pc), next_pc)); - - if (is_branch (insn, &offset, ®)) - { - CORE_ADDR target = offset; - - if (reg == SPU_PC_REGNUM) - target += SPUADDR_ADDR (pc); - else if (reg != -1) - { - regcache->raw_read_part (reg, 0, 4, buf); - target += extract_unsigned_integer (buf, 4, byte_order) & -4; - } - - target = target & lslr; - if (target != next_pc) - next_pcs.push_back (SPUADDR (SPUADDR_SPU (pc), target)); - } - - return next_pcs; -} - - -/* Longjmp support. */ - -static int -spu_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) -{ - struct gdbarch *gdbarch = get_frame_arch (frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - gdb_byte buf[4]; - CORE_ADDR jb_addr; - int optim, unavail; - - /* Jump buffer is pointed to by the argument register $r3. */ - if (!get_frame_register_bytes (frame, SPU_ARG1_REGNUM, 0, 4, buf, - &optim, &unavail)) - return 0; - - jb_addr = extract_unsigned_integer (buf, 4, byte_order); - if (target_read_memory (SPUADDR (tdep->id, jb_addr), buf, 4)) - return 0; - - *pc = extract_unsigned_integer (buf, 4, byte_order); - *pc = SPUADDR (tdep->id, *pc); - return 1; -} - - -/* Disassembler. */ - -struct spu_dis_asm_info : disassemble_info -{ - int id; -}; - -static void -spu_dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) -{ - struct spu_dis_asm_info *data = (struct spu_dis_asm_info *) info; - gdb_disassembler *di - = static_cast<gdb_disassembler *>(info->application_data); - - print_address (di->arch (), SPUADDR (data->id, addr), - (struct ui_file *) info->stream); -} - -static int -gdb_print_insn_spu (bfd_vma memaddr, struct disassemble_info *info) -{ - /* The opcodes disassembler does 18-bit address arithmetic. Make - sure the SPU ID encoded in the high bits is added back when we - call print_address. */ - struct spu_dis_asm_info spu_info; - - memcpy (&spu_info, info, sizeof (*info)); - spu_info.id = SPUADDR_SPU (memaddr); - spu_info.print_address_func = spu_dis_asm_print_address; - return default_print_insn (memaddr, &spu_info); -} - - -/* Target overlays for the SPU overlay manager. - - See the documentation of simple_overlay_update for how the - interface is supposed to work. - - Data structures used by the overlay manager: - - struct ovly_table - { - u32 vma; - u32 size; - u32 pos; - u32 buf; - } _ovly_table[]; -- one entry per overlay section - - struct ovly_buf_table - { - u32 mapped; - } _ovly_buf_table[]; -- one entry per overlay buffer - - _ovly_table should never change. - - Both tables are aligned to a 16-byte boundary, the symbols - _ovly_table and _ovly_buf_table are of type STT_OBJECT and their - size set to the size of the respective array. buf in _ovly_table is - an index into _ovly_buf_table. - - mapped is an index into _ovly_table. Both the mapped and buf indices start - from one to reference the first entry in their respective tables. */ - -/* Using the per-objfile private data mechanism, we store for each - objfile an array of "struct spu_overlay_table" structures, one - for each obj_section of the objfile. This structure holds two - fields, MAPPED_PTR and MAPPED_VAL. If MAPPED_PTR is zero, this - is *not* an overlay section. If it is non-zero, it represents - a target address. The overlay section is mapped iff the target - integer at this location equals MAPPED_VAL. */ - -struct spu_overlay_table - { - CORE_ADDR mapped_ptr; - CORE_ADDR mapped_val; - }; - -static objfile_key<spu_overlay_table, - gdb::noop_deleter<spu_overlay_table>> spu_overlay_data; - -/* Retrieve the overlay table for OBJFILE. If not already cached, read - the _ovly_table data structure from the target and initialize the - spu_overlay_table data structure from it. */ -static struct spu_overlay_table * -spu_get_overlay_table (struct objfile *objfile) -{ - enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)? - BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; - struct bound_minimal_symbol ovly_table_msym, ovly_buf_table_msym; - CORE_ADDR ovly_table_base, ovly_buf_table_base; - unsigned ovly_table_size, ovly_buf_table_size; - struct spu_overlay_table *tbl; - struct obj_section *osect; - gdb_byte *ovly_table; - int i; - - tbl = spu_overlay_data.get (objfile); - if (tbl) - return tbl; - - ovly_table_msym = lookup_minimal_symbol ("_ovly_table", NULL, objfile); - if (!ovly_table_msym.minsym) - return NULL; - - ovly_buf_table_msym = lookup_minimal_symbol ("_ovly_buf_table", - NULL, objfile); - if (!ovly_buf_table_msym.minsym) - return NULL; - - ovly_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_table_msym); - ovly_table_size = MSYMBOL_SIZE (ovly_table_msym.minsym); - - ovly_buf_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_buf_table_msym); - ovly_buf_table_size = MSYMBOL_SIZE (ovly_buf_table_msym.minsym); - - ovly_table = (gdb_byte *) xmalloc (ovly_table_size); - read_memory (ovly_table_base, ovly_table, ovly_table_size); - - tbl = OBSTACK_CALLOC (&objfile->objfile_obstack, - objfile->sections_end - objfile->sections, - struct spu_overlay_table); - - for (i = 0; i < ovly_table_size / 16; i++) - { - CORE_ADDR vma = extract_unsigned_integer (ovly_table + 16*i + 0, - 4, byte_order); - /* Note that this skips the "size" entry, which is at offset - 4. */ - CORE_ADDR pos = extract_unsigned_integer (ovly_table + 16*i + 8, - 4, byte_order); - CORE_ADDR buf = extract_unsigned_integer (ovly_table + 16*i + 12, - 4, byte_order); - - if (buf == 0 || (buf - 1) * 4 >= ovly_buf_table_size) - continue; - - ALL_OBJFILE_OSECTIONS (objfile, osect) - if (vma == bfd_section_vma (osect->the_bfd_section) - && pos == osect->the_bfd_section->filepos) - { - int ndx = osect - objfile->sections; - tbl[ndx].mapped_ptr = ovly_buf_table_base + (buf - 1) * 4; - tbl[ndx].mapped_val = i + 1; - break; - } - } - - xfree (ovly_table); - spu_overlay_data.set (objfile, tbl); - return tbl; -} - -/* Read _ovly_buf_table entry from the target to dermine whether - OSECT is currently mapped, and update the mapped state. */ -static void -spu_overlay_update_osect (struct obj_section *osect) -{ - enum bfd_endian byte_order = bfd_big_endian (osect->objfile->obfd)? - BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; - struct spu_overlay_table *ovly_table; - CORE_ADDR id, val; - - ovly_table = spu_get_overlay_table (osect->objfile); - if (!ovly_table) - return; - - ovly_table += osect - osect->objfile->sections; - if (ovly_table->mapped_ptr == 0) - return; - - id = SPUADDR_SPU (obj_section_addr (osect)); - val = read_memory_unsigned_integer (SPUADDR (id, ovly_table->mapped_ptr), - 4, byte_order); - osect->ovly_mapped = (val == ovly_table->mapped_val); -} - -/* If OSECT is NULL, then update all sections' mapped state. - If OSECT is non-NULL, then update only OSECT's mapped state. */ -static void -spu_overlay_update (struct obj_section *osect) -{ - /* Just one section. */ - if (osect) - spu_overlay_update_osect (osect); - - /* All sections. */ - else - { - for (objfile *objfile : current_program_space->objfiles ()) - ALL_OBJFILE_OSECTIONS (objfile, osect) - if (section_is_overlay (osect)) - spu_overlay_update_osect (osect); - } -} - -/* Whenever a new objfile is loaded, read the target's _ovly_table. - If there is one, go through all sections and make sure for non- - overlay sections LMA equals VMA, while for overlay sections LMA - is larger than SPU_OVERLAY_LMA. */ -static void -spu_overlay_new_objfile (struct objfile *objfile) -{ - struct spu_overlay_table *ovly_table; - struct obj_section *osect; - - /* If we've already touched this file, do nothing. */ - if (!objfile || spu_overlay_data.get (objfile) != NULL) - return; - - /* Consider only SPU objfiles. */ - if (bfd_get_arch (objfile->obfd) != bfd_arch_spu) - return; - - /* Check if this objfile has overlays. */ - ovly_table = spu_get_overlay_table (objfile); - if (!ovly_table) - return; - - /* Now go and fiddle with all the LMAs. */ - ALL_OBJFILE_OSECTIONS (objfile, osect) - { - asection *bsect = osect->the_bfd_section; - int ndx = osect - objfile->sections; - - if (ovly_table[ndx].mapped_ptr == 0) - bfd_set_section_lma (bsect, bfd_section_vma (bsect)); - else - bfd_set_section_lma (bsect, SPU_OVERLAY_LMA + bsect->filepos); - } -} - - -/* Insert temporary breakpoint on "main" function of newly loaded - SPE context OBJFILE. */ -static void -spu_catch_start (struct objfile *objfile) -{ - struct bound_minimal_symbol minsym; - struct compunit_symtab *cust; - CORE_ADDR pc; - - /* Do this only if requested by "set spu stop-on-load on". */ - if (!spu_stop_on_load_p) - return; - - /* Consider only SPU objfiles. */ - if (!objfile || bfd_get_arch (objfile->obfd) != bfd_arch_spu) - return; - - /* The main objfile is handled differently. */ - if (objfile == symfile_objfile) - return; - - /* There can be multiple symbols named "main". Search for the - "main" in *this* objfile. */ - minsym = lookup_minimal_symbol ("main", NULL, objfile); - if (!minsym.minsym) - return; - - /* If we have debugging information, try to use it -- this - will allow us to properly skip the prologue. */ - pc = BMSYMBOL_VALUE_ADDRESS (minsym); - cust - = find_pc_sect_compunit_symtab (pc, MSYMBOL_OBJ_SECTION (minsym.objfile, - minsym.minsym)); - if (cust != NULL) - { - const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust); - const struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - struct symbol *sym; - struct symtab_and_line sal; - - sym = block_lookup_symbol (block, "main", - symbol_name_match_type::SEARCH_NAME, - VAR_DOMAIN); - if (sym) - { - fixup_symbol_section (sym, objfile); - sal = find_function_start_sal (sym, 1); - pc = sal.pc; - } - } - - /* Use a numerical address for the set_breakpoint command to avoid having - the breakpoint re-set incorrectly. */ - event_location_up location = new_address_location (pc, NULL, 0); - create_breakpoint (get_objfile_arch (objfile), location.get (), - NULL /* cond_string */, -1 /* thread */, - NULL /* extra_string */, - 0 /* parse_condition_and_thread */, 1 /* tempflag */, - bp_breakpoint /* type_wanted */, - 0 /* ignore_count */, - AUTO_BOOLEAN_FALSE /* pending_break_support */, - &bkpt_breakpoint_ops /* ops */, 0 /* from_tty */, - 1 /* enabled */, 0 /* internal */, 0); -} - - -/* Look up OBJFILE loaded into FRAME's SPU context. */ -static struct objfile * -spu_objfile_from_frame (struct frame_info *frame) -{ - struct gdbarch *gdbarch = get_frame_arch (frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) - return NULL; - - for (objfile *obj : current_program_space->objfiles ()) - { - if (obj->sections != obj->sections_end - && SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id) - return obj; - } - - return NULL; -} - -/* Flush cache for ea pointer access if available. */ -static void -flush_ea_cache (void) -{ - struct bound_minimal_symbol msymbol; - struct objfile *obj; - - if (!has_stack_frames ()) - return; - - obj = spu_objfile_from_frame (get_current_frame ()); - if (obj == NULL) - return; - - /* Lookup inferior function __cache_flush. */ - msymbol = lookup_minimal_symbol ("__cache_flush", NULL, obj); - if (msymbol.minsym != NULL) - { - struct type *type; - CORE_ADDR addr; - - type = objfile_type (obj)->builtin_void; - type = lookup_function_type (type); - type = lookup_pointer_type (type); - addr = BMSYMBOL_VALUE_ADDRESS (msymbol); - - call_function_by_hand (value_from_pointer (type, addr), NULL, {}); - } -} - -/* This handler is called when the inferior has stopped. If it is stopped in - SPU architecture then flush the ea cache if used. */ -static void -spu_attach_normal_stop (struct bpstats *bs, int print_frame) -{ - if (!spu_auto_flush_cache_p) - return; - - /* Temporarily reset spu_auto_flush_cache_p to avoid recursively - re-entering this function when __cache_flush stops. */ - spu_auto_flush_cache_p = 0; - flush_ea_cache (); - spu_auto_flush_cache_p = 1; -} - - -/* "info spu" commands. */ - -static void -info_spu_event_command (const char *args, int from_tty) -{ - struct frame_info *frame = get_selected_frame (NULL); - ULONGEST event_status = 0; - ULONGEST event_mask = 0; - gdb_byte buf[100]; - char annex[32]; - LONGEST len; - int id; - - if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu) - error (_("\"info spu\" is only supported on the SPU architecture.")); - - id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); - - xsnprintf (annex, sizeof annex, "%d/event_status", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, (sizeof (buf) - 1)); - if (len <= 0) - error (_("Could not read event_status.")); - buf[len] = '\0'; - event_status = strtoulst ((char *) buf, NULL, 16); - - xsnprintf (annex, sizeof annex, "%d/event_mask", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, (sizeof (buf) - 1)); - if (len <= 0) - error (_("Could not read event_mask.")); - buf[len] = '\0'; - event_mask = strtoulst ((char *) buf, NULL, 16); - - ui_out_emit_tuple tuple_emitter (current_uiout, "SPUInfoEvent"); - - current_uiout->text (_("Event Status ")); - current_uiout->field_fmt ("event_status", "0x%s", phex (event_status, 4)); - current_uiout->text ("\n"); - current_uiout->text (_("Event Mask ")); - current_uiout->field_fmt ("event_mask", "0x%s", phex (event_mask, 4)); - current_uiout->text ("\n"); -} - -static void -info_spu_signal_command (const char *args, int from_tty) -{ - struct frame_info *frame = get_selected_frame (NULL); - struct gdbarch *gdbarch = get_frame_arch (frame); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - ULONGEST signal1 = 0; - ULONGEST signal1_type = 0; - int signal1_pending = 0; - ULONGEST signal2 = 0; - ULONGEST signal2_type = 0; - int signal2_pending = 0; - char annex[32]; - gdb_byte buf[100]; - LONGEST len; - int id; - - if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) - error (_("\"info spu\" is only supported on the SPU architecture.")); - - id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); - - xsnprintf (annex, sizeof annex, "%d/signal1", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, - annex, buf, 0, 4); - if (len < 0) - error (_("Could not read signal1.")); - else if (len == 4) - { - signal1 = extract_unsigned_integer (buf, 4, byte_order); - signal1_pending = 1; - } - - xsnprintf (annex, sizeof annex, "%d/signal1_type", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, (sizeof (buf) - 1)); - if (len <= 0) - error (_("Could not read signal1_type.")); - buf[len] = '\0'; - signal1_type = strtoulst ((char *) buf, NULL, 16); - - xsnprintf (annex, sizeof annex, "%d/signal2", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, - annex, buf, 0, 4); - if (len < 0) - error (_("Could not read signal2.")); - else if (len == 4) - { - signal2 = extract_unsigned_integer (buf, 4, byte_order); - signal2_pending = 1; - } - - xsnprintf (annex, sizeof annex, "%d/signal2_type", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, (sizeof (buf) - 1)); - if (len <= 0) - error (_("Could not read signal2_type.")); - buf[len] = '\0'; - signal2_type = strtoulst ((char *) buf, NULL, 16); - - ui_out_emit_tuple tuple_emitter (current_uiout, "SPUInfoSignal"); - - if (current_uiout->is_mi_like_p ()) - { - current_uiout->field_signed ("signal1_pending", signal1_pending); - current_uiout->field_fmt ("signal1", "0x%s", phex_nz (signal1, 4)); - current_uiout->field_signed ("signal1_type", signal1_type); - current_uiout->field_signed ("signal2_pending", signal2_pending); - current_uiout->field_fmt ("signal2", "0x%s", phex_nz (signal2, 4)); - current_uiout->field_signed ("signal2_type", signal2_type); - } - else - { - if (signal1_pending) - printf_filtered (_("Signal 1 control word 0x%s "), phex (signal1, 4)); - else - printf_filtered (_("Signal 1 not pending ")); - - if (signal1_type) - printf_filtered (_("(Type Or)\n")); - else - printf_filtered (_("(Type Overwrite)\n")); - - if (signal2_pending) - printf_filtered (_("Signal 2 control word 0x%s "), phex (signal2, 4)); - else - printf_filtered (_("Signal 2 not pending ")); - - if (signal2_type) - printf_filtered (_("(Type Or)\n")); - else - printf_filtered (_("(Type Overwrite)\n")); - } -} - -static void -info_spu_mailbox_list (gdb_byte *buf, int nr, enum bfd_endian byte_order, - const char *field, const char *msg) -{ - int i; - - if (nr <= 0) - return; - - ui_out_emit_table table_emitter (current_uiout, 1, nr, "mbox"); - - current_uiout->table_header (32, ui_left, field, msg); - current_uiout->table_body (); - - for (i = 0; i < nr; i++) - { - { - ULONGEST val; - ui_out_emit_tuple tuple_emitter (current_uiout, "mbox"); - val = extract_unsigned_integer (buf + 4*i, 4, byte_order); - current_uiout->field_fmt (field, "0x%s", phex (val, 4)); - } - - current_uiout->text ("\n"); - } -} - -static void -info_spu_mailbox_command (const char *args, int from_tty) -{ - struct frame_info *frame = get_selected_frame (NULL); - struct gdbarch *gdbarch = get_frame_arch (frame); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - char annex[32]; - gdb_byte buf[1024]; - LONGEST len; - int id; - - if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) - error (_("\"info spu\" is only supported on the SPU architecture.")); - - id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); - - ui_out_emit_tuple tuple_emitter (current_uiout, "SPUInfoMailbox"); - - xsnprintf (annex, sizeof annex, "%d/mbox_info", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); - if (len < 0) - error (_("Could not read mbox_info.")); - - info_spu_mailbox_list (buf, len / 4, byte_order, - "mbox", "SPU Outbound Mailbox"); - - xsnprintf (annex, sizeof annex, "%d/ibox_info", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); - if (len < 0) - error (_("Could not read ibox_info.")); - - info_spu_mailbox_list (buf, len / 4, byte_order, - "ibox", "SPU Outbound Interrupt Mailbox"); - - xsnprintf (annex, sizeof annex, "%d/wbox_info", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); - if (len < 0) - error (_("Could not read wbox_info.")); - - info_spu_mailbox_list (buf, len / 4, byte_order, - "wbox", "SPU Inbound Mailbox"); -} - -static ULONGEST -spu_mfc_get_bitfield (ULONGEST word, int first, int last) -{ - ULONGEST mask = ~(~(ULONGEST)0 << (last - first + 1)); - return (word >> (63 - last)) & mask; -} - -static void -info_spu_dma_cmdlist (gdb_byte *buf, int nr, enum bfd_endian byte_order) -{ - static const char *spu_mfc_opcode[256] = - { - /* 00 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* 10 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* 20 */ "put", "putb", "putf", NULL, "putl", "putlb", "putlf", NULL, - "puts", "putbs", "putfs", NULL, NULL, NULL, NULL, NULL, - /* 30 */ "putr", "putrb", "putrf", NULL, "putrl", "putrlb", "putrlf", NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* 40 */ "get", "getb", "getf", NULL, "getl", "getlb", "getlf", NULL, - "gets", "getbs", "getfs", NULL, NULL, NULL, NULL, NULL, - /* 50 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* 60 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* 70 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* 80 */ "sdcrt", "sdcrtst", NULL, NULL, NULL, NULL, NULL, NULL, - NULL, "sdcrz", NULL, NULL, NULL, "sdcrst", NULL, "sdcrf", - /* 90 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* a0 */ "sndsig", "sndsigb", "sndsigf", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* b0 */ "putlluc", NULL, NULL, NULL, "putllc", NULL, NULL, NULL, - "putqlluc", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* c0 */ "barrier", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - "mfceieio", NULL, NULL, NULL, "mfcsync", NULL, NULL, NULL, - /* d0 */ "getllar", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* e0 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - /* f0 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - }; - - int *seq = XALLOCAVEC (int, nr); - int done = 0; - int i, j; - - - /* Determine sequence in which to display (valid) entries. */ - for (i = 0; i < nr; i++) - { - /* Search for the first valid entry all of whose - dependencies are met. */ - for (j = 0; j < nr; j++) - { - ULONGEST mfc_cq_dw3; - ULONGEST dependencies; - - if (done & (1 << (nr - 1 - j))) - continue; - - mfc_cq_dw3 - = extract_unsigned_integer (buf + 32*j + 24,8, byte_order); - if (!spu_mfc_get_bitfield (mfc_cq_dw3, 16, 16)) - continue; - - dependencies = spu_mfc_get_bitfield (mfc_cq_dw3, 0, nr - 1); - if ((dependencies & done) != dependencies) - continue; - - seq[i] = j; - done |= 1 << (nr - 1 - j); - break; - } - - if (j == nr) - break; - } - - nr = i; - - - ui_out_emit_table table_emitter (current_uiout, 10, nr, "dma_cmd"); - - current_uiout->table_header (7, ui_left, "opcode", "Opcode"); - current_uiout->table_header (3, ui_left, "tag", "Tag"); - current_uiout->table_header (3, ui_left, "tid", "TId"); - current_uiout->table_header (3, ui_left, "rid", "RId"); - current_uiout->table_header (18, ui_left, "ea", "EA"); - current_uiout->table_header (7, ui_left, "lsa", "LSA"); - current_uiout->table_header (7, ui_left, "size", "Size"); - current_uiout->table_header (7, ui_left, "lstaddr", "LstAddr"); - current_uiout->table_header (7, ui_left, "lstsize", "LstSize"); - current_uiout->table_header (1, ui_left, "error_p", "E"); - - current_uiout->table_body (); - - for (i = 0; i < nr; i++) - { - ULONGEST mfc_cq_dw0; - ULONGEST mfc_cq_dw1; - ULONGEST mfc_cq_dw2; - int mfc_cmd_opcode, mfc_cmd_tag, rclass_id, tclass_id; - int list_lsa, list_size, mfc_lsa, mfc_size; - ULONGEST mfc_ea; - int list_valid_p, qw_valid_p, ea_valid_p, cmd_error_p; - - /* Decode contents of MFC Command Queue Context Save/Restore Registers. - See "Cell Broadband Engine Registers V1.3", section 3.3.2.1. */ - - mfc_cq_dw0 - = extract_unsigned_integer (buf + 32*seq[i], 8, byte_order); - mfc_cq_dw1 - = extract_unsigned_integer (buf + 32*seq[i] + 8, 8, byte_order); - mfc_cq_dw2 - = extract_unsigned_integer (buf + 32*seq[i] + 16, 8, byte_order); - - list_lsa = spu_mfc_get_bitfield (mfc_cq_dw0, 0, 14); - list_size = spu_mfc_get_bitfield (mfc_cq_dw0, 15, 26); - mfc_cmd_opcode = spu_mfc_get_bitfield (mfc_cq_dw0, 27, 34); - mfc_cmd_tag = spu_mfc_get_bitfield (mfc_cq_dw0, 35, 39); - list_valid_p = spu_mfc_get_bitfield (mfc_cq_dw0, 40, 40); - rclass_id = spu_mfc_get_bitfield (mfc_cq_dw0, 41, 43); - tclass_id = spu_mfc_get_bitfield (mfc_cq_dw0, 44, 46); - - mfc_ea = spu_mfc_get_bitfield (mfc_cq_dw1, 0, 51) << 12 - | spu_mfc_get_bitfield (mfc_cq_dw2, 25, 36); - - mfc_lsa = spu_mfc_get_bitfield (mfc_cq_dw2, 0, 13); - mfc_size = spu_mfc_get_bitfield (mfc_cq_dw2, 14, 24); - qw_valid_p = spu_mfc_get_bitfield (mfc_cq_dw2, 38, 38); - ea_valid_p = spu_mfc_get_bitfield (mfc_cq_dw2, 39, 39); - cmd_error_p = spu_mfc_get_bitfield (mfc_cq_dw2, 40, 40); - - { - ui_out_emit_tuple tuple_emitter (current_uiout, "cmd"); - - if (spu_mfc_opcode[mfc_cmd_opcode]) - current_uiout->field_string ("opcode", spu_mfc_opcode[mfc_cmd_opcode]); - else - current_uiout->field_signed ("opcode", mfc_cmd_opcode); - - current_uiout->field_signed ("tag", mfc_cmd_tag); - current_uiout->field_signed ("tid", tclass_id); - current_uiout->field_signed ("rid", rclass_id); - - if (ea_valid_p) - current_uiout->field_fmt ("ea", "0x%s", phex (mfc_ea, 8)); - else - current_uiout->field_skip ("ea"); - - current_uiout->field_fmt ("lsa", "0x%05x", mfc_lsa << 4); - if (qw_valid_p) - current_uiout->field_fmt ("size", "0x%05x", mfc_size << 4); - else - current_uiout->field_fmt ("size", "0x%05x", mfc_size); - - if (list_valid_p) - { - current_uiout->field_fmt ("lstaddr", "0x%05x", list_lsa << 3); - current_uiout->field_fmt ("lstsize", "0x%05x", list_size << 3); - } - else - { - current_uiout->field_skip ("lstaddr"); - current_uiout->field_skip ("lstsize"); - } - - if (cmd_error_p) - current_uiout->field_string ("error_p", "*"); - else - current_uiout->field_skip ("error_p"); - } - - current_uiout->text ("\n"); - } -} - -static void -info_spu_dma_command (const char *args, int from_tty) -{ - struct frame_info *frame = get_selected_frame (NULL); - struct gdbarch *gdbarch = get_frame_arch (frame); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - ULONGEST dma_info_type; - ULONGEST dma_info_mask; - ULONGEST dma_info_status; - ULONGEST dma_info_stall_and_notify; - ULONGEST dma_info_atomic_command_status; - char annex[32]; - gdb_byte buf[1024]; - LONGEST len; - int id; - - if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu) - error (_("\"info spu\" is only supported on the SPU architecture.")); - - id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); - - xsnprintf (annex, sizeof annex, "%d/dma_info", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, 40 + 16 * 32); - if (len <= 0) - error (_("Could not read dma_info.")); - - dma_info_type - = extract_unsigned_integer (buf, 8, byte_order); - dma_info_mask - = extract_unsigned_integer (buf + 8, 8, byte_order); - dma_info_status - = extract_unsigned_integer (buf + 16, 8, byte_order); - dma_info_stall_and_notify - = extract_unsigned_integer (buf + 24, 8, byte_order); - dma_info_atomic_command_status - = extract_unsigned_integer (buf + 32, 8, byte_order); - - ui_out_emit_tuple tuple_emitter (current_uiout, "SPUInfoDMA"); - - if (current_uiout->is_mi_like_p ()) - { - current_uiout->field_fmt ("dma_info_type", "0x%s", - phex_nz (dma_info_type, 4)); - current_uiout->field_fmt ("dma_info_mask", "0x%s", - phex_nz (dma_info_mask, 4)); - current_uiout->field_fmt ("dma_info_status", "0x%s", - phex_nz (dma_info_status, 4)); - current_uiout->field_fmt ("dma_info_stall_and_notify", "0x%s", - phex_nz (dma_info_stall_and_notify, 4)); - current_uiout->field_fmt ("dma_info_atomic_command_status", "0x%s", - phex_nz (dma_info_atomic_command_status, 4)); - } - else - { - const char *query_msg = _("no query pending"); - - if (dma_info_type & 4) - switch (dma_info_type & 3) - { - case 1: query_msg = _("'any' query pending"); break; - case 2: query_msg = _("'all' query pending"); break; - default: query_msg = _("undefined query type"); break; - } - - printf_filtered (_("Tag-Group Status 0x%s\n"), - phex (dma_info_status, 4)); - printf_filtered (_("Tag-Group Mask 0x%s (%s)\n"), - phex (dma_info_mask, 4), query_msg); - printf_filtered (_("Stall-and-Notify 0x%s\n"), - phex (dma_info_stall_and_notify, 4)); - printf_filtered (_("Atomic Cmd Status 0x%s\n"), - phex (dma_info_atomic_command_status, 4)); - printf_filtered ("\n"); - } - - info_spu_dma_cmdlist (buf + 40, 16, byte_order); -} - -static void -info_spu_proxydma_command (const char *args, int from_tty) -{ - struct frame_info *frame = get_selected_frame (NULL); - struct gdbarch *gdbarch = get_frame_arch (frame); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - ULONGEST dma_info_type; - ULONGEST dma_info_mask; - ULONGEST dma_info_status; - char annex[32]; - gdb_byte buf[1024]; - LONGEST len; - int id; - - if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) - error (_("\"info spu\" is only supported on the SPU architecture.")); - - id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); - - xsnprintf (annex, sizeof annex, "%d/proxydma_info", id); - len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex, - buf, 0, 24 + 8 * 32); - if (len <= 0) - error (_("Could not read proxydma_info.")); - - dma_info_type = extract_unsigned_integer (buf, 8, byte_order); - dma_info_mask = extract_unsigned_integer (buf + 8, 8, byte_order); - dma_info_status = extract_unsigned_integer (buf + 16, 8, byte_order); - - ui_out_emit_tuple tuple_emitter (current_uiout, "SPUInfoProxyDMA"); - - if (current_uiout->is_mi_like_p ()) - { - current_uiout->field_fmt ("proxydma_info_type", "0x%s", - phex_nz (dma_info_type, 4)); - current_uiout->field_fmt ("proxydma_info_mask", "0x%s", - phex_nz (dma_info_mask, 4)); - current_uiout->field_fmt ("proxydma_info_status", "0x%s", - phex_nz (dma_info_status, 4)); - } - else - { - const char *query_msg; - - switch (dma_info_type & 3) - { - case 0: query_msg = _("no query pending"); break; - case 1: query_msg = _("'any' query pending"); break; - case 2: query_msg = _("'all' query pending"); break; - default: query_msg = _("undefined query type"); break; - } - - printf_filtered (_("Tag-Group Status 0x%s\n"), - phex (dma_info_status, 4)); - printf_filtered (_("Tag-Group Mask 0x%s (%s)\n"), - phex (dma_info_mask, 4), query_msg); - printf_filtered ("\n"); - } - - info_spu_dma_cmdlist (buf + 24, 8, byte_order); -} - -static void -info_spu_command (const char *args, int from_tty) -{ - printf_unfiltered (_("\"info spu\" must be followed by " - "the name of an SPU facility.\n")); - help_list (infospucmdlist, "info spu ", all_commands, gdb_stdout); -} - - -/* Root of all "set spu "/"show spu " commands. */ - -static void -show_spu_command (const char *args, int from_tty) -{ - help_list (showspucmdlist, "show spu ", all_commands, gdb_stdout); -} - -static void -set_spu_command (const char *args, int from_tty) -{ - help_list (setspucmdlist, "set spu ", all_commands, gdb_stdout); -} - -static void -show_spu_stop_on_load (struct ui_file *file, int from_tty, - struct cmd_list_element *c, const char *value) -{ - fprintf_filtered (file, _("Stopping for new SPE threads is %s.\n"), - value); -} - -static void -show_spu_auto_flush_cache (struct ui_file *file, int from_tty, - struct cmd_list_element *c, const char *value) -{ - fprintf_filtered (file, _("Automatic software-cache flush is %s.\n"), - value); -} - - -/* Set up gdbarch struct. */ - -static struct gdbarch * -spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) -{ - struct gdbarch *gdbarch; - struct gdbarch_tdep *tdep; - int id = -1; - - /* Which spufs ID was requested as address space? */ - if (info.id) - id = *info.id; - /* For objfile architectures of SPU solibs, decode the ID from the name. - This assumes the filename convention employed by solib-spu.c. */ - else if (info.abfd) - { - const char *name = strrchr (info.abfd->filename, '@'); - if (name) - sscanf (name, "@0x%*x <%d>", &id); - } - - /* Find a candidate among extant architectures. */ - for (arches = gdbarch_list_lookup_by_info (arches, &info); - arches != NULL; - arches = gdbarch_list_lookup_by_info (arches->next, &info)) - { - tdep = gdbarch_tdep (arches->gdbarch); - if (tdep && tdep->id == id) - return arches->gdbarch; - } - - /* None found, so create a new architecture. */ - tdep = XCNEW (struct gdbarch_tdep); - tdep->id = id; - gdbarch = gdbarch_alloc (&info, tdep); - - /* Disassembler. */ - set_gdbarch_print_insn (gdbarch, gdb_print_insn_spu); - - /* Registers. */ - set_gdbarch_num_regs (gdbarch, SPU_NUM_REGS); - set_gdbarch_num_pseudo_regs (gdbarch, SPU_NUM_PSEUDO_REGS); - set_gdbarch_sp_regnum (gdbarch, SPU_SP_REGNUM); - set_gdbarch_pc_regnum (gdbarch, SPU_PC_REGNUM); - set_gdbarch_read_pc (gdbarch, spu_read_pc); - set_gdbarch_write_pc (gdbarch, spu_write_pc); - set_gdbarch_register_name (gdbarch, spu_register_name); - set_gdbarch_register_type (gdbarch, spu_register_type); - set_gdbarch_pseudo_register_read (gdbarch, spu_pseudo_register_read); - set_gdbarch_pseudo_register_write (gdbarch, spu_pseudo_register_write); - set_gdbarch_value_from_register (gdbarch, spu_value_from_register); - set_gdbarch_register_reggroup_p (gdbarch, spu_register_reggroup_p); - set_gdbarch_dwarf2_reg_to_regnum (gdbarch, spu_dwarf_reg_to_regnum); - set_gdbarch_ax_pseudo_register_collect - (gdbarch, spu_ax_pseudo_register_collect); - set_gdbarch_ax_pseudo_register_push_stack - (gdbarch, spu_ax_pseudo_register_push_stack); - - /* Data types. */ - set_gdbarch_char_signed (gdbarch, 0); - set_gdbarch_ptr_bit (gdbarch, 32); - set_gdbarch_addr_bit (gdbarch, 32); - set_gdbarch_short_bit (gdbarch, 16); - set_gdbarch_int_bit (gdbarch, 32); - set_gdbarch_long_bit (gdbarch, 32); - set_gdbarch_long_long_bit (gdbarch, 64); - set_gdbarch_float_bit (gdbarch, 32); - set_gdbarch_double_bit (gdbarch, 64); - set_gdbarch_long_double_bit (gdbarch, 64); - set_gdbarch_float_format (gdbarch, floatformats_ieee_single); - set_gdbarch_double_format (gdbarch, floatformats_ieee_double); - set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); - - /* Address handling. */ - set_gdbarch_address_to_pointer (gdbarch, spu_address_to_pointer); - set_gdbarch_pointer_to_address (gdbarch, spu_pointer_to_address); - set_gdbarch_integer_to_address (gdbarch, spu_integer_to_address); - set_gdbarch_address_class_type_flags (gdbarch, spu_address_class_type_flags); - set_gdbarch_address_class_type_flags_to_name - (gdbarch, spu_address_class_type_flags_to_name); - set_gdbarch_address_class_name_to_type_flags - (gdbarch, spu_address_class_name_to_type_flags); - - /* We need to support more than "addr_bit" significant address bits - in order to support SPUADDR_ADDR encoded values. */ - set_gdbarch_significant_addr_bit (gdbarch, 64); - - /* Inferior function calls. */ - set_gdbarch_call_dummy_location (gdbarch, ON_STACK); - set_gdbarch_frame_align (gdbarch, spu_frame_align); - set_gdbarch_frame_red_zone_size (gdbarch, 2000); - set_gdbarch_push_dummy_code (gdbarch, spu_push_dummy_code); - set_gdbarch_push_dummy_call (gdbarch, spu_push_dummy_call); - set_gdbarch_dummy_id (gdbarch, spu_dummy_id); - set_gdbarch_return_value (gdbarch, spu_return_value); - - /* Frame handling. */ - set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - dwarf2_append_unwinders (gdbarch); - frame_unwind_append_unwinder (gdbarch, &spu_frame_unwind); - frame_base_set_default (gdbarch, &spu_frame_base); - set_gdbarch_unwind_pc (gdbarch, spu_unwind_pc); - set_gdbarch_unwind_sp (gdbarch, spu_unwind_sp); - set_gdbarch_virtual_frame_pointer (gdbarch, spu_virtual_frame_pointer); - set_gdbarch_frame_args_skip (gdbarch, 0); - set_gdbarch_skip_prologue (gdbarch, spu_skip_prologue); - set_gdbarch_stack_frame_destroyed_p (gdbarch, spu_stack_frame_destroyed_p); - - /* Cell/B.E. cross-architecture unwinder support. */ - frame_unwind_prepend_unwinder (gdbarch, &spu2ppu_unwind); - - /* Breakpoints. */ - set_gdbarch_decr_pc_after_break (gdbarch, 4); - set_gdbarch_breakpoint_kind_from_pc (gdbarch, spu_breakpoint::kind_from_pc); - set_gdbarch_sw_breakpoint_from_kind (gdbarch, spu_breakpoint::bp_from_kind); - set_gdbarch_memory_remove_breakpoint (gdbarch, spu_memory_remove_breakpoint); - set_gdbarch_software_single_step (gdbarch, spu_software_single_step); - set_gdbarch_get_longjmp_target (gdbarch, spu_get_longjmp_target); - - /* Overlays. */ - set_gdbarch_overlay_update (gdbarch, spu_overlay_update); - - return gdbarch; -} - -void -_initialize_spu_tdep (void) -{ - register_gdbarch_init (bfd_arch_spu, spu_gdbarch_init); - - /* Add ourselves to objfile event chain. */ - gdb::observers::new_objfile.attach (spu_overlay_new_objfile); - - /* Install spu stop-on-load handler. */ - gdb::observers::new_objfile.attach (spu_catch_start); - - /* Add ourselves to normal_stop event chain. */ - gdb::observers::normal_stop.attach (spu_attach_normal_stop); - - /* Add root prefix command for all "set spu"/"show spu" commands. */ - add_prefix_cmd ("spu", no_class, set_spu_command, - _("Various SPU specific commands."), - &setspucmdlist, "set spu ", 0, &setlist); - add_prefix_cmd ("spu", no_class, show_spu_command, - _("Various SPU specific commands."), - &showspucmdlist, "show spu ", 0, &showlist); - - /* Toggle whether or not to add a temporary breakpoint at the "main" - function of new SPE contexts. */ - add_setshow_boolean_cmd ("stop-on-load", class_support, - &spu_stop_on_load_p, _("\ -Set whether to stop for new SPE threads."), - _("\ -Show whether to stop for new SPE threads."), - _("\ -Use \"on\" to give control to the user when a new SPE thread\n\ -enters its \"main\" function.\n\ -Use \"off\" to disable stopping for new SPE threads."), - NULL, - show_spu_stop_on_load, - &setspucmdlist, &showspucmdlist); - - /* Toggle whether or not to automatically flush the software-managed - cache whenever SPE execution stops. */ - add_setshow_boolean_cmd ("auto-flush-cache", class_support, - &spu_auto_flush_cache_p, _("\ -Set whether to automatically flush the software-managed cache."), - _("\ -Show whether to automatically flush the software-managed cache."), - _("\ -Use \"on\" to automatically flush the software-managed cache\n\ -whenever SPE execution stops.\n\ -Use \"off\" to never automatically flush the software-managed cache."), - NULL, - show_spu_auto_flush_cache, - &setspucmdlist, &showspucmdlist); - - /* Add root prefix command for all "info spu" commands. */ - add_prefix_cmd ("spu", class_info, info_spu_command, - _("Various SPU specific commands."), - &infospucmdlist, "info spu ", 0, &infolist); - - /* Add various "info spu" commands. */ - add_cmd ("event", class_info, info_spu_event_command, - _("Display SPU event facility status."), - &infospucmdlist); - add_cmd ("signal", class_info, info_spu_signal_command, - _("Display SPU signal notification facility status."), - &infospucmdlist); - add_cmd ("mailbox", class_info, info_spu_mailbox_command, - _("Display SPU mailbox facility status."), - &infospucmdlist); - add_cmd ("dma", class_info, info_spu_dma_command, - _("Display MFC DMA status."), - &infospucmdlist); - add_cmd ("proxydma", class_info, info_spu_proxydma_command, - _("Display MFC Proxy-DMA status."), - &infospucmdlist); -} diff --git a/gdb/spu-tdep.h b/gdb/spu-tdep.h deleted file mode 100644 index 255be2e..0000000 --- a/gdb/spu-tdep.h +++ /dev/null @@ -1,117 +0,0 @@ -/* SPU target-dependent code for GDB, the GNU debugger. - Copyright (C) 2006-2019 Free Software Foundation, Inc. - - 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/>. */ - -#ifndef SPU_TDEP_H -#define SPU_TDEP_H - -/* Number of registers. */ -#define SPU_NUM_REGS 130 -#define SPU_NUM_PSEUDO_REGS 6 -#define SPU_NUM_GPRS 128 - -/* Register numbers of various important registers. */ -enum spu_regnum -{ - /* SPU calling convention. */ - SPU_LR_REGNUM = 0, /* Link register. */ - SPU_RAW_SP_REGNUM = 1, /* Stack pointer (full register). */ - SPU_ARG1_REGNUM = 3, /* First argument register. */ - SPU_ARGN_REGNUM = 74, /* Last argument register. */ - SPU_SAVED1_REGNUM = 80, /* First call-saved register. */ - SPU_SAVEDN_REGNUM = 127, /* Last call-saved register. */ - SPU_FP_REGNUM = 127, /* Frame pointer. */ - - /* Special registers. */ - SPU_ID_REGNUM = 128, /* SPU ID register. */ - SPU_PC_REGNUM = 129, /* Next program counter. */ - SPU_SP_REGNUM = 130, /* Stack pointer (preferred slot). */ - SPU_FPSCR_REGNUM = 131, /* Floating point status/control register. */ - SPU_SRR0_REGNUM = 132, /* SRR0 register. */ - SPU_LSLR_REGNUM = 133, /* Local store limit register. */ - SPU_DECR_REGNUM = 134, /* Decrementer value. */ - SPU_DECR_STATUS_REGNUM = 135 /* Decrementer status. */ -}; - -/* Address conversions. - - In a combined PPU/SPU debugging session, we have to consider multiple - address spaces: the PPU 32- or 64-bit address space, and the 32-bit - local store address space for each SPU context. As it is currently - not yet possible to use the program_space / address_space mechanism - to represent this, we encode all those addresses into one single - 64-bit address for the whole process. For SPU programs using overlays, - this address space must also include separate ranges reserved for the - LMA of overlay sections. - - - The following combinations are supported for combined debugging: - - PPU address (this relies on the fact that PPC 64-bit user space - addresses can never have the highest-most bit set): - - +-+---------------------------------+ - |0| ADDR [63] | - +-+---------------------------------+ - - SPU address for SPU context with id SPU (this assumes that SPU - IDs, which are file descriptors, are never larger than 2^30): - - +-+-+--------------+----------------+ - |1|0| SPU [30] | ADDR [32] | - +-+-+--------------+----------------+ - - SPU overlay section LMA for SPU context with id SPU: - - +-+-+--------------+----------------+ - |1|1| SPU [30] | ADDR [32] | - +-+-+--------------+----------------+ - - - In SPU stand-alone debugging mode (using spu-linux-nat.c), - the following combinations are supported: - - SPU address: - - +-+-+--------------+----------------+ - |0|0| 0 | ADDR [32] | - +-+-+--------------+----------------+ - - SPU overlay section LMA: - - +-+-+--------------+----------------+ - |0|1| 0 | ADDR [32] | - +-+-+--------------+----------------+ - - - The following macros allow manipulation of addresses in the - above formats. */ - -#define SPUADDR(spu, addr) \ - ((spu) != -1? (ULONGEST)1 << 63 | (ULONGEST)(spu) << 32 | (addr) : (addr)) - -#define SPUADDR_SPU(addr) \ - (((addr) & (ULONGEST)1 << 63) \ - ? (int) ((ULONGEST)(addr) >> 32 & 0x3fffffff) \ - : -1) - -#define SPUADDR_ADDR(addr) \ - (((addr) & (ULONGEST)1 << 63)? (ULONGEST)(addr) & 0xffffffff : (addr)) - -#define SPU_OVERLAY_LMA ((ULONGEST)1 << 62) - -#endif diff --git a/gdb/target.h b/gdb/target.h index c2f6203..8dbd2d6 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -137,8 +137,6 @@ enum target_object { /* AVR target specific transfer. See "avr-tdep.c" and "remote.c". */ TARGET_OBJECT_AVR, - /* SPU target specific transfer. See "spu-tdep.c". */ - TARGET_OBJECT_SPU, /* Transfer up-to LEN bytes of memory starting at OFFSET. */ TARGET_OBJECT_MEMORY, /* Memory, avoiding GDB's data cache and trusting the executable. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e86091e..64c7d38 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,32 @@ +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. + 2019-09-19 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (gdb_test): Eliminate "^FOOBAR$" pattern. diff --git a/gdb/testsuite/gdb.arch/spu-info.c b/gdb/testsuite/gdb.arch/spu-info.c deleted file mode 100644 index 3046525..0000000 --- a/gdb/testsuite/gdb.arch/spu-info.c +++ /dev/null @@ -1,235 +0,0 @@ -/* Copyright 2007-2019 Free Software Foundation, Inc. - - 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/>. - - This file is part of the gdb testsuite. - - Contributed by Markus Deuling <deuling@de.ibm.com>. - Tests for 'info spu' commands. */ - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <spu_mfcio.h> - - -/* PPE-assisted call interface. */ -void -send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data) -{ - __vector unsigned int stopfunc = - { - signalcode, /* stop */ - (opcode << 24) | (unsigned int) data, - 0x4020007f, /* nop */ - 0x35000000 /* bi $0 */ - }; - - void (*f) (void) = (void *) &stopfunc; - asm ("sync"); - f (); -} - -/* PPE-assisted call to mmap from SPU. */ -unsigned long long -mmap_ea (unsigned long long start, size_t length, - int prot, int flags, int fd, off_t offset) -{ - struct mmap_args - { - unsigned long long start __attribute__ ((aligned (16))); - size_t length __attribute__ ((aligned (16))); - int prot __attribute__ ((aligned (16))); - int flags __attribute__ ((aligned (16))); - int fd __attribute__ ((aligned (16))); - off_t offset __attribute__ ((aligned (16))); - } args; - - args.start = start; - args.length = length; - args.prot = prot; - args.flags = flags; - args.fd = fd; - args.offset = offset; - - send_to_ppe (0x2101, 11, &args); - return args.start; -} - -/* This works only in a Linux environment with <= 1024 open - file descriptors for one process. Result is the file - descriptor for the current context if available. */ -int -find_context_fd (void) -{ - int dir_fd = -1; - int i; - - for (i = 0; i < 1024; i++) - { - struct stat stat; - - if (fstat (i, &stat) < 0) - break; - if (S_ISDIR (stat.st_mode)) - dir_fd = dir_fd == -1 ? i : -2; - } - return dir_fd < 0 ? -1 : dir_fd; -} - -/* Open the context file and return the file handler. */ -int -open_context_file (int context_fd, char *name, int flags) -{ - char buf[128]; - - if (context_fd < 0) - return -1; - - sprintf (buf, "/proc/self/fd/%d/%s", context_fd, name); - return open (buf, flags); -} - - -int -do_event_test () -{ - spu_write_event_mask (MFC_MULTI_SRC_SYNC_EVENT); /* 0x1000 */ /* Marker Event */ - spu_write_event_mask (MFC_PRIV_ATTN_EVENT); /* 0x0800 */ - spu_write_event_mask (MFC_LLR_LOST_EVENT); /* 0x0400 */ - spu_write_event_mask (MFC_SIGNAL_NOTIFY_1_EVENT); /* 0x0200 */ - spu_write_event_mask (MFC_SIGNAL_NOTIFY_2_EVENT); /* 0x0100 */ - spu_write_event_mask (MFC_OUT_MBOX_AVAILABLE_EVENT); /* 0x0080 */ - spu_write_event_mask (MFC_OUT_INTR_MBOX_AVAILABLE_EVENT); /* 0x0040 */ - spu_write_event_mask (MFC_DECREMENTER_EVENT); /* 0x0020 */ - spu_write_event_mask (MFC_IN_MBOX_AVAILABLE_EVENT); /* 0x0010 */ - spu_write_event_mask (MFC_COMMAND_QUEUE_AVAILABLE_EVENT); /* 0x0008 */ - spu_write_event_mask (MFC_LIST_STALL_NOTIFY_EVENT); /* 0x0002 */ - spu_write_event_mask (MFC_TAG_STATUS_UPDATE_EVENT); /* 0x0001 */ - - return 0; -} - -int -do_dma_test () -{ - #define MAP_FAILED (-1ULL) - #define PROT_READ 0x1 - #define MAP_PRIVATE 0x002 - #define BSIZE 128 - static char buf[BSIZE] __attribute__ ((aligned (128))); - char *file = "/var/tmp/tmp_buf"; - struct stat fdstat; - int fd, cnt; - unsigned long long src; - - /* Create a file and fill it with some bytes. */ - fd = open (file, O_CREAT | O_RDWR | O_TRUNC, 0777); - if (fd == -1) - return -1; - memset ((void *)buf, '1', BSIZE); - write (fd, buf, BSIZE); - write (fd, buf, BSIZE); - memset ((void *)buf, 0, BSIZE); - - if (fstat (fd, &fdstat) != 0 - || !fdstat.st_size) - return -2; - - src = mmap_ea(0ULL, fdstat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); - if (src == MAP_FAILED) - return -3; - - /* Copy some data via DMA. */ - mfc_get (&buf, src, BSIZE, 5, 0, 0); /* Marker DMA */ - mfc_write_tag_mask (1<<5); /* Marker DMAWait */ - spu_mfcstat (MFC_TAG_UPDATE_ALL); - - /* Close the file. */ - close (fd); - - return cnt; -} - -int -do_mailbox_test () -{ - /* Write to SPU Outbound Mailbox. */ - if (spu_stat_out_mbox ()) /* Marker Mbox */ - spu_write_out_mbox (0x12345678); - - /* Write to SPU Outbound Interrupt Mailbox. */ - if (spu_stat_out_intr_mbox ()) - spu_write_out_intr_mbox (0x12345678); - - return 0; /* Marker MboxEnd */ -} - -int -do_signal_test () -{ - struct stat fdstat; - int context_fd = find_context_fd (); - int ret, buf, fd; - - buf = 23; /* Marker Signal */ - /* Write to signal1. */ - fd = open_context_file (context_fd, "signal1", O_RDWR); - if (fstat (fd, &fdstat) != 0) - return -1; - ret = write (fd, &buf, sizeof (int)); - close (fd); /* Marker Signal1 */ - - /* Write to signal2. */ - fd = open_context_file (context_fd, "signal2", O_RDWR); - if (fstat (fd, &fdstat) != 0) - return -1; - ret = write (fd, &buf, sizeof (int)); - close (fd); /* Marker Signal2 */ - - /* Read signal1. */ - if (spu_stat_signal1 ()) - ret = spu_read_signal1 (); - - /* Read signal2. */ - if (spu_stat_signal2 ()) - ret = spu_read_signal2 (); /* Marker SignalRead */ - - return 0; -} - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - int res; - - /* info spu event */ - res = do_event_test (); - - /* info spu dma */ - res = do_dma_test (); - - /* info spu mailbox */ - res = do_mailbox_test (); - - /* info spu signal */ - res = do_signal_test (); - - return 0; -} - diff --git a/gdb/testsuite/gdb.arch/spu-info.exp b/gdb/testsuite/gdb.arch/spu-info.exp deleted file mode 100644 index f840251..0000000 --- a/gdb/testsuite/gdb.arch/spu-info.exp +++ /dev/null @@ -1,241 +0,0 @@ -# Copyright 2007-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# This file is part of the gdb testsuite. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# Tests for 'info spu' commands. - - -if { ![istarget "spu-*-elf"] } then { - verbose "Skipping SPU-only testcase" - return -} - -standard_testfile - -if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } { - fail "cannot compile test program" - return -1 -} - - -# Continue to MARKER -proc c_to { marker } { - global srcfile - set line [gdb_get_line_number $marker] - gdb_test "break $line" \ - "Breakpoint.*at.*file.*$srcfile.*line $line.*" \ - "break $line" - gdb_test "continue" \ - "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \ - "continue to $line" -} - - - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Check the help. -gdb_test "info spu" \ - ".*info spu.* must be followed by the name of an SPU facility.*" \ - "info spu" -gdb_test "help info spu" \ - "Various SPU specific commands.*List of info spu subcommands.*" \ - "help info spu" - -gdb_test "help info spu dma" \ - "Display MFC DMA status." \ - "help info spu dma" -gdb_test "help info spu event" \ - "Display SPU event facility status." \ - "help info spu event" -gdb_test "help info spu mailbox" \ - "Display SPU mailbox facility status." \ - "help info spu mailbox" -gdb_test "help info spu proxydma" \ - "Display MFC Proxy-DMA status." \ - "help info spu proxydma" -gdb_test "help info spu signal" \ - "Display SPU signal notification facility status." \ - "help info spu signal" - - -# architecture should be spu:256K. -gdb_test "show architecture" \ - "The target architecture is set automatically.*currently spu:256K.*" \ - "architecture = spu256K" - -# 'info spu event'. -gdb_test "info spu event" \ - "Event Status.*Event Mask.*" \ - "info spu event" - -# 'info spu signal'. -gdb_test "info spu signal" \ - "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \ - "info spu signal" - -# 'info spu mailbox'. -gdb_test "info spu mailbox" \ - "" \ - "info spu mailbox" - -# 'info spu dma'. -gdb_test "info spu dma" \ - "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*" \ - "info spu dma" - -# 'info spu proxydma'. -gdb_test "info spu proxydma" \ - "Tag-Group Status.*Tag-Group Mask.*" \ - "info spu proxydma" - -# Event tests. -c_to "Marker Event" -gdb_test "info spu event" \ - "Event Status 0x00000000.*Event Mask 0x00000000.*" \ - "empty event status" - -# MFC_MULTI_SRC_SYNC_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00001000.*" \ - "event mask 0x1000" -# MFC_PRIV_ATTN_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000800.*" \ - "event mask 0x0800" -# MFC_LLR_LOST_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000400.*" \ - "event mask 0x0400" -# MFC_SIGNAL_NOTIFY_1_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000200.*" \ - "event mask 0x0200" -# MFC_SIGNAL_NOTIFY_2_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000100.*" \ - "event mask 0x0100" -# MFC_OUT_MBOX_AVAILABLE_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000080.*" \ - "event mask 0x0080" -# MFC_OUT_INTR_MBOX_AVAILABLE_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000040.*" \ - "event mask 0x0040" -# MFC_DECREMENTER_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000020.*" \ - "event mask 0x0020" -# MFC_IN_MBOX_AVAILABLE_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000010.*" \ - "event mask 0x0010" -# MFC_COMMAND_QUEUE_AVAILABLE_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000008.*" \ - "event mask 0x0008" -# MFC_LIST_STALL_NOTIFY_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000002.*" \ - "event mask 0x0002" -# MFC_TAG_STATUS_UPDATE_EVENT. -gdb_test "next" "" "next" -gdb_test "info spu event" \ - "Event Status 0x0000.*Event Mask 0x00000001.*" \ - "event mask 0x0001" - - -# DMA tests. -# 'info spu dma' should be empty. -c_to "Marker DMA" -gdb_test "info spu dma" \ - "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000\[\r\n\]+" \ - "info spu dma (empty)" - -# 'info spu dma' should be filled with some data. -c_to "Marker DMAWait" -gdb_test "next" "" "next" -gdb_test "info spu dma" \ - "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000020.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*get.*5.*0.*0.*0x00080\[ \r\n\]+" \ - "info spu dma (non-empty)" -gdb_test "finish" "" "finish" - -# Mailbox Test -# 'info spu mailbox' should be empty. -c_to "Marker Mbox" -set msg "info spu mailbox" -gdb_test_multiple "info spu mailbox" $msg { - -re "$gdb_prompt $" { - pass $msg - } - -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" { - # Older kernels had a bug that caused them to return arbitrary values - # when attempting to read from an empty mailbox via spufs. - xfail $msg - } -} - -# 'info spu mailbox' should now contain data. -c_to "Marker MboxEnd" -gdb_test "info spu mailbox" \ - "SPU Outbound Mailbox.*0x12345678.*SPU Outbound Interrupt Mailbox.*0x12345678.*" \ - "info spu mailbox" - -# Signal Test -# 'info spu signal'. -c_to "Marker Signal" -gdb_test "info spu signal" \ - "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \ - "info spu signal" - -# 'info spu signal' with signal1 pending. -c_to "Marker Signal1" -gdb_test "info spu signal" \ - "Signal 1 control word 0x00000017.*Signal 2 not pending.*\(Type.*\).*" \ - "info spu signal" - -# 'info spu signal' with signal1 and signal2 pending. -c_to "Marker Signal2" -gdb_test "info spu signal" \ - "Signal 1 control word 0x00000017.*Signal 2 control word 0x00000017.*" \ - "info spu signal" - -# Read signal1. Only signal2 is pending. -c_to "Marker SignalRead" -gdb_test "info spu signal" \ - "Signal 1 not pending.*Signal 2 control word 0x00000017.*" \ - "info spu signal" - - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.arch/spu-ls.c b/gdb/testsuite/gdb.arch/spu-ls.c deleted file mode 100644 index f1a2049..0000000 --- a/gdb/testsuite/gdb.arch/spu-ls.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2010-2019 Free Software Foundation, Inc. - - 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/>. - - This file is part of the gdb testsuite. - - Contributed by Ulrich Weigand <uweigand@de.ibm.com>. - Tests for SPU local-store access. */ - -char *ptr = (char *)0x12345678; - -char array[256]; - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - return 0; -} - diff --git a/gdb/testsuite/gdb.arch/spu-ls.exp b/gdb/testsuite/gdb.arch/spu-ls.exp deleted file mode 100644 index af0b1ac..0000000 --- a/gdb/testsuite/gdb.arch/spu-ls.exp +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2010-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# This file is part of the gdb testsuite. -# -# Contributed by Ulrich Weigand <uweigand@de.ibm.com>. -# Tests for SPU local-store access. - -if { ![istarget "spu-*-elf"] } then { - verbose "Skipping SPU-only testcase" - return -} - -standard_testfile - -if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } { - fail "cannot compile test program" - return -1 -} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -gdb_test "print ptr" " = 0x12345678 \".*\"" "print ptr" -gdb_test_no_output "set ptr = array + \$lslr + 1" "set ptr = array + \$lslr + 1" -gdb_test_no_output "set array\[0\] = 1" "set array\[0\] = 1" -gdb_test "print *ptr" " = 1 '\\\\001'" "print *ptr" -gdb_test_no_output "set *ptr = 2" "set *ptr = 2" -gdb_test "print array\[0\]" " = 2 '\\\\002'" "print array\[0\]" - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 1bc384e..b10ee17 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -128,11 +128,6 @@ switch -glob -- [istarget] { set asm-flags "-xarch=v9 -I${srcdir}/${subdir} $obj_include" set debug-flags "-gdwarf-2" } - "spu*-*-*" { - set asm-arch spu - set asm-flags "-I${srcdir}/${subdir} $obj_include --no-warn" - set debug-flags "-gdwarf-2" - } "xstormy16-*-*" { set asm-arch xstormy16 set debug-flags "-gdwarf-2" diff --git a/gdb/testsuite/gdb.asm/spu.inc b/gdb/testsuite/gdb.asm/spu.inc deleted file mode 100644 index aabceb8..0000000 --- a/gdb/testsuite/gdb.asm/spu.inc +++ /dev/null @@ -1,42 +0,0 @@ - comment "subroutine prologue" - .macro gdbasm_enter - stqd $lr, 16($sp) - stqd $sp, -32($sp) - ai $sp, $sp, -32 - .endm - - comment "subroutine epilogue" - .macro gdbasm_leave - ai $sp, $sp, 32 - lqd $lr, 16($sp) - bi $lr - .endm - - .macro gdbasm_call subr - brsl $lr, \subr - .endm - - .macro gdbasm_several_nops - nop - nop - nop - nop - .endm - - comment "exit (0)" - .macro gdbasm_exit0 - stop 0x2000 - stop - stop - stop - .endm - - comment "startup" - .macro gdbasm_startup - il $0, 0 - ila $sp, 16368 - stqd $0, 0($sp) - stqd $sp, -32($sp) - ai $sp, $sp, -32 - stqd $0, 16($sp) - .endm diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index 52ba5f8..77db179 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -30,12 +30,6 @@ if [istarget "alpha*-*-*"] then { lappend options "additional_flags=-Wl,-taso" } -if {[istarget "spu*-*-*"]} then { - # The internal address format used for the combined Cell/B.E. - # debugger requires 64-bit. - set is64bitonly "yes" -} - # Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled as # this causes addresses to be out of range for IHEX. lappend options {nopie} diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp index d8ac619..388b87f 100644 --- a/gdb/testsuite/gdb.base/overlays.exp +++ b/gdb/testsuite/gdb.base/overlays.exp @@ -24,9 +24,6 @@ set data_overlays 1 if [istarget "m32r-*-*"] then { set linker_script "${srcdir}/${subdir}/m32r.ld" -} elseif [istarget "spu-*-*"] then { - set linker_script "${srcdir}/${subdir}/spu.ld" - set data_overlays 0 } else { verbose "Skipping overlay test -- not implemented for this target." return diff --git a/gdb/testsuite/gdb.base/ovlymgr.c b/gdb/testsuite/gdb.base/ovlymgr.c index 533606b..f4958ed 100644 --- a/gdb/testsuite/gdb.base/ovlymgr.c +++ b/gdb/testsuite/gdb.base/ovlymgr.c @@ -5,18 +5,6 @@ #include "ovlymgr.h" -#ifdef __SPU__ -/* SPU tool chain provides its own overlay manager. */ -bool -OverlayLoad (unsigned long ovlyno) -{ -} -bool -OverlayUnload (unsigned long ovlyno) -{ -} -#else /* __SPU__ */ - /* Local functions and data: */ extern unsigned long _ovly_table[][4]; @@ -243,4 +231,3 @@ ovly_copy (unsigned long dst, unsigned long src, long size) return; } -#endif /* __SPU__ */ diff --git a/gdb/testsuite/gdb.base/spu.ld b/gdb/testsuite/gdb.base/spu.ld deleted file mode 100644 index 0cd5a85..0000000 --- a/gdb/testsuite/gdb.base/spu.ld +++ /dev/null @@ -1,202 +0,0 @@ -/* Script for -z combreloc: combine and sort reloc sections */ -OUTPUT_FORMAT("elf32-spu", "elf32-spu", - "elf32-spu") -OUTPUT_ARCH(spu) -ENTRY(_start) -SEARCH_DIR("/usr/spu/lib"); -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - PROVIDE (__executable_start = 0); . = 0; - .interrupt : { KEEP(*(.interrupt)) } - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.dyn : - { - *(.rel.init) - *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) - *(.rel.fini) - *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) - *(.rel.data.rel.ro*) - *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) - *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) - *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) - *(.rel.ctors) - *(.rel.dtors) - *(.rel.got) - *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) - } - .rela.dyn : - { - *(.rela.init) - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.fini) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) - *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) - *(.rela.ctors) - *(.rela.dtors) - *(.rela.got) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : - { - KEEP (*(.init)) - } =0 - .plt : { *(.plt) } - .text : - { - *(EXCLUDE_FILE (foo.o bar.o baz.o grbx.o) .text .stub .text.* .gnu.linkonce.t.*) - KEEP (*(.text.*personality*)) - *(.spu.elf) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } =0 - .fini : - { - KEEP (*(.fini)) - } =0 - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .eh_frame_hdr : { *(.eh_frame_hdr) } - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(0x80); - /* Exception handling */ - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } - /* Thread Local Storage sections */ - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - /* Ensure the __preinit_array_start label is properly aligned. We - could instead move the label definition inside the section, but - the linker would then create the section even if it turns out to - be empty, which isn't pretty. */ - . = ALIGN(16); - PROVIDE (__preinit_array_start = .); - .preinit_array : { KEEP (*(.preinit_array)) } - PROVIDE (__preinit_array_end = .); - PROVIDE (__init_array_start = .); - .init_array : { KEEP (*(.init_array)) } - PROVIDE (__init_array_end = .); - PROVIDE (__fini_array_start = .); - .fini_array : { KEEP (*(.fini_array)) } - PROVIDE (__fini_array_end = .); - .ctors : - { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin*.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : - { - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - .jcr : { KEEP (*(.jcr)) } - .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } - .dynamic : { *(.dynamic) } - .got : { *(.got.plt) *(.got) } - .data : - { - *(.data .data.* .gnu.linkonce.d.*) - KEEP (*(.gnu.linkonce.d.*personality*)) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .bss : - { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(16); - } - .toe ALIGN(128) : { *(.toe) } = 0 - . = ALIGN(16); - OVERLAY : - { - .ovly0 { foo.o(.text) } - .ovly1 { bar.o(.text) } - } - OVERLAY : - { - .ovly2 { baz.o(.text) } - .ovly3 { grbx.o(.text) } - } - _end = .; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - .note.spu_name 0 : { *(.note.spu_name) } - PROVIDE (__stack = 0x3fff0); - /DISCARD/ : { *(.note.GNU-stack) } -} - diff --git a/gdb/testsuite/gdb.base/stack-checking.c b/gdb/testsuite/gdb.base/stack-checking.c index e8af6a1..8f6dedb 100644 --- a/gdb/testsuite/gdb.base/stack-checking.c +++ b/gdb/testsuite/gdb.base/stack-checking.c @@ -36,11 +36,7 @@ void medium_frame () void big_frame () { -#ifdef __SPU__ - char S [131072]; -#else char S [524188]; -#endif small_frame (); } diff --git a/gdb/testsuite/gdb.cell/arch.exp b/gdb/testsuite/gdb.cell/arch.exp deleted file mode 100644 index dbfb20c..0000000 --- a/gdb/testsuite/gdb.cell/arch.exp +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcase checks if the "show architecture" command works properly. - -load_lib cell.exp - -set ppu_file "break" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "break-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -# No programm running, default architecture should be powerpc:common. -gdb_test "show architecture" \ - "The target architecture is set automatically.*currently powerpc:common.*" \ - "startup architecture is powerpc:common" - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# In PPU thread, architecture should be powerpc:common. -gdb_test "show architecture" \ - "The target architecture is set automatically.*currently powerpc:common.*" \ - "ppu architecture is powerpc:common" - -# Switch to SPU thread. -cont_spu_main -check_spu_arch "" - -# Remember thread ID of first thread to hit SPU main. -send_gdb "thread\n" -gdb_expect 10 { - -re "Current thread is (\[0-9\]*) .*\r\n$gdb_prompt $" { - pass "retrieve current thread" - set thread_id $expect_out(1,string) - } - -re "$gdb_prompt $" { - fail "retrieve current thread" - return 0 - } - timeout { - fail "retrieve current thread (timed out)" - return 0 - } -} - -# Stress Test: Switching from PPU- to SPU-Thread and back 'rep' times. -set rep 100 -for {set i 0} {$i < $rep} {incr i} { - # Switch to PPU Thread. - gdb_test "t 1" \ - "Switching to thread 1.*" \ - "switch back to thread 1 (PPU) #$i" - # In PPU Thread, architecture should again be powerpc:common. - gdb_test "show architecture" \ - "The target architecture is set automatically.*currently powerpc:common.*" \ - "ppu architecture is powerpc:common again #$i" - # Thread switching to SPU. - gdb_test "t $thread_id" \ - "Switching to thread $thread_id.*at.*$spu_file.c.*" \ - "switch back to thread $thread_id (spu) #$i" - # Standing in SPU thread again, architecture should be spu:256K again. - check_spu_arch "spu architecture is spu256K again #$i" -} -# End of Stress Test loop - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/break-spu.c b/gdb/testsuite/gdb.cell/break-spu.c deleted file mode 100644 index f28a843..0000000 --- a/gdb/testsuite/gdb.cell/break-spu.c +++ /dev/null @@ -1,43 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> - -void foo (void); - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - int i; - - printf ("Hello World! from spu\n"); - - i = 5; - foo (); - printf ("i = %d\n", i); - - return 0; -} - -void -foo (void) -{ - printf ("in foo\n"); -} diff --git a/gdb/testsuite/gdb.cell/break.c b/gdb/testsuite/gdb.cell/break.c deleted file mode 100644 index 95108d7..0000000 --- a/gdb/testsuite/gdb.cell/break.c +++ /dev/null @@ -1,71 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/wait.h> - -extern spe_program_handle_t break_spu; -#define nr_t 5 - -void * -spe_thread (void * arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &break_spu); - spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL); - - pthread_exit (NULL); -} - -int -main (void) -{ - int thread_id[nr_t]; - pthread_t pts[nr_t]; - spe_context_ptr_t ctx[nr_t]; - int value = 1; - int cnt; - - for (cnt = 0; cnt < nr_t; cnt++) - { - ctx[cnt] = spe_context_create (0, NULL); - thread_id[cnt] - = pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]); - } - - for (cnt = 0; cnt < nr_t; cnt++) - pthread_join (pts[cnt], NULL); - - for (cnt = 0; cnt < nr_t; cnt++) - spe_context_destroy (ctx[cnt]); - - return 0; -} - -void -foo () -{ - printf ("foo in break\n"); - return; -} diff --git a/gdb/testsuite/gdb.cell/break.exp b/gdb/testsuite/gdb.cell/break.exp deleted file mode 100644 index 73e60ad..0000000 --- a/gdb/testsuite/gdb.cell/break.exp +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcases tests setting and deleting breakpoints on PPU and SPU. - -load_lib cell.exp - -set testfile "break" -set ppu_file "break" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "break-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -# Delete breakpoints before starting the application. The debugger -# shouldn't prompt for anything. -gdb_test "delete breakpoints" \ - "" \ - "no prompt when deleting non-existing breakpoints" - -gdb_test "break main" \ - "Breakpoint.*at.* file .*$testfile.c, line.*" \ - "breakpoint main in ppu" - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -delete_breakpoints - -# Re-set breakpoint at main in PPU binary. -gdb_test "break main" \ - "Breakpoint.*at.* file .*$testfile.c, line.*" \ - "breakpoint function" - -# Set breakpoint in SPU binary. -send_gdb "break $spu_file.c:10\n" -gdb_expect { - -re ".*$spu_file.c.*Make breakpoint pending.*y or \\\[n\\\]. $" { - gdb_test "y" "Breakpoint.*$spu_file.*pending." "set pending breakpoint" - } - timeout { fail "timeout while setting breakpoint in spu binary" } -} - -# Check breakpoints. -gdb_test "info break" \ - "Num\[ \]+Type\[ \]+Disp\[ \]+Enb\[ \]+Address\[ \]+What.* -\[0-9\]+\[\t \]+breakpoint keep y.*in main at.*$testfile.c.* -\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*$spu_file.c:10.*" \ - "breakpoint info" - -gdb_test "continue" \ - "Continuing.*Switching to Thread.*Breakpoint.*main.*at.*$spu_file.c.*" \ - "continuing to spu thread" - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/bt-spu.c b/gdb/testsuite/gdb.cell/bt-spu.c deleted file mode 100644 index 6e83361..0000000 --- a/gdb/testsuite/gdb.cell/bt-spu.c +++ /dev/null @@ -1,30 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <sys/syscall.h> - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - __send_to_ppe (0x2111, 0, NULL); - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/bt.c b/gdb/testsuite/gdb.cell/bt.c deleted file mode 100644 index 31fb4ea..0000000 --- a/gdb/testsuite/gdb.cell/bt.c +++ /dev/null @@ -1,101 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <stdlib.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/wait.h> - -extern spe_program_handle_t bt_spu; -extern spe_program_handle_t bt2_spu; -#define nr_t 5 - -void * -spe_thread (void * arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &bt_spu); - spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL); - - pthread_exit (NULL); -} - -int -indirect_handler (unsigned char *base, unsigned long offset) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t ctx = spe_context_create (0, NULL); - - spe_program_load (ctx, &bt2_spu); - spe_context_run (ctx, &entry, flags, NULL, NULL, NULL); - - return 0; -} - -static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER; -static int crash_count = 0; - -int -crash_handler (unsigned char *base, unsigned long offset) -{ - int count; - - pthread_mutex_lock (&crash_mutex); - count = ++crash_count; - pthread_mutex_unlock (&crash_mutex); - - while (count < nr_t) - ; - - abort (); -} - -int -main (void) -{ - int thread_id[nr_t]; - pthread_t pts[nr_t]; - spe_context_ptr_t ctx[nr_t]; - int value = 1; - int cnt; - - spe_callback_handler_register (indirect_handler, 0x11, SPE_CALLBACK_NEW); - spe_callback_handler_register (crash_handler, 0x12, SPE_CALLBACK_NEW); - - for (cnt = 0; cnt < nr_t; cnt++) - { - ctx[cnt] = spe_context_create (0, NULL); - thread_id[cnt] - = pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]); - } - - for (cnt = 0; cnt < nr_t; cnt++) - pthread_join (pts[cnt], NULL); - - for (cnt = 0; cnt < nr_t; cnt++) - spe_context_destroy (ctx[cnt]); - - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/bt.exp b/gdb/testsuite/gdb.cell/bt.exp deleted file mode 100644 index cacf7c2..0000000 --- a/gdb/testsuite/gdb.cell/bt.exp +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcases tests mixed-architecture backtrace support - -load_lib cell.exp - -set testfile "bt" -set ppu_file "bt" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "bt-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] -set spu2_file "bt2-spu" -set spu2_src ${srcdir}/${subdir}/${spu2_file}.c -set spu2_bin [standard_output_file ${spu2_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binaries. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -if { [gdb_compile_cell_spu $spu2_src $spu2_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_cell_embedspu $spu2_bin $spu2_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o $spu2_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -delete_breakpoints -gdb_test "continue" ".*received signal SIGABRT, Aborted.*" - -gdb_test "backtrace" ".*abort.*crash_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu2_file.c.*<cross-architecture call>.*spe_context_run.*indirect_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" - -for {set thread_id 2} {$thread_id < 7} {incr thread_id} { - gdb_test "t $thread_id" \ - "Switching to thread $thread_id.*" \ - "switch to thread $thread_id" - gdb_test "backtrace" \ - ".*crash_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu2_file.c.*<cross-architecture call>.*spe_context_run.*indirect_handler.*base.*offset.*<cross-architecture call>.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \ - "backtrace in thread $thread_id" -} - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/bt2-spu.c b/gdb/testsuite/gdb.cell/bt2-spu.c deleted file mode 100644 index 67ed34c..0000000 --- a/gdb/testsuite/gdb.cell/bt2-spu.c +++ /dev/null @@ -1,30 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <sys/syscall.h> - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - __send_to_ppe (0x2112, 0, NULL); - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/core.exp b/gdb/testsuite/gdb.cell/core.exp deleted file mode 100644 index 2de7562..0000000 --- a/gdb/testsuite/gdb.cell/core.exp +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcases tests mixed-architecture core file support - -load_lib cell.exp - -set testfile "coremaker" -set ppu_file "coremaker" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "coremaker-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {![isnative]} then { - return 0 -} - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -# Run program to generate a core file -- see gdb.base/corefile.exp -set found 0 -set coredir "${objdir}/${subdir}/coredir.[getpid]" -file mkdir $coredir -catch "system \"(cd ${coredir}; ulimit -c unlimited; ${ppu_bin}; true) >/dev/null 2>&1\"" -set names [glob -nocomplain -directory $coredir core.*] -if {[llength $names] == 1} { - set corefile [file join $coredir [lindex $names 0]] - remote_exec build "mv $corefile ${objdir}/${subdir}/corefile" - set found 1 -} -remote_exec build "rmdir $coredir" -if { $found == 0 } { - warning "can't generate a core file - core tests suppressed - check ulimit -c" - return 0 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -send_gdb "core-file $objdir/$subdir/corefile\n" -gdb_expect { - -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { - pass "core-file command" - } - -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { - pass "core-file command (with bad program name)" - } - -re ".*$gdb_prompt $" { fail "core-file command" } - timeout { fail "(timeout) core-file command" } -} - -gdb_test "backtrace" ".*abort.*main.*at.*$ppu_file.c.*" - -for {set thread_id 2} {$thread_id < 7} {incr thread_id} { - gdb_test "t $thread_id" \ - "Switching to thread $thread_id.*" \ - "switch to thread $thread_id" - gdb_test "backtrace" \ - ".*terminal_func.*factorial_func.*value=1.*factorial_func.*value=2.*factorial_func.*value=3.*factorial_func.*value=4.*factorial_func.*value=5.*factorial_func.*value=6.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \ - "backtrace in thread $thread_id" -} - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/coremaker-spu.c b/gdb/testsuite/gdb.cell/coremaker-spu.c deleted file mode 100644 index 472660d..0000000 --- a/gdb/testsuite/gdb.cell/coremaker-spu.c +++ /dev/null @@ -1,46 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <spu_mfcio.h> - -void -terminal_func () -{ - spu_write_out_intr_mbox (0); - spu_read_in_mbox (); -} - -int -factorial_func (int value) -{ - if (value > 1) - value *= factorial_func (value - 1); - - terminal_func (); - return value; -} - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - factorial_func (6); - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/coremaker.c b/gdb/testsuite/gdb.cell/coremaker.c deleted file mode 100644 index 741e948..0000000 --- a/gdb/testsuite/gdb.cell/coremaker.c +++ /dev/null @@ -1,70 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <stdlib.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/wait.h> - -extern spe_program_handle_t coremaker_spu; -#define nr_t 5 - -void * -spe_thread (void * arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &coremaker_spu); - spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL); - - pthread_exit (NULL); -} - -int -main (void) -{ - int thread_id[nr_t]; - pthread_attr_t attr; - pthread_t pts[nr_t]; - spe_context_ptr_t ctx[nr_t]; - unsigned int value; - int cnt; - - /* Use small thread stacks to speed up writing out core file. */ - pthread_attr_init (&attr); - pthread_attr_setstacksize (&attr, 2*PTHREAD_STACK_MIN); - - for (cnt = 0; cnt < nr_t; cnt++) - { - ctx[cnt] = spe_context_create (0, NULL); - thread_id[cnt] - = pthread_create (&pts[cnt], &attr, &spe_thread, &ctx[cnt]); - } - - pthread_attr_destroy (&attr); - - for (cnt = 0; cnt < nr_t; cnt++) - spe_out_intr_mbox_read (ctx[cnt], &value, 1, SPE_MBOX_ALL_BLOCKING); - - abort (); -} - diff --git a/gdb/testsuite/gdb.cell/data-spu.c b/gdb/testsuite/gdb.cell/data-spu.c deleted file mode 100644 index 56efbbc..0000000 --- a/gdb/testsuite/gdb.cell/data-spu.c +++ /dev/null @@ -1,36 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - char var_char = 'c'; - short var_short = 7; - int var_int = 1337; - long var_long = 123456; - long long var_longlong = 123456789; - float var_float = 1.23; - double var_double = 2.3456; - long double var_longdouble = 3.45678; - return 0; /* Marker SPU End */ -} - diff --git a/gdb/testsuite/gdb.cell/data.c b/gdb/testsuite/gdb.cell/data.c deleted file mode 100644 index 7c38461..0000000 --- a/gdb/testsuite/gdb.cell/data.c +++ /dev/null @@ -1,72 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/wait.h> - -extern spe_program_handle_t data_spu; -#define nr_t 1 - -void * -spe_thread (void *arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &data_spu); - spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL); - - pthread_exit (NULL); -} - -int main (void) -{ - int thread_id[nr_t]; - pthread_t pts[nr_t]; - spe_context_ptr_t ctx[nr_t]; - - int cnt; - - char var_char = 'c'; - short var_short = 7; - int var_int = 1337; - long var_long = 123456; - long long var_longlong = 123456789; - float var_float = 1.23; - double var_double = 2.3456; - long double var_longdouble = 3.45678; - - for (cnt = 0; cnt < nr_t; cnt++) - { - ctx[cnt] = spe_context_create(0, NULL); - thread_id[cnt] - = pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]); - } - - for (cnt = 0; cnt < nr_t; cnt++) - pthread_join (pts[cnt], NULL); - - for (cnt = 0; cnt < nr_t; cnt++) - spe_context_destroy (ctx[cnt]); - - return 0; -} diff --git a/gdb/testsuite/gdb.cell/data.exp b/gdb/testsuite/gdb.cell/data.exp deleted file mode 100644 index f5c0d20..0000000 --- a/gdb/testsuite/gdb.cell/data.exp +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcases tries to read variables of each kind both on PPU and SPU. - -load_lib cell.exp - -set testfile "data" -set ppu_file "data" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "data-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -proc check_var { name value } { - gdb_test "print $name" \ - ".*=.*$value" \ - "check_var $name = $value" -} - -proc set_var { name value } { - gdb_test "set var $name = $value" \ - "" \ - "set var $name = $value" -} - -proc dotest { name value } { - set_var $name $value - check_var $name $value -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Set values. -dotest var_char 'z' -dotest var_short 8 -dotest var_int 321 -dotest var_long 523442 -dotest var_longlong 235354533 -xfail "dotest var_float 33.2113" -xfail "dotest var_double 2.3456" -xfail "dotest var_longdouble 3.456789" - -gdb_test "break 55" \ - "Breakpoint.*at.*file.*$testfile.c, line 55.*" \ - "set breakpoint" -gdb_test "continue" \ - "Breakpoint.*at.*$testfile.c.*55.*" \ - "continue to bp at line 55" - -# Lookup variables. -check_var var_char 'c' -check_var var_short 7 -check_var var_int 1337 -check_var var_long 123456 -check_var var_longlong 123456789 -xfail "check_var var_float 1.23" -xfail "check_var var_double 2.3456" -xfail "check_var var_longdouble 3.456789" - -cont_spu_main -c_to "Marker SPU End" $spu_file.c - -# In SPU Thread, arch should now be spu:256K. -check_spu_arch "" - -# Lookup variables. -check_var var_char 'c' -check_var var_short 7 -check_var var_int 1337 -check_var var_long 123456 -check_var var_longlong 123456789 -xfail "check_var var_float 1.23" -xfail "check_var var_double 2.3456" -xfail "check_var var_longdouble 3.456789" - -gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.cell/dwarfaddr.S b/gdb/testsuite/gdb.cell/dwarfaddr.S deleted file mode 100644 index 543da3d..0000000 --- a/gdb/testsuite/gdb.cell/dwarfaddr.S +++ /dev/null @@ -1,190 +0,0 @@ -/* Copyright 2010-2019 Free Software Foundation, Inc. - - 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/>. - - This file is part of the gdb testsuite. - - Contributed by Ulrich Weigand <uweigand@de.ibm.com>. - Tests for SPU addresses resulting from complex DWARF expressions. */ - - .text -main: -.Ltext_s: -.LFB1: - stqd $1,-240($1) - ai $1,$1,-240 - ai $2,$1,32 - ai $2,$2,127 - il $3,127 - andc $3,$2,$3 - il $2,1 - lqd $4,0($3) - cwd $5,0($3) - shufb $2,$2,$4,$5 - stqd $2,0($3) - lqd $1,0($1) - bi $0 -.LFE1: - .global main - .type main,@function - .size main,.LFE1-.LFB1 -.Ltext_e: - - .section .debug_info,"",@progbits -.Ldebug_info_s: - .int .debug_info_size-4 - .short 0x2 - .int .Ldebug_abbrev_s - .byte 0x4 -.Ldie0: - .uleb128 0x1 - .string "test.c" - .int .Ltext_s - .int .Ltext_e - .byte 0x1 -.Ldie1: - .uleb128 0x2 - .string "int" - .byte 0x4 - .byte 0x5 -.Ldie2: - .uleb128 0x3 - .int .Ldie4-.Ldebug_info_s - .int .Ldie1-.Ldebug_info_s -.Ldie3: - .uleb128 0x4 - .byte 0 - .byte 0xf - .uleb128 0 -.Ldie4: - .uleb128 0x5 - .string "main" - .int .LFB1 - .int .LFE1 - .byte 0x1 - .byte 0x1 - .byte 0x3 - .byte 0x1 - .byte 0x1 - .byte 0x51 -.Ldie5: - .uleb128 0x6 - .byte 0xe - .byte 0x91 - .sleb128 0x20 - .byte 0xd - .int 0x7f - .byte 0x22 - .byte 0xd - .int 0xffffff80 - .byte 0x1a - .string "x" - .byte 0x1 - .byte 0 - .int .Ldie2-.Ldebug_info_s - .uleb128 0 - .uleb128 0 -.Ldebug_info_e: - .set .debug_info_size,.Ldebug_info_e-.Ldebug_info_s - - - .section .debug_abbrev,"",@progbits -.Ldebug_abbrev_s: - .uleb128 0x1 - .uleb128 0x11 - .byte 0x1 - .uleb128 0x3 - .uleb128 0x8 - .uleb128 0x11 - .uleb128 0x1 - .uleb128 0x12 - .uleb128 0x1 - .uleb128 0x13 - .uleb128 0xb - .uleb128 0 - .uleb128 0 - - .uleb128 0x2 - .uleb128 0x24 - .byte 0 - .uleb128 0x3 - .uleb128 0x8 - .uleb128 0xb - .uleb128 0xb - .uleb128 0x3e - .uleb128 0xb - .uleb128 0 - .uleb128 0 - - .uleb128 0x3 - .uleb128 0x1 - .byte 0x1 - .uleb128 0x1 - .uleb128 0x13 - .uleb128 0x49 - .uleb128 0x13 - .uleb128 0 - .uleb128 0 - - .uleb128 0x4 - .uleb128 0x21 - .byte 0 - .uleb128 0x22 - .uleb128 0xb - .uleb128 0x2f - .uleb128 0xb - .uleb128 0 - .uleb128 0 - - .uleb128 0x5 - .uleb128 0x2e - .byte 0x1 - .uleb128 0x3 - .uleb128 0x8 - .uleb128 0x11 - .uleb128 0x1 - .uleb128 0x12 - .uleb128 0x1 - .uleb128 0x27 - .uleb128 0xc - .uleb128 0x3a - .uleb128 0xb - .uleb128 0x3b - .uleb128 0xb - .uleb128 0x3f - .uleb128 0xc - .uleb128 0x40 - .uleb128 0xa - .uleb128 0 - .uleb128 0 - - .uleb128 0x6 - .uleb128 0x34 - .byte 0 - .uleb128 0x2 - .uleb128 0xa - .uleb128 0x3 - .uleb128 0x8 - .uleb128 0x3a - .uleb128 0xb - .uleb128 0x3b - .uleb128 0xb - .uleb128 0x49 - .uleb128 0x13 - .uleb128 0 - .uleb128 0 - .uleb128 0 -.Ldebug_abbrev_e: - .set .debug_abbrev_size,.Ldebug_abbrev_e-.Ldebug_abbrev_s - diff --git a/gdb/testsuite/gdb.cell/dwarfaddr.exp b/gdb/testsuite/gdb.cell/dwarfaddr.exp deleted file mode 100644 index b61cd53..0000000 --- a/gdb/testsuite/gdb.cell/dwarfaddr.exp +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2010-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# This file is part of the gdb testsuite. -# -# Contributed by Ulrich Weigand <uweigand@de.ibm.com>. -# Tests for SPU addresses resulting from complex DWARF expressions. - -load_lib cell.exp - -set testfile "dwarfaddr" -set srcfile ${srcdir}/${subdir}/${testfile}.S -set binary [standard_output_file ${testfile}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $srcfile $binary executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binary} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -gdb_test "print x" " = \\{0 <repeats 16 times>\\}" "print x" -gdb_test "print &x" " = \\(int \\(\\*\\)\\\[16\\\]\\) 0x\[0-9a-f\]*" "print &x" -gdb_test "info address x" "Symbol \"x\" is a complex DWARF expression.*DW_OP_and\[\r\n\]+\." "info address x" - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/ea-cache-spu.c b/gdb/testsuite/gdb.cell/ea-cache-spu.c deleted file mode 100644 index 07b11c1..0000000 --- a/gdb/testsuite/gdb.cell/ea-cache-spu.c +++ /dev/null @@ -1,41 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <spu_mfcio.h> - -__ea int *ppe_int_ptr; - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - printf ("spe.c | argp = 0x%llx\n", argp); - -#ifdef __EA32__ - ppe_int_ptr = (__ea int *)(unsigned long)argp; -#else - ppe_int_ptr = (__ea int *)argp; -#endif - printf ("spe.c | value = %d\n", *ppe_int_ptr); - *ppe_int_ptr = 42; /* Marker SPUEA */ - printf ("spe.c | value = %d\n", *ppe_int_ptr); - - return 0; -} diff --git a/gdb/testsuite/gdb.cell/ea-cache.c b/gdb/testsuite/gdb.cell/ea-cache.c deleted file mode 100644 index a0a828b..0000000 --- a/gdb/testsuite/gdb.cell/ea-cache.c +++ /dev/null @@ -1,64 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/wait.h> - -extern spe_program_handle_t ea_cache_spu; -int int_var = 23; - -void * -spe_thread (void *arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &ea_cache_spu); - spe_context_run (*ctx, &entry, flags, &int_var, NULL, NULL); - - pthread_exit (NULL); -} - -int -main (void) -{ - spe_context_ptr_t ctx; - pthread_t pts; - int thread_id; - - printf ("ppe.c | int_var vor %d | adr int_var %p\n", int_var, &int_var); - - /* Create SPE context and pthread. */ - ctx = spe_context_create (0, NULL); - thread_id = pthread_create (&pts, NULL, &spe_thread, &ctx); - - /* Join the pthread. */ - pthread_join (pts, NULL); - - /* Destroy the SPE context. */ - spe_context_destroy (ctx); - - printf ("ppe.c | int_var nach %d\n", int_var); - - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/ea-cache.exp b/gdb/testsuite/gdb.cell/ea-cache.exp deleted file mode 100644 index e9bb709..0000000 --- a/gdb/testsuite/gdb.cell/ea-cache.exp +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# Testcase for ea software managed cache. - -load_lib cell.exp - -set ppu_file "ea-cache" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "ea-cache-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Set breakpoint in SPU binary. -cont_spu_main -c_to "Marker SPUEA" $spu_file.c - -gdb_test "p *ppe_int_ptr" \ - ".*=.*23.*" \ - "p *ppe_int_ptr" - -gdb_test "set *ppe_int_ptr=42" "" "" - -gdb_test "p *ppe_int_ptr" \ - ".*=.*42.*" \ - "p *ppe_int_ptr" - -# Now switch to thread 1 (PPU) and look at int_var. ppe_int_ptr points to -# int_var and should now also contain 42 (ea cache has been flushed). -gdb_test "t 1" \ - ".*Switching to thread 1.*" \ - "switch to thread 1" - -gdb_test "p int_var" \ - ".*=.*42.*" \ - "p int_var on ppu" - -gdb_exit -return 0 - - diff --git a/gdb/testsuite/gdb.cell/ea-standalone.c b/gdb/testsuite/gdb.cell/ea-standalone.c deleted file mode 100644 index 20b9af3..0000000 --- a/gdb/testsuite/gdb.cell/ea-standalone.c +++ /dev/null @@ -1,34 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <ea.h> - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - int a; - __ea int *myarray = malloc_ea (3 * sizeof (int)); - - memset_ea (myarray, 0, 3 * sizeof (int)); - a = ++myarray[0]; /* Marker SPUEA1 */ - printf("a: %d, myarray[0]: %d\n", a, myarray[0]); /* Marker SPUEA2 */ - return 0; -} diff --git a/gdb/testsuite/gdb.cell/ea-standalone.exp b/gdb/testsuite/gdb.cell/ea-standalone.exp deleted file mode 100644 index cae8e98..0000000 --- a/gdb/testsuite/gdb.cell/ea-standalone.exp +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# Testcase for ea software managed cache in a standalone binary. - -load_lib cell.exp - -set testfile "ea-standalone" -set srcfile ${srcdir}/${subdir}/${testfile}.c -set binary [standard_output_file ${testfile}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $srcfile $binary executable {debug}] != "" } { - unsupported "failed to compile" - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binary} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -c_to "Marker SPUEA1" $testfile.c -gdb_test "p myarray\[0\]" \ - ".*= 0" \ - "p myarray\[0\]" - -c_to "Marker SPUEA2" $testfile.c -gdb_test "p myarray\[0\]" \ - ".*= 1" \ - "p myarray\[0\]" -gdb_test "call __cache_flush()" "" "call cache_flush()" -gdb_test "p myarray\[0\]" \ - ".*= 1" \ - "p myarray\[0\]" - -gdb_exit -return 0 - - diff --git a/gdb/testsuite/gdb.cell/ea-test.c b/gdb/testsuite/gdb.cell/ea-test.c deleted file mode 100644 index efe49c5..0000000 --- a/gdb/testsuite/gdb.cell/ea-test.c +++ /dev/null @@ -1,33 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> - -__ea int *ppe_pointer; -int *normal_pointer; - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - static __ea int *local_ppe_pointer; - static int *local_normal_pointer; - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/ea-test.exp b/gdb/testsuite/gdb.cell/ea-test.exp deleted file mode 100644 index cbb02f1..0000000 --- a/gdb/testsuite/gdb.cell/ea-test.exp +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# Testcase for __ea pointer - -load_lib cell.exp - -set testfile "ea-test" -set source ${srcdir}/${subdir}/${testfile}.c -set binary [standard_output_file ${testfile}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $source $binary executable {debug}] != "" } { - unsupported "failed to compile" - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binary} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# p -gdb_test "p ppe_pointer" \ - "(int.*@__ea).*0x0.*" \ - "p ppe_pointer" - -gdb_test "p normal_pointer" \ - "(int.*).*0x0.*" \ - "p normal_pointer" - -gdb_test "p local_ppe_pointer" \ - "(int.*@__ea).*0x0.*" \ - "p local_ppe_pointer" - -gdb_test "p local_normal_pointer" \ - "(int.*).*0x0.*" \ - "p local_normal_pointer" - -# ptype -gdb_test "ptype ppe_pointer" \ - "type = int.*@__ea" \ - "ptype ppe_pointer" - -gdb_test "ptype normal_pointer" \ - "type = int.*" \ - "ptype normal_pointer" - -gdb_test "ptype local_ppe_pointer" \ - "type = int.*@__ea" \ - "ptype local_ppe_pointer" - -gdb_test "ptype local_normal_pointer" \ - "type = int.*" \ - "ptype local_normal_pointer" - -# info locals -gdb_test "info locals" \ - ".*local_ppe_pointer =.*0x0.*local_normal_pointer =.*0x0.*" \ - "info locals" - -# p & -gdb_test "p &ppe_pointer" \ - ".*=.*(int.*@__ea.*).*0x.*" \ - "p &ppe_pointer" - -gdb_test "p &normal_pointer" \ - ".*=.*(int.*).*0x.*" \ - "p &normal_pointer" - -gdb_test "p &local_ppe_pointer" \ - ".*=.*(int.*@__ea.*).*0x.*" \ - "p &local_ppe_pointer" - -gdb_test "p &local_normal_pointer" \ - ".*=.*(int.*).*0x.*" \ - "p &local_normal_pointer" - -# ptype * -gdb_test "ptype *ppe_pointer" \ - "type = int" \ - "ptype *ppe_pointer" - -gdb_test "ptype *normal_pointer" \ - "type = int" \ - "ptype *normal_pointer" - -gdb_test "ptype *local_ppe_pointer" \ - "type = int" \ - "ptype *local_ppe_pointer" - -gdb_test "ptype *local_normal_pointer" \ - "type = int" \ - "ptype *local_normal_pointer" - -gdb_exit - -return 0 - - diff --git a/gdb/testsuite/gdb.cell/f-regs.exp b/gdb/testsuite/gdb.cell/f-regs.exp deleted file mode 100644 index a37c77a..0000000 --- a/gdb/testsuite/gdb.cell/f-regs.exp +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcase tests access to SPU vector registers while language is fortran. - -load_lib cell.exp - -set ppu_file "break" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "break-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -proc check_vector_regs {} { - for {set check_reg 0} {$check_reg < 128} {incr check_reg} { - - gdb_test "p \$r$check_reg" \ - "r$check_reg.*=.*\(.*\).*" \ - "p \$r$check_reg" - - gdb_test "ptype \$r$check_reg" \ - "type = Type,.*C_Union :: __spu_builtin_type_vec128.*int128_t :: uint128.*int64_t :: v2_int64.*int32_t :: v4_int32\(.*\).*int16_t :: v8_int16\(.*\).*int8_t :: v16_int8\(.*\).*double :: v2_double\(.*\).*float :: v4_float\(.*\).*End Type __spu_builtin_type_vec128.*" \ - "ptype \$r$check_reg" - } -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -# No programm running, no registers should be available. -gdb_test "info all-registers" \ - "The program has no registers now." \ - "info all-registers" - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -cont_spu_main -gdb_test "set language fortran" \ - "Warning: the current language does not match this frame.*" \ - "set language fortran" -check_vector_regs - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/fork-spu.c b/gdb/testsuite/gdb.cell/fork-spu.c deleted file mode 100644 index 7777165..0000000 --- a/gdb/testsuite/gdb.cell/fork-spu.c +++ /dev/null @@ -1,47 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2010-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Ulrich Weigand <uweigand@de.ibm.com> */ - -#include <spu_mfcio.h> - -int var; - -void -func (void) -{ -} - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - /* Signal to PPU side that it should fork now. */ - spu_write_out_intr_mbox (0); - - /* Wait until fork completed. */ - spu_read_in_mbox (); - - /* Trigger watchpoint. */ - var = 1; - - /* Now call some function to trigger breakpoint. */ - func (); - - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/fork.c b/gdb/testsuite/gdb.cell/fork.c deleted file mode 100644 index 240af47..0000000 --- a/gdb/testsuite/gdb.cell/fork.c +++ /dev/null @@ -1,77 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2010-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Ulrich Weigand <uweigand@de.ibm.com> */ - -#include <stdio.h> -#include <stdlib.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> - -extern spe_program_handle_t fork_spu; - -void * -spe_thread (void * arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &fork_spu); - spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL); - - pthread_exit (NULL); -} - -int -main (void) -{ - pthread_t pts; - spe_context_ptr_t ctx; - unsigned int value; - unsigned int pid; - - ctx = spe_context_create (0, NULL); - pthread_create (&pts, NULL, &spe_thread, &ctx); - - /* Wait until the SPU thread is running. */ - spe_out_intr_mbox_read (ctx, &value, 1, SPE_MBOX_ALL_BLOCKING); - - pid = fork (); - if (pid == 0) - { - /* This is the child. Just exit immediately. */ - exit (0); - } - else - { - /* This is the parent. Wait for the child to exit. */ - waitpid (pid, NULL, 0); - } - - /* Tell SPU to continue. */ - spe_in_mbox_write (ctx, &value, 1, SPE_MBOX_ALL_BLOCKING); - - pthread_join (pts, NULL); - spe_context_destroy (ctx); - - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/fork.exp b/gdb/testsuite/gdb.cell/fork.exp deleted file mode 100644 index 0092191..0000000 --- a/gdb/testsuite/gdb.cell/fork.exp +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2010-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Ulrich Weigand <uweigand@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcases tests support for PPU-side fork during SPU debugging - -load_lib cell.exp - -set testfile "fork" -set ppu_file "fork" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "fork-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -delete_breakpoints - -gdb_test_no_output "set spu stop-on-load" "set spu stop-on-load" - -gdb_test "continue" "Continuing\\..*Temporary breakpoint \[0-9\]+, main \\(speid=.*, argp=.*, envp=.*\\) at .*$spu_file\\.c:.*spu_write_out_intr_mbox.*" \ - "run until SPU main" - -gdb_test "break func" "Breakpoint \[0-9\]+ at.* file .*$spu_file.c, line \[0-9\]+\\." "break func" -gdb_test "watch var" "Watchpoint \[0-9\]+: var" "watch var" - -gdb_test "continue" "Continuing\\..*Watchpoint.*Old value = 0.*New value = 1.*" \ - "run until watchpoint hit" - -gdb_test_no_output "delete \$bpnum" "delete watchpoint" - -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, func \\(\\) at .*$spu_file.c:.*" \ - "run until breakpoint hit" - -gdb_continue_to_end "" continue 1 - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/gcore.exp b/gdb/testsuite/gdb.cell/gcore.exp deleted file mode 100644 index f586b75..0000000 --- a/gdb/testsuite/gdb.cell/gcore.exp +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcases tests mixed-architecture core file support - -load_lib cell.exp - -set testfile "coremaker" -set ppu_file "coremaker" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "coremaker-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {![isnative]} then { - return 0 -} - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -delete_breakpoints - -gdb_test "continue" ".*Aborted.*" - -if {![gdb_gcore_cmd "${objdir}/${subdir}/gcore.test" \ - "save a corefile"]} { - return -1 -} - -# Now restart gdb and load the corefile. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -send_gdb "core-file $objdir/$subdir/gcore.test\n" -gdb_expect { - -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { - pass "core-file command" - } - -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { - pass "core-file command (with bad program name)" - } - -re ".*$gdb_prompt $" { fail "core-file command" } - timeout { fail "(timeout) core-file command" } -} - -gdb_test "backtrace" ".*abort.*main.*at.*$ppu_file.c.*" - -for {set thread_id 2} {$thread_id < 7} {incr thread_id} { - gdb_test "t $thread_id" \ - "Switching to thread $thread_id.*" \ - "switch to thread $thread_id" - gdb_test "backtrace" \ - ".*terminal_func.*factorial_func.*value=1.*factorial_func.*value=2.*factorial_func.*value=3.*factorial_func.*value=4.*factorial_func.*value=5.*factorial_func.*value=6.*main.*speid.*argp.*envp.*at.*$spu_file.c.*<cross-architecture call>.*spe_context_run.*spe_thread.*at.*$ppu_file.c.*" \ - "backtrace in thread $thread_id" -} - -gdb_exit - -return 0 diff --git a/gdb/testsuite/gdb.cell/mem-access-spu.c b/gdb/testsuite/gdb.cell/mem-access-spu.c deleted file mode 100644 index 3baa3a2..0000000 --- a/gdb/testsuite/gdb.cell/mem-access-spu.c +++ /dev/null @@ -1,36 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - int i; - static int test_var; - - printf ("Hello World! from spu\n"); - - test_var = 5; - i = 5; /* Marker SPUEA */ - printf ("i = %d\n", i); - - return 0; -} diff --git a/gdb/testsuite/gdb.cell/mem-access.c b/gdb/testsuite/gdb.cell/mem-access.c deleted file mode 100644 index 442e8a2..0000000 --- a/gdb/testsuite/gdb.cell/mem-access.c +++ /dev/null @@ -1,67 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/wait.h> - -extern spe_program_handle_t mem_access_spu; -#define nr_t 1 - -void * -spe_thread (void *arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &mem_access_spu); - spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL); - - pthread_exit (NULL); -} - -int -main (void) -{ - int thread_id[nr_t]; - pthread_t pts[nr_t]; - spe_context_ptr_t ctx[nr_t]; - int value = 1; - int cnt; - static int test_var; - - test_var = 5; - for (cnt = 0; cnt < nr_t; cnt++) /* Marker PPUEA */ - { - ctx[cnt] = spe_context_create (0, NULL); - thread_id[cnt] - = pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]); - } - - for (cnt = 0; cnt < nr_t; cnt++) - pthread_join (pts[cnt], NULL); - - for (cnt = 0; cnt < nr_t; cnt++) - spe_context_destroy (ctx[cnt]); - - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/mem-access.exp b/gdb/testsuite/gdb.cell/mem-access.exp deleted file mode 100644 index 86d2294..0000000 --- a/gdb/testsuite/gdb.cell/mem-access.exp +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcases tests on PPU and SPU if variables and registers are accessible -# via print and set by using names and adresses. - -load_lib cell.exp - -set ppu_file "mem-access" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "mem-access-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -# Get the adress to symbol name. If $reg -# is set to 1, get address from a register. -proc get_adress_from_name { name reg } { - global gdb_prompt - set adr "" - - if { $reg == 1 } { - set q "x/x $name" - } else { - set q "x/x &$name" - } - - gdb_test_multiple $q "get address from $name" { - -re "(0x.....):.*$gdb_prompt $" { # Registers. - set adr $expect_out(1,string) - pass "get adress from $name = $adr" - } - -re "(0x........) <.*$gdb_prompt $" { # PPU address. - set adr $expect_out(1,string) - pass "get adress from $name = $adr" - } - -re "(0x....) <.*$gdb_prompt $" { # SPU address. - set adr $expect_out(1,string) - pass "get adress from $name = $adr" - } - -re "(0x...) <.*$gdb_prompt $" { # SPU address. - set adr $expect_out(1,string) - pass "get adress from $name = $adr" - } - } - - return ${adr} -} - -# Try to set a $value at adress $adr. -proc set_adr_content { adr value } { - gdb_test "set *$adr=$value" \ - "" \ - "set *$adr=$value" -} - -# Try to set a $value for $symbol. -proc set_symbol_content { symbol value } { - gdb_test "set $symbol=$value" \ - "" \ - "set *$symbol=$value" -} - -# Check if $value is at *adr -proc test_adr_content { adr value } { - gdb_test "p *$adr" \ - ".*=.*$value.*" \ - "(ptr) *$adr==$value" -} - -proc test_symbol_content { symbol value } { - gdb_test "p $symbol" \ - ".*=.*$value.*" \ - "(symbol) $symbol==$value" -} - -# Check VARNAME. Check if it has the inital -# value INITIALVALUE. Set it to NEWVALUE. -# Check if set properly. Do it via symbols and -# pointers. -proc check_var { varname initalvalue newvalue } { - - # Initial value should be $initalvalue. - test_symbol_content $varname $initalvalue - - # Get pointer to symbol and check if the - # initial value is found. - set adr [get_adress_from_name $varname 0] - test_adr_content $adr $initalvalue - - # Re-set value using the pointer. - set_adr_content $adr $newvalue - - # Test values by pointer and by symbol. - test_adr_content $adr $newvalue - test_symbol_content $varname $newvalue - - # Set value back to initalvalue using symbol - # name and check it. - set_symbol_content $varname $initalvalue - test_adr_content $adr $initalvalue - test_symbol_content $varname $initalvalue -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Check in PPU thread. -c_to "Marker PPUEA" $ppu_file.c -check_var "test_var" 5 7 - -# Go to SPU thread. -cont_spu_main -c_to "Marker SPUEA" $spu_file.c -check_spu_arch "" - -# Check in SPU thread. -check_var "test_var" 5 7 -# Check $sp register. -set adr [get_adress_from_name "\$sp" 1] -set_adr_content $adr 8 -test_adr_content $adr 8 - -gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.cell/ptype.exp b/gdb/testsuite/gdb.cell/ptype.exp deleted file mode 100644 index 39311e7..0000000 --- a/gdb/testsuite/gdb.cell/ptype.exp +++ /dev/null @@ -1,145 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# Test ptype and print/set of SPU-side registers. - -load_lib cell.exp - -set ppu_file "break" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "break-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Continue to SPU -cont_spu_main - -gdb_test "info registers r2" \ - "r2.*\{uint128 =.*v2_int64 =.*v4_int32 =.*v8_int16 =.*v16_int8 =.*v2_double =.*v4_float =.*\}.*" \ - "info registers r2" - -for {set check_reg 10} {$check_reg < 12} {incr check_reg} { - gdb_test "print \$r$check_reg\.v4_int32" \ - ".*= \{.*,.*,.*,.*\}" \ - "print \$r$check_reg\.v4_int32" - - gdb_test "ptype \$r$check_reg" \ - "type = union __spu_builtin_type_vec128.*\{.*int128_t uint128.* \ - int64_t v2_int64.*int32_t v4_int32.*int16_t v8_int16.* \ - int8_t v16_int8.*double v2_double.*float v4_float.*\}" \ - "ptype \$r$check_reg" - - gdb_test "set \$r$check_reg\.v4_int32 = {1,2,3,4}" \ - "" \ - "set \$r$check_reg\.v4_int32 = {1,2,3,4}" - - gdb_test "print \$r$check_reg\.v4_int32" \ - ".*= \{.*1, 2, 3, 4.*\}" \ - "print \$r$check_reg\.v4_int32" - - gdb_test "print \$r$check_reg.v4_int32\[0\]" \ - ".*= 1.*" \ - "print \$r$check_reg.v4_int32\[0\]" - - gdb_test "print \$r$check_reg.v4_int32\[1\]" \ - ".*= 2.*" \ - "print \$r$check_reg.v4_int32\[1\]" - - gdb_test "print \$r$check_reg.v4_int32\[2\]" \ - ".*= 3.*" \ - "print \$r$check_reg.v4_int32\[2\]" - - gdb_test "print \$r$check_reg.v4_int32\[3\]" \ - ".*= 4.*" \ - "print \$r$check_reg.v4_int32\[3\]" - - gdb_test "print \$r$check_reg.v4_int32\[4\]" \ - "no such vector element" \ - "print \$r$check_reg.v4_int32\[4\]" - - # Set single array elements to other values and check the results. - gdb_test "set \$r$check_reg\.v4_int32\[0\] = 5" \ - "" \ - "set \$r$check_reg\.v4_int32\[0\] = 5" - gdb_test "print \$r$check_reg.v4_int32\[0\]" \ - ".*= 5.*" \ - "print \$r$check_reg.v4_int32\[0\]" - - gdb_test "set \$r$check_reg\.v4_int32\[1\] = 6" \ - "" \ - "set \$r$check_reg\.v4_int32\[1\] = 6" - gdb_test "print \$r$check_reg.v4_int32\[1\]" \ - ".*= 6.*" \ - "print \$r$check_reg.v4_int32\[1\]" - - gdb_test "set \$r$check_reg\.v4_int32\[2\] = 7" \ - "" \ - "set \$r$check_reg\.v4_int32\[2\] = 7" - gdb_test "print \$r$check_reg.v4_int32\[2\]" \ - ".*= 7.*" \ - "print \$r$check_reg.v4_int32\[2\]" - - gdb_test "set \$r$check_reg\.v4_int32\[3\] = 8" \ - "" \ - "set \$r$check_reg\.v4_int32\[3\] = 8" - gdb_test "print \$r$check_reg.v4_int32\[3\]" \ - ".*= 8.*" \ - "print \$r$check_reg.v4_int32\[3\]" - - # Now there should be {5, 6, 7, 8} in that array. - gdb_test "print \$r$check_reg\.v4_int32" \ - ".*= \{.*5, 6, 7, 8.*\}" \ - "print \$r$check_reg\.v4_int32" -} - -gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.cell/registers.exp b/gdb/testsuite/gdb.cell/registers.exp deleted file mode 100644 index c4d2710..0000000 --- a/gdb/testsuite/gdb.cell/registers.exp +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcase tests registers on PPU and SPU. - -load_lib cell.exp - -set ppu_file "break" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "break-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -# No programm running, no registers should be available. -gdb_test "info all-registers" \ - "The program has no registers now." \ - "info all-registers" - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Check registers in PPU thread. -gdb_test "info reg r0" "r0.*" "info register r0" -gdb_test "info reg r31" "r31.*" "info register r31" -gdb_test "info reg r32" "Invalid register.*r32.*" "(invalid) info register r32" -gdb_test "info reg pc" "pc.*" "info register pc" -gdb_test "info reg cr" "cr.*" "info register cr" -gdb_test "info reg lr" "lr.*" "info register lr" -gdb_test "info reg ctr" "ctr.*" "info register ctr" -gdb_test "info reg xer" "xer.*" "info register xer" - -# Continue to SPU thread. -cont_spu_main - -# In SPU thread, check SPU registers. -for {set check_reg 0} {$check_reg < 128} {incr check_reg} { - gdb_test "info reg r$check_reg" \ - "r$check_reg.*uint128.*=.*v2\_int64.*v4\_int32.*v8\_int16.*v16\_int8.*v2\_double.*v4\_float.*" \ - "info register r$check_reg" -} -gdb_test "info reg r128" \ - "Invalid register.*r128.*" \ - "(invalid) info register r128" - -gdb_test "info reg pc" "pc.*main.*" "info register pc" -gdb_test "info reg id" "id.*" "info register id" -gdb_test "info reg sp" "sp.*" "info register sp" -gdb_test "info reg fpscr" "fpscr.*" "info register fpscr" -gdb_test "info reg srr0" "srr0.*" "info register srr0" -gdb_test "info reg lslr" "lslr.*" "info register lslr" -gdb_test "info reg decr" "decr.*" "info register decr" -gdb_test "info reg decr_status" "decr_status.*" "info register decr-status" - -gdb_test "info reg cr" "Invalid register.*cr.*" "info register cr" -gdb_test "info reg lr" "Invalid register.*lr.*" "info register lr" -gdb_test "info reg ctr" "Invalid register.*ctr.*" "info register ctr" -gdb_test "info reg xer" "Invalid register.*xer.*" "info register xer" - -gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.cell/size-spu.c b/gdb/testsuite/gdb.cell/size-spu.c deleted file mode 100644 index 4d8b881..0000000 --- a/gdb/testsuite/gdb.cell/size-spu.c +++ /dev/null @@ -1,53 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> - - -int -main (unsigned long long speid, unsigned long long argp, - unsigned long long envp) -{ - int c = sizeof (char); /* Break here. */ - printf ("sizeof(char)=%d\n", c); - - int s = sizeof (short); - printf ("sizeof(short)=%d\n", s); - - int i = sizeof (int); - printf ("sizeof(int)=%d\n", i); - - int l = sizeof (long); - printf ("sizeof(long)=%d\n", l); - - int ll = sizeof (long long); - printf ("sizeof(long long)=%d\n", ll); - - int f = sizeof (float); - printf ("sizeof(float)=%d\n", f); - - int d = sizeof (double); - printf ("sizeof(double)=%d\n", d); - - int ld = sizeof (long double); - printf ("sizeof(long double)=%d\n", ld); - - return 0; -} - diff --git a/gdb/testsuite/gdb.cell/size.c b/gdb/testsuite/gdb.cell/size.c deleted file mode 100644 index be9c8d3..0000000 --- a/gdb/testsuite/gdb.cell/size.c +++ /dev/null @@ -1,87 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2009-2019 Free Software Foundation, Inc. - - 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/>. - - Contributed by Markus Deuling <deuling@de.ibm.com> */ - -#include <stdio.h> -#include <libspe2.h> -#include <pthread.h> -#include <sys/wait.h> - -extern spe_program_handle_t size_spu; -#define nr_t 1 - -void * -spe_thread (void *arg) -{ - int flags = 0; - unsigned int entry = SPE_DEFAULT_ENTRY; - spe_context_ptr_t *ctx = (spe_context_ptr_t *) arg; - - spe_program_load (*ctx, &size_spu); - spe_context_run (*ctx, &entry, flags, NULL, NULL, NULL); - - pthread_exit (NULL); -} - -int -main (void) -{ - int thread_id[nr_t]; - pthread_t pts[nr_t]; - spe_context_ptr_t ctx[nr_t]; - int cnt; - - int c = sizeof (char); - printf ("sizeof(char)=%d\n", c); - - int s = sizeof (short); - printf ("sizeof(short)=%d\n", s); - - int i = sizeof (int); - printf ("sizeof(int)=%d\n", i); - - int l = sizeof (long); - printf ("sizeof(long)=%d\n", l); - - int ll = sizeof (long long); - printf ("sizeof(long long)=%d\n", ll); - - int f = sizeof (float); - printf ("sizeof(float)=%d\n", f); - - int d = sizeof (double); - printf ("sizeof(double)=%d\n", d); - - int ld = sizeof (long double); - printf ("sizeof(long double)=%d\n", ld); - - for (cnt = 0; cnt < nr_t; cnt++) - { - ctx[cnt] = spe_context_create (0, NULL); - thread_id[cnt] - = pthread_create (&pts[cnt], NULL, &spe_thread, &ctx[cnt]); - } - - for (cnt = 0; cnt < nr_t; cnt++) - pthread_join (pts[cnt], NULL); - - for (cnt = 0; cnt < nr_t; cnt++) - spe_context_destroy (ctx[cnt]); - - return 0; -} diff --git a/gdb/testsuite/gdb.cell/sizeof.exp b/gdb/testsuite/gdb.cell/sizeof.exp deleted file mode 100644 index 8ea69e6..0000000 --- a/gdb/testsuite/gdb.cell/sizeof.exp +++ /dev/null @@ -1,120 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# Check size of data types both on PPU and SPU. - -load_lib cell.exp - -set ppu_file "size" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "size-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - - -# Ask GDB about the sizes of data types. This has -# to be done in PPU thread and SPU thread. -proc get_gdb_size { type } { - global gdb_prompt - - set val "0" - gdb_test_multiple "print/d sizeof(${type})" "get sizeof(${type})" { - -re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" { - set val $expect_out(1,string) - pass "get sizeof ($type) = $val" - } - } - return ${val} -} - -# Compare sizes from GDB and sizeof(). -proc size_compare { type gdb_size } { - set expr [string_to_regexp "sizeof(${type})=${gdb_size}"] - gdb_test "next" \ - ".*" \ - "next" - # Checks against string_to_regexp fails in remote testing. - if ![is_remote target] { - gdb_test "next" \ - "${expr}.*" \ - "check sizeof \"$type\" \"$gdb_size\" " - } else { - gdb_test "next" ".*" "check sizeof deactivate in remote testing" - } -} - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Compare sizes. -size_compare "char" [get_gdb_size "char"] -size_compare "short" [get_gdb_size "short"] -size_compare "int" [get_gdb_size "int"] -size_compare "long" [get_gdb_size "long"] -size_compare "long long" [get_gdb_size "long long"] -size_compare "float" [get_gdb_size "float"] -size_compare "double" [get_gdb_size "double"] -size_compare "long double" [get_gdb_size "long double"] - -# Continue to SPU thread. -cont_spu_main -check_spu_arch "" - -# Compare sizes in SPU thread. -size_compare "char" [get_gdb_size "char"] -size_compare "short" [get_gdb_size "short"] -size_compare "int" [get_gdb_size "int"] -size_compare "long" [get_gdb_size "long"] -size_compare "long long" [get_gdb_size "long long"] -size_compare "float" [get_gdb_size "float"] -size_compare "double" [get_gdb_size "double"] -size_compare "long double" [get_gdb_size "long double"] - -gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.cell/solib-symbol.exp b/gdb/testsuite/gdb.cell/solib-symbol.exp deleted file mode 100644 index 685ccf5..0000000 --- a/gdb/testsuite/gdb.cell/solib-symbol.exp +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# Testcase for multiple symbol disambiguation patch. - -load_lib cell.exp - -set ppu_file "break" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "break-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Symbol resolved in PPU thread. -gdb_test "info symbol foo" \ - "foo in section \.text of .*$ppu_file\[\r\n\]+.*" \ - "info symbol foo in break" - -# Continue to SPU -cont_spu_main -check_spu_arch "" - -# Symbol resolved in SPU thread. -gdb_test "info symbol foo" \ - "foo in section \.text of .*$spu_file@.*" \ - "info symbol foo in break-spu" - -gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.cell/solib.exp b/gdb/testsuite/gdb.cell/solib.exp deleted file mode 100644 index d6ed65d..0000000 --- a/gdb/testsuite/gdb.cell/solib.exp +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Testsuite for Cell Broadband Engine combined debugger -# This testcase checks 'info sharedlibrary ' command. - -load_lib cell.exp - -set ppu_file "break" -set ppu_src ${srcdir}/${subdir}/${ppu_file}.c -set ppu_bin [standard_output_file ${ppu_file}] -set spu_file "break-spu" -set spu_src ${srcdir}/${subdir}/${spu_file}.c -set spu_bin [standard_output_file ${spu_file}] - -if {[skip_cell_tests]} { - return 0 -} - -# Compile SPU binary. -if { [gdb_compile_cell_spu $spu_src $spu_bin executable {debug}] != "" } { - unsupported "compiling spu binary failed." - return -1 -} -# Compile PPU binary. -if { [gdb_cell_embedspu $spu_bin $spu_bin-embed.o {debug}] != "" } { - unsupported "embedding spu binary failed." - return -1 -} -if { [gdb_compile_cell_ppu [list $ppu_src $spu_bin-embed.o] $ppu_bin executable {debug}] != "" } { - unsupported "compiling ppu binary failed." - return -1 -} - -if [get_compiler_info] { - return -1 -} - - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${ppu_bin} - -# No programm running, no libraries should be loaded. -gdb_test "info sharedlibrary" \ - "No shared libraries loaded at this time." \ - "no shared library is loaded" - -if ![runto_main] then { - fail "can't run to main" - return 0 -} - -# Standing in PPU thread, now some libs should be loaded -# including libspe library. -gdb_test "info sharedlibrary" \ - "From.*To.*Syms Read.*Shared Object Library.*libspe.*" \ - "binary started, some libraries loaded" - -# Continue to SPU -cont_spu_main -check_spu_arch "" - -# In SPU thread now, the SPU binary should now appear in the list -# of shared libraries. -gdb_test "info sharedlibrary" \ - "From.*To.*Syms Read.*Shared Object Library.*libspe.*$spu_bin.*@.*x.*" \ - "spu thread, spu binary as shared library" - -gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.cp/bs15503.exp b/gdb/testsuite/gdb.cp/bs15503.exp index 920b02a..f238f51 100644 --- a/gdb/testsuite/gdb.cp/bs15503.exp +++ b/gdb/testsuite/gdb.cp/bs15503.exp @@ -19,11 +19,6 @@ if { [skip_stl_tests] } { continue } -# On SPU this test fails because the executable exceeds local storage size. -if { [istarget "spu*-*-*"] } { - return 0 -} - standard_testfile .cc if [get_compiler_info] { diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp index ecf3a2f..d7decaf 100644 --- a/gdb/testsuite/gdb.cp/cpexprs.exp +++ b/gdb/testsuite/gdb.cp/cpexprs.exp @@ -681,11 +681,6 @@ add {policyd5::function} \ # Start the test if {[skip_cplus_tests]} { continue } -# On SPU this test fails because the executable exceeds local storage size. -if { [istarget "spu*-*-*"] } { - return 0 -} - # # test running programs # diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp index 0be382b..13631df 100644 --- a/gdb/testsuite/gdb.cp/exception.exp +++ b/gdb/testsuite/gdb.cp/exception.exp @@ -35,11 +35,6 @@ set nl "\[\r\n\]+" if { [skip_stl_tests] } { continue } -# On SPU this test fails because the executable exceeds local storage size. -if { [istarget "spu*-*-*"] } { - return 0 -} - standard_testfile .cc if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { diff --git a/gdb/testsuite/gdb.cp/gdb2495.exp b/gdb/testsuite/gdb.cp/gdb2495.exp index bcb6c5e..a7de2cc 100644 --- a/gdb/testsuite/gdb.cp/gdb2495.exp +++ b/gdb/testsuite/gdb.cp/gdb2495.exp @@ -38,11 +38,6 @@ if [target_info exists gdb,nosignals] { continue } -# On SPU this test fails because the executable exceeds local storage size. -if { [istarget "spu*-*-*"] } { - return 0 -} - standard_testfile .cc # Create and source the file that provides information about the compiler diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp index ad42ef6..5946c0b 100644 --- a/gdb/testsuite/gdb.cp/mb-templates.exp +++ b/gdb/testsuite/gdb.cp/mb-templates.exp @@ -18,11 +18,6 @@ if { [skip_stl_tests] } { continue } -# On SPU this test fails because the executable exceeds local storage size. -if { [istarget "spu*-*-*"] } { - return 0 -} - standard_testfile .cc diff --git a/gdb/testsuite/gdb.cp/pr9167.exp b/gdb/testsuite/gdb.cp/pr9167.exp index e8a7722..2142252 100644 --- a/gdb/testsuite/gdb.cp/pr9167.exp +++ b/gdb/testsuite/gdb.cp/pr9167.exp @@ -13,11 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# On SPU this test fails because the executable exceeds local storage size. -if { [istarget "spu*-*-*"] } { - return 0 -} - standard_testfile .cc if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index dad9be3..7907593 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -21,11 +21,6 @@ if { [skip_stl_tests] } { continue } -# On SPU this test fails because the executable exceeds local storage size. -if { [istarget "spu*-*-*"] } { - return 0 -} - standard_testfile .cc if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp index 35fcc00..efd2227 100644 --- a/gdb/testsuite/gdb.xml/tdesc-regs.exp +++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp @@ -69,16 +69,6 @@ switch -glob -- [istarget] { set regdir "sparc/" set core-regs {sparc64-cpu.xml sparc64-fpu.xml sparc64-cp0.xml} } - "spu*-*-*" { - # This may be either the spu-linux-nat target, or the Cell/B.E. - # multi-architecture debugger in SPU standalone executable mode. - # We do not support XML register sets on SPU in either case. - # However, the multi-arch debugger will accept XML registers sets - # (on the PowerPC side), hence the test below would fail. - # Simply return unconditionally here. - unsupported "register tests" - return 0 - } "tic6x-*-*" { set core-regs {tic6x-core.xml} } diff --git a/gdb/testsuite/lib/cell.exp b/gdb/testsuite/lib/cell.exp deleted file mode 100644 index 4a32805..0000000 --- a/gdb/testsuite/lib/cell.exp +++ /dev/null @@ -1,181 +0,0 @@ -# Copyright 2009-2019 Free Software Foundation, Inc. -# -# 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/>. -# -# Contributed by Markus Deuling <deuling@de.ibm.com>. -# -# Support library for testing the combined debugger for Linux -# on the Cell Broadband Engine. - -# Compile SPU objects. -proc gdb_compile_cell_spu {source dest type options} { - global board - - # Save and unset multilib flags; these are not appropriate - # for the SPU compiler. - set board [target_info name] - set save_multilib_flag [board_info $board multilib_flags] - unset_board_info "multilib_flags" - - set options_spu [concat $options [list compiler=spu-gcc]] - set ccout [gdb_compile $source $dest $type $options_spu] - - set_board_info multilib_flags $save_multilib_flag - return $ccout -} - -# Compile PPU objects. This is just like gdb_compile_pthreads, except that we -# always add the libspe2 library for compiling Cell/B.E. programs. -proc gdb_compile_cell_ppu {source dest type options} { - # We do not need to try multiple names for the pthread library - # -lpthread works on all Cell/B.E. systems - set lib "-lspe2 -lpthread" - set options_ppu [concat $options [list libs=$lib]] - return [gdb_compile $source $dest $type $options_ppu] -} - -# Embed SPU executable into a PPU object. -proc gdb_cell_embedspu {source dest options} { - global CC_FOR_TARGET - - if [info exists CC_FOR_TARGET] { - set compiler $CC_FOR_TARGET - } else { - set compiler [board_info [target_info name] compiler] - } - - # We assume the PPU compiler is called gcc or ppu-gcc, - # and find the appropriate embedspu based on that. - regsub gcc "$compiler" embedspu embedspu - - # Determine default embedded symbol name from source filename. - set path [split "$source" /] - set filename [lindex $path [expr [llength $path] - 1]] - regsub -all -- "\[-\.\]" "$filename" "_" symbol - - set options_embed [concat $options [list compiler=$embedspu]] - return [gdb_compile "$symbol $source $dest" "" none $options_embed] -} - -# Run a test on the target to see if it supports Cell/B.E. hardware. -# Return 0 if so, 1 if it does not. -gdb_caching_proc skip_cell_tests { - global srcdir subdir gdb_prompt inferior_exited_re - - set me "skip_cell_tests" - - # Set up, compile, and execute a combined Cell/B.E. test program. - # Include the current process ID in the file names to prevent conflicts - # with invocations for multiple testsuites. - set src [standard_temp_file cell[pid].c] - set exe [standard_temp_file cell[pid].x] - set src_spu [standard_temp_file cell[pid]-spu.c] - set exe_spu [standard_temp_file cell[pid]-spu.x] - - set f [open $src "w"] - puts $f "#include <libspe2.h>" - puts $f "extern spe_program_handle_t cell[pid]_spu_x;" - puts $f "int main (void) {" - puts $f "unsigned int entry = SPE_DEFAULT_ENTRY;" - puts $f "spe_context_ptr_t ctx = spe_context_create (0, NULL);" - puts $f "spe_program_load (ctx, &cell[pid]_spu_x);" - puts $f "return spe_context_run (ctx, &entry, 0, NULL, NULL, NULL); }" - close $f - - set f [open $src_spu "w"] - puts $f "int main (void) { return 0; }" - close $f - - verbose "$me: compiling testfile $src" 2 - set compile_flags {debug nowarnings quiet} - - set skip 0 - if { [gdb_compile_cell_spu $src_spu $exe_spu executable $compile_flags] != "" } { - verbose "$me: compiling spu binary failed, returning 1" 2 - set skip 1 - } - if { ! $skip && [gdb_cell_embedspu $exe_spu $exe_spu-embed.o $compile_flags] != "" } { - verbose "$me: embedding spu binary failed, returning 1" 2 - set skip 1 - } - if { ! $skip && [gdb_compile_cell_ppu [list $src $exe_spu-embed.o] $exe executable $compile_flags] != "" } { - verbose "$me: compiling ppu binary failed, returning 1" 2 - set skip 1 - } - file delete $src - file delete $src_spu - file delete $exe_spu - file delete $exe_spu-embed.o - - if { $skip } { - return 1 - } - - # Compilation succeeded so now run it via gdb. - - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load "$exe" - gdb_run_cmd - gdb_expect { - -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { - verbose -log "\n$me: Cell/B.E. hardware detected" - set result 0 - } - -re ".*$inferior_exited_re with code.*${gdb_prompt} $" { - verbose -log "\n$me: Cell/B.E. hardware not detected" - set result 1 - } - default { - unresolved "$me: unexpected failure" - set result 1 - } - } - gdb_exit - remote_file build delete $exe - - verbose "$me: returning $result" 2 - return $result -} - -# Delete all breakpoints and stop on the next new SPU thread -proc cont_spu_main { } { - delete_breakpoints - gdb_test "set spu stop-on-load on" - gdb_test "continue" \ - "Continuing.*Temporary breakpoint .*main .*" \ - "continue to SPU main" -} - -# Continue to MARKER -proc c_to { marker srcfile } { - set line [gdb_get_line_number $marker $srcfile] - gdb_test "break $line" \ - "Breakpoint.*at.*file.*$srcfile.*line $line.*" \ - "break $line" - gdb_test "continue" \ - "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \ - "continue to $line" -} - -# Check if the current thread has SPU architecture -proc check_spu_arch { msg } { - if { $msg == "" } { - set msg "spu architecture is spu256K" - } - gdb_test "show architecture" \ - "The target architecture is set automatically.*currently spu:256K.*" \ - $msg -} |