From patchwork Tue Jul 22 16:21:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 34106 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 66D1A20672 for ; Tue, 22 Jul 2014 16:28:27 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf65138977pac.3 for ; Tue, 22 Jul 2014 09:28:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:x-original-sender:x-original-authentication-results; bh=aYBKqueYxVidx5djsuXgtfoHR/aZbLOvVeoM00EEDkc=; b=MN9s2YtWAOrsWtj3FU1o0XmFUEKBvv/iPYJpgx3Plmc5KMAt+s+xN5CzqzholggB+D VmCwi2x09c2pEL7v3TQc7zTwTUqOhwMG1cewfVepKRSfVrovhe2Oq6rQ0aD3fJcBEB1R Oey2OZMyNbM2QqWqR541IGiObIJ3apq8Gph1rLxWcsl/b3wTnVHUron9eYppE8sw+YEP Hi17LrqM3ahPKDHB9FjG/10n+mxLFc6hKRE6UqMBo7Y6KfqVrurjwX1fbANRamdQwt7q x/CqZxd1LSNfbB3cn5o1hkrcLagVCBD23PI2kuoe1gN6EpLBXZVGIm1hJi+8iAhePgH6 MqfQ== X-Gm-Message-State: ALoCoQnZYSJxO6HV67E1AXybbIljhKxEXSfj9Yj6spPqWsBmIJKnExLfvUxmMCXxA8dNeTOE/n83 X-Received: by 10.70.123.3 with SMTP id lw3mr267493pdb.3.1406046158839; Tue, 22 Jul 2014 09:22:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.55 with SMTP id a52ls2397839qga.14.gmail; Tue, 22 Jul 2014 09:22:38 -0700 (PDT) X-Received: by 10.221.26.71 with SMTP id rl7mr14663255vcb.69.1406046158666; Tue, 22 Jul 2014 09:22:38 -0700 (PDT) Received: from mail-vc0-x232.google.com (mail-vc0-x232.google.com [2607:f8b0:400c:c03::232]) by mx.google.com with ESMTPS id mx3si1551754vcb.63.2014.07.22.09.22.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jul 2014 09:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::232 as permitted sender) client-ip=2607:f8b0:400c:c03::232; Received: by mail-vc0-f178.google.com with SMTP id la4so15526342vcb.9 for ; Tue, 22 Jul 2014 09:22:37 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr5065051vdb.27.1406046157463; Tue, 22 Jul 2014 09:22:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp209296vcb; Tue, 22 Jul 2014 09:22:37 -0700 (PDT) X-Received: by 10.68.57.140 with SMTP id i12mr24512645pbq.44.1406046156634; Tue, 22 Jul 2014 09:22:36 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v4si462223pdc.397.2014.07.22.09.22.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jul 2014 09:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-return-114448-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 9456 invoked by alias); 22 Jul 2014 16:22:30 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 9447 invoked by uid 89); 22 Jul 2014 16:22:29 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f172.google.com Received: from mail-wi0-f172.google.com (HELO mail-wi0-f172.google.com) (209.85.212.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 22 Jul 2014 16:22:28 +0000 Received: by mail-wi0-f172.google.com with SMTP id n3so6295779wiv.5 for ; Tue, 22 Jul 2014 09:22:23 -0700 (PDT) X-Received: by 10.180.75.49 with SMTP id z17mr15946124wiv.80.1406046143278; Tue, 22 Jul 2014 09:22:23 -0700 (PDT) Received: from localhost.localdomain ([213.122.173.130]) by mx.google.com with ESMTPSA id gd13sm55456687wic.6.2014.07.22.09.22.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jul 2014 09:22:22 -0700 (PDT) From: Will Newton To: gdb-patches@sourceware.org Subject: [PATCH] gdb/arm-linux-tdep.c: Handle Thumb signal trampolines Date: Tue, 22 Jul 2014 17:21:58 +0100 Message-Id: <1406046118-3127-1-git-send-email-will.newton@linaro.org> X-IsSubscribed: yes X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::232 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 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. gdb/ChangeLog: 2014-07-22 Will Newton * arm-linux-tdep.c (THUMB2_SET_R7_SIGRETURN1): New define. (THUMB2_SET_R7_SIGRETURN2): Likewise. (THUMB2_SET_R7_RT_SIGRETURN1): Likewise. (THUMB2_SET_R7_RT_SIGRETURN2): Likewise. (THUMB2_EABI_SYSCALL): Likewise. (thumb2_eabi_linux_sigreturn_tramp_frame): Create new struct tramp_frame. (thumb2_eabi_linux_rt_sigreturn_tramp_frame): Likewise. (arm_linux_init_abi): Add Thumb2 tramp frame unwinders. --- gdb/arm-linux-tdep.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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);