aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2024-12-17 08:48:03 +0100
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2024-12-17 08:48:03 +0100
commitccdddcac51d41d4c2adaf79d5db4d0eefa5a682b (patch)
treee7cee9c4500adfbb3bf0dd7e4d203b96dbc5242c /gdbserver
parenta2cc13fad638aade196f17af044bf16c885624a1 (diff)
downloadgdb-ccdddcac51d41d4c2adaf79d5db4d0eefa5a682b.zip
gdb-ccdddcac51d41d4c2adaf79d5db4d0eefa5a682b.tar.gz
gdb-ccdddcac51d41d4c2adaf79d5db4d0eefa5a682b.tar.bz2
gdbserver: convert regcache_cpy into regcache::copy_from
Convert the free `regcache_cpy` function to a method of the regcache struct. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/regcache.cc16
-rw-r--r--gdbserver/regcache.h5
-rw-r--r--gdbserver/tracepoint.cc2
3 files changed, 12 insertions, 11 deletions
diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 5ae922e..583b562 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -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. */
diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h
index 068f9e8..db3b242 100644
--- a/gdbserver/regcache.h
+++ b/gdbserver/regcache.h
@@ -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);
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index 6b5541b..81104b0 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -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