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

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