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

7b26da
From 4ac33720d6022079e8b038e795e40f0e06a4012c Mon Sep 17 00:00:00 2001
7b26da
From: Ulrich Weigand <uweigand@de.ibm.com>
7b26da
Date: Fri, 13 Sep 2013 14:17:31 +0000
7b26da
Subject: [PATCH 3/3] gdb/ChangeLog: 2013-09-13  Andreas Arnez 
7b26da
 <arnez@linux.vnet.ibm.com>
7b26da
7b26da
	* NEWS: Mention TDB support.
7b26da
	* features/s390-tdb.xml: New file.
7b26da
	* features/s390-te-linux64.xml: New file.
7b26da
	* features/s390x-te-linux64.xml: New file.
7b26da
	* features/Makefile (WHICH): Add new tdescs above.
7b26da
	(s390-te-linux64-expedite): Set.
7b26da
	(s390x-te-linux64-expedite): Set.
7b26da
	* features/s390-te-linux64.c: New file (generated).
7b26da
	* features/s390x-te-linux64.c: New file (generated).
7b26da
	* regformats/s390-te-linux64.dat: New file (generated).
7b26da
	* regformats/s390x-te-linux64.dat: New file (generated).
7b26da
	* s390-tdep.h (HWCAP_S390_HIGH_GPRS): Define.
7b26da
	(HWCAP_S390_TE): Likewise.
7b26da
	(S390_TDB_DWORD0_REGNUM): Likewise.
7b26da
	(S390_TDB_DWORD0_REGNUM): Likewise.
7b26da
	(S390_TDB_ABORT_CODE_REGNUM): Likewise.
7b26da
	(S390_TDB_CONFLICT_TOKEN_REGNUM): Likewise.
7b26da
	(S390_TDB_ATIA_REGNUM): Likewise.
7b26da
	(S390_TDB_R0_REGNUM): Likewise.
7b26da
	(S390_TDB_R1_REGNUM): Likewise.
7b26da
	(S390_TDB_R2_REGNUM): Likewise.
7b26da
	(S390_TDB_R3_REGNUM): Likewise.
7b26da
	(S390_TDB_R4_REGNUM): Likewise.
7b26da
	(S390_TDB_R5_REGNUM): Likewise.
7b26da
	(S390_TDB_R6_REGNUM): Likewise.
7b26da
	(S390_TDB_R7_REGNUM): Likewise.
7b26da
	(S390_TDB_R8_REGNUM): Likewise.
7b26da
	(S390_TDB_R9_REGNUM): Likewise.
7b26da
	(S390_TDB_R10_REGNUM): Likewise.
7b26da
	(S390_TDB_R11_REGNUM): Likewise.
7b26da
	(S390_TDB_R12_REGNUM): Likewise.
7b26da
	(S390_TDB_R13_REGNUM): Likewise.
7b26da
	(S390_TDB_R14_REGNUM): Likewise.
7b26da
	(S390_TDB_R15_REGNUM): Likewise.
7b26da
	(S390_NUM_REGS): Increase.
7b26da
	(S390_IS_TDBREGSET_REGNUM): New macro.
7b26da
	(s390_regmap_tdb): Declare.
7b26da
	(s390_sizeof_tdbregset): Define.
7b26da
	(tdesc_s390_te_linux64): Declare.
7b26da
	(tdesc_s390x_te_linux64): Likewise.
7b26da
	* s390-tdep.c: Add includes for "auxv.h", <elf.h>,
7b26da
	"features/s390-te-linux64.c", and "features/s390x-te-linux64.c".
7b26da
	(s390_regmap_tdb): New regmap.
7b26da
	(s390_supply_tdb_regset): New function.
7b26da
	(s390_tdb_regset): New regset.
7b26da
	(s390_linux64v2_regset_sections): Add TDB regset to list.
7b26da
	(s390x_linux64v2_regset_sections): Likewise.
7b26da
	(s390_regset_from_core_section): Recognize TDB core note section.
7b26da
	(s390_core_read_description): If HWCAP indicates TE support,
7b26da
	select tdesc_s390_te_linux64 or tdesc_s390_s390x_te_linux64.
7b26da
	(s390_gdbarch_init): Handle TDB regset.
7b26da
	(_initialize_s390_tdep): Initialize new tdescs.
7b26da
	* s390-nat.c (HWCAP_S390_HIGH_GPRS): Remove define.
7b26da
	(have_regset_tdb): New variable.
7b26da
	(s390_native_supply): Support register invalidation.
7b26da
	(fetch_regset): Invalidate registers if ptrace yields ENODATA.
7b26da
	(check_regset): Treat ENODATA as "regset exists".
7b26da
	(s390_linux_fetch_inferior_registers): Add TDB.
7b26da
	(s390_read_description): Check for TDB existence and select
7b26da
	appropriate tdesc.
7b26da
	* gdbserver/Makefile.in (clean): Add removal of new makefile
7b26da
	targets.
7b26da
	(s390-te-linux64.c): New makefile target.
7b26da
	(s390x-te-linux64.c): Likewise.
7b26da
	* gdbserver/configure.srv (srv_regobj): Append new objects
7b26da
	s390-te-linux64.o and s390x-te-linux64.o.
7b26da
	(srv_xmlfiles): Append new files s390-te-linux64.xml,
7b26da
	s390x-te-linux64.xml, and s390-tdb.xml.
7b26da
	* gdbserver/linux-s390-low.c (init_registers_s390_te_linux64): New
7b26da
	declaration.
7b26da
	(tdesc_s390_te_linux64): Likewise.
7b26da
	(init_registers_s390x_te_linux64): Likewise.
7b26da
	(tdesc_s390x_te_linux64): Likewise.
7b26da
	(s390_check_regset): Treat ENODATA as "regset exists".
7b26da
	(s390_arch_setup): Add TDB regset support.
7b26da
	(initialize_low_arch): Initialize registers for new tdescs.
7b26da
7b26da
gdb/doc/ChangeLog:
7b26da
2013-09-13  Andreas Arnez  <arnez@linux.vnet.ibm.com>
7b26da
7b26da
	* gdb.texinfo (Decimal Floating Point format): Mention S/390.
7b26da
	(Standard Target Features): Add new node to menu.
7b26da
	(S/390 and System z Features): New node.
7b26da
7b26da
gdb/testsuite/ChangeLog:
7b26da
2013-09-13  Andreas Arnez  <arnez@linux.vnet.ibm.com>
7b26da
7b26da
	* gdb.arch/s390-tdbregs.c: New file.
7b26da
	* gdb.arch/s390-tdbregs.exp: New file.
7b26da
---
7b26da
 gdb/ChangeLog                           |  79 +++++++++++++++++++++
7b26da
 gdb/NEWS                                |   4 ++
7b26da
 gdb/doc/ChangeLog                       |   6 ++
7b26da
 gdb/doc/gdb.texinfo                     |  38 +++++++++-
7b26da
 gdb/features/Makefile                   |   3 +
7b26da
 gdb/features/s390-tdb.xml               |  30 ++++++++
7b26da
 gdb/features/s390-te-linux64.c          | 118 ++++++++++++++++++++++++++++++++
7b26da
 gdb/features/s390-te-linux64.xml        |  25 +++++++
7b26da
 gdb/features/s390x-te-linux64.c         | 102 +++++++++++++++++++++++++++
7b26da
 gdb/features/s390x-te-linux64.xml       |  24 +++++++
7b26da
 gdb/gdbserver/Makefile.in               |   7 ++
7b26da
 gdb/gdbserver/configure.srv             |   5 ++
7b26da
 gdb/gdbserver/linux-s390-low.c          |  25 +++++--
7b26da
 gdb/regformats/s390-te-linux64.dat      |  94 +++++++++++++++++++++++++
7b26da
 gdb/regformats/s390x-te-linux64.dat     |  78 +++++++++++++++++++++
7b26da
 gdb/s390-nat.c                          |  37 ++++++----
7b26da
 gdb/s390-tdep.c                         |  85 ++++++++++++++++++++++-
7b26da
 gdb/s390-tdep.h                         |  40 ++++++++++-
7b26da
 gdb/testsuite/ChangeLog                 |   5 ++
7b26da
 gdb/testsuite/gdb.arch/s390-tdbregs.c   |  64 +++++++++++++++++
