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

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