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.
This commit is contained in:
Ulrich Weigand 2019-09-20 23:06:57 +02:00
parent 78e8cb91cd
commit abf516c693
108 changed files with 189 additions and 11285 deletions

View File

@ -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.

View File

@ -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

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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;

View File

@ -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

View File

@ -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 ;;

View File

@ -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

View File

@ -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"

View File

@ -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)
{

View File

@ -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.

View File

@ -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{}

View File

@ -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 \

View File

@ -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;
}

View File

@ -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>

View File

@ -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;
}

View File

@ -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>

View File

@ -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'.

View File

@ -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"

View File

@ -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,

View File

@ -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 ();

View File

@ -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 ();

View File

@ -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);

View File

@ -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 */

View File

@ -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 */

View File

@ -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+");

View File

@ -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 ();
}

View File

@ -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);

View File

@ -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

View File

@ -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
@ -3841,12 +3837,6 @@ linux_nat_xfer_osdata (enum target_object object,
const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
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,
@ -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

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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 ();

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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, &regval);
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, &regval);
*fd = (int) regval;
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 4, &regval);
*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);
}

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -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__ */

View File

@ -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) }
}

View File

@ -36,11 +36,7 @@ void medium_frame ()
void big_frame ()
{
#ifdef __SPU__
char S [131072];
#else
char S [524188];
#endif
small_frame ();
}

View File

@ -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

View File

@ -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");
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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 ();
}

View File

@ -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 */
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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] {

Some files were not shown because too many files have changed in this diff Show More