7b26da
 gdb/testsuite/gdb.arch/s390-tdbregs.exp |  75 ++++++++++++++++++++
7b26da
 21 files changed, 921 insertions(+), 23 deletions(-)
7b26da
 create mode 100644 gdb/features/s390-tdb.xml
7b26da
 create mode 100644 gdb/features/s390-te-linux64.c
7b26da
 create mode 100644 gdb/features/s390-te-linux64.xml
7b26da
 create mode 100644 gdb/features/s390x-te-linux64.c
7b26da
 create mode 100644 gdb/features/s390x-te-linux64.xml
7b26da
 create mode 100644 gdb/regformats/s390-te-linux64.dat
7b26da
 create mode 100644 gdb/regformats/s390x-te-linux64.dat
7b26da
 create mode 100644 gdb/testsuite/gdb.arch/s390-tdbregs.c
7b26da
 create mode 100644 gdb/testsuite/gdb.arch/s390-tdbregs.exp
7b26da
7b26da
Index: gdb-7.6.1/gdb/NEWS
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/NEWS
7b26da
+++ gdb-7.6.1/gdb/NEWS
7b26da
@@ -14,6 +14,10 @@ add-auto-load-scripts-directory director
7b26da
 
7b26da
   ** Frame filters and frame decorators have been added.
7b26da
 
7b26da
+* On S/390 targets that provide the transactional-execution feature,
7b26da
+  the program interruption transaction diagnostic block (TDB) is now
7b26da
+  represented as a number of additional "registers" in GDB.
7b26da
+
7b26da
 * New remote packets
7b26da
 
7b26da
 qXfer:libraries-svr4:read's annex
7b26da
Index: gdb-7.6.1/gdb/doc/gdb.texinfo
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/doc/gdb.texinfo
7b26da
+++ gdb-7.6.1/gdb/doc/gdb.texinfo
7b26da
@@ -13737,8 +13737,8 @@ specified by the extension to support de
7b26da
 
7b26da
 There are two encodings in use, depending on the architecture: BID (Binary
7b26da
 Integer Decimal) for x86 and x86-64, and DPD (Densely Packed Decimal) for
7b26da
-PowerPC.  @value{GDBN} will use the appropriate encoding for the configured
7b26da
-target.
7b26da
+PowerPC and S/390.  @value{GDBN} will use the appropriate encoding for the
7b26da
+configured target.
7b26da
 
7b26da
 Because of a limitation in @file{libdecnumber}, the library used by @value{GDBN}
7b26da
 to manipulate decimal floating point numbers, it is not possible to convert
7b26da
@@ -42082,6 +42082,7 @@ registers using the capitalization used
7b26da
 * MIPS Features::
7b26da
 * M68K Features::
7b26da
 * PowerPC Features::
7b26da
+* S/390 and System z Features::
7b26da
 * TIC6x Features::
7b26da
 @end menu
7b26da
 
7b26da
@@ -42261,6 +42262,39 @@ contain registers @samp{ev0h} through @s
7b26da
 these to present registers @samp{ev0} through @samp{ev31} to the
7b26da
 user.
7b26da
 
7b26da
+@node S/390 and System z Features
7b26da
+@subsection S/390 and System z Features
7b26da
+@cindex target descriptions, S/390 features
7b26da
+@cindex target descriptions, System z features
7b26da
+
7b26da
+The @samp{org.gnu.gdb.s390.core} feature is required for S/390 and
7b26da
+System z targets.  It should contain the PSW and the 16 general
7b26da
+registers.  In particular, System z targets should provide the 64-bit
7b26da
+registers @samp{pswm}, @samp{pswa}, and @samp{r0} through @samp{r15}.
7b26da
+S/390 targets should provide the 32-bit versions of these registers.
7b26da
+A System z target that runs in 31-bit addressing mode should provide
7b26da
+32-bit versions of @samp{pswm} and @samp{pswa}, as well as the general
7b26da
+register's upper halves @samp{r0h} through @samp{r15h}, and their
7b26da
+lower halves @samp{r0l} through @samp{r15l}.
7b26da
+
7b26da
+The @samp{org.gnu.gdb.s390.fpr} feature is required.  It should
7b26da
+contain the 64-bit registers @samp{f0} through @samp{f15}, and
7b26da
+@samp{fpc}.
7b26da
+
7b26da
+The @samp{org.gnu.gdb.s390.acr} feature is required.  It should
7b26da
+contain the 32-bit registers @samp{acr0} through @samp{acr15}.
7b26da
+
7b26da
+The @samp{org.gnu.gdb.s390.linux} feature is optional.  It should
7b26da
+contain the register @samp{orig_r2}, which is 64-bit wide on System z
7b26da
+targets and 32-bit otherwise.  In addition, the feature may contain
7b26da
+the @samp{last_break} register, whose width depends on the addressing
7b26da
+mode, as well as the @samp{system_call} register, which is always
7b26da
+32-bit wide.
7b26da
+
7b26da
+The @samp{org.gnu.gdb.s390.tdb} feature is optional.  It should
7b26da
+contain the 64-bit registers @samp{tdb0}, @samp{tac}, @samp{tct},
7b26da
+@samp{atia}, and @samp{tr0} through @samp{tr15}.
7b26da
+
7b26da
 @node TIC6x Features
7b26da
 @subsection TMS320C6x Features
7b26da
 @cindex target descriptions, TIC6x features
7b26da
Index: gdb-7.6.1/gdb/features/Makefile
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/features/Makefile
7b26da
+++ gdb-7.6.1/gdb/features/Makefile
7b26da
@@ -49,6 +49,7 @@ WHICH = aarch64 aarch64-without-fpu \
7b26da
 	s390-linux32 s390-linux64 s390x-linux64 \
7b26da
 	s390-linux32v1 s390-linux64v1 s390x-linux64v1 \
7b26da
 	s390-linux32v2 s390-linux64v2 s390x-linux64v2 \
7b26da
+	s390-te-linux64 s390x-te-linux64 \
7b26da
 	tic6x-c64xp tic6x-c64x tic6x-c62x \
7b26da
 	tic6x-c64xp-linux tic6x-c64x-linux tic6x-c62x-linux
7b26da
 
7b26da
@@ -82,9 +83,11 @@ s390-linux32v2-expedite = r14,r15,pswa
7b26da
 s390-linux64-expedite = r14l,r15l,pswa
7b26da
 s390-linux64v1-expedite = r14l,r15l,pswa
7b26da
 s390-linux64v2-expedite = r14l,r15l,pswa
7b26da
+s390-te-linux64-expedite = r14,r15,pswa
7b26da
 s390x-linux64-expedite = r14,r15,pswa
7b26da
 s390x-linux64v1-expedite = r14,r15,pswa
7b26da
 s390x-linux64v2-expedite = r14,r15,pswa
7b26da
+s390x-te-linux64-expedite = r14,r15,pswa
7b26da
 tic6x-c64xp-expedite = A15,PC
7b26da
 tic6x-c64x-expedite = A15,PC
7b26da
 tic6x-c62x-expedite = A15,PC
7b26da
Index: gdb-7.6.1/gdb/features/s390-tdb.xml
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/features/s390-tdb.xml
7b26da
@@ -0,0 +1,30 @@
7b26da
+
7b26da
+
7b26da
+
7b26da
+     Copying and distribution of this file, with or without modification,
7b26da
+     are permitted in any medium without royalty provided the copyright
7b26da
+     notice and this notice are preserved.  -->
7b26da
+
7b26da
+
7b26da
+<feature name="org.gnu.gdb.s390.tdb">
7b26da
+  <reg name="tdb0" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tac" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tct" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="atia" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr0" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr1" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr2" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr3" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr4" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr5" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr6" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr7" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr8" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr9" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr10" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr11" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr12" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr13" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr14" bitsize="64" type="uint64" group="tdb"/>
7b26da
+  <reg name="tr15" bitsize="64" type="uint64" group="tdb"/>
7b26da
+</feature>
7b26da
Index: gdb-7.6.1/gdb/features/s390-te-linux64.c
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/features/s390-te-linux64.c
7b26da
@@ -0,0 +1,118 @@
7b26da
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
7b26da
+  Original: s390-te-linux64.xml */
7b26da
+
7b26da
+#include "defs.h"
7b26da
+#include "osabi.h"
7b26da
+#include "target-descriptions.h"
7b26da
+
7b26da
+struct target_desc *tdesc_s390_te_linux64;
7b26da
+static void
7b26da
+initialize_tdesc_s390_te_linux64 (void)
7b26da
+{
7b26da
+  struct target_desc *result = allocate_target_description ();
7b26da
+  struct tdesc_feature *feature;
7b26da
+
7b26da
+  set_tdesc_architecture (result, bfd_scan_arch ("s390:31-bit"));
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.core");
7b26da
+  tdesc_create_reg (feature, "pswm", 0, 1, "psw", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "pswa", 1, 1, "psw", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r0h", 2, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r0l", 3, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r1h", 4, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r1l", 5, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r2h", 6, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r2l", 7, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r3h", 8, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r3l", 9, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r4h", 10, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r4l", 11, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r5h", 12, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r5l", 13, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r6h", 14, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r6l", 15, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r7h", 16, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r7l", 17, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r8h", 18, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r8l", 19, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r9h", 20, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r9l", 21, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r10h", 22, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r10l", 23, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r11h", 24, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r11l", 25, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r12h", 26, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r12l", 27, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r13h", 28, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r13l", 29, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r14h", 30, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r14l", 31, 1, "lower", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r15h", 32, 1, "upper", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "r15l", 33, 1, "lower", 32, "uint32");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.acr");
7b26da
+  tdesc_create_reg (feature, "acr0", 34, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr1", 35, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr2", 36, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr3", 37, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr4", 38, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr5", 39, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr6", 40, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr7", 41, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr8", 42, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr9", 43, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr10", 44, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr11", 45, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr12", 46, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr13", 47, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr14", 48, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr15", 49, 1, "access", 32, "uint32");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.fpr");
7b26da
+  tdesc_create_reg (feature, "fpc", 50, 1, "float", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "f0", 51, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f1", 52, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f2", 53, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f3", 54, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f4", 55, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f5", 56, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f6", 57, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f7", 58, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f8", 59, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f9", 60, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f10", 61, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f11", 62, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f12", 63, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f13", 64, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f14", 65, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f15", 66, 1, "float", 64, "ieee_double");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.linux");
7b26da
+  tdesc_create_reg (feature, "orig_r2", 67, 1, "system", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "last_break", 68, 0, "system", 32, "code_ptr");
7b26da
+  tdesc_create_reg (feature, "system_call", 69, 1, "system", 32, "uint32");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.tdb");
7b26da
+  tdesc_create_reg (feature, "tdb0", 70, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tac", 71, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tct", 72, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "atia", 73, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr0", 74, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr1", 75, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr2", 76, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr3", 77, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr4", 78, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr5", 79, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr6", 80, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr7", 81, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr8", 82, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr9", 83, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr10", 84, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr11", 85, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr12", 86, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr13", 87, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr14", 88, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr15", 89, 1, "tdb", 64, "uint64");
7b26da
+
7b26da
+  tdesc_s390_te_linux64 = result;
7b26da
+}
7b26da
Index: gdb-7.6.1/gdb/features/s390-te-linux64.xml
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/features/s390-te-linux64.xml
7b26da
@@ -0,0 +1,25 @@
7b26da
+
7b26da
+
7b26da
+
7b26da
+     Copying and distribution of this file, with or without modification,
7b26da
+     are permitted in any medium without royalty provided the copyright
7b26da
+     notice and this notice are preserved.  -->
7b26da
+
7b26da
+
7b26da
+     in z/Architecture mode.  -->
7b26da
+
7b26da
+
7b26da
+<target>
7b26da
+  <architecture>s390:31-bit</architecture>
7b26da
+  <xi:include href="s390-core64.xml"/>
7b26da
+  <xi:include href="s390-acr.xml"/>
7b26da
+  <xi:include href="s390-fpr.xml"/>
7b26da
+
7b26da
+  <feature name="org.gnu.gdb.s390.linux">
7b26da
+    <reg name="orig_r2" bitsize="32" type="uint32" group="system"/>
7b26da
+    <reg name="last_break" bitsize="32" type="code_ptr" group="system" save-restore="no"/>
7b26da
+    <reg name="system_call" bitsize="32" type="uint32" group="system"/>
7b26da
+  </feature>
7b26da
+
7b26da
+  <xi:include href="s390-tdb.xml"/>
7b26da
+</target>
7b26da
Index: gdb-7.6.1/gdb/features/s390x-te-linux64.c
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/features/s390x-te-linux64.c
7b26da
@@ -0,0 +1,102 @@
7b26da
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
7b26da
+  Original: s390x-te-linux64.xml */
7b26da
+
7b26da
+#include "defs.h"
7b26da
+#include "osabi.h"
7b26da
+#include "target-descriptions.h"
7b26da
+
7b26da
+struct target_desc *tdesc_s390x_te_linux64;
7b26da
+static void
7b26da
+initialize_tdesc_s390x_te_linux64 (void)
7b26da
+{
7b26da
+  struct target_desc *result = allocate_target_description ();
7b26da
+  struct tdesc_feature *feature;
7b26da
+
7b26da
+  set_tdesc_architecture (result, bfd_scan_arch ("s390:64-bit"));
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.core");
7b26da
+  tdesc_create_reg (feature, "pswm", 0, 1, "psw", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "pswa", 1, 1, "psw", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r0", 2, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r1", 3, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r2", 4, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r3", 5, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r4", 6, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r5", 7, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r6", 8, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r7", 9, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r8", 10, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r9", 11, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r10", 12, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r11", 13, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r12", 14, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r13", 15, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r14", 16, 1, "general", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "r15", 17, 1, "general", 64, "uint64");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.acr");
7b26da
+  tdesc_create_reg (feature, "acr0", 18, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr1", 19, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr2", 20, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr3", 21, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr4", 22, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr5", 23, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr6", 24, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr7", 25, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr8", 26, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr9", 27, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr10", 28, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr11", 29, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr12", 30, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr13", 31, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr14", 32, 1, "access", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "acr15", 33, 1, "access", 32, "uint32");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.fpr");
7b26da
+  tdesc_create_reg (feature, "fpc", 34, 1, "float", 32, "uint32");
7b26da
+  tdesc_create_reg (feature, "f0", 35, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f1", 36, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f2", 37, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f3", 38, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f4", 39, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f5", 40, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f6", 41, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f7", 42, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f8", 43, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f9", 44, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f10", 45, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f11", 46, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f12", 47, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f13", 48, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f14", 49, 1, "float", 64, "ieee_double");
7b26da
+  tdesc_create_reg (feature, "f15", 50, 1, "float", 64, "ieee_double");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.linux");
7b26da
+  tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "last_break", 52, 0, "system", 64, "code_ptr");
7b26da
+  tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32");
7b26da
+
7b26da
+  feature = tdesc_create_feature (result, "org.gnu.gdb.s390.tdb");
7b26da
+  tdesc_create_reg (feature, "tdb0", 54, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tac", 55, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tct", 56, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "atia", 57, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr0", 58, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr1", 59, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr2", 60, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr3", 61, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr4", 62, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr5", 63, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr6", 64, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr7", 65, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr8", 66, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr9", 67, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr10", 68, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr11", 69, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr12", 70, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr13", 71, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr14", 72, 1, "tdb", 64, "uint64");
7b26da
+  tdesc_create_reg (feature, "tr15", 73, 1, "tdb", 64, "uint64");
7b26da
+
7b26da
+  tdesc_s390x_te_linux64 = result;
7b26da
+}
7b26da
Index: gdb-7.6.1/gdb/features/s390x-te-linux64.xml
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/features/s390x-te-linux64.xml
7b26da
@@ -0,0 +1,24 @@
7b26da
+
7b26da
+
7b26da
+
7b26da
+     Copying and distribution of this file, with or without modification,
7b26da
+     are permitted in any medium without royalty provided the copyright
7b26da
+     notice and this notice are preserved.  -->
7b26da
+
7b26da
+
7b26da
+
7b26da
+
7b26da
+<target>
7b26da
+  <architecture>s390:64-bit</architecture>
7b26da
+  <xi:include href="s390x-core64.xml"/>
7b26da
+  <xi:include href="s390-acr.xml"/>
7b26da
+  <xi:include href="s390-fpr.xml"/>
7b26da
+
7b26da
+  <feature name="org.gnu.gdb.s390.linux">
7b26da
+    <reg name="orig_r2" bitsize="64" type="uint64" group="system"/>
7b26da
+    <reg name="last_break" bitsize="64" type="code_ptr" group="system" save-restore="no"/>
7b26da
+    <reg name="system_call" bitsize="32" type="uint32" group="system"/>
7b26da
+  </feature>
7b26da
+
7b26da
+  <xi:include href="s390-tdb.xml"/>
7b26da
+</target>
7b26da
Index: gdb-7.6.1/gdb/gdbserver/Makefile.in
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/gdbserver/Makefile.in
7b26da
+++ gdb-7.6.1/gdb/gdbserver/Makefile.in
7b26da
@@ -329,6 +329,9 @@ clean:
7b26da
 	rm -f powerpc-isa205-altivec32l.c powerpc-isa205-vsx32l.c powerpc-isa205-altivec64l.c
7b26da
 	rm -f powerpc-isa205-vsx64l.c
7b26da
 	rm -f s390-linux32.c s390-linux64.c s390x-linux64.c
7b26da
+	rm -f s390-linux32v1.c s390-linux32v2.c s390-linux64v1.c
7b26da
+	rm -f s390-linux64v2.c s390x-linux64v1.c s390x-linux64v2.c
7b26da
+	rm -f s390-te-linux32.c s390-te-linux64.c
7b26da
 	rm -f tic6x-c64xp-linux.c tic6x-c64x-linux.c tic6x-c62x-linux.c
7b26da
 	rm -f xml-builtin.c stamp-xml
7b26da
 	rm -f i386-avx.c i386-avx-linux.c
7b26da
@@ -658,12 +661,16 @@ s390-linux64v1.c : $(srcdir)/../regforma
7b26da
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390-linux64v1.dat s390-linux64v1.c
7b26da
 s390-linux64v2.c : $(srcdir)/../regformats/s390-linux64v2.dat $(regdat_sh)
7b26da
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390-linux64v2.dat s390-linux64v2.c
7b26da
+s390-te-linux64.c : $(srcdir)/../regformats/s390-te-linux64.dat $(regdat_sh)
7b26da
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390-te-linux64.dat s390-te-linux64.c
7b26da
 s390x-linux64.c : $(srcdir)/../regformats/s390x-linux64.dat $(regdat_sh)
7b26da
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-linux64.dat s390x-linux64.c
7b26da
 s390x-linux64v1.c : $(srcdir)/../regformats/s390x-linux64v1.dat $(regdat_sh)
7b26da
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-linux64v1.dat s390x-linux64v1.c
7b26da
 s390x-linux64v2.c : $(srcdir)/../regformats/s390x-linux64v2.dat $(regdat_sh)
7b26da
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-linux64v2.dat s390x-linux64v2.c
7b26da
+s390x-te-linux64.c : $(srcdir)/../regformats/s390x-te-linux64.dat $(regdat_sh)
7b26da
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/s390x-te-linux64.dat s390x-te-linux64.c
7b26da
 
7b26da
 tic6x-c64xp-linux.c : $(srcdir)/../regformats/tic6x-c64xp-linux.dat $(regdat_sh)
7b26da
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/tic6x-c64xp-linux.dat tic6x-c64xp-linux.c
7b26da
Index: gdb-7.6.1/gdb/gdbserver/configure.srv
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/gdbserver/configure.srv
7b26da
+++ gdb-7.6.1/gdb/gdbserver/configure.srv
7b26da
@@ -259,9 +259,11 @@ case "${target}" in
7b26da
 			srv_regobj="${srv_regobj} s390-linux64.o"
7b26da
 			srv_regobj="${srv_regobj} s390-linux64v1.o"
7b26da
 			srv_regobj="${srv_regobj} s390-linux64v2.o"
7b26da
+			srv_regobj="${srv_regobj} s390-te-linux64.o"
7b26da
 			srv_regobj="${srv_regobj} s390x-linux64.o"
7b26da
 			srv_regobj="${srv_regobj} s390x-linux64v1.o"
7b26da
 			srv_regobj="${srv_regobj} s390x-linux64v2.o"
7b26da
+			srv_regobj="${srv_regobj} s390x-te-linux64.o"
7b26da
 			srv_tgtobj="linux-low.o linux-osdata.o linux-s390-low.o linux-procfs.o"
7b26da
 			srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
7b26da
 			srv_xmlfiles="s390-linux32.xml"
7b26da
@@ -270,14 +272,17 @@ case "${target}" in
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390-linux64.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390-linux64v1.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390-linux64v2.xml"
7b26da
+			srv_xmlfiles="${srv_xmlfiles} s390-te-linux64.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390x-linux64.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390x-linux64v1.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390x-linux64v2.xml"
7b26da
+			srv_xmlfiles="${srv_xmlfiles} s390x-te-linux64.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390-core32.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390-core64.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390x-core64.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390-acr.xml"
7b26da
 			srv_xmlfiles="${srv_xmlfiles} s390-fpr.xml"
7b26da
+			srv_xmlfiles="${srv_xmlfiles} s390-tdb.xml"
7b26da
 			srv_linux_usrregs=yes
7b26da
 			srv_linux_regsets=yes
