GDB, gdbserver: Convert regcache_register_size function to method

The regcache_register_size function has one implementation in GDB, and
one in gdbserver.  Both of them have a gdb::checked_static_cast to their
corresponding regcache class.  This can be avoided by defining a
pure virtual register_size method in the
reg_buffer_common class, which is then implemented by the reg_buffer
class in GDB, and by the regcache class in gdbserver.

Calls to the register_size () function from methods of classes in the
reg_buffer_common hierarchy need to be changed to calls to the newly
defined method, otherwise the compiler complains that a matching method
cannot be found.

Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Change-Id: I7f4f74a51e96c42604374e87321ca0e569bc07a3
This commit is contained in:
Thiago Jung Bauermann
2024-11-01 23:56:21 -03:00
committed by Simon Marchi
parent 1da3605797
commit d70701731d
9 changed files with 26 additions and 33 deletions

View File

@@ -211,7 +211,7 @@ amd64_windows_store_arg_in_reg (struct regcache *regcache,
gdb_assert (valbuf.size () <= 8);
std::copy (valbuf.begin (), valbuf.end (), buf.begin ());
size_t reg_size = regcache_register_size (regcache, regno);
size_t reg_size = regcache->register_size (regno);
gdb_assert (reg_size <= buf.size ());
gdb::array_view<gdb_byte> view (buf);
regcache->cooked_write (regno, view.slice (0, reg_size));