Blame SOURCES/gdb-rhbz1105165-ibm-tdb-support-system-z-7of9.patch

7b26da
From e5a9158d093d53f2bb1057359ac381dcdf6d4305 Mon Sep 17 00:00:00 2001
7b26da
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
7b26da
Date: Fri, 12 Dec 2014 14:14:21 +0100
7b26da
Subject: [PATCH 9/9] S390: Fix gdbserver support for TDB
7b26da
7b26da
This makes gdbserver actually provide values for the TDB registers
7b26da
when the inferior was stopped in a transaction.  The change in
7b26da
linux-low.c is needed to suppress the warning for an unavailable TDB.
7b26da
7b26da
The test case 's390-tdbregs.exp' passes with this patch and fails
7b26da
without.
7b26da
7b26da
gdb/gdbserver/ChangeLog:
7b26da
7b26da
	* linux-low.c (regsets_fetch_inferior_registers): Suppress the
7b26da
	warning upon ENODATA from ptrace.
7b26da
	* linux-s390-low.c (s390_store_tdb): New.
7b26da
	(s390_regsets): Add regset for NT_S390_TDB.
7b26da
---
7b26da
 gdb/gdbserver/ChangeLog        |  7 +++++++
7b26da
 gdb/gdbserver/linux-low.c      |  6 ++++++
7b26da
 gdb/gdbserver/linux-s390-low.c | 17 +++++++++++++++++
7b26da
 3 files changed, 30 insertions(+)
7b26da
7b26da
Index: gdb-7.6.1/gdb/gdbserver/linux-low.c
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/gdbserver/linux-low.c
7b26da
+++ gdb-7.6.1/gdb/gdbserver/linux-low.c
7b26da
@@ -4183,6 +4183,12 @@ regsets_store_inferior_registers (struct
7b26da
 	      free (buf);
7b26da
 	      return 0;
7b26da
 	    }
7b26da
+	  else if (errno == ENODATA)
7b26da
+	    {
7b26da
+	      /* ENODATA may be returned if the regset is currently
7b26da
+		 not "active".  This can happen in normal operation,
7b26da
+		 so suppress the warning in this case.  */
7b26da
+	    }
7b26da
 	  else
7b26da
 	    {
7b26da
 	      perror ("Warning: ptrace(regsets_store_inferior_registers)");
7b26da
Index: gdb-7.6.1/gdb/gdbserver/linux-s390-low.c
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/gdbserver/linux-s390-low.c
7b26da
+++ gdb-7.6.1/gdb/gdbserver/linux-s390-low.c
7b26da
@@ -282,6 +282,20 @@ s390_store_system_call (struct regcache
7b26da
   supply_register_by_name (regcache, "system_call", buf);
7b26da
 }
7b26da
 
7b26da
+static void
7b26da
+s390_store_tdb (struct regcache *regcache, const void *buf)
7b26da
+{
7b26da
+  int tdb0 = find_regno ("tdb0");
7b26da
+  int tr0 = find_regno ("tr0");
7b26da
+  int i;
7b26da
+
7b26da
+  for (i = 0; i < 4; i++)
7b26da
+    supply_register (regcache, tdb0 + i, (const char *) buf + 8 * i);
7b26da
+
7b26da
+  for (i = 0; i < 16; i++)
7b26da
+    supply_register (regcache, tr0 + i, (const char *) buf + 8 * (16 + i));
7b26da
+}
7b26da
+
7b26da
 struct regset_info target_regsets[] = {
7b26da
   { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
7b26da
   /* Last break address is read-only; no fill function.  */
7b26da
@@ -289,6 +303,9 @@ struct regset_info target_regsets[] = {
7b26da
     NULL, s390_store_last_break },
7b26da
   { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_SYSTEM_CALL, 0,
7b26da
     EXTENDED_REGS, s390_fill_system_call, s390_store_system_call },
7b26da
+  /* TDB is read-only.  */
7b26da
+  { PTRACE_GETREGSET, -1, NT_S390_TDB, 0, EXTENDED_REGS,
7b26da
+    NULL, s390_store_tdb },
7b26da
   { 0, 0, 0, -1, -1, NULL, NULL }
7b26da
 };
7b26da