Message ID | 1406046118-3127-1-git-send-email-will.newton@linaro.org |
---|---|
State | Accepted |
Headers | show |
On 07/22/2014 05:21 PM, Will Newton wrote: > Recent versions of glibc have assembled the signal trampoline code > as Thumb, which causes gdb to misinterpret them and a number of > testsuite tests to fail. Educate gdb about these trampolines and > get the tests running again. For a moment you had me! The subject/intro made me believe you were talking about Thumb 1. Could you update them to mention "Thumb 2" explicitly, when you push this in? This looks good to me. Tiny nit below. > @@ -246,6 +246,12 @@ static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa > #define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad > #define ARM_EABI_SYSCALL 0xef000000 > Could you add a comment here? Like: /* Likewise for Thumb 2. */ ( Feel free to expand if it makes sense. :-) ) > +#define THUMB2_SET_R7_SIGRETURN1 0xf04f > +#define THUMB2_SET_R7_SIGRETURN2 0x0777 > +#define THUMB2_SET_R7_RT_SIGRETURN1 0xf04f > +#define THUMB2_SET_R7_RT_SIGRETURN2 0x07ad > +#define THUMB2_EABI_SYSCALL 0xdf00 Thanks, Pedro Alves
On 24 July 2014 02:17, Pedro Alves <palves@redhat.com> wrote: > On 07/22/2014 05:21 PM, Will Newton wrote: >> Recent versions of glibc have assembled the signal trampoline code >> as Thumb, which causes gdb to misinterpret them and a number of >> testsuite tests to fail. Educate gdb about these trampolines and >> get the tests running again. > > For a moment you had me! The subject/intro made me believe > you were talking about Thumb 1. Could you update them to > mention "Thumb 2" explicitly, when you push this in? > > This looks good to me. > > Tiny nit below. > >> @@ -246,6 +246,12 @@ static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa >> #define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad >> #define ARM_EABI_SYSCALL 0xef000000 >> > > Could you add a comment here? Like: > > /* Likewise for Thumb 2. */ > > ( Feel free to expand if it makes sense. :-) ) > >> +#define THUMB2_SET_R7_SIGRETURN1 0xf04f >> +#define THUMB2_SET_R7_SIGRETURN2 0x0777 >> +#define THUMB2_SET_R7_RT_SIGRETURN1 0xf04f >> +#define THUMB2_SET_R7_RT_SIGRETURN2 0x07ad >> +#define THUMB2_EABI_SYSCALL 0xdf00 Thanks, pushed with those changes.
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index a96ea3f..54b5dc5 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -246,6 +246,12 @@ static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa #define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad #define ARM_EABI_SYSCALL 0xef000000 +#define THUMB2_SET_R7_SIGRETURN1 0xf04f +#define THUMB2_SET_R7_SIGRETURN2 0x0777 +#define THUMB2_SET_R7_RT_SIGRETURN1 0xf04f +#define THUMB2_SET_R7_RT_SIGRETURN2 0x07ad +#define THUMB2_EABI_SYSCALL 0xdf00 + /* OABI syscall restart trampoline, used for EABI executables too whenever OABI support has been enabled in the kernel. */ #define ARM_OABI_SYSCALL_RESTART_SYSCALL 0xef900000 @@ -444,6 +450,30 @@ static struct tramp_frame arm_eabi_linux_rt_sigreturn_tramp_frame = { arm_linux_rt_sigreturn_init }; +static struct tramp_frame thumb2_eabi_linux_sigreturn_tramp_frame = { + SIGTRAMP_FRAME, + 2, + { + { THUMB2_SET_R7_SIGRETURN1, -1 }, + { THUMB2_SET_R7_SIGRETURN2, -1 }, + { THUMB2_EABI_SYSCALL, -1 }, + { TRAMP_SENTINEL_INSN } + }, + arm_linux_sigreturn_init +}; + +static struct tramp_frame thumb2_eabi_linux_rt_sigreturn_tramp_frame = { + SIGTRAMP_FRAME, + 2, + { + { THUMB2_SET_R7_RT_SIGRETURN1, -1 }, + { THUMB2_SET_R7_RT_SIGRETURN2, -1 }, + { THUMB2_EABI_SYSCALL, -1 }, + { TRAMP_SENTINEL_INSN } + }, + arm_linux_rt_sigreturn_init +}; + static struct tramp_frame arm_linux_restart_syscall_tramp_frame = { NORMAL_FRAME, 4, @@ -1416,6 +1446,10 @@ arm_linux_init_abi (struct gdbarch_info info, tramp_frame_prepend_unwinder (gdbarch, &arm_eabi_linux_rt_sigreturn_tramp_frame); tramp_frame_prepend_unwinder (gdbarch, + &thumb2_eabi_linux_sigreturn_tramp_frame); + tramp_frame_prepend_unwinder (gdbarch, + &thumb2_eabi_linux_rt_sigreturn_tramp_frame); + tramp_frame_prepend_unwinder (gdbarch, &arm_linux_restart_syscall_tramp_frame); tramp_frame_prepend_unwinder (gdbarch, &arm_kernel_linux_restart_syscall_tramp_frame);