From patchwork Fri Dec 12 10:16:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 4213 Received: (qmail 30159 invoked by alias); 12 Dec 2014 10:19:24 -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 30148 invoked by uid 89); 12 Dec 2014 10:19:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp14.uk.ibm.com Received: from e06smtp14.uk.ibm.com (HELO e06smtp14.uk.ibm.com) (195.75.94.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Dec 2014 10:19:22 +0000 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Dec 2014 10:19:19 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 12 Dec 2014 10:19:16 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id D751C219005C for ; Fri, 12 Dec 2014 10:18:46 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBCAJFC261276356 for ; Fri, 12 Dec 2014 10:19:15 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBCAJFI2013802 for ; Fri, 12 Dec 2014 03:19:15 -0700 Received: from br87z6lw.boeblingen.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sBCAHDYC008771 for ; Fri, 12 Dec 2014 03:19:15 -0700 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH v4 4/4] S390: Fix gdbserver support for TDB Date: Fri, 12 Dec 2014 11:16:41 +0100 Message-Id: <1418379431-14407-5-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1418379431-14407-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1418379431-14407-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14121210-0017-0000-0000-000002333DE3 X-IsSubscribed: yes This makes gdbserver actually provide values for the TDB registers when the inferior was stopped in a transaction. The change in linux-low.c is needed to suppress the warning for an unavailable TDB. The test case 's390-tdbregs.exp' passes with this patch and fails without. gdb/gdbserver/ChangeLog: * linux-low.c (regsets_fetch_inferior_registers): Suppress the warning upon ENODATA from ptrace. * linux-s390-low.c (s390_store_tdb): New. (s390_regsets): Add regset for NT_S390_TDB. --- gdb/gdbserver/linux-low.c | 6 ++++++ gdb/gdbserver/linux-s390-low.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 5f62010..5ea9200 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4256,6 +4256,12 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info, this process mode. */ disable_regset (regsets_info, regset); } + else if (errno == ENODATA) + { + /* ENODATA may be returned if the regset is currently + not "active". This can happen in normal operation, + so suppress the warning in this case. */ + } else { char s[256]; diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c index 9f77f30..40fb61c 100644 --- a/gdb/gdbserver/linux-s390-low.c +++ b/gdb/gdbserver/linux-s390-low.c @@ -310,6 +310,20 @@ s390_store_system_call (struct regcache *regcache, const void *buf) supply_register_by_name (regcache, "system_call", buf); } +static void +s390_store_tdb (struct regcache *regcache, const void *buf) +{ + int tdb0 = find_regno (regcache->tdesc, "tdb0"); + int tr0 = find_regno (regcache->tdesc, "tr0"); + int i; + + for (i = 0; i < 4; i++) + supply_register (regcache, tdb0 + i, (const char *) buf + 8 * i); + + for (i = 0; i < 16; i++) + supply_register (regcache, tr0 + i, (const char *) buf + 8 * (16 + i)); +} + static struct regset_info s390_regsets[] = { { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL }, /* Last break address is read-only; no fill function. */ @@ -317,6 +331,9 @@ static struct regset_info s390_regsets[] = { NULL, s390_store_last_break }, { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_SYSTEM_CALL, 0, EXTENDED_REGS, s390_fill_system_call, s390_store_system_call }, + /* TDB is read-only. */ + { PTRACE_GETREGSET, -1, NT_S390_TDB, 0, EXTENDED_REGS, + NULL, s390_store_tdb }, { 0, 0, 0, -1, -1, NULL, NULL } };