From patchwork Thu May 28 14:20:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 6953 Received: (qmail 106237 invoked by alias); 28 May 2015 14:20:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk 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 106145 invoked by uid 89); 28 May 2015 14:20:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f169.google.com Received: from mail-pd0-f169.google.com (HELO mail-pd0-f169.google.com) (209.85.192.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 28 May 2015 14:20:28 +0000 Received: by pdbki1 with SMTP id ki1so42933617pdb.1 for ; Thu, 28 May 2015 07:20:26 -0700 (PDT) X-Received: by 10.66.65.200 with SMTP id z8mr422187pas.16.1432822826571; Thu, 28 May 2015 07:20:26 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id dd3sm2587101pad.45.2015.05.28.07.20.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 May 2015 07:20:25 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 3/6] Check whether kernel supports PTRACE_GETREGSET Date: Thu, 28 May 2015 15:20:13 +0100 Message-Id: <1432822816-32327-4-git-send-email-yao.qi@linaro.org> In-Reply-To: <1432822816-32327-1-git-send-email-yao.qi@linaro.org> References: <1432822816-32327-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes gdb: 2015-05-28 Yao Qi * arm-linux-nat.c (arm_linux_read_description): Check whether kernel supports PTRACE_GETREGSET. --- gdb/arm-linux-nat.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 7352841..877559e 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -634,6 +634,22 @@ arm_linux_read_description (struct target_ops *ops) { CORE_ADDR arm_hwcap = 0; + if (have_ptrace_getregset == -1) + { + elf_gregset_t gpregs; + struct iovec iov; + int tid = GET_THREAD_ID (inferior_ptid); + + iov.iov_base = &gpregs; + iov.iov_len = sizeof (gpregs); + + /* Check if PTRACE_GETREGSET works. */ + if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov) < 0) + have_ptrace_getregset = 0; + else + have_ptrace_getregset = 1; + } + if (target_auxv_search (ops, AT_HWCAP, &arm_hwcap) != 1) { return ops->beneath->to_read_description (ops->beneath);