diff options
author | Luis Machado <luis.machado@arm.com> | 2023-02-09 10:55:26 +0000 |
---|---|---|
committer | Luis Machado <luis.machado@arm.com> | 2023-10-04 16:23:40 +0100 |
commit | 223dbdd276cf0b223ec96f8896d369af57d7387c (patch) | |
tree | 329dd4bfdbee68f57a2ce1b80ac6f980e4f9e151 /gdbserver | |
parent | 6a65998a8a94abaaae7ca4ff0ab9c3f25dc2e766 (diff) | |
download | fsf-binutils-gdb-223dbdd276cf0b223ec96f8896d369af57d7387c.zip fsf-binutils-gdb-223dbdd276cf0b223ec96f8896d369af57d7387c.tar.gz fsf-binutils-gdb-223dbdd276cf0b223ec96f8896d369af57d7387c.tar.bz2 |
refactor: Adjust expedited registers dynamically
Instead of using static arrays, build the list of expedited registers
dynamically using a std::vector.
This refactor shouldn't cause any user-visible changes.
Regression-tested for aarch64-linux Ubuntu 22.04/20.04.
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Diffstat (limited to 'gdbserver')
-rw-r--r-- | gdbserver/linux-aarch64-tdesc.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/gdbserver/linux-aarch64-tdesc.cc b/gdbserver/linux-aarch64-tdesc.cc index 6331349..3c60e1a 100644 --- a/gdbserver/linux-aarch64-tdesc.cc +++ b/gdbserver/linux-aarch64-tdesc.cc @@ -30,6 +30,8 @@ /* All possible aarch64 target descriptors. */ static std::unordered_map<aarch64_features, target_desc *> tdesc_aarch64_map; +static std::vector<const char *> expedited_registers; + /* Create the aarch64 target description. */ const target_desc * @@ -44,15 +46,20 @@ aarch64_linux_read_description (const aarch64_features &features) if (tdesc == NULL) { tdesc = aarch64_create_target_description (features); + expedited_registers.clear (); + + /* Configure the expedited registers. By default we include x29, sp and + pc. */ + expedited_registers.push_back ("x29"); + expedited_registers.push_back ("sp"); + expedited_registers.push_back ("pc"); + + if (features.vq > 0) + expedited_registers.push_back ("vg"); - static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL }; - static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc", - "vg", NULL }; + expedited_registers.push_back (nullptr); - if (features.vq == 0) - init_target_desc (tdesc, expedite_regs_aarch64); - else - init_target_desc (tdesc, expedite_regs_aarch64_sve); + init_target_desc (tdesc, (const char **) expedited_registers.data ()); tdesc_aarch64_map[features] = tdesc; } |