gdb/arm: Include FType bit in EXC_RETURN pattern on v8m

Message ID 20221123114725.2459115-1-torbjorn.svensson@foss.st.com
State New
Headers
Series gdb/arm: Include FType bit in EXC_RETURN pattern on v8m |

Commit Message

Torbjorn SVENSSON Nov. 23, 2022, 11:47 a.m. UTC
  For v8m, the EXC_RETURN pattern, without security extension, consists of
FType, Mode and SPSEL.  These are the same bits that are used in v7m.
This patch extends the list of patterns to include also the FType bit
and not just Mode and SPSEL bits for v8m targets without security
extension.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
 gdb/arm-tdep.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
  

Comments

Luis Machado Nov. 23, 2022, 11:56 a.m. UTC | #1
Hi Torbjörn,

Thanks for the patch.

On 11/23/22 11:47, Torbjörn SVENSSON wrote:
> For v8m, the EXC_RETURN pattern, without security extension, consists of
> FType, Mode and SPSEL.  These are the same bits that are used in v7m.
> This patch extends the list of patterns to include also the FType bit
> and not just Mode and SPSEL bits for v8m targets without security
> extension.
> 
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> ---
>   gdb/arm-tdep.c | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index a839f957440..742b8e1f64b 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -834,7 +834,19 @@ arm_m_addr_is_lockup (CORE_ADDR addr)
>      EXC_RETURN    Condition
>      0xFFFFFFB0    Return to Handler mode.
>      0xFFFFFFB8    Return to Thread mode using the main stack.
> -   0xFFFFFFBC    Return to Thread mode using the process stack.  */
> +   0xFFFFFFBC    Return to Thread mode using the process stack.
> +
> +   The above list is incomplete as it does not include the FType bit.  The
> +   complete list for ARMv8-M is:

I'd just add the missing entries to the list, therefore making the list complete, update the existing
entries like you did and mention we need to consider the FType bit for v8-m.

> +
> +   EXC_RETURN    Condition
> +   0xFFFFFFA0    Return to Handler mode, standard frame.
> +   0xFFFFFFA8    Return to Thread mode using the main stack, standard frame.
> +   0xFFFFFFAC    Return to Thread mode using the process stack, standard frame.
> +   0xFFFFFFB0    Return to Handler mode, extended frame.
> +   0xFFFFFFB8    Return to Thread mode using the main stack, extended frame.
> +   0xFFFFFFBC    Return to Thread mode using the process stack, extended frame.
> +   */
>   
>   static int
>   arm_m_addr_is_magic (struct gdbarch *gdbarch, CORE_ADDR addr)
> @@ -859,6 +871,9 @@ arm_m_addr_is_magic (struct gdbarch *gdbarch, CORE_ADDR addr)
>         switch (addr)
>   	{
>   	  /* Values from ARMv8-M Architecture Technical Reference.  */
> +	case 0xffffffa0:
> +	case 0xffffffa8:
> +	case 0xffffffac:
>   	case 0xffffffb0:
>   	case 0xffffffb8:
>   	case 0xffffffbc:

With the comment update, this is OK.
  

Patch

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index a839f957440..742b8e1f64b 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -834,7 +834,19 @@  arm_m_addr_is_lockup (CORE_ADDR addr)
    EXC_RETURN    Condition
    0xFFFFFFB0    Return to Handler mode.
    0xFFFFFFB8    Return to Thread mode using the main stack.
-   0xFFFFFFBC    Return to Thread mode using the process stack.  */
+   0xFFFFFFBC    Return to Thread mode using the process stack.
+
+   The above list is incomplete as it does not include the FType bit.  The
+   complete list for ARMv8-M is:
+
+   EXC_RETURN    Condition
+   0xFFFFFFA0    Return to Handler mode, standard frame.
+   0xFFFFFFA8    Return to Thread mode using the main stack, standard frame.
+   0xFFFFFFAC    Return to Thread mode using the process stack, standard frame.
+   0xFFFFFFB0    Return to Handler mode, extended frame.
+   0xFFFFFFB8    Return to Thread mode using the main stack, extended frame.
+   0xFFFFFFBC    Return to Thread mode using the process stack, extended frame.
+   */
 
 static int
 arm_m_addr_is_magic (struct gdbarch *gdbarch, CORE_ADDR addr)
@@ -859,6 +871,9 @@  arm_m_addr_is_magic (struct gdbarch *gdbarch, CORE_ADDR addr)
       switch (addr)
 	{
 	  /* Values from ARMv8-M Architecture Technical Reference.  */
+	case 0xffffffa0:
+	case 0xffffffa8:
+	case 0xffffffac:
 	case 0xffffffb0:
 	case 0xffffffb8:
 	case 0xffffffbc: