[Bug gdb/28549] ARM/Cortex-M: improper stack unwinding when the target is in lockup state

luis.machado at arm dot com sourceware-bugzilla@sourceware.org
Mon Sep 12 09:32:04 GMT 2022


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

--- Comment #41 from Luis Machado <luis.machado at arm dot com> ---
Hi Tomas,

You can refer to https://sourceware.org/gdb/wiki/ContributionChecklist for some
information on how to contribute. You'll need a FSF copyright assignment in
place to be able to contribute non-trivial changes. Do you have one?

As for the change, here's what git shows for that commit:

@@ -695,28 +730,43 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR
memaddr)
    0xFFFFFFBC    Return to Thread mode using the process stack.  */

 static int
-arm_m_addr_is_magic (CORE_ADDR addr)
-{
-  switch (addr)
-    {
-      /* Values from ARMv8-M Architecture Technical Reference.  */
-      case 0xffffffb0:
-      case 0xffffffb8:
-      case 0xffffffbc:
-      /* Values from Tables in B1.5.8 the EXC_RETURN definitions of
-        the exception return behavior.  */
-      case 0xffffffe1:
-      case 0xffffffe9:
-      case 0xffffffed:
-      case 0xfffffff1:
-      case 0xfffffff9:
-      case 0xfffffffd:
-       /* Address is magic.  */
-       return 1;
+arm_m_addr_is_magic (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+  if (tdep->have_sec_ext)
+    {
+      switch ((addr & 0xff000000))
+       {
+       case 0xff000000: /* EXC_RETURN pattern.  */
+       case 0xfe000000: /* FNC_RETURN pattern.  */
+         return 1;
+       default:
+         return 0;
+       }
+    }
+  else
+    {
+      switch (addr)
+       {
+         /* Values from ARMv8-M Architecture Technical Reference.  */
+       case 0xffffffb0:
+       case 0xffffffb8:
+       case 0xffffffbc:
+         /* Values from Tables in B1.5.8 the EXC_RETURN definitions of
+            the exception return behavior.  */
+       case 0xffffffe1:
+       case 0xffffffe9:
+       case 0xffffffed:
+       case 0xfffffff1:
+       case 0xfffffff9:
+       case 0xfffffffd:
+         /* Address is magic.  */
+         return 1;

-      default:
-       /* Address is not magic.  */
-       return 0;
+       default:
+         /* Address is not magic.  */
+         return 0;
+       }
     }
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list