rpms/gdb/devel gdb-6.7-testsuite-stable-results-prelink.patch, NONE, 1.1 gdb-archer-ada.patch, NONE, 1.1 gdb-archer-next-over-throw-cxx-exec.patch, NONE, 1.1 gdb-archer-vla-ref-optimizedout.patch, NONE, 1.1 gdb-archer-vla-test-oom.patch, NONE, 1.1 gdb-bz539590-gnu-ifunc-fix-cond.patch, NONE, 1.1 gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch, NONE, 1.1 gdb-bz562763-pretty-print-2d-vectors-prereq.patch, NONE, 1.1 gdb-bz562763-pretty-print-2d-vectors.patch, NONE, 1.1 gdb-bz562975-std-terminate-double-free.patch, NONE, 1.1 gdb-bz570635-prettyprint-doc1.patch, NONE, 1.1 gdb-bz570635-prettyprint-doc2.patch, NONE, 1.1 gdb-bz574483-display-sepdebug.patch, NONE, 1.1 gdb-bz575292-delayed-physname.patch, NONE, 1.1 gdb-bz575292-void-workaround.patch, NONE, 1.1 gdb-bz578250-avx-01of10.patch, NONE, 1.1 gdb-bz578250-avx-02of10.patch, NONE, 1.1 gdb-bz578250-avx-03of10.patch, NONE, 1.1 gdb-bz578250-avx-04of10.patch, NONE, 1.1 gdb-bz578250-avx-05of10.patch, NONE, 1.1 gdb-bz578250-avx-06of10.patch, NONE, 1.1 gdb-bz578250-avx-07of10.patch, NONE, 1.1 gdb-bz578250-avx-08of10.patch, NONE, 1.1 gdb-bz578250-avx-09of10.patch, NONE, 1.1 gdb-bz578250-avx-10of10-ppc.patch, NONE, 1.1 gdb-bz578250-avx-10of10.patch, NONE, 1.1 gdb-bz589467-pieces-vla-compat.patch, NONE, 1.1 gdb-bz589467-pieces01of4.patch, NONE, 1.1 gdb-bz589467-pieces02of4.patch, NONE, 1.1 gdb-bz589467-pieces03of4.patch, NONE, 1.1 gdb-bz589467-pieces1of4.patch, NONE, 1.1 gdb-bz589467-pieces2of4.patch, NONE, 1.1 gdb-bz589467-pieces3of4.patch, NONE, 1.1 gdb-bz589467-pieces4of4.patch, NONE, 1.1 gdb-bz594560-core-vs-process.patch, NONE, 1.1 gdb-bz595475-tui-layout.patch, NONE, 1.1 gdb-bz600746-koenig-crash.patch, NONE, 1.1 gdb-bz601887-dwarf4-1of2.patch, NONE, 1.1 gdb-bz601887-dwarf4-2of2.patch, NONE, 1.1 gdb-bz601887-dwarf4-rh-test.patch, NONE, 1.1 gdb-bz602314-ptype-class-typedef-1of3.patch, NONE, 1.1 gdb-bz602314-ptype-class-typedef-2of3.patch, NONE, 1.1 gdb-bz602314-ptype-class-typedef-3of3.patch, NONE, 1.1 gdb-bz606185-obstack-1of5.patch, NONE, 1.1 gdb-bz606185-obstack-2of5.patch, NONE, 1.1 gdb-bz606185-obstack-3of5.patch, NONE, 1.1 gdb-bz606185-obstack-4of5.patch, NONE, 1.1 gdb-bz606185-obstack-5of5.patch, NONE, 1.1 gdb-bz606660-print-object-nonvirtual.patch, NONE, 1.1 gdb-infcall-sp-underflow.patch, NONE, 1.1 gdb-moribund-utrace-workaround.patch, NONE, 1.1 gdb-pie-1of6-reprelinked-bin.patch, NONE, 1.1 gdb-pie-2of6-reprelinked-ld.patch, NONE, 1.1 gdb-pie-3of6-relocate-once.patch, NONE, 1.1 gdb-pie-rerun.patch, NONE, 1.1 gdb-solib-memory-error-nonfatal.patch, NONE, 1.1 gdb-unwind-debughook-safe-fail.patch, NONE, 1.1 gdb-unwind-debughook-step-independent.patch, NONE, 1.1 gdb-upstream.patch, 1.2, 1.3 gdb-using-directive-leak.patch, NONE, 1.1 .cvsignore, 1.48, 1.49 gdb-6.3-gstack-20050411.patch, 1.7, 1.8 gdb-6.3-readnever-20050907.patch, 1.11, 1.12 gdb-6.3-test-pie-20050107.patch, 1.13, 1.14 gdb-6.5-bz203661-emit-relocs.patch, 1.3, 1.4 gdb-6.5-bz216711-clone-is-outermost.patch, 1.6, 1.7 gdb-6.6-buildid-locate-core-as-arg.patch, 1.2, 1.3 gdb-6.8-bz254229-gcore-prpsinfo.patch, 1.6, 1.7 gdb-archer-pie-addons.patch, 1.4, 1.5 gdb-archer.patch, 1.40, 1.41 gdb-rhel5-gcc44.patch, 1.2, 1.3 gdb.spec, 1.409, 1.410 sources, 1.47, 1.48 gdb-6.3-gstack-without-path-20060414.patch, 1.3, NONE gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch, 1.3, NONE gdb-6.8-inlining-addon.patch, 1.12, NONE gdb-6.8-inlining-by-name.patch, 1.2, NONE gdb-archer-pie-0315-breakpoint_address_match.patch, 1.1, NONE gdb-readline-6.0-signal.patch, 1.2, NONE gdb-stale-related_breakpoint.patch, 1.1, NONE

Jan Kratochvil jkratoch at fedoraproject.org
Sun Jul 11 18:06:34 UTC 2010


Author: jkratoch

Update of /cvs/pkgs/rpms/gdb/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv31667

Modified Files:
	.cvsignore gdb-6.3-gstack-20050411.patch 
	gdb-6.3-readnever-20050907.patch 
	gdb-6.3-test-pie-20050107.patch 
	gdb-6.5-bz203661-emit-relocs.patch 
	gdb-6.5-bz216711-clone-is-outermost.patch 
	gdb-6.6-buildid-locate-core-as-arg.patch 
	gdb-6.8-bz254229-gcore-prpsinfo.patch 
	gdb-archer-pie-addons.patch gdb-archer.patch 
	gdb-rhel5-gcc44.patch gdb.spec sources 
Added Files:
	gdb-6.7-testsuite-stable-results-prelink.patch 
	gdb-archer-ada.patch gdb-archer-next-over-throw-cxx-exec.patch 
	gdb-archer-vla-ref-optimizedout.patch 
	gdb-archer-vla-test-oom.patch 
	gdb-bz539590-gnu-ifunc-fix-cond.patch 
	gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch 
	gdb-bz562763-pretty-print-2d-vectors-prereq.patch 
	gdb-bz562763-pretty-print-2d-vectors.patch 
	gdb-bz562975-std-terminate-double-free.patch 
	gdb-bz570635-prettyprint-doc1.patch 
	gdb-bz570635-prettyprint-doc2.patch 
	gdb-bz574483-display-sepdebug.patch 
	gdb-bz575292-delayed-physname.patch 
	gdb-bz575292-void-workaround.patch 
	gdb-bz578250-avx-01of10.patch gdb-bz578250-avx-02of10.patch 
	gdb-bz578250-avx-03of10.patch gdb-bz578250-avx-04of10.patch 
	gdb-bz578250-avx-05of10.patch gdb-bz578250-avx-06of10.patch 
	gdb-bz578250-avx-07of10.patch gdb-bz578250-avx-08of10.patch 
	gdb-bz578250-avx-09of10.patch 
	gdb-bz578250-avx-10of10-ppc.patch 
	gdb-bz578250-avx-10of10.patch 
	gdb-bz589467-pieces-vla-compat.patch 
	gdb-bz589467-pieces01of4.patch gdb-bz589467-pieces02of4.patch 
	gdb-bz589467-pieces03of4.patch gdb-bz589467-pieces1of4.patch 
	gdb-bz589467-pieces2of4.patch gdb-bz589467-pieces3of4.patch 
	gdb-bz589467-pieces4of4.patch 
	gdb-bz594560-core-vs-process.patch 
	gdb-bz595475-tui-layout.patch gdb-bz600746-koenig-crash.patch 
	gdb-bz601887-dwarf4-1of2.patch gdb-bz601887-dwarf4-2of2.patch 
	gdb-bz601887-dwarf4-rh-test.patch 
	gdb-bz602314-ptype-class-typedef-1of3.patch 
	gdb-bz602314-ptype-class-typedef-2of3.patch 
	gdb-bz602314-ptype-class-typedef-3of3.patch 
	gdb-bz606185-obstack-1of5.patch 
	gdb-bz606185-obstack-2of5.patch 
	gdb-bz606185-obstack-3of5.patch 
	gdb-bz606185-obstack-4of5.patch 
	gdb-bz606185-obstack-5of5.patch 
	gdb-bz606660-print-object-nonvirtual.patch 
	gdb-infcall-sp-underflow.patch 
	gdb-moribund-utrace-workaround.patch 
	gdb-pie-1of6-reprelinked-bin.patch 
	gdb-pie-2of6-reprelinked-ld.patch 
	gdb-pie-3of6-relocate-once.patch gdb-pie-rerun.patch 
	gdb-solib-memory-error-nonfatal.patch 
	gdb-unwind-debughook-safe-fail.patch 
	gdb-unwind-debughook-step-independent.patch gdb-upstream.patch 
	gdb-using-directive-leak.patch 
Removed Files:
	gdb-6.3-gstack-without-path-20060414.patch 
	gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch 
	gdb-6.8-inlining-addon.patch gdb-6.8-inlining-by-name.patch 
	gdb-archer-pie-0315-breakpoint_address_match.patch 
	gdb-readline-6.0-signal.patch 
	gdb-stale-related_breakpoint.patch 
Log Message:
* Sun Jul 11 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-28.fc14
- Rebuild for Fedora 14.


gdb-6.7-testsuite-stable-results-prelink.patch:
 prelink.exp |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

--- NEW FILE gdb-6.7-testsuite-stable-results-prelink.patch ---
http://sourceware.org/ml/gdb-patches/2010-03/msg01006.html
Subject: [patch or FYI] testsuite: Fix prelink.exp on system w/unprelinked  system libs

Hi,

this is a more conservative variant superseded by:
	[patch 4/6] testsuite: Unify to lib/prelink-support.exp
	http://sourceware.org/ml/gdb-patches/2010-03/msg01002.html
where gdb.base/prelink.exp is reworked on generic lib/prelink-support.exp.

I prefer the [patch 4/6] over this patch but this mail can serve also as an
illustration of the current problem.

------------------------------------------------------------------------------

If your system for some reason currently does not have all the libraries
prelinked gdb.base/prelink.exp will get UNRESOLVED randomly also affecting
testsuite results diff.

Apparently the testcase already tried to avoid any system libraries
dependencies by "-nodefaultlibs".  But currently it does has not worked that
way.

"-lm" is contained already even in dejagnu's default_target_compile (not just
in gdb/testsuite/lib/ada.exp).  But I do not know why it is there and which
systems would get broken by some global gdb/testsuite/ "-lm" removal.


Thanks,
Jan


2010-03-29  Jan Kratochvil  <jan.kratochvil at redhat.com>

	Fix testcase false UNRESOLVED if system libraries are not prelinked.
	* gdb.base/prelink.exp: New variables compile, board, err and mathlib.
	Set clear board mathlib for ${libfile} compilation.

--- a/gdb/testsuite/gdb.base/prelink.exp
+++ b/gdb/testsuite/gdb.base/prelink.exp
@@ -42,7 +42,25 @@ set testfile "prelink"
 
 set libsrcfile ${testfile}-lib.c
 set libfile ${objdir}/${subdir}/${testfile}.so
-if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
+
+# default_target_compile would otherwise add "-lm" making the testcase
+# dependent on whether the system libraries are already prelinked.
+# prelink: Could not set /lib64/libm-2.11.1.so owner or mode: Operation not permitted
+set compile {
+    gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]
+}
+set board [target_info name]
+if [board_info $board exists mathlib] {
+    set mathlib [board_info $dest mathlib]
+    set_board_info mathlib ""
+    set err [eval $compile]
+    set_board_info mathlib $mathlib
+} else {
+    set_board_info mathlib ""
+    set err [eval $compile]
+    unset_board_info mathlib
+}
+if {$err != ""} {
     # If creating the shared library fails, maybe we don't have the right tools
     return -1
 }


gdb-archer-ada.patch:
 dwarf2read.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- NEW FILE gdb-archer-ada.patch ---
From: Keith Seitz <keiths at redhat.com>
Message-ID: <4B7F207A.7020102 at redhat.com>

[ read_partial_die part dropped in the port to Rawhide ]

--- gdb-7.0.1-orig/gdb/dwarf2read.c	2010-02-20 01:06:44.000000000 +0100
+++ gdb-7.0.1/gdb/dwarf2read.c	2010-02-20 01:08:28.000000000 +0100
@@ -9924,9 +9928,13 @@ dwarf2_canonicalize_name (char *name, st
 static char *
 dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
 {
-  struct attribute *attr;
+  struct attribute *attr = NULL;
+
+  if (cu->language == language_ada)
+    attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
 
-  attr = dwarf2_attr (die, DW_AT_name, cu);
+  if (!attr)
+    attr = dwarf2_attr (die, DW_AT_name, cu);
   if (!attr || !DW_STRING (attr))
     return NULL;
 

gdb-archer-next-over-throw-cxx-exec.patch:
 breakpoint.c                 |    7 +----
 testsuite/gdb.cp/cxxexec.cc  |   25 +++++++++++++++++++++
 testsuite/gdb.cp/cxxexec.exp |   51 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+), 5 deletions(-)

--- NEW FILE gdb-archer-next-over-throw-cxx-exec.patch ---
Archer-upstreamed:
http://sourceware.org/ml/archer/2010-q2/msg00031.html

--- ./gdb/breakpoint.c	2010-05-29 01:12:32.000000000 +0200
+++ ./gdb/breakpoint.c	2010-05-29 01:22:21.000000000 +0200
@@ -1679,14 +1679,11 @@ create_exception_master_breakpoint (void
       debug_hook = lookup_minimal_symbol_text ("_Unwind_DebugHook", objfile);
       if (debug_hook != NULL)
 	{
-	  CORE_ADDR pc;
 	  struct breakpoint *b;
 
-	  pc = find_function_start_pc (get_objfile_arch (objfile),
-				       SYMBOL_VALUE_ADDRESS (debug_hook),
-				       SYMBOL_OBJ_SECTION (debug_hook));
 	  b = create_internal_breakpoint (get_objfile_arch (objfile),
-					  pc, bp_exception_master);
+					  SYMBOL_VALUE_ADDRESS (debug_hook),
+					  bp_exception_master);
 	  b->addr_string = xstrdup ("_Unwind_DebugHook");
 	  b->enable_state = bp_disabled;
 	}
--- ./gdb/testsuite/gdb.cp/cxxexec.cc	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.cp/cxxexec.cc	2010-05-29 01:18:56.000000000 +0200
@@ -0,0 +1,25 @@
+/* This test script is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+
+int
+main()
+{
+  execlp ("true", "true", NULL);
+  return 1;
+}
--- ./gdb/testsuite/gdb.cp/cxxexec.exp	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.cp/cxxexec.exp	2010-05-29 01:29:25.000000000 +0200
@@ -0,0 +1,51 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_cplus_tests] } { continue }
+
+set testfile cxxexec
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
+    return -1
+}
+
+runto_main
+
+# We could stop after `continue' again at `main'.
+delete_breakpoints
+
+set test "p _Unwind_DebugHook"
+gdb_test_multiple $test $test {
+    -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
+	pass $test
+    }
+    -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
+	xfail $test
+	untested ${testfile}.exp
+	return -1
+    }
+}
+
+set test continue
+gdb_test_multiple $test $test {
+    -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
+	fail $test
+    }
+    -re "\r\n$gdb_prompt $" {
+	pass $test
+    }
+}
+
+# `info inferiors' can show <null> on older GDBs.
+gdb_test "info threads" "info threads" "program finished"

gdb-archer-vla-ref-optimizedout.patch:
 dwarf2loc.c                                |    3 ++
 dwarf2read.c                               |    5 +++
 testsuite/gdb.dwarf2/dw2-bound-loclist.S   |   38 ++++++++++++++++++++++++++++-
 testsuite/gdb.dwarf2/dw2-bound-loclist.exp |    3 ++
 4 files changed, 48 insertions(+), 1 deletion(-)

--- NEW FILE gdb-archer-vla-ref-optimizedout.patch ---
commit a683bac73af74a757591672d89d720169c0b5ec9
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Thu May 13 18:08:30 2010 +0200

    Support DW_AT_upper_bound is referencing an optimized-out variable.
    https://bugzilla.redhat.com/show_bug.cgi?id=591879

--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -383,6 +383,9 @@ dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton,
   size_t size;
   struct value *val;
 
+  if (!dllbaton)
+    return 0;
+
   data = find_location_expression (dllbaton, &size,
 				   get_frame_address_in_block (frame));
   if (data == NULL)
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -11693,6 +11693,11 @@ dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
 {
   struct dwarf2_loclist_baton *baton;
 
+  /* DW_AT_location of the referenced DIE may be missing if the referenced
+     variable has been optimized out.  */
+  if (!attr)
+    return NULL;
+
   if (!(attr_form_is_section_offset (attr)
 	/* ".debug_loc" may not exist at all, or the offset may be outside
 	   the section.  If so, fall through to the complaint in the
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
@@ -51,6 +51,17 @@ vardata:
 	.4byte		.Llen_var-.Lcu1_begin	/* DW_AT_upper_bound */
 	.byte		0			/* End of children of die */
 
+	/* DW_AT_upper_bound is referencing an optimized-out variable.  */
+.Larrayb_type:
+	.uleb128	2			/* Abbrev: DW_TAG_array_type */
+	.4byte		.Lchar_type-.Lcu1_begin	/* DW_AT_type */
+
+	.uleb128	3			/* Abbrev: DW_TAG_subrange_type */
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
+	.byte		0			/* DW_AT_lower_bound */
+	.4byte		.Llenb_var-.Lcu1_begin	/* DW_AT_upper_bound */
+	.byte		0			/* End of children of die */
+
 .Luint_type:
 	.uleb128	4			/* Abbrev: DW_TAG_base_type */
 	.4byte		.Luint_str		/* DW_AT_name */
@@ -69,9 +80,24 @@ vardata:
 	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
 	.4byte		.Llen_loclist-.Lloclist	/* DW_AT_location */
 
+	/* optimized-out variable for b_string.  */
+.Llenb_var:
+	.uleb128	7			/* Abbrev: DW_TAG_variable artificial no DW_AT_location */
+	.byte		1			/* DW_AT_artificial */
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
+
 	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
 	.string		"a_string"		/* DW_AT_name */
-	.4byte		.Larray_type-.Lcu1_begin/* DW_AT_type */
+	.4byte		.Larray_type-.Lcu1_begin /* DW_AT_type */
+	.byte		2f - 1f			/* DW_AT_location */
+1:	.byte		3			/*   DW_OP_addr */
+	.4byte		vardata			/*   <addr> */
+2:
+
+	/* DW_AT_upper_bound is referencing an optimized-out variable.  */
+	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
+	.string		"b_string"		/* DW_AT_name */
+	.4byte		.Larrayb_type-.Lcu1_begin /* DW_AT_type */
 	.byte		2f - 1f			/* DW_AT_location */
 1:	.byte		3			/*   DW_OP_addr */
 	.4byte		vardata			/*   <addr> */
@@ -164,6 +190,16 @@ vardata:
 	.byte		0x0			/* Terminator */
 	.byte		0x0			/* Terminator */
 
+	.uleb128	7			/* Abbrev code */
+	.uleb128	0x34			/* DW_TAG_variable */
+	.byte		0x0			/* no_children */
+	.uleb128	0x34			/* DW_AT_artificial */
+	.uleb128	0x0c			/* DW_FORM_flag */
+	.uleb128	0x49			/* DW_AT_type */
+	.uleb128	0x13			/* DW_FORM_ref4 */
+	.byte		0x0			/* Terminator */
+	.byte		0x0			/* Terminator */
+
 	.byte		0x0			/* Terminator */
 
 /* String table */
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
@@ -46,3 +46,6 @@ if ![runto "*main"] {
 
 gdb_test "p a_string" { = "seen"}
 gdb_test "ptype a_string" {type = char \[4\]}
+
+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
+gdb_test "ptype b_string" {type = char \[\]}

gdb-archer-vla-test-oom.patch:
 vla-overflow.exp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- NEW FILE gdb-archer-vla-test-oom.patch ---
commit ec5a7769d5c05542d12fc21afa25f32360db7de4
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Wed May 12 22:00:46 2010 +0200

    Fix mb_reserve:
    	https://bugzilla.redhat.com/show_bug.cgi?id=590635

diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp
index 7203a48..24a608f 100644
--- a/gdb/testsuite/gdb.base/vla-overflow.exp
+++ b/gdb/testsuite/gdb.base/vla-overflow.exp
@@ -66,7 +66,8 @@ proc memory_v_pages_get {} {
 
 set pages_found [memory_v_pages_get]
 
-set mb_reserve 10
+# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
+set mb_reserve 40
 verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
 set kb_found [expr $pages_found * $pagesize / 1024]
 set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]

gdb-bz539590-gnu-ifunc-fix-cond.patch:
 breakpoint.c |    5 +++++
 1 file changed, 5 insertions(+)

--- NEW FILE gdb-bz539590-gnu-ifunc-fix-cond.patch ---
--- ./gdb/breakpoint.c	2010-04-26 02:35:53.000000000 +0200
+++ ./gdb/breakpoint.c	2010-04-26 02:33:26.000000000 +0200
@@ -8499,6 +8499,11 @@ update_breakpoint_locations (struct brea
 	{
 	  struct gdb_exception e;
 
+	  /* Temporary workaround before the non-intrusive ifunc patch gets in.
+	     exp parsing can now call inferior function invalidating
+	     EXISTING_LOCATIONS.  */
+	  existing_locations = NULL;
+
 	  s = b->cond_string;
 	  TRY_CATCH (e, RETURN_MASK_ERROR)
 	    {

gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch:
 printers.py |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

--- NEW FILE gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch ---
2010-06-01  Chris Moller  <cmoller at redhat.com>

	* python/libstdcxx/v6/printers.py (StdVectorPrinter): Add
	detection for matrices as nested vectors.

Index: libstdc++-v3/python/libstdcxx/v6/printers.py
===================================================================
--- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py	(revision 159937)
+++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py	(working copy)
@@ -19,6 +19,9 @@
 import itertools
 import re
 
+vector_sig = 'std::vector'
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
+
 class StdPointerPrinter:
     "Print a smart pointer of some kind"
 
@@ -186,7 +189,13 @@
                 % (self.typename, int (finish - start), int (end - start)))
 
     def display_hint(self):
-        return 'array'
+        itype0  = self.val.type.template_argument(0)
+        itag = itype0.tag
+        if itag and re.match(vector_regex, itag):
+            rc = 'matrix'
+        else:
+            rc = 'array'
+        return rc 
 
 class StdVectorIteratorPrinter:
     "Print std::vector::iterator"
@@ -692,7 +701,7 @@
     pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
     pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
     pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
-    pretty_printers_dict[re.compile('^std::vector<.*>$')] = lambda val: StdVectorPrinter("std::vector", val)
+    pretty_printers_dict[vector_regex] = lambda val: StdVectorPrinter(vector_sig, val)
     # vector<bool>
 
     # Printer registrations for classes compiled with -D_GLIBCXX_DEBUG.

gdb-bz562763-pretty-print-2d-vectors-prereq.patch:
 doc/gdb.texinfo                         |    3 
 python/py-prettyprint.c                 |  117 +++++++++++++++++++-------------
 testsuite/gdb.python/py-mi.exp          |   35 +++++++++
 testsuite/gdb.python/py-prettyprint.c   |   17 ++++
 testsuite/gdb.python/py-prettyprint.exp |    1 
 testsuite/gdb.python/py-prettyprint.py  |   29 +++++++
 6 files changed, 155 insertions(+), 47 deletions(-)

--- NEW FILE gdb-bz562763-pretty-print-2d-vectors-prereq.patch ---
commit e5ea8d026015c2a0c7774788b425914857de1ffb
Author: pmuldoon <pmuldoon>
Date:   Wed Apr 14 12:02:42 2010 +0000

    2010-04-14  Phil Muldoon  <pmuldoon at redhat.com>
    
    	PR python/11381
    
    	* python/py-prettyprint.c (pretty_print_one_value): Test for
    	Py_None.
    	(print_string_repr): Test for Py_None.  Set flags accordingly.
    	Return value depending on return type.
    	(print_children): Take a value indicating whether data was printed
    	before this function was called.  Alter output accordingly.
    	(apply_val_pretty_printer): Capture return value from
    	print_string_repr and pass to print_children.
    
    2010-04-14  Phil Muldoon  <pmuldoon at redhat.com>
    
    	* gdb.python/py-prettyprint.py (NoStringContainerPrinter): New printer.
    	* gdb.python/py-prettyprint.c: Add justchildren struct, typedefs.
    	* gdb.python/py-prettyprint.exp: New test for to_string returning None.
    	* gdb.python/py-mi.exp: New test for to_string returning None.
    
    2010-04-14  Phil Muldoon  <pmuldoon at redhat.com>
    
    	* gdb.texinfo (Pretty Printing): Document behaviour when to_string
    	returns None.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,16 @@
+2010-04-14  Phil Muldoon  <pmuldoon at redhat.com>
+
+	PR python/11381
+
+	* python/py-prettyprint.c (pretty_print_one_value): Test for
+	Py_None.
+	(print_string_repr): Test for Py_None.  Set flags accordingly.
+	Return value depending on return type.
+	(print_children): Take a value indicating whether data was printed
+	before this function was called.  Alter output accordingly.
+	(apply_val_pretty_printer): Capture return value from
+	print_string_repr and pass to print_children.
+
 2010-04-13  Mark Kettenis  <kettenis at gnu.org>
 
 	PR corefiles/11481
### a/gdb/doc/ChangeLog
### b/gdb/doc/ChangeLog
## -1,3 +1,8 @@
+2010-04-14  Phil Muldoon  <pmuldoon at redhat.com>
+
+	* gdb.texinfo (Pretty Printing): Document behaviour when to_string
+	returns None.
+
 2010-04-09  Stan Shebs  <stan at codesourcery.com>
 
 	* gdb.texinfo (gdb/mi Tracepoint Commands) <-trace-status>:
Index: gdb-7.1/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.1.orig/gdb/doc/gdb.texinfo	2010-06-30 03:22:07.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo	2010-06-30 03:22:20.000000000 +0200
@@ -20344,6 +20344,9 @@ the resulting value.  Again, this may re
 pretty-printer.  Python scalars (integers, floats, and booleans) and
 strings are convertible to @code{gdb.Value}; other types are not.
 
+Finally, if this method returns @code{None} then no further operations
+are peformed in this method and nothing is printed.
+
 If the result is not one of these types, an exception is raised.
 @end defop
 
Index: gdb-7.1/gdb/python/py-prettyprint.c
===================================================================
--- gdb-7.1.orig/gdb/python/py-prettyprint.c	2010-06-30 03:22:02.000000000 +0200
+++ gdb-7.1/gdb/python/py-prettyprint.c	2010-06-30 03:23:38.000000000 +0200
@@ -125,9 +125,12 @@ find_pretty_printer (PyObject *value)
 
 /* Pretty-print a single value, via the printer object PRINTER.
    If the function returns a string, a PyObject containing the string
-   is returned.  Otherwise, if the function returns a value,
-   *OUT_VALUE is set to the value, and NULL is returned.  On error,
-   *OUT_VALUE is set to NULL, and NULL is returned.  */
+   is returned.  If the function returns Py_NONE that means the pretty
+   printer returned the Python None as a value.  Otherwise, if the
+   function returns a value,  *OUT_VALUE is set to the value, and NULL
+   is returned.  On error, *OUT_VALUE is set to NULL, and NULL is
+   returned.  */
+
 static PyObject *
 pretty_print_one_value (PyObject *printer, struct value **out_value)
 {
@@ -140,7 +143,8 @@ pretty_print_one_value (PyObject *printe
       result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
       if (result)
 	{
-	  if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result))
+	  if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result)  
+	      && result != Py_None)
 	    {
 	      *out_value = convert_value_from_python (result);
  	      if (PyErr_Occurred ())
@@ -184,8 +188,11 @@ gdbpy_get_display_hint (PyObject *printe
 }
 
 /* Helper for apply_val_pretty_printer which calls to_string and
-   formats the result.  */
-static void
+   formats the result.  If the value returnd is Py_None, nothing is
+   printed and the function returns a 1; in all other cases data is
+   printed as given by the pretty printer and the function returns 0.
+*/
+static int
 print_string_repr (PyObject *printer, const char *hint,
 		   struct ui_file *stream, int recurse,
 		   const struct value_print_options *options,
@@ -194,52 +201,58 @@ print_string_repr (PyObject *printer, co
 {
   struct value *replacement = NULL;
   PyObject *py_str = NULL;
+  int is_py_none = 0;
 
   py_str = pretty_print_one_value (printer, &replacement);
   if (py_str)
     {
-      gdb_byte *output = NULL;
-      long length;
-      struct type *type;
-      char *encoding = NULL;
-      PyObject *string = NULL;
-      int is_lazy;
-      
-      is_lazy = gdbpy_is_lazy_string (py_str);
-      if (is_lazy)
-	output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
+      if (py_str == Py_None)
+	is_py_none = 1;
       else
 	{
-	  string = python_string_to_target_python_string (py_str);
-	  if (string)
+	  gdb_byte *output = NULL;
+	  long length;
+	  struct type *type;
+	  char *encoding = NULL;
+	  PyObject *string = NULL;
+	  int is_lazy;
+
+	  is_lazy = gdbpy_is_lazy_string (py_str);
+	  if (is_lazy)
+	    output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
+	  else
 	    {
-	      output = PyString_AsString (string);
-	      length = PyString_Size (string);
-	      type = builtin_type (gdbarch)->builtin_char;
+	      string = python_string_to_target_python_string (py_str);
+	      if (string)
+		{
+		  output = PyString_AsString (string);
+		  length = PyString_Size (string);
+		  type = builtin_type (gdbarch)->builtin_char;
+		}
+	      else
+		gdbpy_print_stack ();
+	      
+	    }
+	
+	  if (output)
+	    {
+	      if (is_lazy || (hint && !strcmp (hint, "string")))
+		LA_PRINT_STRING (stream, type, output, length, encoding,
+				 0, options);
+	      else
+		fputs_filtered (output, stream);
 	    }
 	  else
 	    gdbpy_print_stack ();
 	  
-	}
-      
-      if (output)
-	{
-	  if (is_lazy || (hint && !strcmp (hint, "string")))
-	    LA_PRINT_STRING (stream, type, output, length, encoding,
-			     0, options);
+	  if (string)
+	    Py_DECREF (string);
 	  else
-	    fputs_filtered (output, stream);
-	}
-      else
-	gdbpy_print_stack ();
-      
-      if (string)
-	Py_DECREF (string);
-      else
-	xfree (output);
+	    xfree (output);
       
-      xfree (encoding);
-      Py_DECREF (py_str);
+	  xfree (encoding);
+	  Py_DECREF (py_str);
+	}
     }
   else if (replacement)
     {
@@ -250,6 +263,8 @@ print_string_repr (PyObject *printer, co
     }
   else
     gdbpy_print_stack ();
+
+  return is_py_none;
 }
 
 static void
@@ -328,12 +343,14 @@ push_dummy_python_frame ()
 }
 
 /* Helper for apply_val_pretty_printer that formats children of the
-   printer, if any exist.  */
+   printer, if any exist.  If is_py_none is true, then nothing has
+   been printed by to_string, and format output accordingly. */
 static void
 print_children (PyObject *printer, const char *hint,
 		struct ui_file *stream, int recurse,
 		const struct value_print_options *options,
-		const struct language_defn *language)
+		const struct language_defn *language,
+		int is_py_none)
 {
   int is_map, is_array, done_flag, pretty;
   unsigned int i;
@@ -413,7 +430,13 @@ print_children (PyObject *printer, const
 	 2. Arrays.  Always print a ",".
 	 3. Other.  Always print a ",".  */
       if (i == 0)
-	fputs_filtered (" = {", stream);
+	{
+         if (is_py_none)
+           fputs_filtered ("{", stream);
+         else
+           fputs_filtered (" = {", stream);
+       }
+
       else if (! is_map || i % 2 == 0)
 	fputs_filtered (pretty ? "," : ", ", stream);
 
@@ -537,7 +560,7 @@ apply_val_pretty_printer (struct type *t
   char *hint = NULL;
   struct cleanup *cleanups;
   int result = 0;
-
+  int is_py_none = 0;
   cleanups = ensure_python_env (gdbarch, language);
 
   /* Instantiate the printer.  */
@@ -562,9 +585,11 @@ apply_val_pretty_printer (struct type *t
   make_cleanup (free_current_contents, &hint);
 
   /* Print the section */
-  print_string_repr (printer, hint, stream, recurse, options, language,
-		     gdbarch);
-  print_children (printer, hint, stream, recurse, options, language);
+  is_py_none = print_string_repr (printer, hint, stream, recurse,
+				  options, language, gdbarch);
+  print_children (printer, hint, stream, recurse, options, language,
+		  is_py_none);
+
   result = 1;
 
 
Index: gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-mi.exp	2010-01-14 09:03:37.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp	2010-06-30 03:22:20.000000000 +0200
@@ -61,6 +61,16 @@ mi_list_varobj_children container {
 
 mi_delete_varobj container "delete varobj"
 
+mi_create_dynamic_varobj nscont nstype \
+  "create nscont varobj, no pretty-printing"
+
+mi_list_varobj_children nscont {
+  { nscont.len len 0 int }
+  { nscont.elements elements 1 "int ." }
+} "examine nscont children=0, no pretty-printing"
+
+mi_delete_varobj nscont "delete varobj"
+
 mi_gdb_test "-enable-pretty-printing" ""
 
 mi_create_varobj_checked string string_1 \
@@ -239,4 +249,29 @@ mi_continue_to_line \
 
 mi_varobj_update_with_type_change container int 0 "update after type change"
 
+
+mi_continue_to_line \
+    [gdb_get_line_number {break to inspect struct and union} ${testfile}.c] \
+    "step to outer breakpoint"
+
+mi_create_dynamic_varobj nscont nstype \
+  "create nstype varobj"
+
+mi_list_varobj_children nscont {
+    { {nscont.\[0\]} {\[0\]} 0 int }
+    { {nscont.\[1\]} {\[1\]} 0 int }
+} "list children after setting update range"
+
+mi_gdb_test "-var-set-visualizer nscont None" \
+  "\\^done" \
+  "clear visualizer"
+
+mi_gdb_test "-var-update nscont" \
+  "\\^done,changelist=\\\[\\\]" \
+  "varobj update after clearing"
+
+mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \
+  "\\^done" \
+  "choose default visualizer"
+
 remote_file host delete ${remote_python_file}
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.c	2010-01-14 09:03:37.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c	2010-06-30 03:22:20.000000000 +0200
@@ -119,6 +119,15 @@ typedef struct string_repr
 
 /* This lets us avoid malloc.  */
 int array[100];
+int narray[10];
+
+struct justchildren
+{
+  int len;
+  int *elements;
+};
+
+typedef struct justchildren nostring_type;
 
 struct container
 {
@@ -196,7 +205,9 @@ main ()
   const struct string_repr cstring = { { "const string" } };
   /* Clearing by being `static' could invoke an other GDB C++ bug.  */
   struct nullstr nullstr;
-
+  nostring_type nstype;
+  nstype.elements = narray;
+  nstype.len = 0;
 
   init_ss(&ss, 1, 2);
   init_ss(ssa+0, 3, 4);
@@ -249,5 +260,9 @@ main ()
   do_nothing ();
 #endif
 
+  nstype.elements[0] = 7;
+  nstype.elements[1] = 42;
+  nstype.len = 2;
+  
   return 0;      /* break to inspect struct and union */
 }
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.exp	2010-06-30 03:22:02.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp	2010-06-30 03:24:14.000000000 +0200
@@ -115,6 +115,7 @@ proc run_lang_tests {lang} {
 
     gdb_test "print nullstr" "RuntimeError: Error reading string from inferior.*"
 
+    gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
     gdb_test "continue" "Program exited normally\."
 
     remote_file host delete ${remote_python_file}
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.py	2010-01-14 09:03:37.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py	2010-06-30 03:22:20.000000000 +0200
@@ -53,6 +53,33 @@ class ContainerPrinter:
     def children(self):
         return self._iterator(self.val['elements'], self.val['len'])
 
+# Test a printer where to_string is None
+class NoStringContainerPrinter:
+    class _iterator:
+        def __init__ (self, pointer, len):
+            self.start = pointer
+            self.pointer = pointer
+            self.end = pointer + len
+
+        def __iter__(self):
+            return self
+
+        def next(self):
+            if self.pointer == self.end:
+                raise StopIteration
+            result = self.pointer
+            self.pointer = self.pointer + 1
+            return ('[%d]' % int (result - self.start), result.dereference())
+
+    def __init__(self, val):
+        self.val = val
+
+    def to_string(self):
+        return None
+
+    def children(self):
+        return self._iterator(self.val['elements'], self.val['len'])
+
 class pp_s:
     def __init__(self, val):
         self.val = val
@@ -190,8 +217,10 @@ def register_pretty_printers ():
     # both the C and C++ cases.
     pretty_printers_dict[re.compile ('^struct string_repr$')] = string_print
     pretty_printers_dict[re.compile ('^struct container$')] = ContainerPrinter
+    pretty_printers_dict[re.compile ('^struct justchildren$')] = NoStringContainerPrinter
     pretty_printers_dict[re.compile ('^string_repr$')] = string_print
     pretty_printers_dict[re.compile ('^container$')] = ContainerPrinter
+    pretty_printers_dict[re.compile ('^justchildren$')] = NoStringContainerPrinter
     
     pretty_printers_dict[re.compile ('^struct ns$')]  = pp_ns
     pretty_printers_dict[re.compile ('^ns$')]  = pp_ns

gdb-bz562763-pretty-print-2d-vectors.patch:
 python/py-prettyprint.c          |   56 ++++++++++++++++----
 testsuite/gdb.python/pr10659.cc  |   43 +++++++++++++++
 testsuite/gdb.python/pr10659.exp |   82 +++++++++++++++++++++++++++++
 testsuite/gdb.python/pr10659.py  |  109 +++++++++++++++++++++++++++++++++++++++
 valprint.c                       |    3 -
 valprint.h                       |    3 +
 6 files changed, 285 insertions(+), 11 deletions(-)

--- NEW FILE gdb-bz562763-pretty-print-2d-vectors.patch ---
2010-05-31  Chris Moller  <cmoller at redhat.com>

	* python/py-prettyprint.c (print_children): Add formatting for
	matrices. (apply_val_pretty_printer): Detect and deal with matrix
	hints. 


2010-05-31  Chris Moller  <cmoller at redhat.com>

	* gdb.python/Makefile.in (EXECUTABLES):  Added pr10659.
	* gdb.python/pr10659.cc:  New file.
	* gdb.python/pr10659.exp.  New file.
	* gdb.python/pr10659.py: New file.

Index: gdb-7.1/gdb/valprint.h
===================================================================
--- gdb-7.1.orig/gdb/valprint.h	2010-06-30 14:02:16.000000000 +0200
+++ gdb-7.1/gdb/valprint.h	2010-06-30 14:35:24.000000000 +0200
@@ -90,6 +90,9 @@ struct value_print_options
 
   /* If nonzero, print the value in "summary" form.  */
   int summary;
+
+  /* Affects pretty printing of matrices.  */
+  int prettyprint_matrix;
 };
 
 /* The global print options set by the user.  In general this should
Index: gdb-7.1/gdb/python/py-prettyprint.c
===================================================================
--- gdb-7.1.orig/gdb/python/py-prettyprint.c	2010-06-30 14:01:40.000000000 +0200
+++ gdb-7.1/gdb/python/py-prettyprint.c	2010-06-30 14:34:49.000000000 +0200
@@ -385,7 +385,8 @@ print_children (PyObject *printer, const
 
   /* Use the prettyprint_arrays option if we are printing an array,
      and the pretty option otherwise.  */
-  pretty = is_array ? options->prettyprint_arrays : options->pretty;
+  pretty = (is_array || options->prettyprint_matrix) ?
+    options->prettyprint_arrays : options->pretty;
 
   /* Manufacture a dummy Python frame to work around Python 2.4 bug,
      where it insists on having a non-NULL tstate->frame when
@@ -397,6 +398,9 @@ print_children (PyObject *printer, const
       goto done;
     }
   make_cleanup_py_decref (frame);
+  
+  if (options->prettyprint_matrix && recurse == 0)
+    fputs_filtered ("\n", stream);
 
   done_flag = 0;
   for (i = 0; i < options->print_max; ++i)
@@ -431,12 +435,23 @@ print_children (PyObject *printer, const
 	 3. Other.  Always print a ",".  */
       if (i == 0)
 	{
-         if (is_py_none)
-           fputs_filtered ("{", stream);
-         else
-           fputs_filtered (" = {", stream);
+	  if (options->prettyprint_matrix && recurse == 0)
+	    print_spaces_filtered (2 + 2 * recurse, stream);
+	  if (is_py_none)
+	    {
+	      if (options->prettyprint_matrix && strcmp (hint, "array"))
+		{
+		  fputs_filtered ("{\n", stream);
+		  print_spaces_filtered (4 + 2 * recurse, stream);
+		}
+	      else
+		fputs_filtered ("{", stream);
+	    }
+	  else
+	    fputs_filtered (" = {", stream);
        }
-
+      else if (options->prettyprint_matrix)
+	print_spaces_filtered (4 + 2 * recurse, stream);
       else if (! is_map || i % 2 == 0)
 	fputs_filtered (pretty ? "," : ", ", stream);
 
@@ -465,6 +480,10 @@ print_children (PyObject *printer, const
 
       if (is_map && i % 2 == 0)
 	fputs_filtered ("[", stream);
+      else if (options->prettyprint_matrix)
+	{
+	  /* Force a do-nothing.  */
+	}
       else if (is_array)
 	{
 	  /* We print the index, not whatever the child method
@@ -539,7 +558,12 @@ print_children (PyObject *printer, const
 	  fputs_filtered ("\n", stream);
 	  print_spaces_filtered (2 * recurse, stream);
 	}
-      fputs_filtered ("}", stream);
+      if (options->prettyprint_matrix)
+      {
+	print_spaces_filtered (4 * recurse, stream);
+	fputs_filtered ("}\n", stream);
+      }
+      else fputs_filtered ("}", stream);
     }
 
  done:
@@ -561,6 +585,7 @@ apply_val_pretty_printer (struct type *t
   struct cleanup *cleanups;
   int result = 0;
   int is_py_none = 0;
+  struct value_print_options *options_copy;
   cleanups = ensure_python_env (gdbarch, language);
 
   /* Instantiate the printer.  */
@@ -582,12 +607,23 @@ apply_val_pretty_printer (struct type *t
 
   /* If we are printing a map, we want some special formatting.  */
   hint = gdbpy_get_display_hint (printer);
+  
+  if (recurse == 0)
+    {
+      options_copy = alloca (sizeof (struct value_print_options));
+      memcpy (options_copy, options, sizeof (struct value_print_options));
+      options_copy->prettyprint_matrix = hint && !strcmp (hint, "matrix");
+    }
+  else options_copy = (struct value_print_options *)options;
+
   make_cleanup (free_current_contents, &hint);
 
   /* Print the section */
-  is_py_none = print_string_repr (printer, hint, stream, recurse,
-				  options, language, gdbarch);
-  print_children (printer, hint, stream, recurse, options, language,
+  is_py_none = options_copy->prettyprint_matrix ?
+    1 : print_string_repr (printer, hint, stream,
+			   recurse, options_copy,
+			   language, gdbarch);
+  print_children (printer, hint, stream, recurse, options_copy, language,
 		  is_py_none);
 
   result = 1;
Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc	2010-06-30 14:34:49.000000000 +0200
@@ -0,0 +1,43 @@
+#include <list>
+#include <vector>  // /usr/include/c++/4.4.1/bits/vector.tcc
+#include <iostream>
+
+using namespace std;
+
+int use_windows = 9999;
+
+int
+main(){
+  vector<int> test1(2,0);
+  test1[0]=8;
+  test1[1]=9;
+  
+  vector< vector<int> > test2(3, vector<int>(2,0));
+  test2[0][0]=0;
+  test2[0][1]=1;
+  test2[1][0]=2;
+  test2[1][1]=3;
+  test2[2][0]=4;
+  test2[2][1]=5;
+
+#define NR_ROWS    2
+#define NR_COLS    3
+#define NR_PLANES  4
+  vector<int> rows(NR_ROWS, 0);
+  vector< vector<int> > columns(NR_COLS, rows);
+  vector< vector < vector<int> > > test3(NR_PLANES, columns);
+
+  cout << "rows.size() = " << rows.size()
+       << ", columns.size() = " << columns.size()
+       << ", test3.size() = " << test3.size() << "\n";
+
+  for (int i = 0; i < rows.size(); i++) {
+    for (int j = 0; j < columns.size(); j++) {
+      for (int k = 0; k < test3.size(); k++) {
+	test3[k][j][i] = k * 100 + j * 10 + i;
+      }
+    }
+  }
+  
+  return 0;  // break
+}
Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.exp
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.exp	2010-06-30 14:34:49.000000000 +0200
@@ -0,0 +1,82 @@
+#Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set nl             "\[\r\n\]+"
+
+set testfile pr10659
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+    return -1
+}
+
+#if { [skip_python_tests] } { continue }
+
+gdb_test "python execfile(\"$srcdir/$subdir/pr10659.py\")" ""
+gdb_test "python gdb.pretty_printers = \[lookup_function\]" ""
+
+if ![runto_main] then {
+    fail "Can't run to main"
+    return
+}
+
+gdb_breakpoint [gdb_get_line_number "break"]
+gdb_continue_to_breakpoint "break"
+
+gdb_test "p test1" "vector of length 2, capacity 2 =.*"
+
+gdb_test "p test2" "= $nl  {$nl    {.*"
+
+# Complete result is:
+#
+# (gdb) p test2
+# $2 =
+#   {
+#     {0      1    }
+#     {2      3    }
+#     {4      5    }
+#  }
+
+
+gdb_test "p test3" "= $nl  {$nl    {$nl      {.*"
+
+# Complete result is:
+#
+# (gdb) p test3
+# $3 =
+#   {
+#     {
+#       {0        1        }
+#       {10        11        }
+#       {20        21        }
+#     }
+#     {
+#       {100        101        }
+#       {110        111        }
+#       {120        121        }
+#     }
+#     {
+#       {200        201        }
+#       {210        211        }
+#       {220        221        }
+#     }
+#     {
+#       {300        301        }
+#       {310        311        }
+#       {320        321        }
+#     }
+#  }
+# 
+
+
Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.py
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.py	2010-06-30 14:34:49.000000000 +0200
@@ -0,0 +1,109 @@
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+import itertools
+import re
+
+vector_sig = 'std::vector'
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
+
+class FakeVectorPrinter:
+    "Print a std::vector"
+
+    class _iterator:
+        def __init__ (self, start, finish):
+            self.item = start
+            self.finish = finish
+            self.count = 0
+
+        def __iter__(self):
+            return self
+
+        def next(self):
+            if self.item == self.finish:
+                raise StopIteration
+            count = self.count
+            self.count = self.count + 1
+            elt = self.item.dereference()
+            self.item = self.item + 1
+            return ('[%d]' % count, elt)
+
+    def __init__(self, typename, val):
+        self.typename = typename
+        self.val = val
+
+    def children(self):
+        return self._iterator(self.val['_M_impl']['_M_start'],
+                              self.val['_M_impl']['_M_finish'])
+
+    def to_string(self):
+        start = self.val['_M_impl']['_M_start']
+        finish = self.val['_M_impl']['_M_finish']
+        end = self.val['_M_impl']['_M_end_of_storage']
+        return ('std::vector of length %d, capacity %d'
+                % (int (finish - start), int (end - start)))
+
+    def display_hint(self):
+        itype0  = self.val.type.template_argument(0)
+        itag = itype0.tag
+        if itag and re.match(vector_regex, itag):
+            rc = 'matrix'
+        else:
+            rc = 'array'
+        return rc
+
+def register_libstdcxx_printers (obj):
+    "Register libstdc++ pretty-printers with objfile Obj."
+
+    if obj == None:
+        obj = gdb
+
+    obj.pretty_printers.append (lookup_function)
+
+def lookup_function (val):
+    "Look-up and return a pretty-printer that can print val."
+
+    # Get the type.
+    type = val.type;
+
+    # If it points to a reference, get the reference.
+    if type.code == gdb.TYPE_CODE_REF:
+        type = type.target ()
+
+    # Get the unqualified type, stripped of typedefs.
+    type = type.unqualified ().strip_typedefs ()
+
+    # Get the type name.    
+    typename = type.tag
+    if typename == None:
+        return None
+
+    # Iterate over local dictionary of types to determine
+    # if a printer is registered for that type.  Return an
+    # instantiation of the printer if found.
+    for function in fake_pretty_printers_dict:
+        if function.search (typename):
+            return fake_pretty_printers_dict[function] (val)
+        
+    # Cannot find a pretty printer.  Return None.
+    return None
+
+def build_libfakecxx_dictionary ():
+    fake_pretty_printers_dict[vector_regex] = lambda val: FakeVectorPrinter(vector_sig, val)
+
+fake_pretty_printers_dict = {}
+
+build_libfakecxx_dictionary ()
Index: gdb-7.1/gdb/valprint.c
===================================================================
--- gdb-7.1.orig/gdb/valprint.c	2010-06-30 13:51:26.000000000 +0200
+++ gdb-7.1/gdb/valprint.c	2010-06-30 14:35:41.000000000 +0200
@@ -83,7 +83,8 @@ struct value_print_options user_print_op
   1,				/* static_field_print */
   1,				/* pascal_static_field_print */
   0,				/* raw */
-  0				/* summary */
+  0,				/* summary */
+  0				/* prettyprint_matrix */
 };
 
 /* Initialize *OPTS to be a copy of the user print options.  */

gdb-bz562975-std-terminate-double-free.patch:
 breakpoint.c |   14 ++++++++++++++
 breakpoint.h |    3 +++
 infcall.c    |   33 ++++++++++++++++++++++++++-------
 3 files changed, 43 insertions(+), 7 deletions(-)

--- NEW FILE gdb-bz562975-std-terminate-double-free.patch ---
http://sourceware.org/ml/gdb-patches/2010-02/msg00625.html
Subject: RFC: fix bug with std::terminate handler

I would appreciate comments on this patch.

This comes from an automatically-reported bug in the Red Hat bugzilla:

    https://bugzilla.redhat.com/show_bug.cgi?id=562975

call_function_by_hand installs a momentary breakpoint on std::terminate,
and then deletes it later.  However, this can cause a double deletion of
the breakpoint.  In the bug, the called function is dlopen, which causes
gdb to enter solib_add, which calls breakpoint_re_set, deleting the
momentary breakpoint.

This fix works by creating the momentary breakpoint with an internal
breakpoint number, and then trying to delete the breakpoint by number.

This bug does not always manifest in a crash.  In fact, I couldn't make
it crash here, but I could observe the problem under valgrind.

Built and regtested on x86-64 (compile farm).  I also manually verified
it using valgrind.

I think this patch is mildly ugly, due to the introduction of
set_momentary_breakpoint_at_pc_with_number.  However, in the absence of
comments, I plan to check it in after a reasonable waiting period.

Tom

2010-02-25  Tom Tromey  <tromey at redhat.com>

	* infcall.c (do_delete_breakpoint_by_number): New function.
	(call_function_by_hand): Refer to momentary breakpoint by number.
	* breakpoint.h (set_momentary_breakpoint_at_pc_with_number):
	Declare.
	* breakpoint.c (set_momentary_breakpoint_at_pc_with_number): New
	function.

Index: gdb-7.0.90.20100312/gdb/breakpoint.c
===================================================================
--- gdb-7.0.90.20100312.orig/gdb/breakpoint.c	2010-03-12 14:54:26.000000000 +0100
+++ gdb-7.0.90.20100312/gdb/breakpoint.c	2010-03-12 14:54:53.000000000 +0100
@@ -6115,6 +6115,20 @@ set_momentary_breakpoint_at_pc (struct g
 
   return set_momentary_breakpoint (gdbarch, sal, null_frame_id, type);
 }
+
+/* Like set_momentary_breakpoint_at_pc, but ensure that the new
+   breakpoint has a number.  */
+
+struct breakpoint *
+set_momentary_breakpoint_at_pc_with_number (struct gdbarch *gdbarch,
+					    CORE_ADDR pc,
+					    enum bptype type)
+{
+  struct breakpoint *result = set_momentary_breakpoint_at_pc (gdbarch, pc,
+							      type);
+  result->number = internal_breakpoint_number--;
+  return result;
+}
 
 
 /* Tell the user we have just set a breakpoint B.  */
Index: gdb-7.0.90.20100312/gdb/breakpoint.h
===================================================================
--- gdb-7.0.90.20100312.orig/gdb/breakpoint.h	2010-03-12 14:54:26.000000000 +0100
+++ gdb-7.0.90.20100312/gdb/breakpoint.h	2010-03-12 14:54:53.000000000 +0100
@@ -774,6 +774,9 @@ extern struct breakpoint *set_momentary_
 extern struct breakpoint *set_momentary_breakpoint_at_pc
   (struct gdbarch *, CORE_ADDR pc, enum bptype type);
 
+extern struct breakpoint *set_momentary_breakpoint_at_pc_with_number
+  (struct gdbarch *, CORE_ADDR pc, enum bptype type);
+
 extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt);
 
 extern void set_ignore_count (int, int, int);
Index: gdb-7.0.90.20100312/gdb/infcall.c
===================================================================
--- gdb-7.0.90.20100312.orig/gdb/infcall.c	2010-03-12 14:54:26.000000000 +0100
+++ gdb-7.0.90.20100312/gdb/infcall.c	2010-03-12 14:55:19.000000000 +0100
@@ -410,6 +410,18 @@ run_inferior_call (struct thread_info *c
   return e;
 }
 
+/* A cleanup function that deletes a breakpoint, if it still exists,
+   given the breakpoint's number.  */
+
+static void
+do_delete_breakpoint_by_number (void *arg)
+{
+  int *num = arg;
+  struct breakpoint *bp = get_breakpoint (*num);
+  if (bp)
+    delete_breakpoint (bp);
+}
+
 /* All this stuff with a dummy frame may seem unnecessarily complicated
    (why not just save registers in GDB?).  The purpose of pushing a dummy
    frame which looks just like a real frame is so that if you call a
@@ -447,7 +459,8 @@ call_function_by_hand (struct value *fun
   struct cleanup *args_cleanup;
   struct frame_info *frame;
   struct gdbarch *gdbarch;
-  struct breakpoint *terminate_bp = NULL;
+  int terminate_bp_num = 0;
+  CORE_ADDR terminate_bp_addr = 0;
   struct minimal_symbol *tm;
   struct cleanup *terminate_bp_cleanup = NULL;
   ptid_t call_thread_ptid;
@@ -765,8 +778,13 @@ call_function_by_hand (struct value *fun
        struct minimal_symbol *tm = lookup_minimal_symbol  ("std::terminate()",
 							   NULL, NULL);
        if (tm != NULL)
-	   terminate_bp = set_momentary_breakpoint_at_pc
+	 {
+	   struct breakpoint *bp;
+	   bp = set_momentary_breakpoint_at_pc_with_number
 	     (gdbarch, SYMBOL_VALUE_ADDRESS (tm),  bp_breakpoint);
+	   terminate_bp_num = bp->number;
+	   terminate_bp_addr = bp->loc->address;
+	 }
      }
 
   /* Everything's ready, push all the info needed to restore the
@@ -780,8 +798,9 @@ call_function_by_hand (struct value *fun
   discard_cleanups (inf_status_cleanup);
 
   /* Register a clean-up for unwind_on_terminating_exception_breakpoint.  */
-  if (terminate_bp)
-    terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp);
+  if (terminate_bp_num != 0)
+    terminate_bp_cleanup = make_cleanup (do_delete_breakpoint_by_number,
+					 &terminate_bp_num);
 
   /* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
      If you're looking to implement asynchronous dummy-frames, then
@@ -947,9 +966,9 @@ When the function is done executing, GDB
 		 in an inferior function call. Rewind, and warn the
 		 user.  */
 
-	      if (terminate_bp != NULL
+	      if (terminate_bp_num != 0
 		  && (inferior_thread ()->stop_bpstat->breakpoint_at->address
-		      == terminate_bp->loc->address))
+		      == terminate_bp_addr))
 		{
 		  /* We must get back to the frame we were before the
 		     dummy call.  */
@@ -998,7 +1017,7 @@ When the function is done executing, GDB
 
   /* If we get here and the std::terminate() breakpoint has been set,
      it has to be cleaned manually.  */
-  if (terminate_bp)
+  if (terminate_bp_num != 0)
     do_cleanups (terminate_bp_cleanup);
 
   /* If we get here the called FUNCTION ran to completion,

gdb-bz570635-prettyprint-doc1.patch:
 gdb.texinfo |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- NEW FILE gdb-bz570635-prettyprint-doc1.patch ---
RFA: update `print' docs
http://sourceware.org/ml/gdb-patches/2010-03/msg00236.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00048.html

### src/gdb/doc/ChangeLog	2010/03/01 17:19:22	1.1017
### src/gdb/doc/ChangeLog	2010/03/05 20:01:21	1.1018
## -1,3 +1,8 @@
+2010-03-05  Tom Tromey  <tromey at redhat.com>
+
+	* gdb.texinfo (Data): Link to pretty-printing.
+	(Output Formats): Likewise.  Correct text.
+
 2010-03-01  Daniel Jacobowitz  <dan at codesourcery.com>
 
 	* gdb.texinfo (Types): Describe <struct> and <flags>.
--- src/gdb/doc/gdb.texinfo	2010/03/01 17:19:22	1.676
+++ src/gdb/doc/gdb.texinfo	2010/03/05 20:01:21	1.677
@@ -6661,7 +6661,8 @@
 command (abbreviated @code{p}), or its synonym @code{inspect}.  It
 evaluates and prints the value of an expression of the language your
 program is written in (@pxref{Languages, ,Using @value{GDBN} with
-Different Languages}).
+Different Languages}).  It may also print the expression using a
+Python-based pretty-printer (@pxref{Pretty Printing}).
 
 @table @code
 @item print @var{expr}
@@ -7159,8 +7160,10 @@
 @item r
 @cindex raw printing
 Print using the @samp{raw} formatting.  By default, @value{GDBN} will
-use a type-specific pretty-printer.  The @samp{r} format bypasses any
-pretty-printer which might exist for the value's type.
+use a Python-based pretty-printer, if one is available (@pxref{Pretty
+Printing}).  This typically results in a higher-level display of the
+value's contents.  The @samp{r} format bypasses any Python
+pretty-printer which might exist.
 @end table
 
 For example, to print the program counter in hex (@pxref{Registers}), type

gdb-bz570635-prettyprint-doc2.patch:
 gdb.texinfo |   86 +++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 48 insertions(+), 38 deletions(-)

--- NEW FILE gdb-bz570635-prettyprint-doc2.patch ---
Re: [patch] doc-python: Pretty Printing split user / developer
http://sourceware.org/ml/gdb-patches/2010-04/msg00757.html
http://sourceware.org/ml/gdb-cvs/2010-04/msg00221.html

[ Backported for Fedora.  ]

### src/gdb/doc/ChangeLog	2010/04/22 04:09:25	1.1053
### src/gdb/doc/ChangeLog	2010/04/22 16:32:43	1.1054
## -1,3 +1,14 @@
+2010-04-22  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb.texinfo (Data): New @menu reference to Pretty Printing.
+	(Python API): Change the reference to Pretty Printing API.
+	(Pretty Printing): Move the user part under the Data node.  Reformat
+	the sample output to 72 columns.  Create a new reference to Pretty
+	Printing API.  Rename the API part ...
+	(Pretty Printing API): To a new node name.
+	(Selecting Pretty-Printers, Progspaces In Python, Objfiles In Python)
+	(GDB/MI Variable Objects): Change references to Pretty Printing API.
+
 2010-04-21  Stan Shebs  <stan at codesourcery.com>
 
 	* gdb.texinfo (Tracepoint Actions): Mention synonymy of actions
--- gdb-7.1/gdb/doc/gdb.texinfo.orig	2010-04-22 19:08:30.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo	2010-04-22 19:10:41.000000000 +0200
@@ -6727,6 +6727,7 @@ Table}.
 * Memory::                      Examining memory
 * Auto Display::                Automatic display
 * Print Settings::              Print settings
+* Pretty Printing::             Python pretty printing
 * Value History::               Value history
 * Convenience Vars::            Convenience variables
 * Registers::                   Registers
@@ -7897,6 +7898,42 @@ Do not pretty print C at t{++} virtual func
 Show whether C at t{++} virtual function tables are pretty printed, or not.
 @end table
 
+ at node Pretty Printing
+ at section Pretty Printing
+
+ at value{GDBN} provides a mechanism to allow pretty-printing of values using
+Python code.  It greatly simplifies the display of complex objects.  This
+mechanism works for both MI and the CLI.
+
+For example, here is how a C at t{++} @code{std::string} looks without a
+pretty-printer:
+
+ at smallexample
+(@value{GDBP}) print s
+$1 = @{
+  static npos = 4294967295, 
+  _M_dataplus = @{
+    <std::allocator<char>> = @{
+      <__gnu_cxx::new_allocator<char>> = @{
+        <No data fields>@}, <No data fields>
+      @},
+    members of std::basic_string<char, std::char_traits<char>,
+      std::allocator<char> >::_Alloc_hider:
+    _M_p = 0x804a014 "abcd"
+  @}
+@}
+ at end smallexample
+
+With a pretty-printer for @code{std::string} only the contents are printed:
+
+ at smallexample
+(@value{GDBP}) print s
+$2 = "abcd"
+ at end smallexample
+
+For implementing pretty printers for new types you should read the Python API
+details (@pxref{Pretty Printing API}).
+
 @node Value History
 @section Value History
 
@@ -19608,8 +19645,8 @@ situation, a Python @code{KeyboardInterr
 * Exception Handling::
 * Auto-loading::                Automatically loading Python code.
 * Values From Inferior::	Python representation of values.
-* Types In Python::		Python representation of types.
-* Pretty Printing::		Pretty-printing values.
+* Types In Python::             Python representation of types.
+* Pretty Printing API::         Pretty-printing values.
 * Selecting Pretty-Printers::   How GDB chooses a pretty-printer.
 * Inferiors In Python::		Python representation of inferiors (processes)
 * Threads In Python::           Accessing inferior threads from Python.
@@ -20241,37 +20278,10 @@ A function internal to @value{GDBN}.  Th
 convenience functions.
 @end table
 
- at node Pretty Printing
- at subsubsection Pretty Printing
-
- at value{GDBN} provides a mechanism to allow pretty-printing of values
-using Python code.  The pretty-printer API allows application-specific
-code to greatly simplify the display of complex objects.  This
-mechanism works for both MI and the CLI.
-
-For example, here is how a C at t{++} @code{std::string} looks without a
-pretty-printer:
+ at node Pretty Printing API
+ at subsubsection Pretty Printing API
 
- at smallexample
-(@value{GDBP}) print s
-$1 = @{
-  static npos = 4294967295, 
-  _M_dataplus = @{
-    <std::allocator<char>> = @{
-      <__gnu_cxx::new_allocator<char>> = @{<No data fields>@}, <No data fields>@}, 
-    members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider: 
-    _M_p = 0x804a014 "abcd"
-  @}
-@}
- at end smallexample
-
-After a pretty-printer for @code{std::string} has been installed, only
-the contents are printed:
-
- at smallexample
-(@value{GDBP}) print s
-$2 = "abcd"
- at end smallexample
+An example output is provided (@pxref{Pretty Printing}).
 
 A pretty-printer is just an object that holds a value and implements a
 specific interface, defined here.
@@ -20359,7 +20369,7 @@ attribute.
 
 A function on one of these lists is passed a single @code{gdb.Value}
 argument and should return a pretty-printer object conforming to the
-interface definition above (@pxref{Pretty Printing}).  If a function
+interface definition above (@pxref{Pretty Printing API}).  If a function
 cannot create a pretty-printer for the value, it should return
 @code{None}.
 
@@ -20436,7 +20446,7 @@ printers with a specific objfile, @value
 printers for the specific version of the library used by each
 inferior.
 
-To continue the @code{std::string} example (@pxref{Pretty Printing}),
+To continue the @code{std::string} example (@pxref{Pretty Printing API}),
 this code might appear in @code{gdb.libstdcxx.v6}:
 
 @smallexample
@@ -21048,7 +21058,7 @@ The @code{pretty_printers} attribute is 
 used to look up pretty-printers.  A @code{Value} is passed to each
 function in order; if the function returns @code{None}, then the
 search continues.  Otherwise, the return value should be an object
-which is used to format the value.  @xref{Pretty Printing}, for more
+which is used to format the value.  @xref{Pretty Printing API}, for more
 information.
 @end defivar
 
@@ -24875,7 +24885,7 @@ then this attribute will not be present.
 @item displayhint
 A dynamic varobj can supply a display hint to the front end.  The
 value comes directly from the Python pretty-printer object's
- at code{display_hint} method.  @xref{Pretty Printing}.
+ at code{display_hint} method.  @xref{Pretty Printing API}.
 @end table
 
 Typical output will look like this:
@@ -25047,7 +25057,7 @@ The result may have its own attributes:
 @item displayhint
 A dynamic varobj can supply a display hint to the front end.  The
 value comes directly from the Python pretty-printer object's
- at code{display_hint} method.  @xref{Pretty Printing}.
+ at code{display_hint} method.  @xref{Pretty Printing API}.
 
 @item has_more
 This is an integer attribute which is nonzero if there are children
@@ -25411,7 +25421,7 @@ single argument.  @value{GDBN} will call
 the varobj @var{name} as an argument (this is done so that the same
 Python pretty-printing code can be used for both the CLI and MI).
 When called, this object must return an object which conforms to the
-pretty-printing interface (@pxref{Pretty Printing}).
+pretty-printing interface (@pxref{Pretty Printing API}).
 
 The pre-defined function @code{gdb.default_visualizer} may be used to
 select a visualizer by following the built-in process

gdb-bz574483-display-sepdebug.patch:
 printcmd.c                           |    5 ++++-
 testsuite/gdb.base/solib-display.exp |    7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

--- NEW FILE gdb-bz574483-display-sepdebug.patch ---
http://sourceware.org/ml/gdb-patches/2010-04/msg00055.html
Subject: [patch] Fix dangling displays in separate debug

[ Backported.  ]

Hi,

gdb.base/solib-display.exp using _separate_ debug info:
3: c_global = gdbtypes.c:1369: internal-error: check_typedef: Assertion `type' failed.
A problem internal to GDB has been detected,

This problem was fixed before by:
	[patch 1/8] Types GC [unloading observer]
	http://sourceware.org/ml/gdb-patches/2009-05/msg00544.html
	Re: [patch 3/8] Types GC [display_uses_solib_p to exp_iterate]
	http://sourceware.org/ml/gdb-patches/2009-07/msg00054.html

but as that patchset is still not in providing this temporary fixup instead.

One may only address that gdb.base/solib-display.exp was testing symbol
in-objfile while now it tests only symbol in-sepdebug-objfile and no longer
the in-objfile case.  I find the in-sepdebug-objfile as a superset of
in-objfile test but I can rework it if anyones addresses this test change.

No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.


Thanks,
Jan


gdb/
2010-04-03  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* printcmd.c (display_uses_solib_p): Check also
	SEPARATE_DEBUG_OBJFILE.

gdb/testsuite/
2010-04-03  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* gdb.base/solib-display.exp (split solib): New.

--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1845,7 +1845,10 @@ clear_dangling_display_expressions (stru
 
   for (d = display_chain; d != NULL; d = d->next)
     if (block_objfile (d->block) == objfile
-	|| (d->exp && exp_uses_objfile (d->exp, objfile)))
+	|| (d->exp && exp_uses_objfile (d->exp, objfile))
+	|| (objfile->separate_debug_objfile
+	    && (block_objfile (d->block) == objfile->separate_debug_objfile
+		|| (d->exp && exp_uses_objfile (d->exp, objfile->separate_debug_objfile)))))
       {
 	xfree (d->exp);
 	d->exp = NULL;
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -53,6 +53,13 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
   return -1
 }
 
+set test "split solib"
+if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
+    fail $test
+} else {
+    pass $test
+}
+
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir


gdb-bz575292-delayed-physname.patch:
 dwarf2read.c                     |  122 ++++++++++++-
 testsuite/gdb.dwarf2/pr11465.S   |  355 +++++++++++++++++++++++++++++++++++++++
 testsuite/gdb.dwarf2/pr11465.exp |   39 ++++
 3 files changed, 505 insertions(+), 11 deletions(-)

--- NEW FILE gdb-bz575292-delayed-physname.patch ---
Made more safe (but less effective) by using a linked list.

Based on:
	Re: [RFA] Delayed physname computation
	http://sourceware.org/ml/gdb-patches/2010-05/msg00248.html

Neither its obstack-leak.patch nor
	[patch] Fix duplicate types for single DIE
	http://sourceware.org/ml/gdb-patches/2010-05/msg00271.html
is needed as the linked list is used instead.

--- ./gdb/dwarf2read.c	2010-05-13 18:26:22.000000000 +0200
+++ ./gdb/dwarf2read.c	2010-05-13 18:45:04.000000000 +0200
@@ -251,6 +251,28 @@ struct comp_unit_head
   unsigned int first_die_offset;
 };
 
+/* Type used for delaying computation of method physnames.
+   See comments for compute_delayed_physnames.  */
+struct delayed_method_info
+{
+  struct delayed_method_info *next;
+
+  /* The type to which the method is attached, i.e., its parent class.  */
+  struct type *type;
+
+  /* The index of the method in the type's function fieldlists.  */
+  int fnfield_index;
+
+  /* The index of the method in the fieldlist.  */
+  int index;
+
+  /* The name of the DIE.  */
+  const char *name;
+
+  /*  The DIE associated with this method.  */
+  struct die_info *die;
+};
+
 /* Internal state when decoding a particular compilation unit.  */
 struct dwarf2_cu
 {
@@ -329,6 +351,10 @@ struct dwarf2_cu
   /* Header data from the line table, during full symbol processing.  */
   struct line_header *line_header;
 
+  /* A list of methods which need to have physnames computed
+     after all type information has been read.  */
+  struct delayed_method_info *method_list;
+
   /* Mark used when releasing cached dies.  */
   unsigned int mark : 1;
 
@@ -1208,6 +1234,9 @@ static void destroy_section (struct dwar
 static struct dwarf2_locexpr_baton *dwarf2_attr_to_locexpr_baton
   (struct attribute *attr, struct dwarf2_cu *cu);
 
+static const char *dwarf2_physname (char *name, struct die_info *die,
+				    struct dwarf2_cu *cu);
+
 /* Try to locate the sections we need for DWARF 2 debugging
    information and return true if we have enough to do something.  */
 
@@ -3435,6 +3464,58 @@ load_full_comp_unit (struct dwarf2_per_c
   discard_cleanups (free_cu_cleanup);
 }
 
+/* Add a DIE to the delayed physname list.  */
+static void
+add_to_method_list (struct type *type, int fnfield_index, int index,
+		    const char *name, struct die_info *die,
+		    struct dwarf2_cu *cu)
+{
+  struct delayed_method_info *mi;
+
+  mi = xmalloc (sizeof (*mi));
+  mi->next = cu->method_list;
+  cu->method_list = mi;
+  mi->type = type;
+  mi->fnfield_index = fnfield_index;
+  mi->index = index;
+  mi->name = name;
+  mi->die = die;
+}
+
+/* Compute the physnames of any methods on the CU's method list.
+
+   The computation of method physnames is delayed in order to avoid the
+   (bad) condition that one of the method's formal parameters is of an as yet
+   incomplete type.  */
+static void
+compute_delayed_physnames (struct dwarf2_cu *cu)
+{
+  struct delayed_method_info *mi;
+  
+  for (mi = cu->method_list; mi; mi = mi->next)
+    {
+      char *physname;
+      struct fn_fieldlist *fn_flp
+	= &TYPE_FN_FIELDLIST (mi->type, mi->fnfield_index);
+      physname = (char *) dwarf2_physname ((char *) mi->name, mi->die, cu);
+      fn_flp->fn_fields[mi->index].physname = physname ? physname : "";
+    }
+}
+
+static void
+method_list_cleanup (void *arg)
+{
+  struct delayed_method_info **method_list_pointer = arg;
+
+  while (*method_list_pointer)
+    {
+      struct delayed_method_info *mi = *method_list_pointer;
+
+      *method_list_pointer = mi->next;
+      xfree (mi);
+    }
+}
+
 /* Generate full symbol information for PST and CU, whose DIEs have
    already been loaded into memory.  */
 
@@ -3447,7 +3528,7 @@ process_full_comp_unit (struct dwarf2_pe
   bfd *abfd = objfile->obfd;
   CORE_ADDR lowpc, highpc;
   struct symtab *symtab;
-  struct cleanup *back_to;
+  struct cleanup *back_to, *delayed_list_cleanup;
   CORE_ADDR baseaddr;
 
   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -3457,11 +3538,22 @@ process_full_comp_unit (struct dwarf2_pe
 
   cu->list_in_scope = &file_symbols;
 
+  /* If methods were found in the partial symbol table, we allocate one
+     big buffer to hold the entire delayed list for the CU.  */
+  delayed_list_cleanup = make_cleanup (method_list_cleanup,
+				       &cu->method_list);
+
   dwarf2_find_base_address (cu->dies, cu);
 
   /* Do line number decoding in read_file_scope () */
   process_die (cu->dies, cu);
 
+  /* Now that we have processed all the DIEs in the CU, all the types 
+     should be complete, and it should now be safe to compute all of the
+     physnames.  */
+  compute_delayed_physnames (cu);
+  do_cleanups (delayed_list_cleanup);
+
   /* Some compilers don't define a DW_AT_high_pc attribute for the
      compilation unit.  If the DW_AT_high_pc is missing, synthesize
      it, by scanning the DIE's below the compilation unit.  */
@@ -5093,7 +5185,6 @@ dwarf2_add_member_fn (struct field_info 
   int i;
   struct fn_field *fnp;
   char *fieldname;
-  char *physname;
   struct nextfnfield *new_fnfield;
   struct type *this_type;
 
@@ -5105,9 +5196,6 @@ dwarf2_add_member_fn (struct field_info 
   if (fieldname == NULL)
     return;
 
-  /* Get the mangled name.  */
-  physname = (char *) dwarf2_physname (fieldname, die, cu);
-
   /* Look up member function name in fieldlist.  */
   for (i = 0; i < fip->nfnfields; i++)
     {
@@ -5133,7 +5221,7 @@ dwarf2_add_member_fn (struct field_info 
       flp->name = fieldname;
       flp->length = 0;
       flp->head = NULL;
-      fip->nfnfields++;
+      i = fip->nfnfields++;
     }
 
   /* Create a new member function field and chain it to the field list
@@ -5147,9 +5235,19 @@ dwarf2_add_member_fn (struct field_info 
 
   /* Fill in the member function field info.  */
   fnp = &new_fnfield->fnfield;
-  /* The name is already allocated along with this objfile, so we don't
-     need to duplicate it for the type.  */
-  fnp->physname = physname ? physname : "";
+
+  /* Delay processing of the physname until later.  */
+  if (cu->language == language_cplus || cu->language == language_java)
+    {
+      add_to_method_list (type, i, flp->length - 1, fieldname,
+			  die, cu);
+    }
+  else
+    {
+      char *physname = (char *) dwarf2_physname (fieldname, die, cu);
+      fnp->physname = physname ? physname : "";
+    }
+
   fnp->type = alloc_type (objfile);
   this_type = read_type_die (die, cu);
   if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC)
@@ -5175,7 +5273,7 @@ dwarf2_add_member_fn (struct field_info 
     }
   else
     complaint (&symfile_complaints, _("member function type missing for '%s'"),
-	       physname);
+	       dwarf2_full_name (fieldname, die, cu));
 
   /* Get fcontext from DW_AT_containing_type if present.  */
   if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
@@ -7500,7 +7598,9 @@ load_partial_dies (bfd *abfd, gdb_byte *
 		      || last_die->tag == DW_TAG_interface_type
 		      || last_die->tag == DW_TAG_structure_type
 		      || last_die->tag == DW_TAG_union_type))
-	      || (cu->language == language_ada
+	      || ((cu->language == language_ada
+		   || cu->language == language_cplus
+		   || cu->language == language_java)
 		  && (last_die->tag == DW_TAG_subprogram
 		      || last_die->tag == DW_TAG_lexical_block))))
 	{
--- ./gdb/testsuite/gdb.dwarf2/pr11465.S	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.dwarf2/pr11465.S	2010-05-13 18:39:00.000000000 +0200
@@ -0,0 +1,355 @@
+/* Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Compiled from:
+
+    namespace N
+    {
+      class C
+      {
+      public:
+        typedef void (*t) (C);
+        C (t) {}
+      };
+      typedef C::t u;
+      u f;
+      C c (f);
+    };
+
+    int
+    main ()
+    {
+      return 0;
+    }
+*/
+
+	.text
+_ZN1N1cE:	
+	.section	.debug_info
+d:
+	.long	.Ldebug_info_end - 1f /* Length of CU info */
+1:
+	.2byte	0x2		/* DWARF version number */
+	.long	.Ldebug_abbrev0	/* Abbrev offset */
+	.byte	0x4		/* Pointer size */
+dieb:	.uleb128 0x1		/* DW_TAG_compile_unit */
+	.long	.LASF4		/* DW_AT_producer */
+	.byte	0x4		/* DW_AT_language */
+	.long	.LASF5		/* DW_AT_name */
+	.long	.LASF6		/* DW_AT_comp_dir */
+	.long	0x0		/* DW_AT_low_pc */
+	.long	0x0		/* DW_AT_high_pc */
+	.long	0x0		/* DW_AT_entry_pc */
+die29:	.uleb128 0x2		/* DW_TAG_namespace */
+	.string	"N"		/* DW_AT_name */
+die32:	.uleb128 0x3		/* DW_TAG_class_type */
+	.string	"C"		/* DW_AT_name */
+	.byte	0x1		/* DW_AT_declaration */
+die36:	.uleb128 0x4		/* DW_TAG_typedef */
+	.string	"u"		/* DW_AT_name */
+	.long	die7e-d		/* DW_AT_type */
+die3f:	.uleb128 0x5		/* DW_TAG_variable */
+	.string	"f"		/* DW_AT_name */
+	.long	.LASF0		/* DW_AT_MIPS_linkage_name */
+	.long	die36-d		/* DW_AT_type */
+	.byte	0x1		/* DW_AT_external */
+	.byte	0x1		/* DW_AT_declaration */
+die4e:	.uleb128 0x5		/* DW_TAG_variable */
+	.string	"c"		/* DW_AT_name */
+	.long	.LASF1		/* DW_AT_MIPS_linkage_name */
+	.long	die5e-d		/* DW_AT_type */
+	.byte	0x1		/* DW_AT_external */
+	.byte	0x1		/* DW_AT_declaration */
+	.byte	0x0
+die5e:	.uleb128 0x6		/* DW_TAG_class_type */
+	.long	die32-d		/* DW_AT_specification */
+	.byte	0x1		/* DW_AT_byte_size */
+die6a:	.uleb128 0x7		/* DW_TAG_subprogram */
+	.byte	0x1		/* DW_AT_external */
+	.string	"C"		/* DW_AT_name */
+	.byte	0x1		/* DW_AT_declaration */
+die71:	.uleb128 0x8		/* DW_TAG_formal_parameter */
+	.long	die8f-d		/* DW_AT_type */
+	.byte	0x1		/* DW_AT_artificial */
+die77:	.uleb128 0x9		/* DW_TAG_formal_parameter */
+	.long	die7e-d		/* DW_AT_type */
+	.byte	0x0
+	.byte	0x0
+die7e:	.uleb128 0xa		/* DW_TAG_pointer_type */
+	.byte	0x4		/* DW_AT_byte_size */
+	.long	die84-d		/* DW_AT_type */
+die84:	.uleb128 0xb		/* DW_TAG_subroutine_type */
+die89:	.uleb128 0x9		/* DW_TAG_formal_parameter */
+	.long	die5e-d		/* DW_AT_type */
+	.byte	0x0
+die8f:	.uleb128 0xa		/* DW_TAG_pointer_type */
+	.byte	0x4		/* DW_AT_byte_size */
+	.long	die5e-d		/* DW_AT_type */
+die95:	.uleb128 0xc		/* DW_TAG_subprogram */
+	.long	die6a-d		/* DW_AT_specification */
+	.byte	0x2		/* DW_AT_inline */
+die9f:	.uleb128 0xd		/* DW_TAG_formal_parameter */
+	.long	.LASF7		/* DW_AT_name */
+	.long	dieaf-d		/* DW_AT_type */
+	.byte	0x1		/* DW_AT_artificial */
+diea9:	.uleb128 0x9		/* DW_TAG_formal_parameter */
+	.long	die7e-d		/* DW_AT_type */
+	.byte	0x0
+dieaf:	.uleb128 0xe		/* DW_TAG_const_type */
+	.long	die8f-d		/* DW_AT_type */
+dieb4:	.uleb128 0xf		/* DW_TAG_subprogram */
+	.long	die95-d		/* DW_AT_abstract_origin */
+	.long	_ZN1N1cE	/* DW_AT_low_pc */
+	.long	_ZN1N1cE	/* DW_AT_high_pc */
+diec9:	.uleb128 0x10		/* DW_TAG_subprogram */
+	.long	die9f-d		/* DW_AT_abstract_origin */
+	.byte	2f-1f		/* DW_AT_location */
+1:
+	.byte	0x50		/* DW_OP_reg0 */
+2:
+died1:	.uleb128 0x10		/* DW_TAG_formal_parameter */
+	.long	diea9-d		/* DW_AT_abstract_origin */
+	.byte	2f-1f		/* DW_AT_location */
+1:
+	.byte	0x51		/* DW_OP_reg1 */
+2:
+	.byte	0x0
+dieda:	.uleb128 0x11		/* DW_TAG_subprogram */
+	.byte	0x1		/* DW_AT_external */
+	.long	.LASF8		/* DW_AT_name */
+	.long	dief2-d		/* DW_AT_type */
+	.long	_ZN1N1cE	/* DW_AT_low_pc */
+	.long	_ZN1N1cE	/* DW_AT_high_pc */
+dief2:	.uleb128 0x12		/* DW_TAG_base_type */
+	.byte	0x4		/* DW_AT_byte_size */
+	.byte	0x5		/* DW_AT_encoding */
+	.string	"int"		/* DW_AT_name */
+die149:	.uleb128 0x16		/* DW_TAG_variable */
+	.long	die4e-d		/* DW_AT_specification */
+	.byte	0x5		/* DW_AT_location */
+	.byte	0x3
+	.long	_ZN1N1cE
+	.byte	0x0
+.Ldebug_info_end:
+	.section	.debug_abbrev
+.Ldebug_abbrev0:
+	.uleb128 0x1		/* abbrev code*/
+	.uleb128 0x11		/* DW_TAG_compile_unit */
+	.byte	0x1		/* DW_children_yes */
+	.uleb128 0x25		/* DW_AT_producer*/
+	.uleb128 0xe		/* DW_FORM_strp */
+	.uleb128 0x13		/* DW_AT_language */
+	.uleb128 0xb		/* DW_FORM_data1 */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0xe		/* DW_FORM_strp */
+	.uleb128 0x1b		/* DW_AT_comp_dir */
+	.uleb128 0xe		/* DW_FORM_strp */
+	.uleb128 0x11		/* DW_AT_low_pc */
+	.uleb128 0x1		/* DW_FORM_addr */
+	.uleb128 0x12		/* DW_AT_high_pc */
+	.uleb128 0x1		/* DW_FORM_addr */
+	.uleb128 0x52		/* DW_AT_entry_pc */
+	.uleb128 0x1		/* DW_FORM_addr */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x2		/* abbrev code */
+	.uleb128 0x39		/* DW_TAG_namespace */
+	.byte	0x1		/* DW_children_yes */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0x8		/* DW_FORM_string */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x3		/* abbrev code */
+	.uleb128 0x2		/* DW_TAG_class_type */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0x8		/* DW_FORM_string */
+	.uleb128 0x3c		/* DW_AT_declaration */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x4		/* abbrev code */
+	.uleb128 0x16		/* DW_TAG_typedef */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0x8		/* DW_FORM_string */
+	.uleb128 0x49		/* DW_AT_type */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x5		/* abbrev code */
+	.uleb128 0x34		/* DW_TAG_variable */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0x8		/* DW_FORM_string */
+	.uleb128 0x2007		/* DW_AT_MIPS_linkage_name */
+	.uleb128 0xe		/* DW_FORM_strp */
+	.uleb128 0x49		/* DW_AT_TYPE */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x3f		/* DW_AT_external */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.uleb128 0x3c		/* DW_AT_declaration */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x6		/* abbrev code */
+	.uleb128 0x2		/* DW_TAG_class_type */
+	.byte	0x1		/* DW_has_children_yes */
+	.uleb128 0x47		/* DW_AT_specification */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0xb		/* DW_AT_byte_size */
+	.uleb128 0xb		/* DW_FORM_data1 */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x7		/* abbrev code */
+	.uleb128 0x2e		/* DW_TAG_subprogra */
+	.byte	0x1		/* DW_has_children_yes */
+	.uleb128 0x3f		/* DW_AT_external */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0x8		/* DW_FORM_string */
+	.uleb128 0x3c		/* DW_AT_declaration */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x8		/* abbrev code */
+	.uleb128 0x5		/* DW_TAG_formal_parameter */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x49		/* DW_AT_type */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x34		/* DW_AT_artificial */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x9		/* abbrev code */
+	.uleb128 0x5		/* DW_TAG_formal_parameter */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x49		/* DW_AT_type */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0xa		/* abbrev code */
+	.uleb128 0xf		/* DW_TAG_pointer_type */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0xb		/* DW_AT_byte_size */
+	.uleb128 0xb		/* DW_FORM_data1 */
+	.uleb128 0x49		/* DW_AT_type */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0xb		/* abbrev code */
+	.uleb128 0x15		/* DW_TAG_subroutine_type */
+	.byte	0x1		/* DW_has_children_yes */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0xc		/* abbrev code */
+	.uleb128 0x2e		/* DW_TAG_subprogram */
+	.byte	0x1		/* DW_has_children_yes */
+	.uleb128 0x47		/* DW_AT_specification */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x20		/* DW_AT_inline */
+	.uleb128 0xb		/* DW_FORM_data1 */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0xd		/* abbrev code */
+	.uleb128 0x5		/* DW_TAG_formal_parameter */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0xe		/* DW_FORM_strp */
+	.uleb128 0x49		/* DW_AT_type */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x34		/* DW_AT_artificial */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0xe		/* abbrev code */
+	.uleb128 0x26		/* DW_TAG_const_type */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x49		/* DW_AT_type */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0xf		/* abbrev code */
+	.uleb128 0x2e		/* DW_TAG_subprogram */
+	.byte	0x1		/* DW_has_children_yes */
+	.uleb128 0x31		/* DW_AT_abstract_origin */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x11		/* DW_AT_low_pc */
+	.uleb128 0x1		/* DW_FORM_addr */
+	.uleb128 0x12		/* DW_AT_high_pc */
+	.uleb128 0x1		/* DW_FORM_addr */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x10		/* abbrev code */
+	.uleb128 0x5		/* DW_TAG_formal_parameter */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x31		/* DW_AT_abstract_origin */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x2		/* DW_AT_location */
+	.uleb128 0xa		/* DW_FORM_block1 */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x11		/* abbrev code */
+	.uleb128 0x2e		/* DW_TAG_subprogram */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x3f		/* DW_AT_external */
+	.uleb128 0xc		/* DW_FORM_flag */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0xe		/* DW_FORM_strp */
+	.uleb128 0x49		/* DW_AT_type */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x11		/* DW_AT_low_pc */
+	.uleb128 0x1		/* DW_FORM_addr */
+	.uleb128 0x12		/* DW_AT_high_pc */
+	.uleb128 0x1		/* DW_FORM_addr */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x12		/* abbrev code */
+	.uleb128 0x24		/* DW_TAG_base_type */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0xb		/* DW_AT_byte_size */
+	.uleb128 0xb		/* DW_FORM_data1 */
+	.uleb128 0x3e		/* DW_AT_encoding */
+	.uleb128 0xb		/* DW_FORM_data1 */
+	.uleb128 0x3		/* DW_AT_name */
+	.uleb128 0x8		/* DW_FORM_string */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x16		/* abbrev code */
+	.uleb128 0x34		/* DW_TAG_variable */
+	.byte	0x0		/* DW_has_children_no */
+	.uleb128 0x47		/* DW_AT_specification */
+	.uleb128 0x13		/* DW_FORM_ref4 */
+	.uleb128 0x2		/* DW_AT_location */
+	.uleb128 0xa		/* DW_FORM_block1 */
+	.byte	0x0
+	.byte	0x0
+	.byte	0x0
+	.section	.debug_str
+.LASF0:
+	.string	"_ZN1N1fE"
+.LASF7:
+	.string	"this"
+.LASF6:
+	.string	""
+.LASF8:
+	.string	"main"
+.LASF1:
+	.string	"_ZN1N1cE"
+.LASF5:
+	.string	"pr11465.cc"
+.LASF4:
+	.string	"GNU C++ 4.4.2"
+	.ident	"GCC: (GNU) 4.4.2"
--- ./gdb/testsuite/gdb.dwarf2/pr11465.exp	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.dwarf2/pr11465.exp	2010-05-13 18:39:00.000000000 +0200
@@ -0,0 +1,39 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+    && ![istarget *-*-gnu*]
+    && ![istarget *-*-elf*]
+    && ![istarget *-*-openbsd*]
+    && ![istarget arm-*-eabi*]
+    && ![istarget powerpc-*-eabi*]} {
+    return 0  
+}
+
+set testfile "pr11465"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+set binfile ${objdir}/${subdir}/${executable}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
+    return -1
+}
+
+clean_restart $executable
+
+# Test delayed physname computations
+gdb_test "p N::c.C" { = {void \(N::C \*, void \(\*\)\(N::C\)\)}.*}

gdb-bz575292-void-workaround.patch:
 b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S   |   73 ++++++++++++++++++
 b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp |   44 ++++++++++
 gdb/dwarf2read.c                                      |   11 ++
 3 files changed, 126 insertions(+), 2 deletions(-)

--- NEW FILE gdb-bz575292-void-workaround.patch ---
http://sourceware.org/ml/gdb-patches/2010-03/msg01039.html
Subject: [patch] Fix crash on NULL function's TYPE_FIELD_TYPE

Hi,

seen one possibility of a crash.

#0  c_print_type (type=0x0, ...)
#1  in c_type_print_args (type=0xfceb890,

(The real reason of a reported GDB crash was different, though.)


Thanks,
Jan


gdb/
2010-03-30  Jan Kratochvil  <jan.kratochvil at redhat.com>

	Fix crash on reading wrong function declaration DWARF.
	* dwarf2read.c (read_subroutine_type): New variable void_type.
	Pre-fill all TYPE_FIELD_TYPEs.  Move nparams and iparams initialization
	more close to their use.

gdb/testsuite/
2010-03-30  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* gdb.dwarf2/dw2-bad-parameter-type.exp,
	gdb.dwarf2/dw2-bad-parameter-type.S: New.

--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5938,13 +5938,14 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
   
   if (die->child != NULL)
     {
+      struct type *void_type = objfile_type (cu->objfile)->builtin_void;
       struct die_info *child_die;
-      int nparams = 0;
-      int iparams = 0;
+      int nparams, iparams;
 
       /* Count the number of parameters.
          FIXME: GDB currently ignores vararg functions, but knows about
          vararg member functions.  */
+      nparams = 0;
       child_die = die->child;
       while (child_die && child_die->tag)
 	{
@@ -5960,6 +5961,12 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
       TYPE_FIELDS (ftype) = (struct field *)
 	TYPE_ZALLOC (ftype, nparams * sizeof (struct field));
 
+      /* TYPE_FIELD_TYPE must never be NULL.  Pre-fill the array to ensure it
+	 even if we error out during the parameters reading below.  */
+      for (iparams = 0; iparams < nparams; iparams++)
+	TYPE_FIELD_TYPE (ftype, iparams) = void_type;
+
+      iparams = 0;
       child_die = die->child;
       while (child_die && child_die->tag)
 	{
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S
@@ -0,0 +1,73 @@
+/* Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+	.section	.debug_info
+debug_start:
+	.long	debug_end - 1f	/* Length of Compilation Unit Info */
+1:
+	.2byte	0x3	/* DWARF version number */
+	.long	.Ldebug_abbrev0	/* Offset Into Abbrev. Section */
+	.byte	0x4	/* Pointer Size (in bytes) */
+	.uleb128 0x1	/* (DIE (0xb) DW_TAG_compile_unit) */
+	.ascii "GNU C 4.4.3\0"	/* DW_AT_producer */
+	.byte	0x1	/* DW_AT_language */
+	.ascii "1.c\0"	/* DW_AT_name */
+	.uleb128 0x4	/* (DIE (0x3c) DW_TAG_subprogram) */
+	.ascii "f\0"	/* DW_AT_name */
+/* Value 0 would require has_section_at_zero != 0 (which is true, though).  */
+	.long	1	/* DW_AT_low_pc */
+	.long	2	/* DW_AT_high_pc */
+	.byte	0x1	/* DW_AT_prototyped */
+	.uleb128 0x5	/* (DIE (0x42) DW_TAG_formal_parameter) */
+/* Invalid value.  */
+	.long	0x0	/* DW_AT_type */
+	.byte	0x0	/* end of children of DIE 0x3c */
+	.byte	0x0	/* end of children of DIE 0xb */
+debug_end:
+
+	.section	.debug_abbrev
+.Ldebug_abbrev0:
+	.uleb128 0x1	/* (abbrev code) */
+	.uleb128 0x11	/* (TAG: DW_TAG_compile_unit) */
+	.byte	0x1	/* DW_children_yes */
+	.uleb128 0x25	/* (DW_AT_producer) */
+	.uleb128 0x8	/* (DW_FORM_string) */
+	.uleb128 0x13	/* (DW_AT_language) */
+	.uleb128 0xb	/* (DW_FORM_data1) */
+	.uleb128 0x3	/* (DW_AT_name) */
+	.uleb128 0x8	/* (DW_FORM_string) */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x4	/* (abbrev code) */
+	.uleb128 0x2e	/* (TAG: DW_TAG_subprogram) */
+	.byte	0x1	/* DW_children_yes */
+	.uleb128 0x3	/* (DW_AT_name) */
+	.uleb128 0x8	/* (DW_FORM_string) */
+	.uleb128 0x11	/* (DW_AT_low_pc) */
+	.uleb128 0x1	/* (DW_FORM_addr) */
+	.uleb128 0x12	/* (DW_AT_high_pc) */
+	.uleb128 0x1	/* (DW_FORM_addr) */
+	.uleb128 0x27	/* (DW_AT_prototyped) */
+	.uleb128 0xc	/* (DW_FORM_flag) */
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x5	/* (abbrev code) */
+	.uleb128 0x5	/* (TAG: DW_TAG_formal_parameter) */
+	.byte	0x0	/* DW_children_no */
+	.uleb128 0x49	/* (DW_AT_type) */
+	.uleb128 0x13	/* (DW_FORM_ref4) */
+	.byte	0x0
+	.byte	0x0
+	.byte	0x0
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
@@ -0,0 +1,44 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+    && ![istarget *-*-gnu*]
+    && ![istarget *-*-elf*]
+    && ![istarget *-*-openbsd*]
+    && ![istarget arm-*-eabi*]
+    && ![istarget powerpc-*-eabi*]} {
+    return 0  
+}
+
+set testfile "dw2-bad-parameter-type"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+set binfile ${objdir}/${subdir}/${executable}
+
+# First try referencing DW_AT_frame_base which is not defined.
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
+    return -1
+}
+
+clean_restart $executable
+
+# The first access (as we do not use -readnow) prints some:
+# Dwarf Error: Cannot find DIE at 0x0 referenced from DIE at 0x29 [in module ...]
+gdb_test "ptype f"
+
+gdb_test "ptype f"
+gdb_test "p 5" " = 5" "is alive"


gdb-bz578250-avx-01of10.patch:
 amd64-linux-nat.c                |   35 +++++
 amd64-linux-tdep.c               |   73 +++++++---
 amd64-linux-tdep.h               |    3 
 amd64-tdep.c                     |   62 ++------
 gdbserver/Makefile.in            |   30 ++--
 gdbserver/configure.srv          |   33 +++-
 gdbserver/linux-x86-low.c        |    8 -
 i386-linux-nat.c                 |   10 +
 i386-linux-tdep.c                |   66 +++++++--
 i386-linux-tdep.h                |    3 
 i386-nto-tdep.c                  |    2 
 i386-tdep.c                      |  270 ++++++++++++++-------------------------
 i386-tdep.h                      |   29 ++--
 i387-tdep.h                      |    3 
 regformats/i386/amd64-linux.dat  |   62 ++++++++
 regformats/i386/amd64.dat        |   61 ++++++++
 regformats/i386/i386-linux.dat   |   46 ++++++
 regformats/i386/i386.dat         |   45 ++++++
 regformats/reg-i386-linux.dat    |   46 ------
 regformats/reg-i386.dat          |   44 ------
 regformats/reg-x86-64-linux.dat  |   62 --------
 regformats/reg-x86-64.dat        |   59 --------
 testsuite/gdb.xml/tdesc-regs.exp |   15 ++
 23 files changed, 561 insertions(+), 506 deletions(-)

--- NEW FILE gdb-bz578250-avx-01of10.patch ---
[ Backported.  ]

commit d454b7529a5e6134ace8541b341d079534f2062a
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Mon Mar 1 15:33:29 2010 +0000

    Enable XML target descriptions for x86.
    
    gdb/
    
    2010-03-01  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New.
    	(amd64_linux_read_description): Likewise.
    	(_initialize_amd64_linux_nat): Set to_read_description to
    	amd64_linux_read_description.
    
    	* amd64-linux-tdep.c: Include "features/i386/amd64-linux.c".
    	(amd64_linux_register_name): Removed.
    	(amd64_linux_register_type): Likewise.
    	(amd64_linux_core_read_description): New.
    	(amd64_linux_init_abi): Set target description to
    	tdesc_amd64_linux if needed.  Support orig_rax in target
    	description.  Don't call set_gdbarch_register_name nor
    	set_gdbarch_register_type.  Call
    	set_gdbarch_core_read_description.
    	(_initialize_amd64_linux_tdep): Call
    	initialize_tdesc_amd64_linux.
    
    	* amd64-linux-tdep.h (tdesc_amd64_linux): New.
    
    	* amd64-tdep.c:  Include "features/i386/amd64.c".
    	(amd64_register_names): Removed.
    	(amd64_register_name): Likewise.
    	(amd64_register_type): Likewise.
    	(amd64_init_abi):  Set num_core_regs and register_names.  Set
    	target description to tdesc_amd64 if needed.  Don't call
    	set_gdbarch_register_name nor set_gdbarch_register_type.
    	(_initialize_amd64_tdep): New.
    
    	* i386-linux-nat.c (i386_linux_read_description): New.
    	(_initialize_i386_linux_nat): Set to_read_description to
    	i386_linux_read_description.
    
    	* i386-linux-tdep.c: Include "features/i386/i386-linux.c".
    	(i386_linux_register_name): Removed.
    	(i386_linux_core_read_description): New.
    	(i386_linux_read_description): Likewise.
    	(i386_linux_init_abi): Don't call set_gdbarch_register_name.
    	Set target description to tdesc_i386_linux if needed.  Support
    	orig_eax.  Set register_reggroup_p.  Call
    	set_gdbarch_core_read_description.
    	(_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux.
    
    	* i386-linux-tdep.h (tdesc_i386_linux): New.
    
    	* i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS
    	with I387_NUM_REGS.
    
    	* i386-tdep.c: Include "features/i386/i386.c".
    	(i386_register_names): Make it const.
    	(i386_mmx_names): Likewise.
    	(i386_num_register_names): Removed.
    	(i386_register_name): Likewise.
    	(i386_eflags_type): Likewise.
    	(i386_mxcsr_type): Likewise.
    	(i386_sse_type): Likewise.
    	(i386_register_type): Likewise.
    	(i387_ext_type): Call tdesc_find_type instead of arch_float_type.
    	(i386_pseudo_register_name): New.
    	(i386_pseudo_register_type): Likewise.
    	(i386_mmx_type): Make it static.
    	(i386_gdbarch_init): Check arch.  Replace I386_NUM_FREGS with
    	I387_NUM_REGS.  Set num_core_regs and register_names.  Don't
    	call set_gdbarch_register_name nor set_gdbarch_register_type.
    	Set register_reggroup_p.  Set target description to tdesc_i386
    	if needed.  Call set_tdesc_pseudo_register_type,
    	set_tdesc_pseudo_register_name and tdesc_use_registers.
    	(_initialize_i386_tdep): Call initialize_tdesc_i386.
    	initialize_tdesc_x86_64.
    
    	* i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type,
    	i386_mxcsr_type and i386_sse_type.  Add num_core_regs,
    	register_names, tdesc and register_reggroup_p.
    	(I386_NUM_FREGS): Removed.
    	(i386_eflags_type): Likewise.
    	(i386_mxcsr_type): Likewise.
    	(i386_mmx_type): Likewise.
    	(i386_sse_type): Likewise.
    	(i386_register_name): Likewise.
    	(i386_regnum): Add I386_MXCSR_REGNUM.
    	(I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM.
    
    	* i387-tdep.h (I387_NUM_REGS): New.
    
    	* regformats/i386/i386-linux.dat: Generated.
    	* regformats/i386/i386.dat: Likewise.
    	* regformats/i386/amd64-linux.dat: Likewise.
    	* regformats/i386/amd64.dat: Likewise.
    
    	* regformats/reg-i386-linux.dat: Removed.
    	* regformats/reg-i386.dat: Likewise.
    	* regformats/reg-x86-64-linux.dat: Likewise.
    	* regformats/reg-x86-64.dat: Likewise.
    
    gdb/gdbserver/
    
    2010-03-01  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c,
    	reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c,
    	i386-linux.c and amd64-linux.c.
    	(reg-i386.o): Removed.
    	(reg-i386.c): Likewise.
    	(reg-i386-linux.o): Likewise.
    	(reg-i386-linux.c): Likewise.
    	(reg-x86-64.o): Likewise.
    	(reg-x86-64.c): Likewise.
    	(reg-x86-64-linux.o): Likewise.
    	(reg-x86-64-linux.c): Likewise.
    	(i386.o): New.
    	(i386.c): Likewise.
    	(i386-linux.o): Likewise.
    	(i386-linux.c): Likewise.
    	(amd64.o): Likewise.
    	(amd64.c): Likewise.
    	(amd64-linux.o): Likewise.
    	(amd64-linux.c): Likewise.
    
    	* configure.srv (srv_i386_regobj): New.
    	(srv_i386_linux_regobj): Likewise.
    	(srv_amd64_regobj): Likewise.
    	(srv_amd64_linux_regobj): Likewise.
    	(srv_i386_32bit_xmlfiles): Likewise.
    	(srv_i386_64bit_xmlfiles): Likewise.
    	(srv_i386_xmlfiles): Likewise.
    	(srv_amd64_xmlfiles): Likewise.
    	(srv_i386_linux_xmlfiles): Likewise.
    	(srv_amd64_linux_xmlfiles): Likewise.
    	(i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj.  Set
    	srv_xmlfiles to $srv_i386_xmlfiles.
    	(i[34567]86-*-mingw32ce*): Likewise.
    	(i[34567]86-*-mingw*): Likewise.
    	(i[34567]86-*-nto*): Likewise.
    	(i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj
    	and $srv_amd64_linux_regobj.  Set srv_xmlfiles to
    	$srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles.
    	(x86_64-*-linux*): Likewise.
    
    	* linux-x86-low.c (init_registers_x86_64_linux): Removed.
    	(init_registers_amd64_linux): New.
    	(x86_arch_setup): Replace init_registers_x86_64_linux with
    	init_registers_amd64_linux.
    
    gdb/testsuite/
    
    2010-03-01  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* gdb.xml/tdesc-regs.exp (architecture): New.  Set it for x86.
    	(load_description): Set architecture if defined.

--- ./gdb/amd64-linux-nat.c	2010-04-03 20:24:51.000000000 +0200
+++ ./gdb/amd64-linux-nat.c	2010-04-03 20:59:52.000000000 +0200
@@ -817,6 +817,39 @@ amd64_linux_siginfo_fixup (struct siginf
     return 0;
 }
 
+/* Get Linux/x86 target description from running target.
+
+   Value of CS segment register:
+     1. 64bit process: 0x33.
+     2. 32bit process: 0x23.
+ */
+
+#define AMD64_LINUX_USER64_CS	0x33
+
+static const struct target_desc *
+amd64_linux_read_description (struct target_ops *ops)
+{
+  unsigned long cs;
+  int tid;
+
+  /* GNU/Linux LWP ID's are process ID's.  */
+  tid = TIDGET (inferior_ptid);
+  if (tid == 0)
+    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
+
+  /* Get CS register.  */
+  errno = 0;
+  cs = ptrace (PTRACE_PEEKUSER, tid,
+	       offsetof (struct user_regs_struct, cs), 0);
+  if (errno != 0)
+    perror_with_name (_("Couldn't get CS register"));
+
+  if (cs == AMD64_LINUX_USER64_CS)
+    return tdesc_amd64_linux;
+  else
+    return tdesc_i386_linux;
+}
+
 /* Provide a prototype to silence -Wmissing-prototypes.  */
 void _initialize_amd64_linux_nat (void);
 
@@ -861,6 +894,8 @@ _initialize_amd64_linux_nat (void)
   linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus;
   linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg;
 
+  t->to_read_description = amd64_linux_read_description;
+
   /* Register the target.  */
   linux_nat_add_target (t);
   linux_nat_set_new_thread (t, amd64_linux_new_thread);
--- ./gdb/amd64-linux-tdep.c	2010-04-03 20:24:51.000000000 +0200
+++ ./gdb/amd64-linux-tdep.c	2010-04-03 20:59:52.000000000 +0200
@@ -37,6 +37,8 @@
 #include "solib-svr4.h"
 #include "xml-syscall.h"
 
+#include "features/i386/amd64-linux.c"
+
 /* The syscall's XML filename for i386.  */
 #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
 
@@ -234,26 +236,6 @@ static int amd64_linux_sc_reg_offset[] =
   -1				/* %gs */
 };
 
-/* Replacement register functions which know about %orig_rax.  */
-
-static const char *
-amd64_linux_register_name (struct gdbarch *gdbarch, int reg)
-{
-  if (reg == AMD64_LINUX_ORIG_RAX_REGNUM)
-    return "orig_rax";
-
-  return amd64_register_name (gdbarch, reg);
-}
-
-static struct type *
-amd64_linux_register_type (struct gdbarch *gdbarch, int reg)
-{
-  if (reg == AMD64_LINUX_ORIG_RAX_REGNUM)
-    return builtin_type (gdbarch)->builtin_int64;
-
-  return amd64_register_type (gdbarch, reg);
-}
-
 static int
 amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 				 struct reggroup *group)
@@ -1334,10 +1316,32 @@ amd64_linux_record_signal (struct gdbarc
   return 0;
 }
 
+/* Get Linux/x86 target description from core dump.  */
+
+static const struct target_desc *
+amd64_linux_core_read_description (struct gdbarch *gdbarch,
+				  struct target_ops *target,
+				  bfd *abfd)
+{
+  asection *section = bfd_get_section_by_name (abfd, ".reg2");
+
+  if (section == NULL)
+    return NULL;
+
+  /* Linux/x86-64.  */
+  return tdesc_amd64_linux;
+}
+
 static void
 amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  const struct target_desc *tdesc = info.target_desc;
+  struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+  const struct tdesc_feature *feature;
+  int valid_p;
+
+  gdb_assert (tdesc_data);
 
   tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset;
   tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset);
@@ -1345,6 +1349,23 @@ amd64_linux_init_abi (struct gdbarch_inf
 
   amd64_init_abi (info, gdbarch);
 
+  /* Reserve a number for orig_rax.  */
+  set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS);
+
+  if (! tdesc_has_registers (tdesc))
+    tdesc = tdesc_amd64_linux;
+  tdep->tdesc = tdesc;
+
+  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux");
+  if (feature == NULL)
+    return;
+
+  valid_p = tdesc_numbered_register (feature, tdesc_data,
+				     AMD64_LINUX_ORIG_RAX_REGNUM,
+				     "orig_rax");
+  if (!valid_p)
+    return;
+
   tdep->sigtramp_p = amd64_linux_sigtramp_p;
   tdep->sigcontext_addr = amd64_linux_sigcontext_addr;
   tdep->sc_reg_offset = amd64_linux_sc_reg_offset;
@@ -1358,10 +1379,8 @@ amd64_linux_init_abi (struct gdbarch_inf
 
   /* Add the %orig_rax register used for syscall restarting.  */
   set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc);
-  set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS);
-  set_gdbarch_register_name (gdbarch, amd64_linux_register_name);
-  set_gdbarch_register_type (gdbarch, amd64_linux_register_type);
-  set_gdbarch_register_reggroup_p (gdbarch, amd64_linux_register_reggroup_p);
+
+  tdep->register_reggroup_p = amd64_linux_register_reggroup_p;
 
   /* Functions for 'catch syscall'.  */
   set_xml_syscall_file_name (XML_SYSCALL_FILENAME_AMD64);
@@ -1375,6 +1394,9 @@ amd64_linux_init_abi (struct gdbarch_inf
   /* GNU/Linux uses SVR4-style shared libraries.  */
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
+  set_gdbarch_core_read_description (gdbarch,
+				     amd64_linux_core_read_description);
+
   /* Displaced stepping.  */
   set_gdbarch_displaced_step_copy_insn (gdbarch,
                                         amd64_displaced_step_copy_insn);
@@ -1571,4 +1593,7 @@ _initialize_amd64_linux_tdep (void)
 {
   gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
 			  GDB_OSABI_LINUX, amd64_linux_init_abi);
+
+  /* Initialize the Linux target description  */
+  initialize_tdesc_amd64_linux ();
 }
--- ./gdb/amd64-linux-tdep.h	2010-01-01 08:31:29.000000000 +0100
+++ ./gdb/amd64-linux-tdep.h	2010-04-03 20:59:52.000000000 +0200
@@ -31,6 +31,9 @@
 /* Total number of registers for GNU/Linux.  */
 #define AMD64_LINUX_NUM_REGS (AMD64_LINUX_ORIG_RAX_REGNUM + 1)
 
+/* Linux target description.  */
+extern struct target_desc *tdesc_amd64_linux;
+
 /* Enum that defines the syscall identifiers for amd64 linux.
    Used for process record/replay, these will be translated into
    a gdb-canonical set of syscall ids in linux-record.c.  */
--- ./gdb/amd64-tdep.c	2010-04-03 20:24:51.000000000 +0200
+++ ./gdb/amd64-tdep.c	2010-04-03 20:59:52.000000000 +0200
@@ -42,6 +42,8 @@
 #include "amd64-tdep.h"
 #include "i387-tdep.h"
 
+#include "features/i386/amd64.c"
+
 /* Note that the AMD64 architecture was previously known as x86-64.
    The latter is (forever) engraved into the canonical system name as
    returned by config.guess, and used as the name for the AMD64 port
@@ -83,47 +85,6 @@ static int amd64_dummy_call_integer_regs
   9				/* %r9 */
 };
 
-/* Return the name of register REGNUM.  */
-
-const char *
-amd64_register_name (struct gdbarch *gdbarch, int regnum)
-{
-  if (regnum >= 0 && regnum < AMD64_NUM_REGS)
-    return amd64_register_names[regnum];
-
-  return NULL;
-}
-
-/* Return the GDB type object for the "standard" data type of data in
-   register REGNUM. */
-
-struct type *
-amd64_register_type (struct gdbarch *gdbarch, int regnum)
-{
-  if (regnum >= AMD64_RAX_REGNUM && regnum <= AMD64_RDI_REGNUM)
-    return builtin_type (gdbarch)->builtin_int64;
-  if (regnum == AMD64_RBP_REGNUM || regnum == AMD64_RSP_REGNUM)
-    return builtin_type (gdbarch)->builtin_data_ptr;
-  if (regnum >= AMD64_R8_REGNUM && regnum <= AMD64_R15_REGNUM)
-    return builtin_type (gdbarch)->builtin_int64;
-  if (regnum == AMD64_RIP_REGNUM)
-    return builtin_type (gdbarch)->builtin_func_ptr;
-  if (regnum == AMD64_EFLAGS_REGNUM)
-    return i386_eflags_type (gdbarch);
-  if (regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM)
-    return builtin_type (gdbarch)->builtin_int32;
-  if (regnum >= AMD64_ST0_REGNUM && regnum <= AMD64_ST0_REGNUM + 7)
-    return i387_ext_type (gdbarch);
-  if (regnum >= AMD64_FCTRL_REGNUM && regnum <= AMD64_FCTRL_REGNUM + 7)
-    return builtin_type (gdbarch)->builtin_int32;
-  if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15)
-    return i386_sse_type (gdbarch);
-  if (regnum == AMD64_MXCSR_REGNUM)
-    return i386_mxcsr_type (gdbarch);
-
-  internal_error (__FILE__, __LINE__, _("invalid regnum"));
-}
-
 /* DWARF Register Number Mapping as defined in the System V psABI,
    section 3.6.  */
 
@@ -2158,11 +2119,19 @@ void
 amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  const struct target_desc *tdesc = info.target_desc;
 
   /* AMD64 generally uses `fxsave' instead of `fsave' for saving its
      floating-point registers.  */
   tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE;
 
+  if (! tdesc_has_registers (tdesc))
+    tdesc = tdesc_amd64;
+  tdep->tdesc = tdesc;
+
+  tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS;
+  tdep->register_names = amd64_register_names;
+
   /* AMD64 has an FPU and 16 SSE registers.  */
   tdep->st0_regnum = AMD64_ST0_REGNUM;
   tdep->num_xmm_regs = 16;
@@ -2178,8 +2147,6 @@ amd64_init_abi (struct gdbarch_info info
   set_gdbarch_long_double_bit (gdbarch, 128);
 
   set_gdbarch_num_regs (gdbarch, AMD64_NUM_REGS);
-  set_gdbarch_register_name (gdbarch, amd64_register_name);
-  set_gdbarch_register_type (gdbarch, amd64_register_type);
 
   /* Register numbers of various important registers.  */
   set_gdbarch_sp_regnum (gdbarch, AMD64_RSP_REGNUM); /* %rsp */
@@ -2241,6 +2208,15 @@ amd64_init_abi (struct gdbarch_info info
 
   set_gdbarch_get_longjmp_target (gdbarch, amd64_get_longjmp_target);
 }
+
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+void _initialize_amd64_tdep (void);
+
+void
+_initialize_amd64_tdep (void)
+{
+  initialize_tdesc_amd64 ();
+}
 
 
 /* The 64-bit FXSAVE format differs from the 32-bit format in the
--- ./gdb/gdbserver/Makefile.in	2010-01-04 16:03:00.000000000 +0100
+++ ./gdb/gdbserver/Makefile.in	2010-04-03 20:59:52.000000000 +0200
@@ -203,9 +203,9 @@ clean:
 	rm -f *.o ${ADD_FILES} *~
 	rm -f version.c
 	rm -f gdbserver$(EXEEXT) gdbreplay$(EXEEXT) core make.log
-	rm -f reg-arm.c reg-i386.c reg-ia64.c reg-m32r.c reg-m68k.c
-	rm -f reg-sh.c reg-sparc.c reg-spu.c reg-x86-64.c reg-i386-linux.c
-	rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c reg-xtensa.c
+	rm -f reg-arm.c i386.c reg-ia64.c reg-m32r.c reg-m68k.c
+	rm -f reg-sh.c reg-sparc.c reg-spu.c amd64.c i386-linux.c
+	rm -f reg-cris.c reg-crisv32.c amd64-linux.c reg-xtensa.c
 	rm -f arm-with-iwmmxt.c
 	rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c
 	rm -f mips-linux.c mips64-linux.c
@@ -345,12 +345,12 @@ reg-cris.c : $(srcdir)/../regformats/reg
 reg-crisv32.o : reg-crisv32.c $(regdef_h)
 reg-crisv32.c : $(srcdir)/../regformats/reg-crisv32.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-crisv32.dat reg-crisv32.c
-reg-i386.o : reg-i386.c $(regdef_h)
-reg-i386.c : $(srcdir)/../regformats/reg-i386.dat $(regdat_sh)
-	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-i386.dat reg-i386.c
-reg-i386-linux.o : reg-i386-linux.c $(regdef_h)
-reg-i386-linux.c : $(srcdir)/../regformats/reg-i386-linux.dat $(regdat_sh)
-	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-i386-linux.dat reg-i386-linux.c
+i386.o : i386.c $(regdef_h)
+i386.c : $(srcdir)/../regformats/i386/i386.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386.dat i386.c
+i386-linux.o : i386-linux.c $(regdef_h)
+i386-linux.c : $(srcdir)/../regformats/i386/i386-linux.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-linux.dat i386-linux.c
 reg-ia64.o : reg-ia64.c $(regdef_h)
 reg-ia64.c : $(srcdir)/../regformats/reg-ia64.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-ia64.dat reg-ia64.c
@@ -432,12 +432,12 @@ reg-sparc64.c : $(srcdir)/../regformats/
 reg-spu.o : reg-spu.c $(regdef_h)
 reg-spu.c : $(srcdir)/../regformats/reg-spu.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-spu.dat reg-spu.c
-reg-x86-64.o : reg-x86-64.c $(regdef_h)
-reg-x86-64.c : $(srcdir)/../regformats/reg-x86-64.dat $(regdat_sh)
-	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-x86-64.dat reg-x86-64.c
-reg-x86-64-linux.o : reg-x86-64-linux.c $(regdef_h)
-reg-x86-64-linux.c : $(srcdir)/../regformats/reg-x86-64-linux.dat $(regdat_sh)
-	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-x86-64-linux.dat reg-x86-64-linux.c
+amd64.o : amd64.c $(regdef_h)
+amd64.c : $(srcdir)/../regformats/i386/amd64.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64.dat amd64.c
+amd64-linux.o : amd64-linux.c $(regdef_h)
+amd64-linux.c : $(srcdir)/../regformats/i386/amd64-linux.dat $(regdat_sh)
+	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-linux.dat amd64-linux.c
 reg-xtensa.o : reg-xtensa.c $(regdef_h)
 reg-xtensa.c : $(srcdir)/../regformats/reg-xtensa.dat $(regdat_sh)
 	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-xtensa.dat reg-xtensa.c
--- ./gdb/gdbserver/configure.srv	2010-01-04 16:03:00.000000000 +0100
+++ ./gdb/gdbserver/configure.srv	2010-04-03 20:59:52.000000000 +0200
@@ -22,6 +22,18 @@
 # Default hostio_last_error implementation
 srv_hostio_err_objs="hostio-errno.o"
 
+srv_i386_regobj=i386.o
+srv_i386_linux_regobj=i386-linux.o
+srv_amd64_regobj=amd64.o
+srv_amd64_linux_regobj=amd64-linux.o
+
+srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml"
+srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml"
+srv_i386_xmlfiles="i386/i386.xml $srv_i386_32bit_xmlfiles"
+srv_amd64_xmlfiles="i386/amd64.xml $srv_i386_64bit_xmlfiles"
+srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles"
+srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles"
+
 # Input is taken from the "${target}" variable.
 
 case "${target}" in
@@ -60,12 +72,15 @@ case "${target}" in
 			srv_linux_usrregs=yes
 			srv_linux_thread_db=yes
 			;;
-  i[34567]86-*-cygwin*)	srv_regobj=reg-i386.o
+  i[34567]86-*-cygwin*)	srv_regobj="$srv_i386_regobj"
 			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
+			srv_xmlfiles="$srv_i386_xmlfiles"
 			;;
-  i[34567]86-*-linux*)	srv_regobj=reg-i386-linux.o
+  i[34567]86-*-linux*)	srv_regobj="$srv_i386_linux_regobj"
+			srv_xmlfiles="$srv_i386_linux_xmlfiles"
 			if test "$gdb_cv_i386_is_x86_64" = yes ; then
-			    srv_regobj="reg-x86-64-linux.o $srv_regobj"
+			    srv_regobj="$srv_regobj $srv_amd64_linux_regobj"
+			    srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles"
 			fi
 			srv_tgtobj="linux-low.o linux-x86-low.o i386-low.o i387-fp.o"
 			srv_linux_usrregs=yes
@@ -73,20 +88,23 @@ case "${target}" in
 			srv_linux_thread_db=yes
 			;;
   i[34567]86-*-mingw32ce*)
-			srv_regobj=reg-i386.o
+			srv_regobj="$srv_i386_regobj"
 			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
 			srv_tgtobj="${srv_tgtobj} wincecompat.o"
+			srv_xmlfiles="$srv_i386_xmlfiles"
 			# hostio_last_error implementation is in win32-low.c
 			srv_hostio_err_objs=""
 			srv_mingw=yes
 			srv_mingwce=yes
 			;;
-  i[34567]86-*-mingw*)	srv_regobj=reg-i386.o
+  i[34567]86-*-mingw*)	srv_regobj="$srv_i386_regobj"
 			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
+			srv_xmlfiles="$srv_i386_xmlfiles"
 			srv_mingw=yes
 			;;
-  i[34567]86-*-nto*)	srv_regobj=reg-i386.o
+  i[34567]86-*-nto*)	srv_regobj="$srv_i386_regobj"
 			srv_tgtobj="nto-low.o nto-x86-low.o"
+			srv_xmlfiles="$srv_i386_xmlfiles"
 			srv_qnx="yes"
 			;;
   ia64-*-linux*)	srv_regobj=reg-ia64.o
@@ -206,8 +224,9 @@ case "${target}" in
   spu*-*-*)		srv_regobj=reg-spu.o
 			srv_tgtobj="spu-low.o"
 			;;
-  x86_64-*-linux*)	srv_regobj="reg-x86-64-linux.o reg-i386-linux.o"
+  x86_64-*-linux*)	srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
 			srv_tgtobj="linux-low.o linux-x86-low.o i386-low.o i387-fp.o"
+			srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles"
 			srv_linux_usrregs=yes # This is for i386 progs.
 			srv_linux_regsets=yes
 			srv_linux_thread_db=yes
--- ./gdb/gdbserver/linux-x86-low.c	2010-01-20 23:55:38.000000000 +0100
+++ ./gdb/gdbserver/linux-x86-low.c	2010-04-03 20:59:52.000000000 +0200
@@ -27,10 +27,10 @@
 
 #include "gdb_proc_service.h"
 
-/* Defined in auto-generated file reg-i386-linux.c.  */
+/* Defined in auto-generated file i386-linux.c.  */
 void init_registers_i386_linux (void);
-/* Defined in auto-generated file reg-x86-64-linux.c.  */
-void init_registers_x86_64_linux (void);
+/* Defined in auto-generated file amd64-linux.c.  */
+void init_registers_amd64_linux (void);
 
 #include <sys/reg.h>
 #include <sys/procfs.h>
@@ -792,7 +792,7 @@ x86_arch_setup (void)
     }
   else if (use_64bit)
     {
-      init_registers_x86_64_linux ();
+      init_registers_amd64_linux ();
 
       /* Amd64 doesn't have HAVE_LINUX_USRREGS.  */
       the_low_target.num_regs = -1;
--- ./gdb/i386-linux-nat.c	2010-04-03 20:24:51.000000000 +0200
+++ ./gdb/i386-linux-nat.c	2010-04-03 20:59:52.000000000 +0200
@@ -868,6 +868,14 @@ i386_linux_child_post_startup_inferior (
   super_post_startup_inferior (ptid);
 }
 
+/* Get Linux/x86 target description from running target.  */
+
+static const struct target_desc *
+i386_linux_read_description (struct target_ops *ops)
+{
+  return tdesc_i386_linux;
+}
+
 void
 _initialize_i386_linux_nat (void)
 {
@@ -897,6 +905,8 @@ _initialize_i386_linux_nat (void)
   t->to_fetch_registers = i386_linux_fetch_inferior_registers;
   t->to_store_registers = i386_linux_store_inferior_registers;
 
+  t->to_read_description = i386_linux_read_description;
+
   /* Register the target.  */
   linux_nat_add_target (t);
   linux_nat_set_new_thread (t, i386_linux_new_thread);
--- ./gdb/i386-linux-tdep.c	2010-04-03 20:24:51.000000000 +0200
+++ ./gdb/i386-linux-tdep.c	2010-04-03 20:59:52.000000000 +0200
@@ -46,6 +46,8 @@
 #include "linux-record.h"
 #include <stdint.h>
 
+#include "features/i386/i386-linux.c"
+
 /* Supported register note sections.  */
 static struct core_regset_section i386_linux_regset_sections[] =
 {
@@ -55,18 +57,6 @@ static struct core_regset_section i386_l
   { NULL, 0 }
 };
 
-/* Return the name of register REG.  */
-
-static const char *
-i386_linux_register_name (struct gdbarch *gdbarch, int reg)
-{
-  /* Deal with the extra "orig_eax" pseudo register.  */
-  if (reg == I386_LINUX_ORIG_EAX_REGNUM)
-    return "orig_eax";
-
-  return i386_register_name (gdbarch, reg);
-}
-
 /* Return non-zero, when the register is in the corresponding register
    group.  Put the LINUX_ORIG_EAX register in the system group.  */
 static int
@@ -570,21 +560,57 @@ static int i386_linux_sc_reg_offset[] =
   0 * 4				/* %gs */
 };
 
+/* Get Linux/x86 target description from core dump.  */
+
+static const struct target_desc *
+i386_linux_core_read_description (struct gdbarch *gdbarch,
+				  struct target_ops *target,
+				  bfd *abfd)
+{
+  asection *section = bfd_get_section_by_name (abfd, ".reg2");
+
+  if (section == NULL)
+    return NULL;
+
+  /* Linux/i386.  */
+  return tdesc_i386_linux;
+}
+
 static void
 i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  const struct target_desc *tdesc = info.target_desc;
+  struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+  const struct tdesc_feature *feature;
+  int valid_p;
+
+  gdb_assert (tdesc_data);
 
   /* GNU/Linux uses ELF.  */
   i386_elf_init_abi (info, gdbarch);
 
-  /* Since we have the extra "orig_eax" register on GNU/Linux, we have
-     to adjust a few things.  */
+  /* Reserve a number for orig_eax.  */
+  set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS);
+
+  if (! tdesc_has_registers (tdesc))
+    tdesc = tdesc_i386_linux;
+  tdep->tdesc = tdesc;
+
+  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux");
+  if (feature == NULL)
+    return;
+
+  valid_p = tdesc_numbered_register (feature, tdesc_data,
+				     I386_LINUX_ORIG_EAX_REGNUM,
+				     "orig_eax");
+  if (!valid_p)
+    return;
 
+  /* Add the %orig_eax register used for syscall restarting.  */
   set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
-  set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS);
-  set_gdbarch_register_name (gdbarch, i386_linux_register_name);
-  set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p);
+
+  tdep->register_reggroup_p = i386_linux_register_reggroup_p;
 
   tdep->gregset_reg_offset = i386_linux_gregset_reg_offset;
   tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset);
@@ -783,6 +809,9 @@ i386_linux_init_abi (struct gdbarch_info
   /* Install supported register note sections.  */
   set_gdbarch_core_regset_sections (gdbarch, i386_linux_regset_sections);
 
+  set_gdbarch_core_read_description (gdbarch,
+				     i386_linux_core_read_description);
+
   /* Displaced stepping.  */
   set_gdbarch_displaced_step_copy_insn (gdbarch,
                                         simple_displaced_step_copy_insn);
@@ -811,4 +840,7 @@ _initialize_i386_linux_tdep (void)
 {
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
 			  i386_linux_init_abi);
+
+  /* Initialize the Linux target description  */
+  initialize_tdesc_i386_linux ();
 }
--- ./gdb/i386-linux-tdep.h	2010-01-01 08:31:34.000000000 +0100
+++ ./gdb/i386-linux-tdep.h	2010-04-03 20:59:52.000000000 +0200
@@ -35,4 +35,7 @@
 /* Total number of registers for GNU/Linux.  */
 #define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1)
 
+/* Linux target description.  */
+extern struct target_desc *tdesc_i386_linux;
+
 #endif /* i386-linux-tdep.h */
--- ./gdb/i386-nto-tdep.c	2010-01-01 08:31:34.000000000 +0100
+++ ./gdb/i386-nto-tdep.c	2010-04-03 20:59:52.000000000 +0200
@@ -122,7 +122,7 @@ i386nto_regset_id (int regno)
     return NTO_REG_END;
   else if (regno < I386_NUM_GREGS)
     return NTO_REG_GENERAL;
-  else if (regno < I386_NUM_GREGS + I386_NUM_FREGS)
+  else if (regno < I386_NUM_GREGS + I387_NUM_REGS)
     return NTO_REG_FLOAT;
   else if (regno < I386_SSE_NUM_REGS)
     return NTO_REG_FLOAT; /* We store xmm registers in fxsave_area.  */
--- ./gdb/i386-tdep.c	2010-04-03 20:24:51.000000000 +0200
+++ ./gdb/i386-tdep.c	2010-04-03 20:59:52.000000000 +0200
@@ -54,9 +54,11 @@
 #include "record.h"
 #include <stdint.h>
 
+#include "features/i386/i386.c"
+
 /* Register names.  */
 
-static char *i386_register_names[] =
+static const char *i386_register_names[] =
 {
   "eax",   "ecx",    "edx",   "ebx",
   "esp",   "ebp",    "esi",   "edi",
@@ -71,11 +73,9 @@ static char *i386_register_names[] =
   "mxcsr"
 };
 
-static const int i386_num_register_names = ARRAY_SIZE (i386_register_names);
-
 /* Register names for MMX pseudo-registers.  */
 
-static char *i386_mmx_names[] =
+static const char *i386_mmx_names[] =
 {
   "mm0", "mm1", "mm2", "mm3",
   "mm4", "mm5", "mm6", "mm7"
@@ -147,16 +147,11 @@ i386_fpc_regnum_p (struct gdbarch *gdbar
 
 /* Return the name of register REGNUM.  */
 
-const char *
-i386_register_name (struct gdbarch *gdbarch, int regnum)
+static const char *
+i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
 {
-  if (i386_mmx_regnum_p (gdbarch, regnum))
-    return i386_mmx_names[regnum - I387_MM0_REGNUM (gdbarch_tdep (gdbarch))];
-
-  if (regnum >= 0 && regnum < i386_num_register_names)
-    return i386_register_names[regnum];
-
-  return NULL;
+  gdb_assert (i386_mmx_regnum_p (gdbarch, regnum));
+  return i386_mmx_names[regnum - I387_MM0_REGNUM (gdbarch_tdep (gdbarch))];
 }
 
 /* Convert a dbx register number REG to the appropriate register
@@ -2112,87 +2107,22 @@ i386_return_value (struct gdbarch *gdbar
 }
 
 
-/* Construct types for ISA-specific registers.  */
-struct type *
-i386_eflags_type (struct gdbarch *gdbarch)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  if (!tdep->i386_eflags_type)
-    {
-      struct type *type;
-
-      type = arch_flags_type (gdbarch, "builtin_type_i386_eflags", 4);
-      append_flags_type_flag (type, 0, "CF");
-      append_flags_type_flag (type, 1, NULL);
-      append_flags_type_flag (type, 2, "PF");
-      append_flags_type_flag (type, 4, "AF");
-      append_flags_type_flag (type, 6, "ZF");
-      append_flags_type_flag (type, 7, "SF");
-      append_flags_type_flag (type, 8, "TF");
-      append_flags_type_flag (type, 9, "IF");
-      append_flags_type_flag (type, 10, "DF");
-      append_flags_type_flag (type, 11, "OF");
-      append_flags_type_flag (type, 14, "NT");
-      append_flags_type_flag (type, 16, "RF");
-      append_flags_type_flag (type, 17, "VM");
-      append_flags_type_flag (type, 18, "AC");
-      append_flags_type_flag (type, 19, "VIF");
-      append_flags_type_flag (type, 20, "VIP");
-      append_flags_type_flag (type, 21, "ID");
-
-      tdep->i386_eflags_type = type;
-    }
-
-  return tdep->i386_eflags_type;
-}
-
-struct type *
-i386_mxcsr_type (struct gdbarch *gdbarch)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  if (!tdep->i386_mxcsr_type)
-    {
-      struct type *type;
-
-      type = arch_flags_type (gdbarch, "builtin_type_i386_mxcsr", 4);
-      append_flags_type_flag (type, 0, "IE");
-      append_flags_type_flag (type, 1, "DE");
-      append_flags_type_flag (type, 2, "ZE");
-      append_flags_type_flag (type, 3, "OE");
-      append_flags_type_flag (type, 4, "UE");
-      append_flags_type_flag (type, 5, "PE");
-      append_flags_type_flag (type, 6, "DAZ");
-      append_flags_type_flag (type, 7, "IM");
-      append_flags_type_flag (type, 8, "DM");
-      append_flags_type_flag (type, 9, "ZM");
-      append_flags_type_flag (type, 10, "OM");
-      append_flags_type_flag (type, 11, "UM");
-      append_flags_type_flag (type, 12, "PM");
-      append_flags_type_flag (type, 15, "FZ");
-
-      tdep->i386_mxcsr_type = type;
-    }
-
-  return tdep->i386_mxcsr_type;
-}
-
 struct type *
 i387_ext_type (struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (!tdep->i387_ext_type)
-    tdep->i387_ext_type
-      = arch_float_type (gdbarch, -1, "builtin_type_i387_ext",
-			 floatformats_i387_ext);
+    {
+      tdep->i387_ext_type = tdesc_find_type (gdbarch, "i387_ext");
+      gdb_assert (tdep->i387_ext_type != NULL);
+    }
 
   return tdep->i387_ext_type;
 }
 
 /* Construct vector type for MMX registers.  */
-struct type *
+static struct type *
 i386_mmx_type (struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -2233,84 +2163,14 @@ i386_mmx_type (struct gdbarch *gdbarch)
   return tdep->i386_mmx_type;
 }
 
-struct type *
-i386_sse_type (struct gdbarch *gdbarch)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  if (!tdep->i386_sse_type)
-    {
-      const struct builtin_type *bt = builtin_type (gdbarch);
-
-      /* The type we're building is this: */
-#if 0
-      union __gdb_builtin_type_vec128i
-      {
-        int128_t uint128;
-        int64_t v2_int64[2];
-        int32_t v4_int32[4];
-        int16_t v8_int16[8];
-        int8_t v16_int8[16];
-        double v2_double[2];
-        float v4_float[4];
-      };
-#endif
-
-      struct type *t;
-
-      t = arch_composite_type (gdbarch,
-			       "__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
-      append_composite_type_field (t, "v4_float",
-				   init_vector_type (bt->builtin_float, 4));
-      append_composite_type_field (t, "v2_double",
-				   init_vector_type (bt->builtin_double, 2));
-      append_composite_type_field (t, "v16_int8",
-				   init_vector_type (bt->builtin_int8, 16));
-      append_composite_type_field (t, "v8_int16",
-				   init_vector_type (bt->builtin_int16, 8));
-      append_composite_type_field (t, "v4_int32",
-				   init_vector_type (bt->builtin_int32, 4));
-      append_composite_type_field (t, "v2_int64",
-				   init_vector_type (bt->builtin_int64, 2));
-      append_composite_type_field (t, "uint128", bt->builtin_int128);
-
-      TYPE_VECTOR (t) = 1;
-      TYPE_NAME (t) = "builtin_type_vec128i";
-      tdep->i386_sse_type = t;
-    }
-
-  return tdep->i386_sse_type;
-}
-
 /* Return the GDB type object for the "standard" data type of data in
-   register REGNUM.  Perhaps %esi and %edi should go here, but
-   potentially they could be used for things other than address.  */
+   register REGNUM. */
 
 static struct type *
-i386_register_type (struct gdbarch *gdbarch, int regnum)
+i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
 {
-  if (regnum == I386_EIP_REGNUM)
-    return builtin_type (gdbarch)->builtin_func_ptr;
-
-  if (regnum == I386_EFLAGS_REGNUM)
-    return i386_eflags_type (gdbarch);
-
-  if (regnum == I386_EBP_REGNUM || regnum == I386_ESP_REGNUM)
-    return builtin_type (gdbarch)->builtin_data_ptr;
-
-  if (i386_fp_regnum_p (gdbarch, regnum))
-    return i387_ext_type (gdbarch);
-
-  if (i386_mmx_regnum_p (gdbarch, regnum))
-    return i386_mmx_type (gdbarch);
-
-  if (i386_sse_regnum_p (gdbarch, regnum))
-    return i386_sse_type (gdbarch);
-
-  if (regnum == I387_MXCSR_REGNUM (gdbarch_tdep (gdbarch)))
-    return i386_mxcsr_type (gdbarch);
-
-  return builtin_type (gdbarch)->builtin_int;
+  gdb_assert (i386_mmx_regnum_p (gdbarch, regnum));
+  return i386_mmx_type (gdbarch);
 }
 
 /* Map a cooked register onto a raw register or memory.  For the i386,
@@ -2761,7 +2621,7 @@ i386_go32_init_abi (struct gdbarch_info 
 
   /* DJGPP does not support the SSE registers.  */
   tdep->num_xmm_regs = 0;
-  set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS);
+  set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I387_NUM_REGS);
 
   /* Native compiler is GCC, which uses the SVR4 register numbering
      even in COFF and STABS.  See the comment in i386_gdbarch_init,
@@ -5623,12 +5483,50 @@ i386_fast_tracepoint_valid_at (struct gd
   return 1;
 }
 
+static int
+i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
+		       struct tdesc_arch_data *tdesc_data)
+{
+  const struct target_desc *tdesc = tdep->tdesc;
+  const struct tdesc_feature *feature_core, *feature_vector;
+  int i, num_regs, valid_p;
+
+  if (! tdesc_has_registers (tdesc))
+    return 0;
+
+  /* Get core registers.  */
+  feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core");
+
+  /* Get SSE registers.  */
+  feature_vector = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse");
+
+  if (feature_core == NULL || feature_vector == NULL)
+    return 0;
+
+  valid_p = 1;
+
+  num_regs = tdep->num_core_regs;
+  for (i = 0; i < num_regs; i++)
+    valid_p &= tdesc_numbered_register (feature_core, tdesc_data, i,
+					tdep->register_names[i]);
+
+  /* Need to include %mxcsr, so add one.  */
+  num_regs += tdep->num_xmm_regs + 1;
+  for (; i < num_regs; i++)
+    valid_p &= tdesc_numbered_register (feature_vector, tdesc_data, i,
+					tdep->register_names[i]);
+
+  return valid_p;
+}
+
 
 static struct gdbarch *
 i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
+  struct tdesc_arch_data *tdesc_data;
+  const struct target_desc *tdesc;
 
   /* If there is already a candidate, use it.  */
   arches = gdbarch_list_lookup_by_info (arches, &info);
@@ -5699,12 +5597,6 @@ i386_gdbarch_init (struct gdbarch_info i
      alignment.  */
   set_gdbarch_long_double_bit (gdbarch, 96);
 
-  /* The default ABI includes general-purpose registers, 
-     floating-point registers, and the SSE registers.  */
-  set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS);
-  set_gdbarch_register_name (gdbarch, i386_register_name);
-  set_gdbarch_register_type (gdbarch, i386_register_type);
-
   /* Register numbers of various important registers.  */
   set_gdbarch_sp_regnum (gdbarch, I386_ESP_REGNUM); /* %esp */
   set_gdbarch_pc_regnum (gdbarch, I386_EIP_REGNUM); /* %eip */
@@ -5775,11 +5667,6 @@ i386_gdbarch_init (struct gdbarch_info i
 
   set_gdbarch_frame_args_skip (gdbarch, 8);
 
-  /* Wire in the MMX registers.  */
-  set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs);
-  set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read);
-  set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write);
-
   set_gdbarch_print_insn (gdbarch, i386_print_insn);
 
   set_gdbarch_dummy_id (gdbarch, i386_dummy_id);
@@ -5788,7 +5675,7 @@ i386_gdbarch_init (struct gdbarch_info i
 
   /* Add the i386 register groups.  */
   i386_add_reggroups (gdbarch);
-  set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
+  tdep->register_reggroup_p = i386_register_reggroup_p;
 
   /* Helper for function argument information.  */
   set_gdbarch_fetch_pointer_argument (gdbarch, i386_fetch_pointer_argument);
@@ -5806,9 +5693,49 @@ i386_gdbarch_init (struct gdbarch_info i
 
   frame_base_set_default (gdbarch, &i386_frame_base);
 
+  /* Wire in the MMX registers.  */
+  set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs);
+  set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read);
+  set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write);
+
+  set_tdesc_pseudo_register_type (gdbarch, i386_pseudo_register_type);
+  set_tdesc_pseudo_register_name (gdbarch, i386_pseudo_register_name);
+
+  /* The default ABI includes general-purpose registers, 
+     floating-point registers, and the SSE registers.  */
+  set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS);
+
+  /* Get the x86 target description from INFO.  */
+  tdesc = info.target_desc;
+  if (! tdesc_has_registers (tdesc))
+    tdesc = tdesc_i386;
+  tdep->tdesc = tdesc;
+
+  tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS;
+  tdep->register_names = i386_register_names;
+
+  tdesc_data = tdesc_data_alloc ();
+
   /* Hook in ABI-specific overrides, if they have been registered.  */
+  info.tdep_info = (void *) tdesc_data;
   gdbarch_init_osabi (info, gdbarch);
 
+  /* Target description may be changed.  */
+  tdesc = tdep->tdesc;
+
+  if (!i386_validate_tdesc_p (tdep, tdesc_data))
+    {
+      tdesc_data_cleanup (tdesc_data);
+      xfree (tdep);
+      gdbarch_free (gdbarch);
+      return NULL;
+    }
+
+  tdesc_use_registers (gdbarch, tdesc, tdesc_data);
+
+  /* Override gdbarch_register_reggroup_p set in tdesc_use_registers.  */
+  set_gdbarch_register_reggroup_p (gdbarch, tdep->register_reggroup_p);
+
   /* Hook in the legacy prologue-based unwinders last (fallback).  */
   frame_unwind_append_unwinder (gdbarch, &i386_sigtramp_frame_unwind);
   frame_unwind_append_unwinder (gdbarch, &i386_frame_unwind);
@@ -5885,4 +5812,7 @@ is \"default\"."),
 
   /* Initialize the i386-specific register groups.  */
   i386_init_reggroups ();
+
+  /* Initialize the standard target descriptions.  */
+  initialize_tdesc_i386 ();
 }
--- ./gdb/i386-tdep.h	2010-04-03 20:24:51.000000000 +0200
+++ ./gdb/i386-tdep.h	2010-04-03 20:59:52.000000000 +0200
@@ -118,9 +118,21 @@ struct gdbarch_tdep
      of MMX support.  */
   int mm0_regnum;
 
+  /* Number of core registers.  */
+  int num_core_regs;
+
   /* Number of SSE registers.  */
   int num_xmm_regs;
 
+  /* Register names.  */
+  const char **register_names;
+
+  /* Target description.  */
+  const struct target_desc *tdesc;
+
+  /* Register group function.  */
+  const void *register_reggroup_p;
+
   /* Offset of saved PC in jmp_buf.  */
   int jb_pc_offset;
 
@@ -147,10 +159,7 @@ struct gdbarch_tdep
   int sc_sp_offset;
 
   /* ISA-specific data types.  */
-  struct type *i386_eflags_type;
-  struct type *i386_mxcsr_type;
   struct type *i386_mmx_type;
-  struct type *i386_sse_type;
   struct type *i387_ext_type;
 
   /* Process record/replay target.  */
@@ -199,7 +208,8 @@ enum i386_regnum
   I386_ES_REGNUM,		/* %es */
   I386_FS_REGNUM,		/* %fs */
   I386_GS_REGNUM,		/* %gs */
-  I386_ST0_REGNUM		/* %st(0) */
+  I386_ST0_REGNUM,		/* %st(0) */
+  I386_MXCSR_REGNUM = 40	/* %mxcsr */ 
 };
 
 /* Register numbers of RECORD_REGMAP.  */
@@ -233,20 +243,14 @@ enum record_i386_regnum
 };
 
 #define I386_NUM_GREGS	16
-#define I386_NUM_FREGS	16
 #define I386_NUM_XREGS  9
 
-#define I386_SSE_NUM_REGS	(I386_NUM_GREGS + I386_NUM_FREGS \
-				 + I386_NUM_XREGS)
+#define I386_SSE_NUM_REGS	(I386_MXCSR_REGNUM + 1)
 
 /* Size of the largest register.  */
 #define I386_MAX_REGISTER_SIZE	16
 
 /* Types for i386-specific registers.  */
-extern struct type *i386_eflags_type (struct gdbarch *gdbarch);
-extern struct type *i386_mxcsr_type (struct gdbarch *gdbarch);
-extern struct type *i386_mmx_type (struct gdbarch *gdbarch);
-extern struct type *i386_sse_type (struct gdbarch *gdbarch);
 extern struct type *i387_ext_type (struct gdbarch *gdbarch);
 
 /* Segment selectors.  */
@@ -266,9 +270,6 @@ extern CORE_ADDR i386_skip_main_prologue
 /* Return whether the THIS_FRAME corresponds to a sigtramp routine.  */
 extern int i386_sigtramp_p (struct frame_info *this_frame);
 
-/* Return the name of register REGNUM.  */
-extern char const *i386_register_name (struct gdbarch * gdbarch, int regnum);
-
 /* Return non-zero if REGNUM is a member of the specified group.  */
 extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 				     struct reggroup *group);
--- ./gdb/i387-tdep.h	2010-01-01 08:31:36.000000000 +0100
+++ ./gdb/i387-tdep.h	2010-04-03 20:59:52.000000000 +0200
@@ -27,6 +27,9 @@ struct regcache;
 struct type;
 struct ui_file;
 
+/* Number of i387 floating point registers.  */
+#define I387_NUM_REGS	16
+
 #define I387_ST0_REGNUM(tdep) ((tdep)->st0_regnum)
 #define I387_NUM_XMM_REGS(tdep) ((tdep)->num_xmm_regs)
 #define I387_MM0_REGNUM(tdep) ((tdep)->mm0_regnum)
--- ./gdb/regformats/i386/amd64-linux.dat	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/regformats/i386/amd64-linux.dat	2010-04-03 20:59:52.000000000 +0200
@@ -0,0 +1,62 @@
+# DO NOT EDIT: generated from i386/amd64-linux.xml
+name:amd64_linux
+xmltarget:amd64-linux.xml
+expedite:rbp,rsp,rip
+64:rax
+64:rbx
+64:rcx
+64:rdx
+64:rsi
+64:rdi
+64:rbp
+64:rsp
+64:r8
+64:r9
+64:r10
+64:r11
+64:r12
+64:r13
+64:r14
+64:r15
+64:rip
+32:eflags
+32:cs
+32:ss
+32:ds
+32:es
+32:fs
+32:gs
+80:st0
+80:st1
+80:st2
+80:st3
+80:st4
+80:st5
+80:st6
+80:st7
+32:fctrl
+32:fstat
+32:ftag
+32:fiseg
+32:fioff
+32:foseg
+32:fooff
+32:fop
+128:xmm0
+128:xmm1
+128:xmm2
+128:xmm3
+128:xmm4
+128:xmm5
+128:xmm6
+128:xmm7
+128:xmm8
+128:xmm9
+128:xmm10
+128:xmm11
+128:xmm12
+128:xmm13
+128:xmm14
+128:xmm15
+32:mxcsr
+64:orig_rax
--- ./gdb/regformats/i386/amd64.dat	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/regformats/i386/amd64.dat	2010-04-03 20:59:52.000000000 +0200
@@ -0,0 +1,61 @@
+# DO NOT EDIT: generated from i386/amd64.xml
+name:amd64
+xmltarget:amd64.xml
+expedite:rbp,rsp,rip
+64:rax
+64:rbx
+64:rcx
+64:rdx
+64:rsi
+64:rdi
+64:rbp
+64:rsp
+64:r8
+64:r9
+64:r10
+64:r11
+64:r12
+64:r13
+64:r14
+64:r15
+64:rip
+32:eflags
+32:cs
+32:ss
+32:ds
+32:es
+32:fs
+32:gs
+80:st0
+80:st1
+80:st2
+80:st3
+80:st4
+80:st5
+80:st6
+80:st7
+32:fctrl
+32:fstat
+32:ftag
+32:fiseg
+32:fioff
+32:foseg
+32:fooff
+32:fop
+128:xmm0
+128:xmm1
+128:xmm2
+128:xmm3
+128:xmm4
+128:xmm5
+128:xmm6
+128:xmm7
+128:xmm8
+128:xmm9
+128:xmm10
+128:xmm11
+128:xmm12
+128:xmm13
+128:xmm14
+128:xmm15
+32:mxcsr
--- ./gdb/regformats/i386/i386-linux.dat	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/regformats/i386/i386-linux.dat	2010-04-03 20:59:52.000000000 +0200
@@ -0,0 +1,46 @@
+# DO NOT EDIT: generated from i386/i386-linux.xml
+name:i386_linux
+xmltarget:i386-linux.xml
+expedite:ebp,esp,eip
+32:eax
+32:ecx
+32:edx
+32:ebx
+32:esp
+32:ebp
+32:esi
+32:edi
+32:eip
+32:eflags
+32:cs
+32:ss
+32:ds
+32:es
+32:fs
+32:gs
+80:st0
+80:st1
+80:st2
+80:st3
+80:st4
+80:st5
+80:st6
+80:st7
+32:fctrl
+32:fstat
+32:ftag
+32:fiseg
+32:fioff
+32:foseg
+32:fooff
+32:fop
+128:xmm0
+128:xmm1
+128:xmm2
+128:xmm3
+128:xmm4
+128:xmm5
+128:xmm6
+128:xmm7
+32:mxcsr
+32:orig_eax
--- ./gdb/regformats/i386/i386.dat	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/regformats/i386/i386.dat	2010-04-03 20:59:52.000000000 +0200
@@ -0,0 +1,45 @@
+# DO NOT EDIT: generated from i386/i386.xml
+name:i386
+xmltarget:i386.xml
+expedite:ebp,esp,eip
+32:eax
+32:ecx
+32:edx
+32:ebx
+32:esp
+32:ebp
+32:esi
+32:edi
+32:eip
+32:eflags
+32:cs
+32:ss
+32:ds
+32:es
+32:fs
+32:gs
+80:st0
+80:st1
+80:st2
+80:st3
+80:st4
+80:st5
+80:st6
+80:st7
+32:fctrl
+32:fstat
+32:ftag
+32:fiseg
+32:fioff
+32:foseg
+32:fooff
+32:fop
+128:xmm0
+128:xmm1
+128:xmm2
+128:xmm3
+128:xmm4
+128:xmm5
+128:xmm6
+128:xmm7
+32:mxcsr
--- ./gdb/regformats/reg-i386-linux.dat	2009-07-20 20:51:42.000000000 +0200
+++ ./gdb/regformats/reg-i386-linux.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,46 +0,0 @@
-name:i386_linux
-xmlarch:i386
-osabi:GNU/Linux
-expedite:ebp,esp,eip
-32:eax
-32:ecx
-32:edx
-32:ebx
-32:esp
-32:ebp
-32:esi
-32:edi
-32:eip
-32:eflags
-32:cs
-32:ss
-32:ds
-32:es
-32:fs
-32:gs
-80:st0
-80:st1
-80:st2
-80:st3
-80:st4
-80:st5
-80:st6
-80:st7
-32:fctrl
-32:fstat
-32:ftag
-32:fiseg
-32:fioff
-32:foseg
-32:fooff
-32:fop
-128:xmm0
-128:xmm1
-128:xmm2
-128:xmm3
-128:xmm4
-128:xmm5
-128:xmm6
-128:xmm7
-32:mxcsr
-32:orig_eax
--- ./gdb/regformats/reg-i386.dat	2008-02-28 06:54:10.000000000 +0100
+++ ./gdb/regformats/reg-i386.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-name:i386
-xmlarch:i386
-expedite:ebp,esp,eip
-32:eax
-32:ecx
-32:edx
-32:ebx
-32:esp
-32:ebp
-32:esi
-32:edi
-32:eip
-32:eflags
-32:cs
-32:ss
-32:ds
-32:es
-32:fs
-32:gs
-80:st0
-80:st1
-80:st2
-80:st3
-80:st4
-80:st5
-80:st6
-80:st7
-32:fctrl
-32:fstat
-32:ftag
-32:fiseg
-32:fioff
-32:foseg
-32:fooff
-32:fop
-128:xmm0
-128:xmm1
-128:xmm2
-128:xmm3
-128:xmm4
-128:xmm5
-128:xmm6
-128:xmm7
-32:mxcsr
--- ./gdb/regformats/reg-x86-64-linux.dat	2009-07-20 20:51:42.000000000 +0200
+++ ./gdb/regformats/reg-x86-64-linux.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,62 +0,0 @@
-name:x86_64_linux
-xmlarch:i386:x86-64
-osabi:GNU/Linux
-expedite:rbp,rsp,rip
-64:rax
-64:rbx
-64:rcx
-64:rdx
-64:rsi
-64:rdi
-64:rbp
-64:rsp
-64:r8
-64:r9
-64:r10
-64:r11
-64:r12
-64:r13
-64:r14
-64:r15
-64:rip
-32:eflags
-32:cs
-32:ss
-32:ds
-32:es
-32:fs
-32:gs
-80:st0
-80:st1
-80:st2
-80:st3
-80:st4
-80:st5
-80:st6
-80:st7
-32:fctrl
-32:fstat
-32:ftag
-32:fiseg
-32:fioff
-32:foseg
-32:fooff
-32:fop
-128:xmm0
-128:xmm1
-128:xmm2
-128:xmm3
-128:xmm4
-128:xmm5
-128:xmm6
-128:xmm7
-128:xmm8
-128:xmm9
-128:xmm10
-128:xmm11
-128:xmm12
-128:xmm13
-128:xmm14
-128:xmm15
-32:mxcsr
-64:orig_rax
--- ./gdb/regformats/reg-x86-64.dat	2004-01-10 13:52:41.000000000 +0100
+++ ./gdb/regformats/reg-x86-64.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,59 +0,0 @@
-name:x86_64
-expedite:rbp,rsp,rip
-64:rax
-64:rbx
-64:rcx
-64:rdx
-64:rsi
-64:rdi
-64:rbp
-64:rsp
-64:r8
-64:r9
-64:r10
-64:r11
-64:r12
-64:r13
-64:r14
-64:r15
-64:rip
-32:eflags
-32:cs
-32:ss
-32:ds
-32:es
-32:fs
-32:gs
-80:st0
-80:st1
-80:st2
-80:st3
-80:st4
-80:st5
-80:st6
-80:st7
-32:fctrl
-32:fstat
-32:ftag
-32:fiseg
-32:fioff
-32:foseg
-32:fooff
-32:fop
-128:xmm0
-128:xmm1
-128:xmm2
-128:xmm3
-128:xmm4
-128:xmm5
-128:xmm6
-128:xmm7
-128:xmm8
-128:xmm9
-128:xmm10
-128:xmm11
-128:xmm12
-128:xmm13
-128:xmm14
-128:xmm15
-32:mxcsr
--- ./gdb/testsuite/gdb.xml/tdesc-regs.exp	2010-02-16 22:26:48.000000000 +0100
+++ ./gdb/testsuite/gdb.xml/tdesc-regs.exp	2010-04-03 20:59:52.000000000 +0200
@@ -25,6 +25,7 @@ gdb_start
 
 set core-regs ""
 set regdir ""
+set architecture ""
 switch -glob -- [istarget] {
     "*arm-*-*" {
         set core-regs {arm-core.xml}
@@ -55,6 +56,16 @@ switch -glob -- [istarget] {
 	unsupported "register tests"
 	return 0
     }
+    "i?86-*-*" {
+	set architecture "i386"
+	set regdir "i386/"
+        set core-regs {32bit-core.xml 32bit-sse.xml}
+    }
+    "x86_64-*-*" {
+	set architecture "i386:x86-64"
+	set regdir "i386/"
+        set core-regs {64bit-core.xml 64bit-sse.xml}
+    }
 }
 
 # If no core registers were specified, assume this target does not
@@ -89,12 +100,16 @@ proc load_description { file errmsg } {
     global subdir
     global gdb_prompt
     global core-regs
+    global architecture
 
     file delete "$subdir/regs.xml"
     set ifd [open "$srcdir/$subdir/$file" r]
     set ofd [open "$subdir/regs.xml" w]
     while {[gets $ifd line] >= 0} {
 	if {[regexp {<xi:include href="core-regs.xml"/>} $line]} {
+	    if {! [string equal ${architecture} ""]} {
+		puts $ofd "  <architecture>${architecture}</architecture>"
+	    }
 	    foreach src ${core-regs} {
 		puts $ofd "  <xi:include href=\"$src\"/>"
 	    }

gdb-bz578250-avx-02of10.patch:
 doc/gdb.texinfo                  |   41 ++++++++
 features/gdb-target.dtd          |   17 +++
 gdbtypes.c                       |   19 +++
 gdbtypes.h                       |    2 
 target-descriptions.c            |  192 ++++++++++++++++++++++++++++++++++++++-
 target-descriptions.h            |   10 ++
 testsuite/gdb.xml/extra-regs.xml |   18 +++
 testsuite/gdb.xml/tdesc-regs.exp |    5 +
 xml-tdesc.c                      |  164 ++++++++++++++++++++++++++++++---
 9 files changed, 442 insertions(+), 26 deletions(-)

--- NEW FILE gdb-bz578250-avx-02of10.patch ---
[ Backported.  ]

commit cb928c67c90cfb5bbb0636d91855b95e51ad275d
Author: Daniel Jacobowitz <dan at debian.org>
Date:   Mon Mar 1 17:19:21 2010 +0000

    	* gdbtypes.c (append_composite_type_field_raw): New.
    	(append_composite_type_field_aligned): Use the new function.
    	* gdbtypes.h (append_composite_type_field_raw): Declare.
    	* target-descriptions.c (struct tdesc_type_field): Add start and end.
    	(struct tdesc_type_flag): New type.
    	(struct tdesc_type): Add TDESC_TYPE_STRUCT and TDESC_TYPE_FLAGS to
    	kind.  Add size to u.u.  Add u.f for flags.
    	(tdesc_gdb_type): Handle TDESC_TYPE_STRUCT and TDESC_TYPE_FLAGS.
    	(tdesc_free_type): Likewise.
    	(tdesc_create_struct, tdesc_set_struct_size, tdesc_create_flags): New.
    	(tdesc_add_field): Handle TDESC_TYPE_STRUCT.
    	(tdesc_add_bitfield, tdesc_add_flag): New.
    	* target-descriptions.h (tdesc_create_struct, tdesc_set_struct_size)
    	(tdesc_create_flags, tdesc_add_bitfield, tdesc_add_flag): Declare.
    	* xml-tdesc.c (struct tdesc_parsing_data): Rename current_union to
    	current_type.  Add current_type_size and current_type_is_flags.
    	(tdesc_start_union): Clear the new fields.
    	(tdesc_start_struct, tdesc_start_flags): New.
    	(tdesc_start_field): Handle struct fields, including bitfields.
    	(field_attributes): Make type optional.  Add start and end.
    	(union_children): Rename to struct_union_children.
    	(union_attributes): Rename to struct_union_attributes.  Add optional
    	size.
    	(flags_attributes): New.
    	(feature_children): Add struct and flags.
    	* features/gdb-target.dtd: Add flags and struct to features.
    	Make field type optional.  Add field start and end.
    
    	doc/
    	* gdb.texinfo (Types): Describe <struct> and <flags>.
    
    	testsuite/
    	* gdb.xml/extra-regs.xml: Add struct1, struct2, and flags
    	types.  Add structreg, bitfields, and flags registers.
    	* gdb.xml/tdesc-regs.exp: Test structreg and bitfields
    	registers.

--- gdb-7.1-p0/gdb/doc/gdb.texinfo	2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo	2010-04-03 21:04:13.000000000 +0200
@@ -33115,6 +33115,47 @@ each of which has a @var{name} and a @va
 </union>
 @end smallexample
 
+ at cindex <struct>
+If a register's value is composed from several separate values, define
+it with a structure type.  There are two forms of the @samp{<struct>}
+element; a @samp{<struct>} element must either contain only bitfields
+or contain no bitfields.  If the structure contains only bitfields,
+its total size in bytes must be specified, each bitfield must have an
+explicit start and end, and bitfields are automatically assigned an
+integer type.  The field's @var{start} should be less than or
+equal to its @var{end}, and zero represents the least significant bit.
+
+ at smallexample
+<struct id="@var{id}" size="@var{size}">
+  <field name="@var{name}" start="@var{start}" end="@var{end}"/>
+  @dots{}
+</struct>
+ at end smallexample
+
+If the structure contains no bitfields, then each field has an
+explicit type, and no implicit padding is added.
+
+ at smallexample
+<struct id="@var{id}">
+  <field name="@var{name}" type="@var{type}"/>
+  @dots{}
+</struct>
+ at end smallexample
+
+ at cindex <flags>
+If a register's value is a series of single-bit flags, define it with
+a flags type.  The @samp{<flags>} element has an explicit @var{size}
+and contains one or more @samp{<field>} elements.  Each field has a
+ at var{name}, a @var{start}, and an @var{end}.  Only single-bit flags
+are supported.
+
+ at smallexample
+<flags id="@var{id}" size="@var{size}">
+  <field name="@var{name}" start="@var{start}" end="@var{end}"/>
+  @dots{}
+</flags>
+ at end smallexample
+
 @subsection Registers
 @cindex <reg>
 
--- gdb-7.1-p0/gdb/features/gdb-target.dtd	2010-01-01 08:31:48.000000000 +0100
+++ gdb-7.1/gdb/features/gdb-target.dtd	2010-04-03 21:04:13.000000000 +0200
@@ -19,7 +19,8 @@
 
 <!ELEMENT compatible	(#PCDATA)>
 
-<!ELEMENT feature	((vector | union)*, reg*)>
+<!ELEMENT feature
+	((vector | flags | struct | union )*, reg*)>
 <!ATTLIST feature
 	name		ID	#REQUIRED>
 
@@ -39,6 +40,16 @@
 	type		CDATA	#REQUIRED
 	count		CDATA	#REQUIRED>
 
+<!ELEMENT flags		(field+)>
+<!ATTLIST flags
+	id		CDATA	#REQUIRED
+	size		CDATA	#REQUIRED>
+
+<!ELEMENT struct	(field+)>
+<!ATTLIST struct
+	id		CDATA	#REQUIRED
+	size		CDATA	#IMPLIED>
+
 <!ELEMENT union		(field+)>
 <!ATTLIST union
 	id		CDATA	#REQUIRED>
@@ -46,7 +57,9 @@
 <!ELEMENT field		EMPTY>
 <!ATTLIST field
 	name		CDATA	#REQUIRED
-	type		CDATA	#REQUIRED>
+	type		CDATA	#IMPLIED
+	start		CDATA	#IMPLIED
+	end		CDATA	#IMPLIED>
 
 <!ENTITY % xinclude SYSTEM "xinclude.dtd">
 %xinclude;
--- gdb-7.1-p0/gdb/gdbtypes.c	2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/gdbtypes.c	2010-04-03 21:04:13.000000000 +0200
@@ -3798,10 +3798,11 @@ arch_composite_type (struct gdbarch *gdb
 }
 
 /* Add new field with name NAME and type FIELD to composite type T.
-   ALIGNMENT (if non-zero) specifies the minimum field alignment.  */
-void
-append_composite_type_field_aligned (struct type *t, char *name,
-				     struct type *field, int alignment)
+   Do not set the field's position or adjust the type's length;
+   the caller should do so.  Return the new field.  */
+struct field *
+append_composite_type_field_raw (struct type *t, char *name,
+				 struct type *field)
 {
   struct field *f;
   TYPE_NFIELDS (t) = TYPE_NFIELDS (t) + 1;
@@ -3811,6 +3812,16 @@ append_composite_type_field_aligned (str
   memset (f, 0, sizeof f[0]);
   FIELD_TYPE (f[0]) = field;
   FIELD_NAME (f[0]) = name;
+  return f;
+}
+
+/* Add new field with name NAME and type FIELD to composite type T.
+   ALIGNMENT (if non-zero) specifies the minimum field alignment.  */
+void
+append_composite_type_field_aligned (struct type *t, char *name,
+				     struct type *field, int alignment)
+{
+  struct field *f = append_composite_type_field_raw (t, name, field);
   if (TYPE_CODE (t) == TYPE_CODE_UNION)
     {
       if (TYPE_LENGTH (t) < TYPE_LENGTH (field))
--- gdb-7.1-p0/gdb/gdbtypes.h	2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/gdbtypes.h	2010-04-03 21:04:13.000000000 +0200
@@ -1395,6 +1395,8 @@ extern void append_composite_type_field_
 						 char *name,
 						 struct type *field,
 						 int alignment);
+struct field *append_composite_type_field_raw (struct type *t, char *name,
+					       struct type *field);
 
 /* Helper functions to construct a bit flags type.  An initially empty
    type is created using arch_flag_type().  Flags are then added using
--- gdb-7.1-p0/gdb/target-descriptions.c	2010-02-10 19:45:02.000000000 +0100
+++ gdb-7.1/gdb/target-descriptions.c	2010-04-03 21:04:13.000000000 +0200
@@ -90,9 +90,17 @@ typedef struct tdesc_type_field
 {
   char *name;
   struct tdesc_type *type;
+  int start, end;
 } tdesc_type_field;
 DEF_VEC_O(tdesc_type_field);
 
+typedef struct tdesc_type_flag
+{
+  char *name;
+  int start;
+} tdesc_type_flag;
+DEF_VEC_O(tdesc_type_flag);
+
 typedef struct tdesc_type
 {
   /* The name of this type.  */
@@ -123,7 +131,9 @@ typedef struct tdesc_type
 
     /* Types defined by a target feature.  */
     TDESC_TYPE_VECTOR,
-    TDESC_TYPE_UNION
+    TDESC_TYPE_STRUCT,
+    TDESC_TYPE_UNION,
+    TDESC_TYPE_FLAGS
   } kind;
 
   /* Kind-specific data.  */
@@ -136,11 +146,19 @@ typedef struct tdesc_type
       int count;
     } v;
 
-    /* Union type.  */
+    /* Struct or union type.  */
     struct
     {
       VEC(tdesc_type_field) *fields;
+      LONGEST size;
     } u;
+
+    /* Flags type.  */
+    struct
+    {
+      VEC(tdesc_type_flag) *flags;
+      LONGEST size;
+    } f;
   } u;
 } *tdesc_type_p;
 DEF_VEC_P(tdesc_type_p);
@@ -652,6 +670,66 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
 	return type;
       }
 
+    case TDESC_TYPE_STRUCT:
+      {
+	struct type *type, *field_type;
+	struct tdesc_type_field *f;
+	int ix;
+
+	type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
+	TYPE_NAME (type) = xstrdup (tdesc_type->name);
+	TYPE_TAG_NAME (type) = TYPE_NAME (type);
+
+	for (ix = 0;
+	     VEC_iterate (tdesc_type_field, tdesc_type->u.u.fields, ix, f);
+	     ix++)
+	  {
+	    if (f->type == NULL)
+	      {
+		/* Bitfield.  */
+		struct field *fld;
+		struct type *field_type;
+		int bitsize, total_size;
+
+		/* This invariant should be preserved while creating
+		   types.  */
+		gdb_assert (tdesc_type->u.u.size != 0);
+		if (tdesc_type->u.u.size > 4)
+		  field_type = builtin_type (gdbarch)->builtin_uint64;
+		else
+		  field_type = builtin_type (gdbarch)->builtin_uint32;
+
+		fld = append_composite_type_field_raw (type, xstrdup (f->name),
+						       field_type);
+
+		/* For little-endian, BITPOS counts from the LSB of
+		   the structure and marks the LSB of the field.  For
+		   big-endian, BITPOS counts from the MSB of the
+		   structure and marks the MSB of the field.  Either
+		   way, it is the number of bits to the "left" of the
+		   field.  To calculate this in big-endian, we need
+		   the total size of the structure.  */
+		bitsize = f->end - f->start + 1;
+		total_size = tdesc_type->u.u.size * TARGET_CHAR_BIT;
+		if (gdbarch_bits_big_endian (gdbarch))
+		  FIELD_BITPOS (fld[0]) = total_size - f->start - bitsize;
+		else
+		  FIELD_BITPOS (fld[0]) = f->start;
+		FIELD_BITSIZE (fld[0]) = bitsize;
+	      }
+	    else
+	      {
+		field_type = tdesc_gdb_type (gdbarch, f->type);
+		append_composite_type_field (type, xstrdup (f->name),
+					     field_type);
+	      }
+	  }
+
+	if (tdesc_type->u.u.size != 0)
+	  TYPE_LENGTH (type) = tdesc_type->u.u.size;
+	return type;
+      }
+
     case TDESC_TYPE_UNION:
       {
 	struct type *type, *field_type;
@@ -668,12 +746,30 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
 	    field_type = tdesc_gdb_type (gdbarch, f->type);
 	    append_composite_type_field (type, xstrdup (f->name), field_type);
 
-	    /* If any of the children of this union are vectors, flag the
+	    /* If any of the children of a union are vectors, flag the
 	       union as a vector also.  This allows e.g. a union of two
 	       vector types to show up automatically in "info vector".  */
 	    if (TYPE_VECTOR (field_type))
 	      TYPE_VECTOR (type) = 1;
 	  }
+	return type;
+      }
+
+    case TDESC_TYPE_FLAGS:
+      {
+	struct type *type, *field_type;
+	struct tdesc_type_flag *f;
+	int ix;
+
+	type = arch_flags_type (gdbarch, xstrdup (tdesc_type->name),
+				tdesc_type->u.f.size);
+	for (ix = 0;
+	     VEC_iterate (tdesc_type_flag, tdesc_type->u.f.flags, ix, f);
+	     ix++)
+	  /* Note that contrary to the function name, this call will
+	     just set the properties of an already-allocated
+	     field.  */
+	  append_flags_type_flag (type, f->start, f->name);
 
 	return type;
       }
@@ -1161,6 +1257,7 @@ tdesc_free_type (struct tdesc_type *type
 
   switch (type->kind)
     {
+    case TDESC_TYPE_STRUCT:
     case TDESC_TYPE_UNION:
       {
 	struct tdesc_type_field *f;
@@ -1175,6 +1272,20 @@ tdesc_free_type (struct tdesc_type *type
       }
       break;
 
+    case TDESC_TYPE_FLAGS:
+      {
+	struct tdesc_type_flag *f;
+	int ix;
+
+	for (ix = 0;
+	     VEC_iterate (tdesc_type_flag, type->u.f.flags, ix, f);
+	     ix++)
+	  xfree (f->name);
+
+	VEC_free (tdesc_type_flag, type->u.f.flags);
+      }
+      break;
+
     default:
       break;
     }
@@ -1199,6 +1310,29 @@ tdesc_create_vector (struct tdesc_featur
 }
 
 struct tdesc_type *
+tdesc_create_struct (struct tdesc_feature *feature, const char *name)
+{
+  struct tdesc_type *type = XZALLOC (struct tdesc_type);
+
+  type->name = xstrdup (name);
+  type->kind = TDESC_TYPE_STRUCT;
+
+  VEC_safe_push (tdesc_type_p, feature->types, type);
+  return type;
+}
+
+/* Set the total length of TYPE.  Structs which contain bitfields may
+   omit the reserved bits, so the end of the last field may not
+   suffice.  */
+
+void
+tdesc_set_struct_size (struct tdesc_type *type, LONGEST size)
+{
+  gdb_assert (type->kind == TDESC_TYPE_STRUCT);
+  type->u.u.size = size;
+}
+
+struct tdesc_type *
 tdesc_create_union (struct tdesc_feature *feature, const char *name)
 {
   struct tdesc_type *type = XZALLOC (struct tdesc_type);
@@ -1210,13 +1344,32 @@ tdesc_create_union (struct tdesc_feature
   return type;
 }
 
+struct tdesc_type *
+tdesc_create_flags (struct tdesc_feature *feature, const char *name,
+		    LONGEST size)
+{
+  struct tdesc_type *type = XZALLOC (struct tdesc_type);
+
+  type->name = xstrdup (name);
+  type->kind = TDESC_TYPE_FLAGS;
+  type->u.f.size = size;
+
+  VEC_safe_push (tdesc_type_p, feature->types, type);
+  return type;
+}
+
+/* Add a new field.  Return a temporary pointer to the field, which
+   is only valid until the next call to tdesc_add_field (the vector
+   might be reallocated).  */
+
 void
 tdesc_add_field (struct tdesc_type *type, const char *field_name,
 		 struct tdesc_type *field_type)
 {
   struct tdesc_type_field f = { 0 };
 
-  gdb_assert (type->kind == TDESC_TYPE_UNION);
+  gdb_assert (type->kind == TDESC_TYPE_UNION
+	      || type->kind == TDESC_TYPE_STRUCT);
 
   f.name = xstrdup (field_name);
   f.type = field_type;
@@ -1224,6 +1377,37 @@ tdesc_add_field (struct tdesc_type *type
   VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
 }
 
+/* Add a new bitfield.  */
+
+void
+tdesc_add_bitfield (struct tdesc_type *type, const char *field_name,
+		    int start, int end)
+{
+  struct tdesc_type_field f = { 0 };
+
+  gdb_assert (type->kind == TDESC_TYPE_STRUCT);
+
+  f.name = xstrdup (field_name);
+  f.start = start;
+  f.end = end;
+
+  VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
+}
+
+void
+tdesc_add_flag (struct tdesc_type *type, int start,
+		const char *flag_name)
+{
+  struct tdesc_type_flag f = { 0 };
+
+  gdb_assert (type->kind == TDESC_TYPE_FLAGS);
+
+  f.name = xstrdup (flag_name);
+  f.start = start;
+
+  VEC_safe_push (tdesc_type_flag, type->u.f.flags, &f);
+}
+
 static void
 tdesc_free_feature (struct tdesc_feature *feature)
 {
--- gdb-7.1-p0/gdb/target-descriptions.h	2010-02-10 19:45:03.000000000 +0100
+++ gdb-7.1/gdb/target-descriptions.h	2010-04-03 21:04:13.000000000 +0200
@@ -205,10 +205,20 @@ struct tdesc_type *tdesc_create_vector (
 					const char *name,
 					struct tdesc_type *field_type,
 					int count);
+struct tdesc_type *tdesc_create_struct (struct tdesc_feature *feature,
+					const char *name);
+void tdesc_set_struct_size (struct tdesc_type *type, LONGEST size);
 struct tdesc_type *tdesc_create_union (struct tdesc_feature *feature,
 				       const char *name);
+struct tdesc_type *tdesc_create_flags (struct tdesc_feature *feature,
+				       const char *name,
+				       LONGEST size);
 void tdesc_add_field (struct tdesc_type *type, const char *field_name,
 		      struct tdesc_type *field_type);
+void tdesc_add_bitfield (struct tdesc_type *type, const char *field_name,
+			 int start, int end);
+void tdesc_add_flag (struct tdesc_type *type, int start,
+		     const char *flag_name);
 void tdesc_create_reg (struct tdesc_feature *feature, const char *name,
 		       int regnum, int save_restore, const char *group,
 		       int bitsize, const char *type);
--- gdb-7.1-p0/gdb/testsuite/gdb.xml/extra-regs.xml	2007-02-08 22:00:36.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.xml/extra-regs.xml	2010-04-03 21:04:13.000000000 +0200
@@ -8,9 +8,27 @@
       <field name="v2" type="v2int16"/>
     </union>
 
+    <struct id="struct1">
+      <field name="v4" type="v4int8"/>
+      <field name="v2" type="v2int16"/>
+    </struct>
+
+    <struct id="struct2" size="8">
+      <field name="f1" start="0" end="34"/>
+      <field name="f2" start="63" end="63"/>
+    </struct>
+
+    <flags id="flags" size="4">
+      <field name="X" start="0" end="0"/>
+      <field name="Y" start="2" end="2"/>
+    </flags>
+
     <reg name="extrareg" bitsize="32"/>
     <reg name="uintreg" bitsize="32" type="uint32"/>
     <reg name="vecreg" bitsize="32" type="v4int8"/>
     <reg name="unionreg" bitsize="32" type="vecint"/>
+    <reg name="structreg" bitsize="64" type="struct1"/>
+    <reg name="bitfields" bitsize="64" type="struct2"/>
+    <reg name="flags" bitsize="32" type="flags"/>
   </feature>
 </target>
--- gdb-7.1-p0/gdb/testsuite/gdb.xml/tdesc-regs.exp	2010-04-03 20:59:52.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.xml/tdesc-regs.exp	2010-04-03 21:04:13.000000000 +0200
@@ -141,6 +141,11 @@ gdb_test "ptype \$vecreg" "type = int8_t
 gdb_test "ptype \$unionreg" \
     "type = union {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
 gdb_test "ptype \$unionreg.v4" "type = int8_t \\\[4\\\]"
+gdb_test "ptype \$structreg" \
+    "type = struct struct1 {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
+gdb_test "ptype \$structreg.v4" "type = int8_t \\\[4\\\]"
+gdb_test "ptype \$bitfields" \
+    "type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}"
 
 load_description "core-only.xml" ""
 # The extra register from the previous description should be gone.
--- gdb-7.1-p0/gdb/xml-tdesc.c	2010-01-01 08:31:46.000000000 +0100
+++ gdb-7.1/gdb/xml-tdesc.c	2010-04-03 21:04:13.000000000 +0200
@@ -85,8 +85,15 @@ struct tdesc_parsing_data
      it does not have its own.  This starts at zero.  */
   int next_regnum;
 
-  /* The union we are currently parsing, or last parsed.  */
-  struct tdesc_type *current_union;
+  /* The struct or union we are currently parsing, or last parsed.  */
+  struct tdesc_type *current_type;
+
+  /* The byte size of the current struct type, if specified.  Zero
+     if not specified.  */
+  int current_type_size;
+
+  /* Whether the current type is a flags type.  */
+  int current_type_is_flags;
 };
 
 /* Handle the end of an <architecture> element and its value.  */
@@ -229,11 +236,57 @@ tdesc_start_union (struct gdb_xml_parser
   struct tdesc_parsing_data *data = user_data;
   char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
 
-  data->current_union = tdesc_create_union (data->current_feature, id);
+  data->current_type = tdesc_create_union (data->current_feature, id);
+  data->current_type_size = 0;
+  data->current_type_is_flags = 0;
+}
+
+/* Handle the start of a <struct> element.  Initialize the type and
+   record it with the current feature.  */
+
+static void
+tdesc_start_struct (struct gdb_xml_parser *parser,
+		   const struct gdb_xml_element *element,
+		   void *user_data, VEC(gdb_xml_value_s) *attributes)
+{
+  struct tdesc_parsing_data *data = user_data;
+  char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
+  struct tdesc_type *type;
+
+  type = tdesc_create_struct (data->current_feature, id);
+  data->current_type = type;
+  data->current_type_size = 0;
+  data->current_type_is_flags = 0;
+
+  if (VEC_length (gdb_xml_value_s, attributes) > 1)
+    {
+      int size = (int) * (ULONGEST *)
+	VEC_index (gdb_xml_value_s, attributes, 1)->value;
+      tdesc_set_struct_size (type, size);
+      data->current_type_size = size;
+    }
+}
+
+static void
+tdesc_start_flags (struct gdb_xml_parser *parser,
+		   const struct gdb_xml_element *element,
+		   void *user_data, VEC(gdb_xml_value_s) *attributes)
+{
+  struct tdesc_parsing_data *data = user_data;
+  char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
+  int length = (int) * (ULONGEST *)
+    VEC_index (gdb_xml_value_s, attributes, 1)->value;
+  struct tdesc_type *type;
+
+  type = tdesc_create_flags (data->current_feature, id, length);
+
+  data->current_type = type;
+  data->current_type_size = 0;
+  data->current_type_is_flags = 1;
 }
 
 /* Handle the start of a <field> element.  Attach the field to the
-   current union.  */
+   current struct or union.  */
 
 static void
 tdesc_start_field (struct gdb_xml_parser *parser,
@@ -241,20 +294,84 @@ tdesc_start_field (struct gdb_xml_parser
 		   void *user_data, VEC(gdb_xml_value_s) *attributes)
 {
   struct tdesc_parsing_data *data = user_data;
+  int ix = 0, length;
   struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
   struct tdesc_type *field_type;
   char *field_name, *field_type_id;
+  int start, end;
 
-  field_name = attrs[0].value;
-  field_type_id = attrs[1].value;
+  length = VEC_length (gdb_xml_value_s, attributes);
 
-  field_type = tdesc_named_type (data->current_feature, field_type_id);
-  if (field_type == NULL)
-    gdb_xml_error (parser, _("Union field \"%s\" references undefined "
-			     "type \"%s\""),
-		   field_name, field_type_id);
+  field_name = attrs[ix++].value;
+
+  if (ix < length && strcmp (attrs[ix].name, "type") == 0)
+    field_type_id = attrs[ix++].value;
+  else
+    field_type_id = NULL;
+
+  if (ix < length && strcmp (attrs[ix].name, "start") == 0)
+    start = * (ULONGEST *) attrs[ix++].value;
+  else
+    start = -1;
+
+  if (ix < length && strcmp (attrs[ix].name, "end") == 0)
+    end = * (ULONGEST *) attrs[ix++].value;
+  else
+    end = -1;
+
+  if (field_type_id != NULL)
+    {
+      if (data->current_type_is_flags)
+	gdb_xml_error (parser, _("Cannot add typed field \"%s\" to flags"), 
+		       field_name);
+      if (data->current_type_size != 0)
+	gdb_xml_error (parser,
+		       _("Explicitly sized type can not contain non-bitfield \"%s\""), 
+		       field_name);
+
+      field_type = tdesc_named_type (data->current_feature, field_type_id);
+      if (field_type == NULL)
+	gdb_xml_error (parser, _("Field \"%s\" references undefined "
+				 "type \"%s\""),
+		       field_name, field_type_id);
+
+      tdesc_add_field (data->current_type, field_name, field_type);
+    }
+  else if (start != -1 && end != -1)
+    {
+      struct tdesc_type *t = data->current_type;
+
+      if (data->current_type_is_flags)
+	tdesc_add_flag (t, start, field_name);
+      else
+	{
+	  if (data->current_type_size == 0)
+	    gdb_xml_error (parser,
+			   _("Implicitly sized type can not contain bitfield \"%s\""), 
+			   field_name);
+
+	  if (end >= 64)
+	    gdb_xml_error (parser,
+			   _("Bitfield \"%s\" goes past 64 bits (unsupported)"),
+			   field_name);
+
+	  /* Assume that the bit numbering in XML is "lsb-zero".  Most
+	     architectures other than PowerPC use this ordering.  In
+	     the future, we can add an XML tag to indicate "msb-zero"
+	     numbering.  */
+	  if (start > end)
+	    gdb_xml_error (parser, _("Bitfield \"%s\" has start after end"),
+			   field_name);
 
-  tdesc_add_field (data->current_union, field_name, field_type);
+	  if (end >= data->current_type_size * TARGET_CHAR_BIT)
+	    gdb_xml_error (parser, _("Bitfield \"%s\" does not fit in struct"));
+
+	  tdesc_add_bitfield (t, field_name, start, end);
+	}
+    }
+  else
+    gdb_xml_error (parser, _("Field \"%s\" has neither type nor bit position"),
+		   field_name);
 }
 
 /* Handle the start of a <vector> element.  Initialize the type and
@@ -287,11 +404,13 @@ tdesc_start_vector (struct gdb_xml_parse
 
 static const struct gdb_xml_attribute field_attributes[] = {
   { "name", GDB_XML_AF_NONE, NULL, NULL },
-  { "type", GDB_XML_AF_NONE, NULL, NULL },
+  { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
+  { "start", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+  { "end", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
   { NULL, GDB_XML_AF_NONE, NULL, NULL }
 };
 
-static const struct gdb_xml_element union_children[] = {
+static const struct gdb_xml_element struct_union_children[] = {
   { "field", field_attributes, NULL, GDB_XML_EF_REPEATABLE,
     tdesc_start_field, NULL },
   { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
@@ -308,8 +427,15 @@ static const struct gdb_xml_attribute re
   { NULL, GDB_XML_AF_NONE, NULL, NULL }
 };
 
-static const struct gdb_xml_attribute union_attributes[] = {
+static const struct gdb_xml_attribute struct_union_attributes[] = {
   { "id", GDB_XML_AF_NONE, NULL, NULL },
+  { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL},
+  { NULL, GDB_XML_AF_NONE, NULL, NULL }
+};
+
+static const struct gdb_xml_attribute flags_attributes[] = {
+  { "id", GDB_XML_AF_NONE, NULL, NULL },
+  { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL},
   { NULL, GDB_XML_AF_NONE, NULL, NULL }
 };
 
@@ -329,9 +455,15 @@ static const struct gdb_xml_element feat
   { "reg", reg_attributes, NULL,
     GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
     tdesc_start_reg, NULL },
-  { "union", union_attributes, union_children,
+  { "struct", struct_union_attributes, struct_union_children,
+    GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
+    tdesc_start_struct, NULL },
+  { "union", struct_union_attributes, struct_union_children,
     GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
     tdesc_start_union, NULL },
+  { "flags", flags_attributes, struct_union_children,
+    GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
+    tdesc_start_flags, NULL },    
   { "vector", vector_attributes, NULL,
     GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
     tdesc_start_vector, NULL },

gdb-bz578250-avx-03of10.patch:
 features/i386/32bit-core.xml |   20 +++++++++++
 features/i386/32bit-sse.xml  |   16 +++++++++
 features/i386/64bit-core.xml |   20 +++++++++++
 features/i386/64bit-sse.xml  |   16 +++++++++
 features/i386/amd64-linux.c  |   35 ++++++++++++++++++++
 features/i386/amd64.c        |   35 ++++++++++++++++++++
 features/i386/i386-linux.c   |   35 ++++++++++++++++++++
 features/i386/i386.c         |   35 ++++++++++++++++++++
 target-descriptions.c        |   73 +++++++++----------------------------------
 9 files changed, 228 insertions(+), 57 deletions(-)

--- NEW FILE gdb-bz578250-avx-03of10.patch ---
[ Backported.  ]

commit 0257d639d42f896a359993ae8adb5792e280f65f
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Mon Mar 1 17:26:02 2010 +0000

    Remove TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
    
    2010-03-01  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* target-descriptions.c (tdesc_type): Remove
    	TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
    	(tdesc_predefined_types): Likewise.
    	(tdesc_gdb_type): Likewise.  Pass NULL to append_flags_type_flag
    	if flag name is empty.
    	(maint_print_c_tdesc_cmd): Handle TDESC_TYPE_FLAGS.
    
    	* features/i386/32bit-core.xml: Define i386_eflags.
    	* features/i386/64bit-core.xml: Likewise.
    
    	* features/i386/32bit-sse.xml: Define i386_mxcsr.
    	* features/i386/64bit-sse.xml: Likewise.
    
    	* features/i386/amd64-linux.c: Regenerated.
    	* features/i386/amd64.c: Likewise.
    	* features/i386/i386-linux.c: Likewise.
    	* features/i386/i386.c: Likewise.

--- gdb-7.1-p1/gdb/features/i386/32bit-core.xml	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/32bit-core.xml	2010-04-03 21:06:12.000000000 +0200
@@ -7,6 +7,26 @@
 
 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
 <feature name="org.gnu.gdb.i386.core">
+  <flags id="i386_eflags" size="4">
+    <field name="CF" start="0" end="0"/>
+    <field name="" start="1" end="1"/>
+    <field name="PF" start="2" end="2"/>
+    <field name="AF" start="4" end="4"/>
+    <field name="ZF" start="6" end="6"/>
+    <field name="SF" start="7" end="7"/>
+    <field name="TF" start="8" end="8"/>
+    <field name="IF" start="9" end="9"/>
+    <field name="DF" start="10" end="10"/>
+    <field name="OF" start="11" end="11"/>
+    <field name="NT" start="14" end="14"/>
+    <field name="RF" start="16" end="16"/>
+    <field name="VM" start="17" end="17"/>
+    <field name="AC" start="18" end="18"/>
+    <field name="VIF" start="19" end="19"/>
+    <field name="VIP" start="20" end="20"/>
+    <field name="ID" start="21" end="21"/>
+  </flags>
+
   <reg name="eax" bitsize="32" type="int32"/>
   <reg name="ecx" bitsize="32" type="int32"/>
   <reg name="edx" bitsize="32" type="int32"/>
--- gdb-7.1-p1/gdb/features/i386/32bit-sse.xml	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/32bit-sse.xml	2010-04-03 21:06:12.000000000 +0200
@@ -22,6 +22,22 @@
     <field name="v2_int64" type="v2i64"/>
     <field name="uint128" type="uint128"/>
   </union>
+  <flags id="i386_mxcsr" size="4">
+    <field name="IE" start="0" end="0"/>
+    <field name="DE" start="1" end="1"/>
+    <field name="ZE" start="2" end="2"/>
+    <field name="OE" start="3" end="3"/>
+    <field name="UE" start="4" end="4"/>
+    <field name="PE" start="5" end="5"/>
+    <field name="DAZ" start="6" end="6"/>
+    <field name="IM" start="7" end="7"/>
+    <field name="DM" start="8" end="8"/>
+    <field name="ZM" start="9" end="9"/>
+    <field name="OM" start="10" end="10"/>
+    <field name="UM" start="11" end="11"/>
+    <field name="PM" start="12" end="12"/>
+    <field name="FZ" start="15" end="15"/>
+  </flags>
 
   <reg name="xmm0" bitsize="128" type="vec128" regnum="32"/>
   <reg name="xmm1" bitsize="128" type="vec128"/>
--- gdb-7.1-p1/gdb/features/i386/64bit-core.xml	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/64bit-core.xml	2010-04-03 21:06:12.000000000 +0200
@@ -7,6 +7,26 @@
 
 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
 <feature name="org.gnu.gdb.i386.core">
+  <flags id="i386_eflags" size="4">
+    <field name="CF" start="0" end="0"/>
+    <field name="" start="1" end="1"/>
+    <field name="PF" start="2" end="2"/>
+    <field name="AF" start="4" end="4"/>
+    <field name="ZF" start="6" end="6"/>
+    <field name="SF" start="7" end="7"/>
+    <field name="TF" start="8" end="8"/>
+    <field name="IF" start="9" end="9"/>
+    <field name="DF" start="10" end="10"/>
+    <field name="OF" start="11" end="11"/>
+    <field name="NT" start="14" end="14"/>
+    <field name="RF" start="16" end="16"/>
+    <field name="VM" start="17" end="17"/>
+    <field name="AC" start="18" end="18"/>
+    <field name="VIF" start="19" end="19"/>
+    <field name="VIP" start="20" end="20"/>
+    <field name="ID" start="21" end="21"/>
+  </flags>
+
   <reg name="rax" bitsize="64" type="int64"/>
   <reg name="rbx" bitsize="64" type="int64"/>
   <reg name="rcx" bitsize="64" type="int64"/>
--- gdb-7.1-p1/gdb/features/i386/64bit-sse.xml	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/64bit-sse.xml	2010-04-03 21:06:12.000000000 +0200
@@ -22,6 +22,22 @@
     <field name="v2_int64" type="v2i64"/>
     <field name="uint128" type="uint128"/>
   </union>
+  <flags id="i386_mxcsr" size="4">
+    <field name="IE" start="0" end="0"/>
+    <field name="DE" start="1" end="1"/>
+    <field name="ZE" start="2" end="2"/>
+    <field name="OE" start="3" end="3"/>
+    <field name="UE" start="4" end="4"/>
+    <field name="PE" start="5" end="5"/>
+    <field name="DAZ" start="6" end="6"/>
+    <field name="IM" start="7" end="7"/>
+    <field name="DM" start="8" end="8"/>
+    <field name="ZM" start="9" end="9"/>
+    <field name="OM" start="10" end="10"/>
+    <field name="UM" start="11" end="11"/>
+    <field name="PM" start="12" end="12"/>
+    <field name="FZ" start="15" end="15"/>
+  </flags>
 
   <reg name="xmm0" bitsize="128" type="vec128" regnum="40"/>
   <reg name="xmm1" bitsize="128" type="vec128"/>
--- gdb-7.1-p1/gdb/features/i386/amd64-linux.c	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/amd64-linux.c	2010-04-03 21:06:12.000000000 +0200
@@ -17,6 +17,25 @@ initialize_tdesc_amd64_linux (void)
   set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+  field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+  tdesc_add_flag (field_type, 0, "CF");
+  tdesc_add_flag (field_type, 1, "");
+  tdesc_add_flag (field_type, 2, "PF");
+  tdesc_add_flag (field_type, 4, "AF");
+  tdesc_add_flag (field_type, 6, "ZF");
+  tdesc_add_flag (field_type, 7, "SF");
+  tdesc_add_flag (field_type, 8, "TF");
+  tdesc_add_flag (field_type, 9, "IF");
+  tdesc_add_flag (field_type, 10, "DF");
+  tdesc_add_flag (field_type, 11, "OF");
+  tdesc_add_flag (field_type, 14, "NT");
+  tdesc_add_flag (field_type, 16, "RF");
+  tdesc_add_flag (field_type, 17, "VM");
+  tdesc_add_flag (field_type, 18, "AC");
+  tdesc_add_flag (field_type, 19, "VIF");
+  tdesc_add_flag (field_type, 20, "VIP");
+  tdesc_add_flag (field_type, 21, "ID");
+
   tdesc_create_reg (feature, "rax", 0, 1, NULL, 64, "int64");
   tdesc_create_reg (feature, "rbx", 1, 1, NULL, 64, "int64");
   tdesc_create_reg (feature, "rcx", 2, 1, NULL, 64, "int64");
@@ -93,6 +112,22 @@ initialize_tdesc_amd64_linux (void)
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type, "uint128", field_type);
 
+  field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+  tdesc_add_flag (field_type, 0, "IE");
+  tdesc_add_flag (field_type, 1, "DE");
+  tdesc_add_flag (field_type, 2, "ZE");
+  tdesc_add_flag (field_type, 3, "OE");
+  tdesc_add_flag (field_type, 4, "UE");
+  tdesc_add_flag (field_type, 5, "PE");
+  tdesc_add_flag (field_type, 6, "DAZ");
+  tdesc_add_flag (field_type, 7, "IM");
+  tdesc_add_flag (field_type, 8, "DM");
+  tdesc_add_flag (field_type, 9, "ZM");
+  tdesc_add_flag (field_type, 10, "OM");
+  tdesc_add_flag (field_type, 11, "UM");
+  tdesc_add_flag (field_type, 12, "PM");
+  tdesc_add_flag (field_type, 15, "FZ");
+
   tdesc_create_reg (feature, "xmm0", 40, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm1", 41, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm2", 42, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/features/i386/amd64.c	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/amd64.c	2010-04-03 21:06:12.000000000 +0200
@@ -15,6 +15,25 @@ initialize_tdesc_amd64 (void)
   set_tdesc_architecture (result, bfd_scan_arch ("i386:x86-64"));
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+  field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+  tdesc_add_flag (field_type, 0, "CF");
+  tdesc_add_flag (field_type, 1, "");
+  tdesc_add_flag (field_type, 2, "PF");
+  tdesc_add_flag (field_type, 4, "AF");
+  tdesc_add_flag (field_type, 6, "ZF");
+  tdesc_add_flag (field_type, 7, "SF");
+  tdesc_add_flag (field_type, 8, "TF");
+  tdesc_add_flag (field_type, 9, "IF");
+  tdesc_add_flag (field_type, 10, "DF");
+  tdesc_add_flag (field_type, 11, "OF");
+  tdesc_add_flag (field_type, 14, "NT");
+  tdesc_add_flag (field_type, 16, "RF");
+  tdesc_add_flag (field_type, 17, "VM");
+  tdesc_add_flag (field_type, 18, "AC");
+  tdesc_add_flag (field_type, 19, "VIF");
+  tdesc_add_flag (field_type, 20, "VIP");
+  tdesc_add_flag (field_type, 21, "ID");
+
   tdesc_create_reg (feature, "rax", 0, 1, NULL, 64, "int64");
   tdesc_create_reg (feature, "rbx", 1, 1, NULL, 64, "int64");
   tdesc_create_reg (feature, "rcx", 2, 1, NULL, 64, "int64");
@@ -91,6 +110,22 @@ initialize_tdesc_amd64 (void)
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type, "uint128", field_type);
 
+  field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+  tdesc_add_flag (field_type, 0, "IE");
+  tdesc_add_flag (field_type, 1, "DE");
+  tdesc_add_flag (field_type, 2, "ZE");
+  tdesc_add_flag (field_type, 3, "OE");
+  tdesc_add_flag (field_type, 4, "UE");
+  tdesc_add_flag (field_type, 5, "PE");
+  tdesc_add_flag (field_type, 6, "DAZ");
+  tdesc_add_flag (field_type, 7, "IM");
+  tdesc_add_flag (field_type, 8, "DM");
+  tdesc_add_flag (field_type, 9, "ZM");
+  tdesc_add_flag (field_type, 10, "OM");
+  tdesc_add_flag (field_type, 11, "UM");
+  tdesc_add_flag (field_type, 12, "PM");
+  tdesc_add_flag (field_type, 15, "FZ");
+
   tdesc_create_reg (feature, "xmm0", 40, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm1", 41, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm2", 42, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/features/i386/i386-linux.c	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/i386-linux.c	2010-04-03 21:06:12.000000000 +0200
@@ -17,6 +17,25 @@ initialize_tdesc_i386_linux (void)
   set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+  field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+  tdesc_add_flag (field_type, 0, "CF");
+  tdesc_add_flag (field_type, 1, "");
+  tdesc_add_flag (field_type, 2, "PF");
+  tdesc_add_flag (field_type, 4, "AF");
+  tdesc_add_flag (field_type, 6, "ZF");
+  tdesc_add_flag (field_type, 7, "SF");
+  tdesc_add_flag (field_type, 8, "TF");
+  tdesc_add_flag (field_type, 9, "IF");
+  tdesc_add_flag (field_type, 10, "DF");
+  tdesc_add_flag (field_type, 11, "OF");
+  tdesc_add_flag (field_type, 14, "NT");
+  tdesc_add_flag (field_type, 16, "RF");
+  tdesc_add_flag (field_type, 17, "VM");
+  tdesc_add_flag (field_type, 18, "AC");
+  tdesc_add_flag (field_type, 19, "VIF");
+  tdesc_add_flag (field_type, 20, "VIP");
+  tdesc_add_flag (field_type, 21, "ID");
+
   tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
   tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
   tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
@@ -88,6 +107,22 @@ initialize_tdesc_i386_linux (void)
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type, "uint128", field_type);
 
+  field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+  tdesc_add_flag (field_type, 0, "IE");
+  tdesc_add_flag (field_type, 1, "DE");
+  tdesc_add_flag (field_type, 2, "ZE");
+  tdesc_add_flag (field_type, 3, "OE");
+  tdesc_add_flag (field_type, 4, "UE");
+  tdesc_add_flag (field_type, 5, "PE");
+  tdesc_add_flag (field_type, 6, "DAZ");
+  tdesc_add_flag (field_type, 7, "IM");
+  tdesc_add_flag (field_type, 8, "DM");
+  tdesc_add_flag (field_type, 9, "ZM");
+  tdesc_add_flag (field_type, 10, "OM");
+  tdesc_add_flag (field_type, 11, "UM");
+  tdesc_add_flag (field_type, 12, "PM");
+  tdesc_add_flag (field_type, 15, "FZ");
+
   tdesc_create_reg (feature, "xmm0", 32, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm1", 33, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm2", 34, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/features/i386/i386.c	2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/i386.c	2010-04-03 21:06:12.000000000 +0200
@@ -15,6 +15,25 @@ initialize_tdesc_i386 (void)
   set_tdesc_architecture (result, bfd_scan_arch ("i386"));
 
   feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+  field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+  tdesc_add_flag (field_type, 0, "CF");
+  tdesc_add_flag (field_type, 1, "");
+  tdesc_add_flag (field_type, 2, "PF");
+  tdesc_add_flag (field_type, 4, "AF");
+  tdesc_add_flag (field_type, 6, "ZF");
+  tdesc_add_flag (field_type, 7, "SF");
+  tdesc_add_flag (field_type, 8, "TF");
+  tdesc_add_flag (field_type, 9, "IF");
+  tdesc_add_flag (field_type, 10, "DF");
+  tdesc_add_flag (field_type, 11, "OF");
+  tdesc_add_flag (field_type, 14, "NT");
+  tdesc_add_flag (field_type, 16, "RF");
+  tdesc_add_flag (field_type, 17, "VM");
+  tdesc_add_flag (field_type, 18, "AC");
+  tdesc_add_flag (field_type, 19, "VIF");
+  tdesc_add_flag (field_type, 20, "VIP");
+  tdesc_add_flag (field_type, 21, "ID");
+
   tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
   tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
   tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
@@ -83,6 +102,22 @@ initialize_tdesc_i386 (void)
   field_type = tdesc_named_type (feature, "uint128");
   tdesc_add_field (type, "uint128", field_type);
 
+  field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+  tdesc_add_flag (field_type, 0, "IE");
+  tdesc_add_flag (field_type, 1, "DE");
+  tdesc_add_flag (field_type, 2, "ZE");
+  tdesc_add_flag (field_type, 3, "OE");
+  tdesc_add_flag (field_type, 4, "UE");
+  tdesc_add_flag (field_type, 5, "PE");
+  tdesc_add_flag (field_type, 6, "DAZ");
+  tdesc_add_flag (field_type, 7, "IM");
+  tdesc_add_flag (field_type, 8, "DM");
+  tdesc_add_flag (field_type, 9, "ZM");
+  tdesc_add_flag (field_type, 10, "OM");
+  tdesc_add_flag (field_type, 11, "UM");
+  tdesc_add_flag (field_type, 12, "PM");
+  tdesc_add_flag (field_type, 15, "FZ");
+
   tdesc_create_reg (feature, "xmm0", 32, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm1", 33, 1, NULL, 128, "vec128");
   tdesc_create_reg (feature, "xmm2", 34, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/target-descriptions.c	2010-04-03 21:04:13.000000000 +0200
+++ gdb-7.1/gdb/target-descriptions.c	2010-04-03 21:06:12.000000000 +0200
@@ -126,8 +126,6 @@ typedef struct tdesc_type
     TDESC_TYPE_IEEE_DOUBLE,
     TDESC_TYPE_ARM_FPA_EXT,
     TDESC_TYPE_I387_EXT,
-    TDESC_TYPE_I386_EFLAGS,
-    TDESC_TYPE_I386_MXCSR,
 
     /* Types defined by a target feature.  */
     TDESC_TYPE_VECTOR,
@@ -483,9 +481,7 @@ static struct tdesc_type tdesc_predefine
   { "ieee_single", TDESC_TYPE_IEEE_SINGLE },
   { "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
   { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
-  { "i387_ext", TDESC_TYPE_I387_EXT },
-  { "i386_eflags", TDESC_TYPE_I386_EFLAGS },
-  { "i386_mxcsr", TDESC_TYPE_I386_MXCSR }
+  { "i387_ext", TDESC_TYPE_I387_EXT }
 };
 
 /* Return the type associated with ID in the context of FEATURE, or
@@ -607,57 +603,6 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
       return arch_float_type (gdbarch, -1, "builtin_type_i387_ext",
 			      floatformats_i387_ext);
 
-    case TDESC_TYPE_I386_EFLAGS:
-      {
-	struct type *type;
-
-	type = arch_flags_type (gdbarch, "builtin_type_i386_eflags", 4);
-	append_flags_type_flag (type, 0, "CF");
-	append_flags_type_flag (type, 1, NULL);
-	append_flags_type_flag (type, 2, "PF");
-	append_flags_type_flag (type, 4, "AF");
-	append_flags_type_flag (type, 6, "ZF");
-	append_flags_type_flag (type, 7, "SF");
-	append_flags_type_flag (type, 8, "TF");
-	append_flags_type_flag (type, 9, "IF");
-	append_flags_type_flag (type, 10, "DF");
-	append_flags_type_flag (type, 11, "OF");
-	append_flags_type_flag (type, 14, "NT");
-	append_flags_type_flag (type, 16, "RF");
-	append_flags_type_flag (type, 17, "VM");
-	append_flags_type_flag (type, 18, "AC");
-	append_flags_type_flag (type, 19, "VIF");
-	append_flags_type_flag (type, 20, "VIP");
-	append_flags_type_flag (type, 21, "ID");
-
-	return type;
-      }
-    break;
-
-    case TDESC_TYPE_I386_MXCSR:
-      {
-	struct type *type;
-
-	type = arch_flags_type (gdbarch, "builtin_type_i386_mxcsr", 4);
-	append_flags_type_flag (type, 0, "IE");
-	append_flags_type_flag (type, 1, "DE");
-	append_flags_type_flag (type, 2, "ZE");
-	append_flags_type_flag (type, 3, "OE");
-	append_flags_type_flag (type, 4, "UE");
-	append_flags_type_flag (type, 5, "PE");
-	append_flags_type_flag (type, 6, "DAZ");
-	append_flags_type_flag (type, 7, "IM");
-	append_flags_type_flag (type, 8, "DM");
-	append_flags_type_flag (type, 9, "ZM");
-	append_flags_type_flag (type, 10, "OM");
-	append_flags_type_flag (type, 11, "UM");
-	append_flags_type_flag (type, 12, "PM");
-	append_flags_type_flag (type, 15, "FZ");
-
-	return type;
-      }
-    break;
-
     /* Types defined by a target feature.  */
     case TDESC_TYPE_VECTOR:
       {
@@ -769,7 +714,8 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
 	  /* Note that contrary to the function name, this call will
 	     just set the properties of an already-allocated
 	     field.  */
-	  append_flags_type_flag (type, f->start, f->name);
+	  append_flags_type_flag (type, f->start,
+				  *f->name ? f->name : NULL);
 
 	return type;
       }
@@ -1602,6 +1548,7 @@ maint_print_c_tdesc_cmd (char *args, int
   struct tdesc_reg *reg;
   struct tdesc_type *type;
   struct tdesc_type_field *f;
+  struct tdesc_type_flag *flag;
   int ix, ix2, ix3;
 
   /* Use the global target-supplied description, not the current
@@ -1715,6 +1662,18 @@ maint_print_c_tdesc_cmd (char *args, int
 		     f->name);
 		}
 	      break;
+	    case TDESC_TYPE_FLAGS:
+	      printf_unfiltered
+		("  field_type = tdesc_create_flags (feature, \"%s\", %d);\n",
+		 type->name, (int) type->u.f.size);
+	      for (ix3 = 0;
+		   VEC_iterate (tdesc_type_flag, type->u.f.flags, ix3,
+				flag);
+		   ix3++)
+		printf_unfiltered
+		  ("  tdesc_add_flag (field_type, %d, \"%s\");\n",
+		   flag->start, flag->name);
+	      break;
 	    default:
 	      error (_("C output is not supported type \"%s\"."), type->name);
 	    }

gdb-bz578250-avx-04of10.patch:
 amd64-tdep.c                       |  118 ++++++++++++++++
 i386-tdep.c                        |  261 +++++++++++++++++++++++++++++++------
 i386-tdep.h                        |   37 +++++
 testsuite/gdb.arch/amd64-byte.exp  |  121 +++++++++++++++++
 testsuite/gdb.arch/amd64-dword.exp |  123 +++++++++++++++++
 testsuite/gdb.arch/amd64-pseudo.c  |   91 ++++++++++++
 testsuite/gdb.arch/amd64-word.exp  |  123 +++++++++++++++++
 testsuite/gdb.arch/i386-byte.exp   |   98 +++++++++++++
 testsuite/gdb.arch/i386-pseudo.c   |   51 +++++++
 testsuite/gdb.arch/i386-word.exp   |   84 +++++++++++
 10 files changed, 1065 insertions(+), 42 deletions(-)

--- NEW FILE gdb-bz578250-avx-04of10.patch ---
[ Backported.  ]

commit 9d625812f24608f99fd99e8591ef3c80d729f9b5
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Tue Mar 2 13:14:28 2010 +0000

    Support x86 pseudo byte, word and dword registers.
    
    gdb/
    
    2010-03-02  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* amd64-tdep.c (amd64_byte_names): New.
    	(amd64_word_names): Likewise.
    	(amd64_dword_names): Likewise.
    	(amd64_pseudo_register_name): Likewise.
    	(amd64_pseudo_register_read): Likewise.
    	(amd64_pseudo_register_write): Likewise.
    	(amd64_init_abi): Set num_byte_regs, num_word_regs, num_dword_regs
    	and num_mmx_regs.  Call set_gdbarch_pseudo_register_read,
    	set_gdbarch_pseudo_register_write and
    	set_tdesc_pseudo_register_name.  Don't call
    	set_gdbarch_num_pseudo_regs.  Don't set mm0_regnum.
    
    	* i386-tdep.c (i386_num_mmx_regs): Removed.
    	(i386_num_pseudo_regs): Likewise.
    	(i386_byte_names): New.
    	(i386_word_names): Likewise.
    	(i386_byte_regnum_p): Likewise.
    	(i386_word_regnum_p): Likewise.
    	(i386_mmx_regnum_p): Updated.
    	(i386_pseudo_register_name): Make it global.  Handle byte and
    	word pseudo-registers.
    	(i386_pseudo_register_read): Likewise.
    	(i386_pseudo_register_write): Likewise.
    	(i386_pseudo_register_type): Handle byte, word and dword
    	pseudo-registers
    	(i386_register_reggroup_p): Don't include pseudo
    	registers, except for MXX, in any register groups.  Don't
    	include pseudo byte, word, dword registers in general_reggroup.
    	(i386_gdbarch_init): Set num_byte_regs, num_word_regs,
    	num_dword_regs, al_regnum, ax_regnum and eax_regnum.  Put MMX
    	pseudo-registers after word pseudo-registers.  Call
    	set_gdbarch_num_pseudo_regs after calling gdbarch_init_osabi.
    
    	* i386-tdep.h (gdbarch_tdep): Add num_mmx_regs, num_byte_regs,
    	al_regnum, num_word_regs, ax_regnum, num_dword_regs and
    	eax_regnum.
    	(i386_byte_regnum_p): New.
    	(i386_word_regnum_p): Likewise.
    	(i386_dword_regnum_p): Likewise.
    	(i386_pseudo_register_name): Likewise.
    	(i386_pseudo_register_read): Likewise.
    	(i386_pseudo_register_write): Likewise.
    
    gdb/testsuite/
    
    2010-03-02  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* gdb.arch/amd64-byte.exp: New.
    	* gdb.arch/amd64-dword.exp: Likewise.
    	* gdb.arch/amd64-pseudo.c: Likewise.
    	* gdb.arch/amd64-word.exp: Likewise.
    	* gdb.arch/i386-byte.exp: Likewise.
    	* gdb.arch/i386-pseudo.c: Likewise.
    	* gdb.arch/i386-word.exp: Likewise.

--- gdb-7.1-p2/gdb/amd64-tdep.c	2010-04-03 20:59:52.000000000 +0200
+++ gdb-7.1/gdb/amd64-tdep.c	2010-04-03 21:06:52.000000000 +0200
@@ -210,6 +210,107 @@ amd64_arch_reg_to_regnum (int reg)
   return amd64_arch_regmap[reg];
 }
 
+/* Register names for byte pseudo-registers.  */
+
+static const char *amd64_byte_names[] =
+{
+  "al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
+  "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
+};
+
+/* Register names for word pseudo-registers.  */
+
+static const char *amd64_word_names[] =
+{
+  "ax", "bx", "cx", "dx", "si", "di", "bp", "sp", 
+  "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
+};
+
+/* Register names for dword pseudo-registers.  */
+
+static const char *amd64_dword_names[] =
+{
+  "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", 
+  "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
+};
+
+/* Return the name of register REGNUM.  */
+
+static const char *
+amd64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  if (i386_byte_regnum_p (gdbarch, regnum))
+    return amd64_byte_names[regnum - tdep->al_regnum];
+  else if (i386_word_regnum_p (gdbarch, regnum))
+    return amd64_word_names[regnum - tdep->ax_regnum];
+  else if (i386_dword_regnum_p (gdbarch, regnum))
+    return amd64_dword_names[regnum - tdep->eax_regnum];
+  else
+    return i386_pseudo_register_name (gdbarch, regnum);
+}
+
+static void
+amd64_pseudo_register_read (struct gdbarch *gdbarch,
+			    struct regcache *regcache,
+			    int regnum, gdb_byte *buf)
+{
+  gdb_byte raw_buf[MAX_REGISTER_SIZE];
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (i386_byte_regnum_p (gdbarch, regnum))
+    {
+      int gpnum = regnum - tdep->al_regnum;
+
+      /* Extract (always little endian).  */
+      regcache_raw_read (regcache, gpnum, raw_buf);
+      memcpy (buf, raw_buf, 1);
+    }
+  else if (i386_dword_regnum_p (gdbarch, regnum))
+    {
+      int gpnum = regnum - tdep->eax_regnum;
+      /* Extract (always little endian).  */
+      regcache_raw_read (regcache, gpnum, raw_buf);
+      memcpy (buf, raw_buf, 4);
+    }
+  else
+    i386_pseudo_register_read (gdbarch, regcache, regnum, buf);
+}
+
+static void
+amd64_pseudo_register_write (struct gdbarch *gdbarch,
+			     struct regcache *regcache,
+			     int regnum, const gdb_byte *buf)
+{
+  gdb_byte raw_buf[MAX_REGISTER_SIZE];
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (i386_byte_regnum_p (gdbarch, regnum))
+    {
+      int gpnum = regnum - tdep->al_regnum;
+
+      /* Read ...  */
+      regcache_raw_read (regcache, gpnum, raw_buf);
+      /* ... Modify ... (always little endian).  */
+      memcpy (raw_buf, buf, 1);
+      /* ... Write.  */
+      regcache_raw_write (regcache, gpnum, raw_buf);
+    }
+  else if (i386_dword_regnum_p (gdbarch, regnum))
+    {
+      int gpnum = regnum - tdep->eax_regnum;
+
+      /* Read ...  */
+      regcache_raw_read (regcache, gpnum, raw_buf);
+      /* ... Modify ... (always little endian).  */
+      memcpy (raw_buf, buf, 4);
+      /* ... Write.  */
+      regcache_raw_write (regcache, gpnum, raw_buf);
+    }
+  else
+    i386_pseudo_register_write (gdbarch, regcache, regnum, buf);
+}
+
 
 
 /* Return the union class of CLASS1 and CLASS2.  See the psABI for
@@ -2132,6 +2233,19 @@ amd64_init_abi (struct gdbarch_info info
   tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS;
   tdep->register_names = amd64_register_names;
 
+  tdep->num_byte_regs = 16;
+  tdep->num_word_regs = 16;
+  tdep->num_dword_regs = 16;
+  /* Avoid wiring in the MMX registers for now.  */
+  tdep->num_mmx_regs = 0;
+
+  set_gdbarch_pseudo_register_read (gdbarch,
+				    amd64_pseudo_register_read);
+  set_gdbarch_pseudo_register_write (gdbarch,
+				     amd64_pseudo_register_write);
+
+  set_tdesc_pseudo_register_name (gdbarch, amd64_pseudo_register_name);
+
   /* AMD64 has an FPU and 16 SSE registers.  */
   tdep->st0_regnum = AMD64_ST0_REGNUM;
   tdep->num_xmm_regs = 16;
@@ -2183,10 +2297,6 @@ amd64_init_abi (struct gdbarch_info info
 
   set_gdbarch_skip_prologue (gdbarch, amd64_skip_prologue);
 
-  /* Avoid wiring in the MMX registers for now.  */
-  set_gdbarch_num_pseudo_regs (gdbarch, 0);
-  tdep->mm0_regnum = -1;
-
   tdep->record_regmap = amd64_record_regmap;
 
   set_gdbarch_dummy_id (gdbarch, amd64_dummy_id);
--- gdb-7.1-p2/gdb/i386-tdep.c	2010-04-03 20:59:52.000000000 +0200
+++ gdb-7.1/gdb/i386-tdep.c	2010-04-03 21:06:52.000000000 +0200
@@ -81,17 +81,72 @@ static const char *i386_mmx_names[] =
   "mm4", "mm5", "mm6", "mm7"
 };
 
-static const int i386_num_mmx_regs = ARRAY_SIZE (i386_mmx_names);
+/* Register names for byte pseudo-registers.  */
+
+static const char *i386_byte_names[] =
+{
+  "al", "cl", "dl", "bl", 
+  "ah", "ch", "dh", "bh"
+};
+
+/* Register names for word pseudo-registers.  */
+
+static const char *i386_word_names[] =
+{
+  "ax", "cx", "dx", "bx",
+  "sp", "bp", "si", "di"
+};
+
+/* MMX register?  */
 
 static int
 i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum)
 {
-  int mm0_regnum = gdbarch_tdep (gdbarch)->mm0_regnum;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  int mm0_regnum = tdep->mm0_regnum;
 
   if (mm0_regnum < 0)
     return 0;
 
-  return (regnum >= mm0_regnum && regnum < mm0_regnum + i386_num_mmx_regs);
+  regnum -= mm0_regnum;
+  return regnum >= 0 && regnum < tdep->num_mmx_regs;
+}
+
+/* Byte register?  */
+
+int
+i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  regnum -= tdep->al_regnum;
+  return regnum >= 0 && regnum < tdep->num_byte_regs;
+}
+
+/* Word register?  */
+
+int
+i386_word_regnum_p (struct gdbarch *gdbarch, int regnum)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  regnum -= tdep->ax_regnum;
+  return regnum >= 0 && regnum < tdep->num_word_regs;
+}
+
+/* Dword register?  */
+
+int
+i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  int eax_regnum = tdep->eax_regnum;
+
+  if (eax_regnum < 0)
+    return 0;
+
+  regnum -= eax_regnum;
+  return regnum >= 0 && regnum < tdep->num_dword_regs;
 }
 
 /* SSE register?  */
@@ -147,11 +202,18 @@ i386_fpc_regnum_p (struct gdbarch *gdbar
 
 /* Return the name of register REGNUM.  */
 
-static const char *
+const char *
 i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
 {
-  gdb_assert (i386_mmx_regnum_p (gdbarch, regnum));
-  return i386_mmx_names[regnum - I387_MM0_REGNUM (gdbarch_tdep (gdbarch))];
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  if (i386_mmx_regnum_p (gdbarch, regnum))
+    return i386_mmx_names[regnum - I387_MM0_REGNUM (tdep)];
+  else if (i386_byte_regnum_p (gdbarch, regnum))
+    return i386_byte_names[regnum - tdep->al_regnum];
+  else if (i386_word_regnum_p (gdbarch, regnum))
+    return i386_word_names[regnum - tdep->ax_regnum];
+
+  internal_error (__FILE__, __LINE__, _("invalid regnum"));
 }
 
 /* Convert a dbx register number REG to the appropriate register
@@ -2169,8 +2231,20 @@ i386_mmx_type (struct gdbarch *gdbarch)
 static struct type *
 i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
 {
-  gdb_assert (i386_mmx_regnum_p (gdbarch, regnum));
-  return i386_mmx_type (gdbarch);
+  if (i386_mmx_regnum_p (gdbarch, regnum))
+    return i386_mmx_type (gdbarch);
+  else
+    {
+      const struct builtin_type *bt = builtin_type (gdbarch);
+      if (i386_byte_regnum_p (gdbarch, regnum))
+	return bt->builtin_int8;
+      else if (i386_word_regnum_p (gdbarch, regnum))
+	return bt->builtin_int16;
+      else if (i386_dword_regnum_p (gdbarch, regnum))
+	return bt->builtin_int32;
+    }
+
+  internal_error (__FILE__, __LINE__, _("invalid regnum"));
 }
 
 /* Map a cooked register onto a raw register or memory.  For the i386,
@@ -2192,41 +2266,104 @@ i386_mmx_regnum_to_fp_regnum (struct reg
   return (I387_ST0_REGNUM (tdep) + fpreg);
 }
 
-static void
+void
 i386_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
 			   int regnum, gdb_byte *buf)
 {
+  gdb_byte raw_buf[MAX_REGISTER_SIZE];
+
   if (i386_mmx_regnum_p (gdbarch, regnum))
     {
-      gdb_byte mmx_buf[MAX_REGISTER_SIZE];
       int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum);
 
       /* Extract (always little endian).  */
-      regcache_raw_read (regcache, fpnum, mmx_buf);
-      memcpy (buf, mmx_buf, register_size (gdbarch, regnum));
+      regcache_raw_read (regcache, fpnum, raw_buf);
+      memcpy (buf, raw_buf, register_size (gdbarch, regnum));
     }
   else
-    regcache_raw_read (regcache, regnum, buf);
+    {
+      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+      if (i386_word_regnum_p (gdbarch, regnum))
+	{
+	  int gpnum = regnum - tdep->ax_regnum;
+
+	  /* Extract (always little endian).  */
+	  regcache_raw_read (regcache, gpnum, raw_buf);
+	  memcpy (buf, raw_buf, 2);
+	}
+      else if (i386_byte_regnum_p (gdbarch, regnum))
+	{
+	  /* Check byte pseudo registers last since this function will
+	     be called from amd64_pseudo_register_read, which handles
+	     byte pseudo registers differently.  */
+	  int gpnum = regnum - tdep->al_regnum;
+
+	  /* Extract (always little endian).  We read both lower and
+	     upper registers.  */
+	  regcache_raw_read (regcache, gpnum % 4, raw_buf);
+	  if (gpnum >= 4)
+	    memcpy (buf, raw_buf + 1, 1);
+	  else
+	    memcpy (buf, raw_buf, 1);
+	}
+      else
+	internal_error (__FILE__, __LINE__, _("invalid regnum"));
+    }
 }
 
-static void
+void
 i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
 			    int regnum, const gdb_byte *buf)
 {
+  gdb_byte raw_buf[MAX_REGISTER_SIZE];
+
   if (i386_mmx_regnum_p (gdbarch, regnum))
     {
-      gdb_byte mmx_buf[MAX_REGISTER_SIZE];
       int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum);
 
       /* Read ...  */
-      regcache_raw_read (regcache, fpnum, mmx_buf);
+      regcache_raw_read (regcache, fpnum, raw_buf);
       /* ... Modify ... (always little endian).  */
-      memcpy (mmx_buf, buf, register_size (gdbarch, regnum));
+      memcpy (raw_buf, buf, register_size (gdbarch, regnum));
       /* ... Write.  */
-      regcache_raw_write (regcache, fpnum, mmx_buf);
+      regcache_raw_write (regcache, fpnum, raw_buf);
     }
   else
-    regcache_raw_write (regcache, regnum, buf);
+    {
+      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+      if (i386_word_regnum_p (gdbarch, regnum))
+	{
+	  int gpnum = regnum - tdep->ax_regnum;
+
+	  /* Read ...  */
+	  regcache_raw_read (regcache, gpnum, raw_buf);
+	  /* ... Modify ... (always little endian).  */
+	  memcpy (raw_buf, buf, 2);
+	  /* ... Write.  */
+	  regcache_raw_write (regcache, gpnum, raw_buf);
+	}
+      else if (i386_byte_regnum_p (gdbarch, regnum))
+	{
+	  /* Check byte pseudo registers last since this function will
+	     be called from amd64_pseudo_register_read, which handles
+	     byte pseudo registers differently.  */
+	  int gpnum = regnum - tdep->al_regnum;
+
+	  /* Read ...  We read both lower and upper registers.  */
+	  regcache_raw_read (regcache, gpnum % 4, raw_buf);
+	  /* ... Modify ... (always little endian).  */
+	  if (gpnum >= 4)
+	    memcpy (raw_buf + 1, buf, 1);
+	  else
+	    memcpy (raw_buf, buf, 1);
+	  /* ... Write.  */
+	  regcache_raw_write (regcache, gpnum % 4, raw_buf);
+	}
+      else
+	internal_error (__FILE__, __LINE__, _("invalid regnum"));
+    }
 }
 
 
@@ -2663,22 +2800,46 @@ int
 i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 			  struct reggroup *group)
 {
-  int sse_regnum_p = (i386_sse_regnum_p (gdbarch, regnum)
-		      || i386_mxcsr_regnum_p (gdbarch, regnum));
-  int fp_regnum_p = (i386_fp_regnum_p (gdbarch, regnum)
-		     || i386_fpc_regnum_p (gdbarch, regnum));
-  int mmx_regnum_p = (i386_mmx_regnum_p (gdbarch, regnum));
+  int sse_regnum_p, fp_regnum_p, mmx_regnum_p, byte_regnum_p,
+      word_regnum_p, dword_regnum_p;
+
+  /* Don't include pseudo registers, except for MMX, in any register
+     groups.  */
+  byte_regnum_p = i386_byte_regnum_p (gdbarch, regnum);
+  if (byte_regnum_p)
+    return 0;
 
+  word_regnum_p = i386_word_regnum_p (gdbarch, regnum);
+  if (word_regnum_p)
+    return 0;
+
+  dword_regnum_p = i386_dword_regnum_p (gdbarch, regnum);
+  if (dword_regnum_p)
+    return 0;
+
+  mmx_regnum_p = i386_mmx_regnum_p (gdbarch, regnum);
   if (group == i386_mmx_reggroup)
     return mmx_regnum_p;
+
+  sse_regnum_p = (i386_sse_regnum_p (gdbarch, regnum)
+		  || i386_mxcsr_regnum_p (gdbarch, regnum));
   if (group == i386_sse_reggroup)
     return sse_regnum_p;
   if (group == vector_reggroup)
-    return (mmx_regnum_p || sse_regnum_p);
+    return mmx_regnum_p || sse_regnum_p;
+
+  fp_regnum_p = (i386_fp_regnum_p (gdbarch, regnum)
+		 || i386_fpc_regnum_p (gdbarch, regnum));
   if (group == float_reggroup)
     return fp_regnum_p;
+
   if (group == general_reggroup)
-    return (!fp_regnum_p && !mmx_regnum_p && !sse_regnum_p);
+    return (!fp_regnum_p
+	    && !mmx_regnum_p
+	    && !sse_regnum_p
+	    && !byte_regnum_p
+	    && !word_regnum_p
+	    && !dword_regnum_p);
 
   return default_register_reggroup_p (gdbarch, regnum, group);
 }
@@ -5527,6 +5688,7 @@ i386_gdbarch_init (struct gdbarch_info i
   struct gdbarch *gdbarch;
   struct tdesc_arch_data *tdesc_data;
   const struct target_desc *tdesc;
+  int mm0_regnum;
 
   /* If there is already a candidate, use it.  */
   arches = gdbarch_list_lookup_by_info (arches, &info);
@@ -5563,11 +5725,6 @@ i386_gdbarch_init (struct gdbarch_info i
 
   tdep->st0_regnum = I386_ST0_REGNUM;
 
-  /* The MMX registers are implemented as pseudo-registers.  Put off
-     calculating the register number for %mm0 until we know the number
-     of raw registers.  */
-  tdep->mm0_regnum = 0;
-
   /* I386_NUM_XREGS includes %mxcsr, so substract one.  */
   tdep->num_xmm_regs = I386_NUM_XREGS - 1;
 
@@ -5693,8 +5850,7 @@ i386_gdbarch_init (struct gdbarch_info i
 
   frame_base_set_default (gdbarch, &i386_frame_base);
 
-  /* Wire in the MMX registers.  */
-  set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs);
+  /* Pseudo registers may be changed by amd64_init_abi.  */
   set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read);
   set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write);
 
@@ -5714,12 +5870,24 @@ i386_gdbarch_init (struct gdbarch_info i
   tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS;
   tdep->register_names = i386_register_names;
 
+  tdep->num_byte_regs = 8;
+  tdep->num_word_regs = 8;
+  tdep->num_dword_regs = 0;
+  tdep->num_mmx_regs = 8;
+
   tdesc_data = tdesc_data_alloc ();
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
   info.tdep_info = (void *) tdesc_data;
   gdbarch_init_osabi (info, gdbarch);
 
+  /* Wire in pseudo registers.  Number of pseudo registers may be
+     changed.  */
+  set_gdbarch_num_pseudo_regs (gdbarch, (tdep->num_byte_regs
+					 + tdep->num_word_regs
+					 + tdep->num_dword_regs
+					 + tdep->num_mmx_regs));
+
   /* Target description may be changed.  */
   tdesc = tdep->tdesc;
 
@@ -5736,6 +5904,28 @@ i386_gdbarch_init (struct gdbarch_info i
   /* Override gdbarch_register_reggroup_p set in tdesc_use_registers.  */
   set_gdbarch_register_reggroup_p (gdbarch, tdep->register_reggroup_p);
 
+  /* Make %al the first pseudo-register.  */
+  tdep->al_regnum = gdbarch_num_regs (gdbarch);
+  tdep->ax_regnum = tdep->al_regnum + tdep->num_byte_regs;
+
+  mm0_regnum = tdep->ax_regnum + tdep->num_word_regs;
+  if (tdep->num_dword_regs)
+    {
+      /* Support dword pseudo-registesr if it hasn't been disabled,  */
+      tdep->eax_regnum = mm0_regnum;
+      mm0_regnum = tdep->eax_regnum + tdep->num_dword_regs;
+    }
+  else
+    tdep->eax_regnum = -1;
+
+  if (tdep->num_mmx_regs != 0)
+    {
+      /* Support MMX pseudo-registesr if MMX hasn't been disabled,  */
+      tdep->mm0_regnum = mm0_regnum;
+    }
+  else
+    tdep->mm0_regnum = -1;
+
   /* Hook in the legacy prologue-based unwinders last (fallback).  */
   frame_unwind_append_unwinder (gdbarch, &i386_sigtramp_frame_unwind);
   frame_unwind_append_unwinder (gdbarch, &i386_frame_unwind);
@@ -5747,11 +5937,6 @@ i386_gdbarch_init (struct gdbarch_info i
     set_gdbarch_regset_from_core_section (gdbarch,
 					  i386_regset_from_core_section);
 
-  /* Unless support for MMX has been disabled, make %mm0 the first
-     pseudo-register.  */
-  if (tdep->mm0_regnum == 0)
-    tdep->mm0_regnum = gdbarch_num_regs (gdbarch);
-
   set_gdbarch_skip_permanent_breakpoint (gdbarch,
 					 i386_skip_permanent_breakpoint);
 
--- gdb-7.1-p2/gdb/i386-tdep.h	2010-04-03 20:59:52.000000000 +0200
+++ gdb-7.1/gdb/i386-tdep.h	2010-04-03 21:06:52.000000000 +0200
@@ -114,10 +114,32 @@ struct gdbarch_tdep
      absence of an FPU.  */
   int st0_regnum;
 
+  /* Number of MMX registers.  */
+  int num_mmx_regs;
+
   /* Register number for %mm0.  Set this to -1 to indicate the absence
      of MMX support.  */
   int mm0_regnum;
 
+  /* Number of byte registers.  */
+  int num_byte_regs;
+
+  /* Register pseudo number for %al.  */
+  int al_regnum;
+
+  /* Number of pseudo word registers.  */
+  int num_word_regs;
+
+  /* Register number for %ax.  */
+  int ax_regnum;
+
+  /* Number of pseudo dword registers.  */
+  int num_dword_regs;
+
+  /* Register number for %eax.  Set this to -1 to indicate the absence
+     of pseudo dword register support.  */
+  int eax_regnum;
+
   /* Number of core registers.  */
   int num_core_regs;
 
@@ -253,6 +275,21 @@ enum record_i386_regnum
 /* Types for i386-specific registers.  */
 extern struct type *i387_ext_type (struct gdbarch *gdbarch);
 
+/* Checks of different pseudo-registers.  */
+extern int i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum);
+extern int i386_word_regnum_p (struct gdbarch *gdbarch, int regnum);
+extern int i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum);
+
+extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch,
+					      int regnum);
+
+extern void i386_pseudo_register_read (struct gdbarch *gdbarch,
+				       struct regcache *regcache,
+				       int regnum, gdb_byte *buf);
+extern void i386_pseudo_register_write (struct gdbarch *gdbarch,
+					struct regcache *regcache,
+					int regnum, const gdb_byte *buf);
+
 /* Segment selectors.  */
 #define I386_SEL_RPL	0x0003  /* Requester's Privilege Level mask.  */
 #define I386_SEL_UPL	0x0003	/* User Privilige Level. */
--- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-byte.exp	1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-byte.exp	2010-04-03 21:06:52.000000000 +0200
@@ -0,0 +1,121 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb at gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if { ![istarget x86_64-*-* ] } {
+    verbose "Skipping amd64 byte register tests."
+    return
+}
+
+set testfile "amd64-byte"
+set srcfile amd64-pseudo.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+    return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
+    untested ${testfile}
+    return
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    gdb_suppress_tests
+}
+
+set nr_regs 14
+set byte_regs(1) al
+set byte_regs(2) bl
+set byte_regs(3) cl
+set byte_regs(4) dl
+set byte_regs(5) sil
+set byte_regs(6) dil
+set byte_regs(7) r8l
+set byte_regs(8) r9l
+set byte_regs(9) r10l
+set byte_regs(10) r11l
+set byte_regs(11) r12l
+set byte_regs(12) r13l
+set byte_regs(13) r14l
+set byte_regs(14) r15l
+
+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set first breakpoint in main"
+gdb_continue_to_breakpoint "continue to first breakpoint in main"
+
+for { set r 1 } { $r <= 6  } { incr r } {
+    gdb_test "print/x \$$byte_regs($r)" \
+        ".. = 0x[format %x $r]1" \
+        "check contents of %$byte_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set second breakpoint in main"
+gdb_continue_to_breakpoint "continue to second breakpoint in main"
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+    gdb_test "print/x \$$byte_regs($r)" \
+        ".. = 0x[format %x $r]1" \
+        "check contents of %$byte_regs($r)"
+}
+
+for { set r 1 } { $r <= 6  } { incr r } {
+  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set third breakpoint in main"
+gdb_continue_to_breakpoint "continue to third breakpoint in main"
+
+for { set r 1 } { $r <= 6  } { incr r } {
+    gdb_test "print \$$byte_regs($r)" \
+        ".. = $r" \
+        "check contents of %$byte_regs($r)"
+}
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set forth breakpoint in main"
+gdb_continue_to_breakpoint "continue to forth breakpoint in main"
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+    gdb_test "print \$$byte_regs($r)" \
+        ".. = $r" \
+        "check contents of %$byte_regs($r)"
+}
--- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-dword.exp	1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-dword.exp	2010-04-03 21:06:52.000000000 +0200
@@ -0,0 +1,123 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb at gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if { ![istarget x86_64-*-* ] } {
+    verbose "Skipping amd64 dword register tests."
+    return
+}
+
+set testfile "amd64-dword"
+set srcfile amd64-pseudo.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+    return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
+    untested ${testfile}
+    return
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    gdb_suppress_tests
+}
+
+set nr_regs 14
+set dword_regs(1) eax
+set dword_regs(2) ebx
+set dword_regs(3) ecx
+set dword_regs(4) edx
+set dword_regs(5) esi
+set dword_regs(6) edi
+set dword_regs(7) r8d
+set dword_regs(8) r9d
+set dword_regs(9) r10d
+set dword_regs(10) r11d
+set dword_regs(11) r12d
+set dword_regs(12) r13d
+set dword_regs(13) r14d
+set dword_regs(14) r15d
+
+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set first breakpoint in main"
+gdb_continue_to_breakpoint "continue to first breakpoint in main"
+
+for { set r 1 } { $r <= 6  } { incr r } {
+    set hex [format %x $r]
+    gdb_test "print/x \$$dword_regs($r)" \
+	".. = 0x${hex}4${hex}3${hex}2${hex}1" \
+        "check contents of %$dword_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set second breakpoint in main"
+gdb_continue_to_breakpoint "continue to second breakpoint in main"
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+    set hex [format %x $r]
+    gdb_test "print/x \$$dword_regs($r)" \
+	".. = 0x${hex}4${hex}3${hex}2${hex}1" \
+        "check contents of %$dword_regs($r)"
+}
+
+for { set r 1 } { $r <= 6  } { incr r } {
+  gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set third breakpoint in main"
+gdb_continue_to_breakpoint "continue to third breakpoint in main"
+
+for { set r 1 } { $r <= 6  } { incr r } {
+    gdb_test "print \$$dword_regs($r)" \
+        ".. = $r" \
+        "check contents of %$dword_regs($r)"
+}
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+  gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set forth breakpoint in main"
+gdb_continue_to_breakpoint "continue to forth breakpoint in main"
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+    gdb_test "print \$$dword_regs($r)" \
+        ".. = $r" \
+        "check contents of %$dword_regs($r)"
+}
--- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-pseudo.c	1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-pseudo.c	2010-04-03 21:06:52.000000000 +0200
@@ -0,0 +1,91 @@
+/* Test program for byte registers.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+
+int data[] = {
+  0x14131211,
+  0x24232221,
+  0x34333231,
+  0x44434241,
+  0x54535251,
+  0x64636261,
+  0x74737271,
+  0x84838281,
+  0x94939291,
+  0xa4a3a2a1,
+  0xb4b3b2b1,
+  0xc4c3c2c1,
+  0xd4d3d2d1,
+  0xe4e3e2e1,
+};
+
+int
+main (int argc, char **argv)
+{
+  asm ("mov 0(%0), %%eax\n\t"
+       "mov 4(%0), %%ebx\n\t"
+       "mov 8(%0), %%ecx\n\t"
+       "mov 12(%0), %%edx\n\t"
+       "mov 16(%0), %%esi\n\t"
+       "mov 20(%0), %%edi\n\t"
+       : /* no output operands */
+       : "r" (data) 
+       : "eax", "ebx", "ecx", "edx", "esi", "edi");
+  asm ("nop"); /* first breakpoint here */
+
+  asm ("mov 24(%0), %%r8d\n\t"
+       "mov 28(%0), %%r9d\n\t"
+       "mov 32(%0), %%r10d\n\t"
+       "mov 36(%0), %%r11\n\t"
+       "mov 40(%0), %%r12d\n\t"
+       "mov 44(%0), %%r13d\n\t"
+       "mov 48(%0), %%r14d\n\t"
+       "mov 52(%0), %%r15d\n\t"
+       : /* no output operands */
+       : "r" (data) 
+       : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+  asm ("nop"); /* second breakpoint here */
+
+  asm ("mov %%eax, 0(%0)\n\t"
+       "mov %%ebx, 4(%0)\n\t"
+       "mov %%ecx, 8(%0)\n\t"
+       "mov %%edx, 12(%0)\n\t"
+       "mov %%esi, 16(%0)\n\t"
+       "mov %%edi, 20(%0)\n\t"
+       : /* no output operands */
+       : "r" (data) 
+       : "eax", "ebx", "ecx", "edx", "esi", "edi");
+  asm ("nop"); /* third breakpoint here */
+
+  asm ("mov %%r8d, 24(%0)\n\t"
+       "mov %%r9d, 28(%0)\n\t"
+       "mov %%r10d, 32(%0)\n\t"
+       "mov %%r11d, 36(%0)\n\t"
+       "mov %%r12d, 40(%0)\n\t"
+       "mov %%r13d, 44(%0)\n\t"
+       "mov %%r14d, 48(%0)\n\t"
+       "mov %%r15d, 52(%0)\n\t"
+       : /* no output operands */
+       : "r" (data) 
+       : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+  puts ("Bye!"); /* forth breakpoint here */
+
+  return 0;
+}
--- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-word.exp	1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-word.exp	2010-04-03 21:06:52.000000000 +0200
@@ -0,0 +1,123 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb at gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if { ![istarget x86_64-*-* ] } {
+    verbose "Skipping amd64 word register tests."
+    return
+}
+
+set testfile "amd64-word"
+set srcfile amd64-pseudo.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+    return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
+    untested ${testfile}
+    return
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    gdb_suppress_tests
+}
+
+set nr_regs 14
+set word_regs(1) ax
+set word_regs(2) bx
+set word_regs(3) cx
+set word_regs(4) dx
+set word_regs(5) si
+set word_regs(6) di
+set word_regs(7) r8w
+set word_regs(8) r9w
+set word_regs(9) r10w
+set word_regs(10) r11w
+set word_regs(11) r12w
+set word_regs(12) r13w
+set word_regs(13) r14w
+set word_regs(14) r15w
+
+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set first breakpoint in main"
+gdb_continue_to_breakpoint "continue to first breakpoint in main"
+
+for { set r 1 } { $r <= 6  } { incr r } {
+    set hex [format %x $r]
+    gdb_test "print/x \$$word_regs($r)" \
+        ".. = 0x${hex}2${hex}1" \
+        "check contents of %$word_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set second breakpoint in main"
+gdb_continue_to_breakpoint "continue to second breakpoint in main"
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+    set hex [format %x $r]
+    gdb_test "print/x \$$word_regs($r)" \
+        ".. = 0x${hex}2${hex}1" \
+        "check contents of %$word_regs($r)"
+}
+
+for { set r 1 } { $r <= 6  } { incr r } {
+  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set third breakpoint in main"
+gdb_continue_to_breakpoint "continue to third breakpoint in main"
+
+for { set r 1 } { $r <= 6  } { incr r } {
+    gdb_test "print \$$word_regs($r)" \
+        ".. = $r" \
+        "check contents of %$word_regs($r)"
+}
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set forth breakpoint in main"
+gdb_continue_to_breakpoint "continue to forth breakpoint in main"
+
+for { set r 7 } { $r <= $nr_regs  } { incr r } {
+    gdb_test "print \$$word_regs($r)" \
+        ".. = $r" \
+        "check contents of %$word_regs($r)"
+}
--- gdb-7.1-p2/gdb/testsuite/gdb.arch/i386-byte.exp	1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.arch/i386-byte.exp	2010-04-03 21:06:52.000000000 +0200
@@ -0,0 +1,98 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb at gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if { ![istarget i?86-*-*] } {
+    verbose "Skipping i386 byte register tests."
+    return
+}
+
+set testfile "i386-byte"
+set srcfile i386-pseudo.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+    return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
+    untested ${testfile}
+    return
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    gdb_suppress_tests
+}
+
+set byte_regs(1) al
+set byte_regs(2) bl
+set byte_regs(3) cl
+set byte_regs(4) dl
+set byte_regs(5) ah
+set byte_regs(6) bh
+set byte_regs(7) ch
+set byte_regs(8) dh
+
+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set first breakpoint in main"
+gdb_continue_to_breakpoint "continue to first breakpoint in main"
+
+for { set r 1 } { $r <= 4  } { incr r } {
+    gdb_test "print/x \$$byte_regs($r)" \
+        ".. = 0x[format %x $r]1" \
+        "check contents of %$byte_regs($r)"
+    set h [expr $r + 4]
+    gdb_test "print/x \$$byte_regs($h)" \
+        ".. = 0x[format %x $r]2" \
+        "check contents of %$byte_regs($h)"
+}
+
+for { set r 1 } { $r <= 4  } { incr r } {
+  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+  set h [expr $r + 4]
+  gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+}
+
+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set second breakpoint in main"
+gdb_continue_to_breakpoint "continue to second breakpoint in main"
+
+for { set r 1 } { $r <= 4  } { incr r } {
+    gdb_test "print \$$byte_regs($r)" \
+        ".. = $r" \
+        "check contents of %$byte_regs($r)"
+    set h [expr $r + 4]
+    gdb_test "print \$$byte_regs($h)" \
+        ".. = $h" \
+        "check contents of %$byte_regs($h)"
+}
--- gdb-7.1-p2/gdb/testsuite/gdb.arch/i386-pseudo.c	1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.arch/i386-pseudo.c	2010-04-03 21:06:52.000000000 +0200
@@ -0,0 +1,51 @@
+/* Test program for byte registers.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+
+int data[] = {
+  0x14131211,
+  0x24232221,
+  0x34333231,
+  0x44434241,
+};
+
+int
+main (int argc, char **argv)
+{
+  asm ("mov 0(%0), %%eax\n\t"
+       "mov 4(%0), %%ebx\n\t"
+       "mov 8(%0), %%ecx\n\t"
+       "mov 12(%0), %%edx\n\t"
+       : /* no output operands */
+       : "r" (data) 
+       : "eax", "ebx", "ecx", "edx");
+  asm ("nop"); /* first breakpoint here */
+
+  asm ("mov %%eax, 0(%0)\n\t"
+       "mov %%ebx, 4(%0)\n\t"
+       "mov %%ecx, 8(%0)\n\t"
+       "mov %%edx, 12(%0)\n\t"
+       : /* no output operands */
+       : "r" (data) 
+       : "eax", "ebx", "ecx", "edx");
+  puts ("Bye!"); /* second breakpoint here */
+
+  return 0;
+}
--- gdb-7.1-p2/gdb/testsuite/gdb.arch/i386-word.exp	1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.arch/i386-word.exp	2010-04-03 21:06:52.000000000 +0200
@@ -0,0 +1,84 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb at gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if { ![istarget i?86-*-*] } {
+    verbose "Skipping i386 word register tests."
+    return
+}
+
+set testfile "i386-word"
+set srcfile i386-pseudo.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+    return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
+    untested ${testfile}
+    return
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    gdb_suppress_tests
+}
+
+set word_regs(1) ax
+set word_regs(2) bx
+set word_regs(3) cx
+set word_regs(4) dx
+
+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set first breakpoint in main"
+gdb_continue_to_breakpoint "continue to first breakpoint in main"
+
+for { set r 1 } { $r <= 4  } { incr r } {
+    gdb_test "print/x \$$word_regs($r)" \
+        ".. = 0x[format %x $r]2[format %x $r]1" \
+        "check contents of %$word_regs($r)"
+}
+
+for { set r 1 } { $r <= 4  } { incr r } {
+  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+}
+
+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
+         "Breakpoint .* at .*${srcfile}.*" \
+         "set second breakpoint in main"
+gdb_continue_to_breakpoint "continue to second breakpoint in main"
+
+for { set r 1 } { $r <= 4  } { incr r } {
+    gdb_test "print \$$word_regs($r)" \
+        ".. = $r" \
+        "check contents of %$word_regs($r)"
+}

gdb-bz578250-avx-05of10.patch:
 NEWS |    8 ++++++++
 1 file changed, 8 insertions(+)

--- NEW FILE gdb-bz578250-avx-05of10.patch ---
[ Backported.  ]

commit 6448aace637843e8e7c021d7f8c5d5d5fdd71974
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Wed Mar 3 20:19:48 2010 +0000

    Mention improvement for X86 general purpose registers.
    
    2010-03-03  H.J. Lu  <hongjiu.lu at intel.com>
    	    Eli Zaretskii  <eliz at gnu.org>
    
    	* NEWS: Add X86 general purpose registers section.

--- gdb-7.1-p3/gdb/NEWS	2010-03-18 22:01:55.000000000 +0100
+++ gdb-7.1/gdb/NEWS	2010-04-03 21:07:46.000000000 +0200
@@ -438,6 +438,14 @@ GDB will now correctly handle all of:
     now support hardware watchpoints, and will use them automatically
     as appropriate.
 
+* X86 general purpose registers
+
+  GDB now supports reading/writing byte, word and double-word x86
+  general purpose registers directly.  This means you can use, say,
+  $ah or $ax to refer, respectively, to the byte register AH and
+  16-bit word register AX that are actually portions of the 32-bit
+  register EAX or 64-bit register RAX.
+
 * Python scripting
 
   GDB now has support for scripting using Python.  Whether this is

gdb-bz578250-avx-06of10.patch:
 amd64-tdep.c |    2 +-
 i386-tdep.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- NEW FILE gdb-bz578250-avx-06of10.patch ---
[ Backported.  ]

commit 49f8d1c24c639d891f58a3b9feda425833b702fb
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Fri Mar 12 15:12:34 2010 +0000

    Restore sp for x86.
    
    2010-03-12  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* amd64-tdep.c (amd64_word_names): Replace "sp" with "".
    	* i386-tdep.c (i386_word_names): Likewise.

--- gdb-7.1-p4/gdb/amd64-tdep.c	2010-04-03 21:06:52.000000000 +0200
+++ gdb-7.1/gdb/amd64-tdep.c	2010-04-03 21:08:21.000000000 +0200
@@ -222,7 +222,7 @@ static const char *amd64_byte_names[] =
 
 static const char *amd64_word_names[] =
 {
-  "ax", "bx", "cx", "dx", "si", "di", "bp", "sp", 
+  "ax", "bx", "cx", "dx", "si", "di", "bp", "", 
   "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
 };
 
--- gdb-7.1-p4/gdb/i386-tdep.c	2010-04-03 21:06:52.000000000 +0200
+++ gdb-7.1/gdb/i386-tdep.c	2010-04-03 21:08:21.000000000 +0200
@@ -94,7 +94,7 @@ static const char *i386_byte_names[] =
 static const char *i386_word_names[] =
 {
   "ax", "cx", "dx", "bx",
-  "sp", "bp", "si", "di"
+  "", "bp", "si", "di"
 };
 
 /* MMX register?  */

gdb-bz578250-avx-07of10.patch:
 NEWS            |    5 +++
 doc/gdb.texinfo |    6 ++++
 i386-tdep.c     |    4 +++
 remote.c        |   74 ++++++++++++++++++++++++++++++++++++++++++++++----------
 remote.h        |    1 
 5 files changed, 78 insertions(+), 12 deletions(-)

--- NEW FILE gdb-bz578250-avx-07of10.patch ---
[ Backported.  ]

commit d5ea7042210f5ad319ad19910bce13fd5717c6d6
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Tue Mar 30 15:45:08 2010 +0000

    Add xmlRegisters= to qSupported packet.
    
    gdb/
    
    2010-03-30  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* NEWS: Mention xmlRegisters= in qSupported packet.
    
    	* i386-tdep.c: Include "remote.h".
    	(_initialize_i386_tdep): Call register_remote_support_xml.
    
    	* remote.c (remote_support_xml): New.
    	(register_remote_support_xml): Likewise.
    	(remote_query_supported_append): Likewise.
    	(remote_query_supported): Support remote_support_xml.
    
    	* remote.h (register_remote_support_xml): New.
    
    gdb/doc/
    
    2010-03-30  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* gdb.texinfo (General Query Packets): Add xmlRegisters.

--- gdb-7.1-p5/gdb/NEWS	2010-04-03 21:07:46.000000000 +0200
+++ gdb-7.1/gdb/NEWS	2010-04-03 21:10:06.000000000 +0200
@@ -1,6 +1,11 @@
 		What has changed in GDB?
 	     (Organized release by release)
 
+*** Changes since GDB 7.1
+
+* GDB now sends xmlRegisters= in qSupported packet to indicate that
+  it understands register description.
+
 *** Changes in GDB 7.1
 
 * C++ Improvements
--- gdb-7.1-p5/gdb/doc/gdb.texinfo	2010-04-03 21:04:13.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo	2010-04-03 21:09:29.000000000 +0200
@@ -30292,6 +30292,12 @@ extensions to the remote protocol.  @val
 extensions unless the stub also reports that it supports them by
 including @samp{multiprocess+} in its @samp{qSupported} reply.
 @xref{multiprocess extensions}, for details.
+
+ at item xmlRegisters
+This feature indicates that @value{GDBN} supports the XML target
+description.  If the stub sees @samp{xmlRegisters=} with target
+specific strings separated by a comma, it will report register
+description.
 @end table
 
 Stubs should ignore any unknown values for
--- gdb-7.1-p5/gdb/i386-tdep.c	2010-04-03 21:08:21.000000000 +0200
+++ gdb-7.1/gdb/i386-tdep.c	2010-04-03 21:09:29.000000000 +0200
@@ -44,6 +44,7 @@
 #include "value.h"
 #include "dis-asm.h"
 #include "disasm.h"
+#include "remote.h"
 
 #include "gdb_assert.h"
 #include "gdb_string.h"
@@ -6000,4 +6001,7 @@ is \"default\"."),
 
   /* Initialize the standard target descriptions.  */
   initialize_tdesc_i386 ();
+
+  /* Tell remote stub that we support XML target description.  */
+  register_remote_support_xml ("i386");
 }
--- gdb-7.1-p5/gdb/remote.c	2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/remote.c	2010-04-03 21:09:29.000000000 +0200
@@ -3467,6 +3467,53 @@ static struct protocol_feature remote_pr
     PACKET_bs },
 };
 
+static char *remote_support_xml;
+
+/* Register string appended to "xmlRegisters=" in qSupported query.  */
+
+void
+register_remote_support_xml (const char *xml ATTRIBUTE_UNUSED)
+{
+#if defined(HAVE_LIBEXPAT)
+  if (remote_support_xml == NULL)
+    remote_support_xml = concat ("xmlRegisters=", xml, NULL);
+  else
+    {
+      char *copy = xstrdup (remote_support_xml + 13);
+      char *p = strtok (copy, ",");
+
+      do
+	{
+	  if (strcmp (p, xml) == 0)
+	    {
+	      /* already there */
+	      xfree (copy);
+	      return;
+	    }
+	}
+      while ((p = strtok (NULL, ",")) != NULL);
+      xfree (copy);
+
+      p = concat (remote_support_xml, ",", xml, NULL);
+      xfree (remote_support_xml);
+      remote_support_xml = p;
+    }
+#endif
+}
+
+static char *
+remote_query_supported_append (char *msg, const char *append)
+{
+  if (msg)
+    {
+      char *p = concat (msg, ";", append, NULL);
+      xfree (msg);
+      return p;
+    }
+  else
+    return xstrdup (append);
+}
+
 static void
 remote_query_supported (void)
 {
@@ -3485,24 +3532,27 @@ remote_query_supported (void)
   rs->buf[0] = 0;
   if (remote_protocol_packets[PACKET_qSupported].support != PACKET_DISABLE)
     {
+      char *q = NULL;
       const char *qsupported = gdbarch_qsupported (target_gdbarch);
+
+      if (rs->extended)
+	q = remote_query_supported_append (q, "multiprocess+");
+      
       if (qsupported)
+	q = remote_query_supported_append (q, qsupported);
+
+      if (remote_support_xml)
+	q = remote_query_supported_append (q, remote_support_xml);
+
+      if (q)
 	{
-	  char *q;
-	  if (rs->extended)
-	    q = concat ("qSupported:multiprocess+;", qsupported, NULL);
-	  else
-	    q = concat ("qSupported:", qsupported, NULL);
-	  putpkt (q);
+	  char *p = concat ("qSupported:", q, NULL);
 	  xfree (q);
+	  putpkt (p);
+	  xfree (p);
 	}
       else
-	{
-	  if (rs->extended)
-	    putpkt ("qSupported:multiprocess+");
-	  else
-	    putpkt ("qSupported");
-	}
+	putpkt ("qSupported");
 
       getpkt (&rs->buf, &rs->buf_size, 0);
 
--- gdb-7.1-p5/gdb/remote.h	2010-01-01 08:31:41.000000000 +0100
+++ gdb-7.1/gdb/remote.h	2010-04-03 21:09:29.000000000 +0200
@@ -66,6 +66,7 @@ extern void (*deprecated_target_wait_loo
 
 void register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
 				     const struct target_desc *tdesc);
+void register_remote_support_xml (const char *);
 
 void remote_file_put (const char *local_file, const char *remote_file,
 		      int from_tty);

gdb-bz578250-avx-08of10.patch:
 gdb.texinfo |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- NEW FILE gdb-bz578250-avx-08of10.patch ---
[ Backported.  ]

commit 684341392f3ca6703dc28dac548d3051811bff47
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Tue Mar 30 18:37:03 2010 +0000

    Add org.gnu.gdb.i386.avx.
    
    2010-03-30  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* gdb.texinfo (i386 Features): Add org.gnu.gdb.i386.avx.

--- gdb-7.1-p6/gdb/doc/gdb.texinfo	2010-04-03 21:09:29.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo	2010-04-03 21:10:57.000000000 +0200
@@ -33380,6 +33380,17 @@ describe registers:
 @samp{mxcsr}
 @end itemize
 
+The @samp{org.gnu.gdb.i386.avx} feature is optional.  It should
+describe the upper 128 bits of @sc{ymm} registers:
+
+ at itemize @minus
+ at item
+ at samp{ymm0h} through @samp{ymm7h} for i386
+ at item
+ at samp{ymm0h} through @samp{ymm15h} for amd64
+ at item 
+ at end itemize
+
 The @samp{org.gnu.gdb.i386.linux} feature is optional.  It should
 describe a single register, @samp{orig_eax}.
 

gdb-bz578250-avx-09of10.patch:
 amd64-tdep.c                      |   48 ++++++++++++++++++++++++++++++--------
 testsuite/gdb.arch/amd64-byte.exp |   30 ++++++++++++++++++++---
 2 files changed, 64 insertions(+), 14 deletions(-)

--- NEW FILE gdb-bz578250-avx-09of10.patch ---
[ Backported.  ]

commit 5362e5e1dc4cfac24fbd58773aaa7a82c615b662
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Thu Apr 1 20:02:07 2010 +0000

    Support "ah", "bh", "ch", "dh" on amd64.
    
    gdb/
    
    2010-04-01  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* amd64-tdep.c (amd64_byte_names): Add "ah", "bh", "ch", "dh".
    	(AMD64_NUM_LOWER_BYTE_REGS): New.
    	(amd64_pseudo_register_read): Handle "ah", "bh", "ch", "dh".
    	(amd64_pseudo_register_write): Likewise.
    	(amd64_init_abi): Set num_byte_regs to 20.
    
    gdb/testsuite/
    
    2010-04-01  H.J. Lu  <hongjiu.lu at intel.com>
    
    	* gdb.arch/amd64-byte.exp: Check "ah", "bh", "ch", "dh".

--- gdb-7.1-p7/gdb/amd64-tdep.c	2010-04-03 21:08:21.000000000 +0200
+++ gdb-7.1/gdb/amd64-tdep.c	2010-04-03 21:11:41.000000000 +0200
@@ -215,9 +215,13 @@ amd64_arch_reg_to_regnum (int reg)
 static const char *amd64_byte_names[] =
 {
   "al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
-  "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
+  "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l",
+  "ah", "bh", "ch", "dh"
 };
 
+/* Number of lower byte registers.  */
+#define AMD64_NUM_LOWER_BYTE_REGS 16
+
 /* Register names for word pseudo-registers.  */
 
 static const char *amd64_word_names[] =
@@ -263,8 +267,18 @@ amd64_pseudo_register_read (struct gdbar
       int gpnum = regnum - tdep->al_regnum;
 
       /* Extract (always little endian).  */
-      regcache_raw_read (regcache, gpnum, raw_buf);
-      memcpy (buf, raw_buf, 1);
+      if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
+	{
+	  /* Special handling for AH, BH, CH, DH.  */
+	  regcache_raw_read (regcache,
+			     gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+	  memcpy (buf, raw_buf + 1, 1);
+	}
+      else
+	{
+	  regcache_raw_read (regcache, gpnum, raw_buf);
+	  memcpy (buf, raw_buf, 1);
+	}
     }
   else if (i386_dword_regnum_p (gdbarch, regnum))
     {
@@ -289,12 +303,26 @@ amd64_pseudo_register_write (struct gdba
     {
       int gpnum = regnum - tdep->al_regnum;
 
-      /* Read ...  */
-      regcache_raw_read (regcache, gpnum, raw_buf);
-      /* ... Modify ... (always little endian).  */
-      memcpy (raw_buf, buf, 1);
-      /* ... Write.  */
-      regcache_raw_write (regcache, gpnum, raw_buf);
+      if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
+	{
+	  /* Read ... AH, BH, CH, DH.  */
+	  regcache_raw_read (regcache,
+			     gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+	  /* ... Modify ... (always little endian).  */
+	  memcpy (raw_buf + 1, buf, 1);
+	  /* ... Write.  */
+	  regcache_raw_write (regcache,
+			      gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+	}
+      else
+	{
+	  /* Read ...  */
+	  regcache_raw_read (regcache, gpnum, raw_buf);
+	  /* ... Modify ... (always little endian).  */
+	  memcpy (raw_buf, buf, 1);
+	  /* ... Write.  */
+	  regcache_raw_write (regcache, gpnum, raw_buf);
+	}
     }
   else if (i386_dword_regnum_p (gdbarch, regnum))
     {
@@ -2233,7 +2261,7 @@ amd64_init_abi (struct gdbarch_info info
   tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS;
   tdep->register_names = amd64_register_names;
 
-  tdep->num_byte_regs = 16;
+  tdep->num_byte_regs = 20;
   tdep->num_word_regs = 16;
   tdep->num_dword_regs = 16;
   /* Avoid wiring in the MMX registers for now.  */
--- gdb-7.1-p7/gdb/testsuite/gdb.arch/amd64-byte.exp	2010-04-03 21:06:52.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-byte.exp	2010-04-03 21:11:41.000000000 +0200
@@ -52,7 +52,6 @@ if ![runto_main] then {
     gdb_suppress_tests
 }
 
-set nr_regs 14
 set byte_regs(1) al
 set byte_regs(2) bl
 set byte_regs(3) cl
@@ -67,6 +66,10 @@ set byte_regs(11) r12l
 set byte_regs(12) r13l
 set byte_regs(13) r14l
 set byte_regs(14) r15l
+set byte_regs(15) ah
+set byte_regs(16) bh
+set byte_regs(17) ch
+set byte_regs(18) dh
 
 gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
          "Breakpoint .* at .*${srcfile}.*" \
@@ -79,12 +82,19 @@ for { set r 1 } { $r <= 6  } { incr r } 
         "check contents of %$byte_regs($r)"
 }
 
+for { set r 1 } { $r <= 4  } { incr r } {
+    set h [expr $r + 14]
+    gdb_test "print/x \$$byte_regs($h)" \
+        ".. = 0x[format %x $r]2" \
+        "check contents of %$byte_regs($h)"
+}
+
 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
          "Breakpoint .* at .*${srcfile}.*" \
          "set second breakpoint in main"
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
+for { set r 7 } { $r <= 14  } { incr r } {
     gdb_test "print/x \$$byte_regs($r)" \
         ".. = 0x[format %x $r]1" \
         "check contents of %$byte_regs($r)"
@@ -94,6 +104,11 @@ for { set r 1 } { $r <= 6  } { incr r } 
   gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
 }
 
+for { set r 1 } { $r <= 4  } { incr r } {
+  set h [expr $r + 14]
+  gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+}
+
 gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
          "Breakpoint .* at .*${srcfile}.*" \
          "set third breakpoint in main"
@@ -105,7 +120,14 @@ for { set r 1 } { $r <= 6  } { incr r } 
         "check contents of %$byte_regs($r)"
 }
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
+for { set r 1 } { $r <= 4  } { incr r } {
+    set h [expr $r + 14]
+    gdb_test "print \$$byte_regs($h)" \
+        ".. = $h" \
+        "check contents of %$byte_regs($h)"
+}
+
+for { set r 7 } { $r <= 14  } { incr r } {
   gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
 }
 
@@ -114,7 +136,7 @@ gdb_test "break [gdb_get_line_number "fo
          "set forth breakpoint in main"
 gdb_continue_to_breakpoint "continue to forth breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
+for { set r 7 } { $r <= 14  } { incr r } {
     gdb_test "print \$$byte_regs($r)" \
         ".. = $r" \
         "check contents of %$byte_regs($r)"

gdb-bz578250-avx-10of10-ppc.patch:
 linux-ppc-low.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE gdb-bz578250-avx-10of10-ppc.patch ---
http://sourceware.org/ml/gdb-patches/2010-04/msg00056.html

linux-ppc-low.c:599: error: incompatible types when initializing type ‘enum regset_type’ using type ‘void (*)(struct regcache *, void *)’
linux-ppc-low.c:599: warning: initialization from incompatible pointer type

--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -594,7 +594,7 @@ struct regset_info target_regsets[] = {
      PPC_PTRACE_GETREGS.  */
   { PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, 0, SIZEOF_VSXREGS, EXTENDED_REGS,
   ppc_fill_vsxregset, ppc_store_vsxregset },
-  { PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, EXTENDED_REGS,
+  { PTRACE_GETVRREGS, PTRACE_SETVRREGS, 0, SIZEOF_VRREGS, EXTENDED_REGS,
     ppc_fill_vrregset, ppc_store_vrregset },
   { PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 0, 32 * 4 + 8 + 4, EXTENDED_REGS,
     ppc_fill_evrregset, ppc_store_evrregset },

gdb-bz578250-avx-10of10.patch:
 bfd/ChangeLog.xstate                    |   14 
 gdb/ChangeLog.avx                       |  306 +++++++
 gdb/ChangeLog.pseudo                    |  189 ++++
 gdb/ChangeLog.xcr                       | 1304 ++++++++++++++++++++++++++++++++
 gdb/ChangeLog.xml                       |  464 +++++++++++
 gdb/ChangeLog.xstate                    |  384 +++++++++
 gdb/amd64-linux-nat.c                   |  123 ++-
 gdb/amd64-linux-tdep.c                  |   42 +
 gdb/amd64-linux-tdep.h                  |    6 
 gdb/amd64-tdep.c                        |  127 +++
 gdb/amd64-tdep.h                        |   20 
 gdb/common/i386-xstate.h                |   41 +
 gdb/config/djgpp/fnchange.lst           |    8 
 gdb/doc/ChangeLog.xcr                   |   31 
 gdb/doc/ChangeLog.xml                   |   28 
 gdb/features/Makefile                   |   12 
 gdb/features/i386/32bit-avx.xml         |   18 
 gdb/features/i386/64bit-avx.xml         |   26 
 gdb/features/i386/Makefile              |    5 
 gdb/features/i386/amd64-avx-linux.c     |  171 ++++
 gdb/features/i386/amd64-avx-linux.xml   |   18 
 gdb/features/i386/amd64-avx.c           |  166 ++++
 gdb/features/i386/amd64-avx.xml         |   16 
 gdb/features/i386/i386-avx-linux.c      |  147 +++
 gdb/features/i386/i386-avx-linux.xml    |   18 
 gdb/features/i386/i386-avx.c            |  142 +++
 gdb/features/i386/i386-avx.xml          |   16 
 gdb/gdbserver/ChangeLog.avx             |   84 ++
 gdb/gdbserver/ChangeLog.xcr             |  373 +++++++++
 gdb/gdbserver/ChangeLog.xml             |   68 +
 gdb/gdbserver/ChangeLog.xstate          |   89 ++
 gdb/gdbserver/Makefile.in               |   14 
 gdb/gdbserver/configure.srv             |   20 
 gdb/gdbserver/i387-fp.c                 |  267 ++++++
 gdb/gdbserver/i387-fp.h                 |    5 
 gdb/gdbserver/linux-arm-low.c           |    8 
 gdb/gdbserver/linux-crisv32-low.c       |    4 
 gdb/gdbserver/linux-low.c               |   55 +
 gdb/gdbserver/linux-low.h               |    6 
 gdb/gdbserver/linux-m68k-low.c          |    6 
 gdb/gdbserver/linux-mips-low.c          |    6 
 gdb/gdbserver/linux-ppc-low.c           |    8 
 gdb/gdbserver/linux-s390-low.c          |    4 
 gdb/gdbserver/linux-sh-low.c            |    4 
 gdb/gdbserver/linux-sparc-low.c         |    6 
 gdb/gdbserver/linux-x86-low.c           |  174 ++++
 gdb/gdbserver/linux-xtensa-low.c        |    6 
 gdb/gdbserver/server.c                  |    5 
 gdb/gdbserver/target.h                  |    7 
 gdb/i386-linux-nat.c                    |  133 +++
 gdb/i386-linux-tdep.c                   |   71 +
 gdb/i386-linux-tdep.h                   |   31 
 gdb/i386-tdep.c                         |  331 +++++++-
 gdb/i386-tdep.h                         |   34 
 gdb/i387-tdep.c                         |  513 ++++++++++++
 gdb/i387-tdep.h                         |   14 
 gdb/regformats/i386/amd64-avx-linux.dat |   78 +
 gdb/regformats/i386/amd64-avx.dat       |   77 +
 gdb/regformats/i386/i386-avx-linux.dat  |   54 +
 gdb/regformats/i386/i386-avx.dat        |   53 +
 gdb/testsuite/ChangeLog.pseudo          |   26 
 gdb/testsuite/ChangeLog.xcr             |    6 
 gdb/testsuite/ChangeLog.xml             |    4 
 gdb/testsuite/gdb.arch/i386-avx.c       |  128 +++
 gdb/testsuite/gdb.arch/i386-avx.exp     |  110 ++
 gdb/testsuite/gdb.arch/i386-cpuid.h     |  235 ++++-
 include/elf/ChangeLog.xstate            |    8 
 67 files changed, 6785 insertions(+), 182 deletions(-)

--- NEW FILE gdb-bz578250-avx-10of10.patch ---
[ Backported.  ]

git://git.kernel.org/pub/scm/devel/gdb/hjl/avx.git
hjl/avxh
aebae36c2a8b73ae51319fff54fc39f220f0824a

--- ./bfd/ChangeLog.xstate	1970-01-01 01:00:00.000000000 +0100
+++ ./bfd/ChangeLog.xstate	2010-04-03 21:12:32.000000000 +0200
@@ -0,0 +1,14 @@
+2010-01-27  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* elf.c (elfcore_grok_note): Replace NT_386_XSTATE with
+	NT_X86_XSTATE.
+	(elfcore_write_xstatereg): Likewise.
+
+2010-01-27  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* elf-bfd.h (elfcore_write_xstatereg): New.
+
+	* elf.c (elfcore_grok_xstatereg): New.
+	(elfcore_write_xstatereg): Likewise.
+	(elfcore_grok_note): Handle NT_386_XSTATE.
+	(elfcore_write_register_note): Handle .reg-xstate section.
--- ./gdb/ChangeLog.avx	1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/ChangeLog.avx	2010-04-03 21:12:32.000000000 +0200
@@ -0,0 +1,306 @@
+2010-03-04  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* common/i386-xstate.h (I386_XSTATE_SSE_MASK_STRING): Removed.
+	(I386_XSTATE_AVX_MASK_STRING): Likewise.
+	(I386_XSTATE_MAX_MASK_STRING): Likewise.
+	(I386_XSTATE_SSE_SIZE_STRING): Likewise.
+	(I386_XSTATE_AVX_SIZE_STRING): Likewise.
+	(I386_XSTATE_MAX_SIZE_STRING): Likewise.
+
+	* i386-tdep.c (i386_gdbarch_init): Replace
+	I386_XSTATE_MAX_SIZE_STRING/I386_XSTATE_MAX_MASK_STRING with
+	I386_XSTATE_MAX_SIZE/I386_XSTATE_MAX_MASK.
+
+2010-03-04  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* amd64-tdep.c (amd64_supply_xstateregset): Don't check
+	sizeof_xstateregset.
+	(amd64_collect_xstateregset): Likewise.
+	(amd64_regset_from_core_section): Likewise.
+	(amd64_init_abi): Don't set sizeof_xstateregset.
+
+	* i386-tdep.c (i386_supply_xstateregset): Don't check
+	sizeof_xstateregset.
+	(i386_collect_xstateregset): Likewise.
+	(i386_regset_from_core_section): Likewise.
+	(i386_gdbarch_init): Don't set sizeof_xstateregset.
+
+	* i386-tdep.h (gdbarch_tdep): Remove sizeof_xstateregset.
+
+2010-03-04  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* amd64-linux-nat.c (amd64_linux_read_description): Call
+	i386_linux_update_xstateregset.
+	* i386-linux-nat.c (i386_linux_read_description): Likewise.
+
+	* i386-linux-tdep.c (i386_linux_update_xstateregset): New.
+	* i386-linux-tdep.h (i386_linux_update_xstateregset): Likewise.
+
+2010-03-03  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* amd64-linux-nat.c (xstate_size): New.
+	(xstate_size_n_of_int64): Likewise.
+	(amd64_linux_fetch_inferior_registers): Updated.
+	(amd64_linux_store_inferior_registers): Likewise.
+	(amd64_linux_read_description): Use I386_XSTATE_SSE_SIZE
+	instead of I386_XSTATE_MAX_SIZE.  Set xstate_size and
+	xstate_size_n_of_int64.
+
+	* i386-linux-nat.c (xstate_size): New.
+	(xstate_size_n_of_int64): Likewise.
+	(fetch_xstateregs): Updated.
+	(store_xstateregs): Likewise.
+	(i386_linux_read_description): Use I386_XSTATE_SSE_SIZE
+	instead of I386_XSTATE_MAX_SIZE.  Set xstate_size and
+	xstate_size_n_of_int64.
+
+	* common/i386-xstate.h (I386_XSTATE_SIZE): New.
+
+2010-03-02  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* config/djgpp/fnchange.lst: Add x86 AVX XML files.
+
+2010-03-02  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* amd64-linux-nat.c (XSTATE_MAX_SIZE_N_OF_INT64): New.
+	(amd64_linux_fetch_inferior_registers): Updated.
+	(amd64_linux_store_inferior_registers): Likewise.
+	(amd64_linux_read_description): Likewise.
+	* amd64-linux-tdep.c (amd64_linux_core_read_description): Likewise.
+
+	* i386-linux-nat.c  (XSTATE_MAX_SIZE_N_OF_INT64): New.
+	(fetch_xstateregs): Updated.
+	(store_xstateregs): Likewise.
+	(i386_linux_read_description): Likewise.
+
+	* i386-linux-tdep.c (i386_linux_core_read_xcr0): Updated.
+	(i386_linux_core_read_xcr0): Likewise.
+	(i386_linux_core_read_description): Likewise.
+
+	* i386-tdep.c (i386_register_reggroup_p): Updated.
+	(i386_validate_tdesc_p): Likewise.
+	(i386_gdbarch_init): Likewise.
+
+	* i387-tdep.c (i387_supply_fxsave): Updated.
+	(i387_collect_xsave): Likewise.
+
+	* common/i386-xstate.h: Change XSTATE to I386_XSTATE in macros.
+
+2010-03-02  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* Makefile.in (i386-xstate.o): Removed.
+
+	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Use
+	XSTATE_MAX_SIZE_N_OF_INT64 and XSTATE_MAX_SIZE.
+	(amd64_linux_store_inferior_registers): Likewise.
+	(amd64_linux_read_description): Add static xcr0 and get it
+	from I386_LINUX_XSAVE_XCR0_OFFSET.  Use XSTATE_MAX_SIZE_N_OF_INT64
+	and XSTATE_MAX_SIZE.
+	(_initialize_amd64_linux_nat): Don't call i386_xstate_init.
+
+	* configure.ac: Remove check for cpuid.h.
+	* config.in: Regenerated.
+	* configure: Likewise.
+
+	* i386-linux-nat.c (fetch_xstateregs): Use
+	XSTATE_MAX_SIZE_N_OF_INT64 and XSTATE_MAX_SIZE.
+	(store_xstateregs): Likewise.
+	(i386_linux_read_description): Add static xcr0 and get it
+	from I386_LINUX_XSAVE_XCR0_OFFSET.  Use XSTATE_MAX_SIZE_N_OF_INT64
+	and XSTATE_MAX_SIZE.
+	(_initialize_i386_linux_nat): Don't call i386_xstate_init.
+
+	* common/i386-cpuid.h: Removed.
+	* common/i386-xstate.c: Likewise.
+
+	* common/i386-xstate.h (xstate_status): Removed.
+	(i386_xstate_type): Likewise.
+	(i386_xstate): Likewise.
+	(i386_xstate_init): Likewise.
+	(XSTATE_MAX_SIZE_N_OF_INT64): New.
+
+	* config/i386/linux.mh (NATDEPFILES): Remove i386-xstate.o.
+	* config/i386/linux64.mh (NATDEPFILES): Likewise.
+
+2010-02-01  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* amd64-linux-tdep.c (amd64_linux_g_packet_size): Make it const.
+	* amd64-tdep.c (amd64_g_packet_size): Likewise.
+	* i386-linux-tdep.c (i386_linux_g_packet_size): Likewise.
+	* i386-tdep.c (i386_g_packet_size): Likewise.
+
+	* i386-linux-tdep.c (i386_linux_init_abi): Remove
+	i386_linux_g_packet_size.
+
+	* i386-tdep.c (i386_register_g_packet_guesses): Updated.
+	* i386-tdep.h (i386_register_g_packet_guesses): Likewise.
+
+2010-02-01  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* amd64-linux-tdep.c (amd64_linux_g_packet_size): Add key.
+	* i386-linux-tdep.c (i386_linux_g_packet_size): Likewise.
+	* i386-tdep.c (i386_g_packet_size): Likewise.
+
+	* amd64-tdep.c (amd64_g_packet_size): New.
+	(amd64_init_abi): Call i386_register_g_packet_guesses.
+
+	* i386-tdep.c (I386_PROPERTY_SSE): Removed.
+	(I386_PROPERTY_AVX): Likewise.
+	(i386_tdesc_sse): Likewise.
+	(i386_tdesc_avx): Likewise.
+	(i386_init_tdesc): Likewise.
+	(i386_register_g_packet_guesses): Updated.
+	(i386_gdbarch_vector_unit_init): Likewise.
+
+	* i386-tdep.h (I386_PROPERTY_SSE): New.
+	(I386_PROPERTY_AVX): Likewise.
+	(AMD64_PROPERTY_SSE): Likewise.
+	(AMD64_PROPERTY_AVX): Likewise.
+	(i386_g_packet_size): Add key.
+	(i386_register_g_packet_guesses): Updated.
+
+2010-01-31  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* regformats/reg-i386-avx-linux.dat: Add a comment for osabi.
+	* regformats/reg-x86-64-avx-linux.dat: Likewise.
+
+2010-01-31  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* regformats/reg-i386-avx-linux.dat: Add a comment for xmlarch.
+	* regformats/reg-i386-avx.dat: Likewise.
+	* regformats/reg-x86-64-avx-linux.dat: Likewise.
+	* regformats/reg-x86-64-avx.dat: Likewise.
+
[...7872 lines suppressed...]
+
+#if defined(__i386__) && defined(__PIC__)
+/* %ebx may be the PIC register.  */
+#if __GNUC__ >= 3
+#define __cpuid(level, a, b, c, d)			\
+  __asm__ ("xchg{l}\t{%%}ebx, %1\n\t"			\
+	   "cpuid\n\t"					\
+	   "xchg{l}\t{%%}ebx, %1\n\t"			\
+	   : "=a" (a), "=r" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d)		\
+  __asm__ ("xchg{l}\t{%%}ebx, %1\n\t"			\
+	   "cpuid\n\t"					\
+	   "xchg{l}\t{%%}ebx, %1\n\t"			\
+	   : "=a" (a), "=r" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level), "2" (count))
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+   nor alternatives in i386 code.  */
+#define __cpuid(level, a, b, c, d)			\
+  __asm__ ("xchgl\t%%ebx, %1\n\t"			\
+	   "cpuid\n\t"					\
+	   "xchgl\t%%ebx, %1\n\t"			\
+	   : "=a" (a), "=r" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d)		\
+  __asm__ ("xchgl\t%%ebx, %1\n\t"			\
+	   "cpuid\n\t"					\
+	   "xchgl\t%%ebx, %1\n\t"			\
+	   : "=a" (a), "=r" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level), "2" (count))
+#endif
+#else
+#define __cpuid(level, a, b, c, d)			\
+  __asm__ ("cpuid\n\t"					\
+	   : "=a" (a), "=b" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d)		\
+  __asm__ ("cpuid\n\t"					\
+	   : "=a" (a), "=b" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level), "2" (count))
+#endif
+
+/* Return highest supported input value for cpuid instruction.  ext can
+   be either 0x0 or 0x8000000 to return highest supported value for
+   basic or extended cpuid information.  Function returns 0 if cpuid
+   is not supported or whatever cpuid returns in eax register.  If sig
+   pointer is non-null, then first four bytes of the signature
+   (as found in ebx register) are returned in location pointed by sig.  */
+
+static __inline unsigned int
+__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
+{
+  unsigned int __eax, __ebx, __ecx, __edx;
+
+#ifndef __x86_64__
+#if __GNUC__ >= 3
+  /* See if we can use cpuid.  On AMD64 we always can.  */
+  __asm__ ("pushf{l|d}\n\t"
+	   "pushf{l|d}\n\t"
+	   "pop{l}\t%0\n\t"
+	   "mov{l}\t{%0, %1|%1, %0}\n\t"
+	   "xor{l}\t{%2, %0|%0, %2}\n\t"
+	   "push{l}\t%0\n\t"
+	   "popf{l|d}\n\t"
+	   "pushf{l|d}\n\t"
+	   "pop{l}\t%0\n\t"
+	   "popf{l|d}\n\t"
+	   : "=&r" (__eax), "=&r" (__ebx)
+	   : "i" (0x00200000));
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+   nor alternatives in i386 code.  */
+  __asm__ ("pushfl\n\t"
+	   "pushfl\n\t"
+	   "popl\t%0\n\t"
+	   "movl\t%0, %1\n\t"
+	   "xorl\t%2, %0\n\t"
+	   "pushl\t%0\n\t"
+	   "popfl\n\t"
+	   "pushfl\n\t"
+	   "popl\t%0\n\t"
+	   "popfl\n\t"
+	   : "=&r" (__eax), "=&r" (__ebx)
+	   : "i" (0x00200000));
+#endif
 
-   Copyright 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+  if (!((__eax ^ __ebx) & 0x00200000))
+    return 0;
+#endif
 
-   This file is part of GDB.
+  /* Host supports cpuid.  Return highest supported cpuid input value.  */
+  __cpuid (__ext, __eax, __ebx, __ecx, __edx);
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
+  if (__sig)
+    *__sig = __ebx;
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+  return __eax;
+}
 
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+/* Return cpuid data for requested cpuid level, as found in returned
+   eax, ebx, ecx and edx registers.  The function checks if cpuid is
+   supported and returns 1 for valid cpuid information or 0 for
+   unsupported cpuid level.  All pointers are required to be non-null.  */
+
+static __inline int
+__get_cpuid (unsigned int __level,
+	     unsigned int *__eax, unsigned int *__ebx,
+	     unsigned int *__ecx, unsigned int *__edx)
+{
+  unsigned int __ext = __level & 0x80000000;
 
-/* Used by 20020523-2.c and i386-sse-6.c, and possibly others.  */
-/* Plagarized from 20020523-2.c.  */
-/* Plagarized from gcc.  */
+  if (__get_cpuid_max (__ext, 0) < __level)
+    return 0;
 
-#define bit_CMOV (1 << 15)
-#define bit_MMX (1 << 23)
-#define bit_SSE (1 << 25)
-#define bit_SSE2 (1 << 26)
+  __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
+  return 1;
+}
 
 #ifndef NOINLINE
 #define NOINLINE __attribute__ ((noinline))
@@ -35,41 +191,10 @@ unsigned int i386_cpuid (void) NOINLINE;
 unsigned int NOINLINE
 i386_cpuid (void)
 {
-  int fl1, fl2;
-
-#ifndef __x86_64__
-  /* See if we can use cpuid.  On AMD64 we always can.  */
-  __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
-	   "pushl %0; popfl; pushfl; popl %0; popfl"
-	   : "=&r" (fl1), "=&r" (fl2)
-	   : "i" (0x00200000));
-  if (((fl1 ^ fl2) & 0x00200000) == 0)
-    return (0);
-#endif
+  unsigned int eax, ebx, ecx, edx;
 
-  /* Host supports cpuid.  See if cpuid gives capabilities, try
-     CPUID(0).  Preserve %ebx and %ecx; cpuid insn clobbers these, we
-     don't need their CPUID values here, and %ebx may be the PIC
-     register.  */
-#ifdef __x86_64__
-  __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx"
-	   : "=a" (fl1) : "0" (0) : "rdx", "cc");
-#else
-  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
-	   : "=a" (fl1) : "0" (0) : "edx", "cc");
-#endif
-  if (fl1 == 0)
-    return (0);
-
-  /* Invoke CPUID(1), return %edx; caller can examine bits to
-     determine what's supported.  */
-#ifdef __x86_64__
-  __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx"
-	   : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
-#else
-  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
-	   : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
-#endif
+  if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+    return 0;
 
-  return fl2;
+  return edx;
 }
--- ./include/elf/ChangeLog.xstate	1970-01-01 01:00:00.000000000 +0100
+++ ./include/elf/ChangeLog.xstate	2010-04-03 21:12:32.000000000 +0200
@@ -0,0 +1,8 @@
+2010-01-27  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* common.h (NT_386_XSTATE): Renamed to ...
+	(NT_X86_XSTATE): This.
+
+2010-01-27  H.J. Lu  <hongjiu.lu at intel.com>
+
+	* common.h (NT_386_XSTATE): New.

gdb-bz589467-pieces-vla-compat.patch:
 valarith.c |    4 ++++
 value.c    |   19 ++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

--- NEW FILE gdb-bz589467-pieces-vla-compat.patch ---
06e357f534abcf8912e4fd597daae8f1387d631c

Fix compatibility with: FYI: fix BINOP_SUBSCRIPT with pieced arrays
 	http://sourceware.org/ml/gdb-patches/2010-05/msg00281.html

2010-05-30  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* valarith.c (binop_user_defined_p): Return 0 on ARG1 or ARG2 being
	TYPE_DYNAMIC.
	* value.c (coerce_ref): Use object_address_get_data resolution for
	TYPE_DYNAMIC ARG.

[ Backported.  ]

Index: gdb-7.1/gdb/valarith.c
===================================================================
--- gdb-7.1.orig/gdb/valarith.c	2010-05-30 18:54:28.000000000 +0200
+++ gdb-7.1/gdb/valarith.c	2010-05-30 18:54:43.000000000 +0200
@@ -309,6 +309,10 @@ int
 binop_user_defined_p (enum exp_opcode op,
 		      struct value *arg1, struct value *arg2)
 {
+  /* FIXME: We should support user defined ops for dynamic types.  */
+  if (TYPE_DYNAMIC (value_type (arg1)) || TYPE_DYNAMIC (value_type (arg2)))
+    return 0;
+
   return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2));
 }
 
Index: gdb-7.1/gdb/value.c
===================================================================
--- gdb-7.1.orig/gdb/value.c	2010-05-30 18:54:36.000000000 +0200
+++ gdb-7.1/gdb/value.c	2010-05-30 18:55:52.000000000 +0200
@@ -2400,7 +2400,24 @@ value_from_decfloat (struct type *type, 
 struct value *
 coerce_ref (struct value *arg)
 {
-  struct type *value_type_arg_tmp = check_typedef (value_type (arg));
+  struct type *value_type_arg_tmp;
+
+  if (TYPE_DYNAMIC (value_type (arg)))
+    {
+      struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
+      CORE_ADDR address;
+
+      value_type_arg_tmp = value_type (arg);
+      address = value_raw_address (arg);
+      if (! object_address_get_data (value_type_arg_tmp, &address))
+	error (_("Attempt to coerce non-valid value."));
+      CHECK_TYPEDEF (value_type_arg_tmp);
+      arg = value_at_lazy (value_type_arg_tmp, address);
+      do_cleanups (cleanups);
+    }
+  else
+    value_type_arg_tmp = check_typedef (value_type (arg));
+
   if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
     arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
 			 unpack_pointer (value_type (arg),		

gdb-bz589467-pieces01of4.patch:
 dwarf2loc.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

--- NEW FILE gdb-bz589467-pieces01of4.patch ---
commit 96c23bfd2863bcca7388653a7bc4c9f8a64a03be
Author: Ulrich Weigand <uweigand at de.ibm.com>
Date:   Fri Feb 26 12:48:17 2010 +0000

    	* dwarf2loc.c (struct piece_closure): Remove ARCH member,
    	add ADDR_SIZE member.
    	(allocate_piece_closure): Update.
    	(copy_pieced_value_closure): Likewise.
    	(dwarf2_evaluate_loc_desc): Likewise.
    	(read_pieced_value): Use DWARF address size instead of
    	GDB's gdbarch_addr_bit as size of values on the DWARF stack.

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 1c4d057..20ede3e 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -232,8 +232,8 @@ struct piece_closure
   /* The number of pieces used to describe this variable.  */
   int n_pieces;
 
-  /* The architecture, used only for DWARF_VALUE_STACK.  */
-  struct gdbarch *arch;
+  /* The target address size, used only for DWARF_VALUE_STACK.  */
+  int addr_size;
 
   /* The pieces themselves.  */
   struct dwarf_expr_piece *pieces;
@@ -244,12 +244,12 @@ struct piece_closure
 
 static struct piece_closure *
 allocate_piece_closure (int n_pieces, struct dwarf_expr_piece *pieces,
-			struct gdbarch *arch)
+			int addr_size)
 {
   struct piece_closure *c = XZALLOC (struct piece_closure);
 
   c->n_pieces = n_pieces;
-  c->arch = arch;
+  c->addr_size = addr_size;
   c->pieces = XCALLOC (n_pieces, struct dwarf_expr_piece);
 
   memcpy (c->pieces, pieces, n_pieces * sizeof (struct dwarf_expr_piece));
@@ -298,13 +298,12 @@ read_pieced_value (struct value *v)
 
 	case DWARF_VALUE_STACK:
 	  {
-	    size_t n;
-	    int addr_size = gdbarch_addr_bit (c->arch) / 8;
-	    n = p->size;
-	    if (n > addr_size)
-	      n = addr_size;
+	    struct gdbarch *gdbarch = get_type_arch (value_type (v));
+	    size_t n = p->size;
+	    if (n > c->addr_size)
+	      n = c->addr_size;
 	    store_unsigned_integer (contents + offset, n,
-				    gdbarch_byte_order (c->arch),
+				    gdbarch_byte_order (gdbarch),
 				    p->v.expr.value);
 	  }
 	  break;
@@ -377,7 +376,7 @@ copy_pieced_value_closure (struct value *v)
 {
   struct piece_closure *c = (struct piece_closure *) value_computed_closure (v);
   
-  return allocate_piece_closure (c->n_pieces, c->pieces, c->arch);
+  return allocate_piece_closure (c->n_pieces, c->pieces, c->addr_size);
 }
 
 static void
@@ -439,7 +438,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
       struct piece_closure *c;
       struct frame_id frame_id = get_frame_id (frame);
 
-      c = allocate_piece_closure (ctx->num_pieces, ctx->pieces, ctx->gdbarch);
+      c = allocate_piece_closure (ctx->num_pieces, ctx->pieces,
+				  ctx->addr_size);
       retval = allocate_computed_value (type, &pieced_value_funcs, c);
       VALUE_FRAME_ID (retval) = frame_id;
     }

gdb-bz589467-pieces02of4.patch:
 dwarf2loc.c |   35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

--- NEW FILE gdb-bz589467-pieces02of4.patch ---
commit 60d15ff6d78921d080aee681e60372abe6627570
Author: mgretton <mgretton>
Date:   Tue May 4 09:54:17 2010 +0000

    	* gdb/dwarf2loc.c (read_pieced_value, write_pieced_value,
    	dwarf2_evaluate_loc_desc): Handle not being able to access DWARF
    	registers gracefully.

Index: gdb-7.1/gdb/dwarf2loc.c
===================================================================
--- gdb-7.1.orig/gdb/dwarf2loc.c	2010-05-25 21:35:10.000000000 +0200
+++ gdb-7.1/gdb/dwarf2loc.c	2010-05-25 21:37:32.000000000 +0200
@@ -458,8 +458,16 @@ read_pieced_value (struct value *v)
 	      /* Big-endian, and we want less than full size.  */
 	      reg_offset = register_size (arch, gdb_regnum) - p->size;
 
-	    get_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
-				      contents + offset);
+	    if (gdb_regnum != -1)
+	      {
+		get_frame_register_bytes (frame, gdb_regnum, reg_offset, 
+					  p->size, contents + offset);
+	      }
+	    else
+	      {
+		error (_("Unable to access DWARF register number %s"),
+		       paddress (arch, p->v.expr.value));
+	      }
 	  }
 	  break;
 
@@ -531,8 +539,16 @@ write_pieced_value (struct value *to, st
 	      /* Big-endian, and we want less than full size.  */
 	      reg_offset = register_size (arch, gdb_regnum) - p->size;
 
-	    put_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
-				      contents + offset);
+	    if (gdb_regnum != -1)
+	      {
+		put_frame_register_bytes (frame, gdb_regnum, reg_offset, 
+					  p->size, contents + offset);
+	      }
+	    else
+	      {
+		error (_("Unable to write to DWARF register number %s"),
+		       paddress (arch, p->v.expr.value));
+	      }
 	  }
 	  break;
 	case DWARF_VALUE_MEMORY:
@@ -611,7 +627,16 @@ dwarf2_evaluate_loc_desc (struct type *t
 	    struct gdbarch *arch = get_frame_arch (frame);
 	    CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
 	    int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
-	    retval = value_from_register (type, gdb_regnum, frame);
+	    if (gdb_regnum != -1)
+	      {
+		retval = value_from_register (type,
+					      gdb_regnum, frame);
+	      }
+	    else
+	      {
+		error (_("Unable to access DWARF register number %s"),
+		       paddress (arch, dwarf_regnum));
+	      }
 	  }
 	  break;
 

gdb-bz589467-pieces03of4.patch:
 dwarf2loc.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- NEW FILE gdb-bz589467-pieces03of4.patch ---
commit dacd66a53b559be9c26d2c523f168f1ef0261f4d
Author: Michael Snyder <msnyder at specifix.com>
Date:   Fri May 14 17:53:11 2010 +0000

    2010-05-14  Michael Snyder  <msnyder at vmware.com>
    
    	* dbxread.c: White space.
    	* dcache.c: White space.
    	* disasm.c: White space.
    	* doublest.c: White space.
    	* dsrec.c: White space.
    	* dummy-frame.c: White space.
    	* dwarf2expr.c: White space.
    	* dwarf2-frame.c: White space.
    	* dwarf2loc.c: White space.
    	* dwarf2read.c: White space.

--- gdb-7.1/gdb/dwarf2loc.c.orig	2010-05-25 23:06:46.000000000 +0200
+++ gdb-7.1/gdb/dwarf2loc.c	2010-05-25 23:06:46.000000000 +0200
@@ -236,6 +236,7 @@ static CORE_ADDR
 dwarf_expr_frame_cfa (void *baton)
 {
   struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+
   return dwarf2_frame_cfa (debaton->frame);
 }
 
@@ -444,6 +445,7 @@ read_pieced_value (struct value *v)
   for (i = 0; i < c->n_pieces; i++)
     {
       struct dwarf_expr_piece *p = &c->pieces[i];
+
       switch (p->location)
 	{
 	case DWARF_VALUE_REGISTER:
@@ -482,6 +484,7 @@ read_pieced_value (struct value *v)
 	  {
 	    struct gdbarch *gdbarch = get_type_arch (value_type (v));
 	    size_t n = p->size;
+
 	    if (n > c->addr_size)
 	      n = c->addr_size;
 	    store_unsigned_integer (contents + offset, n,
@@ -493,6 +496,7 @@ read_pieced_value (struct value *v)
 	case DWARF_VALUE_LITERAL:
 	  {
 	    size_t n = p->size;
+
 	    if (n > p->v.literal.length)
 	      n = p->v.literal.length;
 	    memcpy (contents + offset, p->v.literal.data, n);
@@ -525,6 +529,7 @@ write_pieced_value (struct value *to, st
   for (i = 0; i < c->n_pieces; i++)
     {
       struct dwarf_expr_piece *p = &c->pieces[i];
+
       switch (p->location)
 	{
 	case DWARF_VALUE_REGISTER:
@@ -712,6 +717,7 @@ static CORE_ADDR
 needs_frame_read_reg (void *baton, int regnum)
 {
   struct needs_frame_baton *nf_baton = baton;
+
   nf_baton->needs_frame = 1;
   return 1;
 }
@@ -742,6 +748,7 @@ static CORE_ADDR
 needs_frame_frame_cfa (void *baton)
 {
   struct needs_frame_baton *nf_baton = baton;
+
   nf_baton->needs_frame = 1;
   return 1;
 }
@@ -751,6 +758,7 @@ static CORE_ADDR
 needs_frame_tls_address (void *baton, CORE_ADDR offset)
 {
   struct needs_frame_baton *nf_baton = baton;
+
   nf_baton->needs_frame = 1;
   return 1;
 }
@@ -907,6 +915,7 @@ locexpr_read_variable (struct symbol *sy
 {
   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
   struct value *val;
+
   val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
 				  dlbaton->size, dlbaton->per_cu);
 
@@ -918,6 +927,7 @@ static int
 locexpr_read_needs_frame (struct symbol *symbol)
 {
   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+
   return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size,
 				      dlbaton->per_cu);
 }

gdb-bz589467-pieces1of4.patch:
 dwarf2loc.c                     |  136 ++-
 testsuite/gdb.dwarf2/pieces.S   | 1655 ++++++++++++++++++++++++++++++++++++++++
 testsuite/gdb.dwarf2/pieces.c   |   98 ++
 testsuite/gdb.dwarf2/pieces.exp |   57 +
 4 files changed, 1919 insertions(+), 27 deletions(-)

--- NEW FILE gdb-bz589467-pieces1of4.patch ---
http://sourceware.org/ml/gdb-cvs/2010-05/msg00186.html

### src/gdb/ChangeLog	2010/05/21 20:34:45	1.11828
### src/gdb/ChangeLog	2010/05/21 20:39:50	1.11829
## -1,3 +1,9 @@
+2010-05-21  Tom Tromey  <tromey at redhat.com>
+
+	* dwarf2loc.c (read_pieced_value): Work properly when 'v' has an
+	offset.
+	(write_pieced_value): Likewise.
+
### src/gdb/testsuite/ChangeLog	2010/05/20 19:18:57	1.2272
### src/gdb/testsuite/ChangeLog	2010/05/21 20:39:50	1.2273
## -1,3 +1,9 @@
+2010-05-21  Tom Tromey  <tromey at redhat.com>
+
+	* gdb.dwarf2.pieces.exp: New file.
+	* gdb.dwarf2.pieces.S: New file.
+	* gdb.dwarf2.pieces.c: New file.
+
--- src/gdb/dwarf2loc.c	2010/05/14 17:53:16	1.78
+++ src/gdb/dwarf2loc.c	2010/05/21 20:39:50	1.79
@@ -264,14 +264,46 @@
 {
   int i;
   long offset = 0;
+  ULONGEST bytes_to_skip;
   gdb_byte *contents;
   struct piece_closure *c = (struct piece_closure *) value_computed_closure (v);
   struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (v));
+  size_t type_len;
+
+  if (value_type (v) != value_enclosing_type (v))
+    internal_error (__FILE__, __LINE__,
+		    _("Should not be able to create a lazy value with "
+		      "an enclosing type"));
 
   contents = value_contents_raw (v);
-  for (i = 0; i < c->n_pieces; i++)
+  bytes_to_skip = value_offset (v);
+  type_len = TYPE_LENGTH (value_type (v));
+  for (i = 0; i < c->n_pieces && offset < type_len; i++)
     {
       struct dwarf_expr_piece *p = &c->pieces[i];
+      size_t this_size;
+      long dest_offset, source_offset;
+
+      if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
+	{
+	  bytes_to_skip -= p->size;
+	  continue;
+	}
+      this_size = p->size;
+      if (this_size > type_len - offset)
+	this_size = type_len - offset;
+      if (bytes_to_skip > 0)
+	{
+	  dest_offset = 0;
+	  source_offset = bytes_to_skip;
+	  this_size -= bytes_to_skip;
+	  bytes_to_skip = 0;
+	}
+      else
+	{
+	  dest_offset = offset;
+	  source_offset = 0;
+	}
 
       switch (p->location)
 	{
@@ -280,17 +312,17 @@
 	    struct gdbarch *arch = get_frame_arch (frame);
 	    int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch,
 							   p->v.expr.value);
-	    int reg_offset = 0;
+	    int reg_offset = source_offset;
 
 	    if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
-		&& p->size < register_size (arch, gdb_regnum))
+		&& this_size < register_size (arch, gdb_regnum))
 	      /* Big-endian, and we want less than full size.  */
-	      reg_offset = register_size (arch, gdb_regnum) - p->size;
+	      reg_offset = register_size (arch, gdb_regnum) - this_size;
 
 	    if (gdb_regnum != -1)
 	      {
 		get_frame_register_bytes (frame, gdb_regnum, reg_offset, 
-					  p->size, contents + offset);
+					  this_size, contents + dest_offset);
 	      }
 	    else
 	      {
@@ -302,38 +334,60 @@
 
 	case DWARF_VALUE_MEMORY:
 	  if (p->v.expr.in_stack_memory)
-	    read_stack (p->v.expr.value, contents + offset, p->size);
+	    read_stack (p->v.expr.value + source_offset,
+			contents + dest_offset, this_size);
 	  else
-	    read_memory (p->v.expr.value, contents + offset, p->size);
+	    read_memory (p->v.expr.value + source_offset,
+			 contents + dest_offset, this_size);
 	  break;
 
 	case DWARF_VALUE_STACK:
 	  {
 	    struct gdbarch *gdbarch = get_type_arch (value_type (v));
-	    size_t n = p->size;
+	    size_t n = this_size;
+
+	    if (n > c->addr_size - source_offset)
+	      n = (c->addr_size >= source_offset
+		   ? c->addr_size - source_offset
+		   : 0);
+	    if (n == 0)
+	      {
+		/* Nothing.  */
+	      }
+	    else if (source_offset == 0)
+	      store_unsigned_integer (contents + dest_offset, n,
+				      gdbarch_byte_order (gdbarch),
+				      p->v.expr.value);
+	    else
+	      {
+		gdb_byte bytes[sizeof (ULONGEST)];
 
-	    if (n > c->addr_size)
-	      n = c->addr_size;
-	    store_unsigned_integer (contents + offset, n,
-				    gdbarch_byte_order (gdbarch),
-				    p->v.expr.value);
+		store_unsigned_integer (bytes, n + source_offset,
+					gdbarch_byte_order (gdbarch),
+					p->v.expr.value);
+		memcpy (contents + dest_offset, bytes + source_offset, n);
+	      }
 	  }
 	  break;
 
 	case DWARF_VALUE_LITERAL:
 	  {
-	    size_t n = p->size;
+	    size_t n = this_size;
 
-	    if (n > p->v.literal.length)
-	      n = p->v.literal.length;
-	    memcpy (contents + offset, p->v.literal.data, n);
+	    if (n > p->v.literal.length - source_offset)
+	      n = (p->v.literal.length >= source_offset
+		   ? p->v.literal.length - source_offset
+		   : 0);
+	    if (n != 0)
+	      memcpy (contents + dest_offset,
+		      p->v.literal.data + source_offset, n);
 	  }
 	  break;
 
 	default:
 	  internal_error (__FILE__, __LINE__, _("invalid location type"));
 	}
-      offset += p->size;
+      offset += this_size;
     }
 }
 
@@ -342,9 +396,11 @@
 {
   int i;
   long offset = 0;
-  gdb_byte *contents;
+  ULONGEST bytes_to_skip;
+  const gdb_byte *contents;
   struct piece_closure *c = (struct piece_closure *) value_computed_closure (to);
   struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (to));
+  size_t type_len;
 
   if (frame == NULL)
     {
@@ -352,10 +408,35 @@
       return;
     }
 
-  contents = value_contents_raw (from);
-  for (i = 0; i < c->n_pieces; i++)
+  contents = value_contents (from);
+  bytes_to_skip = value_offset (to);
+  type_len = TYPE_LENGTH (value_type (to));
+  for (i = 0; i < c->n_pieces && offset < type_len; i++)
     {
       struct dwarf_expr_piece *p = &c->pieces[i];
+      size_t this_size;
+      long dest_offset, source_offset;
+
+      if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
+	{
+	  bytes_to_skip -= p->size;
+	  continue;
+	}
[...1676 lines suppressed...]
+	.ascii "f4\0"	# external name
+	.long	0x189	# DIE offset
+	.ascii "f5\0"	# external name
+	.long	0x1bf	# DIE offset
+	.ascii "main\0"	# external name
+	.long	0
+	.section	.debug_pubtypes,"", at progbits
+	.long	0x1a	# Length of Public Type Names Info
+	.value	0x2	# DWARF Version
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
+	.long	0x1e7	# Compilation Unit Length
+	.long	0x25	# DIE offset
+	.ascii "A\0"	# external name
+	.long	0x4f	# DIE offset
+	.ascii "B\0"	# external name
+	.long	0
+	.section	.debug_aranges,"", at progbits
+	.long	0x1c	# Length of Address Ranges Info
+	.value	0x2	# DWARF Version
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
+	.byte	0x4	# Size of Address
+	.byte	0	# Size of Segment Descriptor
+	.value	0	# Pad to 8 byte boundary
+	.value	0
+	.long	.Ltext0	# Address
+	.long	.Letext0-.Ltext0	# Length
+	.long	0
+	.long	0
+	.section	.debug_str,"MS", at progbits,1
+.LASF2:
+	.string	"pieces.c"
+.LASF3:
+	.string	"/home/tromey/gnu/archer/archer/gdb/testsuite/gdb.dwarf2"
+.LASF1:
+	.string	"GNU C 4.6.0 20100506 (experimental) [trunk revision 159117]"
+.LASF0:
+	.string	"main"
+	.ident	"GCC: (GNU) 4.6.0 20100506 (experimental) [trunk revision 159117]"
+	.section	.note.GNU-stack,"", at progbits
--- src/gdb/testsuite/gdb.dwarf2/pieces.c
+++ src/gdb/testsuite/gdb.dwarf2/pieces.c	2010-05-25 20:18:00.627622000 +0000
@@ -0,0 +1,98 @@
+/* Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* The original program corresponding to pieces.S.
+   This came from https://bugzilla.redhat.com/show_bug.cgi?id=589467
+   Note that it is not ever compiled, pieces.S is used instead.
+   However, it is used to extract breakpoint line numbers.  */
+
+struct A { int i; int j; };
+struct B { int : 4; int i : 12; int j : 12; int : 4; };
+
+__attribute__((noinline)) void
+bar (int x)
+{
+  asm volatile ("" : : "r" (x) : "memory");
+}
+
+__attribute__((noinline)) int
+f1 (int k)
+{
+  struct A a = { 4, k + 6 };
+  asm ("" : "+r" (a.i));
+  a.j++;
+  bar (a.i);		/* { dg-final { gdb-test 20 "a.i" "4" } } */
+  bar (a.j);		/* { dg-final { gdb-test 20 "a.j" "14" } } */
+  return a.i + a.j;	/* f1 breakpoint */
+}
+
+__attribute__((noinline)) int
+f2 (int k)
+{
+  int a[2] = { 4, k + 6 };
+  asm ("" : "+r" (a[0]));
+  a[1]++;
+  bar (a[0]);		/* { dg-final { gdb-test 31 "a\[0\]" "4" } } */
+  bar (a[1]);		/* { dg-final { gdb-test 31 "a\[1\]" "14" } } */
+  return a[0] + a[1];	/* f2 breakpoint */
+}
+
+__attribute__((noinline)) int
+f3 (int k)
+{
+  struct B a = { 4, k + 6 };
+  asm ("" : "+r" (a.i));
+  a.j++;
+  bar (a.i);		/* { dg-final { gdb-test 42 "a.i" "4" } } */
+  bar (a.j);		/* { dg-final { gdb-test 42 "a.j" "14" } } */
+  return a.i + a.j;	/* f3 breakpoint */
+}
+
+__attribute__((noinline)) int
+f4 (int k)
+{
+  int a[2] = { k, k };
+  asm ("" : "+r" (a[0]));
+  a[1]++;
+  bar (a[0]);
+  bar (a[1]);
+  return a[0] + a[1];		/* f4 breakpoint */
+}
+
+__attribute__((noinline)) int
+f5 (int k)
+{
+  struct A a = { k, k };
+  asm ("" : "+r" (a.i));
+  a.j++;
+  bar (a.i);
+  bar (a.j);
+  return a.i + a.j;		/* f5 breakpoint */
+}
+
+int
+main (void)
+{
+  int k;
+  asm ("" : "=r" (k) : "0" (7));
+  f1 (k);
+  f2 (k);
+  f3 (k);
+  f4 (k);
+  f5 (k);
+  return 0;
+}
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp	2010-05-25 20:18:03.961111000 +0000
@@ -0,0 +1,57 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test some DWARF piece operators.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+    && ![istarget *-*-gnu*]
+    && ![istarget *-*-elf*]
+    && ![istarget *-*-openbsd*]
+    && ![istarget arm-*-eabi*]
+    && ![istarget powerpc-*-eabi*]} {
+    return 0  
+}
+# This test can only be run on x86 targets.
+if {![istarget i?86-*]} {
+    return 0  
+}
+
+set testfile "pieces"
+set srcfile ${testfile}.S
+set csrcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}.x
+
+if {[prepare_for_testing ${testfile}.exp ${testfile}.x $srcfile]} {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+# Function f1 tests a particular gdb bug involving DW_OP_piece.
+proc pieces_test_f1 {} {
+    global csrcfile
+    set line [gdb_get_line_number "f1 breakpoint" $csrcfile]
+    gdb_test "break pieces.c:$line" "Breakpoint 2.*" \
+	"set f1 breakpoint for pieces"
+    gdb_continue_to_breakpoint "continue to f1 breakpoint for pieces"
+    gdb_test "print a" " = {i = 4, j = 14}" "print a in pieces:f1"
+    gdb_test "print a.j" " = 14" "print a.j in pieces:f1"
+}
+
+pieces_test_f1

gdb-bz589467-pieces2of4.patch:
 eval.c                          |    4 ++--
 testsuite/gdb.dwarf2/pieces.exp |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

--- NEW FILE gdb-bz589467-pieces2of4.patch ---
http://sourceware.org/ml/gdb-cvs/2010-05/msg00188.html
http://sourceware.org/ml/gdb-cvs/2010-05/msg00189.html

### src/gdb/ChangeLog	2010/05/21 20:45:18	1.11830
### src/gdb/ChangeLog	2010/05/21 20:56:48	1.11831
## -1,3 +1,8 @@
+2010-05-21  Tom Tromey  <tromey at redhat.com>
+
+	* eval.c (evaluate_subexp_standard) <BINOP_SUBSCRIPT>: Call
+	evaluate_subexp, not evaluate_subexp_with_coercion.
+
### src/gdb/testsuite/ChangeLog	2010/05/21 20:39:50	1.2273
### src/gdb/testsuite/ChangeLog	2010/05/21 20:56:49	1.2274
## -1,5 +1,10 @@
 2010-05-21  Tom Tromey  <tromey at redhat.com>
 
+	* gdb.dwarf2/pieces.exp (pieces_test_f2): New proc.
+	Call it.
+
--- src/gdb/eval.c	2010/05/14 18:35:11	1.134
+++ src/gdb/eval.c	2010/05/21 20:56:49	1.135
@@ -2059,8 +2059,8 @@
       error (_("':' operator used in invalid context"));
 
     case BINOP_SUBSCRIPT:
-      arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
-      arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
+      arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+      arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
       if (noside == EVAL_SKIP)
 	goto nosideret;
       if (binop_user_defined_p (op, arg1, arg2))
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp	2010/05/21 20:39:50	1.1
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp	2010/05/21 21:00:27	1.2
@@ -54,4 +54,18 @@
     gdb_test "print a.j" " = 14" "print a.j in pieces:f1"
 }
 
+# Function f2 tests for a bug when indexing into an array created
+# using DW_OP_piece.
+proc pieces_test_f2 {} {
+    global csrcfile
+    set line [gdb_get_line_number "f2 breakpoint" $csrcfile]
+    gdb_test "break pieces.c:$line" "Breakpoint 3.*" \
+       "set f2 breakpoint for pieces"
+    gdb_continue_to_breakpoint "continue to f2 breakpoint for pieces"
+    gdb_test "print a" " = .4, 14." "print a in pieces:f2"
+    gdb_test "print a\[0\]" " = 4" "print a\[0\] in pieces:f2"
+    gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2"
+}
+
 pieces_test_f1
+pieces_test_f2

gdb-bz589467-pieces3of4.patch:
 dwarf2expr.c                    |   20 +
 dwarf2expr.h                    |    5 
 dwarf2loc.c                     |   13 
 testsuite/gdb.dwarf2/pieces.S   |  636 +++++++++++++++++++++++++++-------------
 testsuite/gdb.dwarf2/pieces.c   |   14 
 testsuite/gdb.dwarf2/pieces.exp |   23 +
 6 files changed, 512 insertions(+), 199 deletions(-)

--- NEW FILE gdb-bz589467-pieces3of4.patch ---
http://sourceware.org/ml/gdb-cvs/2010-05/msg00190.html

### src/gdb/ChangeLog	2010/05/21 20:56:48	1.11831
### src/gdb/ChangeLog	2010/05/21 21:01:46	1.11832
## -1,5 +1,16 @@
 2010-05-21  Tom Tromey  <tromey at redhat.com>
 
+	* dwarf2loc.c (read_pieced_value): Exit loop when result is full.
+	<DWARF_VALUE_OPTIMIZED_OUT>: New case.
+	* dwarf2expr.h (enum dwarf_value_location)
+	<DWARF_VALUE_OPTIMIZED_OUT>: New constant.
+	* dwarf2expr.c (dwarf_expr_stack_empty_p): New function.
+	(add_piece): Handle empty piece.
+	(execute_stack_op) <DW_OP_piece>: Handle
+	DWARF_VALUE_OPTIMIZED_OUT.
+
### src/gdb/testsuite/ChangeLog	2010/05/21 20:56:49	1.2274
### src/gdb/testsuite/ChangeLog	2010/05/21 21:01:46	1.2275
## -1,5 +1,13 @@
 2010-05-21  Tom Tromey  <tromey at redhat.com>
 
+	* gdb.dwarf2/pieces.exp (pieces_test_f6): New proc.
+	Call it.
+	* gdb.dwarf2/pieces.c (struct C): New.
+	(f6): New function.
+	* gdb.dwarf2/pieces.S: Replace.
+
--- src/gdb/dwarf2expr.c	2010/05/14 17:53:16	1.42
+++ src/gdb/dwarf2expr.c	2010/05/21 21:01:46	1.43
@@ -143,6 +143,14 @@
 
 }
 
+/* Return true if the expression stack is empty.  */
+
+static int
+dwarf_expr_stack_empty_p (struct dwarf_expr_context *ctx)
+{
+  return ctx->stack_len == 0;
+}
+
 /* Add a new piece to CTX's piece list.  */
 static void
 add_piece (struct dwarf_expr_context *ctx, ULONGEST size)
@@ -167,6 +175,15 @@
       p->v.literal.data = ctx->data;
       p->v.literal.length = ctx->len;
     }
+  else if (dwarf_expr_stack_empty_p (ctx))
+    {
+      p->location = DWARF_VALUE_OPTIMIZED_OUT;
+      /* Also reset the context's location, for our callers.  This is
+	 a somewhat strange approach, but this lets us avoid setting
+	 the location to DWARF_VALUE_MEMORY in all the individual
+	 cases in the evaluator.  */
+      ctx->location = DWARF_VALUE_OPTIMIZED_OUT;
+    }
   else
     {
       p->v.expr.value = dwarf_expr_fetch (ctx, 0);
@@ -859,7 +876,8 @@
 
             /* Pop off the address/regnum, and reset the location
 	       type.  */
-	    if (ctx->location != DWARF_VALUE_LITERAL)
+	    if (ctx->location != DWARF_VALUE_LITERAL
+		&& ctx->location != DWARF_VALUE_OPTIMIZED_OUT)
 	      dwarf_expr_pop (ctx);
             ctx->location = DWARF_VALUE_MEMORY;
           }
--- src/gdb/dwarf2expr.h	2010/01/01 07:31:30	1.20
+++ src/gdb/dwarf2expr.h	2010/05/21 21:01:46	1.21
@@ -38,7 +38,10 @@
   DWARF_VALUE_STACK,
 
   /* The piece is a literal.  */
-  DWARF_VALUE_LITERAL
+  DWARF_VALUE_LITERAL,
+
+  /* The piece was optimized out.  */
+  DWARF_VALUE_OPTIMIZED_OUT
 };
 
 /* The dwarf expression stack.  */
--- src/gdb/dwarf2loc.c	2010/05/21 20:39:50	1.79
+++ src/gdb/dwarf2loc.c	2010/05/21 21:01:46	1.80
@@ -384,6 +384,16 @@
 	  }
 	  break;
 
+	case DWARF_VALUE_OPTIMIZED_OUT:
+	  /* We just leave the bits empty for now.  This is not ideal
+	     but gdb currently does not have a nice way to represent
+	     optimized-out pieces.  */
+	  warning (_("bytes %ld-%ld in computed object were optimized out; "
+		     "replacing with zeroes"),
+		   offset,
+		   offset + (long) this_size);
+	  break;
+
 	default:
 	  internal_error (__FILE__, __LINE__, _("invalid location type"));
 	}
@@ -609,6 +619,9 @@
 	  }
 	  break;
 
+	  /* DWARF_VALUE_OPTIMIZED_OUT can't occur in this context --
+	     it can only be encountered when making a piece.  */
+	case DWARF_VALUE_OPTIMIZED_OUT:
 	default:
 	  internal_error (__FILE__, __LINE__, _("invalid location type"));
 	}
--- src/gdb/testsuite/gdb.dwarf2/pieces.S	2010/05/21 20:39:50	1.1
+++ src/gdb/testsuite/gdb.dwarf2/pieces.S	2010/05/21 21:01:46	1.2
@@ -37,19 +37,19 @@
 bar:
 .LFB0:
 	.file 1 "pieces.c"
-	# pieces.c:28
-	.loc 1 28 0
+	# pieces.c:29
+	.loc 1 29 0
 .LVL0:
 	# basic block 2
 	pushl	%ebp
 .LCFI0:
 	movl	%esp, %ebp
 .LCFI1:
-	# pieces.c:29
-	.loc 1 29 0
-	movl	8(%ebp), %eax
 	# pieces.c:30
 	.loc 1 30 0
+	movl	8(%ebp), %eax
+	# pieces.c:31
+	.loc 1 31 0
 	popl	%ebp
 .LCFI2:
 	ret
@@ -60,8 +60,8 @@
 	.type	f1, @function
 f1:
 .LFB1:
-	# pieces.c:34
-	.loc 1 34 0
+	# pieces.c:35
+	.loc 1 35 0
 .LVL1:
 	# basic block 2
 	pushl	%ebp
@@ -73,36 +73,36 @@
 .LCFI5:
 	movl	%esi, -4(%ebp)
 .LCFI6:
-	# pieces.c:37
-	.loc 1 37 0
+	# pieces.c:38
+	.loc 1 38 0
 	movl	8(%ebp), %esi
-	# pieces.c:34
-	.loc 1 34 0
+	# pieces.c:35
+	.loc 1 35 0
 	movl	%ebx, -8(%ebp)
 .LCFI7:
-	# pieces.c:36
-	.loc 1 36 0
+	# pieces.c:37
+	.loc 1 37 0
 	movl	$4, %ebx
 .LVL3:
+	# pieces.c:39
+	.loc 1 39 0
+	movl	%ebx, (%esp)
 	# pieces.c:38
 	.loc 1 38 0
-	movl	%ebx, (%esp)
-	# pieces.c:37
-	.loc 1 37 0
 	addl	$7, %esi
 .LVL4:
-	# pieces.c:38
-	.loc 1 38 0
-	call	bar
 	# pieces.c:39
 	.loc 1 39 0
-	movl	%esi, (%esp)
 	call	bar
 	# pieces.c:40
 	.loc 1 40 0
-	leal	(%ebx,%esi), %eax
+	movl	%esi, (%esp)
+	call	bar
 	# pieces.c:41
 	.loc 1 41 0
+	leal	(%ebx,%esi), %eax
+	# pieces.c:42
+	.loc 1 42 0
 	movl	-8(%ebp), %ebx
 .LVL5:
 	movl	-4(%ebp), %esi
@@ -119,8 +119,8 @@
 	.type	f2, @function
 f2:
 .LFB2:
-	# pieces.c:45
-	.loc 1 45 0
+	# pieces.c:46
+	.loc 1 46 0
 .LVL7:
 	# basic block 2
 	pushl	%ebp
@@ -132,36 +132,36 @@
 .LCFI12:
 	movl	%esi, -4(%ebp)
 .LCFI13:
-	# pieces.c:48
-	.loc 1 48 0
+	# pieces.c:49
+	.loc 1 49 0
 	movl	8(%ebp), %esi
-	# pieces.c:45
-	.loc 1 45 0
+	# pieces.c:46
+	.loc 1 46 0
 	movl	%ebx, -8(%ebp)
 .LCFI14:
-	# pieces.c:47
-	.loc 1 47 0
+	# pieces.c:48
+	.loc 1 48 0
 	movl	$4, %ebx
 .LVL9:
+	# pieces.c:50
+	.loc 1 50 0
+	movl	%ebx, (%esp)
 	# pieces.c:49
 	.loc 1 49 0
-	movl	%ebx, (%esp)
-	# pieces.c:48
-	.loc 1 48 0
 	addl	$7, %esi
 .LVL10:
-	# pieces.c:49
-	.loc 1 49 0
-	call	bar
 	# pieces.c:50
 	.loc 1 50 0
-	movl	%esi, (%esp)
 	call	bar
 	# pieces.c:51
 	.loc 1 51 0
-	leal	(%ebx,%esi), %eax
+	movl	%esi, (%esp)
+	call	bar
 	# pieces.c:52
 	.loc 1 52 0
+	leal	(%ebx,%esi), %eax
+	# pieces.c:53
+	.loc 1 53 0
 	movl	-8(%ebp), %ebx
 .LVL11:
 	movl	-4(%ebp), %esi
@@ -178,59 +178,59 @@
 	.type	f3, @function
 f3:
 .LFB3:
-	# pieces.c:56
-	.loc 1 56 0
+	# pieces.c:57
+	.loc 1 57 0
 .LVL13:
 	# basic block 2
 	pushl	%ebp
 .LCFI17:
-	# pieces.c:58
-	.loc 1 58 0
+	# pieces.c:59
+	.loc 1 59 0
 	movl	$4, %edx
-	# pieces.c:56
-	.loc 1 56 0
+	# pieces.c:57
+	.loc 1 57 0
 	movl	%esp, %ebp
 .LCFI18:
 .LVL14:
 	subl	$12, %esp
 .LCFI19:
-	# pieces.c:58
-	.loc 1 58 0
+	# pieces.c:59
+	.loc 1 59 0
 .LVL15:
-	# pieces.c:56
-	.loc 1 56 0
+	# pieces.c:57
+	.loc 1 57 0
 	movl	%esi, -4(%ebp)
 .LCFI20:
-	# pieces.c:60
-	.loc 1 60 0
+	# pieces.c:61
+	.loc 1 61 0
 	movswl	%dx, %esi
-	# pieces.c:56
-	.loc 1 56 0
+	# pieces.c:57
+	.loc 1 57 0
 	movl	%ebx, -8(%ebp)
 .LCFI21:
-	# pieces.c:60
-	.loc 1 60 0
+	# pieces.c:61
+	.loc 1 61 0
 	movl	%esi, (%esp)
 	call	bar
 .LVL16:
-	# pieces.c:57
-	.loc 1 57 0
+	# pieces.c:58
+	.loc 1 58 0
 	movl	8(%ebp), %edx
 	sall	$4, %edx
-	# pieces.c:59
-	.loc 1 59 0
+	# pieces.c:60
+	.loc 1 60 0
 	addl	$112, %edx
 	sarw	$4, %dx
-	# pieces.c:61
-	.loc 1 61 0
+	# pieces.c:62
+	.loc 1 62 0
 	movswl	%dx, %ebx
 	movl	%ebx, (%esp)
 	call	bar
-	# pieces.c:62
-	.loc 1 62 0
-	leal	(%esi,%ebx), %eax
 	# pieces.c:63
 	.loc 1 63 0
+	leal	(%esi,%ebx), %eax
+	# pieces.c:64
+	.loc 1 64 0
 	movl	-8(%ebp), %ebx
 	movl	-4(%ebp), %esi
 .LVL17:
@@ -246,8 +246,8 @@
 	.type	f4, @function
 f4:
 .LFB4:
-	# pieces.c:67
-	.loc 1 67 0
+	# pieces.c:68
+	.loc 1 68 0
 .LVL18:
 	# basic block 2
 	pushl	%ebp
@@ -262,28 +262,28 @@
 .LVL19:
 	movl	%ebx, -8(%ebp)
 .LCFI28:
-	# pieces.c:69
-	.loc 1 69 0
-	movl	%esi, %ebx
 	# pieces.c:70
 	.loc 1 70 0
-	addl	$1, %esi
-	# pieces.c:69
-	.loc 1 69 0
-.LVL20:
+	movl	%esi, %ebx
 	# pieces.c:71
 	.loc 1 71 0
-	movl	%ebx, (%esp)
-	call	bar
+	addl	$1, %esi
+	# pieces.c:70
+	.loc 1 70 0
+.LVL20:
 	# pieces.c:72
 	.loc 1 72 0
-	movl	%esi, (%esp)
+	movl	%ebx, (%esp)
 	call	bar
 	# pieces.c:73
 	.loc 1 73 0
-	leal	(%ebx,%esi), %eax
+	movl	%esi, (%esp)
+	call	bar
 	# pieces.c:74
 	.loc 1 74 0
+	leal	(%ebx,%esi), %eax
+	# pieces.c:75
+	.loc 1 75 0
 	movl	-8(%ebp), %ebx
 .LVL21:
 	movl	-4(%ebp), %esi
@@ -300,8 +300,8 @@
 	.type	f5, @function
 f5:
 .LFB5:
-	# pieces.c:78
-	.loc 1 78 0
+	# pieces.c:79
+	.loc 1 79 0
 .LVL23:
 	# basic block 2
 	pushl	%ebp
@@ -316,28 +316,28 @@
 .LVL24:
 	movl	%ebx, -8(%ebp)
 .LCFI35:
-	# pieces.c:80
-	.loc 1 80 0
-	movl	%esi, %ebx
 	# pieces.c:81
 	.loc 1 81 0
-	addl	$1, %esi
-	# pieces.c:80
-	.loc 1 80 0
-.LVL25:
+	movl	%esi, %ebx
 	# pieces.c:82
 	.loc 1 82 0
-	movl	%ebx, (%esp)
-	call	bar
+	addl	$1, %esi
+	# pieces.c:81
+	.loc 1 81 0
+.LVL25:
 	# pieces.c:83
 	.loc 1 83 0
-	movl	%esi, (%esp)
+	movl	%ebx, (%esp)
 	call	bar
 	# pieces.c:84
 	.loc 1 84 0
-	leal	(%ebx,%esi), %eax
+	movl	%esi, (%esp)
+	call	bar
 	# pieces.c:85
 	.loc 1 85 0
+	leal	(%ebx,%esi), %eax
+	# pieces.c:86
+	.loc 1 86 0
 	movl	-8(%ebp), %ebx
 .LVL26:
 	movl	-4(%ebp), %esi
@@ -350,60 +350,118 @@
 .LFE5:
 	.size	f5, .-f5
 	.p2align 4,,15
-.globl main
-	.type	main, @function
-main:
+.globl f6
+	.type	f6, @function
+f6:
 .LFB6:
-	# pieces.c:89
-	.loc 1 89 0
+	# pieces.c:90
+	.loc 1 90 0
+.LVL28:
 	# basic block 2
 	pushl	%ebp
 .LCFI38:
 	movl	%esp, %ebp
 .LCFI39:
-	pushl	%ebx
+	subl	$12, %esp
 .LCFI40:
-	# pieces.c:91
-	.loc 1 91 0
-	movl	$7, %ebx
-	# pieces.c:89
-	.loc 1 89 0
-	subl	$4, %esp
+	movl	%esi, -4(%ebp)
 .LCFI41:
-	# pieces.c:91
-	.loc 1 91 0
-.LVL28:
-	# pieces.c:92
-	.loc 1 92 0
-	movl	%ebx, (%esp)
-	call	f1
+	movl	8(%ebp), %esi
+.LVL29:
+	movl	%ebx, -8(%ebp)
+.LCFI42:
 	# pieces.c:93
 	.loc 1 93 0
-	movl	%ebx, (%esp)
-	call	f2
+	movl	%esi, %ebx
 	# pieces.c:94
 	.loc 1 94 0
-	movl	%ebx, (%esp)
-	call	f3
+	addl	$1, %esi
+	# pieces.c:93
+	.loc 1 93 0
+.LVL30:
 	# pieces.c:95
 	.loc 1 95 0
 	movl	%ebx, (%esp)
-	call	f4
+	call	bar
 	# pieces.c:96
 	.loc 1 96 0
-	movl	%ebx, (%esp)
-	call	f5
+	movl	%esi, (%esp)
+	call	bar
+	# pieces.c:97
+	.loc 1 97 0
+	leal	(%ebx,%esi), %eax
 	# pieces.c:98
 	.loc 1 98 0
+	movl	-8(%ebp), %ebx
+.LVL31:
+	movl	-4(%ebp), %esi
+.LVL32:
+	movl	%ebp, %esp
+.LCFI43:
+	popl	%ebp
+.LCFI44:
+	ret
+.LFE6:
+	.size	f6, .-f6
+	.p2align 4,,15
+.globl main
+	.type	main, @function
+main:
+.LFB7:
+	# pieces.c:102
+	.loc 1 102 0
+	# basic block 2
+	pushl	%ebp
+.LCFI45:
+	movl	%esp, %ebp
+.LCFI46:
+	pushl	%ebx
+.LCFI47:
+	# pieces.c:104
+	.loc 1 104 0
+	movl	$7, %ebx
+	# pieces.c:102
+	.loc 1 102 0
+	subl	$4, %esp
+.LCFI48:
+	# pieces.c:104
+	.loc 1 104 0
+.LVL33:
+	# pieces.c:105
+	.loc 1 105 0
+	movl	%ebx, (%esp)
+	call	f1
+	# pieces.c:106
+	.loc 1 106 0
+	movl	%ebx, (%esp)
+	call	f2
+	# pieces.c:107
+	.loc 1 107 0
+	movl	%ebx, (%esp)
+	call	f3
+	# pieces.c:108
+	.loc 1 108 0
+	movl	%ebx, (%esp)
+	call	f4
+	# pieces.c:109
+	.loc 1 109 0
+	movl	%ebx, (%esp)
+	call	f5
+	# pieces.c:110
+	.loc 1 110 0
+	movl	%ebx, (%esp)
+	call	f6
+	# pieces.c:112
+	.loc 1 112 0
 	addl	$4, %esp
 	xorl	%eax, %eax
 	popl	%ebx
-.LCFI42:
-.LVL29:
+.LCFI49:
+.LVL34:
 	popl	%ebp
-.LCFI43:
+.LCFI50:
 	ret
-.LFE6:
+.LFE7:
 	.size	main, .-main
 #APP
 	.section	.debug_frame,"", at progbits
@@ -649,20 +707,57 @@
 	.byte	0xd	# DW_CFA_def_cfa_register
 	.uleb128 0x5
 	.byte	0x4	# DW_CFA_advance_loc4
-	.long	.LCFI40-.LCFI39
+	.long	.LCFI41-.LCFI39
+	.byte	0x86	# DW_CFA_offset, column 0x6
+	.uleb128 0x3
+	.byte	0x4	# DW_CFA_advance_loc4
+	.long	.LCFI42-.LCFI41
+	.byte	0x83	# DW_CFA_offset, column 0x3
+	.uleb128 0x4
+	.byte	0x4	# DW_CFA_advance_loc4
+	.long	.LCFI43-.LCFI42
+	.byte	0xd	# DW_CFA_def_cfa_register
+	.uleb128 0x4
+	.byte	0xc6	# DW_CFA_restore, column 0x6
+	.byte	0xc3	# DW_CFA_restore, column 0x3
+	.byte	0x4	# DW_CFA_advance_loc4
+	.long	.LCFI44-.LCFI43
+	.byte	0xc5	# DW_CFA_restore, column 0x5
+	.byte	0xe	# DW_CFA_def_cfa_offset
+	.uleb128 0x4
+	.align 4
+.LEFDE12:
+.LSFDE14:
+	.long	.LEFDE14-.LASFDE14	# FDE Length
+.LASFDE14:
+	.long	.Lframe0	# FDE CIE offset
+	.long	.LFB7	# FDE initial location
+	.long	.LFE7-.LFB7	# FDE address range
+	.byte	0x4	# DW_CFA_advance_loc4
+	.long	.LCFI45-.LFB7
+	.byte	0xe	# DW_CFA_def_cfa_offset
+	.uleb128 0x8
+	.byte	0x85	# DW_CFA_offset, column 0x5
+	.uleb128 0x2
+	.byte	0x4	# DW_CFA_advance_loc4
+	.long	.LCFI46-.LCFI45
+	.byte	0xd	# DW_CFA_def_cfa_register
+	.uleb128 0x5
+	.byte	0x4	# DW_CFA_advance_loc4
+	.long	.LCFI47-.LCFI46
 	.byte	0x83	# DW_CFA_offset, column 0x3
 	.uleb128 0x3
 	.byte	0x4	# DW_CFA_advance_loc4
-	.long	.LCFI42-.LCFI40
+	.long	.LCFI49-.LCFI47
 	.byte	0xc3	# DW_CFA_restore, column 0x3
 	.byte	0x4	# DW_CFA_advance_loc4
-	.long	.LCFI43-.LCFI42
+	.long	.LCFI50-.LCFI49
 	.byte	0xc5	# DW_CFA_restore, column 0x5
 	.byte	0xc	# DW_CFA_def_cfa
 	.uleb128 0x4
 	.uleb128 0x4
 	.align 4
-.LEFDE12:
+.LEFDE14:
 #NO_APP
 	.text
 .Letext0:
@@ -1130,6 +1225,11 @@
 	.byte	0x75	# DW_OP_breg5
 	.sleb128 8
 	.long	.LCFI43-.Ltext0	# Location list begin address (*.LLST11)
+	.long	.LCFI44-.Ltext0	# Location list end address (*.LLST11)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 8
+	.long	.LCFI44-.Ltext0	# Location list begin address (*.LLST11)
 	.long	.LFE6-.Ltext0	# Location list end address (*.LLST11)
 	.value	0x2	# Location expression size
 	.byte	0x74	# DW_OP_breg4
@@ -1137,14 +1237,74 @@
 	.long	0	# Location list terminator begin (*.LLST11)
 	.long	0	# Location list terminator end (*.LLST11)
 .LLST12:
-	.long	.LVL28-.Ltext0	# Location list begin address (*.LLST12)
-	.long	.LVL29-.Ltext0	# Location list end address (*.LLST12)
-	.value	0x1	# Location expression size
+	.long	.LVL29-.Ltext0	# Location list begin address (*.LLST12)
+	.long	.LVL30-.Ltext0	# Location list end address (*.LLST12)
+	.value	0xa	# Location expression size
+	.byte	0x91	# DW_OP_fbreg
+	.sleb128 0
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.byte	0x91	# DW_OP_fbreg
+	.sleb128 0
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.long	.LVL30-.Ltext0	# Location list begin address (*.LLST12)
+	.long	.LVL31-.Ltext0	# Location list end address (*.LLST12)
+	.value	0x8	# Location expression size
 	.byte	0x53	# DW_OP_reg3
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.byte	0x56	# DW_OP_reg6
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.long	.LVL31-.Ltext0	# Location list begin address (*.LLST12)
+	.long	.LVL32-.Ltext0	# Location list end address (*.LLST12)
+	.value	0x7	# Location expression size
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.byte	0x56	# DW_OP_reg6
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x4
 	.long	0	# Location list terminator begin (*.LLST12)
 	.long	0	# Location list terminator end (*.LLST12)
+.LLST13:
+	.long	.LFB7-.Ltext0	# Location list begin address (*.LLST13)
+	.long	.LCFI45-.Ltext0	# Location list end address (*.LLST13)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 4
+	.long	.LCFI45-.Ltext0	# Location list begin address (*.LLST13)
+	.long	.LCFI46-.Ltext0	# Location list end address (*.LLST13)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 8
+	.long	.LCFI46-.Ltext0	# Location list begin address (*.LLST13)
+	.long	.LCFI50-.Ltext0	# Location list end address (*.LLST13)
+	.value	0x2	# Location expression size
+	.byte	0x75	# DW_OP_breg5
+	.sleb128 8
+	.long	.LCFI50-.Ltext0	# Location list begin address (*.LLST13)
+	.long	.LFE7-.Ltext0	# Location list end address (*.LLST13)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 4
+	.long	0	# Location list terminator begin (*.LLST13)
+	.long	0	# Location list terminator end (*.LLST13)
+.LLST14:
+	.long	.LVL33-.Ltext0	# Location list begin address (*.LLST14)
+	.long	.LVL34-.Ltext0	# Location list end address (*.LLST14)
+	.value	0x1	# Location expression size
+	.byte	0x53	# DW_OP_reg3
+	.long	0	# Location list terminator begin (*.LLST14)
+	.long	0	# Location list terminator end (*.LLST14)
 	.section	.debug_info
-	.long	0x1e3	# Length of Compilation Unit Info
+	.long	0x252	# Length of Compilation Unit Info
 	.value	0x2	# DWARF version number
 	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
 	.byte	0x4	# Pointer Size (in bytes)
@@ -1212,182 +1372,245 @@
 	.byte	0x23	# DW_OP_plus_uconst
 	.uleb128 0
 	.byte	0	# end of children of DIE 0x4f
-	.uleb128 0x6	# (DIE (0x78) DW_TAG_subprogram)
+	.uleb128 0x2	# (DIE (0x78) DW_TAG_structure_type)
+	.ascii "C\0"	# DW_AT_name
+	.byte	0xc	# DW_AT_byte_size
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x19	# DW_AT_decl_line
+	.long	0xa7	# DW_AT_sibling
+	.uleb128 0x3	# (DIE (0x82) DW_TAG_member)
+	.ascii "i\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x19	# DW_AT_decl_line
+	.long	0x48	# DW_AT_type
+	.byte	0x2	# DW_AT_data_member_location
+	.byte	0x23	# DW_OP_plus_uconst
+	.uleb128 0
+	.uleb128 0x3	# (DIE (0x8e) DW_TAG_member)
+	.ascii "j\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x19	# DW_AT_decl_line
+	.long	0x48	# DW_AT_type
+	.byte	0x2	# DW_AT_data_member_location
+	.byte	0x23	# DW_OP_plus_uconst
+	.uleb128 0x4
+	.uleb128 0x3	# (DIE (0x9a) DW_TAG_member)
+	.ascii "q\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x19	# DW_AT_decl_line
+	.long	0x48	# DW_AT_type
+	.byte	0x2	# DW_AT_data_member_location
+	.byte	0x23	# DW_OP_plus_uconst
+	.uleb128 0x8
+	.byte	0	# end of children of DIE 0x78
+	.uleb128 0x6	# (DIE (0xa7) DW_TAG_subprogram)
 	.byte	0x1	# DW_AT_external
 	.ascii "bar\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x1b	# DW_AT_decl_line
+	.byte	0x1c	# DW_AT_decl_line
 	.byte	0x1	# DW_AT_prototyped
 	.long	.LFB0	# DW_AT_low_pc
 	.long	.LFE0	# DW_AT_high_pc
 	.long	.LLST0	# DW_AT_frame_base
-	.long	0x9e	# DW_AT_sibling
-	.uleb128 0x7	# (DIE (0x91) DW_TAG_formal_parameter)
+	.long	0xcd	# DW_AT_sibling
+	.uleb128 0x7	# (DIE (0xc0) DW_TAG_formal_parameter)
 	.ascii "x\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x1b	# DW_AT_decl_line
+	.byte	0x1c	# DW_AT_decl_line
 	.long	0x48	# DW_AT_type
 	.byte	0x2	# DW_AT_location
 	.byte	0x91	# DW_OP_fbreg
 	.sleb128 0
-	.byte	0	# end of children of DIE 0x78
-	.uleb128 0x8	# (DIE (0x9e) DW_TAG_subprogram)
+	.byte	0	# end of children of DIE 0xa7
+	.uleb128 0x8	# (DIE (0xcd) DW_TAG_subprogram)
 	.byte	0x1	# DW_AT_external
 	.ascii "f1\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x21	# DW_AT_decl_line
+	.byte	0x22	# DW_AT_decl_line
 	.byte	0x1	# DW_AT_prototyped
 	.long	0x48	# DW_AT_type
 	.long	.LFB1	# DW_AT_low_pc
 	.long	.LFE1	# DW_AT_high_pc
 	.long	.LLST1	# DW_AT_frame_base
-	.long	0xd4	# DW_AT_sibling
-	.uleb128 0x7	# (DIE (0xba) DW_TAG_formal_parameter)
+	.long	0x103	# DW_AT_sibling
+	.uleb128 0x7	# (DIE (0xe9) DW_TAG_formal_parameter)
 	.ascii "k\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x21	# DW_AT_decl_line
+	.byte	0x22	# DW_AT_decl_line
 	.long	0x48	# DW_AT_type
 	.byte	0x2	# DW_AT_location
 	.byte	0x91	# DW_OP_fbreg
 	.sleb128 0
-	.uleb128 0x9	# (DIE (0xc6) DW_TAG_variable)
+	.uleb128 0x9	# (DIE (0xf5) DW_TAG_variable)
 	.ascii "a\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x23	# DW_AT_decl_line
+	.byte	0x24	# DW_AT_decl_line
 	.long	0x25	# DW_AT_type
 	.long	.LLST2	# DW_AT_location
-	.byte	0	# end of children of DIE 0x9e
-	.uleb128 0x8	# (DIE (0xd4) DW_TAG_subprogram)
+	.byte	0	# end of children of DIE 0xcd
+	.uleb128 0x8	# (DIE (0x103) DW_TAG_subprogram)
 	.byte	0x1	# DW_AT_external
 	.ascii "f2\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x2c	# DW_AT_decl_line
+	.byte	0x2d	# DW_AT_decl_line
 	.byte	0x1	# DW_AT_prototyped
 	.long	0x48	# DW_AT_type
 	.long	.LFB2	# DW_AT_low_pc
 	.long	.LFE2	# DW_AT_high_pc
 	.long	.LLST3	# DW_AT_frame_base
-	.long	0x10a	# DW_AT_sibling
-	.uleb128 0x7	# (DIE (0xf0) DW_TAG_formal_parameter)
+	.long	0x139	# DW_AT_sibling
+	.uleb128 0x7	# (DIE (0x11f) DW_TAG_formal_parameter)
 	.ascii "k\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x2c	# DW_AT_decl_line
+	.byte	0x2d	# DW_AT_decl_line
 	.long	0x48	# DW_AT_type
 	.byte	0x2	# DW_AT_location
 	.byte	0x91	# DW_OP_fbreg
 	.sleb128 0
-	.uleb128 0x9	# (DIE (0xfc) DW_TAG_variable)
+	.uleb128 0x9	# (DIE (0x12b) DW_TAG_variable)
 	.ascii "a\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x2e	# DW_AT_decl_line
-	.long	0x10a	# DW_AT_type
+	.byte	0x2f	# DW_AT_decl_line
+	.long	0x139	# DW_AT_type
 	.long	.LLST4	# DW_AT_location
-	.byte	0	# end of children of DIE 0xd4
-	.uleb128 0xa	# (DIE (0x10a) DW_TAG_array_type)
+	.byte	0	# end of children of DIE 0x103
+	.uleb128 0xa	# (DIE (0x139) DW_TAG_array_type)
 	.long	0x48	# DW_AT_type
-	.long	0x11a	# DW_AT_sibling
-	.uleb128 0xb	# (DIE (0x113) DW_TAG_subrange_type)
-	.long	0x11a	# DW_AT_type
+	.long	0x149	# DW_AT_sibling
+	.uleb128 0xb	# (DIE (0x142) DW_TAG_subrange_type)
+	.long	0x149	# DW_AT_type
 	.byte	0x1	# DW_AT_upper_bound
-	.byte	0	# end of children of DIE 0x10a
-	.uleb128 0xc	# (DIE (0x11a) DW_TAG_base_type)
+	.byte	0	# end of children of DIE 0x139
+	.uleb128 0xc	# (DIE (0x149) DW_TAG_base_type)
 	.byte	0x4	# DW_AT_byte_size
 	.byte	0x7	# DW_AT_encoding
-	.uleb128 0x8	# (DIE (0x11d) DW_TAG_subprogram)
+	.uleb128 0x8	# (DIE (0x14c) DW_TAG_subprogram)
 	.byte	0x1	# DW_AT_external
 	.ascii "f3\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x37	# DW_AT_decl_line
+	.byte	0x38	# DW_AT_decl_line
 	.byte	0x1	# DW_AT_prototyped
 	.long	0x48	# DW_AT_type
 	.long	.LFB3	# DW_AT_low_pc
 	.long	.LFE3	# DW_AT_high_pc
 	.long	.LLST5	# DW_AT_frame_base
-	.long	0x153	# DW_AT_sibling
-	.uleb128 0x7	# (DIE (0x139) DW_TAG_formal_parameter)
+	.long	0x182	# DW_AT_sibling
+	.uleb128 0x7	# (DIE (0x168) DW_TAG_formal_parameter)
 	.ascii "k\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x37	# DW_AT_decl_line
+	.byte	0x38	# DW_AT_decl_line
 	.long	0x48	# DW_AT_type
 	.byte	0x2	# DW_AT_location
 	.byte	0x91	# DW_OP_fbreg
 	.sleb128 0
-	.uleb128 0x9	# (DIE (0x145) DW_TAG_variable)
+	.uleb128 0x9	# (DIE (0x174) DW_TAG_variable)
 	.ascii "a\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x39	# DW_AT_decl_line
+	.byte	0x3a	# DW_AT_decl_line
 	.long	0x4f	# DW_AT_type
 	.long	.LLST6	# DW_AT_location
-	.byte	0	# end of children of DIE 0x11d
-	.uleb128 0x8	# (DIE (0x153) DW_TAG_subprogram)
+	.byte	0	# end of children of DIE 0x14c
+	.uleb128 0x8	# (DIE (0x182) DW_TAG_subprogram)
 	.byte	0x1	# DW_AT_external
 	.ascii "f4\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x42	# DW_AT_decl_line
+	.byte	0x43	# DW_AT_decl_line
 	.byte	0x1	# DW_AT_prototyped
 	.long	0x48	# DW_AT_type
 	.long	.LFB4	# DW_AT_low_pc
 	.long	.LFE4	# DW_AT_high_pc
 	.long	.LLST7	# DW_AT_frame_base
-	.long	0x189	# DW_AT_sibling
-	.uleb128 0x7	# (DIE (0x16f) DW_TAG_formal_parameter)
+	.long	0x1b8	# DW_AT_sibling
+	.uleb128 0x7	# (DIE (0x19e) DW_TAG_formal_parameter)
 	.ascii "k\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x42	# DW_AT_decl_line
+	.byte	0x43	# DW_AT_decl_line
 	.long	0x48	# DW_AT_type
 	.byte	0x2	# DW_AT_location
 	.byte	0x91	# DW_OP_fbreg
 	.sleb128 0
-	.uleb128 0x9	# (DIE (0x17b) DW_TAG_variable)
+	.uleb128 0x9	# (DIE (0x1aa) DW_TAG_variable)
 	.ascii "a\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x44	# DW_AT_decl_line
-	.long	0x10a	# DW_AT_type
+	.byte	0x45	# DW_AT_decl_line
+	.long	0x139	# DW_AT_type
 	.long	.LLST8	# DW_AT_location
-	.byte	0	# end of children of DIE 0x153
-	.uleb128 0x8	# (DIE (0x189) DW_TAG_subprogram)
+	.byte	0	# end of children of DIE 0x182
+	.uleb128 0x8	# (DIE (0x1b8) DW_TAG_subprogram)
 	.byte	0x1	# DW_AT_external
 	.ascii "f5\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x4d	# DW_AT_decl_line
+	.byte	0x4e	# DW_AT_decl_line
 	.byte	0x1	# DW_AT_prototyped
 	.long	0x48	# DW_AT_type
 	.long	.LFB5	# DW_AT_low_pc
 	.long	.LFE5	# DW_AT_high_pc
 	.long	.LLST9	# DW_AT_frame_base
-	.long	0x1bf	# DW_AT_sibling
-	.uleb128 0x7	# (DIE (0x1a5) DW_TAG_formal_parameter)
+	.long	0x1ee	# DW_AT_sibling
+	.uleb128 0x7	# (DIE (0x1d4) DW_TAG_formal_parameter)
 	.ascii "k\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x4d	# DW_AT_decl_line
+	.byte	0x4e	# DW_AT_decl_line
 	.long	0x48	# DW_AT_type
 	.byte	0x2	# DW_AT_location
 	.byte	0x91	# DW_OP_fbreg
 	.sleb128 0
-	.uleb128 0x9	# (DIE (0x1b1) DW_TAG_variable)
+	.uleb128 0x9	# (DIE (0x1e0) DW_TAG_variable)
 	.ascii "a\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x4f	# DW_AT_decl_line
+	.byte	0x50	# DW_AT_decl_line
 	.long	0x25	# DW_AT_type
 	.long	.LLST10	# DW_AT_location
-	.byte	0	# end of children of DIE 0x189
-	.uleb128 0xd	# (DIE (0x1bf) DW_TAG_subprogram)
+	.byte	0	# end of children of DIE 0x1b8
+	.uleb128 0x8	# (DIE (0x1ee) DW_TAG_subprogram)
 	.byte	0x1	# DW_AT_external
-	.long	.LASF0	# DW_AT_name: "main"
+	.ascii "f6\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x58	# DW_AT_decl_line
+	.byte	0x59	# DW_AT_decl_line
 	.byte	0x1	# DW_AT_prototyped
 	.long	0x48	# DW_AT_type
 	.long	.LFB6	# DW_AT_low_pc
 	.long	.LFE6	# DW_AT_high_pc
 	.long	.LLST11	# DW_AT_frame_base
-	.uleb128 0x9	# (DIE (0x1d8) DW_TAG_variable)
+	.long	0x22e	# DW_AT_sibling
+	.uleb128 0x7	# (DIE (0x20a) DW_TAG_formal_parameter)
 	.ascii "k\0"	# DW_AT_name
 	.byte	0x1	# DW_AT_decl_file (pieces.c)
-	.byte	0x5a	# DW_AT_decl_line
+	.byte	0x59	# DW_AT_decl_line
 	.long	0x48	# DW_AT_type
+	.byte	0x2	# DW_AT_location
+	.byte	0x91	# DW_OP_fbreg
+	.sleb128 0
+	.uleb128 0xd	# (DIE (0x216) DW_TAG_variable)
+	.ascii "z\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x5b	# DW_AT_decl_line
+	.long	0x48	# DW_AT_type
+	.byte	0x17	# DW_AT_const_value
+	.uleb128 0x9	# (DIE (0x220) DW_TAG_variable)
+	.ascii "a\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x5c	# DW_AT_decl_line
+	.long	0x78	# DW_AT_type
 	.long	.LLST12	# DW_AT_location
-	.byte	0	# end of children of DIE 0x1bf
+	.byte	0	# end of children of DIE 0x1ee
+	.uleb128 0xe	# (DIE (0x22e) DW_TAG_subprogram)
+	.byte	0x1	# DW_AT_external
+	.long	.LASF0	# DW_AT_name: "main"
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x65	# DW_AT_decl_line
+	.byte	0x1	# DW_AT_prototyped
+	.long	0x48	# DW_AT_type
+	.long	.LFB7	# DW_AT_low_pc
+	.long	.LFE7	# DW_AT_high_pc
+	.long	.LLST13	# DW_AT_frame_base
+	.uleb128 0x9	# (DIE (0x247) DW_TAG_variable)
+	.ascii "k\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (pieces.c)
+	.byte	0x67	# DW_AT_decl_line
+	.long	0x48	# DW_AT_type
+	.long	.LLST14	# DW_AT_location
+	.byte	0	# end of children of DIE 0x22e
 	.byte	0	# end of children of DIE 0xb
 	.section	.debug_abbrev
 	.uleb128 0x1	# (abbrev code)
@@ -1577,6 +1800,21 @@
 	.byte	0
 	.byte	0
 	.uleb128 0xd	# (abbrev code)
+	.uleb128 0x34	# (TAG: DW_TAG_variable)
+	.byte	0	# DW_children_no
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0x8	# (DW_FORM_string)
+	.uleb128 0x3a	# (DW_AT_decl_file)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3b	# (DW_AT_decl_line)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.uleb128 0x1c	# (DW_AT_const_value)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.byte	0
+	.byte	0
+	.uleb128 0xe	# (abbrev code)
 	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
 	.byte	0x1	# DW_children_yes
 	.uleb128 0x3f	# (DW_AT_external)
@@ -1601,34 +1839,38 @@
 	.byte	0
 	.byte	0
 	.section	.debug_pubnames,"", at progbits
-	.long	0x42	# Length of Public Names Info
+	.long	0x49	# Length of Public Names Info
 	.value	0x2	# DWARF Version
 	.long	.Ldebug_info0	# Offset of Compilation Unit Info
-	.long	0x1e7	# Compilation Unit Length
-	.long	0x78	# DIE offset
+	.long	0x256	# Compilation Unit Length
+	.long	0xa7	# DIE offset
 	.ascii "bar\0"	# external name
-	.long	0x9e	# DIE offset
+	.long	0xcd	# DIE offset
 	.ascii "f1\0"	# external name
-	.long	0xd4	# DIE offset
+	.long	0x103	# DIE offset
 	.ascii "f2\0"	# external name
-	.long	0x11d	# DIE offset
+	.long	0x14c	# DIE offset
 	.ascii "f3\0"	# external name
-	.long	0x153	# DIE offset
+	.long	0x182	# DIE offset
 	.ascii "f4\0"	# external name
-	.long	0x189	# DIE offset
+	.long	0x1b8	# DIE offset
 	.ascii "f5\0"	# external name
-	.long	0x1bf	# DIE offset
+	.long	0x1ee	# DIE offset
+	.ascii "f6\0"	# external name
+	.long	0x22e	# DIE offset
 	.ascii "main\0"	# external name
 	.long	0
 	.section	.debug_pubtypes,"", at progbits
-	.long	0x1a	# Length of Public Type Names Info
+	.long	0x20	# Length of Public Type Names Info
 	.value	0x2	# DWARF Version
 	.long	.Ldebug_info0	# Offset of Compilation Unit Info
-	.long	0x1e7	# Compilation Unit Length
+	.long	0x256	# Compilation Unit Length
 	.long	0x25	# DIE offset
 	.ascii "A\0"	# external name
 	.long	0x4f	# DIE offset
 	.ascii "B\0"	# external name
+	.long	0x78	# DIE offset
+	.ascii "C\0"	# external name
 	.long	0
 	.section	.debug_aranges,"", at progbits
 	.long	0x1c	# Length of Address Ranges Info
--- src/gdb/testsuite/gdb.dwarf2/pieces.c	2010/05/21 20:39:50	1.1
+++ src/gdb/testsuite/gdb.dwarf2/pieces.c	2010/05/21 21:01:46	1.2
@@ -22,6 +22,7 @@
 
 struct A { int i; int j; };
 struct B { int : 4; int i : 12; int j : 12; int : 4; };
+struct C { int i; int j; int q; };
 
 __attribute__((noinline)) void
 bar (int x)
@@ -84,6 +85,18 @@
   return a.i + a.j;		/* f5 breakpoint */
 }
 
+__attribute__((noinline)) int
+f6 (int k)
+{
+  int z = 23;
+  struct C a = { k, k, z};
+  asm ("" : "+r" (a.i));
+  a.j++;
+  bar (a.i);
+  bar (a.j);
+  return a.i + a.j;		/* f6 breakpoint */
+}
+
 int
 main (void)
 {
@@ -94,5 +107,6 @@
   f3 (k);
   f4 (k);
   f5 (k);
+  f6 (k);
   return 0;
 }
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp	2010/05/21 21:00:27	1.2
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp	2010/05/21 21:01:46	1.3
@@ -67,5 +67,28 @@
     gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2"
 }
 
+# Function f6 tests for an empty DW_OP_piece.
+proc pieces_test_f6 {} {
+    global csrcfile
+    set line [gdb_get_line_number "f6 breakpoint" $csrcfile]
+    gdb_test "break pieces.c:$line" "Breakpoint 4.*" \
+       "set f6 breakpoint for pieces"
+    gdb_continue_to_breakpoint "continue to f6 breakpoint for pieces"
+    gdb_test "print a" \
+	"warning: bytes .* in computed object were.* = {i = 7, j = 8, q = 0}" \
+	"print a with optimized out piece"
+    # Note: no warning for this case.
+    gdb_test_multiple "print a.i" \
+	"print a.i with optimized out piece" {
+	    -re "warning: some bits in computed object" {
+		fail "print a.i with optimized out piece"
+	    }
+	    -re " = 7" {
+		pass "print a.i with optimized out piece"
+	    }
+	}
+}
+
 pieces_test_f1
 pieces_test_f2
+pieces_test_f6

gdb-bz589467-pieces4of4.patch:
 dwarf2expr.c                    |   38 +++-
 dwarf2expr.h                    |    6 
 dwarf2loc.c                     |  367 ++++++++++++++++++++++++++++++++++------
 testsuite/gdb.dwarf2/pieces.S   |   54 ++---
 testsuite/gdb.dwarf2/pieces.c   |    4 
 testsuite/gdb.dwarf2/pieces.exp |   20 +-
 6 files changed, 384 insertions(+), 105 deletions(-)

--- NEW FILE gdb-bz589467-pieces4of4.patch ---
http://sourceware.org/ml/gdb-cvs/2010-05/msg00191.html

### src/gdb/ChangeLog	2010/05/21 21:01:46	1.11832
### src/gdb/ChangeLog	2010/05/21 21:13:10	1.11833
## -1,5 +1,20 @@
 2010-05-21  Tom Tromey  <tromey at redhat.com>
 
+	* dwarf2loc.c (extract_bits_primitive): New function.
+	(extract_bits): Likewise.
+	(insert_bits): Likewise.
+	(copy_bitwise): Likewise.
+	(read_pieced_value): Do all operations in bits.
+	(write_pieced_value): Likewise.
+	* dwarf2expr.h (struct dwarf_expr_piece) <offset>: New field.
+	* dwarf2expr.c (add_piece): New arguments bit_piece, offset.
+	Always use xrealloc to resize piece array.
+	(execute_stack_op) <DW_OP_reg0>: Handle DW_OP_bit_piece.
+	<DW_OP_piece>: Update.
+	<DW_OP_bit_piece>: New case.
+
### src/gdb/testsuite/ChangeLog	2010/05/21 21:01:46	1.2275
### src/gdb/testsuite/ChangeLog	2010/05/21 21:13:13	1.2276
## -1,5 +1,12 @@
 2010-05-21  Tom Tromey  <tromey at redhat.com>
 
+	* gdb.dwarf2/pieces.exp (pieces_test_f3): New proc.
+	Call it.
+	* gdb.dwarf2/pieces.S: Update.
+	* gdb.dwarf2/pieces.c (struct B): Remove initial field.
+
--- src/gdb/dwarf2expr.c	2010/05/21 21:01:46	1.43
+++ src/gdb/dwarf2expr.c	2010/05/21 21:13:10	1.44
@@ -153,23 +153,21 @@
 
 /* Add a new piece to CTX's piece list.  */
 static void
-add_piece (struct dwarf_expr_context *ctx, ULONGEST size)
+add_piece (struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset)
 {
   struct dwarf_expr_piece *p;
 
   ctx->num_pieces++;
 
-  if (ctx->pieces)
-    ctx->pieces = xrealloc (ctx->pieces,
-                            (ctx->num_pieces
-                             * sizeof (struct dwarf_expr_piece)));
-  else
-    ctx->pieces = xmalloc (ctx->num_pieces
-                           * sizeof (struct dwarf_expr_piece));
+  ctx->pieces = xrealloc (ctx->pieces,
+			  (ctx->num_pieces
+			   * sizeof (struct dwarf_expr_piece)));
 
   p = &ctx->pieces[ctx->num_pieces - 1];
   p->location = ctx->location;
   p->size = size;
+  p->offset = offset;
+
   if (p->location == DWARF_VALUE_LITERAL)
     {
       p->v.literal.data = ctx->data;
@@ -499,9 +497,11 @@
 	case DW_OP_reg31:
 	  if (op_ptr != op_end 
 	      && *op_ptr != DW_OP_piece
+	      && *op_ptr != DW_OP_bit_piece
 	      && *op_ptr != DW_OP_GNU_uninit)
 	    error (_("DWARF-2 expression error: DW_OP_reg operations must be "
-		   "used either alone or in conjuction with DW_OP_piece."));
+		     "used either alone or in conjuction with DW_OP_piece "
+		     "or DW_OP_bit_piece."));
 
 	  result = op - DW_OP_reg0;
 	  ctx->location = DWARF_VALUE_REGISTER;
@@ -872,7 +872,7 @@
 
             /* Record the piece.  */
             op_ptr = read_uleb128 (op_ptr, op_end, &size);
-	    add_piece (ctx, size);
+	    add_piece (ctx, 8 * size, 0);
 
             /* Pop off the address/regnum, and reset the location
 	       type.  */
@@ -883,6 +883,24 @@
           }
           goto no_push;
 
+	case DW_OP_bit_piece:
+	  {
+	    ULONGEST size, offset;
+
+            /* Record the piece.  */
+	    op_ptr = read_uleb128 (op_ptr, op_end, &size);
+	    op_ptr = read_uleb128 (op_ptr, op_end, &offset);
+	    add_piece (ctx, size, offset);
+
+            /* Pop off the address/regnum, and reset the location
+	       type.  */
+	    if (ctx->location != DWARF_VALUE_LITERAL
+		&& ctx->location != DWARF_VALUE_OPTIMIZED_OUT)
+	      dwarf_expr_pop (ctx);
+            ctx->location = DWARF_VALUE_MEMORY;
+	  }
+	  goto no_push;
+
 	case DW_OP_GNU_uninit:
 	  if (op_ptr != op_end)
 	    error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
--- src/gdb/dwarf2expr.h	2010/05/21 21:01:46	1.21
+++ src/gdb/dwarf2expr.h	2010/05/21 21:13:11	1.22
@@ -155,7 +155,7 @@
 };
 
 
-/* A piece of an object, as recorded by DW_OP_piece.  */
+/* A piece of an object, as recorded by DW_OP_piece or DW_OP_bit_piece.  */
 struct dwarf_expr_piece
 {
   enum dwarf_value_location location;
@@ -181,8 +181,10 @@
     } literal;
   } v;
 
-  /* The length of the piece, in bytes.  */
+  /* The length of the piece, in bits.  */
   ULONGEST size;
+  /* The piece offset, in bits.  */
+  ULONGEST offset;
 };
 
 struct dwarf_expr_context *new_dwarf_expr_context (void);
--- src/gdb/dwarf2loc.c	2010/05/21 21:01:46	1.80
+++ src/gdb/dwarf2loc.c	2010/05/21 21:13:11	1.81
@@ -259,52 +259,245 @@
   return c;
 }
 
+/* The lowest-level function to extract bits from a byte buffer.
+   SOURCE is the buffer.  It is updated if we read to the end of a
+   byte.
+   SOURCE_OFFSET_BITS is the offset of the first bit to read.  It is
+   updated to reflect the number of bits actually read.
+   NBITS is the number of bits we want to read.  It is updated to
+   reflect the number of bits actually read.  This function may read
+   fewer bits.
+   BITS_BIG_ENDIAN is taken directly from gdbarch.
+   This function returns the extracted bits.  */
+
+static unsigned int
+extract_bits_primitive (const gdb_byte **source,
+			unsigned int *source_offset_bits,
+			int *nbits, int bits_big_endian)
+{
+  unsigned int avail, mask, datum;
+
+  gdb_assert (*source_offset_bits < 8);
+
+  avail = 8 - *source_offset_bits;
+  if (avail > *nbits)
+    avail = *nbits;
+
+  mask = (1 << avail) - 1;
+  datum = **source;
+  if (bits_big_endian)
+    datum >>= 8 - (*source_offset_bits + *nbits);
+  else
+    datum >>= *source_offset_bits;
+  datum &= mask;
+
+  *nbits -= avail;
+  *source_offset_bits += avail;
+  if (*source_offset_bits >= 8)
+    {
+      *source_offset_bits -= 8;
+      ++*source;
+    }
+
+  return datum;
+}
+
+/* Extract some bits from a source buffer and move forward in the
+   buffer.
+   
+   SOURCE is the source buffer.  It is updated as bytes are read.
+   SOURCE_OFFSET_BITS is the offset into SOURCE.  It is updated as
+   bits are read.
+   NBITS is the number of bits to read.
+   BITS_BIG_ENDIAN is taken directly from gdbarch.
+   
+   This function returns the bits that were read.  */
+
+static unsigned int
+extract_bits (const gdb_byte **source, unsigned int *source_offset_bits,
+	      int nbits, int bits_big_endian)
+{
+  unsigned int datum;
+
+  gdb_assert (nbits > 0 && nbits <= 8);
+
+  datum = extract_bits_primitive (source, source_offset_bits, &nbits,
+				  bits_big_endian);
+  if (nbits > 0)
+    {
+      unsigned int more;
+
+      more = extract_bits_primitive (source, source_offset_bits, &nbits,
+				     bits_big_endian);
+      if (bits_big_endian)
+	datum <<= nbits;
+      else
+	more <<= nbits;
+      datum |= more;
+    }
+
+  return datum;
+}
+
+/* Write some bits into a buffer and move forward in the buffer.
+   
+   DATUM is the bits to write.  The low-order bits of DATUM are used.
+   DEST is the destination buffer.  It is updated as bytes are
+   written.
+   DEST_OFFSET_BITS is the bit offset in DEST at which writing is
+   done.
+   NBITS is the number of valid bits in DATUM.
+   BITS_BIG_ENDIAN is taken directly from gdbarch.  */
+
+static void
+insert_bits (unsigned int datum,
+	     gdb_byte *dest, unsigned int dest_offset_bits,
+	     int nbits, int bits_big_endian)
+{
+  unsigned int mask;
+
+  gdb_assert (dest_offset_bits >= 0 && dest_offset_bits + nbits <= 8);
+
+  mask = (1 << nbits) - 1;
+  if (bits_big_endian)
+    {
+      datum <<= 8 - (dest_offset_bits + nbits);
+      mask <<= 8 - (dest_offset_bits + nbits);
+    }
+  else
+    {
+      datum <<= dest_offset_bits;
+      mask <<= dest_offset_bits;
+    }
+
+  gdb_assert ((datum & ~mask) == 0);
+
+  *dest = (*dest & ~mask) | datum;
+}
+
+/* Copy bits from a source to a destination.
+   
+   DEST is where the bits should be written.
+   DEST_OFFSET_BITS is the bit offset into DEST.
+   SOURCE is the source of bits.
+   SOURCE_OFFSET_BITS is the bit offset into SOURCE.
+   BIT_COUNT is the number of bits to copy.
+   BITS_BIG_ENDIAN is taken directly from gdbarch.  */
+
+static void
+copy_bitwise (gdb_byte *dest, unsigned int dest_offset_bits,
+	      const gdb_byte *source, unsigned int source_offset_bits,
+	      unsigned int bit_count,
+	      int bits_big_endian)
+{
+  unsigned int dest_avail;
+  int datum;
+
+  /* Reduce everything to byte-size pieces.  */
+  dest += dest_offset_bits / 8;
+  dest_offset_bits %= 8;
+  source += source_offset_bits / 8;
+  source_offset_bits %= 8;
+
+  dest_avail = 8 - dest_offset_bits % 8;
+
+  /* See if we can fill the first destination byte.  */
+  if (dest_avail < bit_count)
+    {
+      datum = extract_bits (&source, &source_offset_bits, dest_avail,
+			    bits_big_endian);
+      insert_bits (datum, dest, dest_offset_bits, dest_avail, bits_big_endian);
+      ++dest;
+      dest_offset_bits = 0;
+      bit_count -= dest_avail;
+    }
+
+  /* Now, either DEST_OFFSET_BITS is byte-aligned, or we have fewer
+     than 8 bits remaining.  */
+  gdb_assert (dest_offset_bits % 8 == 0 || bit_count < 8);
+  for (; bit_count >= 8; bit_count -= 8)
+    {
+      datum = extract_bits (&source, &source_offset_bits, 8, bits_big_endian);
+      *dest++ = (gdb_byte) datum;
+    }
+
+  /* Finally, we may have a few leftover bits.  */
+  gdb_assert (bit_count <= 8 - dest_offset_bits % 8);
+  if (bit_count > 0)
+    {
+      datum = extract_bits (&source, &source_offset_bits, bit_count,
+			    bits_big_endian);
+      insert_bits (datum, dest, dest_offset_bits, bit_count, bits_big_endian);
+    }
+}
+
 static void
 read_pieced_value (struct value *v)
 {
   int i;
   long offset = 0;
-  ULONGEST bytes_to_skip;
+  ULONGEST bits_to_skip;
   gdb_byte *contents;
   struct piece_closure *c = (struct piece_closure *) value_computed_closure (v);
   struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (v));
   size_t type_len;
+  size_t buffer_size = 0;
+  char *buffer = NULL;
+  struct cleanup *cleanup;
+  int bits_big_endian
+    = gdbarch_bits_big_endian (get_type_arch (value_type (v)));
 
   if (value_type (v) != value_enclosing_type (v))
     internal_error (__FILE__, __LINE__,
 		    _("Should not be able to create a lazy value with "
 		      "an enclosing type"));
 
+  cleanup = make_cleanup (free_current_contents, &buffer);
+
   contents = value_contents_raw (v);
-  bytes_to_skip = value_offset (v);
-  type_len = TYPE_LENGTH (value_type (v));
+  bits_to_skip = 8 * value_offset (v);
+  type_len = 8 * TYPE_LENGTH (value_type (v));
+
   for (i = 0; i < c->n_pieces && offset < type_len; i++)
     {
       struct dwarf_expr_piece *p = &c->pieces[i];
-      size_t this_size;
-      long dest_offset, source_offset;
-
-      if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
+      size_t this_size, this_size_bits;
+      long dest_offset_bits, source_offset_bits, source_offset;
+      gdb_byte *intermediate_buffer;
+
+      /* Compute size, source, and destination offsets for copying, in
+	 bits.  */
+      this_size_bits = p->size;
+      if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
 	{
-	  bytes_to_skip -= p->size;
+	  bits_to_skip -= this_size_bits;
 	  continue;
 	}
-      this_size = p->size;
-      if (this_size > type_len - offset)
-	this_size = type_len - offset;
-      if (bytes_to_skip > 0)
-	{
-	  dest_offset = 0;
-	  source_offset = bytes_to_skip;
-	  this_size -= bytes_to_skip;
-	  bytes_to_skip = 0;
+      if (this_size_bits > type_len - offset)
+	this_size_bits = type_len - offset;
+      if (bits_to_skip > 0)
+	{
+	  dest_offset_bits = 0;
+	  source_offset_bits = bits_to_skip;
+	  this_size_bits -= bits_to_skip;
+	  bits_to_skip = 0;
 	}
       else
 	{
-	  dest_offset = offset;
-	  source_offset = 0;
+	  dest_offset_bits = offset;
+	  source_offset_bits = 0;
+	}
+
+      this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
+      source_offset = source_offset_bits / 8;
+      if (buffer_size < this_size)
+	{
+	  buffer_size = this_size;
+	  buffer = xrealloc (buffer, buffer_size);
 	}
+      intermediate_buffer = buffer;
 
+      /* Copy from the source to DEST_BUFFER.  */
       switch (p->location)
 	{
 	case DWARF_VALUE_REGISTER:
@@ -316,13 +509,18 @@
 
 	    if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
 		&& this_size < register_size (arch, gdb_regnum))
-	      /* Big-endian, and we want less than full size.  */
-	      reg_offset = register_size (arch, gdb_regnum) - this_size;
+	      {
+		/* Big-endian, and we want less than full size.  */
+		reg_offset = register_size (arch, gdb_regnum) - this_size;
+		/* We want the lower-order THIS_SIZE_BITS of the bytes
+		   we extract from the register.  */
+		source_offset_bits += 8 * this_size - this_size_bits;
+	      }
 
 	    if (gdb_regnum != -1)
 	      {
 		get_frame_register_bytes (frame, gdb_regnum, reg_offset, 
-					  this_size, contents + dest_offset);
+					  this_size, buffer);
 	      }
 	    else
 	      {
@@ -334,11 +532,9 @@
 
 	case DWARF_VALUE_MEMORY:
 	  if (p->v.expr.in_stack_memory)
-	    read_stack (p->v.expr.value + source_offset,
-			contents + dest_offset, this_size);
+	    read_stack (p->v.expr.value + source_offset, buffer, this_size);
 	  else
-	    read_memory (p->v.expr.value + source_offset,
-			 contents + dest_offset, this_size);
+	    read_memory (p->v.expr.value + source_offset, buffer, this_size);
 	  break;
 
 	case DWARF_VALUE_STACK:
@@ -355,7 +551,7 @@
 		/* Nothing.  */
 	      }
 	    else if (source_offset == 0)
-	      store_unsigned_integer (contents + dest_offset, n,
+	      store_unsigned_integer (buffer, n,
 				      gdbarch_byte_order (gdbarch),
 				      p->v.expr.value);
 	    else
@@ -365,7 +561,7 @@
 		store_unsigned_integer (bytes, n + source_offset,
 					gdbarch_byte_order (gdbarch),
 					p->v.expr.value);
-		memcpy (contents + dest_offset, bytes + source_offset, n);
+		memcpy (buffer, bytes + source_offset, n);
 	      }
 	  }
 	  break;
@@ -379,8 +575,7 @@
 		   ? p->v.literal.length - source_offset
 		   : 0);
 	    if (n != 0)
-	      memcpy (contents + dest_offset,
-		      p->v.literal.data + source_offset, n);
+	      intermediate_buffer = p->v.literal.data + source_offset;
 	  }
 	  break;
 
@@ -388,17 +583,25 @@
 	  /* We just leave the bits empty for now.  This is not ideal
 	     but gdb currently does not have a nice way to represent
 	     optimized-out pieces.  */
-	  warning (_("bytes %ld-%ld in computed object were optimized out; "
+	  warning (_("bits %ld-%ld in computed object were optimized out; "
 		     "replacing with zeroes"),
 		   offset,
-		   offset + (long) this_size);
+		   offset + (long) this_size_bits);
 	  break;
 
 	default:
 	  internal_error (__FILE__, __LINE__, _("invalid location type"));
 	}
-      offset += this_size;
+
+      if (p->location != DWARF_VALUE_OPTIMIZED_OUT)
+	copy_bitwise (contents, dest_offset_bits,
+		      intermediate_buffer, source_offset_bits % 8,
+		      this_size_bits, bits_big_endian);
+
+      offset += this_size_bits;
     }
+
+  do_cleanups (cleanup);
 }
 
 static void
@@ -406,11 +609,16 @@
 {
   int i;
   long offset = 0;
-  ULONGEST bytes_to_skip;
+  ULONGEST bits_to_skip;
   const gdb_byte *contents;
   struct piece_closure *c = (struct piece_closure *) value_computed_closure (to);
   struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (to));
   size_t type_len;
+  size_t buffer_size = 0;
+  char *buffer = NULL;
+  struct cleanup *cleanup;
+  int bits_big_endian
+    = gdbarch_bits_big_endian (get_type_arch (value_type (to)));
 
   if (frame == NULL)
     {
@@ -418,34 +626,57 @@
       return;
     }
 
+  cleanup = make_cleanup (free_current_contents, &buffer);
+
   contents = value_contents (from);
-  bytes_to_skip = value_offset (to);
-  type_len = TYPE_LENGTH (value_type (to));
+  bits_to_skip = 8 * value_offset (to);
+  type_len = 8 * TYPE_LENGTH (value_type (to));
   for (i = 0; i < c->n_pieces && offset < type_len; i++)
     {
       struct dwarf_expr_piece *p = &c->pieces[i];
-      size_t this_size;
-      long dest_offset, source_offset;
+      size_t this_size_bits, this_size;
+      long dest_offset_bits, source_offset_bits, dest_offset, source_offset;
+      int need_bitwise;
+      const gdb_byte *source_buffer;
 
-      if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
+      this_size_bits = p->size;
+      if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
 	{
-	  bytes_to_skip -= p->size;
+	  bits_to_skip -= this_size_bits;
 	  continue;
 	}
-      this_size = p->size;
-      if (this_size > type_len - offset)
-	this_size = type_len - offset;
-      if (bytes_to_skip > 0)
-	{
-	  dest_offset = bytes_to_skip;
-	  source_offset = 0;
-	  this_size -= bytes_to_skip;
-	  bytes_to_skip = 0;
+      if (this_size_bits > type_len - offset)
+	this_size_bits = type_len - offset;
+      if (bits_to_skip > 0)
+	{
+	  dest_offset_bits = bits_to_skip;
+	  source_offset_bits = 0;
+	  this_size_bits -= bits_to_skip;
+	  bits_to_skip = 0;
+	}
+      else
+	{
+	  dest_offset_bits = 0;
+	  source_offset_bits = offset;
+	}
+
+      this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
+      source_offset = source_offset_bits / 8;
+      dest_offset = dest_offset_bits / 8;
+      if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0)
+	{
+	  source_buffer = contents + source_offset;
+	  need_bitwise = 0;
 	}
       else
 	{
-	  dest_offset = 0;
-	  source_offset = offset;
+	  if (buffer_size < this_size)
+	    {
+	      buffer_size = this_size;
+	      buffer = xrealloc (buffer, buffer_size);
+	    }
+	  source_buffer = buffer;
+	  need_bitwise = 1;
 	}
 
       switch (p->location)
@@ -463,8 +694,18 @@
 
 	    if (gdb_regnum != -1)
 	      {
+		if (need_bitwise)
+		  {
+		    get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+					      this_size, buffer);
+		    copy_bitwise (buffer, dest_offset_bits,
+				  contents, source_offset_bits,
+				  this_size_bits,
+				  bits_big_endian);
+		  }
+
 		put_frame_register_bytes (frame, gdb_regnum, reg_offset, 
-					  this_size, contents + source_offset);
+					  this_size, source_buffer);
 	      }
 	    else
 	      {
@@ -474,15 +715,31 @@
 	  }
 	  break;
 	case DWARF_VALUE_MEMORY:
+	  if (need_bitwise)
+	    {
+	      /* Only the first and last bytes can possibly have any
+		 bits reused.  */
+	      read_memory (p->v.expr.value + dest_offset, buffer, 1);
+	      read_memory (p->v.expr.value + dest_offset + this_size - 1,
+			   buffer + this_size - 1, 1);
+	      copy_bitwise (buffer, dest_offset_bits,
+			    contents, source_offset_bits,
+			    this_size_bits,
+			    bits_big_endian);
+	    }
+
 	  write_memory (p->v.expr.value + dest_offset,
-			contents + source_offset, this_size);
+			source_buffer, this_size);
 	  break;
 	default:
 	  set_value_optimized_out (to, 1);
-	  return;
+	  goto done;
 	}
-      offset += this_size;
+      offset += this_size_bits;
     }
+
+ done:
+  do_cleanups (cleanup);
 }
 
 static void *
--- src/gdb/testsuite/gdb.dwarf2/pieces.S	2010/05/21 21:01:46	1.2
+++ src/gdb/testsuite/gdb.dwarf2/pieces.S	2010/05/21 21:13:13	1.3
@@ -989,23 +989,18 @@
 .LLST6:
 	.long	.LVL13-.Ltext0	# Location list begin address (*.LLST6)
 	.long	.LVL14-.Ltext0	# Location list end address (*.LLST6)
-	.value	0xa	# Location expression size
-	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
-	.uleb128 0
+	.value	0x8	# Location expression size
 	.byte	0x34	# DW_OP_lit4
 	.byte	0x9f	# DW_OP_stack_value
 	.byte	0x9d	# DW_OP_bit_piece
 	.uleb128 0xc
 	.uleb128 0
-	.byte	0x93	# DW_OP_piece
-	.uleb128 0x2
-	.long	.LVL14-.Ltext0	# Location list begin address (*.LLST6)
-	.long	.LVL15-.Ltext0	# Location list end address (*.LLST6)
-	.value	0x15	# Location expression size
 	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
+	.uleb128 0x14
 	.uleb128 0
+	.long	.LVL14-.Ltext0	# Location list begin address (*.LLST6)
+	.long	.LVL15-.Ltext0	# Location list end address (*.LLST6)
+	.value	0x11	# Location expression size
 	.byte	0x34	# DW_OP_lit4
 	.byte	0x9f	# DW_OP_stack_value
 	.byte	0x9d	# DW_OP_bit_piece
@@ -1021,15 +1016,11 @@
 	.byte	0x9d	# DW_OP_bit_piece
 	.uleb128 0xc
 	.uleb128 0
-	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
-	.uleb128 0
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x1
 	.long	.LVL15-.Ltext0	# Location list begin address (*.LLST6)
 	.long	.LVL16-1-.Ltext0	# Location list end address (*.LLST6)
-	.value	0x14	# Location expression size
-	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
-	.uleb128 0
+	.value	0x10	# Location expression size
 	.byte	0x52	# DW_OP_reg2
 	.byte	0x9d	# DW_OP_bit_piece
 	.uleb128 0xc
@@ -1044,15 +1035,11 @@
 	.byte	0x9d	# DW_OP_bit_piece
 	.uleb128 0xc
 	.uleb128 0
-	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
-	.uleb128 0
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x1
 	.long	.LVL16-1-.Ltext0	# Location list begin address (*.LLST6)
 	.long	.LVL17-.Ltext0	# Location list end address (*.LLST6)
-	.value	0x14	# Location expression size
-	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
-	.uleb128 0
+	.value	0x10	# Location expression size
 	.byte	0x56	# DW_OP_reg6
 	.byte	0x9d	# DW_OP_bit_piece
 	.uleb128 0xc
@@ -1067,14 +1054,14 @@
 	.byte	0x9d	# DW_OP_bit_piece
 	.uleb128 0xc
 	.uleb128 0
-	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
-	.uleb128 0
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x1
 	.long	.LVL17-.Ltext0	# Location list begin address (*.LLST6)
 	.long	.LFE3-.Ltext0	# Location list end address (*.LLST6)
 	.value	0xf	# Location expression size
-	.byte	0x93	# DW_OP_piece
-	.uleb128 0x2
+	.byte	0x9d	# DW_OP_bit_piece
+	.uleb128 0xc
+	.uleb128 0
 	.byte	0x91	# DW_OP_fbreg
 	.sleb128 0
 	.byte	0x94	# DW_OP_deref_size
@@ -1085,9 +1072,8 @@
 	.byte	0x9d	# DW_OP_bit_piece
 	.uleb128 0xc
 	.uleb128 0
-	.byte	0x9d	# DW_OP_bit_piece
-	.uleb128 0x4
-	.uleb128 0
+	.byte	0x93	# DW_OP_piece
+	.uleb128 0x1
 	.long	0	# Location list terminator begin (*.LLST6)
 	.long	0	# Location list terminator end (*.LLST6)
 .LLST7:
@@ -1356,7 +1342,7 @@
 	.long	0x48	# DW_AT_type
 	.byte	0x4	# DW_AT_byte_size
 	.byte	0xc	# DW_AT_bit_size
-	.byte	0x10	# DW_AT_bit_offset
+	.byte	0x14	# DW_AT_bit_offset
 	.byte	0x2	# DW_AT_data_member_location
 	.byte	0x23	# DW_OP_plus_uconst
 	.uleb128 0
@@ -1367,7 +1353,7 @@
 	.long	0x48	# DW_AT_type
 	.byte	0x4	# DW_AT_byte_size
 	.byte	0xc	# DW_AT_bit_size
-	.byte	0x4	# DW_AT_bit_offset
+	.byte	0x8	# DW_AT_bit_offset
 	.byte	0x2	# DW_AT_data_member_location
 	.byte	0x23	# DW_OP_plus_uconst
 	.uleb128 0
--- src/gdb/testsuite/gdb.dwarf2/pieces.c	2010/05/21 21:01:46	1.2
+++ src/gdb/testsuite/gdb.dwarf2/pieces.c	2010/05/21 21:13:13	1.3
@@ -21,7 +21,7 @@
    However, it is used to extract breakpoint line numbers.  */
 
 struct A { int i; int j; };
-struct B { int : 4; int i : 12; int j : 12; int : 4; };
+struct B { int i : 12; int j : 12; int : 4; };
 struct C { int i; int j; int q; };
 
 __attribute__((noinline)) void
@@ -89,7 +89,7 @@
 f6 (int k)
 {
   int z = 23;
-  struct C a = { k, k, z};
+  struct C a = { k, k, z };
   asm ("" : "+r" (a.i));
   a.j++;
   bar (a.i);
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp	2010/05/21 21:01:46	1.3
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp	2010/05/21 21:13:13	1.4
@@ -67,15 +67,30 @@
     gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2"
 }
 
+# Function f3 tests DW_OP_bit_piece.
+proc pieces_test_f3 {} {
+    global csrcfile
+    set line [gdb_get_line_number "f3 breakpoint" $csrcfile]
+    gdb_test "break pieces.c:$line" "Breakpoint 4.*" \
+       "set f3 breakpoint for pieces"
+    gdb_continue_to_breakpoint "continue to f3 breakpoint for pieces"
+    gdb_test "print a.i" " = 4" "print a.i in pieces:f3"
+    gdb_test "print a.j" " = 14" "print a.j in pieces:f3"
+    # Right now gdb says "value optimized out" here, but that is wrong.
+    setup_kfail "no bug yet" *-*-*
+    gdb_test "print a.i = 7" " = 7" "set a.i in pieces:f3"
+    gdb_test "print a.i" " = 7" "print new a.i in pieces:f3"
+}
+
 # Function f6 tests for an empty DW_OP_piece.
 proc pieces_test_f6 {} {
     global csrcfile
     set line [gdb_get_line_number "f6 breakpoint" $csrcfile]
-    gdb_test "break pieces.c:$line" "Breakpoint 4.*" \
+    gdb_test "break pieces.c:$line" "Breakpoint 5.*" \
        "set f6 breakpoint for pieces"
     gdb_continue_to_breakpoint "continue to f6 breakpoint for pieces"
     gdb_test "print a" \
-	"warning: bytes .* in computed object were.* = {i = 7, j = 8, q = 0}" \
+	"warning: bits .* in computed object were.* = {i = 7, j = 8, q = 0}" \
 	"print a with optimized out piece"
     # Note: no warning for this case.
     gdb_test_multiple "print a.i" \
@@ -91,4 +106,5 @@
 
 pieces_test_f1
 pieces_test_f2
+pieces_test_f3
 pieces_test_f6

gdb-bz594560-core-vs-process.patch:
 doc/gdb.texinfo                 |   42 ++++++++++------------------
 infcmd.c                        |   14 +++++++++
 testsuite/gdb.base/corefile.exp |   59 ++++++++++++++++++++++++++++++++++++++++
 testsuite/gdb.base/coremaker.c  |    8 ++++-
 4 files changed, 95 insertions(+), 28 deletions(-)

--- NEW FILE gdb-bz594560-core-vs-process.patch ---
--- ./gdb/doc/gdb.texinfo	2010-05-24 19:37:01.000000000 +0200
+++ ./gdb/doc/gdb.texinfo	2010-05-24 19:38:56.000000000 +0200
@@ -14768,33 +14768,21 @@ and @code{show architecture}.
 @cindex active targets
 @cindex multiple targets
 
-There are three classes of targets: processes, core files, and
-executable files.  @value{GDBN} can work concurrently on up to three
-active targets, one in each class.  This allows you to (for example)
-start a process and inspect its activity without abandoning your work on
-a core file.
-
-For example, if you execute @samp{gdb a.out}, then the executable file
- at code{a.out} is the only active target.  If you designate a core file as
-well---presumably from a prior run that crashed and coredumped---then
- at value{GDBN} has two active targets and uses them in tandem, looking
-first in the corefile target, then in the executable file, to satisfy
-requests for memory addresses.  (Typically, these two classes of target
-are complementary, since core files contain only a program's
-read-write memory---variables and so on---plus machine status, while
-executable files contain only the program text and initialized data.)
-
-When you type @code{run}, your executable file becomes an active process
-target as well.  When a process target is active, all @value{GDBN}
-commands requesting memory addresses refer to that target; addresses in
-an active core file or executable file target are obscured while the
-process target is active.
-
-Use the @code{core-file} and @code{exec-file} commands to select a new
-core file or executable target (@pxref{Files, ,Commands to Specify
-Files}).  To specify as a target a process that is already running, use
-the @code{attach} command (@pxref{Attach, ,Debugging an Already-running
-Process}).
+There are multiple classes of targets such as: processes, executable files or
+recording sessions.  Core files belong to the process class, there can be
+active only one of a core or a running process.  Otherwise @value{GDBN} can
+work concurrently on multiple active targets, one in each class.  This allows
+you to (for example) start a process and inspect its activity while still
+having access to the executable file after the process finishes.  Or if you
+start process recording (@pxref{Reverse Execution}) and @code{reverse-step}
+there you are presented a virtual layer of the recording target while the
+process target remains stopped at the chronologically last point of the process
+execution.
+
+Use the @code{core-file} and @code{exec-file} commands to select a new core
+file or executable target (@pxref{Files, ,Commands to Specify Files}).  To
+specify as a target a process that is already running, use the @code{attach}
+command (@pxref{Attach, ,Debugging an Already-running Process}).
 
 @node Target Commands
 @section Commands for Managing Targets
--- ./gdb/infcmd.c	2010-05-24 19:37:01.000000000 +0200
+++ ./gdb/infcmd.c	2010-05-24 19:41:21.000000000 +0200
@@ -483,6 +483,13 @@ run_command_1 (char *args, int from_tty,
 
   dont_repeat ();
 
+  if (core_bfd)
+    {
+      core_file_command (NULL, from_tty);
+      if (core_bfd)
+	warning (_("Core file not unloaded."));
+    }
+
   kill_if_already_running (from_tty);
 
   init_wait_for_inferior ();
@@ -2373,6 +2380,13 @@ attach_command (char *args, int from_tty
 	error (_("Not killed."));
     }
 
+  if (core_bfd)
+    {
+      core_file_command (NULL, from_tty);
+      if (core_bfd)
+	warning (_("Core file not unloaded."));
+    }
+
   /* Clean up any leftovers from other runs.  Some other things from
      this function should probably be moved into target_pre_inferior.  */
   target_pre_inferior (from_tty);
--- ./gdb/testsuite/gdb.base/corefile.exp	2010-01-09 01:14:11.000000000 +0100
+++ ./gdb/testsuite/gdb.base/corefile.exp	2010-05-24 19:38:56.000000000 +0200
@@ -182,3 +182,62 @@ gdb_load ${binfile}
 gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)"
 
 gdb_test "core" "No core file now."
+
+
+# Test a run (start) command will clear any loaded core file.
+
+gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
+gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
+
+set test "run: with core"
+if [runto_main] {
+    pass $test
+} else {
+    fail $test
+}
+
+set test "run: core file is cleared"
+gdb_test_multiple "info files" $test {
+    "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
+	fail $test
+    }
+    "\r\n$gdb_prompt $" {
+	pass $test
+    }
+}
+
+gdb_exit
+
+
+# Test an attach command will clear any loaded core file.
+
+if ![is_remote target] {
+    set test "attach: spawn sleep"
+    set res [remote_spawn host "$binfile sleep"];
+    if { $res < 0 || $res == "" } {
+	perror "$test failed."
+	fail $test
+	return
+    }
+    set pid [exp_pid -i $res]
+    # We do not care of the startup phase where it will be caught.
+
+    gdb_start
+
+    gdb_test "core-file $corefile" "Core was generated by .*" "attach: load core again"
+    gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "attach: sanity check we see the core file"
+
+    gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach: with core"
+
+    set test "attach: core file is cleared"
+    gdb_test_multiple "info files" $test {
+	"\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
+	    fail $test
+	}
+	"\r\n$gdb_prompt $" {
+	    pass $test
+	}
+    }
+
+    gdb_exit
+}
--- ./gdb/testsuite/gdb.base/coremaker.c	2010-01-01 08:32:00.000000000 +0100
+++ ./gdb/testsuite/gdb.base/coremaker.c	2010-05-24 19:38:56.000000000 +0200
@@ -133,8 +133,14 @@ func1 ()
   func2 ();
 }
 
-int main ()
+int
+main (int argc, char **argv)
 {
+  if (argc == 2 && strcmp (argv[1], "sleep") == 0)
+    {
+      sleep (60);
+      return 0;
+    }
   mmapdata ();
   func1 ();
   return 0;

gdb-bz595475-tui-layout.patch:
 gdb-7.1/gdb/testsuite/gdb.base/tui-layout.exp |   21 +++++++++++++++++++++
 src/gdb/tui/tui-disasm.c                      |    3 ++-
 src/gdb/tui/tui-layout.c                      |    3 ++-
 3 files changed, 25 insertions(+), 2 deletions(-)

--- NEW FILE gdb-bz595475-tui-layout.patch ---
https://bugzilla.redhat.com/show_bug.cgi?id=586566
http://sourceware.org/ml/gdb-patches/2010-03/msg00746.html
http://sourceware.org/ml/gdb-patches/2010-05/msg00551.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00194.html

### src/gdb/ChangeLog	2010/03/19 22:00:16	1.11508
### src/gdb/ChangeLog	2010/03/20 05:17:10	1.11509
## -1,3 +1,9 @@
+2010-03-20  Daniel Jacobowitz  <dan at codesourcery.com>
+
+	* tui/tui-disasm.c (tui_get_begin_asm_address): Default to
+	get_current_arch.
+	* tui/tui-layout.c (extract_display_start_addr): Likewise.
+
 2010-03-19  Stan Shebs  <stan at codesourcery.com>
 
 	* ax-gdb.c (gen_fetch): Handle bool.
--- src/gdb/tui/tui-disasm.c	2010/01/01 07:32:07	1.33
+++ src/gdb/tui/tui-disasm.c	2010/03/20 05:17:10	1.34
@@ -21,6 +21,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "arch-utils.h"
 #include "symtab.h"
 #include "breakpoint.h"
 #include "frame.h"
@@ -330,7 +331,7 @@
 {
   struct tui_gen_win_info *locator;
   struct tui_locator_element *element;
-  struct gdbarch *gdbarch = NULL;
+  struct gdbarch *gdbarch = get_current_arch ();
   CORE_ADDR addr;
 
   locator = tui_locator_win_info_ptr ();
--- src/gdb/tui/tui-layout.c	2010/01/01 07:32:07	1.36
+++ src/gdb/tui/tui-layout.c	2010/03/20 05:17:10	1.37
@@ -21,6 +21,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "arch-utils.h"
 #include "command.h"
 #include "symtab.h"
 #include "frame.h"
@@ -522,7 +523,7 @@
 extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
 {
   enum tui_layout_type cur_layout = tui_current_layout ();
-  struct gdbarch *gdbarch = NULL;
+  struct gdbarch *gdbarch = get_current_arch ();
   CORE_ADDR addr;
   CORE_ADDR pc;
   struct symtab_and_line cursal = get_current_source_symtab_and_line ();
--- /dev/null	2010-05-24 04:43:32.632794021 +0200
+++ gdb-7.1/gdb/testsuite/gdb.base/tui-layout.exp	2010-05-24 20:13:30.000000000 +0200
@@ -0,0 +1,21 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set testfile tui-layout
+if { [prepare_for_testing ${testfile}.exp ${testfile} start.c] } {
+    return -1
+}
+
+gdb_test "layout asm"

gdb-bz600746-koenig-crash.patch:
 gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.cc  |    7 +++++++
 gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.exp |    4 ++++
 src/gdb/cp-support.c                              |    3 +++
 3 files changed, 14 insertions(+)

--- NEW FILE gdb-bz600746-koenig-crash.patch ---
[patch] Fix ADL anonymous type crash
http://sourceware.org/ml/gdb-patches/2010-06/msg00004.html
http://sourceware.org/ml/gdb-cvs/2010-06/msg00012.html

[ Backported the testcase.  ]

### src/gdb/ChangeLog	2010/06/02 06:24:00	1.11862
### src/gdb/ChangeLog	2010/06/02 15:31:29	1.11863
## -1,3 +1,8 @@
+2010-06-02  Sami Wagiaalla  <swagiaal at redhat.com>
+
+	* cp-support.c (make_symbol_overload_list_adl_namespace): Handle
+	anonymous type case.
+
 2010-06-02  Pierre Muller  <muller at ics.u-strasbg.fr>
 
 	* dwarf2read.c (read_subrange_type): Handle missing base type
### src/gdb/testsuite/ChangeLog	2010/06/01 21:29:21	1.2298
### src/gdb/testsuite/ChangeLog	2010/06/02 15:31:30	1.2299
## -1,3 +1,8 @@
+2010-06-02  Sami Wagiaalla  <swagiaal at redhat.com>
+
+	* gdb.cp/namespace-koenig.exp: Added new test case.
+	* gdb.cp/namespace-koenig.cc: Ditto.
+
 2010-06-01  Michael Snyder  <msnyder at vmware.com>
 
 	* gdb.base/arithmet.exp: Use gdb_test_no_output.
--- src/gdb/cp-support.c	2010/05/13 23:53:32	1.40
+++ src/gdb/cp-support.c	2010/06/02 15:31:30	1.41
@@ -752,6 +752,9 @@
 
   type_name = TYPE_NAME (type);
 
+  if (type_name == NULL)
+    return;
+
   prefix_len = cp_entire_prefix_len (type_name);
 
   if (prefix_len != 0)
--- gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.cc.orig	2010-06-09 08:20:14.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.cc	2010-06-09 11:09:29.000000000 +0200
@@ -165,6 +165,13 @@ namespace M {
 
 }
 //------------
+static union {
+    int  a;
+    char b;
+}p_union;
+
+//------------
+
 int
 main ()
 {
--- gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.exp.orig	2010-06-09 08:20:14.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.exp	2010-06-09 11:09:48.000000000 +0200
@@ -110,3 +111,7 @@ gdb_test "p o + 5.0f" "= 22"
 gdb_test "p o + 5" "= 23"
 
 gdb_test "p o++" "= 24"
+
+#test that lookup is not thwarted by anonymous types
+gdb_test "p foo (p_union)" \
+  "Cannot resolve function foo to any overloaded instance"

gdb-bz601887-dwarf4-1of2.patch:
 dwarf2-frame.c |   19 +++++++++++
 dwarf2read.c   |   93 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 97 insertions(+), 15 deletions(-)

--- NEW FILE gdb-bz601887-dwarf4-1of2.patch ---
commit be1f57c90bdf86477b9bc69cc982171d6ad5df56
Author: Tom Tromey <tromey at redhat.com>
Date:   Tue Apr 20 17:33:13 2010 +0000

    	* dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4.
    	(struct dwarf2_cie) <segment_size>: New field.
    	* dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4.
    	(skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset,
    	DW_FORM_exprloc.
    	(read_attribute_value): Handle DW_FORM_flag_present,
    	DW_FORM_sec_offset, DW_FORM_exprloc.
    	(dump_die_shallow): Likewise.
    	(attr_form_is_section_offset): Handle DW_FORM_sec_offset.
    	(dwarf2_const_value): Handle DW_FORM_exprloc.
    	(attr_form_is_block): Likewise.
    	(struct line_header) <maximum_ops_per_instruction>: New field.
    	(dwarf_decode_line_header): Set new field.
    	(dwarf_decode_lines): Handle new field.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,20 @@
+2010-04-20  Tom Tromey  <tromey at redhat.com>
+
+	* dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4.
+	(struct dwarf2_cie) <segment_size>: New field.
+	* dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4.
+	(skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset,
+	DW_FORM_exprloc.
+	(read_attribute_value): Handle DW_FORM_flag_present,
+	DW_FORM_sec_offset, DW_FORM_exprloc.
+	(dump_die_shallow): Likewise.
+	(attr_form_is_section_offset): Handle DW_FORM_sec_offset.
+	(dwarf2_const_value): Handle DW_FORM_exprloc.
+	(attr_form_is_block): Likewise.
+	(struct line_header) <maximum_ops_per_instruction>: New field.
+	(dwarf_decode_line_header): Set new field.
+	(dwarf_decode_lines): Handle new field.
+
 2010-04-20  Jan Kratochvil  <jan.kratochvil at redhat.com>
 
 	* f-exp.y: Add new production to recognize the `logical*8' type.
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -85,6 +85,9 @@ struct dwarf2_cie
 
   /* The version recorded in the CIE.  */
   unsigned char version;
+
+  /* The segment size.  */
+  unsigned char segment_size;
 };
 
 struct dwarf2_cie_table
@@ -1714,7 +1717,7 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p,
 
       /* Check version number.  */
       cie_version = read_1_byte (unit->abfd, buf);
-      if (cie_version != 1 && cie_version != 3)
+      if (cie_version != 1 && cie_version != 3 && cie_version != 4)
 	return NULL;
       cie->version = cie_version;
       buf += 1;
@@ -1738,6 +1741,20 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p,
 	  augmentation += 2;
 	}
 
+      if (cie->version >= 4)
+	{
+	  /* FIXME: check that this is the same as from the CU header.  */
+	  cie->addr_size = read_1_byte (unit->abfd, buf);
+	  ++buf;
+	  cie->segment_size = read_1_byte (unit->abfd, buf);
+	  ++buf;
+	}
+      else
+	{
+	  cie->addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
+	  cie->segment_size = 0;
+	}
+
       cie->code_alignment_factor =
 	read_unsigned_leb128 (unit->abfd, buf, &bytes_read);
       buf += bytes_read;
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -396,6 +396,7 @@ struct line_header
   unsigned short version;
   unsigned int header_length;
   unsigned char minimum_instruction_length;
+  unsigned char maximum_ops_per_instruction;
   unsigned char default_is_stmt;
   int line_base;
   unsigned char line_range;
@@ -1488,10 +1489,10 @@ partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
 
   info_ptr = read_comp_unit_head (header, info_ptr, abfd);
 
-  if (header->version != 2 && header->version != 3)
+  if (header->version != 2 && header->version != 3 && header->version != 4)
     error (_("Dwarf Error: wrong version in compilation unit header "
-	   "(is %d, should be %d) [in module %s]"), header->version,
-	   2, bfd_get_filename (abfd));
+	   "(is %d, should be 2, 3, or 4) [in module %s]"), header->version,
+	   bfd_get_filename (abfd));
 
   if (header->abbrev_offset >= dwarf2_per_objfile->abbrev.size)
     error (_("Dwarf Error: bad offset (0x%lx) in compilation unit header "
@@ -2776,6 +2777,8 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr,
 	case DW_FORM_flag:
 	  info_ptr += 1;
 	  break;
+	case DW_FORM_flag_present:
+	  break;
 	case DW_FORM_data2:
 	case DW_FORM_ref2:
 	  info_ptr += 2;
@@ -2793,9 +2796,11 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr,
 	  read_string (abfd, info_ptr, &bytes_read);
 	  info_ptr += bytes_read;
 	  break;
+	case DW_FORM_sec_offset:
 	case DW_FORM_strp:
 	  info_ptr += cu->header.offset_size;
 	  break;
+	case DW_FORM_exprloc:
 	case DW_FORM_block:
 	  info_ptr += read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
 	  info_ptr += bytes_read;
@@ -7129,6 +7134,10 @@ read_attribute_value (struct attribute *attr, unsigned form,
       DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
       info_ptr += 8;
       break;
+    case DW_FORM_sec_offset:
+      DW_UNSND (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read);
+      info_ptr += bytes_read;
+      break;
     case DW_FORM_string:
       DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read);
       DW_STRING_IS_CANONICAL (attr) = 0;
@@ -7140,6 +7149,7 @@ read_attribute_value (struct attribute *attr, unsigned form,
       DW_STRING_IS_CANONICAL (attr) = 0;
       info_ptr += bytes_read;
       break;
+    case DW_FORM_exprloc:
     case DW_FORM_block:
       blk = dwarf_alloc_block (cu);
       blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
@@ -7164,6 +7174,9 @@ read_attribute_value (struct attribute *attr, unsigned form,
       DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
       info_ptr += 1;
       break;
+    case DW_FORM_flag_present:
+      DW_UNSND (attr) = 1;
+      break;
     case DW_FORM_sdata:
       DW_SND (attr) = read_signed_leb128 (abfd, info_ptr, &bytes_read);
       info_ptr += bytes_read;
@@ -7680,7 +7693,7 @@ dwarf2_attr_no_follow (struct die_info *die, unsigned int name,
 
 /* Return non-zero iff the attribute NAME is defined for the given DIE,
    and holds a non-zero value.  This function should only be used for
-   DW_FORM_flag attributes.  */
+   DW_FORM_flag or DW_FORM_flag_present attributes.  */
 
 static int
 dwarf2_flag_true_p (struct die_info *die, unsigned name, struct dwarf2_cu *cu)
@@ -7862,6 +7875,21 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd,
   line_ptr += offset_size;
   lh->minimum_instruction_length = read_1_byte (abfd, line_ptr);
   line_ptr += 1;
+  if (lh->version >= 4)
+    {
+      lh->maximum_ops_per_instruction = read_1_byte (abfd, line_ptr);
+      line_ptr += 1;
+    }
+  else
+    lh->maximum_ops_per_instruction = 1;
+
+  if (lh->maximum_ops_per_instruction == 0)
+    {
+      lh->maximum_ops_per_instruction = 1;
+      complaint (&symfile_complaints,
+		 _("invalid maximum_ops_per_instruction in `.debug_line' section"));
+    }
+
   lh->default_is_stmt = read_1_byte (abfd, line_ptr);
   line_ptr += 1;
   lh->line_base = read_1_signed_byte (abfd, line_ptr);
@@ -8010,6 +8038,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
       int basic_block = 0;
       int end_sequence = 0;
       CORE_ADDR addr;
+      unsigned char op_index = 0;
 
       if (!decode_for_pst_p && lh->num_file_names >= file)
 	{
@@ -8041,12 +8070,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
 	    {		
 	      /* Special operand.  */
 	      adj_opcode = op_code - lh->opcode_base;
-	      address += (adj_opcode / lh->line_range)
-		* lh->minimum_instruction_length;
+	      address += (((op_index + (adj_opcode / lh->line_range))
+			   / lh->maximum_ops_per_instruction)
+			  * lh->minimum_instruction_length);
+	      op_index = ((op_index + (adj_opcode / lh->line_range))
+			  % lh->maximum_ops_per_instruction);
 	      line += lh->line_base + (adj_opcode % lh->line_range);
 	      if (lh->num_file_names < file || file == 0)
 		dwarf2_debug_line_missing_file_complaint ();
-	      else
+	      /* For now we ignore lines not starting on an
+		 instruction boundary.  */
+	      else if (op_index == 0)
 		{
 		  lh->file_names[file - 1].included_p = 1;
 		  if (!decode_for_pst_p && is_stmt)
@@ -8081,6 +8115,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
 		  break;
 		case DW_LNE_set_address:
 		  address = read_address (abfd, line_ptr, cu, &bytes_read);
+		  op_index = 0;
 		  line_ptr += bytes_read;
 		  address += baseaddr;
 		  break;
@@ -8146,9 +8181,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
 	      basic_block = 0;
 	      break;
 	    case DW_LNS_advance_pc:
-	      address += lh->minimum_instruction_length
-		* read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
-	      line_ptr += bytes_read;
+	      {
+		CORE_ADDR adjust
+		  = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+
+		address += (((op_index + adjust)
+			     / lh->maximum_ops_per_instruction)
+			    * lh->minimum_instruction_length);
+		op_index = ((op_index + adjust)
+			    % lh->maximum_ops_per_instruction);
+		line_ptr += bytes_read;
+	      }
 	      break;
 	    case DW_LNS_advance_line:
 	      line += read_signed_leb128 (abfd, line_ptr, &bytes_read);
@@ -8195,11 +8238,19 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
 	       instruction length since special opcode 255 would have
 	       scaled the the increment.  */
 	    case DW_LNS_const_add_pc:
-	      address += (lh->minimum_instruction_length
-			  * ((255 - lh->opcode_base) / lh->line_range));
+	      {
+		CORE_ADDR adjust = (255 - lh->opcode_base) / lh->line_range;
+
+		address += (((op_index + adjust)
+			     / lh->maximum_ops_per_instruction)
+			    * lh->minimum_instruction_length);
+		op_index = ((op_index + adjust)
+			    % lh->maximum_ops_per_instruction);
+	      }
 	      break;
 	    case DW_LNS_fixed_advance_pc:
 	      address += read_2_bytes (abfd, line_ptr);
+	      op_index = 0;
 	      line_ptr += 2;
 	      break;
 	    default:
@@ -8761,6 +8812,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
     case DW_FORM_block2:
     case DW_FORM_block4:
     case DW_FORM_block:
+    case DW_FORM_exprloc:
       blk = DW_BLOCK (attr);
       if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != blk->size)
 	dwarf2_const_value_length_mismatch_complaint (SYMBOL_PRINT_NAME (sym),
@@ -10308,6 +10360,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	case DW_FORM_block1:
 	  fprintf_unfiltered (f, "block: size %d", DW_BLOCK (&die->attrs[i])->size);
 	  break;
+	case DW_FORM_exprloc:
+	  fprintf_unfiltered (f, "expression: size %u",
+			      DW_BLOCK (&die->attrs[i])->size);
+	  break;
 	case DW_FORM_ref1:
 	case DW_FORM_ref2:
 	case DW_FORM_ref4:
@@ -10323,6 +10379,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	  fprintf_unfiltered (f, "constant: %s",
 			      pulongest (DW_UNSND (&die->attrs[i])));
 	  break;
+	case DW_FORM_sec_offset:
+	  fprintf_unfiltered (f, "section offset: %s",
+			      pulongest (DW_UNSND (&die->attrs[i])));
+	  break;
 	case DW_FORM_sig8:
 	  if (DW_SIGNATURED_TYPE (&die->attrs[i]) != NULL)
 	    fprintf_unfiltered (f, "signatured type, offset: 0x%x",
@@ -10343,6 +10403,9 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	  else
 	    fprintf_unfiltered (f, "flag: FALSE");
 	  break;
+	case DW_FORM_flag_present:
+	  fprintf_unfiltered (f, "flag: TRUE");
+	  break;
 	case DW_FORM_indirect:
 	  /* the reader will have reduced the indirect form to
 	     the "base form" so this form should not occur */
@@ -11520,7 +11583,8 @@ attr_form_is_block (struct attribute *attr)
       attr->form == DW_FORM_block1
       || attr->form == DW_FORM_block2
       || attr->form == DW_FORM_block4
-      || attr->form == DW_FORM_block);
+      || attr->form == DW_FORM_block
+      || attr->form == DW_FORM_exprloc);
 }
 
 /* Return non-zero if ATTR's value is a section offset --- classes
@@ -11535,7 +11599,8 @@ static int
 attr_form_is_section_offset (struct attribute *attr)
 {
   return (attr->form == DW_FORM_data4
-          || attr->form == DW_FORM_data8);
+          || attr->form == DW_FORM_data8
+	  || attr->form == DW_FORM_sec_offset);
 }
 
 

gdb-bz601887-dwarf4-2of2.patch:
 dwarf2read.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- NEW FILE gdb-bz601887-dwarf4-2of2.patch ---
commit 669907bd6d54ae8e85b1278f0f16f8641ce6802d
Author: Tom Tromey <tromey at redhat.com>
Date:   Tue Apr 20 21:19:07 2010 +0000

    	* dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name.
    	(read_partial_die): Likewise.
    	(dwarf_attr_name): Likewise.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,9 @@
+2010-04-20  Tom Tromey  <tromey at redhat.com>
+
+	* dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name.
+	(read_partial_die): Likewise.
+	(dwarf_attr_name): Likewise.
+
 2010-04-20  Chris Moller  <cmoller at redhat.com>
 	
 	PR 10867
--- gdb-7.1/gdb/dwarf2read.c.orig	2010-06-09 14:38:01.000000000 +0200
+++ gdb-7.1/gdb/dwarf2read.c	2010-06-09 14:49:53.000000000 +0200
@@ -7675,7 +7675,11 @@ read_partial_die (struct partial_die_inf
 	      break;
 	    }
 	  break;
+	case DW_AT_linkage_name:
 	case DW_AT_MIPS_linkage_name:
+	  /* Note that both forms of linkage name might appear.  We
+	     assume they will be the same, and we only store the last
+	     one we see.  */
 	  if (cu->language == language_ada)
 	    part_die->name = DW_STRING (&attr);
 	  break;
@@ -10167,7 +10171,11 @@ dwarf2_name (struct die_info *die, struc
   struct attribute *attr = NULL;
 
   if (cu->language == language_ada)
-    attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+    {
+      attr = dwarf2_attr (die, DW_AT_linkage_name, cu);
+      if (attr == NULL)
+	attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+    }
 
   if (!attr)
     attr = dwarf2_attr (die, DW_AT_name, cu);
@@ -10555,6 +10563,8 @@ dwarf_attr_name (unsigned attr)
     /* DWARF 4 values.  */
     case DW_AT_signature:
       return "DW_AT_signature";
+    case DW_AT_linkage_name:
+      return "DW_AT_linkage_name";
     /* SGI/MIPS extensions.  */
 #ifdef MIPS /* collides with DW_AT_HP_block_index */
     case DW_AT_MIPS_fde:

gdb-bz601887-dwarf4-rh-test.patch:
 rh-dwarf4-x86_64.S   |  167 +++++++++++++++++++++++++++++++++++++++++++++++++++
 rh-dwarf4-x86_64.c   |   22 ++++++
 rh-dwarf4-x86_64.exp |   42 ++++++++++++
 3 files changed, 231 insertions(+)

--- NEW FILE gdb-bz601887-dwarf4-rh-test.patch ---
--- /dev/null	2010-06-08 20:35:46.800278452 +0200
+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S	2010-06-09 15:22:57.000000000 +0200
@@ -0,0 +1,167 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+	.file	"rh-dwarf4-x86_64.c"
+	.section	.debug_abbrev,"", at progbits
+.Ldebug_abbrev0:
+	.section	.debug_info,"", at progbits
+.Ldebug_info0:
+	.section	.debug_line,"", at progbits
+.Ldebug_line0:
+	.text
+.Ltext0:
+.globl main
+	.type	main, @function
+main:
+.LFB0:
+	.file 1 "gdb.dwarf2/rh-dwarf4-x86_64.c"
+	# gdb.dwarf2/rh-dwarf4-x86_64.c:20
+	.loc 1 20 0
+	.cfi_startproc
+	# basic block 2
+	pushq	%rbp
+	.cfi_def_cfa_offset 16
+	movq	%rsp, %rbp
+	.cfi_offset 6, -16
+	.cfi_def_cfa_register 6
+	# gdb.dwarf2/rh-dwarf4-x86_64.c:21
+	.loc 1 21 0
+	movl	$0, %eax
+	# gdb.dwarf2/rh-dwarf4-x86_64.c:22
+	.loc 1 22 0
+	leave
+	.cfi_def_cfa 7, 8
+	ret
+	.cfi_endproc
+.LFE0:
+	.size	main, .-main
+.Letext0:
+	.section	.debug_info
+	.long	0x4e	# Length of Compilation Unit Info
+	.value	0x4	# DWARF version number
+	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
+	.byte	0x8	# Pointer Size (in bytes)
+	.uleb128 0x1	# (DIE (0xb) DW_TAG_compile_unit)
+	.long	.LASF0	# DW_AT_producer: "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
+	.byte	0x1	# DW_AT_language
+	.long	.LASF1	# DW_AT_name: "gdb.dwarf2/rh-dwarf4-x86_64.c"
+	.long	.LASF2	# DW_AT_comp_dir
+	.quad	.Ltext0	# DW_AT_low_pc
+	.quad	.Letext0	# DW_AT_high_pc
+	.long	.Ldebug_line0	# DW_AT_stmt_list
+	.uleb128 0x2	# (DIE (0x2d) DW_TAG_subprogram)
+			# DW_AT_external
+	.long	.LASF3	# DW_AT_name: "main"
+	.byte	0x1	# DW_AT_decl_file (gdb.dwarf2/rh-dwarf4-x86_64.c)
+	.byte	0x13	# DW_AT_decl_line
+			# DW_AT_prototyped
+	.long	0x4a	# DW_AT_type
+	.quad	.LFB0	# DW_AT_low_pc
+	.quad	.LFE0	# DW_AT_high_pc
+	.uleb128 0x1	# DW_AT_frame_base
+	.byte	0x9c	# DW_OP_call_frame_cfa
+	.uleb128 0x3	# (DIE (0x4a) DW_TAG_base_type)
+	.byte	0x4	# DW_AT_byte_size
+	.byte	0x5	# DW_AT_encoding
+	.ascii "int\0"	# DW_AT_name
+	.byte	0x0	# end of children of DIE 0xb
+	.section	.debug_abbrev
+	.uleb128 0x1	# (abbrev code)
+	.uleb128 0x11	# (TAG: DW_TAG_compile_unit)
+	.byte	0x1	# DW_children_yes
+	.uleb128 0x25	# (DW_AT_producer)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x13	# (DW_AT_language)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x1b	# (DW_AT_comp_dir)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x11	# (DW_AT_low_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x12	# (DW_AT_high_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x10	# (DW_AT_stmt_list)
+	.uleb128 0x17	# (DW_FORM_sec_offset)
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x2	# (abbrev code)
+	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
+	.byte	0x0	# DW_children_no
+	.uleb128 0x3f	# (DW_AT_external)
+	.uleb128 0x19	# (DW_FORM_flag_present)
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x3a	# (DW_AT_decl_file)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3b	# (DW_AT_decl_line)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x27	# (DW_AT_prototyped)
+	.uleb128 0x19	# (DW_FORM_flag_present)
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.uleb128 0x11	# (DW_AT_low_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x12	# (DW_AT_high_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x40	# (DW_AT_frame_base)
+	.uleb128 0x18	# (DW_FORM_exprloc)
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x3	# (abbrev code)
+	.uleb128 0x24	# (TAG: DW_TAG_base_type)
+	.byte	0x0	# DW_children_no
+	.uleb128 0xb	# (DW_AT_byte_size)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3e	# (DW_AT_encoding)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0x8	# (DW_FORM_string)
+	.byte	0x0
+	.byte	0x0
+	.byte	0x0
+	.section	.debug_pubnames,"", at progbits
+	.long	0x17	# Length of Public Names Info
+	.value	0x2	# DWARF Version
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
+	.long	0x52	# Compilation Unit Length
+	.long	0x2d	# DIE offset
+	.ascii "main\0"	# external name
+	.long	0x0
+	.section	.debug_aranges,"", at progbits
+	.long	0x2c	# Length of Address Ranges Info
+	.value	0x2	# DWARF Version
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
+	.byte	0x8	# Size of Address
+	.byte	0x0	# Size of Segment Descriptor
+	.value	0x0	# Pad to 16 byte boundary
+	.value	0x0
+	.quad	.Ltext0	# Address
+	.quad	.Letext0-.Ltext0	# Length
+	.quad	0x0
+	.quad	0x0
+	.section	.debug_str,"MS", at progbits,1
+.LASF2:
+	.string	"."
+.LASF0:
+	.string	"GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
+.LASF1:
+	.string	"gdb.dwarf2/rh-dwarf4-x86_64.c"
+.LASF3:
+	.string	"main"
+	.ident	"GCC: (GNU) 4.4.4 20100503 (Red Hat 4.4.4-2)"
+	.section	.note.GNU-stack,"", at progbits
--- /dev/null	2010-06-08 20:35:46.800278452 +0200
+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c	2010-06-09 15:21:35.000000000 +0200
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+main (void)
+{
+  return 0;
+}
--- /dev/null	2010-06-08 20:35:46.800278452 +0200
+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp	2010-06-09 15:26:21.000000000 +0200
@@ -0,0 +1,42 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+    && ![istarget *-*-gnu*]
+    && ![istarget *-*-elf*]
+    && ![istarget *-*-openbsd*]
+    && ![istarget arm-*-eabi*]
+    && ![istarget powerpc-*-eabi*]} {
+    return 0  
+}
+
+if {![istarget x86_64-*]} {
+    return 0  
+}
+
+set testfile "rh-dwarf4-x86_64"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+set binfile ${objdir}/${subdir}/${executable}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
+    return -1
+}
+
+clean_restart $executable
+
+gdb_test "ptype main" {type = int \(void\)}

gdb-bz602314-ptype-class-typedef-1of3.patch:
 gdb-7.1/gdb/cp-namespace.c                 |   20 +++++++-
 gdb-7.1/gdb/symtab.h                       |    6 ++
 gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp |   66 ++++++++++++++++++++++++++++-
 gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc |   15 ++++++
 gdb-7.1/gdb/valops.c                       |   14 ++++--
 gdb/symtab.c                               |   19 ++++++--
 6 files changed, 129 insertions(+), 11 deletions(-)

--- NEW FILE gdb-bz602314-ptype-class-typedef-1of3.patch ---
commit f49f91e9c3eaba847f75f5c46e77e261a76d9a9b
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Mon Jun 28 20:35:51 2010 +0000

    gdb/
    	* cp-namespace.c (cp_lookup_nested_type): New variable
    	concatenated_name.  Turn the current return condition into a reverse
    	one.  Call also lookup_static_symbol_aux on the constructed qualified
    	name.
    	* symtab.c (lookup_symbol_aux): Move variable objfile and searching in
    	other files into a called ...
    	(lookup_static_symbol_aux): ... new function here.
    	* symtab.h (lookup_static_symbol_aux): New prototype.
    	* valops.c (value_maybe_namespace_elt): Call also
    	lookup_static_symbol_aux if we failed otherwise.
    
    gdb/testsuite/
    	* gdb.cp/namespace.exp (whatis C::cOtherFileType)
    	(whatis ::C::cOtherFileType, whatis C::cOtherFileVar)
    	(whatis ::C::cOtherFileVar, print C::cOtherFileVar)
    	(print ::C::cOtherFileVar)
    	(whatis C::OtherFileClass::cOtherFileClassType)
    	(whatis ::C::OtherFileClass::cOtherFileClassType)
    	(print C::OtherFileClass::cOtherFileClassVar)
    	(print ::cOtherFileClassVar)
    	(print ::C::OtherFileClass::cOtherFileClassVar): New tests.
    	(ptype OtherFileClass, ptype ::C::OtherFileClass): Permit arbitrary
    	trailing content.
    	* gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType)
    	(C::OtherFileClass::cOtherFileClassVar)
    	(C::OtherFileClass::cOtherFileClassVar_use, C::cOtherFileType)
    	(C::cOtherFileVar, C::cOtherFileVar_use): New.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,18 @@
 2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
 
+	* cp-namespace.c (cp_lookup_nested_type): New variable
+	concatenated_name.  Turn the current return condition into a reverse
+	one.  Call also lookup_static_symbol_aux on the constructed qualified
+	name.
+	* symtab.c (lookup_symbol_aux): Move variable objfile and searching in
+	other files into a called ...
+	(lookup_static_symbol_aux): ... new function here.
+	* symtab.h (lookup_static_symbol_aux): New prototype.
+	* valops.c (value_maybe_namespace_elt): Call also
+	lookup_static_symbol_aux if we failed otherwise.
+
+2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
 	Fix PR c++/11703 and PR gdb/1448.
 	* c-exp.y (yylex) <last_was_coloncolon && first_was_coloncolon>: Add
 	FIRST_ITER check.
Index: gdb-7.1/gdb/cp-namespace.c
===================================================================
--- gdb-7.1.orig/gdb/cp-namespace.c	2010-06-29 17:54:17.000000000 +0200
+++ gdb-7.1/gdb/cp-namespace.c	2010-06-29 17:59:32.000000000 +0200
@@ -585,10 +585,24 @@ cp_lookup_nested_type (struct type *pare
 							 nested_name,
 							 block,
 							 VAR_DOMAIN);
-	if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
-	  return NULL;
-	else
+	char *concatenated_name;
+
+	if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+	  return SYMBOL_TYPE (sym);
+
+	/* Now search all static file-level symbols.  Not strictly correct,
+	   but more useful than an error.  We do not try to guess any imported
+	   namespace as even the fully specified namespace seach is is already
+	   not C++ compliant and more assumptions could make it too magic.  */
+
+	concatenated_name = alloca (strlen (parent_name) + 2
+				    + strlen (nested_name) + 1);
+	sprintf (concatenated_name, "%s::%s", parent_name, nested_name);
+	sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
+	if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
 	  return SYMBOL_TYPE (sym);
+
+	return NULL;
       }
     default:
       internal_error (__FILE__, __LINE__,
Index: gdb-7.1/gdb/symtab.h
===================================================================
--- gdb-7.1.orig/gdb/symtab.h	2010-06-29 17:54:16.000000000 +0200
+++ gdb-7.1/gdb/symtab.h	2010-06-29 18:00:37.000000000 +0200
@@ -1036,6 +1036,12 @@ extern struct partial_symbol *lookup_par
 						     const char *, int,
 						     domain_enum);
 
+/* Lookup a symbol only in the file static scope of all the objfiles.  */
+
+struct symbol *lookup_static_symbol_aux (const char *name,
+					 const domain_enum domain);
+
+
 /* lookup a symbol by name, within a specified block */
 
 extern struct symbol *lookup_block_symbol (const struct block *, const char *,
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace.exp	2010-06-29 17:54:11.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp	2010-06-29 18:17:17.000000000 +0200
@@ -217,6 +217,70 @@ gdb_expect {
 gdb_test "break BBB::Class::xyzq" \
     "Breakpoint.*at $hex: file.*namespace.cc, line 68\\."
 
+# Tests accessing static elements in namespace of other file.
+
+gdb_test "whatis C::cOtherFileType" "type = short"
+gdb_test "whatis ::C::cOtherFileType" "type = short"
+gdb_test "whatis C::cOtherFileVar" "type = const C::cOtherFileType"
+gdb_test "whatis ::C::cOtherFileVar" "type = const C::cOtherFileType"
+gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319"
+gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319"
+
+if {[test_compiler_info {gcc-[0-3]-*}]
+    || [test_compiler_info {gcc-4-[0-4]-*}]} {
+    # The type in class is missing in older GCCs.
+    setup_xfail *-*-* 
+}
+gdb_test "whatis C::OtherFileClass::cOtherFileClassType" "type = short"
+if {[test_compiler_info {gcc-[0-3]-*}]
+    || [test_compiler_info {gcc-4-[0-4]-*}]} {
+    # The type in class is missing in older GCCs.
+    setup_xfail *-*-* 
+}
+gdb_test "whatis ::C::OtherFileClass::cOtherFileClassType" "type = short"
+
+set test "print C::OtherFileClass::cOtherFileClassVar"
+gdb_test_multiple $test $test {
+    -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
+	pass $test
+    }
+    -re "static field cOtherFileClassVar has been optimized out\r\n$gdb_prompt $" {
+	setup_kfail "c++/11702" "*-*-*"
+	fail $test
+    }
+}
+
+# FSF GCC <=4.4 creates unqualified DIE "cOtherFileClassVar" ignoring the
+# namespace the same way older GDB did.
+set test "print ::cOtherFileClassVar"
+set test2 "print ::C::OtherFileClass::cOtherFileClassVar"
+gdb_test_multiple $test $test {
+    -re "No symbol \"cOtherFileClassVar\" in current context\\.\r\n$gdb_prompt $" {
+	pass $test
+
+	gdb_test_multiple $test2 $test2 {
+	    -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
+		pass $test2
+	    }
+	    -re "static field cOtherFileClassVar has been optimized out\r\n$gdb_prompt $" {
+		setup_kfail "c++/11702" "*-*-*"
+		fail $test2
+	    }
+	}
+
+    }
+    -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
+	if {[test_compiler_info {gcc-[0-3]-*}]
+	    || [test_compiler_info {gcc-4-[0-4]-*}]} {
+	    # Do not permit to XFAIL on recent GCCs.
+	    setup_xfail *-*-* 
+	}
+	fail $test
+
+	unresolved $test2
+    }
+}
+
 # Test to see if the appropriate namespaces are in scope when trying
 # to print out stuff from within a function defined within a
 # namespace.
@@ -260,7 +324,7 @@ gdb_test "ptype C::NestedClass" "No symb
 # Tests involving multiple files
 
 gdb_test "print cOtherFile" "\\$\[0-9\].* = 316"
-gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n  public:|struct C::OtherFileClass \{)\r\n    int z;\r\n\}"
+gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n  public:|struct C::OtherFileClass \{)\r\n    int z;\r\n.*\}"
 cp_test_ptype_class \
 	"ptype ::C::OtherFileClass" "" "class" "C::OtherFileClass" \
 	{
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace1.cc	2010-01-01 08:32:01.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc	2010-06-29 17:56:42.000000000 +0200
@@ -21,7 +21,15 @@ namespace C
   class OtherFileClass {
   public:
     int z;
+
+    typedef short cOtherFileClassType;
+    static const cOtherFileClassType cOtherFileClassVar = 318;
+    cOtherFileClassType cOtherFileClassVar_use ();
   };
+  OtherFileClass::cOtherFileClassType OtherFileClass::cOtherFileClassVar_use ()
+  {
+    return cOtherFileClassVar;
+  }
 
   namespace {
     int cXOtherFile = 29;
@@ -35,6 +43,13 @@ namespace C
     static OtherFileClass *c = new OtherFileClass();
     c->z = cOtherFile + cXOtherFile;
   }
+
+  typedef short cOtherFileType;
+  static const cOtherFileType cOtherFileVar = 319;
+  cOtherFileType cOtherFileVar_use ()
+  {
+    return cOtherFileVar;
+  }
 }
 
 namespace {
Index: gdb-7.1/gdb/valops.c
===================================================================
--- gdb-7.1.orig/gdb/valops.c	2010-06-29 17:54:16.000000000 +0200
+++ gdb-7.1/gdb/valops.c	2010-06-29 18:15:00.000000000 +0200
@@ -3253,9 +3253,17 @@ value_maybe_namespace_elt (const struct 
   struct symbol *sym;
   struct value *result;
 
-  sym = cp_lookup_symbol_namespace(namespace_name, name,
-                                   get_selected_block (0), 
-                                   VAR_DOMAIN);
+  sym = cp_lookup_symbol_namespace (namespace_name, name,
+				    get_selected_block (0), VAR_DOMAIN);
+
+  if (sym == NULL)
+    {
+      char *concatenated_name = alloca (strlen (namespace_name) + 2
+					+ strlen (name) + 1);
+
+      sprintf (concatenated_name, "%s::%s", namespace_name, name);
+      sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
+    }
 
   if (sym == NULL)
     return NULL;
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1122,10 +1121,21 @@ lookup_symbol_aux (const char *name, const struct block *block,
     return sym;
 
   /* Now search all static file-level symbols.  Not strictly correct,
-     but more useful than an error.  Do the symtabs first, then check
-     the psymtabs.  If a psymtab indicates the existence of the
-     desired name as a file-level static, then do psymtab-to-symtab
-     conversion on the fly and return the found symbol. */
+     but more useful than an error.  */
+
+  return lookup_static_symbol_aux (name, domain);
+}
+
+/* Search all static file-level symbols for NAME from DOMAIN.  Do the symtabs
+   first, then check the psymtabs.  If a psymtab indicates the existence of the
+   desired name as a file-level static, then do psymtab-to-symtab conversion on
+   the fly and return the found symbol. */
+
+struct symbol *
+lookup_static_symbol_aux (const char *name, const domain_enum domain)
+{
+  struct objfile *objfile;
+  struct symbol *sym;
 
   sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
   if (sym != NULL)

gdb-bz602314-ptype-class-typedef-2of3.patch:
 c-typeprint.c                  |   26 +++++++++++++++
 dwarf2read.c                   |   67 +++++++++++++++++++++++++++++++++++++++++
 gdbtypes.h                     |   24 ++++++++++++++
 testsuite/gdb.cp/namespace.exp |   15 +++++++++
 testsuite/gdb.cp/namespace1.cc |    8 +++-
 testsuite/gdb.cp/userdef.exp   |    2 -
 6 files changed, 138 insertions(+), 4 deletions(-)

--- NEW FILE gdb-bz602314-ptype-class-typedef-2of3.patch ---
commit 758a1f7149cb7469c7e6bb30cb572715ee90a6e8
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Mon Jun 28 20:39:27 2010 +0000

    gdb/
    	* c-typeprint.c (c_type_print_base): For no fields check include also
    	TYPE_TYPEDEF_FIELD_COUNT.  Print new typedefs section.
    	* dwarf2read.c (struct typedef_field_list)
    	(struct field_info) <typedef_field_list, typedef_field_list_count>: New.
    	(dwarf2_add_typedef): New.
    	(read_structure_type): Call dwarf2_add_typedef for DW_TAG_typedef.
    	Copy also FI.TYPEDEF_FIELD_LIST.
    	* gdbtypes.h (struct typedef_field)
    	(struct cplus_struct_type) <typedef_field, typedef_field_count>
    	(TYPE_TYPEDEF_FIELD_ARRAY, TYPE_TYPEDEF_FIELD, TYPE_TYPEDEF_FIELD_NAME)
    	(TYPE_TYPEDEF_FIELD_TYPE, TYPE_TYPEDEF_FIELD_COUNT): New.
    
    gdb/testsuite/
    	* gdb.cp/namespace.exp (ptype OtherFileClass typedefs)
    	(ptype ::C::OtherFileClass typedefs): New.
    	* gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType2)
    	(C::OtherFileClass::cOtherFileClassVar2): New.
    	(C::OtherFileClass::cOtherFileClassVar_use): Use also
    	cOtherFileClassVar2.
    	(C::cOtherFileType2, C::cOtherFileVar2): New.
    	(C::cOtherFileVar_use): use also cOtherFileVar2.
    	* gdb.cp/userdef.exp (ptype &*c): Permit arbitrary trailing text.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,19 @@
 2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
 
+	* c-typeprint.c (c_type_print_base): For no fields check include also
+	TYPE_TYPEDEF_FIELD_COUNT.  Print new typedefs section.
+	* dwarf2read.c (struct typedef_field_list)
+	(struct field_info) <typedef_field_list, typedef_field_list_count>: New.
+	(dwarf2_add_typedef): New.
+	(read_structure_type): Call dwarf2_add_typedef for DW_TAG_typedef.
+	Copy also FI.TYPEDEF_FIELD_LIST.
+	* gdbtypes.h (struct typedef_field)
+	(struct cplus_struct_type) <typedef_field, typedef_field_count>
+	(TYPE_TYPEDEF_FIELD_ARRAY, TYPE_TYPEDEF_FIELD, TYPE_TYPEDEF_FIELD_NAME)
+	(TYPE_TYPEDEF_FIELD_TYPE, TYPE_TYPEDEF_FIELD_COUNT): New.
+
+2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
 	* cp-namespace.c (cp_lookup_nested_type): New variable
 	concatenated_name.  Turn the current return condition into a reverse
 	one.  Call also lookup_static_symbol_aux on the constructed qualified
Index: gdb-7.1/gdb/c-typeprint.c
===================================================================
--- gdb-7.1.orig/gdb/c-typeprint.c	2010-06-29 17:54:09.000000000 +0200
+++ gdb-7.1/gdb/c-typeprint.c	2010-06-29 18:17:48.000000000 +0200
@@ -774,7 +774,8 @@ c_type_print_base (struct type *type, st
 	  cp_type_print_derivation_info (stream, type);
 
 	  fprintf_filtered (stream, "{\n");
-	  if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
+	  if (TYPE_NFIELDS (type) == 0 && TYPE_NFN_FIELDS (type) == 0
+	      && TYPE_TYPEDEF_FIELD_COUNT (type) == 0)
 	    {
 	      if (TYPE_STUB (type))
 		fprintfi_filtered (level + 4, stream, _("<incomplete type>\n"));
@@ -1060,6 +1061,29 @@ c_type_print_base (struct type *type, st
 		}
 	    }
 
+	  /* Print typedefs defined in this class.  */
+
+	  if (TYPE_TYPEDEF_FIELD_COUNT (type) != 0)
+	    {
+	      if (TYPE_NFIELDS (type) != 0 || TYPE_NFN_FIELDS (type) != 0)
+		fprintf_filtered (stream, "\n");
+
+	      for (i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); i++)
+		{
+		  struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i);
+
+		  /* Dereference the typedef declaration itself.  */
+		  gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF);
+		  target = TYPE_TARGET_TYPE (target);
+
+		  print_spaces_filtered (level + 4, stream);
+		  fprintf_filtered (stream, "typedef ");
+		  c_print_type (target, (char *) TYPE_TYPEDEF_FIELD_NAME (type, i),
+				stream, show - 1, level + 4);
+		  fprintf_filtered (stream, ";\n");
+		}
+	    }
+
 	  fprintfi_filtered (level, stream, "}");
 
 	  if (TYPE_LOCALTYPE_PTR (type) && show >= 0)
Index: gdb-7.1/gdb/dwarf2read.c
===================================================================
--- gdb-7.1.orig/gdb/dwarf2read.c	2010-06-29 17:54:28.000000000 +0200
+++ gdb-7.1/gdb/dwarf2read.c	2010-06-29 18:17:48.000000000 +0200
@@ -722,6 +722,16 @@ struct field_info
 
     /* Number of entries in the fnfieldlists array.  */
     int nfnfields;
+
+    /* typedefs defined inside this class.  TYPEDEF_FIELD_LIST contains head of
+       a NULL terminated list of TYPEDEF_FIELD_LIST_COUNT elements.  */
+    struct typedef_field_list
+      {
+	struct typedef_field field;
+	struct typedef_field_list *next;
+      }
+    *typedef_field_list;
+    unsigned typedef_field_list_count;
   };
 
 /* One item on the queue of compilation units to read in full symbols
@@ -5075,6 +5085,39 @@ dwarf2_add_field (struct field_info *fip
     }
 }
 
+/* Add a typedef defined in the scope of the FIP's class.  */
+
+static void
+dwarf2_add_typedef (struct field_info *fip, struct die_info *die,
+		    struct dwarf2_cu *cu)
+{ 
+  struct objfile *objfile = cu->objfile;
+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
+  struct typedef_field_list *new_field;
+  struct attribute *attr;
+  struct typedef_field *fp;
+  char *fieldname = "";
+
+  /* Allocate a new field list entry and link it in.  */
+  new_field = xzalloc (sizeof (*new_field));
+  make_cleanup (xfree, new_field);
+
+  gdb_assert (die->tag == DW_TAG_typedef);
+
+  fp = &new_field->field;
+
+  /* Get name of field.  */
+  fp->name = dwarf2_name (die, cu);
+  if (fp->name == NULL)
+    return;
+
+  fp->type = read_type_die (die, cu);
+
+  new_field->next = fip->typedef_field_list;
+  fip->typedef_field_list = new_field;
+  fip->typedef_field_list_count++;
+}
+
 /* Create the vector of fields, and attach it to the type.  */
 
 static void
@@ -5600,6 +5643,8 @@ read_structure_type (struct die_info *di
 	      /* C++ base class field.  */
 	      dwarf2_add_field (&fi, child_die, cu);
 	    }
+	  else if (child_die->tag == DW_TAG_typedef)
+	    dwarf2_add_typedef (&fi, child_die, cu);
 	  child_die = sibling_die (child_die);
 	}
 
@@ -5673,6 +5718,28 @@ read_structure_type (struct die_info *di
 		}
 	    }
 	}
+
+      /* Copy fi.typedef_field_list linked list elements content into the
+	 allocated array TYPE_TYPEDEF_FIELD_ARRAY (type).  */
+      if (fi.typedef_field_list)
+	{
+	  int i = fi.typedef_field_list_count;
+
+	  TYPE_TYPEDEF_FIELD_ARRAY (type)
+	    = TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
+	  TYPE_TYPEDEF_FIELD_COUNT (type) = i;
+
+	  /* Reverse the list order to keep the debug info elements order.  */
+	  while (--i >= 0)
+	    {
+	      struct typedef_field *dest, *src;
+	      
+	      dest = &TYPE_TYPEDEF_FIELD (type, i);
+	      src = &fi.typedef_field_list->field;
+	      fi.typedef_field_list = fi.typedef_field_list->next;
+	      *dest = *src;
+	    }
+	}
     }
 
   quirk_gcc_member_function_pointer (type, cu->objfile);
Index: gdb-7.1/gdb/gdbtypes.h
===================================================================
--- gdb-7.1.orig/gdb/gdbtypes.h	2010-06-29 17:54:17.000000000 +0200
+++ gdb-7.1/gdb/gdbtypes.h	2010-06-29 18:18:29.000000000 +0200
@@ -948,6 +948,19 @@ struct cplus_struct_type
        member functions or virtual base classes.  Minus one if not
        dynamic.  Zero if not yet computed.  */
     int is_dynamic : 2;
+
+    /* typedefs defined inside this class.  TYPEDEF_FIELD points to an array of
+       TYPEDEF_FIELD_COUNT elements.  */
+    struct typedef_field
+      {
+	/* Unqualified name to be prefixed by owning class qualified name.  */
+	const char *name;
+
+	/* Type this typedef named NAME represents.  */
+	struct type *type;
+      }
+    *typedef_field;
+    unsigned typedef_field_count;
   };
 
 /* Struct used for ranking a function for overload resolution */
@@ -1182,6 +1195,17 @@ extern void allocate_gnat_aux_type (stru
 #define TYPE_LOCALTYPE_FILE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->file)
 #define TYPE_LOCALTYPE_LINE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->line)
 
+#define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \
+  TYPE_CPLUS_SPECIFIC (thistype)->typedef_field
+#define TYPE_TYPEDEF_FIELD(thistype, n) \
+  TYPE_CPLUS_SPECIFIC (thistype)->typedef_field[n]
+#define TYPE_TYPEDEF_FIELD_NAME(thistype, n) \
+  TYPE_TYPEDEF_FIELD (thistype, n).name
+#define TYPE_TYPEDEF_FIELD_TYPE(thistype, n) \
+  TYPE_TYPEDEF_FIELD (thistype, n).type
+#define TYPE_TYPEDEF_FIELD_COUNT(thistype) \
+  TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
+
 #define TYPE_IS_OPAQUE(thistype) (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) ||        \
                                    (TYPE_CODE (thistype) == TYPE_CODE_UNION))        && \
                                   (TYPE_NFIELDS (thistype) == 0)                     && \
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace.exp	2010-06-29 18:17:17.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp	2010-06-29 18:18:58.000000000 +0200
@@ -332,6 +332,21 @@ cp_test_ptype_class \
 	}
 gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"."
 
+# Test class typedefs printing.
+set expect "type = class C::OtherFileClass \{\r\n.*\r\n *typedef short cOtherFileClassType;\r\n *typedef long cOtherFileClassType2;\r\n\}"
+if {[test_compiler_info {gcc-[0-3]-*}]
+    || [test_compiler_info {gcc-4-[0-4]-*}]} {
+    # The type in class is missing in older GCCs.
+    setup_xfail *-*-* 
+}
+gdb_test "ptype OtherFileClass" $expect "ptype OtherFileClass typedefs"
+if {[test_compiler_info {gcc-[0-3]-*}]
+    || [test_compiler_info {gcc-4-[0-4]-*}]} {
+    # The type in class is missing in older GCCs.
+    setup_xfail *-*-* 
+}
+gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs"
+
 # Some anonymous namespace tests.
 
 gdb_test "print cX" "\\$\[0-9\].* = 6"
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace1.cc	2010-06-29 17:56:42.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc	2010-06-29 18:17:48.000000000 +0200
@@ -23,12 +23,14 @@ namespace C
     int z;
 
     typedef short cOtherFileClassType;
+    typedef long cOtherFileClassType2;
     static const cOtherFileClassType cOtherFileClassVar = 318;
+    static const cOtherFileClassType2 cOtherFileClassVar2 = 320;
     cOtherFileClassType cOtherFileClassVar_use ();
   };
   OtherFileClass::cOtherFileClassType OtherFileClass::cOtherFileClassVar_use ()
   {
-    return cOtherFileClassVar;
+    return cOtherFileClassVar + cOtherFileClassVar2;
   }
 
   namespace {
@@ -45,10 +47,12 @@ namespace C
   }
 
   typedef short cOtherFileType;
+  typedef long cOtherFileType2;
   static const cOtherFileType cOtherFileVar = 319;
+  static const cOtherFileType2 cOtherFileVar2 = 321;
   cOtherFileType cOtherFileVar_use ()
   {
-    return cOtherFileVar;
+    return cOtherFileVar + cOtherFileVar2;
   }
 }
 
Index: gdb-7.1/gdb/testsuite/gdb.cp/userdef.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/userdef.exp	2010-06-29 17:54:11.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/userdef.exp	2010-06-29 18:17:48.000000000 +0200
@@ -154,7 +154,7 @@ gdb_test "break A2::'operator +'" ".*Bre
 gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"
 gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}"
 gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
-gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\]+} &\\*"
+gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\].*} &\\*"
 
 gdb_test "print operator== (mem1, mem2)" " = false"
 gdb_test "print operator== (mem1, mem1)" " = true"

gdb-bz602314-ptype-class-typedef-3of3.patch:
 dwarf2read.c |    1 +
 1 file changed, 1 insertion(+)

--- NEW FILE gdb-bz602314-ptype-class-typedef-3of3.patch ---
commit 477c1359b217cdc052a7c9f83cae9c894396894c
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Mon Jun 28 22:03:31 2010 +0000

    gdb/
    	* dwarf2read.c (read_structure_type) <fi.typedef_field_list>: Call
    	ALLOCATE_CPLUS_STRUCT_TYPE.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,8 @@
+2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* dwarf2read.c (read_structure_type) <fi.typedef_field_list>: Call
+	ALLOCATE_CPLUS_STRUCT_TYPE.
+
 2010-06-28  Phil Muldoon  <pmuldoon at redhat.com>
             Tom Tromey  <tromey at redhat.com>
             Thiago Jung Bauermann  <bauerman at br.ibm.com>
## -27,8 +32,6 @@
 	* python/py-inferior.c: New File.
 	* python/py-infthread.c: New File.
 
-
-
 2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
 
 	* c-typeprint.c (c_type_print_base): For no fields check include also
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5327,6 +5327,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
 	{
 	  int i = fi.typedef_field_list_count;
 
+	  ALLOCATE_CPLUS_STRUCT_TYPE (type);
 	  TYPE_TYPEDEF_FIELD_ARRAY (type)
 	    = TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
 	  TYPE_TYPEDEF_FIELD_COUNT (type) = i;

gdb-bz606185-obstack-1of5.patch:
 cp-valprint.c                |   57 +++++++++++++++++++++++++++++++++++++++----
 testsuite/gdb.cp/pr10687.cc  |   24 ++++++++++++++++++
 testsuite/gdb.cp/pr10687.exp |   31 +++++++++++++++++++++++
 3 files changed, 108 insertions(+), 4 deletions(-)

--- NEW FILE gdb-bz606185-obstack-1of5.patch ---
commit 78c144e8c3ae7bb36d632f6bfaaaad9c97199ce6
Author: cmoller <cmoller>
Date:   Tue Apr 20 20:22:09 2010 +0000

    PR 10867
    * cp-valprint.c (global): Adding new static array recursion
    detection obstack.
    (cp_print_value_fields, cp_print_static_field): Added new static
    array recursion detection code.
    * gdb.cp/Makefile.in  (EXECUTABLES): Added pr10687
    * gdb.cp/pr10687.cc: New file.
    * gdb.cp/pr10687.exp: New file

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,12 @@
+2010-04-20  Chris Moller  <cmoller at redhat.com>
+	
+	PR 10867
+
+	* cp-valprint.c (global): Adding new static array recursion
+	detection obstack.
+	(cp_print_value_fields, cp_print_static_field): Added new static
+	array recursion detection code.
+
 2010-04-20  Mark Kettenis  <kettenis at gnu.org>
 
 	* i386-linux-tdep.c (i386_linux_regset_sections): Size of the
Index: gdb-7.1/gdb/cp-valprint.c
===================================================================
--- gdb-7.1.orig/gdb/cp-valprint.c	2010-02-08 19:04:16.000000000 +0100
+++ gdb-7.1/gdb/cp-valprint.c	2010-06-28 20:21:53.000000000 +0200
@@ -71,6 +71,7 @@ show_static_field_print (struct ui_file 
 
 static struct obstack dont_print_vb_obstack;
 static struct obstack dont_print_statmem_obstack;
+static struct obstack dont_print_stat_array_obstack;
 
 extern void _initialize_cp_valprint (void);
 
@@ -155,12 +156,17 @@ cp_print_value_fields (struct type *type
 {
   int i, len, n_baseclasses;
   int fields_seen = 0;
+  static int last_set_recurse = -1;
 
   CHECK_TYPEDEF (type);
   
-  if (recurse == 0
-      && obstack_object_size (&dont_print_statmem_obstack) > 0)
-    obstack_free (&dont_print_statmem_obstack, NULL);
+  if (recurse == 0)
+    {
+      if (obstack_object_size (&dont_print_statmem_obstack) > 0)
+	obstack_free (&dont_print_statmem_obstack, NULL);
+      if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
+	obstack_free (&dont_print_stat_array_obstack, NULL);
+    }
 
   fprintf_filtered (stream, "{");
   len = TYPE_NFIELDS (type);
@@ -181,12 +187,20 @@ cp_print_value_fields (struct type *type
   else
     {
       void *statmem_obstack_top = NULL;
+      void *stat_array_obstack_top = NULL;
       
       if (dont_print_statmem == 0)
 	{
 	  /* Set the current printed-statics stack top.  */
 	  statmem_obstack_top
 	    = obstack_next_free (&dont_print_statmem_obstack);
+
+	  if (last_set_recurse != recurse)
+	    {
+	      stat_array_obstack_top
+		= obstack_next_free (&dont_print_stat_array_obstack);
+	      last_set_recurse = recurse;
+	    }
 	}
 
       for (i = n_baseclasses; i < len; i++)
@@ -307,9 +321,16 @@ cp_print_value_fields (struct type *type
 
       if (dont_print_statmem == 0)
 	{
-	  /* In effect, a pop of the printed-statics stack.  */
 	  if (obstack_object_size (&dont_print_statmem_obstack) > 0) 
 	    obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
+
+	  if (last_set_recurse != recurse)
+	    {
+	      if (obstack_object_size (&dont_print_stat_array_obstack) > 0) 
+		obstack_free (&dont_print_stat_array_obstack,
+			      stat_array_obstack_top);
+	      last_set_recurse = -1;
+	    }
 	}
 
       if (options->pretty)
@@ -508,6 +529,7 @@ cp_print_static_field (struct type *type
 		       const struct value_print_options *options)
 {
   struct value_print_options opts;
+  
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
       CORE_ADDR *first_dont_print;
@@ -542,6 +564,32 @@ cp_print_static_field (struct type *type
       return;
     }
 
+  if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+    {
+      struct type **first_dont_print;
+      int i;
+      struct type *target_type = TYPE_TARGET_TYPE (type);
+
+      first_dont_print
+	= (struct type **) obstack_base (&dont_print_stat_array_obstack);
+      i = obstack_object_size (&dont_print_stat_array_obstack)
+	/ sizeof (CORE_ADDR);
+
+      while (--i >= 0)
+	{
+	  if (target_type == first_dont_print[i])
+	    {
+	      fputs_filtered ("<same as static member of an already"
+			      " seen type>",
+			      stream);
+	      return;
+	    }
+	}
+
+      obstack_grow (&dont_print_stat_array_obstack, (char *) &target_type,
+		    sizeof (struct type *));
+    }
+
   opts = *options;
   opts.deref_ref = 0;
   val_print (type, value_contents_all (val), 
@@ -672,6 +720,7 @@ Show printing of object's derived type b
 			   show_objectprint,
 			   &setprintlist, &showprintlist);
 
+  obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (CORE_ADDR));
   obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
   obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
 }
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr10687.cc
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr10687.cc	2010-06-28 20:21:53.000000000 +0200
@@ -0,0 +1,24 @@
+class vec2 
+{
+  public:
+    vec2() { _v[0] = _v[1] = 0; }
+    vec2(int x, int y) { _v[0] = x; _v[1] = y; }
+    static vec2 axis[2];
+    static vec2 axis6[6];
+  private:
+    int _v[2];
+};
+
+vec2 vec2::axis[2] = { vec2(1,0), vec2(0,1) };
+vec2 vec2::axis6[6] = { 
+  vec2(1,0), vec2(0,1),
+  vec2(2,0), vec2(0,2),
+  vec2(3,0), vec2(0,3) 
+};
+
+int main(int argc, char*argv[])
+{
+  vec2 a;
+
+  return 0;  // marker
+}
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr10687.exp
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr10687.exp	2010-06-28 20:21:53.000000000 +0200
@@ -0,0 +1,31 @@
+#Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set testfile pr10687
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+    return -1
+}
+
+if ![runto_main] then {
+    fail "Can't run to main"
+    return
+}
+
+gdb_breakpoint [gdb_get_line_number "marker"]
+gdb_continue_to_breakpoint "marker"
+
+gdb_test "p a" "{static axis = {{static axis = <same as static member of an already.*"
+

gdb-bz606185-obstack-2of5.patch:
 cp-valprint.c               |   23 ++++++++++++++++-------
 testsuite/gdb.cp/pr9167.cc  |   36 ++++++++++++++++++++++++++++++++++++
 testsuite/gdb.cp/pr9167.exp |   31 +++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 7 deletions(-)

--- NEW FILE gdb-bz606185-obstack-2of5.patch ---
commit d54f5671e190a5c0ca8fd1ff070372bf20eb42a8
Author: cmoller <cmoller>
Date:   Wed Apr 21 17:33:51 2010 +0000

    PR 9167
    * cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
    method of popping recursion-detection stack with a method based on
    obstack_object_size().
    * gdb.cp/Makefile.in (EXECUTABLES): Added pr9167.
    * gdb.cp/pr9167.cc: New file.
    * gdb.cp/pr9167.exp: New file.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,10 @@
+2010-04-21  Chris Moller  <cmoller at redhat.com>
+
+	PR 9167
+	* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
+        method of popping recursion-detection stack with a method based on
+        obstack_object_size().
+
 2010-04-21  Pierre Muller  <muller at ics.u-strasbg.fr>
 
 	PR pascal/11492.
## -3184,7 +3191,7 @@
 	addr_bit.  Adjust LOAD_ADDR sign for cross-arch inferiors.
 
 2010-02-17  Tristan Gingold  <gingold at adacore.com>
-	    Petr Hluzín <petr.hluzin at gmail.com>
+	    Petr Hluzín <petr.hluzin at gmail.com>
 
 	* avr-tdep.c (avr_scan_prologue): Convert an if statement to a
 	gdb_assert.  Fix info->size for SIG prologue.
Index: gdb-7.1/gdb/cp-valprint.c
===================================================================
--- gdb-7.1.orig/gdb/cp-valprint.c	2010-06-28 20:21:53.000000000 +0200
+++ gdb-7.1/gdb/cp-valprint.c	2010-06-28 20:22:16.000000000 +0200
@@ -186,14 +186,13 @@ cp_print_value_fields (struct type *type
     fprintf_filtered (stream, "<No data fields>");
   else
     {
-      void *statmem_obstack_top = NULL;
+      int obstack_initial_size = 0;
       void *stat_array_obstack_top = NULL;
       
       if (dont_print_statmem == 0)
 	{
-	  /* Set the current printed-statics stack top.  */
-	  statmem_obstack_top
-	    = obstack_next_free (&dont_print_statmem_obstack);
+	  obstack_initial_size =
+	    obstack_object_size (&dont_print_statmem_obstack);
 
 	  if (last_set_recurse != recurse)
 	    {
@@ -321,8 +320,19 @@ cp_print_value_fields (struct type *type
 
       if (dont_print_statmem == 0)
 	{
-	  if (obstack_object_size (&dont_print_statmem_obstack) > 0) 
-	    obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
+	  int obstack_final_size =
+           obstack_object_size (&dont_print_statmem_obstack);
+
+	  if (obstack_final_size > obstack_initial_size) {
+	    /* In effect, a pop of the printed-statics stack.  */
+
+	    void *free_to_ptr =
+	      obstack_next_free (&dont_print_statmem_obstack) -
+	      (obstack_final_size - obstack_initial_size);
+
+	    obstack_free (&dont_print_statmem_obstack,
+			  free_to_ptr);
+	  }
 
 	  if (last_set_recurse != recurse)
 	    {
@@ -555,7 +565,6 @@ cp_print_static_field (struct type *type
       addr = value_address (val);
       obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
 		    sizeof (CORE_ADDR));
-
       CHECK_TYPEDEF (type);
       cp_print_value_fields (type, value_enclosing_type (val),
 			     value_contents_all (val),
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr9167.cc
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr9167.cc	2010-06-28 20:22:16.000000000 +0200
@@ -0,0 +1,36 @@
+#include <iostream>
+
+template<typename DATA>
+struct ATB
+{
+    int data;
+    ATB() : data(0) {}
+};
+
+
+template<typename DATA,
+	 typename DerivedType >
+class A : public ATB<DATA>
+{
+public:
+    static DerivedType const DEFAULT_INSTANCE;
+};
+
+template<typename DATA, typename DerivedType>
+const DerivedType A<DATA, DerivedType>::DEFAULT_INSTANCE;
+
+class B : public A<int, B>
+{
+    
+};
+
+int main()
+{
+    B b;
+    // If this if-block is removed then GDB shall
+    // not infinitely recurse when trying to print b.
+
+    return 0;		// marker
+}
+
+
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr9167.exp
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr9167.exp	2010-06-28 20:22:16.000000000 +0200
@@ -0,0 +1,31 @@
+#Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set testfile pr9167
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+    return -1
+}
+
+if ![runto_main] then {
+    fail "Can't run to main"
+    return
+}
+
+gdb_breakpoint [gdb_get_line_number "marker"]
+gdb_continue_to_breakpoint "marker"
+
+gdb_test "p b" "{<A<int, B>> = {<ATB<int>> = {data = 0}, static DEFAULT_INSTANCE = <optimized out>}, <No data fields>}"
+

gdb-bz606185-obstack-3of5.patch:
 cp-valprint.c |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

--- NEW FILE gdb-bz606185-obstack-3of5.patch ---
commit 407cb192dcac2602aebaa7e262419adb580ecca6
Author: cmoller <cmoller>
Date:   Thu Apr 22 20:12:06 2010 +0000

    * cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
    method of popping recursion-detection stack with a method based on
    obstack_object_size().  (Similar to the PR9167 patch below, but for
    the static array obstack rather than the static member obstack.)

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,10 @@
+2010-04-22  Chris Moller  <cmoller at redhat.com>
+
+	* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
+        method of popping recursion-detection stack with a method based on
+        obstack_object_size().  (Similar to the PR9167 patch below, but for
+	the static array obstack rather than the static member obstack.)
+
 2010-04-22  H.J. Lu  <hongjiu.lu at intel.com>
 
 	* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Removed.
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -186,18 +186,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
     fprintf_filtered (stream, "<No data fields>");
   else
     {
-      int obstack_initial_size = 0;
-      void *stat_array_obstack_top = NULL;
+      int statmem_obstack_initial_size = 0;
+      int stat_array_obstack_initial_size = 0;
       
       if (dont_print_statmem == 0)
 	{
-	  obstack_initial_size =
+	  statmem_obstack_initial_size =
 	    obstack_object_size (&dont_print_statmem_obstack);
 
 	  if (last_set_recurse != recurse)
 	    {
-	      stat_array_obstack_top
-		= obstack_next_free (&dont_print_stat_array_obstack);
+	      stat_array_obstack_initial_size =
+		obstack_object_size (&dont_print_stat_array_obstack);
 	      last_set_recurse = recurse;
 	    }
 	}
@@ -323,12 +323,12 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 	  int obstack_final_size =
            obstack_object_size (&dont_print_statmem_obstack);
 
-	  if (obstack_final_size > obstack_initial_size) {
+	  if (obstack_final_size > statmem_obstack_initial_size) {
 	    /* In effect, a pop of the printed-statics stack.  */
 
 	    void *free_to_ptr =
 	      obstack_next_free (&dont_print_statmem_obstack) -
-	      (obstack_final_size - obstack_initial_size);
+	      (obstack_final_size - statmem_obstack_initial_size);
 
 	    obstack_free (&dont_print_statmem_obstack,
 			  free_to_ptr);
@@ -336,9 +336,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 
 	  if (last_set_recurse != recurse)
 	    {
-	      if (obstack_object_size (&dont_print_stat_array_obstack) > 0) 
-		obstack_free (&dont_print_stat_array_obstack,
-			      stat_array_obstack_top);
+	      int obstack_final_size =
+		obstack_object_size (&dont_print_stat_array_obstack);
+	      
+	      if (obstack_final_size > stat_array_obstack_initial_size)
+		{
+		  void *free_to_ptr =
+		    obstack_next_free (&dont_print_stat_array_obstack) -
+		    (obstack_final_size - stat_array_obstack_initial_size);
+
+		  obstack_free (&dont_print_stat_array_obstack,
+				free_to_ptr);
+		}
 	      last_set_recurse = -1;
 	    }
 	}

gdb-bz606185-obstack-4of5.patch:
 cp-valprint.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- NEW FILE gdb-bz606185-obstack-4of5.patch ---
commit 744735550d4a4fd6d4be40776069d799dca5ee39
Author: Ulrich Weigand <uweigand at de.ibm.com>
Date:   Mon Jun 14 16:09:55 2010 +0000

    	* cp-valprint.c (cp_print_static_field): Members of
    	dont_print_stat_array_obstack are of type "struct type *".
    	(_initialize_cp_valprint): Likewise.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
 2010-06-14  Ulrich Weigand  <uweigand at de.ibm.com>
 
+	* cp-valprint.c (cp_print_static_field): Members of
+	dont_print_stat_array_obstack are of type "struct type *".
+	(_initialize_cp_valprint): Likewise.
+
+2010-06-14  Ulrich Weigand  <uweigand at de.ibm.com>
+
 	* frame.c (frame_register_unwind): Do not access contents
 	of "optimized out" unwound register value.
 
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -615,7 +615,7 @@ cp_print_static_field (struct type *type,
       first_dont_print
 	= (struct type **) obstack_base (&dont_print_stat_array_obstack);
       i = obstack_object_size (&dont_print_stat_array_obstack)
-	/ sizeof (CORE_ADDR);
+	/ sizeof (struct type *);
 
       while (--i >= 0)
 	{
@@ -764,7 +764,7 @@ Show printing of object's derived type based on vtable info."), NULL,
 			   show_objectprint,
 			   &setprintlist, &showprintlist);
 
-  obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (CORE_ADDR));
+  obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (struct type *));
   obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
   obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
 }

gdb-bz606185-obstack-5of5.patch:
 b/gdb/testsuite/gdb.cp/static-print-quit.cc  |   32 +++++++++++++++++
 b/gdb/testsuite/gdb.cp/static-print-quit.exp |   50 +++++++++++++++++++++++++++
 gdb/cp-valprint.c                            |   17 ++++++++-
 3 files changed, 97 insertions(+), 2 deletions(-)

--- NEW FILE gdb-bz606185-obstack-5of5.patch ---
commit 47c8c764a9be6d023eca450336e6d9de16970fc0
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Mon Jun 28 16:59:43 2010 +0000

    gdb/
    	* cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
    	obstack_begin after each obstack_free.
    
    gdb/testsuite/
    	* gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,8 @@
+2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
+	obstack_begin after each obstack_free.
+
 2010-06-27  Doug Evans  <dje at google.com>
 
 	* value.c (value_static_field): Use `switch' instead of `if'.
## -12,27 +17,27 @@
 
 2010-06-25  Paul Hilfinger  <hilfinger at adacore.com>
 
-        * defs.h (make_command_stats_cleanup): Declare.
-        (set_display_time): Declare.
-        (set_display_space): Declare.
-        * event-top.c (command_handler): Use make_command_stats_cleanup.
-        * main.c (display_time, display_space): Move definitions to utils.c.
-        (captured_main): Use make_command_stats_cleanup to get start-up
-        statistics.
-        Use set_display_time and set_display_space for processing OPT_STATISTICS
-        case.
-        * maint.c (maintenance_time_display): Use set_display_time.
-        (maintenance_space_display): Use set_display_space.
-        * top.c (execute_command): Remove obsolete 'maint time' code.
-        (command_loop): Use make_command_stats_cleanup.
-        * utils.c (struct cmd_stats): Structure for storing initial time
-        and space usage.
-        (display_time, display_space): Move definitions here from utils.c.
-        (set_display_time): New function.
-        (set_display_space): New function.
-        (make_command_stats_cleanup): New function.
-        (report_command_stats): New auxiliary function for
-        make_command_stats_cleanup.
+	* defs.h (make_command_stats_cleanup): Declare.
+	(set_display_time): Declare.
+	(set_display_space): Declare.
+	* event-top.c (command_handler): Use make_command_stats_cleanup.
+	* main.c (display_time, display_space): Move definitions to utils.c.
+	(captured_main): Use make_command_stats_cleanup to get start-up
+	statistics.
+	Use set_display_time and set_display_space for processing OPT_STATISTICS
+	case.
+	* maint.c (maintenance_time_display): Use set_display_time.
+	(maintenance_space_display): Use set_display_space.
+	* top.c (execute_command): Remove obsolete 'maint time' code.
+	(command_loop): Use make_command_stats_cleanup.
+	* utils.c (struct cmd_stats): Structure for storing initial time
+	and space usage.
+	(display_time, display_space): Move definitions here from utils.c.
+	(set_display_time): New function.
+	(set_display_space): New function.
+	(make_command_stats_cleanup): New function.
+	(report_command_stats): New auxiliary function for
+	make_command_stats_cleanup.
 
 2010-06-25  Ulrich Weigand  <uweigand at de.ibm.com>
 
## -6103,7 +6108,7 @@
 
 	PR gdb/9067
 	* cp-valprint.c (cp_print_value_fields) Fix use of obstacks.
-	cp_print_static_field)  Fix use of obstacks.
+	(cp_print_static_field)  Fix use of obstacks.
 
 2010-02-08  Pedro Alves  <pedro at codesourcery.com>
 
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -164,10 +164,19 @@ cp_print_value_fields (struct type *type, struct type *real_type,
   
   if (recurse == 0)
     {
+      /* Any object can be left on obstacks only during an unexpected error.  */
+
       if (obstack_object_size (&dont_print_statmem_obstack) > 0)
-	obstack_free (&dont_print_statmem_obstack, NULL);
+	{
+	  obstack_free (&dont_print_statmem_obstack, NULL);
+	  obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
+	}
       if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
-	obstack_free (&dont_print_stat_array_obstack, NULL);
+	{
+	  obstack_free (&dont_print_stat_array_obstack, NULL);
+	  obstack_begin (&dont_print_stat_array_obstack,
+			 32 * sizeof (struct type *));
+	}
     }
 
   fprintf_filtered (stream, "{");
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,7 @@
+2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
+
 2010-06-28  Doug Evans  <dje at google.com>
 
 	* gdb.base/break-interp.exp (reach): Relax expected output a bit.
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/static-print-quit.cc
@@ -0,0 +1,32 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+class D
+  {
+  public:
+    int loooooooooooooooooooooooooooooooooooooooooooooong;
+  };
+
+class C
+  {
+  public:
+    int loooooooooooooooooooooooooooooooooooooooooooooong;
+    static D field;
+  };
+
+D C::field;
+C c;
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/static-print-quit.exp
@@ -0,0 +1,50 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_cplus_tests] } { continue }
+
+set testfile static-print-quit
+set srcfile ${testfile}.cc
+set executable $testfile.o
+set objfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile $srcdir/$subdir/$srcfile $objfile object {debug c++}] != ""} {
+    untested ${testfile}.exp
+    return -1
+}
+
+clean_restart $executable
+
+gdb_test "set width 80"
+gdb_test "set height 2"
+
+set test "print c"
+gdb_test_multiple $test $test {
+    -re " = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type <return> to continue, or q <return> to quit---$" {
+	pass $test
+    }
+    -re " to quit---$" {
+	fail $test
+	return -1
+    }
+}
+
+gdb_test "q" ".*"
+
+# Now the obstack is uninitialized.  Excercise it.
+
+gdb_test "set pagination off"
+gdb_test "print c" ".*" "first print"
+gdb_test "print c" ".*" "second print"

gdb-bz606660-print-object-nonvirtual.patch:
 dwarf2read.c                  |    1 +
 testsuite/gdb.cp/virtbase.cc  |   14 +++++++++++++-
 testsuite/gdb.cp/virtbase.exp |    5 +++++
 3 files changed, 19 insertions(+), 1 deletion(-)

--- NEW FILE gdb-bz606660-print-object-nonvirtual.patch ---
commit bb604f9e70de515b13e2a935d8ad9d2fb0290849
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Mon Jun 28 20:12:52 2010 +0000

    gdb/
    	Fix modification of cplus_struct_default.
    	* dwarf2read.c (dwarf2_add_member_fn) <no DW_AT_vtable_elem_location>:
    	Call ALLOCATE_CPLUS_STRUCT_TYPE.
<removed>
    	* gdbtypes.c (cplus_struct_default): New empty initializer, comment it.
</removed>
    
    gdb/testsuite/
    	* gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data)
    	(main) <rtti_data>: New.
    	* gdb.cp/virtbase.exp (print rtti_data): New.

### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,10 @@
+2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Fix modification of cplus_struct_default.
+	* dwarf2read.c (dwarf2_add_member_fn) <no DW_AT_vtable_elem_location>:
+	Call ALLOCATE_CPLUS_STRUCT_TYPE.
+	* gdbtypes.c (cplus_struct_default): New empty initializer, comment it.
+
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,4 +1,10 @@
+2010-06-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data)
+	(main) <rtti_data>: New.
+	* gdb.cp/virtbase.exp (print rtti_data): New.
+
###--- a/gdb/gdbtypes.c
###+++ b/gdb/gdbtypes.c
###@@ -1733,7 +1733,8 @@ check_stub_method_group (struct type *type, int method_id)
###     }
### }
### 
###-const struct cplus_struct_type cplus_struct_default;
###+/* Ensure it is in .rodata (if available) by workarounding GCC PR 44690.  */
###+const struct cplus_struct_type cplus_struct_default = { };
### 
### void
### allocate_cplus_struct_type (struct type *type)
Index: gdb-7.1/gdb/dwarf2read.c
===================================================================
--- gdb-7.1.orig/gdb/dwarf2read.c	2010-06-29 18:26:47.000000000 +0200
+++ gdb-7.1/gdb/dwarf2read.c	2010-06-29 18:39:43.000000000 +0200
@@ -5404,6 +5404,7 @@ dwarf2_add_member_fn (struct field_info 
 	  complaint (&symfile_complaints,
 		     _("Member function \"%s\" (offset %d) is virtual but the vtable offset is not specified"),
 		     fieldname, die->offset);
+	  ALLOCATE_CPLUS_STRUCT_TYPE (type);
 	  TYPE_CPLUS_DYNAMIC (type) = 1;
 	}
     }
Index: gdb-7.1/gdb/testsuite/gdb.cp/virtbase.cc
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/virtbase.cc	2010-02-03 00:40:28.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.cp/virtbase.cc	2010-06-29 18:39:43.000000000 +0200
@@ -74,8 +74,19 @@ public:
   virtual void b() {}
 };
 
+class RTTI_base
+{
+public:
+  virtual ~RTTI_base() {}
+};
 
-
+class RTTI_data
+{
+public:
+  RTTI_base base;
+  int data;
+  RTTI_data() : data(1) {}
+};
 
 int main() {
   ph::Derived tst;
@@ -84,6 +95,7 @@ int main() {
 
   E *e = new E;
   RHB *b = new RHC();
+  RTTI_data rtti_data;
 
   return 0;			// breakpoint 3
 }
Index: gdb-7.1/gdb/testsuite/gdb.cp/virtbase.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/virtbase.exp	2010-02-04 22:04:30.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.cp/virtbase.exp	2010-06-29 18:39:56.000000000 +0200
@@ -60,3 +60,8 @@ gdb_test "print *(D *) e" " = {<C> = {v 
 # https://bugzilla.redhat.com/show_bug.cgi?id=560741
 gdb_test "set print object on" ""
 gdb_test "print/x b->mA" " = 0xaaaaaaaa"
+
+# A regression test reported to Red Hat bugzilla, see:
+# https://bugzilla.redhat.com/show_bug.cgi?id=606660
+# `set print object on' is expected.
+gdb_test "print rtti_data" " = .*, data = 1\}"

gdb-infcall-sp-underflow.patch:
 infcall.c                        |    7 +++----
 testsuite/gdb.base/callfuncs.exp |   15 ++++++++++++++-
 2 files changed, 17 insertions(+), 5 deletions(-)

--- NEW FILE gdb-infcall-sp-underflow.patch ---
http://sourceware.org/ml/gdb-patches/2010-02/msg00515.html
Subject: [patch] infcall: Remove gdb_assert ($sp overflow)

Hi,

set $sp=0
call something()
->
../../gdb/infcall.c:521: internal-error: call_function_by_hand: Assertion
`(gdbarch_inner_than (gdbarch, 1, 2) && sp <= old_sp) || (gdbarch_inner_than
(gdbarch, 2, 1) && sp >= old_sp)' failed.

as $sp - frame == 0xffffsmth which is not lower than $sp.

It must not be gdb_assert().  It can be an error() but I left it just to do:
	(gdb) set $sp=0
	(gdb) call doubleit (1)
	Cannot access memory at address 0xffffffffffffff78
	(gdb) set $sp=-1
	(gdb) call doubleit (1)
	Cannot access memory at address 0xffffffffffffff68

Unaware how inconvenient is an intentional crash of the testcase on some
embedded/non-MMU systems.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.


Thanks,
Jan


gdb/
2010-02-19  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp.
	New comment.

gdb/testsuite/
2010-02-19  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* gdb.base/callfuncs.exp: New tests for $spval 0 and -1.  Remove return.

--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -518,10 +518,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
 	      /* Stack grows up.  */
 	      sp = gdbarch_frame_align (gdbarch, old_sp + 1);
 	  }
-	gdb_assert ((gdbarch_inner_than (gdbarch, 1, 2)
-		    && sp <= old_sp)
-		    || (gdbarch_inner_than (gdbarch, 2, 1)
-		       && sp >= old_sp));
+	/* SP may have overflown address zero here from OLD_SP.  Memory access
+	   functions will probably fail in such case but that is a target's
+	   problem.  */
       }
     else
       /* FIXME: cagney/2002-09-18: Hey, you loose!
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -469,5 +469,18 @@ if {$old_reg_content == $new_reg_content} then {
     fail "nested call dummies preserve register contents"
 }
 
-return 0
+# GDB should not crash by internal error on $sp overflow during the inferior
+# call.  It is OK it will stop on some: Cannot access memory at address 0x$hex.
 
+foreach spval {0 -1} {
+    set old_ldprefix $pf_prefix
+    lappend pf_prefix "sp=$spval:"
+
+    gdb_test {set $old_sp = $sp}
+    gdb_test "set \$sp = $spval"
+
+    gdb_test "call doubleit (1)"
+
+    gdb_test {set $sp = $old_sp}
+    set pf_prefix $old_ldprefix
+}


gdb-moribund-utrace-workaround.patch:
 breakpoint.c |    2 ++
 1 file changed, 2 insertions(+)

--- NEW FILE gdb-moribund-utrace-workaround.patch ---
https://bugzilla.redhat.com/show_bug.cgi?id=590623
http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593

Bug in FSF GDB exploited by the ptrace-on-utrace interaction.

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9084,6 +9084,8 @@ update_global_location_list (int should_insert)
 		 traps we can no longer explain.  */
 
 	      old_loc->events_till_retirement = 3 * (thread_count () + 1);
+	      /* Red Hat Bug 590623.  */
+	      old_loc->events_till_retirement *= 10;
 	      old_loc->owner = NULL;
 
 	      VEC_safe_push (bp_location_p, moribund_locations, old_loc);

gdb-pie-1of6-reprelinked-bin.patch:
 solib-svr4.c                        |  180 +++++++++++++++++++++++++++++++++++-
 testsuite/gdb.base/break-interp.exp |  143 ++++++++++++++++++++--------
 2 files changed, 277 insertions(+), 46 deletions(-)

--- NEW FILE gdb-pie-1of6-reprelinked-bin.patch ---
http://sourceware.org/ml/gdb-patches/2010-03/msg01008.html
Subject: [patch 1/6]: PIE: Attach binary even after re-prelinked underneath

Hi,

there is a regression (against previous unreleased commits) by:
	Re: RFC: Verify AT_ENTRY before using it
	http://sourceware.org/ml/gdb-patches/2010-03/msg00395.html

for loading PIE executables which have changed on the disk since started.
There are in fact 3 different addresses one has to properly deal with.

This patch uses explicit "file" so it is not dependent on pending:
	[patch] Attach to running but deleted executable
	http://sourceware.org/ml/gdb-patches/2010-03/msg00950.html

The two copy-pasted blocks for elf32 and elf64 are "not nice" but this is the
current style in GDB.

No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
patch series together.


Thanks,
Jan


gdb/
2010-03-29  Jan Kratochvil  <jan.kratochvil at redhat.com>

	Fix attaching to PIEs prelinked on the disk since their start.
	* solib-svr4.c (svr4_exec_displacement): New variable arch_size.
	Verify it against bfd_get_arch_size.  Try to match arbitrary
	displacement for the phdrs comparison.

gdb/testsuite/
2010-03-29  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* gdb.base/break-interp.exp: Run $binpie with new value "ATTACH", new
	code for it.  New variable relink_args.
	(prelinkYES): Call prelinkNO.
	(test_attach): Accept new parameter relink_args.  Re-prelink the binary
	in such case.  Move the core code to ...
	(test_attach_gdb): ... a new function.  Send GDB command "file".
	Extend expected "Attaching to " string.

--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1750,13 +1750,183 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
 	 really do not match.  */
       int phdrs_size, phdrs2_size, ok = 1;
       gdb_byte *buf, *buf2;
+      int arch_size;
 
-      buf = read_program_header (-1, &phdrs_size, NULL);
+      buf = read_program_header (-1, &phdrs_size, &arch_size);
       buf2 = read_program_headers_from_bfd (exec_bfd, &phdrs2_size);
-      if (buf != NULL && buf2 != NULL
-	  && (phdrs_size != phdrs2_size
-	      || memcmp (buf, buf2, phdrs_size) != 0))
-	ok = 0;
+      if (buf != NULL && buf2 != NULL)
+	{
+	  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+
+	  /* We are dealing with three different addresses.  EXEC_BFD
+	     represents current address in on-disk file.  target memory content
+	     may be different from EXEC_BFD as the file may have been prelinked
+	     to a different address since the executable has been loaded.
+	     Moreover the address of placement in target memory can be
+	     different from what say the target memory program headers - this
+	     is the goal of PIE.
+
+	     Detected DISPLACEMENT covers both the offsets of PIE placement and
+	     possible new prelink since start of the program.  Here relocate
+	     BUF and BUF2 just by the EXEC_BFD vs. target memory content offset
+	     for the verification purpose.  */
+
+	  if (phdrs_size != phdrs2_size
+	      || bfd_get_arch_size (exec_bfd) != arch_size)
+	    ok = 0;
+	  else if (arch_size == 32 && phdrs_size >= sizeof (Elf32_External_Phdr)
+	           && phdrs_size % sizeof (Elf32_External_Phdr) == 0)
+	    {
+	      Elf_Internal_Ehdr *ehdr2 = elf_tdata (exec_bfd)->elf_header;
+	      Elf_Internal_Phdr *phdr2 = elf_tdata (exec_bfd)->phdr;
+	      CORE_ADDR displacement = 0;
+	      int i;
+
+	      /* DISPLACEMENT could be found easier by the difference of
+	         ehdr2->e_entry but already read BUF does not contain ehdr.  */
+
+	      for (i = 0; i < ehdr2->e_phnum; i++)
+		if (phdr2[i].p_type == PT_LOAD)
+		  {
+		    Elf32_External_Phdr *phdrp;
+		    gdb_byte *buf_vaddr_p, *buf_paddr_p;
+		    CORE_ADDR vaddr, paddr;
+		    CORE_ADDR displacement_vaddr = 0;
+		    CORE_ADDR displacement_paddr = 0;
+
+		    phdrp = &((Elf32_External_Phdr *) buf)[i];
+		    buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+		    buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+
+		    vaddr = extract_unsigned_integer (buf_vaddr_p, 4,
+						      byte_order);
+		    displacement_vaddr = vaddr - phdr2[i].p_vaddr;
+
+		    paddr = extract_unsigned_integer (buf_paddr_p, 4,
+						      byte_order);
+		    displacement_paddr = paddr - phdr2[i].p_paddr;
+
+		    if (displacement_vaddr == displacement_paddr)
+		      displacement = displacement_vaddr;
+
+		    break;
+		  }
+
+	      /* Now compare BUF and BUF2 with optional DISPLACEMENT.  */
+
+	      for (i = 0; i < phdrs_size / sizeof (Elf32_External_Phdr); i++)
+		{
+		  Elf32_External_Phdr *phdrp;
+		  Elf32_External_Phdr *phdr2p;
+		  gdb_byte *buf_vaddr_p, *buf_paddr_p;
+		  CORE_ADDR vaddr, paddr;
+
+		  phdrp = &((Elf32_External_Phdr *) buf)[i];
+		  buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+		  buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+		  phdr2p = &((Elf32_External_Phdr *) buf2)[i];
+
+		  /* PT_GNU_STACK addresses are left as zero not being
+		     relocated by prelink, their displacing would create false
+		     verification failure.  Feel free to test the unrelocated
+		     comparison for any segment type.  */
+
+		  if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+		    continue;
+
+		  vaddr = extract_unsigned_integer (buf_vaddr_p, 4, byte_order);
+		  vaddr -= displacement;
+		  store_unsigned_integer (buf_vaddr_p, 4, byte_order, vaddr);
+
+		  paddr = extract_unsigned_integer (buf_paddr_p, 4, byte_order);
+		  paddr -= displacement;
+		  store_unsigned_integer (buf_paddr_p, 4, byte_order, paddr);
+
+		  if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+		    continue;
+
+		  ok = 0;
+		  break;
+		}
+	    }
+	  else if (arch_size == 64 && phdrs_size >= sizeof (Elf64_External_Phdr)
+	           && phdrs_size % sizeof (Elf64_External_Phdr) == 0)
+	    {
+	      Elf_Internal_Ehdr *ehdr2 = elf_tdata (exec_bfd)->elf_header;
+	      Elf_Internal_Phdr *phdr2 = elf_tdata (exec_bfd)->phdr;
+	      CORE_ADDR displacement = 0;
+	      int i;
+
+	      /* DISPLACEMENT could be found easier by the difference of
+	         ehdr2->e_entry but already read BUF does not contain ehdr.  */
+
+	      for (i = 0; i < ehdr2->e_phnum; i++)
+		if (phdr2[i].p_type == PT_LOAD)
+		  {
+		    Elf64_External_Phdr *phdrp;
+		    gdb_byte *buf_vaddr_p, *buf_paddr_p;
+		    CORE_ADDR vaddr, paddr;
+		    CORE_ADDR displacement_vaddr = 0;
+		    CORE_ADDR displacement_paddr = 0;
+
+		    phdrp = &((Elf64_External_Phdr *) buf)[i];
+		    buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+		    buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+
+		    vaddr = extract_unsigned_integer (buf_vaddr_p, 8,
+						      byte_order);
+		    displacement_vaddr = vaddr - phdr2[i].p_vaddr;
+
+		    paddr = extract_unsigned_integer (buf_paddr_p, 8,
+						      byte_order);
+		    displacement_paddr = paddr - phdr2[i].p_paddr;
+
+		    if (displacement_vaddr == displacement_paddr)
+		      displacement = displacement_vaddr;
+
+		    break;
+		  }
+
+	      /* Now compare BUF and BUF2 with optional DISPLACEMENT.  */
+
+	      for (i = 0; i < phdrs_size / sizeof (Elf64_External_Phdr); i++)
+		{
+		  Elf64_External_Phdr *phdrp;
+		  Elf64_External_Phdr *phdr2p;
+		  gdb_byte *buf_vaddr_p, *buf_paddr_p;
+		  CORE_ADDR vaddr, paddr;
+
+		  phdrp = &((Elf64_External_Phdr *) buf)[i];
+		  buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+		  buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+		  phdr2p = &((Elf64_External_Phdr *) buf2)[i];
+
+		  /* PT_GNU_STACK addresses are left as zero not being
+		     relocated by prelink, their displacing would create false
+		     verification failure.  Feel free to test the unrelocated
+		     comparison for any segment type.  */
+
+		  if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+		    continue;
+
+		  vaddr = extract_unsigned_integer (buf_vaddr_p, 8, byte_order);
+		  vaddr -= displacement;
+		  store_unsigned_integer (buf_vaddr_p, 8, byte_order, vaddr);
+
+		  paddr = extract_unsigned_integer (buf_paddr_p, 8, byte_order);
+		  paddr -= displacement;
+		  store_unsigned_integer (buf_paddr_p, 8, byte_order, paddr);
+
+		  if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+		    continue;
+
+		  ok = 0;
+		  break;
+		}
+	    }
+	  else
+	    ok = 0;
+	}
 
       xfree (buf);
       xfree (buf2);
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -154,6 +154,12 @@ proc prelinkYES {arg {name ""}} {
     if {$name == ""} {
 	set name [file tail $arg]
     }
+
+    # Try to unprelink it first so that if it has been already prelinked before
+    # we get different address now and the result is not affected by the
+    # previous $arg state..
+    prelinkNO $arg "$name pre-unprelink"
+
     set test "prelink $name"
     set command "exec /usr/sbin/prelink -qNR --no-exec-shield $arg"
     verbose -log "command is $command"
@@ -319,38 +325,12 @@ proc test_core {file displacement} {
     set pf_prefix $old_ldprefix
 }
 
-proc test_attach {file displacement} {
-    global board_info gdb_prompt expect_out
-
-    gdb_exit
-
-    set test "sleep function started"
-
-    set command "${file} sleep"
-    set res [remote_spawn host $command];
-    if { $res < 0 || $res == "" } {
-	perror "Spawning $command failed."
-	fail $test
-	return
-    }
-    set pid [exp_pid -i $res]
-    gdb_expect {
-	-re "sleeping\r\n" {
-	    pass $test
-	}
-	eof {
-	    fail "$test (eof)"
-	    return
-	}
-	timeout {
-	    fail "$test (timeout)"
-	    return
-	}
-    }
+proc test_attach_gdb {file pid displacement prefix} {
+    global gdb_prompt expect_out
 
     global pf_prefix
     set old_ldprefix $pf_prefix
-    lappend pf_prefix "attach:"
+    lappend pf_prefix "$prefix:"
 
     gdb_exit
     gdb_start
@@ -358,9 +338,13 @@ proc test_attach {file displacement} {
     # Print the "PIE (Position Independent Executable) displacement" message.
     gdb_test "set verbose on"
 
+    if {$file != ""} {
+	gdb_test "file $file" "Reading symbols from .*done\\." "file"
+    }
+
     set test "attach"
     gdb_test_multiple "attach $pid" $test {
-	-re "Attaching to process $pid\r\n" {
+	-re "Attaching to (program: .*, )?process $pid\r\n" {
 	    # Missing "$gdb_prompt $" is intentional.
 	    pass $test
 	}
@@ -396,11 +380,56 @@ proc test_attach {file displacement} {
     gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
     gdb_exit
 
-    remote_exec host "kill -9 $pid"
-
     set pf_prefix $old_ldprefix
 }
 
+proc test_attach {file displacement {relink_args ""}} {
+    global board_info
+
+    gdb_exit
+
+    set test "sleep function started"
+
+    set command "${file} sleep"
+    set res [remote_spawn host $command];
+    if { $res < 0 || $res == "" } {
+	perror "Spawning $command failed."
+	fail $test
+	return
+    }
+    set pid [exp_pid -i $res]
+    gdb_expect {
+	-re "sleeping\r\n" {
+	    pass $test
+	}
+	eof {
+	    fail "$test (eof)"
+	    return
+	}
+	timeout {
+	    fail "$test (timeout)"
+	    return
+	}
+    }
+
+    if {$relink_args == ""} {
+	test_attach_gdb "" $pid $displacement "attach"
+    } else {
+	# These could be rather passed as arguments.
+	global exec interp_saved interp
+
+	foreach relink {YES NO} {
+	    if {[prelink$relink $relink_args [file tail $exec]]
+	        && [copy $interp_saved $interp]} {
+		# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
+		test_attach_gdb $exec $pid $displacement "attach-relink$relink"
+	    }
+	}
+    }
+
+    remote_exec host "kill -9 $pid"
+}
+
 proc test_ld {file ifmain trynosym displacement} {
     global srcdir subdir gdb_prompt expect_out
 
@@ -609,7 +638,10 @@ foreach ldprelink {NO YES} {
 	set old_binprefix $pf_prefix
 	foreach binprelink {NO YES} {
 	    foreach binsepdebug {NO IN SEP} {
-		foreach binpie {NO YES} {
+		# "ATTACH" is like "YES" but it is modified during run.
+		# It cannot be used for problem reproducibility after the
+		# testcase ends.
+		foreach binpie {NO YES ATTACH} {
 		    # This combination is not possible, non-PIE (fixed address)
 		    # binary cannot be prelinked to any (other) address.
 		    if {$binprelink == "YES" && $binpie == "NO"} {
@@ -628,7 +660,7 @@ foreach ldprelink {NO YES} {
 		    if {$binsepdebug != "NO"} {
 			lappend opts {debug}
 		    }
-		    if {$binpie == "YES"} {
+		    if {$binpie != "NO"} {
 			lappend opts {additional_flags=-fPIE -pie}
 		    }
 		    if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
@@ -680,16 +712,45 @@ foreach ldprelink {NO YES} {
 			lappend dests $dest
 		    }
 
-		    if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" [file tail $exec]]
+		    if {$binpie == "NO"} {
+			set displacement "NONE"
+		    } elseif {$binprelink == "NO"} {
+			set displacement "NONZERO"
+		    } else {
+			set displacement "ZERO"
+		    }
+
+		    set relink_args "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]"
+		    if {[prelink$binprelink $relink_args [file tail $exec]]
 		        && [copy $interp_saved $interp]} {
-			if {$binpie == "NO"} {
-			    set displacement "NONE"
-			} elseif {$binprelink == "NO"} {
-			    set displacement "NONZERO"
+			if {$binpie != "ATTACH"} {
+			    test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
 			} else {
-			    set displacement "ZERO"
+			    # If the file has been randomly prelinked it must
+			    # be "NONZERO".  We could see "ZERO" only if it was
+			    # unprelinked na it is now running at the same
+			    # address - which is 0 but executable can never run
+			    # at address 0.
+
+			    set displacement "NONZERO"
+			    test_attach $exec $displacement $relink_args
+
+			    # ATTACH executables + libraries get modified since
+			    # they have been run.  They cannot be used for
+			    # problem reproducibility after the testcase ends.
+			    set exec_debug [system_debug_get $exec]
+			    if {$exec_debug != ""} {
+				# `file delete [glob "${exec_debug}*"]' does not work.
+				foreach f [glob "${exec_debug}*"] {
+				    file delete $f
+				}
+			    }
+			    file delete -force $dir
+			    # `file delete [glob "${exec}*"]' does not work.
+			    foreach f [glob "${exec}*"] {
+				file delete $f
+			    }
 			}
-			test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
 		    }
 		}
 	    }


gdb-pie-2of6-reprelinked-ld.patch:
 auxv.c                              |   11 ++++++++++-
 testsuite/gdb.base/break-interp.exp |    8 ++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

--- NEW FILE gdb-pie-2of6-reprelinked-ld.patch ---
http://sourceware.org/ml/gdb-patches/2010-03/msg01000.html
Subject: [patch 2/6] PIE: Attach binary even after ld.so re-prelinked  underneath

Hi,

when I have seen the PIE-binary-changed-sice-start tested also
ld.so-changed-since-start and it did not work.

There is questionable when to print and when to not to print non-fatal memory
read errors.  Similar change I requested in
	Re: [RFC/ia64] memory error when reading wrong core file
	http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html
so that GDB prints at least as a warning
	Cannot access memory at address ...
when some unexpected error happens.

Contrary to it there is not such warning present in the code below as in the
case of non-valgrind PIE with re-prelinked ld.so the memory read error happens
there.  Some GDB code rework could probably avoid it.

Just for example all the memory read errors in read_program_header or even
- primarily - scan_dyntag are currently IMO-incorrectly silent and others.
Therefore posted the patch this way, making all these warnings printed and
possibly fixing code attempting incorrect reads along the way could be done by
a different patch.

No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
patch series together.


Thanks,
Jan


gdb/
2010-03-29  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* auxv.c (ld_so_xfer_auxv): Do not error on failed read of data_address.

gdb/testsuite/
2010-03-29  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* gdb.base/break-interp.exp (test_attach): Keep $interp changed.  Move
	its restore after the <$relink_args != ""> loop.  new comment.

--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -96,7 +96,16 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
 
   pointer_address = SYMBOL_VALUE_ADDRESS (msym);
 
-  data_address = read_memory_typed_address (pointer_address, ptr_type);
+  /* While it is an error I am not aware how to solve attaching to PIE under
+     valgrind --db-attach=yes different way when ld.so on-disk file has prelink
+     change in the meantime.  Currently GDB will drop back to procfs_xfer_auxv
+     (so that at least non-valgrind PIE attachments with prelink change of
+     ld.so work).  To make it working even with valgrind is PR 11440 requiring
+     a valgrind extension.  */
+  if (target_read_memory (pointer_address, ptr_buf, ptr_size) != 0)
+    return -1;
+
+  data_address = extract_typed_address (ptr_buf, ptr_type);
 
   /* Possibly still not initialized such as during an inferior startup.  */
   if (data_address == 0)
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -419,12 +419,16 @@ proc test_attach {file displacement {relink_args ""}} {
 	global exec interp_saved interp
 
 	foreach relink {YES NO} {
-	    if {[prelink$relink $relink_args [file tail $exec]]
-	        && [copy $interp_saved $interp]} {
+	    # It would be more correct to also [copy $interp_saved $interp]
+	    # here to really test just different prelink of $exec.
+	    # But we would need a separate test for different prelink of ld.so
+	    # where a bug occured.  It is now all merged into this single test.
+	    if [prelink$relink $relink_args [file tail $exec]] {
 		# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
 		test_attach_gdb $exec $pid $displacement "attach-relink$relink"
 	    }
 	}
+	copy $interp_saved $interp
     }
 
     remote_exec host "kill -9 $pid"


gdb-pie-3of6-relocate-once.patch:
 b/gdb/testsuite/gdb.base/attach-pie-misread.c   |   47 +++++
 b/gdb/testsuite/gdb.base/attach-pie-misread.exp |  209 ++++++++++++++++++++++++
 gdb/auxv.c                                      |    3 
 gdb/solib-svr4.c                                |    4 
 gdb/testsuite/gdb.base/break-interp.exp         |   16 -
 5 files changed, 264 insertions(+), 15 deletions(-)

--- NEW FILE gdb-pie-3of6-relocate-once.patch ---
http://sourceware.org/ml/gdb-patches/2010-03/msg01001.html
Subject: [patch 3/6] PIE: Fix occasional error attaching i686 binary

[ Testcase diff backported.  ]

Hi,

this is the real bugreport which started this patch series.
	gdb "Cannot access memory" on a running process
	https://bugzilla.redhat.com/show_bug.cgi?id=576742

Offsets on i686 cause that while attaching to an unprelinked running PIE
scan_dyntag will incorrectly get a successful read in scan_dyntag from DT_DEBUG
it expects is from the mani executable but in fact it is from some ld.so or
libc.so (located low for --exec-shield).  Another issue is that scan_dyntag
could verify more that the target memory matches the .dynamic section it is
reading from exec_bfd.  It could also complain when the read failed (as always
failed so for for PIE attaches first, succeeded later so nobody has noticed
anything).

The successful read reads a bogus DT_DEBUG value and GDB errors on it later.
This is again a non-fatal error after the patch by Joel Brobecker above but it
was not so before and it is incorrect anyway.

The svr4_relocate_main_executable call in svr4_special_symbol_handling was
there before delayed that way for svr4_static_exec_displacement.
But svr4_static_exec_displacement has been removed in the meantime by:
	Re: RFC: Verify AT_ENTRY before using it
	http://sourceware.org/ml/gdb-patches/2010-03/msg00030.html

So it can be simplified + corrected now.  Moreover GDB will now finally print
exactly "Using PIE (Position Independent Executable) displacement" exactly
once.

The reproducer depends on various offsets which may be distro dependent but it
was made so that it is hopefully reproducible everywhere.  Reproduced + fixed
on Fedora 12 x86_64 and i686.

No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
patch series together.


Thanks,
Jan


gdb/
2010-03-29  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* auxv.c (memory_xfer_auxv): Update attach comment.
	* solib-svr4.c (svr4_special_symbol_handling): Remove the call to
	svr4_relocate_main_executable.
	(svr4_solib_create_inferior_hook): Make the call to
	svr4_relocate_main_executable unconditional.

gdb/testsuite/
2010-03-29  Jan Kratochvil  <jan.kratochvil at redhat.com>

	* gdb.base/attach-pie-misread.exp, gdb.base/attach-pie-misread.c: New.

--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -198,7 +198,8 @@ memory_xfer_auxv (struct target_ops *ops,
 
    /* ld_so_xfer_auxv is the only function safe for virtual executables being
       executed by valgrind's memcheck.  As using ld_so_xfer_auxv is problematic
-      during inferior startup GDB does call it only for attached processes.  */
+      during inferior startup as ld.so symbol tables are not yet relocated GDB
+      calls ld_so_xfer_auxv only for attached processes.  */
 
   if (current_inferior ()->attach_flag != 0)
     {
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1628,7 +1628,6 @@ enable_break (struct svr4_info *info, int from_tty)
 static void
 svr4_special_symbol_handling (void)
 {
-  svr4_relocate_main_executable ();
 }
 
 /* Read the ELF program headers from ABFD.  Return the contents and
@@ -2065,8 +2064,7 @@ svr4_solib_create_inferior_hook (int from_tty)
   info = get_svr4_info ();
 
   /* Relocate the main executable if necessary.  */
-  if (current_inferior ()->attach_flag == 0)
-    svr4_relocate_main_executable ();
+  svr4_relocate_main_executable ();
 
   if (!svr4_have_link_map_offsets ())
     return;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.c
@@ -0,0 +1,47 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <unistd.h>
+
+const char stub[] = {
+#ifdef GEN
+# include GEN
+#endif
+};
+
+int
+main (int argc, char **argv)
+{
+  /* Generator of GEN written in Python takes about 15s for x86_64's 4MB.  */
+  if (argc == 2)
+    {
+      long count = strtol (argv[1], NULL, 0);
+
+      while (count-- > 0)
+	puts ("0x55,");
+
+      return 0;
+    }
+  if (argc != 1)
+    return 1;
+
+  puts ("sleeping");
+  fflush (stdout);
+
+  return sleep (60);
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -0,0 +1,209 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This test only works on GNU/Linux.
+if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} {
+    continue
+}
+
+set test "attach-pie-misread"
+set srcfile ${test}.c
+set genfile ${objdir}/${subdir}/${test}-gen.h
+set executable ${test}
+set binfile ${objdir}/${subdir}/${executable}
+
+if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie"]] == -1} {
+    return -1
+}
+
+# Program Headers:
+#   Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
+#   LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x134f5ec 0x134f5ec R E 0x200000
+#   LOAD           0x134f5f0 0x000000000194f5f0 0x000000000194f5f0 0x1dbc60 0x214088 RW  0x200000
+#   DYNAMIC        0x134f618 0x000000000194f618 0x000000000194f618 0x000200 0x000200 RW  0x8
+#
+proc read_phdr {binfile test} {
+    set readelf_program [transform readelf]
+    set command "exec $readelf_program -Wl $binfile"
+    verbose -log "command is $command"
+    set result [catch $command output]
+    verbose -log "result is $result"
+    verbose -log "output is $output"
+    if {$result != 0} {
+	fail $test
+	return
+    }
+    if ![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr] {
+	fail "$test (no Program Headers)"
+	return
+    }
+    if ![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr] {
+	fail "$test (no DYNAMIC found)"
+	return
+    }
+    verbose -log "dynamic_vaddr is $dynamic_vaddr"
+    set align_max -1
+    foreach {trash align} [regexp -line -all -inline {^ *LOAD .* (0x[0-9]+)$} $phdr] {
+	if {$align_max < $align} {
+	    set align_max $align
+	}
+    }
+    verbose -log "align_max is $align_max"
+    if {$align_max == -1} {
+	fail "$test (no LOAD found)"
+	return
+    }
+    pass $test
+    return [list $dynamic_vaddr $align_max]
+}
+
+set phdr [read_phdr $binfile "readelf initial scan"]
+set dynamic_vaddr [lindex $phdr 0]
+set align_max [lindex $phdr 1]
+
+set stub_size [format 0x%x [expr "2 * $align_max - ($dynamic_vaddr & ($align_max - 1))"]]
+verbose -log "stub_size is $stub_size"
+
+# On x86_64 it is commonly about 4MB.
+if {$stub_size > 25000000} {
+    xfail "stub size $stub_size is too large"
+    return
+}
+
+set test "generate stub"
+set command "exec $binfile $stub_size >$genfile"
+verbose -log "command is $command"
+set result [catch $command output]
+verbose -log "result is $result"
+verbose -log "output is $output"
+if {$result == 0} {
+    pass $test
+} else {
+    fail $test
+}
+
+if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie -DGEN=\"$genfile\""]] == -1} {
+    return -1
+}
+
+# x86_64 file has 25MB, no need to keep it.
+file delete -- $genfile
+
+set phdr [read_phdr $binfile "readelf rebuilt with stub_size"]
+set dynamic_vaddr_prelinkno [lindex $phdr 0]
+
+set command "exec /usr/sbin/prelink -q -N --no-exec-shield -R $binfile"
+verbose -log "command is $command"
+set result [catch $command output]
+verbose -log "result is $result"
+verbose -log "output is $output"
+
+set test "prelink -R"
+if {$result == 0 && $output == ""} {
+    pass $test
+} elseif {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} {
+    untested attach-pie-misread.exp
+    return -1
+} else {
+    fail $test
+}
+
+set phdr [read_phdr $binfile "readelf with prelink -R"]
+set dynamic_vaddr_prelinkyes [lindex $phdr 0]
+
+set first_offset [format 0x%x [expr $dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno]]
+verbose -log "first_offset is $first_offset"
+
+set test "first offset is non-zero"
+if {$first_offset == 0} {
+    fail "$test (-fPIE -pie in effect?)"
+} else {
+    pass $test
+}
+
+set test "start inferior"
+gdb_exit
+
+set res [remote_spawn host $binfile];
+if { $res < 0 || $res == "" } {
+    perror "Spawning $binfile failed."
+    fail $test
+    return
+}
+set pid [exp_pid -i $res]
+gdb_expect {
+    -re "sleeping\r\n" {
+	pass $test
+    }
+    eof {
+	fail "$test (eof)"
+	remote_exec host "kill -9 $pid"
+	return
+    }
+    timeout {
+	fail "$test (timeout)"
+	remote_exec host "kill -9 $pid"
+	return
+    }
+}
+
+# Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
+foreach align_mult {1 2} {
+    set old_ldprefix $pf_prefix
+    lappend pf_prefix "shift-by-$align_mult:"
+
+    # FIXME: We believe there is enough room under FIRST_OFFSET.
+    set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
+    verbose -log "shifted_offset is $shifted_offset"
+
+    set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offset $binfile"
+    verbose -log "command is $command"
+    set result [catch $command output]
+    verbose -log "result is $result"
+    verbose -log "output is $output"
+
+    set test "prelink -r"
+    if {$result == 0 && $output == ""} {
+	pass $test
+    } else {
+	fail $test
+    }
+
+    clean_restart $executable
+
+    set test "attach"
+    gdb_test_multiple "attach $pid" $test {
+	-re "Attaching to program: .*, process $pid\r\n" {
+	    # Missing "$gdb_prompt $" is intentional.
+	    pass $test
+	}
+    }
+
+    set test "error on Cannot access memory at address"
+    gdb_test_multiple "" $test {
+	-re "\r\nCannot access memory at address .*$gdb_prompt $" {
+	    fail $test
+	}
+	-re "$gdb_prompt $" {
+	    pass $test
+	}
+    }
+
+    gdb_test "detach" "Detaching from program: .*"
+
+    set pf_prefix $old_ldprefix
+}
+
+remote_exec host "kill -9 $pid"
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -248,9 +248,8 @@ proc reach {func command displacement} {
 		}
 		if {$displacement == $case} {
 		    pass $test_displacement
-		    # Permit multiple such messages.
 		    set displacement "FOUND-$displacement"
-		} elseif {$displacement != "FOUND-$case"} {
+		} else {
 		    fail $test_displacement
 		}
 		exp_continue
@@ -304,9 +303,8 @@ proc test_core {file displacement} {
 	    }
 	    if {$displacement == $case} {
 		pass $test_displacement
-		# Permit multiple such messages.
 		set displacement "FOUND-$displacement"
-	    } elseif {$displacement != "FOUND-$case"} {
+	    } else {
 		fail $test_displacement
 	    }
 	    exp_continue
@@ -362,9 +360,8 @@ proc test_attach_gdb {file pid displacement prefix} {
 	    }
 	    if {$displacement == $case} {
 		pass $test_displacement
-		# Permit multiple such messages.
 		set displacement "FOUND-$displacement"
-	    } elseif {$displacement != "FOUND-$case"} {
+	    } else {
 		fail $test_displacement
 	    }
 	    exp_continue
@@ -451,9 +448,7 @@
     gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
 
     if $ifmain {
-	# Displacement message will be printed the second time on initializing
-	# the linker from svr4_special_symbol_handling.
-	reach "main" continue $displacement
+	reach "main" continue "NONE"
 
 	reach "libfunc" continue "NONE"
 
@@ -528,9 +517,8 @@ proc test_ld {file ifmain trynosym displacement} {
 		}
 		if {$displacement == $case} {
 		    pass $test_displacement
-		    # Permit multiple such messages.
 		    set displacement "FOUND-$displacement"
-		} elseif {$displacement != "FOUND-$case"} {
+		} else {
 		    fail $test_displacement
 		}
 		exp_continue


gdb-pie-rerun.patch:
 solib-svr4.c                        |   15 ++++-----------
 testsuite/gdb.base/break-interp.exp |   19 +++++++++++--------
 2 files changed, 15 insertions(+), 19 deletions(-)

--- NEW FILE gdb-pie-rerun.patch ---
http://sourceware.org/ml/gdb-patches/2010-03/msg00868.html
Subject: [patch] PIE: Fix back re-run  [Re: [patch] svr4_exec_displacement  success indicator]

Hi,

currently:

$ echo 'main(){}'|gcc -o 1 -fPIE -pie -x c -; ./gdb -nx -ex 'set disable-randomization off' -ex 'b main' -ex r -ex c -ex r ./1
Breakpoint 1 at 0x6b0
Starting program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/1 
Breakpoint 1, 0x00007fbf73e8c6b0 in main ()
Continuing.
Program exited with code 0140.
Starting program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/1 
Error in re-setting breakpoint 1: Cannot access memory at address 0x7fbf73e8c6ac

It is since:
	[patch] svr4_exec_displacement success indicator [Re: PIE question]
	http://sourceware.org/ml/gdb-patches/2010-03/msg00336.html


On Mon, 08 Mar 2010 22:53:58 +0100, Jan Kratochvil wrote:
> Attached these changes:
> 
> * svr4_exec_displacement calling convention should have success indicator.
> 
> * Preserving now section_offsets if they are already set, inspired by
>   init_objfile_sect_indices.
> 
> I believe either of parts would be sufficient for this problem.

The first part has caused the regression for PIE on native x86* GNU/Linux host.

As I believe for Daniel J.'s seen regression of `qOffsets' the second already
checked-in part is sufficient - I would like to remove the first part.

OK to check it in?

No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.

(I do not think one needs to think about 7.1-branch as it is not a regression
against any FSF GDB release.)


Thanks,
Jan


gdb/
2010-03-25  Jan Kratochvil  <jan.kratochvil at redhat.com>

	Fix re-run of PIE executable.
	* solib-svr4.c (svr4_relocate_main_executable) <symfile_objfile>: Remove
	the part of pre-set SYMFILE_OBJFILE->SECTION_OFFSETS.

gdb/testsuite/
2010-03-25  Jan Kratochvil  <jan.kratochvil at redhat.com>

	Fix re-run of PIE executable.
	* gdb.base/break-interp.exp (test_ld): Turn off "disable-randomization".
	Remove $displacement_main to match the solib-svr4.c change.  New "kill"
	and re-"run" of the inferior.

--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1791,17 +1791,10 @@ svr4_relocate_main_executable (void)
 {
   CORE_ADDR displacement;
 
-  if (symfile_objfile)
-    {
-      int i;
-
-      /* Remote target may have already set specific offsets by `qOffsets'
-	 which should be preferred.  */
-
-      for (i = 0; i < symfile_objfile->num_sections; i++)
-	if (ANOFFSET (symfile_objfile->section_offsets, i) != 0)
-	  return;
-    }
+  /* SYMFILE_OBJFILE->SECTION_OFFSETS may now contain displacement from the
+     previous run of the inferior.  Re-set it according to the current value,
+     if we can find it out.  But otherwise keep it as for remote target it may
+     have been pre-set by the `qOffsets' packet.  */
 
   if (! svr4_exec_displacement (&displacement))
     return;
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -416,25 +416,28 @@ proc test_ld {file ifmain trynosym displacement} {
     # Print the "PIE (Position Independent Executable) displacement" message.
     gdb_test "set verbose on"
 
+    # A bit better test coverage.
+    gdb_test "set disable-randomization off"
+
     reach "dl_main" "run segv" $displacement
 
     gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
 
     if $ifmain {
 	# Displacement message will be printed the second time on initializing
-	# the linker from svr4_special_symbol_handling.  If any ANOFFSET has
-	# been already set as non-zero the detection will no longer be run.
-	if {$displacement == "NONZERO"} {
-	    set displacement_main "NONE"
-	} else {
-	    set displacement_main $displacement
-	}
-	reach "main" continue $displacement_main
+	# the linker from svr4_special_symbol_handling.
+	reach "main" continue $displacement
 
 	reach "libfunc" continue "NONE"
 
 	gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt"
+    }
 
+    # Try re-run if the new PIE displacement takes effect.
+    gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
+    reach "dl_main" "run  segv" $displacement
+
+    if $ifmain {
 	test_core $file $displacement
 
 	test_attach $file $displacement


gdb-solib-memory-error-nonfatal.patch:
 solib-svr4.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

--- NEW FILE gdb-solib-memory-error-nonfatal.patch ---
[RFC/ia64] memory error when reading wrong core file
http://sourceware.org/ml/gdb-patches/2010-01/msg00645.html
http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html
http://sourceware.org/ml/gdb-patches/2010-03/msg00298.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00065.html
c961a8da422283662e09ee498c0598d48fc9d70f

--- src/gdb/solib-svr4.c	2010/02/24 00:29:02	1.125
+++ src/gdb/solib-svr4.c	2010/03/08 07:45:49	1.126
@@ -868,9 +868,16 @@
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
   struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+  CORE_ADDR addr = 0;
+  volatile struct gdb_exception ex;
 
-  return read_memory_typed_address (info->debug_base + lmo->r_map_offset,
-				    ptr_type);
+  TRY_CATCH (ex, RETURN_MASK_ERROR)
+    {
+      addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
+                                        ptr_type);
+    }
+  exception_print (gdb_stderr, ex);
+  return addr;
 }
 
 /* Find r_brk from the inferior's debug base.  */
### src/gdb/ChangeLog	2010/03/08 01:49:30	1.11441
### src/gdb/ChangeLog	2010/03/08 07:45:49	1.11442
## -1,3 +1,10 @@
+2010-03-08  Joel Brobecker  <brobecker at adacore.com>
+
+	Memory error when reading wrong core file.
+	* solib-svr4.c (solib_svr4_r_map): catch and print all exception
+	errors while reading the inferior memory, and return zero if
+	an exception was raised.
+
 2010-03-07  Michael Snyder  <msnyder at vmware.com>
 
 	* record.c (record_restore): Rename tmpu8 to rectype.

gdb-unwind-debughook-safe-fail.patch:
 infrun.c |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

--- NEW FILE gdb-unwind-debughook-safe-fail.patch ---
commit 802214c97d1661ad337aad0d011dded44f0b5ddd
Author: Tom Tromey <tromey at redhat.com>
Date:   Mon Apr 26 15:15:55 2010 -0600

    Fail gracefully if the _Unwind_DebugHook argument is optimized out

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2eea550..9a5b534 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4925,20 +4925,24 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 
       vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL);
       value = read_var_value (vsym, frame);
-      handler = value_as_address (value);
+      /* If the value was optimized out, revert to the old behavior.  */
+      if (! value_optimized_out (value))
+	{
+	  handler = value_as_address (value);
 
-      /* We're going to replace the current step-resume breakpoint
-	 with an exception-resume breakpoint.  */
-      delete_step_resume_breakpoint (tp);
+	  /* We're going to replace the current step-resume breakpoint
+	     with an exception-resume breakpoint.  */
+	  delete_step_resume_breakpoint (tp);
 
-      if (debug_infrun)
-	fprintf_unfiltered (gdb_stdlog,
-			    "infrun: exception resume at %lx\n",
-			    (unsigned long) handler);
+	  if (debug_infrun)
+	    fprintf_unfiltered (gdb_stdlog,
+				"infrun: exception resume at %lx\n",
+				(unsigned long) handler);
 
-      bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
-					   handler, bp_exception_resume);
-      inferior_thread ()->step_resume_breakpoint = bp;
+	  bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
+					       handler, bp_exception_resume);
+	  inferior_thread ()->step_resume_breakpoint = bp;
+	}
     }
 }
 

gdb-unwind-debughook-step-independent.patch:
 gdbthread.h                  |    6 ++++
 infrun.c                     |   61 +++++++++++++++++++++++--------------------
 testsuite/gdb.cp/gdb9593.exp |    2 -
 thread.c                     |   10 +++++++
 4 files changed, 50 insertions(+), 29 deletions(-)

--- NEW FILE gdb-unwind-debughook-step-independent.patch ---
commit f8ca03e0097ae49c66cf33a50e3247bccd3a4a33
Author: Tom Tromey <tromey at redhat.com>
Date:   Wed Apr 28 14:17:38 2010 -0600

    Reimplement infrun parts of next-over-throw.
    Previously, we reset the step-resume breakpoint.
    However, this can do the wrong thing if an exception
    is thrown and caught beneath the nexting frame.
    The new approach is to have a separate exception-resume
    breakpoint.

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 611dcbb..9638368 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -66,6 +66,9 @@ struct thread_info
   /* Step-resume or longjmp-resume breakpoint.  */
   struct breakpoint *step_resume_breakpoint;
 
+  /* Exception-resume breakpoint.  */
+  struct breakpoint *exception_resume_breakpoint;
+
   /* Range to single step within.
 
      If this is nonzero, respond to a single-step signal by continuing
@@ -225,6 +228,9 @@ extern void delete_thread_silent (ptid_t);
 /* Delete a step_resume_breakpoint from the thread database. */
 extern void delete_step_resume_breakpoint (struct thread_info *);
 
+/* Delete an exception_resume_breakpoint from the thread database. */
+extern void delete_exception_resume_breakpoint (struct thread_info *);
+
 /* Translate the integer thread id (GDB's homegrown id, not the system's)
    into a "pid" (which may be overloaded with extra thread information).  */
 extern ptid_t thread_id_to_pid (int);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9a5b534..3546cf1 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -300,6 +300,7 @@ follow_fork (void)
      parent thread structure's run control related fields, not just these.
      Initialized to avoid "may be used uninitialized" warnings from gcc.  */
   struct breakpoint *step_resume_breakpoint = NULL;
+  struct breakpoint *exception_resume_breakpoint = NULL;
   CORE_ADDR step_range_start = 0;
   CORE_ADDR step_range_end = 0;
   struct frame_id step_frame_id = { 0 };
@@ -352,6 +353,8 @@ follow_fork (void)
 	    step_range_start = tp->step_range_start;
 	    step_range_end = tp->step_range_end;
 	    step_frame_id = tp->step_frame_id;
+	    exception_resume_breakpoint
+	      = clone_momentary_breakpoint (tp->exception_resume_breakpoint);
 
 	    /* For now, delete the parent's sr breakpoint, otherwise,
 	       parent/child sr breakpoints are considered duplicates,
@@ -362,6 +365,7 @@ follow_fork (void)
 	    tp->step_range_start = 0;
 	    tp->step_range_end = 0;
 	    tp->step_frame_id = null_frame_id;
+	    delete_exception_resume_breakpoint (tp);
 	  }
 
 	parent = inferior_ptid;
@@ -403,6 +407,8 @@ follow_fork (void)
 		    tp->step_range_start = step_range_start;
 		    tp->step_range_end = step_range_end;
 		    tp->step_frame_id = step_frame_id;
+		    tp->exception_resume_breakpoint
+		      = exception_resume_breakpoint;
 		  }
 		else
 		  {
@@ -456,6 +462,9 @@ follow_inferior_reset_breakpoints (void)
   if (tp->step_resume_breakpoint)
     breakpoint_re_set_thread (tp->step_resume_breakpoint);
 
+  if (tp->exception_resume_breakpoint)
+    breakpoint_re_set_thread (tp->exception_resume_breakpoint);
+
   /* Reinsert all breakpoints in the child.  The user may have set
      breakpoints after catching the fork, in which case those
      were never set in the child, but only in the parent.  This makes
@@ -694,6 +703,7 @@ follow_exec (ptid_t pid, char *execd_pathname)
   /* If there was one, it's gone now.  We cannot truly step-to-next
      statement through an exec(). */
   th->step_resume_breakpoint = NULL;
+  th->exception_resume_breakpoint = NULL;
   th->step_range_start = 0;
   th->step_range_end = 0;
 
@@ -2145,6 +2155,7 @@ delete_step_resume_breakpoint_callback (struct thread_info *info, void *data)
     return 0;
 
   delete_step_resume_breakpoint (info);
+  delete_exception_resume_breakpoint (info);
   return 0;
 }
 
@@ -2168,6 +2179,7 @@ delete_step_thread_step_resume_breakpoint (void)
 	 stepping.  */
       struct thread_info *tp = inferior_thread ();
       delete_step_resume_breakpoint (tp);
+      delete_exception_resume_breakpoint (tp);
     }
   else
     /* In all-stop mode, delete all step-resume and longjmp-resume
@@ -3832,30 +3844,31 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
 	  fprintf_unfiltered (gdb_stdlog,
 			      "infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n");
 
-	gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
-	delete_step_resume_breakpoint (ecs->event_thread);
-
-	if (!what.is_longjmp)
+	if (what.is_longjmp)
+	  {
+	    gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
+	    delete_step_resume_breakpoint (ecs->event_thread);
+	  }
+	else
 	  {
 	    /* There are several cases to consider.
-	       
+
 	       1. The initiating frame no longer exists.  In this case
 	       we must stop, because the exception has gone too far.
-	       
+
 	       2. The initiating frame exists, and is the same as the
-	       current frame.
-	       
-	       2.1. If we are stepping, defer to the stepping logic.
-	       
-	       2.2. Otherwise, we are not stepping, so we are doing a
-	       "finish" and we have reached the calling frame.  So,
-	       stop.
-	       
+	       current frame.  We stop, because the exception has been
+	       caught.
+
 	       3. The initiating frame exists and is different from
 	       the current frame.  This means the exception has been
 	       caught beneath the initiating frame, so keep going.  */
 	    struct frame_info *init_frame
 	      = frame_find_by_id (ecs->event_thread->initiating_frame);
+
+	    gdb_assert (ecs->event_thread->exception_resume_breakpoint != NULL);
+	    delete_exception_resume_breakpoint (ecs->event_thread);
+
 	    if (init_frame)
 	      {
 		struct frame_id current_id
@@ -3863,15 +3876,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
 		if (frame_id_eq (current_id,
 				 ecs->event_thread->initiating_frame))
 		  {
-		    if (ecs->event_thread->step_range_start)
-		      {
-			/* Case 2.1.  */
-			break;
-		      }
-		    else
-		      {
-			/* Case 2.2: fall through.  */
-		      }
+		    /* Case 2.  Fall through.  */
 		  }
 		else
 		  {
@@ -3880,6 +3885,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
 		    return;
 		  }
 	      }
+
+	    /* For Cases 1 and 2, remove the step-resume breakpoint,
+	       if it exists.  */
+	    delete_step_resume_breakpoint (ecs->event_thread);
 	  }
 
 	ecs->event_thread->stop_step = 1;
@@ -4930,10 +4939,6 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 	{
 	  handler = value_as_address (value);
 
-	  /* We're going to replace the current step-resume breakpoint
-	     with an exception-resume breakpoint.  */
-	  delete_step_resume_breakpoint (tp);
-
 	  if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog,
 				"infrun: exception resume at %lx\n",
@@ -4941,7 +4946,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
 
 	  bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
 					       handler, bp_exception_resume);
-	  inferior_thread ()->step_resume_breakpoint = bp;
+	  inferior_thread ()->exception_resume_breakpoint = bp;
 	}
     }
 }
diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp
index ee9aeff..c77dbd8 100644
--- a/gdb/testsuite/gdb.cp/gdb9593.exp
+++ b/gdb/testsuite/gdb.cp/gdb9593.exp
@@ -145,7 +145,7 @@ gdb_test "step" \
   "step into finish, for until"
 
 gdb_test "until" \
-  ".*catch .int x.*" \
+  ".*function1 ().*" \
   "until with no argument 1"
 
 set line [gdb_get_line_number "marker for until" $testfile.cc]
diff --git a/gdb/thread.c b/gdb/thread.c
index 16a207c..3c52ae4 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -90,6 +90,16 @@ delete_step_resume_breakpoint (struct thread_info *tp)
     }
 }
 
+void
+delete_exception_resume_breakpoint (struct thread_info *tp)
+{
+  if (tp && tp->exception_resume_breakpoint)
+    {
+      delete_breakpoint (tp->exception_resume_breakpoint);
+      tp->exception_resume_breakpoint = NULL;
+    }
+}
+
 static void
 clear_thread_inferior_resources (struct thread_info *tp)
 {

gdb-upstream.patch:
 b/gdb/testsuite/gdb.base/dup-sect.S                  |   22 ++
 b/gdb/testsuite/gdb.base/dup-sect.exp                |   84 +++++++
 gdb/completer.c                                      |   13 +
 gdb/symfile.c                                        |   15 +
 src/gdb/config/djgpp/fnchange.lst                    |   11 +
 src/gdb/gdbserver/linux-low.c                        |   24 +-
 src/gdb/infcmd.c                                     |    5 
 src/gdb/linux-nat.c                                  |   19 +
 src/gdb/solib-svr4.c                                 |   78 +++++--
 src/gdb/symfile.c                                    |   45 +++-
 src/gdb/testsuite/gdb.base/break-entry.exp           |   43 ++++
 src/gdb/testsuite/gdb.base/break-interp.exp          |  204 ++++++++++++++++---
 src/gdb/testsuite/gdb.base/prelink.exp               |   18 -
 src/gdb/testsuite/gdb.base/solib-corrupted.exp       |   51 ++++
 src/gdb/testsuite/gdb.threads/watchthreads-reorder.c |   15 +
 15 files changed, 570 insertions(+), 77 deletions(-)

Index: gdb-upstream.patch
===================================================================
RCS file: gdb-upstream.patch
diff -N gdb-upstream.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb-upstream.patch	11 Jul 2010 18:06:33 -0000	1.3
@@ -0,0 +1,1179 @@
+http://sourceware.org/ml/gdb-cvs/2010-03/msg00104.html
+5855954454f19a801f76bbf7baafd11a693c5d33
+
+Imported to sync gdb.base/break-interp.exp for gdb-pie-rerun.patch.
+
+### src/gdb/ChangeLog	2010/03/11 03:45:48	1.11469
+### src/gdb/ChangeLog	2010/03/11 22:07:00	1.11470
+## -1,3 +1,9 @@
++2010-03-11  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	* solib-svr4.c (LM_ADDR_CHECK) <info_verbose>: Use printf_unfiltered
++	for the PIC displacement, print also the displacement value.
++	(svr4_exec_displacement):  Print DISPLACEMENT if INFO_VERBOSE.
++
+ 2010-03-10  Kevin Buettner  <kevinb at redhat.com>
+ 
+ 	* remote-mips.c (close_ports, mips_initialize_cleanups)
+--- src/gdb/solib-svr4.c	2010/03/10 20:55:44	1.129
++++ src/gdb/solib-svr4.c	2010/03/11 22:07:02	1.130
+@@ -243,12 +243,10 @@
+ 	      l_addr = l_dynaddr - dynaddr;
+ 
+ 	      if (info_verbose)
+-		{
+-		  warning (_(".dynamic section for \"%s\" "
+-			     "is not at the expected address"), so->so_name);
+-		  warning (_("difference appears to be caused by prelink, "
+-			     "adjusting expectations"));
+-		}
++		printf_unfiltered (_("Using PIC (Position Independent Code) "
++				     "prelink displacement %s for \"%s\".\n"),
++				   paddress (target_gdbarch, l_addr),
++				   so->so_name);
+ 	    }
+ 	  else
+ 	    warning (_(".dynamic section for \"%s\" "
+@@ -1767,6 +1765,18 @@
+ 	return 0;
+     }
+ 
++  if (info_verbose)
++    {
++      /* It can be printed repeatedly as there is no easy way to check
++	 the executable symbols/file has been already relocated to
++	 displacement.  */
++
++      printf_unfiltered (_("Using PIE (Position Independent Executable) "
++			   "displacement %s for \"%s\".\n"),
++			 paddress (target_gdbarch, displacement),
++			 bfd_get_filename (exec_bfd));
++    }
++
+   *displacementp = displacement;
+   return 1;
+ }
+### src/gdb/testsuite/ChangeLog	2010/03/11 00:20:29	1.2168
+### src/gdb/testsuite/ChangeLog	2010/03/11 22:07:02	1.2169
+## -1,3 +1,20 @@
++2010-03-11  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	* gdb.base/break-interp.exp: Create new displacement parameter value
++	for the test_ld calls.
++	(reach): New parameter displacement, verify its content.  New push of
++	pf_prefix "reach-$func:".  Import global expect_out.
++	(test_core): New parameter displacement, verify its content.  New push
++	of pf_prefix "core:".  New command "set verbose on".  Import global
++	expect_out.
++	(test_attach): New parameter displacement, verify its content.  New
++	push of pf_prefix "attach:".  New command "set verbose on".  Import
++	global expect_out.
++	(test_ld): New parameter displacement, pass it to the reach, test_core
++	and test_attach calls and verify its content in the "ld.so exit" test.
++	* gdb.base/prelink.exp: Remove gdb_exit and final return.
++	(prelink): Update expected text, use gdb_test.
++
+ 2010-03-10  Doug Evans  <dje at google.com>
+ 
+ 	* gdb.base/checkpoint.exp: Fix comment.
+--- src/gdb/testsuite/gdb.base/break-interp.exp	2010/01/27 20:53:22	1.6
++++ src/gdb/testsuite/gdb.base/break-interp.exp	2010/03/11 22:07:03	1.7
+@@ -221,30 +221,61 @@
+ }
+ 
+ # `runto' does not check we stopped really at the function we specified.
+-proc reach {func command} {
+-    global gdb_prompt
++# DISPLACEMENT can be "NONE", "ZERO" or "NONZERO"
++proc reach {func command displacement} {
++    global gdb_prompt expect_out
++
++    global pf_prefix
++    set old_ldprefix $pf_prefix
++    lappend pf_prefix "reach-$func:"
+ 
+     if [gdb_breakpoint $func allow-pending] {
+-	set test "reach $func"
++	set test "reach"
++	set test_displacement "seen displacement message as $displacement"
+ 	gdb_test_multiple $command $test {
++	    -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
++		# Missing "$gdb_prompt $" is intentional.
++		if {$expect_out(1,string) == "0x0"} {
++		    set case "ZERO"
++		} else {
++		    set case "NONZERO"
++		}
++		if {$displacement == $case} {
++		    pass $test_displacement
++		    # Permit multiple such messages.
++		    set displacement "FOUND-$displacement"
++		} elseif {$displacement != "FOUND-$case"} {
++		    fail $test_displacement
++		}
++		exp_continue
++	    }
+ 	    -re "Breakpoint \[0-9\]+, $func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
+ 		pass $test
+ 	    }
+-	    -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" { 
++	    -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" {
+ 		pass $test
+ 	    }
+ 	}
++	if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
++	    fail $test_displacement
++	}
+     }
++
++    set pf_prefix $old_ldprefix
+ }
+ 
+-proc test_core {file} {
+-    global srcdir subdir gdb_prompt
++proc test_core {file displacement} {
++    global srcdir subdir gdb_prompt expect_out
+ 
+     set corefile [core_find $file {} "segv"]
+     if {$corefile == ""} {
+ 	return
+     }
+ 
++    global pf_prefix
++    set old_ldprefix $pf_prefix
++    lappend pf_prefix "core:"
++
+     gdb_exit
+     gdb_start
+     # Clear it to never find any separate debug infos in $debug_root.
+@@ -252,14 +283,44 @@
+     gdb_reinitialize_dir $srcdir/$subdir
+     gdb_load $file
+ 
+-    # Do not check the binary filename as it may be truncated.
+-    gdb_test "core-file $corefile" "Core was generated by .*\r\n#0 .*" "core loaded"
++    # Print the "PIE (Position Independent Executable) displacement" message.
++    gdb_test "set verbose on"
++
++    set test "core loaded"
++    set test_displacement "seen displacement message"
++    gdb_test_multiple "core-file $corefile" $test {
++	-re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
++	    # Missing "$gdb_prompt $" is intentional.
++	    if {$expect_out(1,string) == "0x0"} {
++		set case "ZERO"
++	    } else {
++		set case "NONZERO"
++	    }
++	    if {$displacement == $case} {
++		pass $test_displacement
++		# Permit multiple such messages.
++		set displacement "FOUND-$displacement"
++	    } elseif {$displacement != "FOUND-$case"} {
++		fail $test_displacement
++	    }
++	    exp_continue
++	}
++	-re "Core was generated by .*\r\n#0 .*$gdb_prompt $" {
++	    # Do not check the binary filename as it may be truncated.
++	    pass $test
++	}
++    }
++    if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
++	fail $test_displacement
++    }
+ 
+     gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
++
++    set pf_prefix $old_ldprefix
+ }
+ 
+-proc test_attach {file} {
+-    global board_info
++proc test_attach {file displacement} {
++    global board_info gdb_prompt expect_out
+ 
+     gdb_exit
+ 
+@@ -287,17 +348,61 @@
+ 	}
+     }
+ 
++    global pf_prefix
++    set old_ldprefix $pf_prefix
++    lappend pf_prefix "attach:"
++
+     gdb_exit
+     gdb_start
+-    gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach"
++
++    # Print the "PIE (Position Independent Executable) displacement" message.
++    gdb_test "set verbose on"
++
++    set test "attach"
++    gdb_test_multiple "attach $pid" $test {
++	-re "Attaching to process $pid\r\n" {
++	    # Missing "$gdb_prompt $" is intentional.
++	    pass $test
++	}
++    }
++
++    set test "attach final prompt"
++    set test_displacement "seen displacement message"
++    gdb_test_multiple "" $test {
++	-re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
++	    # Missing "$gdb_prompt $" is intentional.
++	    if {$expect_out(1,string) == "0x0"} {
++		set case "ZERO"
++	    } else {
++		set case "NONZERO"
++	    }
++	    if {$displacement == $case} {
++		pass $test_displacement
++		# Permit multiple such messages.
++		set displacement "FOUND-$displacement"
++	    } elseif {$displacement != "FOUND-$case"} {
++		fail $test_displacement
++	    }
++	    exp_continue
++	}
++	-re "$gdb_prompt $" {
++	    pass $test
++	}
++    }
++    if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
++	fail $test_displacement
++    }
++
+     gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
+     gdb_exit
+ 
+     remote_exec host "kill -9 $pid"
++
++    set pf_prefix $old_ldprefix
+ }
+ 
+-proc test_ld {file ifmain trynosym} {
+-    global srcdir subdir gdb_prompt
++proc test_ld {file ifmain trynosym displacement} {
++    global srcdir subdir gdb_prompt expect_out
+ 
+     # First test normal `file'-command loaded $FILE with symbols.
+ 
+@@ -308,20 +413,31 @@
+     gdb_reinitialize_dir $srcdir/$subdir
+     gdb_load $file
+ 
+-    reach "dl_main" "run segv"
++    # Print the "PIE (Position Independent Executable) displacement" message.
++    gdb_test "set verbose on"
++
++    reach "dl_main" "run segv" $displacement
+ 
+     gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
+ 
+     if $ifmain {
+-	reach "main" continue
++	# Displacement message will be printed the second time on initializing
++	# the linker from svr4_special_symbol_handling.  If any ANOFFSET has
++	# been already set as non-zero the detection will no longer be run.
++	if {$displacement == "NONZERO"} {
++	    set displacement_main "NONE"
++	} else {
++	    set displacement_main $displacement
++	}
++	reach "main" continue $displacement_main
+ 
+-	reach "libfunc" continue
++	reach "libfunc" continue "NONE"
+ 
+ 	gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt"
+ 
+-	test_core $file
++	test_core $file $displacement
+ 
+-	test_attach $file
++	test_attach $file $displacement
+     }
+ 
+     if !$trynosym {
+@@ -341,18 +457,21 @@
+     gdb_test "set debug-file-directory"
+     gdb_reinitialize_dir $srcdir/$subdir
+ 
++    # Print the "PIE (Position Independent Executable) displacement" message.
++    gdb_test "set verbose on"
++
+     # Test no (error) message has been printed by `exec-file'.
+     set escapedfile [string_to_regexp $file]
+     gdb_test "exec-file $file" "exec-file $escapedfile" "load"
+ 
+     if $ifmain {
+-	reach "dl_main" run
++	reach "dl_main" run $displacement
+ 
+ 	set test "info files"
+ 	set entrynohex ""
+ 	gdb_test_multiple $test $test {
+ 	    -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n.*$gdb_prompt $" {
+-		set entrynohex $expect_out(1,string) 
++		set entrynohex $expect_out(1,string)
+ 		pass $test
+ 	    }
+ 	}
+@@ -363,7 +482,34 @@
+     } else {
+ 	# There is no symbol to break at ld.so.  Moreover it can exit with an
+ 	# error code.
+-	gdb_test "run" "Program exited (normally|with code \[0-9\]+)\\." "ld.so exit"
++
++	set test "ld.so exit"
++	set test_displacement "seen displacement message"
++	gdb_test_multiple "run" $test {
++	    -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
++		# Missing "$gdb_prompt $" is intentional.
++		if {$expect_out(1,string) == "0x0"} {
++		    set case "ZERO"
++		} else {
++		    set case "NONZERO"
++		}
++		if {$displacement == $case} {
++		    pass $test_displacement
++		    # Permit multiple such messages.
++		    set displacement "FOUND-$displacement"
++		} elseif {$displacement != "FOUND-$case"} {
++		    fail $test_displacement
++		}
++		exp_continue
++	    }
++	    -re "Program exited (normally|with code \[0-9\]+)\\.\r\n$gdb_prompt $" {
++		# Do not check the binary filename as it may be truncated.
++		pass $test
++	    }
++	}
++	if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
++	    fail $test_displacement
++	}
+     }
+ 
+     set pf_prefix $old_ldprefix
+@@ -450,7 +596,12 @@
+ 	if ![prelink$ldprelink $interp] {
+ 	    continue
+ 	}
+-	test_ld $interp 0 [expr {$ldsepdebug == "NO"}]
++	if {$ldprelink == "NO"} {
++	    set displacement "NONZERO"
++	} else {
++	    set displacement "ZERO"
++	}
++	test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
+ 
+ 	if ![copy $interp $interp_saved] {
+ 	    continue
+@@ -531,7 +682,14 @@
+ 
+ 		    if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" [file tail $exec]]
+ 		        && [copy $interp_saved $interp]} {
+-			test_ld $exec 1 [expr {$binsepdebug == "NO"}]
++			if {$binpie == "NO"} {
++			    set displacement "NONE"
++			} elseif {$binprelink == "NO"} {
++			    set displacement "NONZERO"
++			} else {
++			    set displacement "ZERO"
++			}
++			test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
+ 		    }
+ 		}
+ 	    }
+--- src/gdb/testsuite/gdb.base/prelink.exp	2010/02/13 12:02:29	1.11
++++ src/gdb/testsuite/gdb.base/prelink.exp	2010/03/11 22:07:03	1.12
+@@ -112,15 +112,4 @@
+ # Print the "adjusting expectations" message.
+ gdb_test "set verbose on"
+ 
+-set test "prelink"
+-global gdb_prompt
+-gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
+-    -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" {
+-	pass "$test"
+-    }
+-}
+-
+-gdb_exit
+-
+-return 0
+-
++gdb_test "core-file $objdir/$subdir/prelink.core" {Using PIC \(Position Independent Code\) prelink displacement.*} "prelink"
+
+
+
+http://sourceware.org/ml/gdb-cvs/2010-03/msg00066.html
+16558457783d71e2856ff2b9ceaa83199d2d9811
+
+### src/gdb/ChangeLog	2010/03/08 07:45:49	1.11442
+### src/gdb/ChangeLog	2010/03/08 08:32:49	1.11443
+## -1,3 +1,8 @@
++2010-03-08  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	* symfile.c (addr_info_make_relative): New variable sect_name, use it.
++	Do not warn on ".gnu.liblist" and ".gnu.conflict".
++
+ 2010-03-08  Joel Brobecker  <brobecker at adacore.com>
+ 
+ 	Memory error when reading wrong core file.
+--- src/gdb/symfile.c	2010/03/05 19:32:44	1.275
++++ src/gdb/symfile.c	2010/03/08 08:32:49	1.276
+@@ -592,7 +592,8 @@
+ 
+   for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+     {
+-      asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
++      const char *sect_name = addrs->other[i].name;
++      asection *sect = bfd_get_section_by_name (abfd, sect_name);
+ 
+       if (sect)
+ 	{
+@@ -609,8 +610,22 @@
+ 	}
+       else
+ 	{
+-	  warning (_("section %s not found in %s"), addrs->other[i].name,
+-		   bfd_get_filename (abfd));
++	  /* This section does not exist in ABFD, which is normally
++	     unexpected and we want to issue a warning.
++
++	     However, the ELF prelinker does create a couple of sections
++	     (".gnu.liblist" and ".gnu.conflict") which are marked in the main
++	     executable as loadable (they are loaded in memory from the
++	     DYNAMIC segment) and yet are not present in separate debug info
++	     files.  This is fine, and should not cause a warning.  Shared
++	     libraries contain just the section ".gnu.liblist" but it is not
++	     marked as loadable there.  */
++
++	  if (!(strcmp (sect_name, ".gnu.liblist") == 0
++		|| strcmp (sect_name, ".gnu.conflict") == 0))
++	    warning (_("section %s not found in %s"), sect_name,
++		     bfd_get_filename (abfd));
++
+ 	  addrs->other[i].addr = 0;
+ 
+ 	  /* SECTINDEX is invalid if ADDR is zero.  */
+
+
+
+http://sourceware.org/ml/gdb-cvs/2010-03/msg00138.html
+http://sourceware.org/ml/gdb-patches/2010-03/msg00535.html
+cc3e71651e2fd0168a2d3dd4efc2d3e15fd508dd
+
+### src/gdb/ChangeLog	2010/03/15 03:48:46	1.11479
+### src/gdb/ChangeLog	2010/03/15 09:31:30	1.11480
+## -1,3 +1,8 @@
++2010-03-15  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	* symfile.c (addr_info_make_relative): Ignore also missing ".dynbss"
++	and ".sdynbss".  Update the comment.
++
+ 2010-03-15  Jie Zhang  <jie at codesourcery.com>
+ 
+ 	* MAINTAINERS: Update my email address.
+--- src/gdb/symfile.c	2010/03/10 18:20:07	1.277
++++ src/gdb/symfile.c	2010/03/15 09:31:34	1.278
+@@ -576,16 +576,19 @@
+ 	  /* This section does not exist in ABFD, which is normally
+ 	     unexpected and we want to issue a warning.
+ 
+-	     However, the ELF prelinker does create a couple of sections
+-	     (".gnu.liblist" and ".gnu.conflict") which are marked in the main
+-	     executable as loadable (they are loaded in memory from the
+-	     DYNAMIC segment) and yet are not present in separate debug info
+-	     files.  This is fine, and should not cause a warning.  Shared
+-	     libraries contain just the section ".gnu.liblist" but it is not
+-	     marked as loadable there.  */
++	     However, the ELF prelinker does create a few sections which are
++	     marked in the main executable as loadable (they are loaded in
++	     memory from the DYNAMIC segment) and yet are not present in
++	     separate debug info files.  This is fine, and should not cause
++	     a warning.  Shared libraries contain just the section
++	     ".gnu.liblist" but it is not marked as loadable there.  There is
++	     no other way to identify them than by their name as the sections
++	     created by prelink have no special flags.  */
+ 
+ 	  if (!(strcmp (sect_name, ".gnu.liblist") == 0
+-		|| strcmp (sect_name, ".gnu.conflict") == 0))
++		|| strcmp (sect_name, ".gnu.conflict") == 0
++		|| strcmp (sect_name, ".dynbss") == 0
++		|| strcmp (sect_name, ".sdynbss") == 0))
+ 	    warning (_("section %s not found in %s"), sect_name,
+ 		     bfd_get_filename (abfd));
+ 
+
+
+
+http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html
+Subject: [patch] Fix separate-debug with non-unique section names (PR 11409)
+
+A different version was checked-in but they are interchangeable:
+	http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html
+	http://sourceware.org/ml/gdb-cvs/2010-03/msg00241.html
+
+Hi,
+
+gdb-7.1 is now broken for example for debugging /usr/bin/emacs due to:
+http://sourceware.org/bugzilla/show_bug.cgi?id=11409
+  [22] .data   PROGBITS 00000000007fe8a0 1fe8a0 215068 00  WA  0   0 32
+  [23] .data   PROGBITS 0000000000a13920 413920 68c6e0 00  WA  0   0 32
+
+It is in fact a regression against gdb-7.0 by me due to:
+
+commit 71d0069a9f238a11f7f455bf6ad2adfc25683521
+Author: Jan Kratochvil <jan.kratochvil at redhat.com>
+Date:   Tue Jan 5 15:51:01 2010 +0000
+
+gdb/
+        * symfile.c (syms_from_objfile): Remove the !MAINLINE conditional.
+
+as while the code was broken even before the broken relocation was not applied
+to mainline binary (before PIE+OSX patches went in).
+
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+OK to check-in also for gdb-7.1 (7.1.1)?
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-03-23  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* symfile.c (addr_info_make_relative): Move sect declaration to the
+	outer block.  Initialize it to NULL.  Prefer SECT->next more than
+	bfd_get_section_by_name.
+
+gdb/testsuite/
+2010-03-23  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb.base/dup-sect.exp, gdb.base/dup-sect.S: New.
+
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -529,6 +529,7 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
+   asection *lower_sect;
+   CORE_ADDR lower_offset;
+   int i;
++  asection *sect;
+ 
+   /* Find lowest loadable section to be used as starting point for
+      continguous sections.  */
+@@ -553,11 +554,23 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
+      (the loadable section directly below it in memory).
+      this_offset = lower_offset = lower_addr - lower_orig_addr */
+ 
++  sect = NULL;
+   for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+     {
+       const char *sect_name = addrs->other[i].name;
+-      asection *sect = bfd_get_section_by_name (abfd, sect_name);
+ 
++      /* Prefer the next section of that we have found last.  The separate
++	 debug info files have either the same section layout or just a few
++	 sections are missing there.  On the other hand the section name is not
++	 unique and we could find an inappropraite section by its name.  */
++
++      if (sect)
++	sect = sect->next;
++      if (sect && strcmp (sect_name, bfd_get_section_name (abfd, sect)) != 0)
++	sect = NULL;
++
++      if (sect == NULL)
++	sect = bfd_get_section_by_name (abfd, sect_name);
+       if (sect)
+ 	{
+ 	  /* This is the index used by BFD. */
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/dup-sect.S
+@@ -0,0 +1,22 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2010 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++	.section	sect1, "a"
++var1:	.byte	1
++
++	.section	sect2, "a"
++var2:	.byte	2
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/dup-sect.exp
+@@ -0,0 +1,79 @@
++# This testcase is part of GDB, the GNU debugger.
++
++# Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# Test inappropriate offseting of multiple sections with the same name.
++# When kept in object file (before final executable link) it still works.
++# When separate debug info file is not used it still works.
++# When the ELF symbol table is kept in the main binary it still works.
++# Used .S file as in .c file we would need __attriute__((section)) which is
++# a GCC extension.
++
++# This test can only be run on targets which support ELF and use gas.
++# For now pick a sampling of likely targets.
++if {![istarget *-*-linux*]
++    && ![istarget *-*-gnu*]
++    && ![istarget *-*-elf*]
++    && ![istarget arm-*-eabi*]
++    && ![istarget powerpc-*-eabi*]} {
++    return 0
++}
++
++set testfile dup-sect
++set srcfile ${testfile}.S
++set srcmainfile start.c
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/${executable}
++
++if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile}] {}] == -1} {
++    return -1
++}
++
++set test "rename section"
++set objcopy_program [transform objcopy]
++set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output]
++verbose "result is $result"
++verbose "output is $output"
++if {$result != 0} {
++    fail $test
++    return
++}
++pass $test
++
++set test "split"
++if {[gdb_gnu_strip_debug $binfile] != 0} {
++    fail $test
++} else {
++    pass $test
++}
++
++# gdb_gnu_strip_debug uses only --strip-debug and keeps the ELF symbol table
++# in $binfile.
++set test "strip"
++set strip_program [transform strip]
++set result [catch "exec $strip_program $binfile" output]
++verbose "result is $result"
++verbose "output is $output"
++if {$result != 0} {
++    fail $test
++    return
++}
++pass $test
++
++clean_restart $executable
++
++gdb_test "p/d *(const char *) &var1" " = 1" "var1 after strip"
++gdb_test "p/d *(const char *) &var2" " = 2" "var2 after strip"
+
+
+
+[patch] Fix breakpoint at *_start
+http://sourceware.org/ml/gdb-patches/2010-04/msg00059.html
+http://sourceware.org/ml/gdb-cvs/2010-04/msg00029.html
+
+### src/gdb/ChangeLog	2010/04/04 13:54:42	1.11568
+### src/gdb/ChangeLog	2010/04/04 22:12:04	1.11569
+## -1,5 +1,10 @@
+ 2010-04-04  Jan Kratochvil  <jan.kratochvil at redhat.com>
+ 
++	* infcmd.c (run_command_1): Call proceed with regcache_read_pc address.
++	* config/djgpp/fnchange.lst: Add translation for break-entry.exp.
++
++2010-04-04  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
+ 	* breakpoint.c (bpstat_find_step_resume_breakpoint): Remove.
+ 	* breakpoint.h (bpstat_find_step_resume_breakpoint): Remove.
+ 
+--- src/gdb/infcmd.c	2010/03/25 20:48:53	1.263
++++ src/gdb/infcmd.c	2010/04/04 22:12:04	1.264
+@@ -580,8 +580,9 @@
+      has done its thing; now we are setting up the running program.  */
+   post_create_inferior (&current_target, 0);
+ 
+-  /* Start the target running.  */
+-  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
++  /* Start the target running.  Do not use -1 continuation as it would skip
++     breakpoint right at the entry point.  */
++  proceed (regcache_read_pc (get_current_regcache ()), TARGET_SIGNAL_0, 0);
+ 
+   /* Since there was no error, there's no need to finish the thread
+      states here.  */
+--- src/gdb/config/djgpp/fnchange.lst	2010/02/01 19:27:55	1.108
++++ src/gdb/config/djgpp/fnchange.lst	2010/04/04 22:12:07	1.109
+@@ -371,6 +371,7 @@
+ @V@/gdb/testsuite/gdb.arch/powerpc-prologue.exp @V@/gdb/testsuite/gdb.arch/ppc-prologue.exp
+ @V@/gdb/testsuite/gdb.base/bitfields2.c @V@/gdb/testsuite/gdb.base/bitfiel2.c
+ @V@/gdb/testsuite/gdb.base/bitfields2.exp @V@/gdb/testsuite/gdb.base/bitfiel2.exp
++ at V@/gdb/testsuite/gdb.base/break-entry.exp @V@/gdb/testsuite/gdb.base/brkentry.exp
+ @V@/gdb/testsuite/gdb.base/coremaker2.c @V@/gdb/testsuite/gdb.base/core2maker.c
+ @V@/gdb/testsuite/gdb.base/hashline1.exp @V@/gdb/testsuite/gdb.base/hash1line.exp
+ @V@/gdb/testsuite/gdb.base/hashline2.exp @V@/gdb/testsuite/gdb.base/hash2line.exp
+### src/gdb/testsuite/ChangeLog	2010/04/02 05:13:07	1.2218
+### src/gdb/testsuite/ChangeLog	2010/04/04 22:12:09	1.2219
+## -1,3 +1,7 @@
++2010-04-04  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	* gdb.base/break-entry.exp: New.
++
+ 2010-04-02  Hui Zhu  <teawater at gmail.com>
+             Michael Snyder <msnyder at vmware.com>
+ 
+--- src/gdb/testsuite/gdb.base/break-entry.exp
++++ src/gdb/testsuite/gdb.base/break-entry.exp	2010-04-05 20:17:39.234684000 +0000
+@@ -0,0 +1,43 @@
++# Copyright (C) 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# Test inferior can stop at its very first instruction, usually "_start".
++# Dynamic executables have first instruction in ld.so.
++
++set testfile break-entry
++if { [prepare_for_testing ${testfile}.exp ${testfile} start.c {additional_flags=-static}] } {
++    return -1
++}
++
++set test "info files"
++set entry ""
++gdb_test_multiple $test $test {
++    -re "\r\n\[\t \]*Entry point:\[\t \]*(0x\[0-9a-f\]+)\r\n.*$gdb_prompt $" {
++	set entry $expect_out(1,string)
++	pass $test
++    }
++}
++if {$entry == ""} {
++    untested ${testfile}.exp
++    return
++}
++
++if ![runto "*$entry"] {
++    return
++}
++gdb_test {p/x $pc} " = $entry"
++
++gdb_breakpoint "main"
++gdb_continue_to_breakpoint "main" "main.*"
+
+
+
+https://bugzilla.redhat.com/show_bug.cgi?id=590648
+Re: [rfc] Work around invalid G++ DWARF for unnamed aggregates
+http://sourceware.org/ml/gdb-patches/2010-03/msg00909.html
+commit 5e40af195bd74a66d300d8f481cab1f2ba533f3a
+
+[ cut only a part of it ]
+
+--- a/gdb/completer.c
++++ b/gdb/completer.c
+@@ -401,7 +401,7 @@ add_struct_fields (struct type *type, int *nextp, char **output,
+ 	      computed_type_name = 1;
+ 	    }
+ 	  /* Omit constructors from the completion list.  */
+-	  if (type_name && strcmp (type_name, name))
++	  if (!type_name || strcmp (type_name, name))
+ 	    {
+ 	      output[*nextp] = xstrdup (name);
+ 	      ++*nextp;
+
+
+
+https://bugzilla.redhat.com/show_bug.cgi?id=578136
+https://bugzilla.redhat.com/show_bug.cgi?id=593926
+http://sourceware.org/ml/gdb-patches/2010-04/msg00820.html
+http://sourceware.org/ml/gdb-cvs/2010-04/msg00240.html
+
+### src/gdb/ChangeLog	2010/04/23 18:09:16	1.11678
+### src/gdb/ChangeLog	2010/04/23 21:44:19	1.11679
+## -1,3 +1,14 @@
++2010-04-23  Daniel Jacobowitz  <dan at codesourcery.com>
++	    Paul Pluzhnikov  <ppluzhnikov at google.com>
++	    Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	Fix deadlock on looped list of loaded shared objects.
++	* solib-svr4.c (LM_PREV): New function.
++	(IGNORE_FIRST_LINK_MAP_ENTRY): Use it.
++	(svr4_current_sos): Check for correct l_prev.  New variables prev_lm
++	and next_lm.  Clear prev_lm for solib_svr4_r_ldsomap.
++	* config/djgpp/fnchange.lst: Add translation for solib-corrupted.exp.
++
+ 2010-04-23  Doug Evans  <dje at google.com>
+ 
+ 	* configure.ac (CONFIG_SRCS): Add py-auto-load.o even if not using
+--- src/gdb/solib-svr4.c	2010/03/11 22:07:02	1.130
++++ src/gdb/solib-svr4.c	2010/04/23 21:44:19	1.131
+@@ -272,6 +272,16 @@
+ }
+ 
+ static CORE_ADDR
++LM_PREV (struct so_list *so)
++{
++  struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
++  struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
++
++  return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
++				ptr_type);
++}
++
++static CORE_ADDR
+ LM_NAME (struct so_list *so)
+ {
+   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+@@ -284,16 +294,12 @@
+ static int
+ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so)
+ {
+-  struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+-  struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+-
+   /* Assume that everything is a library if the dynamic loader was loaded
+      late by a static executable.  */
+   if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
+     return 0;
+ 
+-  return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
+-				ptr_type) == 0;
++  return LM_PREV (so) == 0;
+ }
+ 
+ /* Per pspace SVR4 specific data.  */
+@@ -1101,7 +1107,7 @@
+ static struct so_list *
+ svr4_current_sos (void)
+ {
+-  CORE_ADDR lm;
++  CORE_ADDR lm, prev_lm;
+   struct so_list *head = 0;
+   struct so_list **link_ptr = &head;
+   CORE_ADDR ldsomap = 0;
+@@ -1120,6 +1126,7 @@
+ 
+   /* Walk the inferior's link map list, and build our list of
+      `struct so_list' nodes.  */
++  prev_lm = 0;
+   lm = solib_svr4_r_map (info);
+ 
+   while (lm)
+@@ -1127,6 +1134,7 @@
+       struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+       struct so_list *new = XZALLOC (struct so_list);
+       struct cleanup *old_chain = make_cleanup (xfree, new);
++      CORE_ADDR next_lm;
+ 
+       new->lm_info = xmalloc (sizeof (struct lm_info));
+       make_cleanup (xfree, new->lm_info);
+@@ -1138,14 +1146,21 @@
+ 
+       read_memory (lm, new->lm_info->lm, lmo->link_map_size);
+ 
+-      lm = LM_NEXT (new);
++      next_lm = LM_NEXT (new);
++
++      if (LM_PREV (new) != prev_lm)
++	{
++	  warning (_("Corrupted shared library list"));
++	  free_so (new);
++	  next_lm = 0;
++	}
+ 
+       /* For SVR4 versions, the first entry in the link map is for the
+          inferior executable, so we must ignore it.  For some versions of
+          SVR4, it has no name.  For others (Solaris 2.3 for example), it
+          does have a name, so we can no longer use a missing name to
+          decide when to ignore it. */
+-      if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
++      else if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
+ 	{
+ 	  info->main_lm_addr = new->lm_info->lm_addr;
+ 	  free_so (new);
+@@ -1182,12 +1197,18 @@
+ 	    }
+ 	}
+ 
++      prev_lm = lm;
++      lm = next_lm;
++
+       /* On Solaris, the dynamic linker is not in the normal list of
+ 	 shared objects, so make sure we pick it up too.  Having
+ 	 symbol information for the dynamic linker is quite crucial
+ 	 for skipping dynamic linker resolver code.  */
+       if (lm == 0 && ldsomap == 0)
+-	lm = ldsomap = solib_svr4_r_ldsomap (info);
++	{
++	  lm = ldsomap = solib_svr4_r_ldsomap (info);
++	  prev_lm = 0;
++	}
+ 
+       discard_cleanups (old_chain);
+     }
+--- src/gdb/config/djgpp/fnchange.lst	2010/04/09 15:15:05	1.112
++++ src/gdb/config/djgpp/fnchange.lst	2010/04/23 21:44:19	1.113
+@@ -397,6 +397,7 @@
+ @V@/gdb/testsuite/gdb.base/siginfo-obj.c @V@/gdb/testsuite/gdb.base/si-obj.c
+ @V@/gdb/testsuite/gdb.base/siginfo-addr.exp @V@/gdb/testsuite/gdb.base/si-addr.exp
+ @V@/gdb/testsuite/gdb.base/siginfo-obj.exp @V@/gdb/testsuite/gdb.base/si-obj.exp
++ at V@/gdb/testsuite/gdb.base/solib-corrupted.exp @V@/gdb/testsuite/gdb.base/so-crptd.exp
+ @V@/gdb/testsuite/gdb.base/solib-disc.c @V@/gdb/testsuite/gdb.base/so-disc.c
+ @V@/gdb/testsuite/gdb.base/solib-display-lib.c @V@/gdb/testsuite/gdb.base/so-displib.c
+ @V@/gdb/testsuite/gdb.base/solib-display-main.c @V@/gdb/testsuite/gdb.base/so-dispmain.c
+### src/gdb/testsuite/ChangeLog	2010/04/23 18:03:31	1.2252
+### src/gdb/testsuite/ChangeLog	2010/04/23 21:44:20	1.2253
+## -1,3 +1,8 @@
++2010-04-23  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	Fix deadlock on looped list of loaded shared objects.
++	* gdb.base/solib-corrupted.exp: New.
++
+ 2010-04-23  Doug Evans  <dje at google.com>
+ 
+ 	* gdb.python/py-section-script.c: New file.
+--- src/gdb/testsuite/gdb.base/solib-corrupted.exp
++++ src/gdb/testsuite/gdb.base/solib-corrupted.exp	2010-05-24 18:00:52.057995000 +0000
+@@ -0,0 +1,46 @@
++# Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set testfile "solib-corrupted"
++set srcfile start.c
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
++    untested ${testfile}.exp
++    return -1
++}
++
++if ![runto_main] {
++    fail "Can't run to main"
++    return
++}
++
++gdb_test "info sharedlibrary" "" "normal list"
++
++# GDB checks there for matching L_PREV.
++set test "make solibs looping"
++gdb_test_multiple "p/x _r_debug->r_map->l_next = _r_debug->r_map" $test {
++    -re "(No symbol \"_r_debug\" in current context\\.|Attempt to extract a component of a value that is not a structure pointer\\.)\r\n$gdb_prompt $" {
++	# glibc debug info is not available and it is too difficult to find and
++	# parse it from this testcase without the gdb supporting functions.
++	verbose -log "no _r_debug symbol has been found"
++	xfail $test
++	untested ${testfile}.exp
++	return
++    }
++    -re " = 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
++	pass $test
++    }
++}
++gdb_test "info sharedlibrary" "warning: Corrupted shared library list\r\n.*" "corrupted list"
+
+
+
+Re: [patch] Fix crash on /proc/PID/stat race
+http://sourceware.org/ml/gdb-patches/2010-05/msg00685.html
+http://sourceware.org/ml/gdb-cvs/2010-05/msg00244.html
+
+### src/gdb/ChangeLog	2010/05/28 18:00:41	1.11855
+### src/gdb/ChangeLog	2010/05/28 18:23:13	1.11856
+## -1,5 +1,10 @@
+ 2010-05-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
+ 
++	* linux-nat.c (linux_nat_core_of_thread_1): Fix crash on invalid
++	CONTENT.
++
++2010-05-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
+ 	* linux-nat.c (linux_nat_wait_1): Do not call
+ 	linux_nat_core_of_thread_1 on TARGET_WAITKIND_EXITED or
+ 	TARGET_WAITKIND_SIGNALLED.
+--- src/gdb/linux-nat.c	2010/05/28 18:00:46	1.169
++++ src/gdb/linux-nat.c	2010/05/28 18:23:15	1.170
+@@ -5509,15 +5509,21 @@
+   make_cleanup (xfree, content);
+ 
+   p = strchr (content, '(');
+-  p = strchr (p, ')') + 2; /* skip ")" and a whitespace. */
++
++  /* Skip ")".  */
++  if (p != NULL)
++    p = strchr (p, ')');
++  if (p != NULL)
++    p++;
+ 
+   /* If the first field after program name has index 0, then core number is
+      the field with index 36.  There's no constant for that anywhere.  */
+-  p = strtok_r (p, " ", &ts);
+-  for (i = 0; i != 36; ++i)
++  if (p != NULL)
++    p = strtok_r (p, " ", &ts);
++  for (i = 0; p != NULL && i != 36; ++i)
+     p = strtok_r (NULL, " ", &ts);
+ 
+-  if (sscanf (p, "%d", &core) == 0)
++  if (p == NULL || sscanf (p, "%d", &core) == 0)
+     core = -1;
+ 
+   do_cleanups (back_to);
+### src/gdb/gdbserver/ChangeLog	2010/05/26 22:40:22	1.386
+### src/gdb/gdbserver/ChangeLog	2010/05/28 18:23:15	1.387
+## -1,3 +1,8 @@
++2010-05-28  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	* linux-low.c (linux_core_of_thread): Fix crash on invalid CONTENT.
++	New comment.
++
+ 2010-05-26  Ozkan Sezer  <sezeroz at gmail.com>
+ 
+ 	* gdbreplay.c (remote_open): Check error return from socket() call by
+--- src/gdb/gdbserver/linux-low.c	2010/05/03 04:02:20	1.148
++++ src/gdb/gdbserver/linux-low.c	2010/05/28 18:23:15	1.149
+@@ -4346,13 +4346,21 @@
+     }
+ 
+   p = strchr (content, '(');
+-  p = strchr (p, ')') + 2; /* skip ")" and a whitespace. */
+ 
+-  p = strtok_r (p, " ", &ts);
+-  for (i = 0; i != 36; ++i)
++  /* Skip ")".  */
++  if (p != NULL)
++    p = strchr (p, ')');
++  if (p != NULL)
++    p++;
++
++  /* If the first field after program name has index 0, then core number is
++     the field with index 36.  There's no constant for that anywhere.  */
++  if (p != NULL)
++    p = strtok_r (p, " ", &ts);
++  for (i = 0; p != NULL && i != 36; ++i)
+     p = strtok_r (NULL, " ", &ts);
+ 
+-  if (sscanf (p, "%d", &core) == 0)
++  if (p == NULL || sscanf (p, "%d", &core) == 0)
+     core = -1;
+ 
+   free (content);
+
+
+
+Re: [patch] testsuite: watchthreads-reorder: Linux kernel compat.
+http://sourceware.org/ml/gdb-patches/2010-05/msg00696.html
+http://sourceware.org/ml/gdb-cvs/2010-05/msg00255.html
+
+### src/gdb/testsuite/ChangeLog	2010/05/28 23:47:40	1.2293
+### src/gdb/testsuite/ChangeLog	2010/05/31 03:31:16	1.2294
+## -1,3 +1,11 @@
++2010-05-31  Jan Kratochvil  <jan.kratochvil at redhat.com>
++
++	Accept the new Linux kernel "t (tracing stop)" string.
++	* gdb.threads/watchthreads-reorder.c (thread1_func, thread2_func):
++	Update comment.
++	(state_wait) <T (tracing stop)>: New.
++	(main): Update the state_wait expect string.
++
+ 2010-05-28  Pedro Alves  <pedro at codesourcery.com>
+ 
+ 	* limits.c, limits.exp: Delete files.
+--- src/gdb/testsuite/gdb.threads/watchthreads-reorder.c	2010/01/20 21:09:30	1.3
++++ src/gdb/testsuite/gdb.threads/watchthreads-reorder.c	2010/05/31 03:31:17	1.4
+@@ -99,7 +99,7 @@
+ 
+   rwatch_store = thread1_rwatch;
+ 
+-  /* Be sure the "T (tracing stop)" test can proceed for both threads.  */
++  /* Be sure the "t (tracing stop)" test can proceed for both threads.  */
+   timed_mutex_lock (&terminate_mutex);
+   i = pthread_mutex_unlock (&terminate_mutex);
+   assert (i == 0);
+@@ -125,7 +125,7 @@
+ 
+   rwatch_store = thread2_rwatch;
+ 
+-  /* Be sure the "T (tracing stop)" test can proceed for both threads.  */
++  /* Be sure the "t (tracing stop)" test can proceed for both threads.  */
+   timed_mutex_lock (&terminate_mutex);
+   i = pthread_mutex_unlock (&terminate_mutex);
+   assert (i == 0);
+@@ -211,6 +211,13 @@
+   do
+     {
+       state = proc_string (filename, "State:\t");
++
++      /* torvalds/linux-2.6.git 464763cf1c6df632dccc8f2f4c7e50163154a2c0
++	 has changed "T (tracing stop)" to "t (tracing stop)".  Make the GDB
++	 testcase backward compatible with older Linux kernels.  */
++      if (strcmp (state, "T (tracing stop)") == 0)
++	state = "t (tracing stop)";
++
+       if (strcmp (state, wanted) == 0)
+ 	{
+ 	  free (filename);
+@@ -336,9 +343,9 @@
+     {
+       /* s390x-unknown-linux-gnu will fail with "R (running)".  */
+ 
+-      state_wait (thread1_tid, "T (tracing stop)");
++      state_wait (thread1_tid, "t (tracing stop)");
+ 
+-      state_wait (thread2_tid, "T (tracing stop)");
++      state_wait (thread2_tid, "t (tracing stop)");
+     }
+ 
+   cleanup ();

gdb-using-directive-leak.patch:
 buildsym.c                       |    1 
 cp-namespace.c                   |   69 +++++++++++++++------------------------
 cp-support.h                     |   10 +----
 dwarf2read.c                     |   19 ++++++----
 testsuite/gdb.cp/gdb2384-base.cc |    2 +
 testsuite/gdb.cp/gdb2384-base.h  |    4 ++
 6 files changed, 48 insertions(+), 57 deletions(-)

--- NEW FILE gdb-using-directive-leak.patch ---
FSF GDB variant is at:
http://sourceware.org/ml/gdb-patches/2010-03/msg00789.html

commit 56b45f494f647360f9d6ff84f12f59c08cbe05af
Author: Sami Wagiaalla <swagiaal at redhat.com>
Date:   Mon Mar 29 16:08:58 2010 -0400

    Fix using_directive memory leak.

diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index ff2c9b1..35e4663 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -387,6 +387,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
     }
 
   block_set_using (block, using_directives, &objfile->objfile_obstack);
+  using_directives = NULL;
 
   record_pending_block (objfile, block, opblock);
 
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 6325ead..c6df91f 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -120,7 +120,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
 		 anonymous namespace.  So add symbols in it to the
 		 namespace given by the previous component if there is
 		 one, or to the global namespace if there isn't.  */
-	      cp_add_using_directive (dest, src, NULL, "", 0);
+	      cp_add_using_directive (dest, src, NULL, "", 0,
+	                              &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack);
 	    }
 	  /* The "+ 2" is for the "::".  */
 	  previous_component = next_component + 2;
@@ -132,11 +133,17 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
 }
 
 /* Add a using directive to using_list. If the using directive in question
-   has already been added, don't add it twice.  */
+   has already been added, don't add it twice.
+   Create a new struct using_direct which imports the namespace SRC into the
+   scope DEST.  ALIAS is the name of the imported namespace in the current
+   scope.  If ALIAS is NULL then the namespace is known by its original name.
+   The arguments are copied into newly allocated memory so they can be
+   temporaries.  */
 
 void
 cp_add_using_directive (const char *dest, const char *src, const char *alias,
-			const char *declaration, const int line_number)
+			const char *declaration, const int line_number,
+			struct obstack *obstack)
 {
   struct using_direct *current;
   struct using_direct *new;
@@ -146,12 +153,26 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias,
   for (current = using_directives; current != NULL; current = current->next)
     {
       if (strcmp (current->import_src, src) == 0
-          && strcmp (current->import_dest, dest) == 0)
+	  && strcmp (current->import_dest, dest) == 0
+	  && ((alias == NULL && current->alias == NULL)
+	      || (alias != NULL && current->alias != NULL
+		  && strcmp (alias, current->alias) == 0)))
 	return;
     }
 
-  using_directives = cp_add_using (dest, src, alias, declaration,
-				   line_number, using_directives);
+  new = OBSTACK_ZALLOC (obstack, struct using_direct);
+
+  new->import_src = obsavestring (src, strlen (src), obstack);
+  new->import_dest = obsavestring (dest, strlen (dest), obstack);
+
+  if (alias != NULL)
+    new->alias = obsavestring (alias, strlen (alias), obstack);
+
+  new->declaration = obsavestring (declaration, strlen (declaration), obstack);
+  new->line_number = line_number;
+
+  new->next = using_directives;
+  using_directives = new;
 
 }
 
@@ -203,42 +224,6 @@ cp_is_anonymous (const char *namespace)
 	  != NULL);
 }
 
-/* Create a new struct using direct which imports the namespace SRC
-   into the scope DEST.  ALIAS is the name of the imported namespace
-   in the current scope.  If ALIAS is NULL then the
-   namespace is known by its original name.
-
-   Set its next member in the linked list to NEXT; allocate all memory
-   using xmalloc.  It copies the strings, so NAME can be a temporary
-   string.  */
-
-struct using_direct *
-cp_add_using (const char *dest,
-              const char *src,
-              const char *alias,
-              const char *declaration,
-              const int line_number,
-	      struct using_direct *next)
-{
-  struct using_direct *retval;
-
-  retval = xmalloc (sizeof (struct using_direct));
-  retval->import_src = savestring (src, strlen (src));
-  retval->import_dest = savestring (dest, strlen (dest));
-
-  if (alias != NULL)
-    retval->alias = savestring (alias, strlen (alias));
-  else
-    retval->alias = NULL;
-
-  retval->declaration = savestring (declaration, strlen (declaration));
-  retval->line_number = line_number;
-  retval->next = next;
-  retval->searched = 0;
-
-  return retval;
-}
-
 /* The C++-specific version of name lookup for static and global
    names.  This makes sure that names get looked for in all namespaces
    that are in scope.  NAME is the natural name of the symbol that
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 57aa5e5..41f17fe 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -101,14 +101,8 @@ extern void cp_add_using_directive (const char *dest,
                                     const char *src,
                                     const char *alias,
                                     const char *declaration,
-                                    const int line_number);
-
-extern struct using_direct *cp_add_using (const char *dest,
-                                          const char *src,
-                                          const char *alias,
-                                          const char *declaration,
-                                          const int line_number,
-					  struct using_direct *next);
+                                    const int line_number,
+                                    struct obstack *obstack);
 
 extern void cp_initialize_namespace (void);
 
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e3a780e..b73f444 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3563,12 +3563,12 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
     }
   }
   
-  using_directives = cp_add_using (import_prefix,
-                                   canonical_name,
-                                   import_alias,
-                                   imported_declaration,
-                                   line_number,
-                                   using_directives);
+  cp_add_using_directive (import_prefix,
+                          canonical_name,
+                          import_alias,
+                          imported_declaration,
+                          line_number,
+                          &cu->objfile->objfile_obstack);
 }
 
 static void
@@ -5703,7 +5703,12 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
       if (is_anonymous)
 	{
 	  const char *previous_prefix = determine_prefix (die, cu);
-	  cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, "", dwarf2_read_decl_line(die, cu));
+	  cp_add_using_directive (previous_prefix,
+	                          TYPE_NAME (type),
+	                          NULL,
+	                          "",
+	                          dwarf2_read_decl_line(die, cu),
+	                          &objfile->objfile_obstack);
 	}
     }
 
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.cc b/gdb/testsuite/gdb.cp/gdb2384-base.cc
index 09ed04e..b58f30d 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.cc
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.cc
@@ -23,6 +23,8 @@ base::base (int _x)
 {
 }
 
+using namespace B;
+
 int
 base::meth ()
 {
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.h b/gdb/testsuite/gdb.cp/gdb2384-base.h
index b09701e..981943c 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.h
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.h
@@ -16,6 +16,10 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    */
 
+namespace B{
+  int x;
+}
+
 class base
 {
  public:


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/.cvsignore,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -p -r1.48 -r1.49
--- .cvsignore	3 Feb 2010 06:05:12 -0000	1.48
+++ .cvsignore	11 Jul 2010 18:06:29 -0000	1.49
@@ -1,2 +1,2 @@
-gdb-7.0.50.20100203.tar.bz2
+gdb-7.1.tar.bz2
 libstdc++-v3-python-r155978.tar.bz2

gdb-6.3-gstack-20050411.patch:
 Makefile.in                   |   32 +++++++++++++++++-
 gstack.sh                     |   48 ++++++++++++++++++++++++++++
 testsuite/gdb.base/gstack.c   |   43 +++++++++++++++++++++++++
 testsuite/gdb.base/gstack.exp |   71 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 192 insertions(+), 2 deletions(-)

Index: gdb-6.3-gstack-20050411.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.3-gstack-20050411.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- gdb-6.3-gstack-20050411.patch	17 Sep 2009 12:15:41 -0000	1.7
+++ gdb-6.3-gstack-20050411.patch	11 Jul 2010 18:06:29 -0000	1.8
@@ -4,10 +4,9 @@
 	to install and uninstall.
 	* gstack.sh, gstack.1: New files.
 
-Index: gdb-6.8.91.20090917/gdb/Makefile.in
-===================================================================
---- gdb-6.8.91.20090917.orig/gdb/Makefile.in	2009-09-17 12:47:07.000000000 +0200
-+++ gdb-6.8.91.20090917/gdb/Makefile.in	2009-09-17 12:47:38.000000000 +0200
+diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
+--- gdb-7.0.1-empty/gdb/Makefile.in	2010-04-07 20:36:04.000000000 +0200
++++ gdb-7.0.1/gdb/Makefile.in	2010-04-07 20:36:42.000000000 +0200
 @@ -989,7 +989,7 @@ install: all install-only 
  
  # The "install-only" target also installs the syscalls' XML files in
@@ -63,10 +62,9 @@ Index: gdb-6.8.91.20090917/gdb/Makefile.
  
  # The C++ name parser can be built standalone for testing.
  test-cp-name-parser.o: cp-name-parser.c
-Index: gdb-6.8.91.20090917/gdb/gstack.sh
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.91.20090917/gdb/gstack.sh	2009-09-17 12:47:14.000000000 +0200
+diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
+--- gdb-7.0.1-empty/gdb/gstack.sh	1970-01-01 01:00:00.000000000 +0100
++++ gdb-7.0.1/gdb/gstack.sh	2010-04-07 20:36:47.000000000 +0200
 @@ -0,0 +1,48 @@
 +#!/bin/sh
 +
@@ -87,17 +85,17 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
 +backtrace="bt"
 +if test -d /proc/$1/task ; then
 +    # Newer kernel; has a task/ directory.
-+    if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
++    if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
 +	backtrace="thread apply all bt"
 +    fi
 +elif test -f /proc/$1/maps ; then
 +    # Older kernel; go by it loading libpthread.
-+    if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
++    if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
 +	backtrace="thread apply all bt"
 +    fi
 +fi
 +
-+GDB=${GDB:-gdb}
++GDB=${GDB:-/usr/bin/gdb}
 +
 +if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
 +    readnever=--readnever
@@ -112,7 +110,127 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
 +set pagination no
 +$backtrace
 +EOF
-+sed -n \
-+    -e 's/^(gdb) //' \
++/bin/sed -n \
++    -e 's/^\((gdb) \)*//' \
 +    -e '/^#/p' \
 +    -e '/^Thread/p'
+--- /dev/null	2010-04-07 06:20:52.289994508 +0200
++++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.exp	2010-04-07 21:53:57.000000000 +0200
+@@ -0,0 +1,71 @@
++# Copyright (C) 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set testfile gstack
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/$executable
++if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
++    return -1
++}
++
++set test "spawn inferior"
++set command "${binfile}"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++    perror "Spawning $command failed."
++    fail $test
++    return
++}
++set pid [exp_pid -i $res]
++gdb_expect {
++    -re "looping\r\n" {
++	pass $test
++    }
++    eof {
++	fail "$test (eof)"
++	return
++    }
++    timeout {
++	fail "$test (timeout)"
++	return
++    }
++}
++gdb_exit
++
++# Testcase uses the most simple notification not to get caught by attach on
++# exiting the function.  Still we could retry the gstack command if we fail.
++
++set test "spawn gstack"
++set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++    perror "Spawning $command failed."
++    fail $test
++}
++set pid [exp_pid -i $res]
++gdb_expect {
++    -re {^#0 +0x[0-9a-f]+ in \.?func \(\)\r\n#1 +0x[0-9a-f]+ in \.?main \(\)\r\nGSTACK-END\r\n$} {
++	pass $test
++    }
++    eof {
++	fail "$test (eof)"
++    }
++    timeout {
++	fail "$test (timeout)"
++    }
++}
++gdb_exit
++
++remote_exec host "kill -9 $pid"
+--- /dev/null	2010-04-07 06:20:52.289994508 +0200
++++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.c	2010-04-07 21:46:52.000000000 +0200
+@@ -0,0 +1,43 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <stdio.h>
++#include <unistd.h>
++#include <string.h>
++
++void
++func (void)
++{
++  const char msg[] = "looping\n";
++
++  /* Use the most simple notification not to get caught by attach on exiting
++     the function.  */
++  write (1, msg, strlen (msg));
++  
++  for (;;);
++}
++
++int
++main (void)
++{
++  alarm (60);
++  nice (100);
++
++  func ();
++
++  return 0;
++}

gdb-6.3-readnever-20050907.patch:
 doc/gdb.texinfo |    6 ++++++
 dwarf2read.c    |    4 +++-
 main.c          |    2 ++
 symfile.c       |    1 +
 top.h           |    1 +
 5 files changed, 13 insertions(+), 1 deletion(-)

Index: gdb-6.3-readnever-20050907.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.3-readnever-20050907.patch,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- gdb-6.3-readnever-20050907.patch	21 Jan 2010 16:09:09 -0000	1.11
+++ gdb-6.3-readnever-20050907.patch	11 Jul 2010 18:06:30 -0000	1.12
@@ -11,11 +11,11 @@
 
         * gdb.texinfo (File Options): Document --readnever.
 
-Index: gdb-7.0.50.20100121/gdb/doc/gdb.texinfo
+Index: gdb-7.0.90.20100306/gdb/doc/gdb.texinfo
 ===================================================================
---- gdb-7.0.50.20100121.orig/gdb/doc/gdb.texinfo	2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/doc/gdb.texinfo	2010-01-21 15:13:02.000000000 +0100
-@@ -997,6 +997,12 @@ Read each symbol file's entire symbol ta
+--- gdb-7.0.90.20100306.orig/gdb/doc/gdb.texinfo	2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/doc/gdb.texinfo	2010-03-06 23:20:35.000000000 +0100
+@@ -995,6 +995,12 @@ Read each symbol file's entire symbol ta
  the default, which is to read it incrementally as it is needed.
  This makes startup slower, but makes future operations faster.
  
@@ -28,10 +28,10 @@ Index: gdb-7.0.50.20100121/gdb/doc/gdb.t
  @end table
  
  @node Mode Options
-Index: gdb-7.0.50.20100121/gdb/main.c
+Index: gdb-7.0.90.20100306/gdb/main.c
 ===================================================================
---- gdb-7.0.50.20100121.orig/gdb/main.c	2010-01-21 15:11:18.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/main.c	2010-01-21 15:13:02.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/main.c	2010-03-06 23:20:23.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/main.c	2010-03-06 23:20:35.000000000 +0100
 @@ -382,6 +382,7 @@ captured_main (void *data)
        {"xdb", no_argument, &xdb_commands, 1},
        {"dbx", no_argument, &dbx_commands, 1},
@@ -48,10 +48,10 @@ Index: gdb-7.0.50.20100121/gdb/main.c
  "), stream);
    fputs_unfiltered (_("\
    --se=FILE          Use FILE as symbol file and executable file.\n\
-Index: gdb-7.0.50.20100121/gdb/symfile.c
+Index: gdb-7.0.90.20100306/gdb/symfile.c
 ===================================================================
---- gdb-7.0.50.20100121.orig/gdb/symfile.c	2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/symfile.c	2010-01-21 15:13:02.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/symfile.c	2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/symfile.c	2010-03-06 23:20:35.000000000 +0100
 @@ -79,6 +79,7 @@ static void clear_symtab_users_cleanup (
  
  /* Global variables owned by this file */
@@ -60,19 +60,19 @@ Index: gdb-7.0.50.20100121/gdb/symfile.c
  
  /* External variables and functions referenced. */
  
-Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
+Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
 ===================================================================
---- gdb-7.0.50.20100121.orig/gdb/dwarf2read.c	2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/dwarf2read.c	2010-01-21 15:13:15.000000000 +0100
-@@ -53,6 +53,7 @@
+--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c	2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/dwarf2read.c	2010-03-06 23:20:54.000000000 +0100
+@@ -52,6 +52,7 @@
+ #include "f-lang.h"
  #include "typeprint.h"
  #include "jv-lang.h"
- #include "vec.h"
 +#include "top.h"
  
  #include <fcntl.h>
  #include "gdb_string.h"
-@@ -1237,7 +1238,8 @@ dwarf2_has_info (struct objfile *objfile
+@@ -1222,7 +1223,8 @@ dwarf2_has_info (struct objfile *objfile
  
        bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
      }
@@ -82,10 +82,10 @@ Index: gdb-7.0.50.20100121/gdb/dwarf2rea
  	  && dwarf2_per_objfile->abbrev.asection != NULL);
  }
  
-Index: gdb-7.0.50.20100121/gdb/top.h
+Index: gdb-7.0.90.20100306/gdb/top.h
 ===================================================================
---- gdb-7.0.50.20100121.orig/gdb/top.h	2010-01-01 08:31:42.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/top.h	2010-01-21 15:13:02.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/top.h	2010-01-01 08:31:42.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/top.h	2010-03-06 23:20:35.000000000 +0100
 @@ -63,6 +63,7 @@ extern void set_prompt (char *);
  
  /* From random places.  */

gdb-6.3-test-pie-20050107.patch:
 configure            |    3 
 configure.ac         |    2 
 gdb.pie/Makefile.in  |   19 
 gdb.pie/attach.c     |   20 +
 gdb.pie/attach.exp   |  433 ++++++++++++++++++++++
 gdb.pie/attach2.c    |   24 +
 gdb.pie/break.c      |  146 +++++++
 gdb.pie/break.exp    |  977 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb.pie/break1.c     |   44 ++
 gdb.pie/corefile.exp |  243 ++++++++++++
 gdb.pie/coremaker.c  |  142 +++++++
 11 files changed, 2051 insertions(+), 2 deletions(-)

Index: gdb-6.3-test-pie-20050107.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.3-test-pie-20050107.patch,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- gdb-6.3-test-pie-20050107.patch	28 Jan 2010 22:26:13 -0000	1.13
+++ gdb-6.3-test-pie-20050107.patch	11 Jul 2010 18:06:30 -0000	1.14
@@ -1,29 +1,29 @@
-Index: gdb-6.8.50.20090909/gdb/testsuite/configure.ac
+Index: gdb-7.0.90.20100306/gdb/testsuite/configure.ac
 ===================================================================
---- gdb-6.8.50.20090909.orig/gdb/testsuite/configure.ac	2009-07-31 17:38:16.000000000 +0200
-+++ gdb-6.8.50.20090909/gdb/testsuite/configure.ac	2009-09-09 19:06:01.000000000 +0200
+--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure.ac	2010-02-19 20:16:36.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/testsuite/configure.ac	2010-03-06 23:19:56.000000000 +0100
 @@ -144,6 +144,6 @@ AC_OUTPUT([Makefile \
    gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
-   gdb.fortran/Makefile gdb.server/Makefile \
-   gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile \
+   gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \
+   gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
 -  gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
 +  gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
    gdb.python/Makefile gdb.reverse/Makefile \
    gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
-Index: gdb-6.8.50.20090909/gdb/testsuite/configure
+Index: gdb-7.0.90.20100306/gdb/testsuite/configure
 ===================================================================
---- gdb-6.8.50.20090909.orig/gdb/testsuite/configure	2009-08-22 18:56:43.000000000 +0200
-+++ gdb-6.8.50.20090909/gdb/testsuite/configure	2009-09-09 19:06:27.000000000 +0200
+--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure	2010-02-19 20:16:36.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/testsuite/configure	2010-03-06 23:20:12.000000000 +0100
 @@ -3515,7 +3515,7 @@ done
  
  
  
--ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
-+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
++ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
  
  cat >confcache <<\_ACEOF
  # This file is a shell script that caches the results of configure
-@@ -4231,6 +4231,7 @@ do
+@@ -4232,6 +4232,7 @@ do
      "gdb.objc/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.objc/Makefile" ;;
      "gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;;
      "gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;;
@@ -31,10 +31,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
      "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
      "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
      "gdb.threads/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;;
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,20 @@
 +/* This program is intended to be started outside of gdb, and then
 +   attached to by gdb.  Thus, it simply spins in a loop.  The loop
@@ -56,10 +56,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +    }
 +  return 0;
 +}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,24 @@
 +/* This program is intended to be started outside of gdb, and then
 +   attached to by gdb.  Thus, it simply spins in a loop.  The loop
@@ -85,10 +85,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +    }
 +  return (0);
 +}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,146 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -236,10 +236,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +    }
 +  return 0;
 +}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,44 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -285,10 +285,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +void marker3 (a, b) char *a, *b; {}	/* set breakpoint 18 here */
 +void marker4 (d) long d; {}		/* set breakpoint 13 here */
 +#endif
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,142 @@
 +/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
 +   Free Software Foundation, Inc.
@@ -432,10 +432,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +  return 0;
 +}
 +
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,433 @@
 +#   Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
 +
@@ -870,10 +870,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +do_call_attach_tests
 +
 +return 0
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,977 @@
 +#   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
 +#   2000, 2002, 2003, 2004
@@ -1852,10 +1852,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +    send_gdb "set args main\n"
 +    gdb_expect -re ".*$gdb_prompt $" {}
 +}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,243 @@
 +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
 +# Free Software Foundation, Inc.
@@ -2100,10 +2100,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite
 +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)"
 +
 +gdb_test "core" "No core file now."
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in	2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in	2010-03-06 23:19:31.000000000 +0100
 @@ -0,0 +1,19 @@
 +VPATH = @srcdir@
 +srcdir = @srcdir@

gdb-6.5-bz203661-emit-relocs.patch:
 symfile.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: gdb-6.5-bz203661-emit-relocs.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.5-bz203661-emit-relocs.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- gdb-6.5-bz203661-emit-relocs.patch	4 Aug 2009 05:37:28 -0000	1.3
+++ gdb-6.5-bz203661-emit-relocs.patch	11 Jul 2010 18:06:30 -0000	1.4
@@ -1,11 +1,11 @@
-Index: gdb-6.8.50.20090802/gdb/symfile.c
+Index: gdb-7.0.90.20100306/gdb/symfile.c
 ===================================================================
---- gdb-6.8.50.20090802.orig/gdb/symfile.c	2009-08-03 12:29:58.000000000 +0200
-+++ gdb-6.8.50.20090802/gdb/symfile.c	2009-08-03 12:40:58.000000000 +0200
-@@ -4012,6 +4012,12 @@ symfile_dummy_outputs (bfd *abfd, asecti
- bfd_byte *
- symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
+--- gdb-7.0.90.20100306.orig/gdb/symfile.c	2010-03-06 23:20:35.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/symfile.c	2010-03-06 23:26:25.000000000 +0100
+@@ -3642,6 +3642,12 @@ default_symfile_relocate (struct objfile
  {
+   bfd *abfd = objfile->obfd;
+ 
 +  /* Executable files have all the relocations already resolved.
 +   * Handle files linked with --emit-relocs.
 +   * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html  */

gdb-6.5-bz216711-clone-is-outermost.patch:
 gdb-6.8.50.20090802/gdb/amd64-linux-tdep.c                      |   76 +++++
 gdb-6.8.50.20090802/gdb/amd64-tdep.c                            |    5 
 gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.c   |   39 ++
 gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.exp |   61 ++++
 gdb-6.8.50.20090811/gdb/i386-tdep.c                             |    3 
 gdb-6.8.50.20090811/gdb/i386-tdep.h                             |    3 
 gdb/ia64-tdep.c                                                 |  133 ++++++++++
 7 files changed, 320 insertions(+)

Index: gdb-6.5-bz216711-clone-is-outermost.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.5-bz216711-clone-is-outermost.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- gdb-6.5-bz216711-clone-is-outermost.patch	12 Jan 2010 22:15:55 -0000	1.6
+++ gdb-6.5-bz216711-clone-is-outermost.patch	11 Jul 2010 18:06:30 -0000	1.7
@@ -164,7 +164,7 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tde
  /* Floating-point registers.  */
 --- a/gdb/ia64-tdep.c
 +++ b/gdb/ia64-tdep.c
-@@ -2122,6 +2122,137 @@ static const struct frame_unwind ia64_frame_unwind =
+@@ -2122,6 +2122,138 @@ static const struct frame_unwind ia64_frame_unwind =
    default_frame_sniffer
  };
  
@@ -228,12 +228,13 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tde
 +  if (minsym == NULL)
 +    return 0;
 +
-+  instr = slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], 2);
++  instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
 +  instr &= ~(((1L << 20) - 1) << 13);
 +  /* Address is relative to the jump instruction slot, not the next one.  */
 +  instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
 +	    & ((1L << 20) - 1)) << 13;
-+  replace_slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], instr, 2);
++  replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
++			  2);
 +
 +  if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
 +              &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],

gdb-6.6-buildid-locate-core-as-arg.patch:
 exceptions.h |    3 +++
 exec.c       |   22 +++++++++++++++++++---
 main.c       |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 72 insertions(+), 6 deletions(-)

Index: gdb-6.6-buildid-locate-core-as-arg.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.6-buildid-locate-core-as-arg.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- gdb-6.6-buildid-locate-core-as-arg.patch	28 Jan 2010 22:26:13 -0000	1.2
+++ gdb-6.6-buildid-locate-core-as-arg.patch	11 Jul 2010 18:06:30 -0000	1.3
@@ -58,10 +58,8 @@ Http://sourceware.org/ml/gdb-patches/201
 	* exec.c (exec_file_attach): Print a more useful error message if the
 	user did "gdb core".
 
-Index: gdb-7.0.50.20100128/gdb/exceptions.h
-===================================================================
---- gdb-7.0.50.20100128.orig/gdb/exceptions.h	2010-01-18 07:25:22.000000000 +0100
-+++ gdb-7.0.50.20100128/gdb/exceptions.h	2010-01-28 22:49:00.000000000 +0100
+--- ./gdb/exceptions.h	2010-04-11 22:31:30.000000000 +0200
++++ ./gdb/exceptions.h	2010-04-11 22:31:47.000000000 +0200
 @@ -78,6 +78,9 @@ enum errors {
    /* Feature is not supported in this copy of GDB.  */
    UNSUPPORTED_ERROR,
@@ -72,40 +70,49 @@ Index: gdb-7.0.50.20100128/gdb/exception
    /* Add more errors here.  */
    NR_ERRORS
  };
-Index: gdb-7.0.50.20100128/gdb/exec.c
-===================================================================
---- gdb-7.0.50.20100128.orig/gdb/exec.c	2010-01-28 22:48:59.000000000 +0100
-+++ gdb-7.0.50.20100128/gdb/exec.c	2010-01-28 22:58:45.000000000 +0100
+--- ./gdb/exec.c	2010-04-11 22:31:30.000000000 +0200
++++ ./gdb/exec.c	2010-04-11 22:41:26.000000000 +0200
 @@ -34,6 +34,7 @@
+ #include "arch-utils.h"
  #include "gdbthread.h"
  #include "progspace.h"
- #include "solib.h"
 +#include "exceptions.h"
  
  #include <fcntl.h>
  #include "readline/readline.h"
-@@ -258,6 +259,17 @@ exec_file_attach (char *filename, int fr
- 	  /* Make sure to close exec_bfd, or else "run" might try to use
- 	     it.  */
- 	  exec_close ();
+@@ -256,12 +257,27 @@ exec_file_attach (char *filename, int fr
+ 
+       if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
+ 	{
++	  int is_core;
 +
 +	  /* If the user accidentally did "gdb core", print a useful
 +	     error message.  Check it only after bfd_object has been checked as
 +	     a valid executable may get recognized for example also as
 +	     "trad-core".  */
-+	  if (bfd_check_format (exec_bfd, bfd_core))
-+	    throw_error (IS_CORE_ERROR,
-+			 _("\"%s\" is a core file.\n"
-+			   "Please specify an executable to debug."),
-+			 scratch_pathname);
++	  is_core = bfd_check_format (exec_bfd, bfd_core);
 +
- 	  error (_("\"%s\": not in executable format: %s"),
- 		 scratch_pathname, bfd_errmsg (bfd_get_error ()));
+ 	  /* Make sure to close exec_bfd, or else "run" might try to use
+ 	     it.  */
+ 	  exec_close ();
+-	  error (_("\"%s\": not in executable format: %s"),
+-		 scratch_pathname,
+-		 gdb_bfd_errmsg (bfd_get_error (), matching));
++
++	  if (is_core != 0)
++	    throw_error (IS_CORE_ERROR,
++		   _("\"%s\" is a core file.\n"
++		     "Please specify an executable to debug."),
++		   scratch_pathname);
++	  else
++	    error (_("\"%s\": not in executable format: %s"),
++		   scratch_pathname,
++		   gdb_bfd_errmsg (bfd_get_error (), matching));
  	}
-Index: gdb-7.0.50.20100128/gdb/main.c
-===================================================================
---- gdb-7.0.50.20100128.orig/gdb/main.c	2010-01-28 22:48:59.000000000 +0100
-+++ gdb-7.0.50.20100128/gdb/main.c	2010-01-28 22:49:00.000000000 +0100
+ 
+       /* FIXME - This should only be run for RS6000, but the ifdef is a poor
+--- ./gdb/main.c	2010-04-11 22:31:30.000000000 +0200
++++ ./gdb/main.c	2010-04-11 22:31:47.000000000 +0200
 @@ -241,6 +241,36 @@ captured_command_loop (void *data)
    return 1;
  }

gdb-6.8-bz254229-gcore-prpsinfo.patch:
 bfd/elf-bfd.h         |    2 
 bfd/elf.c             |   27 ++++++-
 gdb/amd64-linux-nat.c |   15 +++-
 gdb/fbsd-nat.c        |    1 
 gdb/linux-nat.c       |  172 +++++++++++++++++++++++++++++++++++++++++++++++++-
 gdb/linux-nat.h       |    2 
 gdb/procfs.c          |    1 
 7 files changed, 205 insertions(+), 15 deletions(-)

Index: gdb-6.8-bz254229-gcore-prpsinfo.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.8-bz254229-gcore-prpsinfo.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- gdb-6.8-bz254229-gcore-prpsinfo.patch	3 Feb 2010 06:36:19 -0000	1.6
+++ gdb-6.8-bz254229-gcore-prpsinfo.patch	11 Jul 2010 18:06:30 -0000	1.7
@@ -1,8 +1,8 @@
-Index: gdb-7.0.50.20100203/bfd/elf-bfd.h
+Index: gdb-7.1/bfd/elf-bfd.h
 ===================================================================
---- gdb-7.0.50.20100203.orig/bfd/elf-bfd.h	2010-02-02 13:37:39.000000000 +0100
-+++ gdb-7.0.50.20100203/bfd/elf-bfd.h	2010-02-03 07:28:20.000000000 +0100
-@@ -2140,7 +2140,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
+--- gdb-7.1.orig/bfd/elf-bfd.h	2010-02-09 13:14:42.000000000 +0100
++++ gdb-7.1/bfd/elf-bfd.h	2010-05-16 20:22:38.000000000 +0200
+@@ -2160,7 +2160,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
  extern char *elfcore_write_note
    (bfd *, char *, int *, const char *, int, const void *, int);
  extern char *elfcore_write_prpsinfo
@@ -11,11 +11,11 @@ Index: gdb-7.0.50.20100203/bfd/elf-bfd.h
  extern char *elfcore_write_prstatus
    (bfd *, char *, int *, long, int, const void *);
  extern char * elfcore_write_pstatus
-Index: gdb-7.0.50.20100203/bfd/elf.c
+Index: gdb-7.1/bfd/elf.c
 ===================================================================
---- gdb-7.0.50.20100203.orig/bfd/elf.c	2010-02-02 13:37:39.000000000 +0100
-+++ gdb-7.0.50.20100203/bfd/elf.c	2010-02-03 07:28:20.000000000 +0100
-@@ -8459,6 +8459,7 @@ char *
+--- gdb-7.1.orig/bfd/elf.c	2010-02-18 01:09:06.000000000 +0100
++++ gdb-7.1/bfd/elf.c	2010-05-16 20:25:15.000000000 +0200
+@@ -8545,6 +8545,7 @@ char *
  elfcore_write_prpsinfo (bfd  *abfd,
  			char *buf,
  			int  *bufsiz,
@@ -23,7 +23,7 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
  			const char *fname,
  			const char *psargs)
  {
-@@ -8485,9 +8486,15 @@ elfcore_write_prpsinfo (bfd  *abfd,
+@@ -8571,26 +8572,40 @@ elfcore_write_prpsinfo (bfd  *abfd,
        int note_type = NT_PRPSINFO;
  #endif
  
@@ -42,7 +42,16 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
        return elfcore_write_note (abfd, buf, bufsiz,
  				 note_name, note_type, &data, sizeof (data));
      }
-@@ -8502,9 +8509,15 @@ elfcore_write_prpsinfo (bfd  *abfd,
+   else
+ #endif
+     {
++/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue.  */
+ #if defined (HAVE_PSINFO_T)
+       psinfo_t data;
++/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue.  */
+       int note_type = NT_PSINFO;
+ #else
+       prpsinfo_t data;
        int note_type = NT_PRPSINFO;
  #endif
  
@@ -61,10 +70,10 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
        return elfcore_write_note (abfd, buf, bufsiz,
  				 note_name, note_type, &data, sizeof (data));
      }
-Index: gdb-7.0.50.20100203/gdb/amd64-linux-nat.c
+Index: gdb-7.1/gdb/amd64-linux-nat.c
 ===================================================================
---- gdb-7.0.50.20100203.orig/gdb/amd64-linux-nat.c	2010-02-03 07:28:20.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/amd64-linux-nat.c	2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/amd64-linux-nat.c	2010-05-16 20:22:38.000000000 +0200
++++ gdb-7.1/gdb/amd64-linux-nat.c	2010-05-16 20:22:38.000000000 +0200
 @@ -140,6 +140,7 @@ static int amd64_linux_gregset32_reg_off
  
  static char *
@@ -98,10 +107,10 @@ Index: gdb-7.0.50.20100203/gdb/amd64-lin
  }
  
  static void
-Index: gdb-7.0.50.20100203/gdb/fbsd-nat.c
+Index: gdb-7.1/gdb/fbsd-nat.c
 ===================================================================
---- gdb-7.0.50.20100203.orig/gdb/fbsd-nat.c	2010-01-01 08:31:31.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/fbsd-nat.c	2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/fbsd-nat.c	2010-01-01 08:31:31.000000000 +0100
++++ gdb-7.1/gdb/fbsd-nat.c	2010-05-16 20:22:38.000000000 +0200
 @@ -211,6 +211,7 @@ fbsd_make_corefile_notes (bfd *obfd, int
  	psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL);
  
@@ -110,10 +119,10 @@ Index: gdb-7.0.50.20100203/gdb/fbsd-nat.
  					  fname, psargs);
      }
  
-Index: gdb-7.0.50.20100203/gdb/linux-nat.c
+Index: gdb-7.1/gdb/linux-nat.c
 ===================================================================
---- gdb-7.0.50.20100203.orig/gdb/linux-nat.c	2010-02-03 07:28:20.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/linux-nat.c	2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/linux-nat.c	2010-05-16 20:22:38.000000000 +0200
++++ gdb-7.1/gdb/linux-nat.c	2010-05-16 20:22:38.000000000 +0200
 @@ -56,6 +56,7 @@
  #include "terminal.h"
  #include <sys/vfs.h>
@@ -131,7 +140,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat
  char *(*linux_elfcore_write_prstatus)
    (bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus;
  static char *
-@@ -4422,6 +4423,159 @@ linux_spu_make_corefile_notes (bfd *obfd
+@@ -4507,6 +4508,159 @@ linux_spu_make_corefile_notes (bfd *obfd
    return args.note_data;
  }
  
@@ -291,7 +300,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat
  /* Fills the "to_make_corefile_note" target vector.  Builds the note
     section for a corefile, and returns it in a malloc buffer.  */
  
-@@ -4442,8 +4596,14 @@ linux_nat_make_corefile_notes (bfd *obfd
+@@ -4527,8 +4681,14 @@ linux_nat_make_corefile_notes (bfd *obfd
  
    if (get_exec_file (0))
      {
@@ -306,7 +315,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat
        if (get_inferior_args ())
  	{
  	  char *string_end;
-@@ -4459,9 +4619,15 @@ linux_nat_make_corefile_notes (bfd *obfd
+@@ -4544,9 +4704,15 @@ linux_nat_make_corefile_notes (bfd *obfd
  		       psargs_end - string_end);
  	    }
  	}
@@ -324,10 +333,10 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat
      }
  
    /* Dump information for threads.  */
-Index: gdb-7.0.50.20100203/gdb/linux-nat.h
+Index: gdb-7.1/gdb/linux-nat.h
 ===================================================================
---- gdb-7.0.50.20100203.orig/gdb/linux-nat.h	2010-02-03 07:28:19.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/linux-nat.h	2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/linux-nat.h	2010-05-16 20:22:37.000000000 +0200
++++ gdb-7.1/gdb/linux-nat.h	2010-05-16 20:22:38.000000000 +0200
 @@ -173,7 +173,7 @@ int linux_nat_core_of_thread_1 (ptid_t p
  /* These functions make elfcore note sections.
     They may get overriden by code adjusting data for multi-target builds.  */
@@ -337,11 +346,11 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat
  extern char *(*linux_elfcore_write_prstatus)
    (bfd *, char *, int *, long, int, const void *);
  extern char *(*linux_elfcore_write_prfpreg)
-Index: gdb-7.0.50.20100203/gdb/procfs.c
+Index: gdb-7.1/gdb/procfs.c
 ===================================================================
---- gdb-7.0.50.20100203.orig/gdb/procfs.c	2010-01-28 09:19:29.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/procfs.c	2010-02-03 07:28:20.000000000 +0100
-@@ -6186,6 +6186,7 @@ procfs_make_note_section (bfd *obfd, int
+--- gdb-7.1.orig/gdb/procfs.c	2010-02-15 18:35:49.000000000 +0100
++++ gdb-7.1/gdb/procfs.c	2010-05-16 20:22:38.000000000 +0200
+@@ -6184,6 +6184,7 @@ procfs_make_note_section (bfd *obfd, int
    note_data = (char *) elfcore_write_prpsinfo (obfd,
  					       note_data,
  					       note_size,

gdb-archer-pie-addons.patch:
 dwarf2read.c |   17 +++++++++++++----
 gdbtypes.h   |    5 +++++
 jv-lang.c    |    6 ++++--
 value.c      |    6 ++++--
 4 files changed, 26 insertions(+), 8 deletions(-)

Index: gdb-archer-pie-addons.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-archer-pie-addons.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- gdb-archer-pie-addons.patch	28 Jan 2010 22:26:13 -0000	1.4
+++ gdb-archer-pie-addons.patch	11 Jul 2010 18:06:31 -0000	1.5
@@ -1,8 +1,8 @@
-Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
+Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
 ===================================================================
---- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c	2010-01-15 21:41:32.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/dwarf2read.c	2010-01-15 21:42:19.000000000 +0100
-@@ -5821,7 +5821,12 @@ read_common_block (struct die_info *die,
+--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c	2010-03-06 23:27:30.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/dwarf2read.c	2010-03-06 23:28:43.000000000 +0100
+@@ -5910,7 +5910,12 @@ read_common_block (struct die_info *die,
  {
    struct attribute *attr;
    struct symbol *sym;
@@ -16,7 +16,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2rea
  
    attr = dwarf2_attr (die, DW_AT_location, cu);
    if (attr)
-@@ -5830,6 +5835,7 @@ read_common_block (struct die_info *die,
+@@ -5919,6 +5924,7 @@ read_common_block (struct die_info *die,
        if (attr_form_is_block (attr))
          {
            base = decode_locdesc (DW_BLOCK (attr), cu);
@@ -24,7 +24,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2rea
          }
        else if (attr_form_is_section_offset (attr))
          {
-@@ -5891,12 +5897,15 @@ read_common_block (struct die_info *die,
+@@ -5980,12 +5986,15 @@ read_common_block (struct die_info *die,
  	      else
  		dwarf2_complex_location_expr_complaint ();
  
@@ -42,7 +42,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2rea
  	  else
  	    SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
  	  FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
-@@ -5910,7 +5919,7 @@ read_common_block (struct die_info *die,
+@@ -5999,7 +6008,7 @@ read_common_block (struct die_info *die,
  
        sym = new_symbol (die, type, cu);
        /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static.  */
@@ -51,60 +51,11 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2rea
  
        set_die_type (die, type, cu);
      }
-Index: gdb-7.0.50.20100115/gdb/exec.c
+Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
 ===================================================================
---- gdb-7.0.50.20100115.orig/gdb/exec.c	2010-01-15 21:35:14.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/exec.c	2010-01-15 21:47:19.000000000 +0100
-@@ -35,6 +35,7 @@
- #include "arch-utils.h"
- #include "gdbthread.h"
- #include "progspace.h"
-+#include "solib.h"
- 
- #include <fcntl.h>
- #include "readline/readline.h"
-@@ -225,6 +226,10 @@ exec_file_attach (char *filename, int fr
-       char *scratch_pathname;
-       int scratch_chan;
-       struct target_section *sections = NULL, *sections_end = NULL;
-+      struct target_section *p;
-+      int addr_bit;
-+      CORE_ADDR mask = CORE_ADDR_MAX;
-+      CORE_ADDR displacement;
- 
-       scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
- 		   write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
-@@ -293,12 +298,23 @@ exec_file_attach (char *filename, int fr
- 		 scratch_pathname, bfd_errmsg (bfd_get_error ()));
- 	}
- 
-+      set_gdbarch_from_file (exec_bfd);
-+
-+      addr_bit = gdbarch_addr_bit (target_gdbarch);
-+      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-+	mask = ((CORE_ADDR) 1 << addr_bit) - 1;
-+
-+      displacement = solib_exec_displacement ();
-+      for (p = sections; p < sections_end; p++)
-+	{
-+	  p->addr = (p->addr + displacement) & mask;
-+	  p->endaddr = (p->endaddr + displacement) & mask;
-+	}
-+
-       exec_bfd_mtime = bfd_get_mtime (exec_bfd);
- 
-       validate_files ();
- 
--      set_gdbarch_from_file (exec_bfd);
--
-       /* Add the executable's sections to the current address spaces'
- 	 list of sections.  This possibly pushes the exec_ops
- 	 target.  */
-Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/gdbtypes.h	2010-01-15 21:35:16.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/gdbtypes.h	2010-01-15 21:44:24.000000000 +0100
-@@ -406,6 +406,7 @@ enum type_instance_flag_value
+--- gdb-7.0.90.20100306.orig/gdb/gdbtypes.h	2010-03-06 23:26:34.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/gdbtypes.h	2010-03-06 23:28:43.000000000 +0100
+@@ -412,6 +412,7 @@ enum type_instance_flag_value
  enum field_loc_kind
    {
      FIELD_LOC_KIND_BITPOS,	/* bitpos */
@@ -112,7 +63,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.
      FIELD_LOC_KIND_PHYSADDR,	/* physaddr */
      FIELD_LOC_KIND_PHYSNAME	/* physname */
    };
-@@ -582,6 +583,7 @@ struct main_type
+@@ -591,6 +592,7 @@ struct main_type
  	   is the location (in the target) of the static field.
  	   Otherwise, physname is the mangled label of the static field. */
  
@@ -120,7 +71,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.
  	CORE_ADDR physaddr;
  	char *physname;
        }
-@@ -1100,6 +1102,7 @@ extern void allocate_gnat_aux_type (stru
+@@ -1091,6 +1093,7 @@ extern void allocate_gnat_aux_type (stru
  #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
  #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
  #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
@@ -128,7 +79,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.
  #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
  #define SET_FIELD_BITPOS(thisfld, bitpos)			\
    (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS,		\
-@@ -1107,6 +1110,7 @@ extern void allocate_gnat_aux_type (stru
+@@ -1098,6 +1101,7 @@ extern void allocate_gnat_aux_type (stru
  #define SET_FIELD_PHYSNAME(thisfld, name)			\
    (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME,		\
     FIELD_STATIC_PHYSNAME (thisfld) = (name))
@@ -136,7 +87,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.
  #define SET_FIELD_PHYSADDR(thisfld, addr)			\
    (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR,		\
     FIELD_STATIC_PHYSADDR (thisfld) = (addr))
-@@ -1119,6 +1123,7 @@ extern void allocate_gnat_aux_type (stru
+@@ -1110,6 +1114,7 @@ extern void allocate_gnat_aux_type (stru
  #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
  #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
  #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
@@ -144,10 +95,10 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.
  #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
  #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
  #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
-Index: gdb-7.0.50.20100115/gdb/jv-lang.c
+Index: gdb-7.0.90.20100306/gdb/jv-lang.c
 ===================================================================
---- gdb-7.0.50.20100115.orig/gdb/jv-lang.c	2010-01-15 21:35:13.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/jv-lang.c	2010-01-15 21:41:58.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/jv-lang.c	2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/jv-lang.c	2010-03-06 23:28:43.000000000 +0100
 @@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gd
  
    fields = NULL;
@@ -168,142 +119,10 @@ Index: gdb-7.0.50.20100115/gdb/jv-lang.c
        else
  	TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
        if (accflags & 0x8000)	/* FIELD_UNRESOLVED_FLAG */
-Index: gdb-7.0.50.20100115/gdb/solib-svr4.c
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solib-svr4.c	2010-01-15 21:35:16.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solib-svr4.c	2010-01-15 21:44:55.000000000 +0100
-@@ -1689,7 +1689,10 @@ svr4_exec_displacement (void)
-   if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
-     return entry_point - bfd_get_start_address (exec_bfd);
- 
--  return svr4_static_exec_displacement ();
-+  if (!ptid_equal (inferior_ptid, null_ptid))
-+    return svr4_static_exec_displacement ();
-+
-+  return 0;
- }
- 
- /* Relocate the main executable.  This function should be called upon
-@@ -1700,7 +1703,7 @@ svr4_exec_displacement (void)
- static void
- svr4_relocate_main_executable (void)
- {
--  CORE_ADDR displacement = svr4_exec_displacement ();
-+  CORE_ADDR displacement = solib_exec_displacement ();
- 
-   /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
-      difference of in-memory vs. in-file addresses and we could already
-@@ -2054,6 +2057,7 @@ _initialize_svr4_solib (void)
-   svr4_so_ops.free_so = svr4_free_so;
-   svr4_so_ops.clear_solib = svr4_clear_solib;
-   svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
-+  svr4_so_ops.exec_displacement = svr4_exec_displacement;
-   svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
-   svr4_so_ops.current_sos = svr4_current_sos;
-   svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
-Index: gdb-7.0.50.20100115/gdb/solib.c
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solib.c	2010-01-15 21:35:16.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solib.c	2010-01-15 21:41:58.000000000 +0100
-@@ -1037,6 +1037,19 @@ solib_create_inferior_hook (int from_tty
-   ops->solib_create_inferior_hook (from_tty);
- }
- 
-+/* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs.  */
-+
-+CORE_ADDR
-+solib_exec_displacement (void)
-+{
-+  struct target_so_ops *ops = solib_ops (target_gdbarch);
-+
-+  if (ops->exec_displacement != NULL)
-+    return (*ops->exec_displacement) ();
-+  else
-+    return 0;
-+}
-+
- /* GLOBAL FUNCTION
- 
-    in_solib_dynsym_resolve_code -- check to see if an address is in
-Index: gdb-7.0.50.20100115/gdb/solib.h
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solib.h	2010-01-08 23:52:04.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solib.h	2010-01-15 21:42:36.000000000 +0100
-@@ -44,6 +44,8 @@ extern int solib_read_symbols (struct so
- 
- extern void solib_create_inferior_hook (int from_tty);
- 
-+extern CORE_ADDR solib_exec_displacement (void);
-+
- /* If ADDR lies in a shared library, return its name.  */
- 
- extern char *solib_name_from_address (struct program_space *, CORE_ADDR);
-Index: gdb-7.0.50.20100115/gdb/solist.h
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solist.h	2010-01-08 23:52:04.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solist.h	2010-01-15 21:41:58.000000000 +0100
-@@ -92,6 +92,9 @@ struct target_so_ops
-     /* Target dependent code to run after child process fork.  */
-     void (*solib_create_inferior_hook) (int from_tty);
- 
-+    /* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs.  */
-+    CORE_ADDR (*exec_displacement) (void);
-+
-     /* Do additional symbol handling, lookup, etc. after symbols
-        for a shared object have been loaded.  */
-     void (*special_symbol_handling) (void);
-Index: gdb-7.0.50.20100115/gdb/symfile.c
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/symfile.c	2010-01-15 21:35:14.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/symfile.c	2010-01-15 21:41:58.000000000 +0100
-@@ -832,15 +832,36 @@ syms_from_objfile (struct objfile *objfi
-      if an error occurs during symbol reading.  */
-   old_chain = make_cleanup_free_objfile (objfile);
- 
--  /* If ADDRS and OFFSETS are both NULL, put together a dummy address
--     list.  We now establish the convention that an addr of zero means
--     no load address was specified. */
-+  /* If ADDRS and OFFSETS are both NULL, put together a dummy offset list.  */
-+
-   if (! addrs && ! offsets)
-     {
--      local_addr
--	= alloc_section_addr_info (bfd_count_sections (objfile->obfd));
--      make_cleanup (xfree, local_addr);
--      addrs = local_addr;
-+      /* Relocateble files have an exception in default_symfile_offsets which
-+	 applies only for ADDRS.  But calling solib_exec_displacement is more
-+	 suitable for OFFSETS.  Fortunately we never need the both
-+	 functionalities simultaneously and in other cases zeroed ADDRS and
-+	 zeroed OFFSETS are equivalent.  */
-+
-+      if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
-+	{
-+	  local_addr
-+		 = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
-+	  make_cleanup (xfree, local_addr);
-+	  addrs = local_addr;
-+	}
-+      else
-+	{
-+	  CORE_ADDR displacement = 0;
-+	  int i;
-+
-+	  if (mainline)
-+	    displacement = solib_exec_displacement ();
-+
-+	  num_offsets = bfd_count_sections (objfile->obfd);
-+	  offsets = alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets));
-+	  for (i = 0; i < num_offsets; i++)
-+	    offsets->offsets[i] = displacement;
-+	}
-     }
- 
-   /* Now either addrs or offsets is non-zero.  */
-Index: gdb-7.0.50.20100115/gdb/value.c
+Index: gdb-7.0.90.20100306/gdb/value.c
 ===================================================================
---- gdb-7.0.50.20100115.orig/gdb/value.c	2010-01-15 21:35:13.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/value.c	2010-01-15 21:41:58.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/value.c	2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/value.c	2010-03-06 23:28:43.000000000 +0100
 @@ -1897,7 +1897,8 @@ value_static_field (struct type *type, i
    if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
      {

gdb-archer.patch:
 Makefile.in                                              |   93 
 ada-lang.c                                               |   41 
 alpha-linux-tdep.c                                       |    4 
 amd64-linux-nat.c                                        |   15 
 amd64-linux-tdep.c                                       |    3 
 arm-linux-tdep.c                                         |    3 
 ax-gdb.c                                                 |    2 
 block.c                                                  |   24 
 block.h                                                  |   12 
 breakpoint.c                                             |  231 +-
 breakpoint.h                                             |   17 
 c-exp.y                                                  |  117 +
 c-lang.c                                                 |    1 
 c-typeprint.c                                            |   48 
 coffread.c                                               |    1 
 config.in                                                |    8 
 configure                                                |   76 
 configure.ac                                             |   47 
 configure.tgt                                            |   24 
 cp-name-parser.y                                         |    2 
 cp-namespace.c                                           |  370 +--
 cp-support.c                                             |  100 
 cp-support.h                                             |   43 
 dbxread.c                                                |    1 
 doc/gdb.texinfo                                          |  407 +++
 doc/gdbint.texinfo                                       |   62 
 doc/observer.texi                                        |    5 
 dwarf2-frame.c                                           |    9 
 dwarf2expr.c                                             |    7 
 dwarf2expr.h                                             |    2 
 dwarf2loc.c                                              |  289 ++
 dwarf2loc.h                                              |    9 
 dwarf2read.c                                             | 1564 +++++++++++----
 elfread.c                                                |   36 
 eval.c                                                   |  204 +
 expprint.c                                               |    2 
 expression.h                                             |   10 
 f-lang.c                                                 |   44 
 f-lang.h                                                 |   11 
 f-typeprint.c                                            |   36 
 f-valprint.c                                             |   59 
 findcmd.c                                                |  111 -
 findvar.c                                                |  126 -
 frv-linux-tdep.c                                         |   21 
 frv-tdep.c                                               |    2 
 frv-tdep.h                                               |    3 
 gdbinit.in                                               |   10 
 gdbthread.h                                              |    7 
 gdbtypes.c                                               |  746 ++++++-
 gdbtypes.h                                               |  182 +
 gnu-v3-abi.c                                             |   18 
 hppa-linux-tdep.c                                        |   21 
 hppa-tdep.c                                              |    2 
 hppa-tdep.h                                              |    4 
 i386-linux-nat.c                                         |   16 
 i386-linux-tdep.c                                        |    3 
 i386-nat.c                                               |   12 
 i386-nat.h                                               |    5 
 ia64-linux-tdep.c                                        |    4 
 infcall.c                                                |   14 
 infcmd.c                                                 |   34 
 inferior.h                                               |    2 
 infrun.c                                                 |  183 +
 jv-lang.c                                                |    1 
 language.h                                               |    1 
 linespec.c                                               |  322 +--
 linux-nat.c                                              |   35 
 linux-tdep.c                                             |   42 
 linux-tdep.h                                             |    7 
 m2-lang.c                                                |    1 
 m32r-linux-tdep.c                                        |    4 
 machoread.c                                              |    1 
 main.c                                                   |   80 
 maint.c                                                  |    8 
 mi/mi-cmd-var.c                                          |    1 
 microblaze-linux-tdep.c                                  |    4 
 minsyms.c                                                |   19 
 mips-linux-tdep.c                                        |    4 
 mipsread.c                                               |    1 
 mn10300-linux-tdep.c                                     |    4 
 objc-lang.c                                              |   21 
 objfiles.c                                               |   20 
 objfiles.h                                               |   21 
 parse.c                                                  |  162 +
 parser-defs.h                                            |   25 
 ppc-linux-nat.c                                          |   19 
 ppc-linux-tdep.c                                         |   16 
 printcmd.c                                               |   91 
 python/lib/gdb/FrameIterator.py                          |   33 
 python/lib/gdb/FrameWrapper.py                           |  112 +
 python/lib/gdb/__init__.py                               |   19 
 python/lib/gdb/backtrace.py                              |   42 
 python/lib/gdb/command/__init__.py                       |    1 
 python/lib/gdb/command/alias.py                          |   59 
 python/lib/gdb/command/backtrace.py                      |  106 +
 python/lib/gdb/command/ignore_errors.py                  |   37 
 python/lib/gdb/command/pahole.py                         |   75 
 python/lib/gdb/command/require.py                        |   57 
 python/lib/gdb/command/save_breakpoints.py               |   65 
 python/lib/gdb/command/upto.py                           |  129 +
 python/lib/gdb/function/__init__.py                      |    1 
 python/lib/gdb/function/caller_is.py                     |   58 
 python/lib/gdb/function/in_scope.py                      |   47 
 python/py-block.c                                        |  265 ++
 python/py-breakpoint.c                                   |  666 ++++++
 python/py-cmd.c                                          |   16 
 python/py-frame.c                                        |  116 +
 python/py-hooks.c                                        |   50 
 python/py-inferior.c                                     |  934 ++++++++
 python/py-infthread.c                                    |  285 ++
 python/py-membuf.c                                       |  268 ++
 python/py-param.c                                        |  606 +++++
 python/py-prettyprint.c                                  |   20 
 python/py-symbol.c                                       |  336 +++
 python/py-symtab.c                                       |  322 +++
 python/py-type.c                                         |  165 +
 python/py-utils.c                                        |   46 
 python/py-value.c                                        |   55 
 python/python-internal.h                                 |   69 
 python/python.c                                          |  340 +++
 python/python.h                                          |    2 
 scm-lang.c                                               |    1 
 scm-valprint.c                                           |    4 
 sh-linux-tdep.c                                          |    4 
 solib-darwin.c                                           |    1 
 solib-spu.c                                              |    7 
 solib-svr4.c                                             |    7 
 solib.c                                                  |    3 
 solist.h                                                 |    2 
 somread.c                                                |    1 
 sparc-linux-tdep.c                                       |    4 
 sparc64-linux-tdep.c                                     |    4 
 spu-tdep.c                                               |    2 
 stack.c                                                  |   36 
 symfile.c                                                |   12 
 symfile.h                                                |   11 
 symmisc.c                                                |    7 
 symtab.c                                                 |  320 +--
 symtab.h                                                 |   18 
 target.c                                                 |   20 
 target.h                                                 |   24 
 testsuite/gdb.arch/x86_64-vla-pointer-foo.S              |  457 ++++
 testsuite/gdb.arch/x86_64-vla-pointer.c                  |   43 
 testsuite/gdb.arch/x86_64-vla-pointer.exp                |   66 
 testsuite/gdb.arch/x86_64-vla-typedef-foo.S              |  455 ++++
 testsuite/gdb.arch/x86_64-vla-typedef.c                  |   43 
 testsuite/gdb.arch/x86_64-vla-typedef.exp                |   64 
 testsuite/gdb.base/arrayidx.c                            |    7 
 testsuite/gdb.base/arrayidx.exp                          |   10 
 testsuite/gdb.base/gnu-ifunc-lib.c                       |   54 
 testsuite/gdb.base/gnu-ifunc.c                           |   36 
 testsuite/gdb.base/gnu-ifunc.exp                         |  115 +
 testsuite/gdb.base/internal-var-field-address.c          |   20 
 testsuite/gdb.base/internal-var-field-address.exp        |   26 
 testsuite/gdb.base/vla-overflow.c                        |   30 
 testsuite/gdb.base/vla-overflow.exp                      |  108 +
 testsuite/gdb.base/vla.c                                 |   55 
 testsuite/gdb.base/vla.exp                               |   62 
 testsuite/gdb.cp/Makefile.in                             |    2 
 testsuite/gdb.cp/cp-relocate.exp                         |    6 
 testsuite/gdb.cp/cpexprs.cc                              |  431 ++++
 testsuite/gdb.cp/cpexprs.exp                             |  724 ++++++
 testsuite/gdb.cp/cplusfuncs.cc                           |    6 
 testsuite/gdb.cp/cplusfuncs.exp                          |  195 +
 testsuite/gdb.cp/ctti.exp                                |    5 
 testsuite/gdb.cp/exception.exp                           |   10 
 testsuite/gdb.cp/expand-sals.exp                         |    2 
 testsuite/gdb.cp/gdb9593.cc                              |  180 +
 testsuite/gdb.cp/gdb9593.exp                             |  185 +
 testsuite/gdb.cp/m-static.cc                             |   11 
 testsuite/gdb.cp/m-static.exp                            |    5 
 testsuite/gdb.cp/member-ptr.cc                           |   17 
 testsuite/gdb.cp/member-ptr.exp                          |   34 
 testsuite/gdb.cp/namespace-koenig.cc                     |  232 ++
 testsuite/gdb.cp/namespace-koenig.exp                    |  112 +
 testsuite/gdb.cp/namespace-multiple-imports.cc           |   20 
 testsuite/gdb.cp/namespace-multiple-imports.exp          |   49 
 testsuite/gdb.cp/namespace-nested-imports.cc             |   36 
 testsuite/gdb.cp/namespace-nested-imports.exp            |   57 
 testsuite/gdb.cp/namespace-no-imports.cc                 |   37 
 testsuite/gdb.cp/namespace-no-imports.exp                |   76 
 testsuite/gdb.cp/namespace-recursive.cc                  |   47 
 testsuite/gdb.cp/namespace-recursive.exp                 |   75 
 testsuite/gdb.cp/namespace-stress-declarations.cc        |   93 
 testsuite/gdb.cp/namespace-stress-declarations.exp       |   50 
 testsuite/gdb.cp/namespace-stress.cc                     |   60 
 testsuite/gdb.cp/namespace-stress.exp                    |   50 
 testsuite/gdb.cp/namespace.exp                           |   23 
 testsuite/gdb.cp/nsusing.exp                             |    2 
 testsuite/gdb.cp/overload.exp                            |    8 
 testsuite/gdb.cp/ovldbreak.exp                           |   46 
 testsuite/gdb.cp/realcpp.cc                              |  409 +++
 testsuite/gdb.cp/realcpp.exp                             |  891 ++++++++
 testsuite/gdb.cp/shadow.exp                              |    1 
 testsuite/gdb.cp/shadowing.cc                            |   48 
 testsuite/gdb.cp/shadowing.exp                           |   91 
 testsuite/gdb.cp/userdef.cc                              |    9 
 testsuite/gdb.cp/userdef.exp                             |    4 
 testsuite/gdb.dwarf2/dw2-aranges.S                       |  140 +
 testsuite/gdb.dwarf2/dw2-aranges.exp                     |   40 
 testsuite/gdb.dwarf2/dw2-bound-loclist.S                 |  176 +
 testsuite/gdb.dwarf2/dw2-bound-loclist.exp               |   48 
 testsuite/gdb.dwarf2/dw2-empty-namespace.S               |  108 +
 testsuite/gdb.dwarf2/dw2-empty-namespace.exp             |   43 
 testsuite/gdb.dwarf2/dw2-stripped.c                      |   42 
 testsuite/gdb.dwarf2/dw2-stripped.exp                    |   79 
 testsuite/gdb.dwarf2/dw2-struct-member-data-location.S   |   83 
 testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp |   37 
 testsuite/gdb.fortran/dwarf-stride.exp                   |   42 
 testsuite/gdb.fortran/dwarf-stride.f90                   |   40 
 testsuite/gdb.fortran/dynamic.exp                        |  145 +
 testsuite/gdb.fortran/dynamic.f90                        |   98 
 testsuite/gdb.fortran/library-module-lib.f90             |   28 
 testsuite/gdb.fortran/library-module-main.f90            |   23 
 testsuite/gdb.fortran/library-module.exp                 |   53 
 testsuite/gdb.fortran/module.exp                         |   38 
 testsuite/gdb.fortran/module.f90                         |   39 
 testsuite/gdb.fortran/string.exp                         |   59 
 testsuite/gdb.fortran/string.f90                         |   37 
 testsuite/gdb.gdb/selftest.exp                           |    4 
 testsuite/gdb.java/jmain.exp                             |    4 
 testsuite/gdb.java/jmisc.exp                             |    4 
 testsuite/gdb.java/jnpe.exp                              |   77 
 testsuite/gdb.java/jnpe.java                             |   38 
 testsuite/gdb.java/jprint.exp                            |    4 
 testsuite/gdb.opt/array-from-register-func.c             |   22 
 testsuite/gdb.opt/array-from-register.c                  |   28 
 testsuite/gdb.opt/array-from-register.exp                |   33 
 testsuite/gdb.opt/fortran-string.exp                     |   41 
 testsuite/gdb.opt/fortran-string.f90                     |   28 
 testsuite/gdb.python/py-cmd.exp                          |   27 
 testsuite/gdb.python/py-frame.exp                        |   48 
 testsuite/gdb.python/py-function.exp                     |   27 
 testsuite/gdb.python/py-inferior.c                       |   49 
 testsuite/gdb.python/py-inferior.exp                     |  201 +
 testsuite/gdb.python/py-infthread.c                      |   14 
 testsuite/gdb.python/py-infthread.exp                    |   58 
 testsuite/gdb.python/py-prettyprint.exp                  |   22 
 testsuite/gdb.python/py-template.exp                     |   25 
 testsuite/gdb.python/py-value.exp                        |   31 
 testsuite/gdb.threads/watchpoint-fork-forkoff.c          |  175 +
 testsuite/gdb.threads/watchpoint-fork-mt.c               |  157 +
 testsuite/gdb.threads/watchpoint-fork.c                  |   57 
 testsuite/gdb.threads/watchpoint-fork.exp                |  130 +
 testsuite/lib/cp-support.exp                             |    3 
 testsuite/lib/gdb.exp                                    |    1 
 testsuite/lib/python-support.exp                         |   53 
 thread.c                                                 |    3 
 top.c                                                    |    1 
 typeprint.c                                              |   13 
 typeprint.h                                              |    3 
 ui-file.c                                                |   20 
 ui-file.h                                                |    6 
 valarith.c                                               |  114 -
 valops.c                                                 |  194 +
 valprint.c                                               |    4 
 value.c                                                  |  146 +
 value.h                                                  |    7 
 varobj.c                                                 |    2 
 xcoffread.c                                              |    1 
 xtensa-linux-tdep.c                                      |    4 
 261 files changed, 19892 insertions(+), 1740 deletions(-)

View full diff with command:
/usr/bin/cvs -n -f diff -kk -u -p -N -r 1.40 -r 1.41 gdb-archer.patchIndex: gdb-archer.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-archer.patch,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -p -r1.40 -r1.41
--- gdb-archer.patch	3 Feb 2010 06:05:12 -0000	1.40
+++ gdb-archer.patch	11 Jul 2010 18:06:31 -0000	1.41
@@ -2,17 +2,17 @@ http://sourceware.org/gdb/wiki/ProjectAr
 http://sourceware.org/gdb/wiki/ArcherBranchManagement
 
 GIT snapshot:
-commit 285cf618d9b90b7f8f201f094bcfead3c9ba8925
+commit 39998c496988faaa1509cc6ab76b5c4777659bf4
 
 branch `archer' - the merge of branches:
-archer-tromey-delayed-symfile
+archer-tromey-delayed-symfile2
 archer-tromey-python
-archer-pmuldoon-next-over-throw
-archer-jankratochvil-fortran-module
-archer-jankratochvil-watchpoint
+archer-pmuldoon-next-over-throw2
+archer-jankratochvil-fortran-module2
+archer-jankratochvil-watchpoint2
 archer-jankratochvil-vla
 archer-keiths-expr-cumulative
-archer-jankratochvil-ifunc
+# plus older archer-jankratochvil-ifunc
 
 
 diff --git a/gdb/Makefile.in b/gdb/Makefile.in
@@ -190,7 +190,7 @@ index 98f42b9..dbf8273 100644
  # Dependency tracking.  Most of this is conditional on GNU Make being
  # found by configure; if GNU Make is not found, we fall back to a
 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
-index 40b70ab..b291d40 100644
+index 7a2d2ca..4bf4e31 100644
 --- a/gdb/ada-lang.c
 +++ b/gdb/ada-lang.c
 @@ -4781,14 +4781,10 @@ ada_lookup_symbol (const char *name, const struct block *block0,
@@ -209,7 +209,7 @@ index 40b70ab..b291d40 100644
  }
  
  
-@@ -10931,6 +10927,40 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp)
+@@ -10938,6 +10934,40 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp)
      }
  }
  
@@ -250,7 +250,7 @@ index 40b70ab..b291d40 100644
  static char *
  ada_op_name (enum exp_opcode opcode)
  {
-@@ -11319,6 +11349,7 @@ parse (void)
+@@ -11326,6 +11356,7 @@ parse (void)
  static const struct exp_descriptor ada_exp_descriptor = {
    ada_print_subexp,
    ada_operator_length,
@@ -314,7 +314,7 @@ index 5c9e558..55a1873 100644
  
    /* Override the GNU/Linux inferior startup hook.  */
 diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
-index 01cc1ce..2a0fa84 100644
+index c28eef7..02c11e1 100644
 --- a/gdb/amd64-linux-tdep.c
 +++ b/gdb/amd64-linux-tdep.c
 @@ -1481,6 +1481,9 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -342,10 +342,10 @@ index af409f6..406c066 100644
  
  /* Provide a prototype to silence -Wmissing-prototypes.  */
 diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
-index 5776bb0..6099e99 100644
+index 3e151de..ddbcb6e 100644
 --- a/gdb/ax-gdb.c
 +++ b/gdb/ax-gdb.c
-@@ -1810,7 +1810,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
+@@ -1812,7 +1812,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
  
  	/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
  	   symbol instead of the LOC_ARG one (if both exist).  */
@@ -432,7 +432,7 @@ index 7eedb6c..b147826 100644
 +
  #endif /* BLOCK_H */
 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
-index 0d55862..9258c6a 100644
+index 8c97949..0b66740 100644
 --- a/gdb/breakpoint.c
 +++ b/gdb/breakpoint.c
 @@ -61,6 +61,7 @@
@@ -788,7 +788,7 @@ index 0d55862..9258c6a 100644
        case bp_tracepoint:
        case bp_fast_tracepoint:
        case bp_jit_event:
-@@ -4818,6 +4906,8 @@ allocate_bp_location (struct breakpoint *bpt)
+@@ -4816,6 +4904,8 @@ allocate_bp_location (struct breakpoint *bpt)
      case bp_finish:
      case bp_longjmp:
      case bp_longjmp_resume:
@@ -797,7 +797,7 @@ index 0d55862..9258c6a 100644
      case bp_step_resume:
      case bp_watchpoint_scope:
      case bp_call_dummy:
-@@ -4826,6 +4916,7 @@ allocate_bp_location (struct breakpoint *bpt)
+@@ -4824,6 +4914,7 @@ allocate_bp_location (struct breakpoint *bpt)
      case bp_overlay_event:
      case bp_jit_event:
      case bp_longjmp_master:
@@ -855,7 +855,7 @@ index 0d55862..9258c6a 100644
  	break;
        }
  
-@@ -7508,6 +7602,7 @@ struct until_break_command_continuation_args
+@@ -7509,6 +7603,7 @@ struct until_break_command_continuation_args
  {
    struct breakpoint *breakpoint;
    struct breakpoint *breakpoint2;
@@ -863,7 +863,7 @@ index 0d55862..9258c6a 100644
  };
  
  /* This function is called by fetch_inferior_event via the
-@@ -7522,6 +7617,7 @@ until_break_command_continuation (void *arg)
+@@ -7523,6 +7618,7 @@ until_break_command_continuation (void *arg)
    delete_breakpoint (a->breakpoint);
    if (a->breakpoint2)
      delete_breakpoint (a->breakpoint2);
@@ -871,7 +871,7 @@ index 0d55862..9258c6a 100644
  }
  
  void
-@@ -7533,6 +7629,8 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7534,6 +7630,8 @@ until_break_command (char *arg, int from_tty, int anywhere)
    struct breakpoint *breakpoint;
    struct breakpoint *breakpoint2 = NULL;
    struct cleanup *old_chain;
@@ -880,7 +880,7 @@ index 0d55862..9258c6a 100644
  
    clear_proceed_status ();
  
-@@ -7571,6 +7669,9 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7572,6 +7670,9 @@ until_break_command (char *arg, int from_tty, int anywhere)
  
    old_chain = make_cleanup_delete_breakpoint (breakpoint);
  
@@ -890,7 +890,7 @@ index 0d55862..9258c6a 100644
    /* Keep within the current frame, or in frames called by the current
       one.  */
  
-@@ -7583,6 +7684,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7584,6 +7685,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
  					      frame_unwind_caller_id (frame),
  					      bp_until);
        make_cleanup_delete_breakpoint (breakpoint2);
@@ -901,7 +901,7 @@ index 0d55862..9258c6a 100644
      }
  
    proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
-@@ -7599,6 +7704,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7600,6 +7705,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
  
        args->breakpoint = breakpoint;
        args->breakpoint2 = breakpoint2;
@@ -909,7 +909,7 @@ index 0d55862..9258c6a 100644
  
        discard_cleanups (old_chain);
        add_continuation (inferior_thread (),
-@@ -8784,6 +8890,7 @@ delete_command (char *arg, int from_tty)
+@@ -8796,6 +8902,7 @@ delete_command (char *arg, int from_tty)
  	    && b->type != bp_thread_event
  	    && b->type != bp_overlay_event
  	    && b->type != bp_longjmp_master
@@ -917,7 +917,7 @@ index 0d55862..9258c6a 100644
  	    && b->number >= 0)
  	  {
  	    breaks_to_delete = 1;
-@@ -8803,6 +8910,7 @@ delete_command (char *arg, int from_tty)
+@@ -8815,6 +8922,7 @@ delete_command (char *arg, int from_tty)
  		&& b->type != bp_jit_event
  		&& b->type != bp_overlay_event
  		&& b->type != bp_longjmp_master
@@ -925,7 +925,7 @@ index 0d55862..9258c6a 100644
  		&& b->number >= 0)
  	      delete_breakpoint (b);
  	  }
-@@ -9113,6 +9221,7 @@ breakpoint_re_set_one (void *bint)
+@@ -9125,6 +9233,7 @@ breakpoint_re_set_one (void *bint)
  	 reset later by breakpoint_re_set.  */
      case bp_overlay_event:
      case bp_longjmp_master:
@@ -933,7 +933,7 @@ index 0d55862..9258c6a 100644
        delete_breakpoint (b);
        break;
  
-@@ -9135,6 +9244,8 @@ breakpoint_re_set_one (void *bint)
+@@ -9147,6 +9256,8 @@ breakpoint_re_set_one (void *bint)
      case bp_step_resume:
      case bp_longjmp:
      case bp_longjmp_resume:
@@ -942,7 +942,7 @@ index 0d55862..9258c6a 100644
      case bp_jit_event:
[...6756 lines suppressed...]
+   const char *obj_type_name = NULL;
+   char *func_name = NULL;
+@@ -2346,12 +2425,25 @@ find_overload_match (struct type **arg_types, int nargs,
    if (method)
      {
        gdb_assert (obj);
@@ -25965,45 +28690,108 @@ index cee10fb..b08cb21 100644
  
        fns_ptr = value_find_oload_method_list (&temp, name, 
  					      0, &num_fns, 
-@@ -2377,16 +2469,29 @@ find_overload_match (struct type **arg_types, int nargs,
+@@ -2371,23 +2463,45 @@ find_overload_match (struct type **arg_types, int nargs,
      }
    else
      {
 -      const char *qualified_name = SYMBOL_CPLUS_DEMANGLED_NAME (fsym);
-+      const char *qualified_name = SYMBOL_NATURAL_NAME (fsym);
++      const char *qualified_name = NULL;
  
 -      /* If we have a C++ name, try to extract just the function
 -	 part.  */
 -      if (qualified_name)
 -	func_name = cp_func_name (qualified_name);
-+      /* If we have a function with a C++ name, try to extract just
-+	 the function part.  Do not try this for non-functions (e.g.
-+	 function pointers).  */
-+      if (qualified_name
-+	  && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) == TYPE_CODE_FUNC)
-+	{
-+	  func_name = cp_func_name (qualified_name);
-+
-+	  /* If cp_func_name did not remove anything, the name of the
-+	     symbol did not include scope or argument types - it was
-+	     probably a C-style function.  */
-+	  if (func_name && strcmp (func_name, qualified_name) == 0)
-+	    {
-+	      xfree (func_name);
-+	      func_name = NULL;
-+	    }
-+	}
- 
+-
 -      /* If there was no C++ name, this must be a C-style function.
 -	 Just return the same symbol.  Do the same if cp_func_name
 -	 fails for some reason.  */
++      if (fsym)
++        {
++          qualified_name = SYMBOL_NATURAL_NAME (fsym);
++
++          /* If we have a function with a C++ name, try to extract just
++	     the function part.  Do not try this for non-functions (e.g.
++	     function pointers).  */
++          if (qualified_name
++              && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) == TYPE_CODE_FUNC)
++            {
++              func_name = cp_func_name (qualified_name);
++
++              /* If cp_func_name did not remove anything, the name of the
++	         symbol did not include scope or argument types - it was
++	         probably a C-style function.  */
++              if (func_name && strcmp (func_name, qualified_name) == 0)
++                {
++                  xfree (func_name);
++                  func_name = NULL;
++                }
++            }
++        }
++      else
++        {
++          func_name = (char *) name;
++          qualified_name = name;
++        }
++      
 +      /* If there was no C++ name, this must be a C-style function or
 +	 not a function at all.  Just return the same symbol.  Do the
 +	 same if cp_func_name fails for some reason.  */
        if (func_name == NULL)
          {
  	  *symp = fsym;
-@@ -3123,9 +3228,9 @@ value_maybe_namespace_elt (const struct type *curtype,
+           return 0;
+         }
+ 
+-      old_cleanups = make_cleanup (xfree, func_name);
+       make_cleanup (xfree, oload_syms);
+       make_cleanup (xfree, oload_champ_bv);
+ 
+@@ -2398,8 +2512,11 @@ find_overload_match (struct type **arg_types, int nargs,
+ 						&oload_champ_bv);
+     }
+ 
+-  /* Check how bad the best match is.  */
++  /* Did we find a match ?  */
++  if (oload_champ == -1)
++    error ("No symbol \"%s\" in current context.", name);
+ 
++  /* Check how bad the best match is.  */
+   match_quality =
+     classify_oload_match (oload_champ_bv, nargs,
+ 			  oload_method_static (method, fns_ptr,
+@@ -2456,8 +2573,8 @@ find_overload_match (struct type **arg_types, int nargs,
+ 	}
+       *objp = temp;
+     }
+-  if (old_cleanups != NULL)
+-    do_cleanups (old_cleanups);
++
++  do_cleanups (old_cleanups);
+ 
+   switch (match_quality)
+     {
+@@ -2565,6 +2682,12 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
+   new_namespace[namespace_len] = '\0';
+   new_oload_syms = make_symbol_overload_list (func_name,
+ 					      new_namespace);
++
++  /* If we have reached the deepesst level perform argument
++     determined lookup.  */
++  if (!searched_deeper)
++    make_symbol_overload_list_adl (arg_types, nargs, func_name);
++
+   while (new_oload_syms[num_fns])
+     ++num_fns;
+ 
+@@ -2597,7 +2720,6 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
+     }
+   else
+     {
+-      gdb_assert (new_oload_champ != -1);
+       *oload_syms = new_oload_syms;
+       *oload_champ = new_oload_champ;
+       *oload_champ_bv = new_oload_champ_bv;
+@@ -3117,9 +3239,9 @@ value_maybe_namespace_elt (const struct type *curtype,
    struct symbol *sym;
    struct value *result;
  
@@ -26016,7 +28804,7 @@ index cee10fb..b08cb21 100644
  
    if (sym == NULL)
      return NULL;
-@@ -3267,7 +3372,7 @@ value_of_local (const char *name, int complain)
+@@ -3261,7 +3383,7 @@ value_of_local (const char *name, int complain)
  
    /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
       symbol instead of the LOC_ARG one (if both exist).  */
@@ -26025,7 +28813,7 @@ index cee10fb..b08cb21 100644
    if (sym == NULL)
      {
        if (complain)
-@@ -3321,8 +3426,6 @@ value_slice (struct value *array, int lowbound, int length)
+@@ -3315,8 +3437,6 @@ value_slice (struct value *array, int lowbound, int length)
        || lowbound + length - 1 > upperbound)
      error (_("slice out of range"));
  
@@ -26318,7 +29106,7 @@ index a462ee4..968cdf4 100644
 +  observer_attach_mark_used (value_types_mark_used);
  }
 diff --git a/gdb/value.h b/gdb/value.h
-index 42b4497..6f9923c 100644
+index 1f2086e..dd503ad 100644
 --- a/gdb/value.h
 +++ b/gdb/value.h
 @@ -342,11 +342,16 @@ extern LONGEST unpack_field_as_long (struct type *type,
@@ -26338,7 +29126,7 @@ index 42b4497..6f9923c 100644
  extern struct value *value_at (struct type *type, CORE_ADDR addr);
  extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr);
  
-@@ -689,7 +694,7 @@ extern struct value *value_allocate_space_in_inferior (int);
+@@ -694,7 +699,7 @@ extern struct value *value_allocate_space_in_inferior (int);
  extern struct value *value_of_local (const char *name, int complain);
  
  extern struct value *value_subscripted_rvalue (struct value *array,
@@ -26348,7 +29136,7 @@ index 42b4497..6f9923c 100644
  /* User function handler.  */
  
 diff --git a/gdb/varobj.c b/gdb/varobj.c
-index 6ec87b3..b274ade 100644
+index b4b2461..3a7a884 100644
 --- a/gdb/varobj.c
 +++ b/gdb/varobj.c
 @@ -26,6 +26,8 @@
@@ -26360,17 +29148,8 @@ index 6ec87b3..b274ade 100644
  
  #include "gdb_assert.h"
  #include "gdb_string.h"
-@@ -3495,7 +3497,7 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data)
-       (*func) (var_root->rootvar, data);
-     }
- }
--
-+
- extern void _initialize_varobj (void);
- void
- _initialize_varobj (void)
 diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
-index 25cc2d9..6784654 100644
+index acd7b50..0929a33 100644
 --- a/gdb/xcoffread.c
 +++ b/gdb/xcoffread.c
 @@ -3030,6 +3030,7 @@ static struct sym_fns xcoff_sym_fns =

gdb-rhel5-gcc44.patch:
 gdb.base/break-interp.exp      |   50 ++++++++++++++++++++++++++++++++++++++---
 gdb.base/vla.exp               |   20 +++++++++++++++-
 gdb.fortran/common-block.exp   |   20 +++++++++++++++-
 gdb.fortran/derived-type.exp   |   22 ++++++++++++++++--
 gdb.fortran/dwarf-stride.exp   |   20 +++++++++++++++-
 gdb.fortran/dynamic.exp        |   20 +++++++++++++++-
 gdb.fortran/library-module.exp |   26 ++++++++++++++++++---
 gdb.fortran/module.exp         |   20 +++++++++++++++-
 gdb.fortran/omp-step.exp       |   21 ++++++++++++++++-
 gdb.fortran/string.exp         |   20 +++++++++++++++-
 gdb.fortran/subarray.exp       |   22 ++++++++++++++++--
 gdb.threads/tls-sepdebug.exp   |   20 +++++++++++++++-
 12 files changed, 262 insertions(+), 19 deletions(-)

Index: gdb-rhel5-gcc44.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-rhel5-gcc44.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- gdb-rhel5-gcc44.patch	16 Jan 2010 22:32:09 -0000	1.2
+++ gdb-rhel5-gcc44.patch	11 Jul 2010 18:06:33 -0000	1.3
@@ -69,7 +69,7 @@ Index: gdb-7.0.50.20100115/gdb/testsuite
  }
  
 @@ -480,9 +500,33 @@ foreach ldprelink {NO YES} {
- 		    if {$binpie == "YES"} {
+ 		    if {$binpie != "NO"} {
  			lappend opts {additional_flags=-fPIE -pie}
  		    }
 -		    if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {


Index: gdb.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb.spec,v
retrieving revision 1.409
retrieving revision 1.410
diff -u -p -r1.409 -r1.410
--- gdb.spec	8 Feb 2010 21:00:12 -0000	1.409
+++ gdb.spec	11 Jul 2010 18:06:33 -0000	1.410
@@ -32,17 +32,18 @@ Name: gdb%{?_with_debug:-debug}
 # Set version to contents of gdb/version.in.
 # NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
 # and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
-Version: 7.0.50.20100203
+Version: 7.1
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 15%{?_with_upstream:.upstream}%{dist}
+Release: 28%{?_with_upstream:.upstream}%{dist}
 
-License: GPLv3+
+License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
 Group: Development/Debuggers
+# Do not provide URL for snapshots as the file lasts there only for 2 days.
 # ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2
 # ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
-Source: ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2
+Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
 Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 URL: http://gnu.org/software/gdb/
 
@@ -118,7 +119,6 @@ Patch118: gdb-6.3-gstack-20050411.patch
 
 # VSYSCALL and PIE
 Patch122: gdb-6.3-test-pie-20050107.patch
-Patch124: gdb-archer-pie-0315-breakpoint_address_match.patch
 Patch389: gdb-archer-pie-addons.patch
 Patch394: gdb-archer-pie-addons-keep-disabled.patch
 
@@ -183,10 +183,6 @@ Patch170: gdb-6.3-bt-past-zero-20051201.
 # Use bigger numbers than int.
 Patch176: gdb-6.3-large-core-20051206.patch
 
-# Hard-code executable names in gstack, such that it can run with a
-# corrupted or missing PATH.
-Patch177: gdb-6.3-gstack-without-path-20060414.patch
-
 # Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
 Patch188: gdb-6.5-bz203661-emit-relocs.patch
 
@@ -224,8 +220,7 @@ Patch213: gdb-6.5-readline-long-line-cra
 # Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
 Patch214: gdb-6.5-bz216711-clone-is-outermost.patch
 
-# Try to reduce sideeffects of skipping ppc .so libs trampolines (BZ 218379).
-Patch215: gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
+# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
 Patch216: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
 
 # Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
@@ -241,7 +236,7 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding
 Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
 
 # Backported fixups post the source tarball.
-#Patch232: gdb-upstream.patch
+Patch232: gdb-upstream.patch
 
 # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
 Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
@@ -344,13 +339,6 @@ Patch324: gdb-6.8-glibc-headers-compat.p
 # Create a single binary `gdb' autodetecting --tui by its argv[0].
 Patch326: gdb-6.8-tui-singlebinary.patch
 
-# Support transparent debugging of inlined functions for an optimized code.
-# Disable break-by-name on inlined functions due to a regression on parameters
-# of inlined functions falsely <optimized out> (BZ 556975 Comment 8).
-# Disable addon (finish) due to inline-cmds.exp: up from outer_inline2 assert.
-Patch350: gdb-6.8-inlining-addon.patch
-Patch328: gdb-6.8-inlining-by-name.patch
-
 # Fix PRPSINFO in the core files dumped by gcore (BZ 254229).
 Patch329: gdb-6.8-bz254229-gcore-prpsinfo.patch
 
@@ -374,6 +362,7 @@ Patch348: gdb-6.8-bz466901-backtrace-ful
 
 # The merged branch `archer' of: http://sourceware.org/gdb/wiki/ProjectArcher
 Patch349: gdb-archer.patch
+Patch420: gdb-archer-ada.patch
 
 # Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187).
 # - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE.
@@ -385,9 +374,6 @@ Patch381: gdb-simultaneous-step-resume-b
 # Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
 Patch382: gdb-core-open-vdso-warning.patch
 
-# Fix callback-mode readline-6.0 regression for CTRL-C.
-Patch390: gdb-readline-6.0-signal.patch
-
 # Fix syscall restarts for amd64->i386 biarch.
 Patch391: gdb-x86_64-i386-syscall-restart.patch
 
@@ -404,9 +390,6 @@ Patch335: gdb-rhel5-compat.patch
 # Fix regression by python on ia64 due to stale current frame.
 Patch397: gdb-follow-child-stale-parent.patch
 
-# Fix related_breakpoint stale ref crash.
-Patch400: gdb-stale-related_breakpoint.patch
-
 # Workaround ccache making lineno non-zero for command-line definitions.
 Patch403: gdb-ccache-workaround.patch
 
@@ -429,6 +412,121 @@ Patch412: gdb-unused-revert.patch
 # Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
 Patch417: gdb-bz541866-rwatch-before-run.patch
 
+# Remove false gdb_assert on $sp underflow.
+Patch422: gdb-infcall-sp-underflow.patch
+
+# Fix double-free on std::terminate handler (Tom Tromey, BZ 562975).
+Patch429: gdb-bz562975-std-terminate-double-free.patch
+
+# PIE: Fix back re-reun.
+Patch430: gdb-pie-rerun.patch
+
+# Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742).
+Patch432: gdb-solib-memory-error-nonfatal.patch
+
+# testsuite: Fix unstable results of gdb.base/prelink.exp.
+Patch433: gdb-6.7-testsuite-stable-results-prelink.patch 
+
+# [patch 1/6] PIE: Attach binary even after re-prelinked underneath
+# [patch 2/6] PIE: Attach binary even after ld.so re-prelinked underneath
+# [patch 3/6] PIE: Fix occasional error attaching i686 binary
+Patch434: gdb-pie-1of6-reprelinked-bin.patch
+Patch435: gdb-pie-2of6-reprelinked-ld.patch
+Patch436: gdb-pie-3of6-relocate-once.patch
+
+# [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla).
+Patch437: gdb-using-directive-leak.patch
+
+# Fix dangling displays in separate debuginfo (BZ 574483).
+Patch438: gdb-bz574483-display-sepdebug.patch
+
+# Support AVX registers (BZ 578250).
+Patch439: gdb-bz578250-avx-01of10.patch
+Patch440: gdb-bz578250-avx-02of10.patch
+Patch441: gdb-bz578250-avx-03of10.patch
+Patch442: gdb-bz578250-avx-04of10.patch
+Patch443: gdb-bz578250-avx-05of10.patch
+Patch444: gdb-bz578250-avx-06of10.patch
+Patch445: gdb-bz578250-avx-07of10.patch
+Patch446: gdb-bz578250-avx-08of10.patch
+Patch447: gdb-bz578250-avx-09of10.patch
+Patch448: gdb-bz578250-avx-10of10.patch
+Patch449: gdb-bz578250-avx-10of10-ppc.patch
+
+# Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz).
+# Temporarily workaround the crash of BZ 575292 as there was now BZ 585445.
+# Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch.
+Patch451: gdb-bz575292-delayed-physname.patch
+Patch455: gdb-bz575292-void-workaround.patch
+
+# Pretty printers not well documented (BZ 570635, Tom Tromey, Jan Kratochvil).
+Patch452: gdb-bz570635-prettyprint-doc1.patch
+Patch453: gdb-bz570635-prettyprint-doc2.patch
+
+# Fix crash when using GNU IFUNC call from breakpoint condition.
+Patch454: gdb-bz539590-gnu-ifunc-fix-cond.patch
+
+# Fail gracefully if the _Unwind_DebugHook arg. is optimized out (Tom Tromey).
+# Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey).
+Patch456: gdb-unwind-debughook-safe-fail.patch
+Patch457: gdb-unwind-debughook-step-independent.patch
+
+# testsuite: Fix gdb.base/vla-overflow.exp FAILing on s390x (BZ 590635).
+Patch458: gdb-archer-vla-test-oom.patch
+
+# Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
+Patch459: gdb-moribund-utrace-workaround.patch
+
+# Fix crash on VLA bound referencing an optimized-out variable (BZ 591879).
+Patch460: gdb-archer-vla-ref-optimizedout.patch
+
+# Remove core file when starting a process (BZ 594560).
+Patch461: gdb-bz594560-core-vs-process.patch
+
+# Import fix of TUI layout internal error (BZ 595475).
+Patch462: gdb-bz595475-tui-layout.patch
+
+# Fix and support DW_OP_*piece (Tom Tromey, BZ 589467).
+Patch463: gdb-bz589467-pieces01of4.patch
+Patch464: gdb-bz589467-pieces02of4.patch
+Patch465: gdb-bz589467-pieces03of4.patch
+Patch466: gdb-bz589467-pieces1of4.patch
+Patch467: gdb-bz589467-pieces2of4.patch
+Patch468: gdb-bz589467-pieces3of4.patch
+Patch469: gdb-bz589467-pieces4of4.patch
+Patch471: gdb-bz589467-pieces-vla-compat.patch
+
+# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
+Patch470: gdb-archer-next-over-throw-cxx-exec.patch
+
+# Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla).
+Patch472: gdb-bz600746-koenig-crash.patch
+
+# Backport DWARF-4 support (BZ 601887, Tom Tromey).
+Patch473: gdb-bz601887-dwarf4-1of2.patch
+Patch474: gdb-bz601887-dwarf4-2of2.patch
+Patch475: gdb-bz601887-dwarf4-rh-test.patch
+
+# Fix obstack corruptions on C++ (BZ 606185, Chris Moller, Jan Kratochvil).
+Patch476: gdb-bz606185-obstack-1of5.patch
+Patch477: gdb-bz606185-obstack-2of5.patch
+Patch478: gdb-bz606185-obstack-3of5.patch
+Patch479: gdb-bz606185-obstack-4of5.patch
+Patch480: gdb-bz606185-obstack-5of5.patch
+
+# Improve support for typedefs in classes (BZ 602314).
+Patch481: gdb-bz602314-ptype-class-typedef-1of3.patch
+Patch482: gdb-bz602314-ptype-class-typedef-2of3.patch
+Patch483: gdb-bz602314-ptype-class-typedef-3of3.patch
+
+# Fix `set print object on' for some non-dynamic classes (BZ 606660).
+Patch484: gdb-bz606660-print-object-nonvirtual.patch
+
+# Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller).
+Patch485: gdb-bz562763-pretty-print-2d-vectors-prereq.patch
+Patch486: gdb-bz562763-pretty-print-2d-vectors.patch
+Patch487: gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
+
 BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
 Requires: readline%{?_isa}
 BuildRequires: readline-devel%{?_isa}
@@ -459,7 +557,7 @@ BuildRequires: libstdc++%{?_isa}
 %define bits_other %{?_isa}
 %if 0%{!?el5:1}
 %ifarch s390x
-%define bits_other (%{__isa_name}-31)
+%define bits_other (%{__isa_name}-32)
 %else #!s390x
 %ifarch ppc
 %define bits_other (%{__isa_name}-64)
@@ -539,7 +637,8 @@ GDB, the GNU debugger, allows you to deb
 Java, and other languages, by executing them in a controlled fashion
 and printing their data.
 
-This package provides a program that allows you to run GDB on a different machine than the one which is running the program being debugged.
+This package provides a program that allows you to run GDB on a different
+machine than the one which is running the program being debugged.
 %endif # 0%{!?el5:1}
 
 %prep
@@ -563,9 +662,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 
 %if 0%{!?_with_upstream:1}
 
-#patch232 -p1
+%patch232 -p1
 %patch349 -p1
-%patch124 -p1
+%patch420 -p1
 %patch1 -p1
 %patch3 -p1
 
@@ -596,7 +695,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 %patch169 -p1
 %patch170 -p1
 %patch176 -p1
-%patch177 -p1
 %patch188 -p1
 %patch190 -p1
 %patch194 -p1
@@ -609,7 +707,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 %patch211 -p1
 %patch213 -p1
 %patch214 -p1
-%patch215 -p1
 %patch216 -p1
 %patch217 -p1
 %patch225 -p1
@@ -651,8 +748,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 %patch322 -p1
 %patch324 -p1
 %patch326 -p1
-###patch350 -p1
-###patch328 -p1
 %patch329 -p1
 %patch330 -p1
 %patch331 -p1
@@ -663,11 +758,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 %patch360 -p1
 %patch381 -p1
 %patch382 -p1
-%patch390 -p1
 %patch391 -p1
 %patch392 -p1
 %patch397 -p1
-%patch400 -p1
 %patch403 -p1
 %patch404 -p1
 %patch405 -p1
@@ -678,6 +771,64 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 %patch408 -p1
 %patch412 -p1
 %patch417 -p1
+%patch422 -p1
+%patch429 -p1
+%patch430 -p1
+%patch432 -p1
+%patch433 -p1
+%patch434 -p1
+%patch435 -p1
+%patch436 -p1
+%patch437 -p1
+%patch438 -p1
+%patch439 -p1
+%patch440 -p1
+%patch441 -p1
+%patch442 -p1
+%patch443 -p1
+%patch444 -p1
+%patch445 -p1
+%patch446 -p1
+%patch447 -p1
+%patch448 -p1
+%patch449 -p1
+%patch451 -p1
+%patch452 -p1
+%patch453 -p1
+%patch454 -p1
+%patch455 -p1
+%patch456 -p1
+%patch457 -p1
+%patch458 -p1
+%patch459 -p1
+%patch460 -p1
+%patch461 -p1
+%patch462 -p1
+%patch463 -p1
+%patch464 -p1
+%patch465 -p1
+%patch466 -p1
+%patch467 -p1
+%patch468 -p1
+%patch469 -p1
+%patch471 -p1
+%patch470 -p1
+%patch472 -p1
+%patch473 -p1
+%patch474 -p1
+%patch475 -p1
+%patch476 -p1
+%patch477 -p1
+%patch478 -p1
+%patch479 -p1
+%patch480 -p1
+%patch481 -p1
+%patch482 -p1
+%patch483 -p1
+%patch484 -p1
+%patch485 -p1
+%patch486 -p1
+%patch487 -p1
 
 %patch415 -p1
 %patch393 -p1
@@ -685,7 +836,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 # Patch415: gdb-6.6-buildid-locate-core-as-arg.patch
 # Currently disabled for RHEL as it is a new experimental feature not present
 # in FSF GDB and possibly affecting new user scripts.
-%if 0%{!?rhel:1}
+%if 0%{?rhel:1}
 %patch415 -p1 -R
 %endif
 %if 0%{!?el5:1}
@@ -978,7 +1129,7 @@ fi
 
 %files
 %defattr(-,root,root)
-%doc COPYING COPYING.LIB README NEWS
+%doc COPYING3 COPYING COPYING.LIB README NEWS
 %{_bindir}/gcore
 %{_bindir}/gdb
 %{_bindir}/gdbtui
@@ -1010,6 +1161,148 @@ fi
 %endif
 
 %changelog
+* Sun Jul 11 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-28.fc14
+- Rebuild for Fedora 14.
+
+* Wed Jun 30 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-28.fc13
+- Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller).
+
+* Wed Jun 30 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-27.fc13
+- Fix obstack corruptions on C++ (BZ 606185, Chris Moller, Jan Kratochvil).
+- Improve support for typedefs in classes (BZ 602314).
+- Fix `set print object on' for some non-dynamic classes (BZ 606660).
+
+* Wed Jun  9 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-26.fc13
+- Backport DWARF-4 support (BZ 601887, Tom Tromey).
+
+* Wed Jun  9 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-25.fc13
+- Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla).
+
+* Tue Jun  1 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-24.fc13
+- Fix crash on /proc/PID/stat race during inferior exit (BZ 596751).
+- testsuite: gdb.threads/watchthreads-reorder.exp kernel-2.6.33 compat. fix.
+
+* Sun May 30 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-23.fc13
+- Fix and support DW_OP_*piece (Tom Tromey, BZ 589467).
+- Fix follow-exec for C++ programs (bugreported by Martin Stransky).
+
+* Mon May 24 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-22.fc13
+- Remove core file when starting a process (BZ 594560).
+- Fix lock up on loops in the solib chain (BZ 593926).
+- Import fix of TUI layout internal error (BZ 595475).
+
+* Sun May 16 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-21.fc13
+- Make gdb-6.8-bz254229-gcore-prpsinfo.patch RHEL-5 /usr/bin/patch compatible
+  (bugreported by Jonas Maebe).
+
+* Thu May 13 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-20.fc13
+- Fix crash on VLA bound referencing an optimized-out variable (BZ 591879).
+- Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch.
+
+* Wed May 12 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-19.fc13
+- Backport <tab>-completion bug on anonymous structure fields (BZ 590648).
+- testsuite: Fix gdb.base/vla-overflow.exp FAILing on s390x (BZ 590635).
+- Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
+
+* Thu Apr 29 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-18.fc13
+- Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey).
+
+* Tue Apr 27 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-17.fc13
+- Fail gracefully if the _Unwind_DebugHook arg. is optimized out (Tom Tromey).
+
+* Tue Apr 27 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-16.fc13
+- Temporarily workaround the crash of BZ 575292 as there was now BZ 585445.
+
+* Mon Apr 26 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-15.fc13
+- Fix crash when using GNU IFUNC call from breakpoint condition.
+- Avoid internal error by disabling the previous BZ 575292 fix (BZ 585445).
+
+* Thu Apr 22 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-14.fc13
+- Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz).
+- Pretty printers not well documented (BZ 570635, Tom Tromey, Jan Kratochvil).
+
+* Fri Apr 16 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-13.fc13
+- archer-jankratochvil-fedora13 commit: 39998c496988faaa1509cc6ab76b5c4777659bf4
+- [vla] Fix boundaries for arrays on -O2 -g (support bound-ref->var->loclist).
+- [vla] Fix copy_type_recursive for unavailable variables (Joost van der Sluis).
+
+* Sun Apr 11 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-12.fc13
+- Fix crash on trying to load invalid executable (BZ 581215).
+
+* Thu Apr  8 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-11.fc13
+- testsuite: Fix gdb.base/gstack.exp also for ppc64 inferiors (for BZ 579793).
+
+* Thu Apr  8 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-10.fc13
+- Fix s390 --with testsuite Buildrequiers to be (s390-32) (BZ 580347, Cai Qian).
+
+* Wed Apr  7 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-9.fc13
+- Fix gstack to print even the frame #0.  New gdb.base/gstack.exp.  (BZ 579793)
+- Merge gdb-6.3-gstack-without-path-20060414.p* into gdb-6.3-gstack-20050411.p*,
+  no real code change.
+
+* Mon Apr  5 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-8.fc13
+- Fix breakpoint at *_start (BZ 162775, bugreport by John Reiser).
+
+* Sat Apr  3 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-7.fc13
+- Fix ppc build of the AVX registers support (for BZ 578250).
+
+* Sat Apr  3 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-6.fc13
+- Support AVX registers (BZ 578250).
+
+* Sat Apr  3 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-5.fc13
+- Fix dangling displays in separate debuginfo (BZ 574483).
+
+* Wed Mar 31 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-4.fc13
+- Remove gdb-readline-6.0-signal.patch with a bug causing crash while no longer
+  required with F-13 readline-6.1 (BZ 575516)
+
+* Mon Mar 29 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-3.fc13
+- [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla).
+
+* Mon Mar 29 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-2.fc13
+- Drop obsoleted `gdb-archer-pie-0315-breakpoint_address_match.patch'.
+- Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742).
+  - PIE: Attach binary even after re-prelinked underneath.
+  - PIE: Attach binary even after ld.so re-prelinked underneath.
+  - PIE: Fix occasional error attaching i686 binary (BZ 576742).
+- testsuite: Fix unstable results of gdb.base/prelink.exp.
+
+* Thu Mar 25 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.1-1.fc13
+- Update to new FSF GDB release.
+
+* Mon Mar 15 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.90.20100312-24.fc13
+- Drop gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch having false symbols
+  resolving (related to BZ 573277).
+
+* Fri Mar 12 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.90.20100312-23.fc13
+- Update to new FSF GDB snapshot.
+- Fix double-free on std::terminate handler (Tom Tromey, BZ 562975).
+
+* Wed Mar 10 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.90.20100306-22.fc13
+- Another License update.
+
+* Wed Mar 10 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.90.20100306-21.fc13
+- Update License for all the licenses contained in .src.rpm.
+
+* Mon Mar  8 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.90.20100306-20.fc13
+- Remove unapplied: gdb-6.8-inlining-addon.patch gdb-6.8-inlining-by-name.patch
+
+* Mon Mar  8 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.90.20100306-19.fc13
+- Include also %%doc COPYING3 (review by Petr Machata).
+- Remove URL for Source (review by Matej Cepl).
+
+* Sun Mar  7 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.90.20100306-18.fc13
+- archer-jankratochvil-fedora13 commit: 59c35a31f0981a0f0b884b32c91ae6325b2126cd
+
+* Sun Feb 28 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.50.20100203-17.fc13
+- Fix false warning: section .gnu.liblist not found in ...
+- Fix crash on stale addrinfo->sectindex (more sensitive due to the PIE patch).
+
+* Fri Feb 26 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.50.20100203-16.fc13
+- Fix ia64 part of the bt-clone-stop.exp fix.
+- Fix gdb.ada/* regressions (Keith Seitz).
+- Remove false gdb_assert on $sp underflow.
+
 * Mon Feb  8 2010 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.0.50.20100203-15.fc13
 - Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
 


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/sources,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -p -r1.47 -r1.48
--- sources	3 Feb 2010 06:05:13 -0000	1.47
+++ sources	11 Jul 2010 18:06:33 -0000	1.48
@@ -1,2 +1,2 @@
-179d5e54575f7a4d8dfbe423e1ee6678  gdb-7.0.50.20100203.tar.bz2
+21dce610476c054687b52770d2ddc657  gdb-7.1.tar.bz2
 04e5c4b1b9e633422cc48990fe61958d  libstdc++-v3-python-r155978.tar.bz2


--- gdb-6.3-gstack-without-path-20060414.patch DELETED ---


--- gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch DELETED ---


--- gdb-6.8-inlining-addon.patch DELETED ---


--- gdb-6.8-inlining-by-name.patch DELETED ---


--- gdb-archer-pie-0315-breakpoint_address_match.patch DELETED ---


--- gdb-readline-6.0-signal.patch DELETED ---


--- gdb-stale-related_breakpoint.patch DELETED ---



More information about the scm-commits mailing list