summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@foss.st.com>2022-06-09 16:34:53 +0200
committerYvan Roux <yvan.roux@foss.st.com>2022-06-09 16:39:27 +0200
commit1ef3351b7b11e3d3bcdccdbc1bf2690ce35a70ba (patch)
tree7854f1cdd85112b6c547bcd499a58558e54d7fa5
parent8db775b211bb01d06197bf6dabb6b32b5428d5e2 (diff)
downloadbinutils-gdb-1ef3351b7b11e3d3bcdccdbc1bf2690ce35a70ba.tar.gz
gdb/arm: Simplify logic for updating addresses
Small performance improvement by fetching previous SP value only once before the loop and reuse it to avoid fetching at every iteration. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com> Signed-off-by: Yvan Roux <yvan.roux@foss.st.com>
-rw-r--r--gdb/arm-tdep.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 09670b69a1d..23f3d5f02f2 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2177,7 +2177,7 @@ arm_make_prologue_cache (struct frame_info *this_frame)
{
int reg;
struct arm_prologue_cache *cache;
- CORE_ADDR unwound_fp;
+ CORE_ADDR unwound_fp, prev_sp;
cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
arm_cache_init (cache, this_frame);
@@ -2191,14 +2191,15 @@ arm_make_prologue_cache (struct frame_info *this_frame)
arm_gdbarch_tdep *tdep =
(arm_gdbarch_tdep *) gdbarch_tdep (get_frame_arch (this_frame));
- arm_cache_set_active_sp_value (cache, tdep, unwound_fp + cache->framesize);
+ prev_sp = unwound_fp + cache->framesize;
+ arm_cache_set_active_sp_value (cache, tdep, prev_sp);
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
if (cache->saved_regs[reg].is_addr ())
- cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
- + arm_cache_get_prev_sp_value (cache, tdep));
+ cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr () +
+ prev_sp);
return cache;
}