7b26da
 			srv_linux_thread_db=yes
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
@@ -59,6 +59,12 @@ void init_registers_s390x_linux64v1 (voi
7b26da
 /* Defined in auto-generated file s390x-linux64v2.c.  */
7b26da
 void init_registers_s390x_linux64v2 (void);
7b26da
 
7b26da
+/* Defined in auto-generated file s390x-te-linux64.c.  */
7b26da
+void init_registers_s390x_te_linux64 (void);
7b26da
+
7b26da
+/* Defined in auto-generated file s390-te-linux64.c.  */
7b26da
+void init_registers_s390_te_linux64 (void);
7b26da
+
7b26da
 #define s390_num_regs 52
7b26da
 
7b26da
 static int s390_regmap[] = {
7b26da
@@ -365,10 +371,10 @@ s390_check_regset (int pid, int regset,
7b26da
   iov.iov_base = buf;
7b26da
   iov.iov_len = regsize;
7b26da
 
7b26da
-  if (ptrace (PTRACE_GETREGSET, pid, (long) regset, (long) &iov) < 0)
7b26da
-    return 0;
7b26da
-  else
7b26da
+  if (ptrace (PTRACE_GETREGSET, pid, (long) regset, (long) &iov) >= 0
7b26da
+      || errno == ENODATA)
7b26da
     return 1;
7b26da
+  return 0;
7b26da
 }
7b26da
 
7b26da
 static void
7b26da
@@ -382,6 +388,7 @@ s390_arch_setup (void)
7b26da
     = s390_check_regset (pid, NT_S390_LAST_BREAK, 8);
7b26da
   int have_regset_system_call
7b26da
     = s390_check_regset (pid, NT_S390_SYSTEM_CALL, 4);
7b26da
+  int have_regset_tdb = s390_check_regset (pid, NT_S390_TDB, 256);
7b26da
 
7b26da
   /* Update target_regsets according to available register sets.  */
7b26da
   for (regset = target_regsets; regset->fill_function != NULL; regset++)
7b26da
@@ -394,6 +401,8 @@ s390_arch_setup (void)
7b26da
 	case NT_S390_SYSTEM_CALL:
7b26da
 	  regset->size = have_regset_system_call? 4 : 0;
7b26da
 	  break;
7b26da
+	case NT_S390_TDB:
7b26da
+	  regset->size = have_regset_tdb ? 256 : 0;
7b26da
 	default:
7b26da
 	  break;
7b26da
 	}
7b26da
@@ -421,6 +430,8 @@ s390_arch_setup (void)
7b26da
 
7b26da
     if (pswm & 1)
7b26da
       {
7b26da
+	if (have_regset_tdb)
7b26da
+	  init_registers_s390x_te_linux64 ();
7b26da
 	if (have_regset_system_call)
7b26da
 	  init_registers_s390x_linux64v2 ();
7b26da
 	else if (have_regset_last_break)
7b26da
@@ -433,6 +444,8 @@ s390_arch_setup (void)
7b26da
        using the full 64-bit GPRs.  */
7b26da
     else if (s390_get_hwcap () & HWCAP_S390_HIGH_GPRS)
7b26da
       {
7b26da
+	if (have_regset_tdb)
7b26da
+	  init_registers_s390_te_linux64 ();
7b26da
 	if (have_regset_system_call)
7b26da
 	  init_registers_s390_linux64v2 ();
7b26da
 	else if (have_regset_last_break)
7b26da
Index: gdb-7.6.1/gdb/regformats/s390-te-linux64.dat
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/regformats/s390-te-linux64.dat
7b26da
@@ -0,0 +1,94 @@
7b26da
+# DO NOT EDIT: generated from s390-te-linux64.xml
7b26da
+name:s390_te_linux64
7b26da
+xmltarget:s390-te-linux64.xml
7b26da
+expedite:r14,r15,pswa
7b26da
+32:pswm
7b26da
+32:pswa
7b26da
+32:r0h
7b26da
+32:r0l
7b26da
+32:r1h
7b26da
+32:r1l
7b26da
+32:r2h
7b26da
+32:r2l
7b26da
+32:r3h
7b26da
+32:r3l
7b26da
+32:r4h
7b26da
+32:r4l
7b26da
+32:r5h
7b26da
+32:r5l
7b26da
+32:r6h
7b26da
+32:r6l
7b26da
+32:r7h
7b26da
+32:r7l
7b26da
+32:r8h
7b26da
+32:r8l
7b26da
+32:r9h
7b26da
+32:r9l
7b26da
+32:r10h
7b26da
+32:r10l
7b26da
+32:r11h
7b26da
+32:r11l
7b26da
+32:r12h
7b26da
+32:r12l
7b26da
+32:r13h
7b26da
+32:r13l
7b26da
+32:r14h
7b26da
+32:r14l
7b26da
+32:r15h
7b26da
+32:r15l
7b26da
+32:acr0
7b26da
+32:acr1
7b26da
+32:acr2
7b26da
+32:acr3
7b26da
+32:acr4
7b26da
+32:acr5
7b26da
+32:acr6
7b26da
+32:acr7
7b26da
+32:acr8
7b26da
+32:acr9
7b26da
+32:acr10
7b26da
+32:acr11
7b26da
+32:acr12
7b26da
+32:acr13
7b26da
+32:acr14
7b26da
+32:acr15
7b26da
+32:fpc
7b26da
+64:f0
7b26da
+64:f1
7b26da
+64:f2
7b26da
+64:f3
7b26da
+64:f4
7b26da
+64:f5
7b26da
+64:f6
7b26da
+64:f7
7b26da
+64:f8
7b26da
+64:f9
7b26da
+64:f10
7b26da
+64:f11
7b26da
+64:f12
7b26da
+64:f13
7b26da
+64:f14
7b26da
+64:f15
7b26da
+32:orig_r2
7b26da
+32:last_break
7b26da
+32:system_call
7b26da
+64:tdb0
7b26da
+64:tac
7b26da
+64:tct
7b26da
+64:atia
7b26da
+64:tr0
7b26da
+64:tr1
7b26da
+64:tr2
7b26da
+64:tr3
7b26da
+64:tr4
7b26da
+64:tr5
7b26da
+64:tr6
7b26da
+64:tr7
7b26da
+64:tr8
7b26da
+64:tr9
7b26da
+64:tr10
7b26da
+64:tr11
7b26da
+64:tr12
7b26da
+64:tr13
7b26da
+64:tr14
7b26da
+64:tr15
7b26da
Index: gdb-7.6.1/gdb/regformats/s390x-te-linux64.dat
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/regformats/s390x-te-linux64.dat
7b26da
@@ -0,0 +1,78 @@
7b26da
+# DO NOT EDIT: generated from s390x-te-linux64.xml
7b26da
+name:s390x_te_linux64
7b26da
+xmltarget:s390x-te-linux64.xml
7b26da
+expedite:r14,r15,pswa
7b26da
+64:pswm
7b26da
+64:pswa
7b26da
+64:r0
7b26da
+64:r1
7b26da
+64:r2
7b26da
+64:r3
7b26da
+64:r4
7b26da
+64:r5
7b26da
+64:r6
7b26da
+64:r7
7b26da
+64:r8
7b26da
+64:r9
7b26da
+64:r10
7b26da
+64:r11
7b26da
+64:r12
7b26da
+64:r13
7b26da
+64:r14
7b26da
+64:r15
7b26da
+32:acr0
7b26da
+32:acr1
7b26da
+32:acr2
7b26da
+32:acr3
7b26da
+32:acr4
7b26da
+32:acr5
7b26da
+32:acr6
7b26da
+32:acr7
7b26da
+32:acr8
7b26da
+32:acr9
7b26da
+32:acr10
7b26da
+32:acr11
7b26da
+32:acr12
7b26da
+32:acr13
7b26da
+32:acr14
7b26da
+32:acr15
7b26da
+32:fpc
7b26da
+64:f0
7b26da
+64:f1
7b26da
+64:f2
7b26da
+64:f3
7b26da
+64:f4
7b26da
+64:f5
7b26da
+64:f6
7b26da
+64:f7
7b26da
+64:f8
7b26da
+64:f9
7b26da
+64:f10
7b26da
+64:f11
7b26da
+64:f12
7b26da
+64:f13
7b26da
+64:f14
7b26da
+64:f15
7b26da
+64:orig_r2
7b26da
+64:last_break
7b26da
+32:system_call
7b26da
+64:tdb0
7b26da
+64:tac
7b26da
+64:tct
7b26da
+64:atia
7b26da
+64:tr0
7b26da
+64:tr1
7b26da
+64:tr2
7b26da
+64:tr3
7b26da
+64:tr4
7b26da
+64:tr5
7b26da
+64:tr6
7b26da
+64:tr7
7b26da
+64:tr8
7b26da
+64:tr9
7b26da
+64:tr10
7b26da
+64:tr11
7b26da
+64:tr12
7b26da
+64:tr13
7b26da
+64:tr14
7b26da
+64:tr15
7b26da
Index: gdb-7.6.1/gdb/s390-nat.c
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/s390-nat.c
7b26da
+++ gdb-7.6.1/gdb/s390-nat.c
7b26da
@@ -37,10 +37,6 @@
7b26da
 #include <sys/ucontext.h>
7b26da
 #include <elf.h>
7b26da
 
7b26da
-#ifndef HWCAP_S390_HIGH_GPRS
7b26da
-#define HWCAP_S390_HIGH_GPRS 512
7b26da
-#endif
7b26da
-
7b26da
 #ifndef PTRACE_GETREGSET
7b26da
 #define PTRACE_GETREGSET 0x4204
7b26da
 #endif
7b26da
@@ -51,6 +47,7 @@
7b26da
 
7b26da
 static int have_regset_last_break = 0;
7b26da
 static int have_regset_system_call = 0;
7b26da
+static int have_regset_tdb = 0;
7b26da
 
7b26da
 /* Map registers to gregset/ptrace offsets.
7b26da
    These arrays are defined in s390-tdep.c.  */
7b26da
@@ -72,7 +69,7 @@ s390_native_supply (struct regcache *reg
7b26da
 		    const gdb_byte *regp)
7b26da
 {
7b26da
   for (; map[0] >= 0; map += 2)
7b26da
-    regcache_raw_supply (regcache, map[1], regp + map[0]);
7b26da
+    regcache_raw_supply (regcache, map[1], regp ? regp + map[0] : NULL);
7b26da
 }
7b26da
 
7b26da
 /* Collect the register REGNO out of the regset described by MAP from
7b26da
@@ -315,9 +312,14 @@ fetch_regset (struct regcache *regcache,
7b26da
   iov.iov_len = regsize;
7b26da
 
7b26da
   if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
7b26da
-    perror_with_name (_("Couldn't get register set"));
7b26da
-
7b26da
-  s390_native_supply (regcache, regmap, buf);
7b26da
+    {
7b26da
+      if (errno == ENODATA)
7b26da
+	s390_native_supply (regcache, regmap, NULL);
7b26da
+      else
7b26da
+	perror_with_name (_("Couldn't get register set"));
7b26da
+    }
7b26da
+  else
7b26da
+    s390_native_supply (regcache, regmap, buf);
7b26da
 }
7b26da
 
7b26da
 /* Store all registers in the kernel's register set whose number is REGSET,
7b26da
@@ -353,10 +355,10 @@ check_regset (int tid, int regset, int r
7b26da
   iov.iov_base = buf;
7b26da
   iov.iov_len = regsize;
7b26da
 
7b26da
-  if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
7b26da
-    return 0;
7b26da
-  else
7b26da
+  if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) >= 0
7b26da
+      || errno == ENODATA)
7b26da
     return 1;
7b26da
+  return 0;
7b26da
 }
7b26da
 
7b26da
 /* Fetch register REGNUM from the child process.  If REGNUM is -1, do
7b26da
@@ -383,6 +385,11 @@ s390_linux_fetch_inferior_registers (str
7b26da
     if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
7b26da
       fetch_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4,
7b26da
 		    s390_regmap_system_call);
7b26da
+
7b26da
+  if (have_regset_tdb)
7b26da
+    if (regnum == -1 || S390_IS_TDBREGSET_REGNUM (regnum))
7b26da
+      fetch_regset (regcache, tid, NT_S390_TDB, s390_sizeof_tdbregset,
7b26da
+		    s390_regmap_tdb);
7b26da
 }
7b26da
 
7b26da
 /* Store register REGNUM back into the child process.  If REGNUM is
7b26da
@@ -625,6 +632,8 @@ s390_read_description (struct target_ops
7b26da
     = check_regset (tid, NT_S390_LAST_BREAK, 8);
7b26da
   have_regset_system_call
7b26da
     = check_regset (tid, NT_S390_SYSTEM_CALL, 4);
7b26da
+  have_regset_tdb
7b26da
+    = check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
7b26da
 
7b26da
 #ifdef __s390x__
7b26da
   /* If GDB itself is compiled as 64-bit, we are running on a machine in
7b26da
@@ -634,12 +643,14 @@ s390_read_description (struct target_ops
7b26da
      that mode, report s390 architecture with 64-bit GPRs.  */
7b26da
 
7b26da
   if (s390_target_wordsize () == 8)
7b26da
-    return (have_regset_system_call? tdesc_s390x_linux64v2 :
7b26da
+    return (have_regset_tdb ? tdesc_s390x_te_linux64 :
7b26da
+	    have_regset_system_call? tdesc_s390x_linux64v2 :
7b26da
 	    have_regset_last_break? tdesc_s390x_linux64v1 :
7b26da
 	    tdesc_s390x_linux64);
7b26da
 
7b26da
   if (s390_get_hwcap () & HWCAP_S390_HIGH_GPRS)
7b26da
-    return (have_regset_system_call? tdesc_s390_linux64v2 :
7b26da
+    return (have_regset_tdb ? tdesc_s390_te_linux64 :
7b26da
+	    have_regset_system_call? tdesc_s390_linux64v2 :
7b26da
 	    have_regset_last_break? tdesc_s390_linux64v1 :
7b26da
 	    tdesc_s390_linux64);
7b26da
 #endif
7b26da
Index: gdb-7.6.1/gdb/s390-tdep.c
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/s390-tdep.c
7b26da
+++ gdb-7.6.1/gdb/s390-tdep.c
7b26da
@@ -44,6 +44,7 @@
7b26da
 #include "prologue-value.h"
7b26da
 #include "linux-tdep.h"
7b26da
 #include "s390-tdep.h"
7b26da
+#include "auxv.h"
7b26da
 
7b26da
 #include "stap-probe.h"
7b26da
 #include "ax.h"
7b26da
@@ -51,6 +52,7 @@
7b26da
 #include "user-regs.h"
7b26da
 #include "cli/cli-utils.h"
7b26da
 #include <ctype.h>
7b26da
+#include <elf.h>
7b26da
 
7b26da
 #include "features/s390-linux32.c"
7b26da
 #include "features/s390-linux32v1.c"
7b26da
@@ -58,9 +60,11 @@
7b26da
 #include "features/s390-linux64.c"
7b26da
 #include "features/s390-linux64v1.c"
7b26da
 #include "features/s390-linux64v2.c"
7b26da
+#include "features/s390-te-linux64.c"
7b26da
 #include "features/s390x-linux64.c"
7b26da
 #include "features/s390x-linux64v1.c"
7b26da
 #include "features/s390x-linux64v2.c"
7b26da
+#include "features/s390x-te-linux64.c"
7b26da
 
7b26da
 /* The tdep structure.  */
7b26da
 
7b26da
@@ -568,6 +572,30 @@ const short s390_regmap_system_call[] =
7b26da
     -1, -1
7b26da
   };
7b26da
 
7b26da
+const short s390_regmap_tdb[] =
7b26da
+  {
7b26da
+    0x00, S390_TDB_DWORD0_REGNUM,
7b26da
+    0x08, S390_TDB_ABORT_CODE_REGNUM,
7b26da
+    0x10, S390_TDB_CONFLICT_TOKEN_REGNUM,
7b26da
+    0x18, S390_TDB_ATIA_REGNUM,
7b26da
+    0x80, S390_TDB_R0_REGNUM,
7b26da
+    0x88, S390_TDB_R1_REGNUM,
7b26da
+    0x90, S390_TDB_R2_REGNUM,
7b26da
+    0x98, S390_TDB_R3_REGNUM,
7b26da
+    0xa0, S390_TDB_R4_REGNUM,
7b26da
+    0xa8, S390_TDB_R5_REGNUM,
7b26da
+    0xb0, S390_TDB_R6_REGNUM,
7b26da
+    0xb8, S390_TDB_R7_REGNUM,
7b26da
+    0xc0, S390_TDB_R8_REGNUM,
7b26da
+    0xc8, S390_TDB_R9_REGNUM,
7b26da
+    0xd0, S390_TDB_R10_REGNUM,
7b26da
+    0xd8, S390_TDB_R11_REGNUM,
7b26da
+    0xe0, S390_TDB_R12_REGNUM,
7b26da
+    0xe8, S390_TDB_R13_REGNUM,
7b26da
+    0xf0, S390_TDB_R14_REGNUM,
7b26da
+    0xf8, S390_TDB_R15_REGNUM,
7b26da
+    -1, -1
7b26da
+  };
7b26da
 
7b26da
 
7b26da
 /* Supply register REGNUM from the register set REGSET to register cache 
7b26da
@@ -579,7 +607,25 @@ s390_supply_regset (const struct regset
7b26da
   const short *map;
7b26da
   for (map = regset->descr; map[0] >= 0; map += 2)
7b26da
     if (regnum == -1 || regnum == map[1])
7b26da
-      regcache_raw_supply (regcache, map[1], (const char *)regs + map[0]);
7b26da
+      regcache_raw_supply (regcache, map[1],
7b26da
+			   regs ? (const char *)regs + map[0] : NULL);
7b26da
+}
7b26da
+
7b26da
+/* Supply the TDB regset.  Like s390_supply_regset, but invalidate the
7b26da
+   TDB registers unless the TDB format field is valid.  */
7b26da
+
7b26da
+static void
7b26da
+s390_supply_tdb_regset (const struct regset *regset, struct regcache *regcache,
7b26da
+		    int regnum, const void *regs, size_t len)
7b26da
+{
7b26da
+  ULONGEST tdw;
7b26da
+  enum register_status ret;
7b26da
+  int i;
7b26da
+
7b26da
+  s390_supply_regset (regset, regcache, regnum, regs, len);
7b26da
+  ret = regcache_cooked_read_unsigned (regcache, S390_TDB_DWORD0_REGNUM, &tdw;;
7b26da
+  if (ret != REG_VALID || (tdw >> 56) != 1)
7b26da
+    s390_supply_regset (regset, regcache, regnum, NULL, len);
7b26da
 }
7b26da
 
7b26da
 /* Collect register REGNUM from the register cache REGCACHE and store
7b26da
@@ -639,6 +685,12 @@ static const struct regset s390_system_c
7b26da
   s390_collect_regset
7b26da
 };
7b26da
 
7b26da
+static const struct regset s390_tdb_regset = {
7b26da
+  s390_regmap_tdb,
7b26da
+  s390_supply_tdb_regset,
7b26da
+  s390_collect_regset
7b26da
+};
7b26da
+
7b26da
 static struct core_regset_section s390_linux32_regset_sections[] =
7b26da
 {
7b26da
   { ".reg", s390_sizeof_gregset, "general-purpose" },
7b26da
@@ -687,6 +739,7 @@ static struct core_regset_section s390_l
7b26da
   { ".reg-s390-high-gprs", 16*4, "s390 GPR upper halves" },
7b26da
   { ".reg-s390-last-break", 8, "s930 last-break address" },
7b26da
   { ".reg-s390-system-call", 4, "s390 system-call" },
7b26da
+  { ".reg-s390-tdb", s390_sizeof_tdbregset, "s390 TDB" },
7b26da
   { NULL, 0}
7b26da
 };
7b26da
 
7b26da
@@ -711,6 +764,7 @@ static struct core_regset_section s390x_
7b26da
   { ".reg2", s390_sizeof_fpregset, "floating-point" },
7b26da
   { ".reg-s390-last-break", 8, "s930 last-break address" },
7b26da
   { ".reg-s390-system-call", 4, "s390 system-call" },
7b26da
+  { ".reg-s390-tdb", s390_sizeof_tdbregset, "s390 TDB" },
7b26da
   { NULL, 0}
7b26da
 };
7b26da
 
7b26da
@@ -739,6 +793,9 @@ s390_regset_from_core_section (struct gd
7b26da
   if (strcmp (sect_name, ".reg-s390-system-call") == 0 && sect_size >= 4)
7b26da
     return &s390_system_call_regset;
7b26da
 
7b26da
+  if (strcmp (sect_name, ".reg-s390-tdb") == 0 && sect_size >= 256)
7b26da
+    return &s390_tdb_regset;
7b26da
+
7b26da
   return NULL;
7b26da
 }
7b26da
 
7b26da
@@ -750,6 +807,9 @@ s390_core_read_description (struct gdbar
7b26da
   asection *v1 = bfd_get_section_by_name (abfd, ".reg-s390-last-break");
7b26da
   asection *v2 = bfd_get_section_by_name (abfd, ".reg-s390-system-call");
7b26da
   asection *section = bfd_get_section_by_name (abfd, ".reg");
7b26da
+  CORE_ADDR hwcap = 0;
7b26da
+
7b26da
+  target_auxv_search (target, AT_HWCAP, &hwcap);
7b26da
   if (!section)
7b26da
     return NULL;
7b26da
 
7b26da
@@ -757,14 +817,16 @@ s390_core_read_description (struct gdbar
7b26da
     {
7b26da
     case s390_sizeof_gregset:
7b26da
       if (high_gprs)
7b26da
-	return (v2? tdesc_s390_linux64v2 :
7b26da
+	return ((hwcap & HWCAP_S390_TE) ? tdesc_s390_te_linux64 :
7b26da
+		v2? tdesc_s390_linux64v2 :
7b26da
 		v1? tdesc_s390_linux64v1 : tdesc_s390_linux64);
7b26da
       else
7b26da
 	return (v2? tdesc_s390_linux32v2 :
7b26da
 		v1? tdesc_s390_linux32v1 : tdesc_s390_linux32);
7b26da
 
7b26da
     case s390x_sizeof_gregset:
7b26da
-      return (v2? tdesc_s390x_linux64v2 :
7b26da
+      return ((hwcap & HWCAP_S390_TE) ? tdesc_s390x_te_linux64 :
7b26da
+	      v2? tdesc_s390x_linux64v2 :
7b26da
 	      v1? tdesc_s390x_linux64v1 : tdesc_s390x_linux64);
7b26da
 
7b26da
     default:
7b26da
@@ -3011,6 +3073,11 @@ s390_gdbarch_init (struct gdbarch_info i
7b26da
 	"r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
7b26da
 	"r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h"
7b26da
       };
7b26da
+      static const char *const tdb_regs[] = {
7b26da
+	"tdb0", "tac", "tct", "atia",
7b26da
+	"tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7",
7b26da
+	"tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"
7b26da
+      };
7b26da
       const struct tdesc_feature *feature;
7b26da
       int i, valid_p = 1;
7b26da
 
7b26da
@@ -3088,6 +3155,16 @@ s390_gdbarch_init (struct gdbarch_info i
7b26da
 	    valid_p = 0;
7b26da
 	}
7b26da
 
7b26da
+      /* Transaction diagnostic block.  */
7b26da
+      feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.tdb");
7b26da
+      if (feature)
7b26da
+	{
7b26da
+	  for (i = 0; i < ARRAY_SIZE (tdb_regs); i++)
7b26da
+	    valid_p &= tdesc_numbered_register (feature, tdesc_data,
7b26da
+						S390_TDB_DWORD0_REGNUM + i,
7b26da
+						tdb_regs[i]);
7b26da
+	}
7b26da
+
7b26da
       if (!valid_p)
7b26da
 	{
7b26da
 	  tdesc_data_cleanup (tdesc_data);
7b26da
@@ -3304,7 +3381,9 @@ _initialize_s390_tdep (void)
7b26da
   initialize_tdesc_s390_linux64 ();
7b26da
   initialize_tdesc_s390_linux64v1 ();
7b26da
   initialize_tdesc_s390_linux64v2 ();
7b26da
+  initialize_tdesc_s390_te_linux64 ();
7b26da
   initialize_tdesc_s390x_linux64 ();
7b26da
   initialize_tdesc_s390x_linux64v1 ();
7b26da
   initialize_tdesc_s390x_linux64v2 ();
7b26da
+  initialize_tdesc_s390x_te_linux64 ();
7b26da
 }
7b26da
Index: gdb-7.6.1/gdb/s390-tdep.h
7b26da
===================================================================
7b26da
--- gdb-7.6.1.orig/gdb/s390-tdep.h
7b26da
+++ gdb-7.6.1/gdb/s390-tdep.h
7b26da
@@ -19,6 +19,16 @@
7b26da
 #ifndef S390_TDEP_H
7b26da
 #define S390_TDEP_H
7b26da
 
7b26da
+/* Hardware capabilities. */
7b26da
+
7b26da
+#ifndef HWCAP_S390_HIGH_GPRS
7b26da
+#define HWCAP_S390_HIGH_GPRS 512
7b26da
+#endif
7b26da
+
7b26da
+#ifndef HWCAP_S390_TE
7b26da
+#define HWCAP_S390_TE 1024
7b26da
+#endif
7b26da
+
7b26da
 /* Register information.  */
7b26da
 
7b26da
 /* Program Status Word.  */
7b26da
@@ -98,8 +108,29 @@
7b26da
 #define S390_ORIG_R2_REGNUM 67
7b26da
 #define S390_LAST_BREAK_REGNUM 68
7b26da
 #define S390_SYSTEM_CALL_REGNUM 69
7b26da
+/* Transaction diagnostic block.  */
7b26da
+#define S390_TDB_DWORD0_REGNUM 70
7b26da
+#define S390_TDB_ABORT_CODE_REGNUM 71
7b26da
+#define S390_TDB_CONFLICT_TOKEN_REGNUM 72
7b26da
+#define S390_TDB_ATIA_REGNUM 73
7b26da
+#define S390_TDB_R0_REGNUM 74
7b26da
+#define S390_TDB_R1_REGNUM 75
7b26da
+#define S390_TDB_R2_REGNUM 76
7b26da
+#define S390_TDB_R3_REGNUM 77
7b26da
+#define S390_TDB_R4_REGNUM 78
7b26da
+#define S390_TDB_R5_REGNUM 79
7b26da
+#define S390_TDB_R6_REGNUM 80
7b26da
+#define S390_TDB_R7_REGNUM 81
7b26da
+#define S390_TDB_R8_REGNUM 82
7b26da
+#define S390_TDB_R9_REGNUM 83
7b26da
+#define S390_TDB_R10_REGNUM 84
7b26da
+#define S390_TDB_R11_REGNUM 85
7b26da
+#define S390_TDB_R12_REGNUM 86
7b26da
+#define S390_TDB_R13_REGNUM 87
7b26da
+#define S390_TDB_R14_REGNUM 88
7b26da
+#define S390_TDB_R15_REGNUM 89
7b26da
 /* Total.  */
7b26da
-#define S390_NUM_REGS 70
7b26da
+#define S390_NUM_REGS 90
7b26da
 
7b26da
 /* Special register usage.  */
7b26da
 #define S390_SP_REGNUM S390_R15_REGNUM
7b26da
@@ -114,6 +145,9 @@
7b26da
 #define S390_IS_FPREGSET_REGNUM(i)			\
7b26da
   ((i) >= S390_FPC_REGNUM && (i) <= S390_F15_REGNUM)
7b26da
 
7b26da
+#define S390_IS_TDBREGSET_REGNUM(i)				\
7b26da
+  ((i) >= S390_TDB_DWORD0_REGNUM && (i) <= S390_TDB_R15_REGNUM)
7b26da
+
7b26da
 /* Core file register sets, defined in s390-tdep.c.  */
7b26da
 #define s390_sizeof_gregset 0x90
7b26da
 extern const short s390_regmap_gregset[];
7b26da
@@ -124,6 +158,8 @@ extern const short s390_regmap_fpregset[
7b26da
 extern const short s390_regmap_last_break[];
7b26da
 extern const short s390x_regmap_last_break[];
7b26da
 extern const short s390_regmap_system_call[];
7b26da
+extern const short s390_regmap_tdb[];
7b26da
+#define s390_sizeof_tdbregset 0x100
7b26da
 
7b26da
 /* GNU/Linux target descriptions.  */
7b26da
 extern struct target_desc *tdesc_s390_linux32;
7b26da
@@ -132,9 +168,11 @@ extern struct target_desc *tdesc_s390_li
7b26da
 extern struct target_desc *tdesc_s390_linux64;
7b26da
 extern struct target_desc *tdesc_s390_linux64v1;
7b26da
 extern struct target_desc *tdesc_s390_linux64v2;
7b26da
+extern struct target_desc *tdesc_s390_te_linux64;
7b26da
 extern struct target_desc *tdesc_s390x_linux64;
7b26da
 extern struct target_desc *tdesc_s390x_linux64v1;
7b26da
 extern struct target_desc *tdesc_s390x_linux64v2;
7b26da
+extern struct target_desc *tdesc_s390x_te_linux64;
7b26da
 
7b26da
 #endif
7b26da
 
7b26da
Index: gdb-7.6.1/gdb/testsuite/gdb.arch/s390-tdbregs.c
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/testsuite/gdb.arch/s390-tdbregs.c
7b26da
@@ -0,0 +1,64 @@
7b26da
+/* Copyright 2008-2013 Free Software Foundation, Inc.
7b26da
+
7b26da
+   This file is part of GDB.
7b26da
+
7b26da
+   This program is free software; you can redistribute it and/or modify
7b26da
+   it under the terms of the GNU General Public License as published by
7b26da
+   the Free Software Foundation; either version 3 of the License, or
7b26da
+   (at your option) any later version.
7b26da
+
7b26da
+   This program is distributed in the hope that it will be useful,
7b26da
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7b26da
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7b26da
+   GNU General Public License for more details.
7b26da
+
7b26da
+   You should have received a copy of the GNU General Public License
7b26da
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7b26da
+
7b26da
+#include <stdio.h>
7b26da
+
7b26da
+static void
7b26da
+my_tbegin ()
7b26da
+{
7b26da
+  __asm__ volatile
7b26da
+    ( "1:  .byte 0xe5,0x60,0x00,0x00,0xff,0x00\n"
7b26da
+      "    jnz 1b"
7b26da
+      : /* no return value */
7b26da
+      : /* no inputs */
7b26da
+      : "cc", "memory" );
7b26da
+}
7b26da
+
7b26da
+static void
7b26da
+my_tend ()
7b26da
+{
7b26da
+  __asm__ volatile
7b26da
+    ( "    .byte 0xb2,0xf8,0x00,0x00"
7b26da
+      : /* no return value */
7b26da
+      : /* no inputs */
7b26da
+      : "cc", "memory" );
7b26da
+}
7b26da
+
7b26da
+void
7b26da
+try_transaction (void)
7b26da
+{
7b26da
+  my_tbegin ();
7b26da
+  my_tend ();
7b26da
+}
7b26da
+
7b26da
+void
7b26da
+crash_in_transaction (void)
7b26da
+{
7b26da
+  volatile char *p = 0;
7b26da
+
7b26da
+  my_tbegin ();
7b26da
+  *p = 5;			/* FAULT */
7b26da
+  my_tend ();
7b26da
+}
7b26da
+
7b26da
+int
7b26da
+main (int argc, char *argv[])
7b26da
+{
7b26da
+  try_transaction ();
7b26da
+  crash_in_transaction ();
7b26da
+  return 0;
7b26da
+}
7b26da
Index: gdb-7.6.1/gdb/testsuite/gdb.arch/s390-tdbregs.exp
7b26da
===================================================================
7b26da
--- /dev/null
7b26da
+++ gdb-7.6.1/gdb/testsuite/gdb.arch/s390-tdbregs.exp
7b26da
@@ -0,0 +1,75 @@
7b26da
+# Copyright 2004-2013 Free Software Foundation, Inc.
7b26da
+
7b26da
+# This program is free software; you can redistribute it and/or modify
7b26da
+# it under the terms of the GNU General Public License as published by
7b26da
+# the Free Software Foundation; either version 3 of the License, or
7b26da
+# (at your option) any later version.
7b26da
+#
7b26da
+# This program is distributed in the hope that it will be useful,
7b26da
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7b26da
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7b26da
+# GNU General Public License for more details.
7b26da
+#
7b26da
+# You should have received a copy of the GNU General Public License
7b26da
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7b26da
+
7b26da
+# Please email any bugs, comments, and/or additions to this file to:
7b26da
+# bug-gdb@gnu.org
7b26da
+
7b26da
+# This file is part of the gdb testsuite.
7b26da
+
7b26da
+
7b26da
+if { ![istarget s390-*-*] && ![istarget s390x-*-* ] } {
7b26da
+    verbose "Skipping s390 TDB register tests."
7b26da
+    return
7b26da
+}
7b26da
+
7b26da
+set testfile "s390-tdbregs"
7b26da
+set srcfile ${testfile}.c
7b26da
+set binfile ${objdir}/${subdir}/${testfile}
7b26da
+
7b26da
+if { [get_compiler_info] } {
7b26da
+    return -1
7b26da
+}
7b26da
+
7b26da
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
7b26da
+      executable [list debug]] != "" } {
7b26da
+    fail "compile failed"
7b26da
+    return
7b26da
+}
7b26da
+
7b26da
+gdb_exit
7b26da
+gdb_start
7b26da
+gdb_reinitialize_dir $srcdir/$subdir
7b26da
+gdb_load ${binfile}
7b26da
+
7b26da
+if { ![runto_main] } then {
7b26da
+    gdb_suppress_tests
7b26da
+}
7b26da
+
7b26da
+gdb_test_multiple "next" "check for TE support" {
7b26da
+    -re "Program received signal SIGILL,.*\r\n$gdb_prompt $" {
7b26da
+	unsupported "No TE support."
7b26da
+	return
7b26da
+    }
7b26da
+    -re "\[0-9\]+.*\r\n$gdb_prompt $" {
7b26da
+	pass "TE support available"
7b26da
+    }
7b26da
+    -re "$gdb_prompt $" {
7b26da
+	unsupported "No TE support (unknown error)."
7b26da
+	return
7b26da
+    }
7b26da
+}
7b26da
+
7b26da
+set crashline [gdb_get_line_number "FAULT"]
7b26da
+
7b26da
+gdb_test "print \$tdb0" "\\\$\[0-9\]+ = <unavailable>" "tdb0 unavailable"
7b26da
+gdb_test "print \$tr0" "\\\$\[0-9\]+ = <unavailable>" "tr0 unavailable"
7b26da
+gdb_test "next" \
7b26da
+    "Program received signal SIGSEGV, .*" \
7b26da
+    "crash in transaction"
7b26da
+gdb_test "print/x \$tdb0" "\\\$\[0-9\]+ = 0x1.*" "tdb0 available"
7b26da
+gdb_test "set print symbol-filename" "" "set print symbol-filename"
7b26da
+gdb_test "print/a \$atia" \
7b26da
+    "<crash_in_transaction.*:$crashline>" \
7b26da
+    "ATIA points to crash"