gdb/arm: Fetch initial sp value prior to compare
authorYvan Roux <yvan.roux@foss.st.com>
Wed, 15 Jun 2022 14:00:34 +0000 (16:00 +0200)
committerYvan Roux <yvan.roux@foss.st.com>
Wed, 15 Jun 2022 14:00:34 +0000 (16:00 +0200)
For Arm Cortex-M33 with security extensions, there are 4 different
stack pointers (msp_s, msp_ns, psp_s, psp_ns).  In order to
identify the active one, compare the values of the different
stacks. The value of the initial sp register needs to be fetched to
perform this comparison.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Signed-off-by: Yvan Roux <yvan.roux@foss.st.com>
gdb/arm-tdep.c

index fe62617d4bf89a4f301faea12cb3f8b1419c7dec..7c36133a091069c5b65dfff1efdce42f8a15b506 100644 (file)
@@ -341,6 +341,7 @@ arm_cache_init (struct arm_prologue_cache *cache, struct frame_info *frame)
   arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   arm_cache_init (cache, gdbarch);
+  cache->sp = get_frame_register_unsigned (frame, ARM_SP_REGNUM);
 
   if (tdep->have_sec_ext)
     {