]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/arm-tdep.c
gdb/arm: Track msp and psp
authorYvan Roux <yvan.roux@foss.st.com>
Wed, 15 Jun 2022 14:01:46 +0000 (16:01 +0200)
committerYvan Roux <yvan.roux@foss.st.com>
Wed, 15 Jun 2022 14:01:46 +0000 (16:01 +0200)
commit0d12d61b9a646f317d9793492971c9a28f83b754
treea763455a2e54b482b32303931f05a331175e3856
parentfe642a5b1411502000af9d169122522065dff9ca
gdb/arm: Track msp and psp

For Arm Cortex-M33 with security extensions, there are 4 different
stack pointers (msp_s, msp_ns, psp_s, psp_ns).  To be compatible
with earlier Cortex-M derivates, the msp and psp registers are
aliases for one of the 4 real stack pointer registers.

These are the combinations that exist:
sp -> msp -> msp_s
sp -> msp -> msp_ns
sp -> psp -> psp_s
sp -> psp -> psp_ns

This means that when the GDB client is to show the value of "msp",
the value should always be equal to either "msp_s" or "msp_ns".
Same goes for "psp".

To add a bit more context; GDB does not really use the register msp
(or psp) internally, but they are part of the set of registers which
are provided by the target.xml file.  As a result, they will be part
of the set of registers printed by the "info r" command.

Without this particular patch, GDB will hit the assert in the bottom
of arm_cache_get_sp_register function.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29121

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