]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver: convert regcache_cpy into regcache::copy_from
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Tue, 17 Dec 2024 07:48:03 +0000 (08:48 +0100)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Tue, 17 Dec 2024 07:48:03 +0000 (08:48 +0100)
Convert the free `regcache_cpy` function to a method of the
regcache struct.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdbserver/regcache.cc
gdbserver/regcache.h
gdbserver/tracepoint.cc

index 5ae922ec0be40fdaecad29aa522ff90ed6d8afca..583b5624333a18fab2b9ccc292e78b067687f17f 100644 (file)
@@ -178,19 +178,19 @@ free_register_cache (struct regcache *regcache)
 #endif
 
 void
-regcache_cpy (struct regcache *dst, struct regcache *src)
+regcache::copy_from (regcache *src)
 {
-  gdb_assert (src != NULL && dst != NULL);
-  gdb_assert (src->tdesc == dst->tdesc);
-  gdb_assert (src != dst);
+  gdb_assert (src != nullptr);
+  gdb_assert (src->tdesc == this->tdesc);
+  gdb_assert (src != this);
 
-  memcpy (dst->registers, src->registers, src->tdesc->registers_size);
+  memcpy (this->registers, src->registers, src->tdesc->registers_size);
 #ifndef IN_PROCESS_AGENT
-  if (dst->register_status != NULL && src->register_status != NULL)
-    memcpy (dst->register_status, src->register_status,
+  if (this->register_status != nullptr && src->register_status != nullptr)
+    memcpy (this->register_status, src->register_status,
            src->tdesc->reg_defs.size ());
 #endif
-  dst->registers_valid = src->registers_valid;
+  this->registers_valid = src->registers_valid;
 }
 
 /* Return a reference to the description of register N.  */
index 068f9e8df3d90ba2fbf8781901a2ad03519e312e..db3b2425de687c991130b6bf3115e6fdc10465b2 100644 (file)
@@ -60,14 +60,15 @@ struct regcache : public reg_buffer_common
 
   /* See gdbsupport/common-regcache.h.  */
   bool raw_compare (int regnum, const void *buf, int offset) const override;
+
+  /* Copy the contents of SRC into this regcache.  */
+  void copy_from (regcache *src);
 };
 
 struct regcache *init_register_cache (struct regcache *regcache,
                                      const struct target_desc *tdesc,
                                      unsigned char *regbuf);
 
-void regcache_cpy (struct regcache *dst, struct regcache *src);
-
 /* Create a new register cache for INFERIOR.  */
 
 struct regcache *new_register_cache (const struct target_desc *tdesc);
index 6b5541b5fbff921dc48786e194a980a473d5b2de..81104b02c8321fcb4cb247a6166be10ba04aea8c 100644 (file)
@@ -4797,7 +4797,7 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx,
                             regspace + 1);
 
        /* Copy the register data to the regblock.  */
-       regcache_cpy (&tregcache, context_regcache);
+       tregcache.copy_from (context_regcache);
 
 #ifndef IN_PROCESS_AGENT
        /* On some platforms, trap-based tracepoints will have the PC