Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v4 4/4] S390: Fix gdbserver support for TDB
Date: Fri, 12 Dec 2014 10:19:00 -0000	[thread overview]
Message-ID: <1418379431-14407-5-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1418379431-14407-1-git-send-email-arnez@linux.vnet.ibm.com>

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 }
 };
 
-- 
1.8.4.2


  parent reply	other threads:[~2014-12-12 10:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 10:17 [PATCH v4 0/4] gdbserver: Fix support for S390 TDB Andreas Arnez
2014-12-12 10:17 ` [PATCH v4 1/4] gdbserver: Rephrase loops in regsets_fetch/store_inferior_registers Andreas Arnez
2014-12-12 12:04   ` Pedro Alves
2014-12-12 10:18 ` [PATCH v4 3/4] gdbserver: Support read-only regsets in linux-low.c Andreas Arnez
2014-12-12 12:21   ` Pedro Alves
2014-12-12 10:18 ` [PATCH v4 2/4] gdbserver: Prevent stale/random values in register cache Andreas Arnez
2014-12-12 12:14   ` Pedro Alves
2014-12-12 10:19 ` Andreas Arnez [this message]
2014-12-12 12:23   ` [PATCH v4 4/4] S390: Fix gdbserver support for TDB Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418379431-14407-5-git-send-email-arnez@linux.vnet.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox