[PATCH 1/8] AARCH64 SVE: Increse max register sizes
Mon Dec 12 18:11:00 GMT 2016
On 16-12-05 12:26:24, Alan Hayward wrote:
> This is part of a series adding AARCH64 SVE support to gdb and gdbserver.
> In SVE the maximum size of a variable-length vector register is 256 bytes,
> times the current maximum size currently supported in gdb. This patch
> the max register size and max gdbserver buffer size accordingly.
Joel expressed the willingness that we should make MAX_REGISTER_SIZE
gdbarch specific last time when it was changed from 32 to 64.
I think we should make MAX_REGISTER_SIZE gdbarch specific, or stop
using it at all.
> Alternatively, I could add a target variable using gdbarch.c, however
> there are
> 80+ static arrays within the code using the value, which would all need
> replacing with mallocs/frees.
We can use alloca to allocate memory on stack, and we can get the
size of a register if gdbarch and regnum is available. For example,
we can replace MAX_REGISTER_SIZE with register_size in
xtensa_pseudo_register_read this way,
gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
This can be used many places to replace MAX_REGISTER_SIZE. Hopefully,
this may get rid of the use of MAX_REGISTER_SIZE except the uses in
python/py-unwind.c and remote.c. We may replace array data[MAX_REGISTER_SIZE]
with pointer in struct cached_reg and struct reg_info, and allocate memory
dynamically, or use std::vector if it helps.
More information about the Gdb-patches