From e7668ed9afb1ee2708dcf9abf254000d25b7d90c Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 14 Jul 2022 16:42:43 -0700 Subject: [PATCH] trad_frame_set_reg_regmap: Permit a non-zero register base. Similar to the register base used with regcache::collect/supply_regset, this value is added to the register number in valid register map entries. --- gdb/trad-frame.c | 5 ++++- gdb/trad-frame.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c index 9d4f23a851f..fece3461be8 100644 --- a/gdb/trad-frame.c +++ b/gdb/trad-frame.c @@ -116,7 +116,7 @@ trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache, void trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache, const struct regcache_map_entry *regmap, - CORE_ADDR addr, size_t size) + CORE_ADDR addr, size_t size, int regbase) { struct gdbarch *gdbarch = get_frame_arch (this_trad_cache->this_frame); int offs = 0, count; @@ -126,6 +126,9 @@ trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache, int regno = regmap->regno; int slot_size = regmap->size; + if (regno != REGCACHE_MAP_SKIP) + regno += regbase; + if (slot_size == 0 && regno != REGCACHE_MAP_SKIP) slot_size = register_size (gdbarch, regno); diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h index 09a8133d362..8e12f30c01a 100644 --- a/gdb/trad-frame.h +++ b/gdb/trad-frame.h @@ -48,7 +48,7 @@ void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr); void trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache, const struct regcache_map_entry *regmap, - CORE_ADDR addr, size_t size); + CORE_ADDR addr, size_t size, int regbase = 0); void trad_frame_set_reg_value (struct trad_frame_cache *this_cache, int regnum, LONGEST val); -- 2.47.2