Bump version to 8.2.50.DATE-git.
[deliverable/binutils-gdb.git] / gdb / spu-multiarch.c
index 4e3397fdfe3e5403ab586497fa112bbf9522fca6..7e642d663a420b6457dc4948abb911039613e727 100644 (file)
 
 /* 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
 {
   spu_multiarch_target ()
   { to_stratum = arch_stratum; };
 
-  const char *shortname () override
-  { return "spu"; }
-
-  const char *longname () override
-  { return _("SPU multi-architecture support."); }
-
-  const char *doc () override
-  { return _("SPU multi-architecture support."); }
+  const target_info &info () const override
+  { return spu_multiarch_target_info; }
 
   void mourn_inferior () override;
 
-    void fetch_registers (struct regcache *, int) 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,
@@ -157,21 +157,19 @@ spu_multiarch_target::thread_architecture (ptid_t ptid)
   if (parse_spufs_run (ptid, &spufs_fd, &spufs_addr))
     return spu_gdbarch (spufs_fd);
 
-  target_ops *beneath = find_target_beneath (this);
-  return beneath->thread_architecture (ptid);
+  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)
 {
-  struct target_ops *ops_beneath = find_target_beneath (this);
-
   /* We cannot watch SPU local store.  */
   if (SPUADDR_SPU (addr) != -1)
     return 0;
 
-  return ops_beneath->region_ok_for_hw_watchpoint (addr, len);
+  return beneath ()->region_ok_for_hw_watchpoint (addr, len);
 }
 
 /* Override the to_fetch_registers routine.  */
@@ -181,19 +179,18 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  struct target_ops *ops_beneath = find_target_beneath (this);
   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_get_ptid (regcache));
+    = 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)
     {
-      ops_beneath->fetch_registers (regcache, regno);
+      beneath ()->fetch_registers (regcache, regno);
       return;
     }
 
@@ -206,7 +203,7 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
     {
       gdb_byte buf[4];
       store_unsigned_integer (buf, 4, byte_order, spufs_fd);
-      regcache_raw_supply (regcache, SPU_ID_REGNUM, buf);
+      regcache->raw_supply (SPU_ID_REGNUM, buf);
     }
 
   /* The NPC register is found in PPC memory at SPUFS_ADDR.  */
@@ -214,9 +211,9 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
     {
       gdb_byte buf[4];
 
-      if (target_read (ops_beneath, TARGET_OBJECT_MEMORY, NULL,
+      if (target_read (beneath (), TARGET_OBJECT_MEMORY, NULL,
                       buf, spufs_addr, sizeof buf) == sizeof buf)
-       regcache_raw_supply (regcache, SPU_PC_REGNUM, buf);
+       regcache->raw_supply (SPU_PC_REGNUM, buf);
     }
 
   /* The GPRs are found in the "regs" spufs file.  */
@@ -227,10 +224,10 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
       int i;
 
       xsnprintf (annex, sizeof annex, "%d/regs", spufs_fd);
-      if (target_read (ops_beneath, TARGET_OBJECT_SPU, annex,
+      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 (regcache, i, buf + i*16);
+         regcache->raw_supply (i, buf + i*16);
     }
 }
 
@@ -240,19 +237,18 @@ void
 spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct target_ops *ops_beneath = find_target_beneath (this);
   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_get_ptid (regcache));
+    = 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)
     {
-      ops_beneath->store_registers (regcache, regno);
+      beneath ()->store_registers (regcache, regno);
       return;
     }
 
@@ -264,9 +260,9 @@ spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
   if (regno == -1 || regno == SPU_PC_REGNUM)
     {
       gdb_byte buf[4];
-      regcache_raw_collect (regcache, SPU_PC_REGNUM, buf);
+      regcache->raw_collect (SPU_PC_REGNUM, buf);
 
-      target_write (ops_beneath, TARGET_OBJECT_MEMORY, NULL,
+      target_write (beneath (), TARGET_OBJECT_MEMORY, NULL,
                    buf, spufs_addr, sizeof buf);
     }
 
@@ -278,10 +274,10 @@ spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
       int i;
 
       for (i = 0; i < SPU_NUM_GPRS; i++)
-       regcache_raw_collect (regcache, i, buf + i*16);
+       regcache->raw_collect (i, buf + i*16);
 
       xsnprintf (annex, sizeof annex, "%d/regs", spufs_fd);
-      target_write (ops_beneath, TARGET_OBJECT_SPU, annex,
+      target_write (beneath (), TARGET_OBJECT_SPU, annex,
                    buf, 0, sizeof buf);
     }
 }
@@ -294,7 +290,7 @@ spu_multiarch_target::xfer_partial (enum target_object object,
                                    const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
                                    ULONGEST *xfered_len)
 {
-  struct target_ops *ops_beneath = find_target_beneath (this);
+  struct target_ops *ops_beneath = this->beneath ();
 
   /* Use the "mem" spufs file to access SPU local store.  */
   if (object == TARGET_OBJECT_MEMORY)
@@ -344,15 +340,13 @@ spu_multiarch_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space
                                     const gdb_byte *pattern, ULONGEST pattern_len,
                                     CORE_ADDR *found_addrp)
 {
-  struct target_ops *ops_beneath = find_target_beneath (this);
-
   /* 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 ops_beneath->search_memory (start_addr, search_space_len,
-                                    pattern, pattern_len, found_addrp);
+  return beneath ()->search_memory (start_addr, search_space_len,
+                                   pattern, pattern_len, found_addrp);
 }
 
 
@@ -409,9 +403,7 @@ spu_multiarch_solib_unloaded (struct so_list *so)
 void
 spu_multiarch_target::mourn_inferior ()
 {
-  struct target_ops *ops_beneath = find_target_beneath (this);
-
-  ops_beneath->mourn_inferior ();
+  beneath ()->mourn_inferior ();
   spu_multiarch_deactivate ();
 }
 
This page took 0.026316 seconds and 4 git commands to generate.