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.