]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ARM/FDPIC: Add support to unwind thumb2 signal trampoline
authorChristophe Lyon <christophe.lyon@linaro.org>
Wed, 14 Apr 2021 14:22:44 +0000 (14:22 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Wed, 14 Apr 2021 14:22:44 +0000 (14:22 +0000)
2021-04-14  Mickael Guene  <mickael.guene@st.com>
Christophe Lyon  <christophe.lyon@st.com>

* gdb/arm-linux-tdep.c (FDPIC_T2_LDR_R12_WITH_FUNCDESC): New
define.
(FDPIC_T2_LDR_R9_WITH_GOT): New define.
(FDPIC_T2_LDR_PC_WITH_RESTORER): New define.
(arm_linux_thumb2_sigreturn_tramp_frame_fdpic): New.
(arm_linux_init_abi): Add thumb2 signal handler.

gdb/arm-linux-tdep.c

index 3da10112eb57555c474662862769d6c6959f1d70..4ec4561cf72e134121eacd517c376e2cb638226b 100644 (file)
@@ -257,6 +257,10 @@ static const char arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa0 };
 #define FDPIC_LDR_R9_WITH_GOT          0xe59c9004
 #define FDPIC_LDR_PC_WITH_RESTORER     0xe59cf000
 
+#define FDPIC_T2_LDR_R12_WITH_FUNCDESC  0xc008f8df
+#define FDPIC_T2_LDR_R9_WITH_GOT       0x9004f8dc
+#define FDPIC_T2_LDR_PC_WITH_RESTORER   0xf000f8dc
+
 static void
 arm_linux_sigtramp_cache (struct frame_info *this_frame,
                          struct trad_frame_cache *this_cache,
@@ -511,6 +515,18 @@ static struct tramp_frame arm_linux_sigreturn_tramp_frame_fdpic = {
   arm_linux_sigreturn_fdpic_init
 };
 
+static struct tramp_frame arm_linux_thumb2_sigreturn_tramp_frame_fdpic = {
+  SIGTRAMP_FRAME,
+  4,
+  {
+    { FDPIC_T2_LDR_R12_WITH_FUNCDESC, -1 },
+    { FDPIC_T2_LDR_R9_WITH_GOT, -1 },
+    { FDPIC_T2_LDR_PC_WITH_RESTORER, -1 },
+    { TRAMP_SENTINEL_INSN }
+  },
+  arm_linux_sigreturn_fdpic_init
+};
+
 /* Core file and register set support.  */
 
 #define ARM_LINUX_SIZEOF_GREGSET (18 * INT_REGISTER_SIZE)
@@ -1312,6 +1328,8 @@ arm_linux_init_abi (struct gdbarch_info info,
                                &arm_kernel_linux_restart_syscall_tramp_frame);
   tramp_frame_prepend_unwinder (gdbarch,
                                &arm_linux_sigreturn_tramp_frame_fdpic);
+  tramp_frame_prepend_unwinder (gdbarch,
+                               &arm_linux_thumb2_sigreturn_tramp_frame_fdpic);
 
   /* Core file support.  */
   set_gdbarch_regset_from_core_section (gdbarch,