Introduce typeid_operation
[deliverable/binutils-gdb.git] / gdb / sparc-obsd-tdep.c
index b7d3d3cf47a143cf1e253ca85fcc3a2577f92c8b..e198e9702cdb07a37ab08f1cc06609680357d980 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for OpenBSD/sparc.
 
-   Copyright (C) 2004-2017 Free Software Foundation, Inc.
+   Copyright (C) 2004-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,7 +18,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "floatformat.h"
 #include "frame.h"
 #include "frame-unwind.h"
 #include "gdbcore.h"
 #include "regcache.h"
 #include "symtab.h"
 #include "trad-frame.h"
+#include "inferior.h"
 
 #include "obsd-tdep.h"
 #include "sparc-tdep.h"
 #include "solib-svr4.h"
 #include "bsd-uthread.h"
+#include "gdbarch.h"
 
 /* Signal trampolines.  */
 
@@ -87,7 +88,7 @@ sparc32obsd_sigtramp_frame_cache (struct frame_info *this_frame,
       cache->pc &= ~(sparc32obsd_page_size - 1);
 
       /* Since we couldn't find the frame's function, the cache was
-         initialized under the assumption that we're frameless.  */
+        initialized under the assumption that we're frameless.  */
       sparc_record_save_insn (cache);
       addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
       cache->base = addr;
@@ -153,18 +154,21 @@ static void
 sparc32obsd_supply_uthread (struct regcache *regcache,
                            int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR fp, fp_addr = addr + SPARC32OBSD_UTHREAD_FP_OFFSET;
   gdb_byte buf[4];
 
+  /* This function calls functions that depend on the global current thread.  */
+  gdb_assert (regcache->ptid () == inferior_ptid);
+
   gdb_assert (regnum >= -1);
 
   fp = read_memory_unsigned_integer (fp_addr, 4, byte_order);
   if (regnum == SPARC_SP_REGNUM || regnum == -1)
     {
       store_unsigned_integer (buf, 4, byte_order, fp);
-      regcache_raw_supply (regcache, SPARC_SP_REGNUM, buf);
+      regcache->raw_supply (SPARC_SP_REGNUM, buf);
 
       if (regnum == SPARC_SP_REGNUM)
        return;
@@ -179,12 +183,12 @@ sparc32obsd_supply_uthread (struct regcache *regcache,
       if (regnum == SPARC32_PC_REGNUM || regnum == -1)
        {
          store_unsigned_integer (buf, 4, byte_order, i7 + 8);
-         regcache_raw_supply (regcache, SPARC32_PC_REGNUM, buf);
+         regcache->raw_supply (SPARC32_PC_REGNUM, buf);
        }
       if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
        {
          store_unsigned_integer (buf, 4, byte_order, i7 + 12);
-         regcache_raw_supply (regcache, SPARC32_NPC_REGNUM, buf);
+         regcache->raw_supply (SPARC32_NPC_REGNUM, buf);
        }
 
       if (regnum == SPARC32_PC_REGNUM || regnum == SPARC32_NPC_REGNUM)
@@ -198,18 +202,21 @@ static void
 sparc32obsd_collect_uthread(const struct regcache *regcache,
                            int regnum, CORE_ADDR addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
   gdb_byte buf[4];
 
+  /* This function calls functions that depend on the global current thread.  */
+  gdb_assert (regcache->ptid () == inferior_ptid);
+
   gdb_assert (regnum >= -1);
 
   if (regnum == SPARC_SP_REGNUM || regnum == -1)
     {
       CORE_ADDR fp_addr = addr + SPARC32OBSD_UTHREAD_FP_OFFSET;
 
-      regcache_raw_collect (regcache, SPARC_SP_REGNUM, buf);
+      regcache->raw_collect (SPARC_SP_REGNUM, buf);
       write_memory (fp_addr,buf, 4);
     }
 
@@ -217,7 +224,7 @@ sparc32obsd_collect_uthread(const struct regcache *regcache,
     {
       CORE_ADDR i7, i7_addr = addr + SPARC32OBSD_UTHREAD_PC_OFFSET;
 
-      regcache_raw_collect (regcache, SPARC32_PC_REGNUM, buf);
+      regcache->raw_collect (SPARC32_PC_REGNUM, buf);
       i7 = extract_unsigned_integer (buf, 4, byte_order) - 8;
       write_memory_unsigned_integer (i7_addr, 4, byte_order, i7);
 
@@ -225,7 +232,7 @@ sparc32obsd_collect_uthread(const struct regcache *regcache,
        return;
     }
 
-  regcache_raw_collect (regcache, SPARC_SP_REGNUM, buf);
+  regcache->raw_collect (SPARC_SP_REGNUM, buf);
   sp = extract_unsigned_integer (buf, 4, byte_order);
   sparc_collect_rwindow (regcache, sp, regnum);
 }
@@ -246,12 +253,9 @@ sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   bsd_uthread_set_collect_uthread (gdbarch, sparc32obsd_collect_uthread);
 }
 
-\f
-/* Provide a prototype to silence -Wmissing-prototypes.  */
-void _initialize_sparc32obsd_tdep (void);
-
+void _initialize_sparc32obsd_tdep ();
 void
-_initialize_sparc32obsd_tdep (void)
+_initialize_sparc32obsd_tdep ()
 {
   gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_OPENBSD,
                          sparc32obsd_init_abi);
This page took 0.027293 seconds and 4 git commands to generate.