]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
GDB: Add concept of variable-size registers to the regcache
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>
Sat, 5 Oct 2024 02:48:11 +0000 (23:48 -0300)
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>
Thu, 23 Oct 2025 02:47:54 +0000 (23:47 -0300)
commit461b29704e5bbfd5f7c3f6da11588d21d147afbc
treee47fdd2e3af1d45dda7a5028c70808d89c714547
parent17d36c261915d74229a837b3aa11f11f981a89ea
GDB: Add concept of variable-size registers to the regcache

The contents of variable-size registers are placed in a separate buffer,
because their size will only be known a while after the buffer is
created but some fixed-size registers (particularly the program counter)
need to be stored or fetched before then.  This is also why the state
related to variable-size registers is lazily initialised at the moment
it's first needed (by calling the initialize_variable_size_registers ()
method).

Simon suggested placing the variable-size registers at the end of the
existing contents buffer to avoid having to use a separate one.  I will
experiment with that idea and see if it simplifies the code.

The regcache now also stores the resolved type and size of the
variable-size registers.  Some places needed to be changed from calling
the register_size () function to calling the register_size () method
instead, because they may call them for variable-size registers.  The
frame-unwinding code doesn't have a regcache readily available, so the
register_size () function is changed to optionally accept a
frame_info_ptr which it uses to create a readonly_detached_regcache.

When debugging a remote target, if the regcache has variable-size
registers the maximum packet size may change with new values of
expedited registers.  Therefore, update the maximum packet size when
expedited registers are supplied, or load-early registers are fetched.

Finally, there are FIXMEs related to the const_casts needed to remove
the const from the "this" pointer when calling
reg_buffer::initialize_variable_size_registers ().  I'm still thinking
about what to do with them.  I tried the simple solution of changing the
calling methods to be non-const, but the change escalates quickly.
gdb/aarch64-tdep.c
gdb/eval.c
gdb/findvar.c
gdb/frame.c
gdb/record-full.c
gdb/regcache.c
gdb/regcache.h
gdb/remote.c
gdb/value.c