aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-tdep.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-12-01 11:27:15 -0500
committerSimon Marchi <simon.marchi@efficios.com>2023-12-14 16:04:49 +0000
commite4e20d45110d919a5a2da2db84806f315ab59d90 (patch)
treec153a7c86e48bbb61850d2dd0f230bef3ba8e9ae /gdb/arm-tdep.c
parentc3a03de70fd373c0f8fc4ba5df1c0db29445112c (diff)
downloadbinutils-e4e20d45110d919a5a2da2db84806f315ab59d90.zip
binutils-e4e20d45110d919a5a2da2db84806f315ab59d90.tar.gz
binutils-e4e20d45110d919a5a2da2db84806f315ab59d90.tar.bz2
gdb: use reg_buffer_common throughout gdbsupport/common-regcache.h
Right now, gdbsupport/common-regcache.h contains two abstractons for a regcache. An opaque type `regcache` (gdb and gdbserver both have their own regcache that is the concrete version of this) and an abstract base class `reg_buffer_common`, that is the base of regcaches on both sides. These abstractions allow code to be written for both gdb and gdbserver, for instance in the gdb/arch sub-directory. However, having two different abstractions is impractical. If some common code has a regcache, and wants to use an operation defined on reg_buffer_common, it can't. It would be better to have just one. Change all instances of `regcache *` in gdbsupport/common-regcache.h to be `reg_buffer_common *`, then fix fallouts. Implementations in gdb and gdbserver now need to down-cast (using gdb::checked_static_cast) from reg_buffer_common to their concrete regcache type. Some of them could be avoided by changing free functions (like regcache_register_size) to be virtual methods on reg_buffer_common. I tried it, it seems to work, but I did not include it in this series to avoid adding unnecessary changes. Change-Id: Ia5503adb6b5509a0f4604bd2a68b4642cc5283fd Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r--gdb/arm-tdep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 23fecf7..83fce2a 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -7255,7 +7255,8 @@ CORE_ADDR
arm_get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self,
CORE_ADDR val)
{
- return gdbarch_addr_bits_remove (self->regcache->arch (), val);
+ return gdbarch_addr_bits_remove
+ (gdb::checked_static_cast<regcache *> (self->regcache)->arch (), val);
}
/* Wrapper over syscall_next_pc for use in get_next_pcs. */
@@ -7271,7 +7272,7 @@ arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
int
arm_get_next_pcs_is_thumb (struct arm_get_next_pcs *self)
{
- return arm_is_thumb (self->regcache);
+ return arm_is_thumb (gdb::checked_static_cast<regcache *> (self->regcache));
}
/* single_step() is called just before we want to resume the inferior,