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

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