public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jan Kratochvil <jkratoch@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: - Rebuild for Fedora 14.
Date: Sat, 27 Jun 2026 23:54:39 GMT	[thread overview]
Message-ID: <178260447924.1.14801182983511749382.rpms-gdb-ee681d3b2f9f@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : ee681d3b2f9fce360dc30e10ab6fdcccb440fb13
Author : Jan Kratochvil <jkratoch@fedoraproject.org>
Date   : 2010-07-11T18:06:33+00:00
Stats  : +29591/-2942 in 80 file(s)
URL    : https://src.fedoraproject.org/rpms/gdb/c/ee681d3b2f9fce360dc30e10ab6fdcccb440fb13?branch=gdb-17.2-rebase-f44

Log:
- Rebuild for Fedora 14.

---
diff --git a/.cvsignore b/.cvsignore
index 3b34e37..47c7cd6 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,2 +1,2 @@
-gdb-7.0.50.20100203.tar.bz2
+gdb-7.1.tar.bz2
 libstdc++-v3-python-r155978.tar.bz2

diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch
index 0aa6426..100b877 100644
--- a/gdb-6.3-gstack-20050411.patch
+++ b/gdb-6.3-gstack-20050411.patch
@@ -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.in
  
  # 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;
++}

diff --git a/gdb-6.3-gstack-without-path-20060414.patch b/gdb-6.3-gstack-without-path-20060414.patch
deleted file mode 100644
index 677f934..0000000
--- a/gdb-6.3-gstack-without-path-20060414.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Index: gdb-6.3/gdb/gstack.sh
-===================================================================
---- gdb-6.3.orig/gdb/gstack.sh	2006-02-14 17:21:05.000000000 -0200
-+++ gdb-6.3/gdb/gstack.sh	2006-04-14 03:17:12.000000000 -0300
-@@ -17,17 +17,17 @@ fi
- 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
-@@ -39,7 +39,7 @@ fi
- set pagination no
- $backtrace
- EOF
--sed -n \
-+/bin/sed -n \
-     -e 's/^(gdb) //' \
-     -e '/^#/p' \
-     -e '/^Thread/p'

diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch
index bd89dd5..132f3bf 100644
--- a/gdb-6.3-readnever-20050907.patch
+++ b/gdb-6.3-readnever-20050907.patch
@@ -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.texinfo
  @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/dwarf2read.c
  	  && 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.  */

diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch
index e4227ef..f9d5bb4 100644
--- a/gdb-6.3-test-pie-20050107.patch
+++ b/gdb-6.3-test-pie-20050107.patch
@@ -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/configure
      "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/gdb.pie/attach.c
 +    }
 +  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/gdb.pie/attach2.c
 +    }
 +  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/gdb.pie/break.c
 +    }
 +  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/gdb.pie/break1.c
 +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/gdb.pie/coremaker.c
 +  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/gdb.pie/attach.exp
 +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/gdb.pie/break.exp
 +    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.pie/corefile.exp
 +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@

diff --git a/gdb-6.5-bz203661-emit-relocs.patch b/gdb-6.5-bz203661-emit-relocs.patch
index f58cc9e..61e0d56 100644
--- a/gdb-6.5-bz203661-emit-relocs.patch
+++ b/gdb-6.5-bz203661-emit-relocs.patch
@@ -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  */

diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch
index ab0c902..bd03985 100644
--- a/gdb-6.5-bz216711-clone-is-outermost.patch
+++ b/gdb-6.5-bz216711-clone-is-outermost.patch
@@ -164,7 +164,7 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c
  /* 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-tdep.c
 +  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],

diff --git a/gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
deleted file mode 100644
index 4fb26b0..0000000
--- a/gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
-
-
-Index: gdb-6.8.50.20081128/gdb/minsyms.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/minsyms.c	2008-10-01 18:56:52.000000000 +0200
-+++ gdb-6.8.50.20081128/gdb/minsyms.c	2008-12-02 23:24:27.000000000 +0100
-@@ -544,6 +544,11 @@ lookup_minimal_symbol_by_pc_section_1 (C
- 			 don't fill the bfd_section member, so don't
- 			 throw away symbols on those platforms.  */
- 		      && SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL
-+		      /* Don't ignore symbols for solib trampolines.
-+			 Limit its sideeffects - only for non-0 sized trampolines.
-+			 Red Hat Bug 200533 with its regression Bug 218379.  */
-+		      && (MSYMBOL_TYPE (&msymbol[hi]) != mst_solib_trampoline
-+		          || MSYMBOL_SIZE (&msymbol[hi]))
- 		      && (!matching_obj_sections
- 			  (SYMBOL_OBJ_SECTION (&msymbol[hi]), section)))
- 		    {

diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch
index f2fd4fe..7809940 100644
--- a/gdb-6.6-buildid-locate-core-as-arg.patch
+++ b/gdb-6.6-buildid-locate-core-as-arg.patch
@@ -58,10 +58,8 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
 	* 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/exceptions.h
    /* 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;
  }

diff --git a/gdb-6.7-testsuite-stable-results-prelink.patch b/gdb-6.7-testsuite-stable-results-prelink.patch
new file mode 100644
index 0000000..3c51577
--- /dev/null
+++ b/gdb-6.7-testsuite-stable-results-prelink.patch
@@ -0,0 +1,68 @@
+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@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
+ }
+

diff --git a/gdb-6.8-bz254229-gcore-prpsinfo.patch b/gdb-6.8-bz254229-gcore-prpsinfo.patch
index e0e68b8..249aa81 100644
--- a/gdb-6.8-bz254229-gcore-prpsinfo.patch
+++ b/gdb-6.8-bz254229-gcore-prpsinfo.patch
@@ -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-linux-nat.c
  }
  
  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.c
  					  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.c
  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.c
  /* 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.c
        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.c
      }
  
    /* 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.h
  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,

diff --git a/gdb-6.8-inlining-addon.patch b/gdb-6.8-inlining-addon.patch
deleted file mode 100644
index 7b84ef9..0000000
--- a/gdb-6.8-inlining-addon.patch
+++ /dev/null
@@ -1,571 +0,0 @@
-infcall.c <unwind_on_signal_p>:
-Revert the change of: gdb-6.8-inlining.patch
-causing: FAIL: gdb.base/unwindonsignal.exp: unwindonsignal, stack unwound
-
-resume() -> target_resume() move of clear_inline_frame_state() is for:
-gdb.mi/mi-nsmoribund.exp
-
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-bt.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-bt.c	2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-bt.c	2010-01-21 15:14:47.000000000 +0100
-@@ -13,10 +13,16 @@
-    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 x, y;
-+/* VOLATILE forces all the inlining to happen as otherwise the whole program
-+   gets optimized by CSE to just simple assignments of the results.  */
-+volatile int x, y;
- volatile int result;
- 
--void bar(void);
-+inline void bar(void)
-+{
-+  x += y; /* set breakpoint 1 here */
-+}
-+
- 
- inline int func1(void)
- {
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-cmds.c	2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.c	2010-01-21 15:14:47.000000000 +0100
-@@ -13,13 +13,19 @@
-    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 x, y;
-+/* VOLATILE forces all the inlining to happen as otherwise the whole program
-+   gets optimized by CSE to just simple assignments of the results.  */
-+volatile int x, y;
- volatile int result;
- 
--void bar(void);
- void marker(void);
- void noinline(void);
- 
-+inline void bar(void)
-+{
-+  x += y; /* set breakpoint 1 here */
-+}
-+
- inline int func1(void)
- {
-   bar ();
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.exp
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-cmds.exp	2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.exp	2010-01-21 15:14:47.000000000 +0100
-@@ -230,7 +230,7 @@ set line3 [gdb_get_line_number "set brea
- gdb_breakpoint $line3
- gdb_continue_to_breakpoint "consecutive func1"
- 
--gdb_test "next" ".*func1 .*first call.*" "next to first func1"
-+gdb_test "next" "func1 .*first call.*" "next to first func1"
- set msg "next to second func1"
- gdb_test_multiple "next" $msg {
-     -re ".*func1 .*second call.*$gdb_prompt $" {
-@@ -253,16 +253,16 @@ set line4 [gdb_get_line_number "set brea
- gdb_breakpoint $line4
- gdb_continue_to_breakpoint "func1 then func3"
- 
--gdb_test "next" ".*func1 \\\(\\\);" "next to func1 before func3"
--gdb_test "next" ".*func3 \\\(\\\);" "next to func3"
-+gdb_test "next" "func1 \\\(\\\);" "next to func1 before func3"
-+gdb_test "next" "func3 \\\(\\\);" "next to func3"
- 
- # Test finishing out of one thing and into another.
- set line5 [gdb_get_line_number "set breakpoint 5 here"]
- gdb_breakpoint $line5
- gdb_continue_to_breakpoint "finish into func1"
- 
--gdb_test "next" ".*marker \\\(\\\);" "next to finish marker"
--gdb_test "step" ".*set breakpoint 2 here.*" "step into finish marker"
-+gdb_test "next" "marker \\\(\\\);" "next to finish marker"
-+gdb_test "step" "set breakpoint 2 here.*" "step into finish marker"
- gdb_test "finish" "func1 \\\(\\\);" "finish from marker to func1"
- 
- gdb_test "step" "bar \\\(\\\);" "step into func1 for finish"
-@@ -297,12 +297,12 @@ gdb_test "step" "noinline \\\(\\\) at .*
- gdb_test "bt" "#0  noinline.*#1  .*outer_inline1.*#2  .*outer_inline2.*#3  main.*" "backtrace at noinline from outer_inline1"
- gdb_test "step" "inlined_fn \\\(\\\) at .*" "enter inlined_fn from noinline"
- gdb_test "bt" "#0  inlined_fn.*#1  noinline.*#2  .*outer_inline1.*#3  .*outer_inline2.*#4  main.*" "backtrace at inlined_fn from noinline"
--gdb_test "info frame" ".*inlined into frame.*" "inlined_fn from noinline inlined"
--gdb_test "up" "#1  noinline.*" "up to noinline"
--gdb_test "info frame" ".*\n called by frame.*" "noinline from outer_inline1 not inlined"
--gdb_test "up" "#2  .*outer_inline1.*" "up to outer_inline1"
--gdb_test "info frame" ".*inlined into frame.*" "outer_inline1 inlined"
--gdb_test "up" "#3  .*outer_inline2.*" "up to outer_inline2"
--gdb_test "info frame" ".*inlined into frame.*" "outer_inline2 inlined"
--gdb_test "up" "#4  main.*" "up from outer_inline2"
--gdb_test "info frame" ".*\n caller of frame.*" "main not inlined"
-+gdb_test "info frame" "inlined into frame.*" "inlined_fn from noinline inlined"
-+gdb_test "fini" "" "up to noinline"
-+gdb_test "info frame" "\n called by frame.*" "noinline from outer_inline1 not inlined"
-+gdb_test "fini" "" "up to outer_inline1"
-+gdb_test "info frame" "inlined into frame.*" "outer_inline1 inlined"
-+gdb_test "fini" "" "up to outer_inline2"
-+gdb_test "info frame" "inlined into frame.*" "outer_inline2 inlined"
-+gdb_test "fini" "" "up from outer_inline2"
-+gdb_test "info frame" " in main \[^\n\]*\n source language.*" "main not inlined"
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-locals.c	2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.c	2010-01-21 15:14:47.000000000 +0100
-@@ -13,11 +13,16 @@
-    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 x, y;
-+/* VOLATILE forces all the inlining to happen as otherwise the whole program
-+   gets optimized by CSE to just simple assignments of the results.  */
-+volatile int x, y;
- volatile int result;
- volatile int *array_p;
- 
--void bar(void);
-+inline void bar(void)
-+{
-+  x += y; /* set breakpoint 1 here */
-+}
- 
- inline int func1(int arg1)
- {
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.exp
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-locals.exp	2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.exp	2010-01-21 15:14:47.000000000 +0100
-@@ -77,6 +77,9 @@ if { ! $no_frames } {
- 
- # Make sure that locals on the stack are found.  This is an array to
- # prevent it from living in a register.
-+if [test_compiler_info "gcc-4-3-*"] {
-+    setup_kfail *-*-* "gcc/debug.optimization"
-+}
- gdb_test "print array\[0\]" "\\\$$decimal = 0" "print local (2)"
- 
- if { ! $no_frames } {
-@@ -115,4 +118,7 @@ if { ! $no_frames } {
-     gdb_test "info locals" ".*arg2 = 184.*" "info locals above bar (3b)"
- }
- 
-+if [test_compiler_info "gcc-4-3-*"] {
-+    setup_kfail *-*-* "gcc/debug.optimization"
-+}
- gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)"
-Index: gdb-7.0.50.20100121/gdb/frame.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/frame.c	2010-01-21 15:13:26.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/frame.c	2010-01-21 15:14:47.000000000 +0100
-@@ -316,7 +316,7 @@ fprint_frame (struct ui_file *file, stru
- static struct frame_info *
- skip_inlined_frames (struct frame_info *frame)
- {
--  while (get_frame_type (frame) == INLINE_FRAME)
-+  while (frame && get_frame_type (frame) == INLINE_FRAME)
-     frame = get_prev_frame (frame);
- 
-   return frame;
-@@ -1792,6 +1792,7 @@ get_frame_address_in_block (struct frame
- {
-   /* A draft address.  */
-   CORE_ADDR pc = get_frame_pc (this_frame);
-+  struct thread_info *tp = inferior_thread ();
- 
-   struct frame_info *next_frame = this_frame->next;
- 
-@@ -1834,6 +1835,9 @@ get_frame_address_in_block (struct frame
-      while in an inlined function, then the code address of the
-      "calling" normal function should not be adjusted either.  */
- 
-+  if (tp->current_pc_is_notcurrent)
-+    return pc - 1;
-+
-   while (get_frame_type (next_frame) == INLINE_FRAME)
-     next_frame = next_frame->next;
- 
-@@ -1865,7 +1869,7 @@ find_frame_sal (struct frame_info *frame
- 	sym = inline_skipped_symbol (inferior_ptid);
- 
-       init_sal (sal);
--      if (SYMBOL_LINE (sym) != 0)
-+      if (sym != NULL && SYMBOL_LINE (sym) != 0)
- 	{
- 	  sal->symtab = SYMBOL_SYMTAB (sym);
- 	  sal->line = SYMBOL_LINE (sym);
-Index: gdb-7.0.50.20100121/gdb/breakpoint.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/breakpoint.c	2010-01-21 15:14:41.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/breakpoint.c	2010-01-21 15:14:47.000000000 +0100
-@@ -62,6 +62,7 @@
- #include "jit.h"
- #include "xml-syscall.h"
- #include "parser-defs.h"
-+#include "inline-frame.h"
- 
- /* readline include files */
- #include "readline/readline.h"
-@@ -3558,10 +3559,24 @@ bpstat_check_breakpoint_conditions (bpst
-   const struct bp_location *bl = bs->breakpoint_at;
-   struct breakpoint *b = bl->owner;
- 
--  if (frame_id_p (b->frame_id)
--      && !frame_id_eq (b->frame_id, get_stack_frame_id (get_current_frame ())))
--    bs->stop = 0;
--  else if (bs->stop)
-+  if (frame_id_p (b->frame_id))
-+    {
-+      struct frame_info *b_frame, *frame;
-+      struct frame_id b_frame_id, current_frame_id;
-+
-+      b_frame = frame_find_by_id (b->frame_id);
-+
-+      /* get_stack_frame_id normalizes the id to the real non-inlined function
-+	 by skip_inlined_frames.  */
-+      b_frame_id = get_stack_frame_id (b_frame);
-+      current_frame_id = get_stack_frame_id (get_current_frame ());
-+
-+      /* Completely different (inlining notwithstanding) frames?  */
-+      if (!frame_id_eq (b_frame_id, current_frame_id))
-+	bs->stop = 0;
-+    }
-+
-+  if (bs->stop)
-     {
-       int value_is_zero = 0;
-       
-@@ -3729,6 +3744,12 @@ bpstat_stop_status (struct address_space
- 		  bs->print = 0;
- 		}
- 	      bs->commands = copy_command_lines (bs->commands);
-+
-+	      /* Display the innermost inlined frame at a breakpont as it gives to
-+		 most of the available information.  */
-+	      if (b->type != bp_until && b->type != bp_finish)
-+		while (inline_skipped_frames (ptid))
-+		  step_into_inline_frame (ptid);
- 	    }
- 
- 	  /* Print nothing for this entry if we dont stop or dont print.  */
-@@ -6043,9 +6064,9 @@ set_momentary_breakpoint (struct gdbarch
- {
-   struct breakpoint *b;
- 
--  /* If FRAME_ID is valid, it should be a real frame, not an inlined
--     one.  */
--  gdb_assert (!frame_id_inlined_p (frame_id));
-+  /* We can be returning even into an inline frame.  While finish_command will
-+     shortcut the case of returning _from_ an inline frame we still may be
-+     returning from non-inlined frame _to_ an inlined frame.  */
- 
-   b = set_raw_breakpoint (gdbarch, sal, type);
-   b->enable_state = bp_enabled;
-Index: gdb-7.0.50.20100121/gdb/inline-frame.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/inline-frame.c	2010-01-01 08:31:36.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/inline-frame.c	2010-01-21 15:14:47.000000000 +0100
-@@ -213,6 +213,12 @@ inline_frame_sniffer (const struct frame
-   if (frame_block == NULL)
-     return 0;
- 
-+  /* For >=2 inlined functions SKIPPED_SYMBOL needs to be different after each
-+     step_into_inline_frame call.  But skip_inline_frames is called only once
-+     and thus SKIPPED_SYMBOL needs to be calculated by INLINE_FRAME_SNIFFER.  */
-+  if (state)
-+    state->skipped_symbol = NULL;
-+
-   /* Calculate DEPTH, the number of inlined functions at this
-      location.  */
-   depth = 0;
-@@ -222,6 +228,10 @@ inline_frame_sniffer (const struct frame
-       if (block_inlined_p (cur_block))
- 	depth++;
- 
-+      if (state && depth == state->skipped_frames
-+	  && state->skipped_symbol == NULL)
-+	state->skipped_symbol = BLOCK_FUNCTION (cur_block);
-+
-       cur_block = BLOCK_SUPERBLOCK (cur_block);
-     }
- 
-@@ -300,7 +310,6 @@ skip_inline_frames (ptid_t ptid)
- {
-   CORE_ADDR this_pc;
-   struct block *frame_block, *cur_block;
--  struct symbol *last_sym = NULL;
-   int skip_count = 0;
-   struct inline_state *state;
- 
-@@ -321,10 +330,7 @@ skip_inline_frames (ptid_t ptid)
- 		 of BLOCK_START.  */
- 	      if (BLOCK_START (cur_block) == this_pc
- 		  || block_starting_point_at (this_pc, cur_block))
--		{
--		  skip_count++;
--		  last_sym = BLOCK_FUNCTION (cur_block);
--		}
-+		skip_count++;
- 	      else
- 		break;
- 	    }
-@@ -336,7 +342,6 @@ skip_inline_frames (ptid_t ptid)
-   state = allocate_inline_frame_state (ptid);
-   state->skipped_frames = skip_count;
-   state->saved_pc = this_pc;
--  state->skipped_symbol = last_sym;
- 
-   if (skip_count != 0)
-     reinit_frame_cache ();
-@@ -354,6 +359,23 @@ step_into_inline_frame (ptid_t ptid)
-   reinit_frame_cache ();
- }
- 
-+/* Step out of an inlined function by hiding it.  */
-+
-+void
-+step_out_of_inline_frame (ptid_t ptid)
-+{
-+  struct inline_state *state = find_inline_frame_state (ptid);
-+
-+  gdb_assert (state != NULL);
-+
-+  /* Simulate the caller adjustment.  */
-+  if (state->skipped_frames == 0)
-+    state->saved_pc--;
-+
-+  state->skipped_frames++;
-+  reinit_frame_cache ();
-+}
-+
- /* Return the number of hidden functions inlined into the current
-    frame.  */
- 
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-markers.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-markers.c	2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-markers.c	2010-01-21 15:14:47.000000000 +0100
-@@ -15,11 +15,6 @@
- 
- extern int x, y;
- 
--void bar(void)
--{
--  x += y; /* set breakpoint 1 here */
--}
--
- void marker(void)
- {
-   x += y; /* set breakpoint 2 here */
-Index: gdb-7.0.50.20100121/gdb/gdbthread.h
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/gdbthread.h	2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/gdbthread.h	2010-01-21 15:14:47.000000000 +0100
-@@ -195,6 +195,12 @@ struct thread_info
-   /* Function that is called to free PRIVATE.  If this is NULL, then
-      xfree will be called on PRIVATE.  */
-   void (*private_dtor) (struct private_thread_info *);
-+
-+  /* Nonzero if the current frame PC should be unwound as the caller.  It is
-+     used to keep the backtrace upper levels existing after finish_command into
-+     an inlined frame if the current inlined function/block was ending at the
-+     current PC.  */
-+  int current_pc_is_notcurrent;
- };
- 
- /* Create an empty thread list, or empty the existing one.  */
-Index: gdb-7.0.50.20100121/gdb/infcmd.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/infcmd.c	2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/infcmd.c	2010-01-21 15:14:47.000000000 +0100
-@@ -1439,11 +1439,11 @@ finish_command_continuation (void *arg)
-       struct type *value_type;
- 
-       value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function));
--      if (!value_type)
-+      if (!SYMBOL_INLINED (a->function) && !value_type)
- 	internal_error (__FILE__, __LINE__,
- 			_("finish_command: function has no target type"));
- 
--      if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
-+      if (value_type && TYPE_CODE (value_type) != TYPE_CODE_VOID)
- 	print_return_value (SYMBOL_TYPE (a->function), value_type);
-     }
- 
-@@ -1551,6 +1551,16 @@ finish_forward (struct symbol *function,
-   tp->initiating_frame = get_frame_id (frame);
-   make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
- 
-+  /* We should _always_ set CURRENT_PC_IS_NOTCURRENT here to always see the
-+     calling line with the message `Value returned is ...'.  Currently it is
-+     seen only if at least one instruction is on that source line after the
-+     call instruction.  We would also need to hook step_once and only clear
-+     CURRENT_PC_IS_NOTCURRENT on the first step.  But it would be a change of
-+     general non-inlining behavior against upstream.  */
-+
-+  if (get_frame_type (frame) == INLINE_FRAME)
-+    tp->current_pc_is_notcurrent = 1;
-+
-   tp->proceed_to_finish = 1;    /* We want stop_registers, please...  */
-   cargs = xmalloc (sizeof (*cargs));
- 
-@@ -1571,7 +1581,9 @@ finish_forward (struct symbol *function,
- static void
- finish_command (char *arg, int from_tty)
- {
--  struct frame_info *frame;
-+  /* FIXME: Rename `current_frame' to `frame' upon a merge.  */
-+  struct frame_info *current_frame, *prev_frame;
-+  CORE_ADDR frame_pc;
-   struct symbol *function;
- 
-   int async_exec = 0;
-@@ -1602,45 +1614,63 @@ finish_command (char *arg, int from_tty)
-   if (!target_has_execution)
-     error (_("The program is not running."));
- 
--  frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
--  if (frame == 0)
-+  current_frame = get_selected_frame (_("No selected frame."));
-+  frame_pc = get_frame_pc (current_frame);
-+  prev_frame = get_prev_frame (current_frame);
-+  if (prev_frame == 0)
-     error (_("\"finish\" not meaningful in the outermost frame."));
- 
--  clear_proceed_status ();
--
-   /* Finishing from an inline frame is completely different.  We don't
-      try to show the "return value" - no way to locate it.  So we do
-      not need a completion.  */
--  if (get_frame_type (get_selected_frame (_("No selected frame.")))
--      == INLINE_FRAME)
-+  if (get_frame_type (current_frame) == INLINE_FRAME)
-     {
--      /* Claim we are stepping in the calling frame.  An empty step
--	 range means that we will stop once we aren't in a function
--	 called by that frame.  We don't use the magic "1" value for
--	 step_range_end, because then infrun will think this is nexti,
--	 and not step over the rest of this inlined function call.  */
-       struct thread_info *tp = inferior_thread ();
-       struct symtab_and_line empty_sal;
--      init_sal (&empty_sal);
--      set_step_info (frame, empty_sal);
--      tp->step_range_start = tp->step_range_end = get_frame_pc (frame);
--      tp->step_over_calls = STEP_OVER_ALL;
-+      struct block *frame_block;
- 
-       /* Print info on the selected frame, including level number but not
- 	 source.  */
-       if (from_tty)
- 	{
- 	  printf_filtered (_("Run till exit from "));
--	  print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
-+	  print_stack_frame (current_frame, 1, LOCATION);
-+	}
-+
-+      /* Even just a single stepi would get us out of the caller function PC
-+	 range.  */
-+
-+      frame_block = get_frame_block (current_frame, NULL);
-+
-+      /* FRAME_BLOCK must be initialized and also the frame printing above must
-+         be done still with the original CURRENT_PC_IS_NOTCURRENT setting.  */
-+      clear_proceed_status ();
-+
-+      if (frame_block && BLOCK_END (frame_block) == frame_pc)
-+	{
-+	  step_out_of_inline_frame (tp->ptid);
-+	  tp->current_pc_is_notcurrent = 1;
-+	  normal_stop ();
-+	  return;
- 	}
- 
-+      /* Claim we are stepping in the calling frame.  An empty step
-+	 range means that we will stop once we aren't in a function
-+	 called by that frame.  We don't use the magic "1" value for
-+	 step_range_end, because then infrun will think this is nexti,
-+	 and not step over the rest of this inlined function call.  */
-+      init_sal (&empty_sal);
-+      set_step_info (prev_frame, empty_sal);
-+      tp->step_range_start = tp->step_range_end = get_frame_pc (prev_frame);
-+      tp->step_over_calls = STEP_OVER_ALL;
-+
-       proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
-       return;
-     }
- 
-   /* Find the function we will return from.  */
- 
--  function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
-+  function = find_pc_function (frame_pc);
- 
-   /* Print info on the selected frame, including level number but not
-      source.  */
-@@ -1654,10 +1684,14 @@ finish_command (char *arg, int from_tty)
-       print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
-     }
- 
-+  /* Frames printing above must be done still with the original
-+     CURRENT_PC_IS_NOTCURRENT setting.  */
-+  clear_proceed_status ();
-+
-   if (execution_direction == EXEC_REVERSE)
-     finish_backward (function);
-   else
--    finish_forward (function, frame);
-+    finish_forward (function, prev_frame);
- }
- \f
- 
-Index: gdb-7.0.50.20100121/gdb/target.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/target.c	2010-01-21 15:13:26.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/target.c	2010-01-21 15:14:47.000000000 +0100
-@@ -2216,6 +2216,7 @@ target_resume (ptid_t ptid, int step, en
- {
-   struct target_ops *t;
- 
-+  clear_inline_frame_state (ptid);
-   target_dcache_invalidate ();
- 
-   for (t = current_target.beneath; t != NULL; t = t->beneath)
-Index: gdb-7.0.50.20100121/gdb/inline-frame.h
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/inline-frame.h	2010-01-01 08:31:36.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/inline-frame.h	2010-01-21 15:14:47.000000000 +0100
-@@ -43,6 +43,10 @@ void clear_inline_frame_state (ptid_t pt
- 
- void step_into_inline_frame (ptid_t ptid);
- 
-+/* Step out of an inlined function by hiding it.  */
-+
-+void step_out_of_inline_frame (ptid_t ptid);
-+
- /* Return the number of hidden functions inlined into the current
-    frame.  */
- 
-Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/dwarf2read.c	2010-01-21 15:14:41.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/dwarf2read.c	2010-01-21 15:15:09.000000000 +0100
-@@ -4137,6 +4137,7 @@ read_func_scope (struct die_info *die, s
-   struct block *block;
-   unsigned die_children = 0;
-   int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
-+  struct type *type;
- 
-   if (inlined_func)
-     {
-@@ -4178,7 +4179,10 @@ read_func_scope (struct die_info *die, s
-   add_to_cu_func_list (name, lowpc, highpc, cu);
- 
-   new = push_context (0, lowpc);
--  new->name = new_symbol (die, read_type_die (die, cu), cu);
-+  type = read_type_die (die, cu);
-+  gdb_assert (type != NULL);
-+  new->name = new_symbol (die, type, cu);
-+  gdb_assert (TYPE_CODE (SYMBOL_TYPE (new->name)) == TYPE_CODE_FUNC);
- 
-   /* If there is a location expression for DW_AT_frame_base, record
-      it.  */

diff --git a/gdb-6.8-inlining-by-name.patch b/gdb-6.8-inlining-by-name.patch
deleted file mode 100644
index 6096247..0000000
--- a/gdb-6.8-inlining-by-name.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-Implement `b <funcname>' for <funcname> with concete inlined instances by
-a multiple-PC breakpoint.
-
-Index: gdb-6.8.50.20081128/gdb/ada-lang.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/ada-lang.c	2008-11-25 00:21:15.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/ada-lang.c	2008-12-06 21:39:56.000000000 +0100
-@@ -4614,7 +4614,7 @@ remove_irrelevant_renamings (struct ada_
-   if (current_block == NULL)
-     return nsyms;
- 
--  current_function = block_linkage_function (current_block);
-+  current_function = block_function (current_block);
-   if (current_function == NULL)
-     return nsyms;
- 
-@@ -6625,7 +6625,7 @@ ada_find_renaming_symbol (const char *na
- static struct symbol *
- find_old_style_renaming_symbol (const char *name, struct block *block)
- {
--  const struct symbol *function_sym = block_linkage_function (block);
-+  const struct symbol *function_sym = block_function (block);
-   char *rename;
- 
-   if (function_sym != NULL)
-Index: gdb-6.8.50.20081128/gdb/block.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/block.c	2008-12-06 14:06:16.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/block.c	2008-12-06 21:40:29.000000000 +0100
-@@ -75,6 +75,19 @@ block_linkage_function (const struct blo
-   return BLOCK_FUNCTION (bl);
- }
- 
-+/* Return the symbol for the function which contains a specified
-+   lexical block, described by a struct block BL.  Inlined functions
-+   can be returned.  */
-+
-+struct symbol *
-+block_function (const struct block *bl)
-+{
-+  while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
-+    bl = BLOCK_SUPERBLOCK (bl);
-+
-+  return BLOCK_FUNCTION (bl);
-+}
-+
- /* Return one if BL represents an inlined function.  */
- 
- int
-Index: gdb-6.8.50.20081128/gdb/block.h
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/block.h	2008-12-06 14:06:16.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/block.h	2008-12-06 21:39:56.000000000 +0100
-@@ -133,6 +133,7 @@ struct blockvector
- enum { GLOBAL_BLOCK = 0, STATIC_BLOCK = 1, FIRST_LOCAL_BLOCK = 2 };
- 
- extern struct symbol *block_linkage_function (const struct block *);
-+extern struct symbol *block_function (const struct block *bl);
- 
- extern int block_inlined_p (const struct block *block);
- 
-Index: gdb-6.8.50.20081128/gdb/blockframe.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/blockframe.c	2008-12-06 14:06:16.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/blockframe.c	2008-12-06 21:39:56.000000000 +0100
-@@ -143,7 +143,7 @@ find_pc_sect_function (CORE_ADDR pc, str
-   struct block *b = block_for_pc_sect (pc, section);
-   if (b == 0)
-     return 0;
--  return block_linkage_function (b);
-+  return block_function (b);
- }
- 
- /* Return the function containing pc value PC.
-Index: gdb-6.8.50.20081128/gdb/breakpoint.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/breakpoint.c	2008-12-06 14:06:17.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/breakpoint.c	2008-12-06 21:39:56.000000000 +0100
-@@ -5712,7 +5712,7 @@ resolve_sal_pc (struct symtab_and_line *
-       bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab);
-       if (bv != NULL)
- 	{
--	  sym = block_linkage_function (b);
-+	  sym = block_function (b);
- 	  if (sym != NULL)
- 	    {
- 	      fixup_symbol_section (sym, sal->symtab->objfile);
-Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/testsuite/gdb.opt/inline-cmds.exp	2008-12-06 21:37:27.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp	2008-12-06 21:41:37.000000000 +0100
-@@ -45,8 +45,10 @@ if { [skip_inline_frame_tests] } {
- 
- # First, check that the things we expected to be inlined really were,
- # and those that shouldn't be weren't.
--set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
--gdb_breakpoint $srcfile2:$line1
-+# We test also inlining by the function name, otherwise we would use:
-+#   set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
-+#   gdb_breakpoint $srcfile2:$line1
-+gdb_breakpoint "bar"
- set line2 [gdb_get_line_number "set breakpoint 2 here" ${srcfile2}]
- gdb_breakpoint $srcfile2:$line2
- 

diff --git a/gdb-archer-ada.patch b/gdb-archer-ada.patch
new file mode 100644
index 0000000..128112b
--- /dev/null
+++ b/gdb-archer-ada.patch
@@ -0,0 +1,23 @@
+From: Keith Seitz <keiths@redhat.com>
+Message-ID: <4B7F207A.7020102@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;
+ 

diff --git a/gdb-archer-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch
new file mode 100644
index 0000000..41409f0
--- /dev/null
+++ b/gdb-archer-next-over-throw-cxx-exec.patch
@@ -0,0 +1,104 @@
+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"

diff --git a/gdb-archer-pie-0315-breakpoint_address_match.patch b/gdb-archer-pie-0315-breakpoint_address_match.patch
deleted file mode 100644
index 0000597..0000000
--- a/gdb-archer-pie-0315-breakpoint_address_match.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-[ Forward-ported context.  ]
-
-http://sourceware.org/ml/gdb-patches/2009-11/msg00170.html
-Subject: [patch 03/15] PIE: breakpoint_address_match gdbarch_addr_bit  workaround
-
-Hi,
-
-there are already multiple cases of CORE_ADDR being masked by the width of
-gdbarch_addr_bit.  This specific new case was required the PIE support.
-
-Please read the C comment in attached patch.
-
-Checked that CORE_ADDR math operations are present on 6000+ lines of code of
-GDB sources which makes it impossible to do some general fix by replacing all
-	a->addr < b->addr
-by
-	addr_less_than (a->addr, b->addr)
-etc.
-
-Even with this patch I think there are still many bugs left in the operation
-of x86_64 gdb debugging i386 targets.  Do you find the C++ way as a viable
-one?
-
-
-Thanks,
-Jan
-
-    
-gdb/
-    	* breakpoint.c (breakpoint_address_match): New variables addr_bit and
-    	addr_mask, initialize it.  Mask addresses by ADDR_MASK.
-    	* defs.h (CORE_ADDR): Extend the comment.
-
---- a/gdb/breakpoint.c
-+++ b/gdb/breakpoint.c
-@@ -4559,9 +4559,15 @@ static int
- breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1,
- 			  struct address_space *aspace2, CORE_ADDR addr2)
- {
-+  int addr_bit = gdbarch_addr_bit (target_gdbarch);
-+  CORE_ADDR addr_mask = CORE_ADDR_MAX;
-+
-+  if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-+    addr_mask = ((CORE_ADDR) 1 << addr_bit) - 1;
-+
-   return ((gdbarch_has_global_breakpoints (target_gdbarch)
- 	   || aspace1 == aspace2)
--	  && addr1 == addr2);
-+	  && (addr1 & addr_mask) == (addr2 & addr_mask));
- }
- 
- /* Assuming LOC1 and LOC2's types' have meaningful target addresses
---- a/gdb/defs.h
-+++ b/gdb/defs.h
-@@ -98,7 +98,20 @@
- /* A byte from the program being debugged.  */
- typedef bfd_byte gdb_byte;
- 
--/* An address in the program being debugged.  Host byte order.  */
-+/* An address in the program being debugged.  Host byte order.
-+
-+   Its width is the maximum width of all the supported targets.  That means
-+   32-bit target will run on such GDB using 64-bit CORE_ADDR cluttering the
-+   bits 32...63 with random data from internal GDB calculations.  GDB currently
-+   in general truncates the address width only when it is being presented/used
-+   externally (such as by the paddress function).
-+
-+   FIXME: This is still not right as any GDB internal comparisons (such as >=)
-+   of CORE_ADDR do not use the properly truncated width.  As converting all the
-+   CORE_ADDR operations to width-aware functions is not feasible the way out
-+   could be a width-aware C++ class CORE_ADDR referencing gdbarch as its
-+   constructor parameter.  */
-+
- typedef bfd_vma CORE_ADDR;
- 
- /* The largest CORE_ADDR value.  */
-

diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch
index 6575d5d..060b19e 100644
--- a/gdb-archer-pie-addons.patch
+++ b/gdb-archer-pie-addons.patch
@@ -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/dwarf2read.c
  
    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/dwarf2read.c
          }
        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/dwarf2read.c
  	  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/dwarf2read.c
  
        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.h
      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.h
  	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.h
  #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.h
  #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.h
  #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)
      {

diff --git a/gdb-archer-vla-ref-optimizedout.patch b/gdb-archer-vla-ref-optimizedout.patch
new file mode 100644
index 0000000..6b86bda
--- /dev/null
+++ b/gdb-archer-vla-ref-optimizedout.patch
@@ -0,0 +1,105 @@
+commit a683bac73af74a757591672d89d720169c0b5ec9
+Author: Jan Kratochvil <jan.kratochvil@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 \[\]}

diff --git a/gdb-archer-vla-test-oom.patch b/gdb-archer-vla-test-oom.patch
new file mode 100644
index 0000000..dad5ca4
--- /dev/null
+++ b/gdb-archer-vla-test-oom.patch
@@ -0,0 +1,21 @@
+commit ec5a7769d5c05542d12fc21afa25f32360db7de4
+Author: Jan Kratochvil <jan.kratochvil@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]

diff --git a/gdb-archer.patch b/gdb-archer.patch
index 3ec58c3..c9b5c9b 100644
--- a/gdb-archer.patch
+++ b/gdb-archer.patch
@@ -2,17 +2,17 @@ http://sourceware.org/gdb/wiki/ProjectArcher
 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:
        break;
      }
-@@ -9177,6 +9288,7 @@ breakpoint_re_set (void)
+@@ -9189,6 +9300,7 @@ breakpoint_re_set (void)
    create_longjmp_master_breakpoint ("_longjmp");
    create_longjmp_master_breakpoint ("siglongjmp");
    create_longjmp_master_breakpoint ("_siglongjmp");
@@ -950,7 +950,7 @@ index 0d55862..9258c6a 100644
  }
  \f
  /* Reset the thread number of this breakpoint:
-@@ -10172,6 +10284,22 @@ all_tracepoints ()
+@@ -10187,6 +10299,22 @@ all_tracepoints ()
    return tp_vec;
  }
  
@@ -973,7 +973,7 @@ index 0d55862..9258c6a 100644
  \f
  /* This help string is used for the break, hbreak, tbreak and thbreak commands.
     It is defined as a macro to prevent duplication.
-@@ -10716,4 +10844,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
+@@ -10731,4 +10859,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
    automatic_hardware_breakpoints = 1;
  
    observer_attach_about_to_proceed (breakpoint_about_to_proceed);
@@ -1029,10 +1029,49 @@ index 6b373a3..59aa412 100644
  extern struct breakpoint *get_tracepoint (int num);
  
 diff --git a/gdb/c-exp.y b/gdb/c-exp.y
-index 8e00979..b86fc8e 100644
+index 845771c..7a74d7e 100644
 --- a/gdb/c-exp.y
 +++ b/gdb/c-exp.y
-@@ -418,6 +418,24 @@ exp     :       exp '(' nonempty_typelist ')' const_or_volatile
+@@ -186,6 +186,7 @@ static struct stoken operator_stoken (const char *);
+ %token <tsval> STRING
+ %token <tsval> CHAR
+ %token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
++%token <ssym> UNKNOWN_CPP_NAME
+ %token <voidval> COMPLETE
+ %token <tsym> TYPENAME
+ %type <sval> name
+@@ -391,6 +392,30 @@ exp	:	exp '('
+ 			  write_exp_elt_opcode (OP_FUNCALL); }
+ 	;
+ 
++exp	:	UNKNOWN_CPP_NAME '('
++			{
++
++			 /* This could potentially be a an argument defined
++			    lookup function (Koenig).  */
++			  write_exp_elt_opcode (OP_ADL_FUNC);
++			  write_exp_elt_block (expression_context_block);
++			  write_exp_elt_sym (NULL); /* Place holder */
++			  write_exp_string ($1.stoken);
++			  write_exp_elt_opcode (OP_ADL_FUNC);
++
++			/* This is to save the value of arglist_len
++			   being accumulated by an outer function call.  */
++
++			  start_arglist ();
++			}
++		arglist ')'	%prec ARROW
++			{
++			  write_exp_elt_opcode (OP_FUNCALL);
++			  write_exp_elt_longcst ((LONGEST) end_arglist ());
++			  write_exp_elt_opcode (OP_FUNCALL);
++			}
++	;
++
+ lcurly	:	'{'
+ 			{ start_arglist (); }
+ 	;
+@@ -418,6 +443,24 @@ exp     :       exp '(' nonempty_typelist ')' const_or_volatile
  			}
  	;
  
@@ -1057,7 +1096,7 @@ index 8e00979..b86fc8e 100644
  rcurly	:	'}'
  			{ $$ = end_arglist () - 1; }
  	;
-@@ -785,12 +803,13 @@ qualified_name:	typebase COLONCOLON name
+@@ -785,12 +828,13 @@ qualified_name:	typebase COLONCOLON name
  	;
  
  variable:	qualified_name
@@ -1072,10 +1111,19 @@ index 8e00979..b86fc8e 100644
  			  sym =
  			    lookup_symbol (name, (const struct block *) NULL,
  					   VAR_DOMAIN, (int *) NULL);
-@@ -1298,6 +1317,14 @@ name_not_typename :	NAME
+@@ -1286,6 +1330,7 @@ name	:	NAME { $$ = $1.stoken; }
+ 	|	BLOCKNAME { $$ = $1.stoken; }
+ 	|	TYPENAME { $$ = $1.stoken; }
+ 	|	NAME_OR_INT  { $$ = $1.stoken; }
++	|	UNKNOWN_CPP_NAME  { $$ = $1.stoken; }	
+ 	|	operator { $$ = $1; }
+ 	;
+ 
+@@ -1298,6 +1343,15 @@ name_not_typename :	NAME
     context where only a name could occur, this might be useful.
    	|	NAME_OR_INT
   */
++  	|	UNKNOWN_CPP_NAME 
 +	|	operator
 +			{
 +			  $$.stoken = $1;
@@ -1087,7 +1135,7 @@ index 8e00979..b86fc8e 100644
  	;
  
  %%
-@@ -2033,6 +2060,13 @@ static int last_was_structop;
+@@ -2033,6 +2087,13 @@ static int last_was_structop;
  static int
  yylex (void)
  {
@@ -1101,7 +1149,7 @@ index 8e00979..b86fc8e 100644
    int c;
    int namelen;
    unsigned int i;
-@@ -2041,9 +2075,19 @@ yylex (void)
+@@ -2041,9 +2102,19 @@ yylex (void)
    char *copy;
  
    last_was_structop = 0;
@@ -1123,7 +1171,7 @@ index 8e00979..b86fc8e 100644
    /* Check if this is a macro invocation that we need to expand.  */
    if (! scanning_macro_expansion ())
      {
-@@ -2079,10 +2123,19 @@ yylex (void)
+@@ -2079,10 +2150,19 @@ yylex (void)
  	    && parse_language->la_language != language_cplus)
  	  break;
  
@@ -1143,7 +1191,7 @@ index 8e00979..b86fc8e 100644
  	return tokentab2[i].token;
        }
  
-@@ -2111,6 +2164,8 @@ yylex (void)
+@@ -2111,6 +2191,8 @@ yylex (void)
          return 0;
  
      case ' ':
@@ -1152,7 +1200,7 @@ index 8e00979..b86fc8e 100644
      case '\t':
      case '\n':
        lexptr++;
-@@ -2268,11 +2323,13 @@ yylex (void)
+@@ -2268,11 +2350,13 @@ yylex (void)
      error ("Invalid character '%c' in expression.", c);
  
    /* It's a name.  See how long it is.  */
@@ -1166,7 +1214,7 @@ index 8e00979..b86fc8e 100644
        /* Template parameter lists are part of the name.
  	 FIXME: This mishandles `print $a<4&&$a>3'.  */
  
-@@ -2357,14 +2414,29 @@ yylex (void)
+@@ -2357,14 +2441,33 @@ yylex (void)
       currently as names of types; NAME for other symbols.
       The caller is not constrained to care about the distinction.  */
    {
@@ -1177,7 +1225,11 @@ index 8e00979..b86fc8e 100644
  
 -    sym = lookup_symbol (copy, expression_context_block,
 +    if (name_prefix != NULL)
-+      tmp = savestring (name_prefix, name_prefix_len+namelen);
++      {
++	tmp = alloca (name_prefix_len + namelen + 1);
++	memcpy (tmp, name_prefix, name_prefix_len + namelen);
++	tmp[name_prefix_len + namelen] = '\0';
++      }
 +
 +    sym = lookup_symbol (tmp, expression_context_block,
  			 VAR_DOMAIN,
@@ -1197,11 +1249,16 @@ index 8e00979..b86fc8e 100644
      /* Call lookup_symtab, not lookup_partial_symtab, in case there are
         no psymtabs (coff, xcoff, or some future change to blow away the
         psymtabs once once symbols are read).  */
-@@ -2423,6 +2495,7 @@ yylex (void)
+@@ -2423,6 +2526,12 @@ yylex (void)
      yylval.ssym.is_a_field_of_this = is_a_field_of_this;
      if (in_parse_field && *lexptr == '\0')
        saw_name_at_eof = 1;
 +        
++    if (sym == NULL 
++        && parse_language->la_language == language_cplus
++        && !lookup_minimal_symbol (tmp, NULL, NULL))
++      return UNKNOWN_CPP_NAME;
++
      return NAME;
    }
  }
@@ -1218,7 +1275,7 @@ index d620881..34cb34a 100644
    dump_subexp_body_standard,
    evaluate_subexp_c
 diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
-index 27746d9..d4da180 100644
+index ed98381..3061ab7 100644
 --- a/gdb/c-typeprint.c
 +++ b/gdb/c-typeprint.c
 @@ -32,6 +32,7 @@
@@ -1301,12 +1358,13 @@ index 27746d9..d4da180 100644
        printed_any = 1;
      }
  
-@@ -558,7 +584,12 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+@@ -558,7 +584,13 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
  	fprintf_filtered (stream, ")");
  
        fprintf_filtered (stream, "[");
 -      if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
-+      if (TYPE_ARRAY_UPPER_BOUND_IS_DWARF_BLOCK (type))
++      if (TYPE_RANGE_DATA (TYPE_INDEX_TYPE (type))->high.kind
++	  != RANGE_BOUND_KIND_CONSTANT)
 +	{
 +	  /* No _() - printed sources should not be locale dependent.  */
 +	  fprintf_filtered (stream, "variable");
@@ -1315,7 +1373,7 @@ index 27746d9..d4da180 100644
  	&& !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
  	fprintf_filtered (stream, "%d",
  			  (TYPE_LENGTH (type)
-@@ -591,7 +622,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+@@ -591,7 +623,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
        if (passed_a_ptr)
  	fprintf_filtered (stream, ")");
        if (!demangled_args)
@@ -1325,7 +1383,7 @@ index 27746d9..d4da180 100644
  				   passed_a_ptr, 0);
        break;
 diff --git a/gdb/coffread.c b/gdb/coffread.c
-index 8e5dca9..7e7fb8b 100644
+index ba413ad..44676a8 100644
 --- a/gdb/coffread.c
 +++ b/gdb/coffread.c
 @@ -2123,6 +2123,7 @@ static struct sym_fns coff_sym_fns =
@@ -1365,7 +1423,7 @@ index ebde876..907b275 100644
  #undef RELOC_SRCDIR
  
 diff --git a/gdb/configure b/gdb/configure
-index d444b08..d4ced89 100755
+index 1983d04..8dca37e 100755
 --- a/gdb/configure
 +++ b/gdb/configure
 @@ -676,6 +676,8 @@ REPORT_BUGS_TO
@@ -1480,7 +1538,7 @@ index d444b08..d4ced89 100755
  
    # Flags needed to compile Python code (taken from python-config --cflags).
 diff --git a/gdb/configure.ac b/gdb/configure.ac
-index 8da6867..8e39254 100644
+index 6f873b5..77985c8 100644
 --- a/gdb/configure.ac
 +++ b/gdb/configure.ac
 @@ -108,6 +108,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat
@@ -1656,7 +1714,7 @@ index 81f6a5d..097db65 100644
  			{ $$ = $1.comp;
  			  if ($2) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2); }
 diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
-index 8ca9c20..21e013a 100644
+index 5e894d4..6325ead 100644
 --- a/gdb/cp-namespace.c
 +++ b/gdb/cp-namespace.c
 @@ -34,14 +34,17 @@
@@ -1683,8 +1741,8 @@ index 8ca9c20..21e013a 100644
  		 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);
-+	      cp_add_using_directive (dest, src, "", "", 0);
+-	      cp_add_using_directive (dest, src, NULL);
++	      cp_add_using_directive (dest, src, NULL, "", 0);
  	    }
  	  /* The "+ 2" is for the "::".  */
  	  previous_component = next_component + 2;
@@ -1692,39 +1750,41 @@ index 8ca9c20..21e013a 100644
     has already been added, don't add it twice.  */
  
  void
--cp_add_using_directive (const char *dest, const char *src)
-+cp_add_using_directive (const char *dest, const char *src, const char* alias,
+-cp_add_using_directive (const char *dest, const char *src, const char *alias)
++cp_add_using_directive (const char *dest, const char *src, const char *alias,
 +			const char *declaration, const int line_number)
  {
    struct using_direct *current;
    struct using_direct *new;
-@@ -146,7 +150,8 @@ cp_add_using_directive (const char *dest, const char *src)
+@@ -146,7 +150,8 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias)
  	return;
      }
  
--  using_directives = cp_add_using (dest, src, using_directives);
+-  using_directives = cp_add_using (dest, src, alias, using_directives);
 +  using_directives = cp_add_using (dest, src, alias, declaration,
 +				   line_number, using_directives);
  
  }
  
-@@ -199,7 +204,10 @@ cp_is_anonymous (const char *namespace)
+@@ -198,9 +203,11 @@ cp_is_anonymous (const char *namespace)
+ 	  != NULL);
  }
  
- /* Create a new struct using direct which imports the namespace SRC
--   into the scope DEST.
+-/* 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.
++/* 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 an empty string  then the
++   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.  */
-@@ -207,13 +215,19 @@ cp_is_anonymous (const char *namespace)
- struct using_direct *
+@@ -209,19 +216,23 @@ struct using_direct *
  cp_add_using (const char *dest,
                const char *src,
-+              const char *alias,
+               const char *alias,
 +              const char *declaration,
 +              const int line_number,
  	      struct using_direct *next)
@@ -1736,13 +1796,18 @@ index 8ca9c20..21e013a 100644
 -  retval->import_dest = savestring (dest, strlen(dest));
 +  retval->import_src = savestring (src, strlen (src));
 +  retval->import_dest = savestring (dest, strlen (dest));
-+  retval->alias = savestring (alias, strlen (alias));
+ 
+   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;
  
-@@ -230,19 +244,100 @@ cp_add_using (const char *dest,
+@@ -238,19 +249,100 @@ cp_add_using (const char *dest,
  
  struct symbol *
  cp_lookup_symbol_nonlocal (const char *name,
@@ -1848,7 +1913,7 @@ index 8ca9c20..21e013a 100644
  }
  
  /* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in
-@@ -250,25 +345,24 @@ cp_lookup_symbol_nonlocal (const char *name,
+@@ -258,25 +350,24 @@ cp_lookup_symbol_nonlocal (const char *name,
  
  static struct symbol *
  cp_lookup_symbol_in_namespace (const char *namespace,
@@ -1883,7 +1948,7 @@ index 8ca9c20..21e013a 100644
      }
  }
  
-@@ -283,9 +377,17 @@ reset_directive_searched (void *data)
+@@ -291,9 +382,17 @@ reset_directive_searched (void *data)
  }
  
  /* Search for NAME by applying all import statements belonging
@@ -1903,7 +1968,7 @@ index 8ca9c20..21e013a 100644
     Example:
  
       namespace A{
-@@ -299,26 +401,33 @@ reset_directive_searched (void *data)
+@@ -307,26 +406,33 @@ reset_directive_searched (void *data)
     and Y will be considered. If SEARCH_PARENTS is false only the import of Y
     is considered.  */
  
@@ -1946,27 +2011,25 @@ index 8ca9c20..21e013a 100644
    /* Go through the using directives.  If any of them add new
       names to the namespace we're searching in, see if we can find a
       match by applying them.  */
-@@ -327,123 +436,78 @@ cp_lookup_symbol_imports (const char *scope,
+@@ -335,7 +441,10 @@ cp_lookup_symbol_imports (const char *scope,
         current != NULL;
         current = current->next)
      {
 -      len = strlen (current->import_dest);
--      directive_match = (search_parents
--                         ? (strncmp (scope, current->import_dest,
--                                     strlen (current->import_dest)) == 0
--                            && (len == 0
--                                || scope[len] == ':' || scope[len] == '\0'))
--                         : strcmp (scope, current->import_dest) == 0);
--
 +  
-       /* If the import destination is the current scope or one of its ancestors then
-          it is applicable.  */
++      /* If the import destination is the current scope or one of its ancestors then
++         it is applicable.  */
++      int len = strlen (current->import_dest);
+       directive_match = (search_parents
+                          ? (strncmp (scope, current->import_dest,
+                                      strlen (current->import_dest)) == 0
+@@ -343,130 +452,70 @@ cp_lookup_symbol_imports (const char *scope,
+                                 || scope[len] == ':' || scope[len] == '\0'))
+                          : strcmp (scope, current->import_dest) == 0);
+ 
+-      /* If the import destination is the current scope or one of its ancestors then
+-         it is applicable.  */
 -      if (directive_match && !current->searched)
-+      directive_match = search_parents ?
-+                        strncmp (scope, current->import_dest,
-+                                 strlen(current->import_dest)) == 0 :
-+                        strcmp (scope, current->import_dest) == 0;
-+
 +      if (directive_match &&
 +          current->line_number < current_line &&
 +          !current->searched)
@@ -1976,13 +2039,65 @@ index 8ca9c20..21e013a 100644
 -	current->searched = 1;
 -	searched_cleanup = make_cleanup (reset_directive_searched, current);
 -
--	sym = cp_lookup_symbol_namespace (current->import_src,
--	                                  name,
--	                                  linkage_name,
--	                                  block,
--	                                  domain,
--	                                  0);
--
+-	if (current->alias != NULL && strcmp (name, current->alias) == 0)
+-	  /* If the import is creating an alias and the alias matches the
+-	     sought name.  Pass current->import_src as the NAME to direct the
+-	     search towards the aliased namespace.  */
+-	  {
++	  current->searched = 1;
++	  searched_cleanup = make_cleanup (reset_directive_searched, current);
++
++	  /* If there is an import of a single declaration, compare the imported
++	     declaration with the sought out name. If there is a match pass
++	     current->import_src as NAMESPACE to direct the search towards the
++	     imported namespace.  */
++	  if (strcmp ("", current->declaration) != 0)
++	    {
++	    if (strcmp (name, current->declaration) == 0)
++	      {
++	      sym = cp_lookup_symbol_in_namespace (current->import_src,
++	                                           name,
++	                                           block,
++	                                           domain);
++	      }
++
++	    current->searched = 0;
++	    if (sym)
++	      return sym;
++
++	    continue;
++	    }
++	   
++	  if (declaration_only)
++	    {
++	    current->searched = 0;
++	    discard_cleanups (searched_cleanup);
++	    continue;
++	    }
++
++	  if (current->alias != NULL && strcmp (name, current->alias) == 0)
++	    /* If the import is creating an alias and the alias matches the
++	       sought name. Pass current->inner as the NAME to direct the
++	       search towards the aliased namespace */
++	    {
+ 	    sym = cp_lookup_symbol_in_namespace (scope,
+ 	                                         current->import_src,
+-	                                         linkage_name,
+ 	                                         block,
+ 	                                         domain);
+-	  }
+-	else if (current->alias == NULL)
+-	  {
++	    } else if (current->alias == NULL){
+ 	    /* If this import statement creates no alias, pass current->inner as
+-               NAMESPACE to direct the search towards the imported namespace.  */
+-	    sym = cp_lookup_symbol_imports (current->import_src,
+-	                                    name,
+-	                                    linkage_name,
+-	                                    block,
+-	                                    domain,
+-	                                    0);
+-	  }
 -	current->searched = 0;
 -	discard_cleanups (searched_cleanup);
 -
@@ -2047,51 +2162,10 @@ index 8ca9c20..21e013a 100644
 -			int scope_len)
 -{
 -  char *namespace;
-+	  current->searched = 1;
-+	  searched_cleanup = make_cleanup (reset_directive_searched, current);
-+
-+	  /* If there is an import of a single declaration, compare the imported
-+	     declaration with the sought out name. If there is a match pass
-+	     current->import_src as NAMESPACE to direct the search towards the
-+	     imported namespace.  */
-+	  if (strcmp ("", current->declaration) != 0)
-+	    {
-+	    if (strcmp (name, current->declaration) == 0)
-+	      {
-+	      sym = cp_lookup_symbol_in_namespace (current->import_src,
-+	                                           name,
-+	                                           block,
-+	                                           domain);
-+	      }
-+
-+	    current->searched = 0;
-+	    if (sym)
-+	      return sym;
-+
-+	    continue;
-+	    }
-+	   
-+	  if (declaration_only)
-+	    {
-+	    current->searched = 0;
-+	    discard_cleanups (searched_cleanup);
-+	    continue;
-+	    }
- 
+-
 -  if (scope[scope_len] != '\0')
 -    {
 -      /* Recursively search for names in child namespaces first.  */
-+	  if (strcmp (name, current->alias) == 0)
-+	    /* If the import is creating an alias and the alias matches the
-+	       sought name. Pass current->inner as the NAME to direct the
-+	       search towards the aliased namespace */
-+	    {
-+	    sym = cp_lookup_symbol_in_namespace (scope,
-+	                                         current->import_src,
-+	                                         block,
-+	                                         domain);
-+	    } else if (strcmp ("", current->alias) == 0){
-+	    /* If this import statement creates no alias, pass current->inner as
 +	       NAMESPACE to direct the search towards the imported namespace. */
 +	      sym = cp_lookup_symbol_imports (current->import_src,
 +	                                      name,
@@ -2133,7 +2207,7 @@ index 8ca9c20..21e013a 100644
  }
  
  /* Look up NAME in BLOCK's static block and in global blocks.  If
-@@ -453,17 +517,15 @@ lookup_namespace_scope (const char *name,
+@@ -476,17 +525,15 @@ lookup_namespace_scope (const char *name,
  
  static struct symbol *
  lookup_symbol_file (const char *name,
@@ -2152,7 +2226,7 @@ index 8ca9c20..21e013a 100644
    if (anonymous_namespace)
      {
        /* Symbols defined in anonymous namespaces have external linkage
-@@ -473,12 +535,11 @@ lookup_symbol_file (const char *name,
+@@ -496,12 +543,11 @@ lookup_symbol_file (const char *name,
        const struct block *global_block = block_global_block (block);
        
        if (global_block != NULL)
@@ -2167,7 +2241,7 @@ index 8ca9c20..21e013a 100644
      }
  
    if (sym != NULL)
-@@ -499,6 +560,7 @@ lookup_symbol_file (const char *name,
+@@ -522,6 +568,7 @@ lookup_symbol_file (const char *name,
        sym = lookup_possible_namespace_symbol (name);
        if (sym != NULL)
  	return sym;
@@ -2175,7 +2249,7 @@ index 8ca9c20..21e013a 100644
      }
  
    return NULL;
-@@ -527,10 +589,9 @@ cp_lookup_nested_type (struct type *parent_type,
+@@ -550,10 +597,9 @@ cp_lookup_nested_type (struct type *parent_type,
  
  	const char *parent_name = TYPE_TAG_NAME (parent_type);
  	struct symbol *sym = cp_lookup_symbol_in_namespace (parent_name,
@@ -2189,7 +2263,7 @@ index 8ca9c20..21e013a 100644
  	if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
  	  return NULL;
  	else
-@@ -774,7 +835,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
+@@ -797,7 +843,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
  
    memcpy (name_copy, name, len);
    name_copy[len] = '\0';
@@ -2198,7 +2272,7 @@ index 8ca9c20..21e013a 100644
  
    if (sym == NULL)
      {
-@@ -815,7 +876,7 @@ lookup_possible_namespace_symbol (const char *name)
+@@ -838,7 +884,7 @@ lookup_possible_namespace_symbol (const char *name)
        struct symbol *sym;
  
        sym = lookup_block_symbol (get_possible_namespace_block (objfile),
@@ -2208,9 +2282,18 @@ index 8ca9c20..21e013a 100644
        if (sym != NULL)
  	return sym;
 diff --git a/gdb/cp-support.c b/gdb/cp-support.c
-index c31fcff..fc294ae 100644
+index c31fcff..8c5d56f 100644
 --- a/gdb/cp-support.c
 +++ b/gdb/cp-support.c
+@@ -50,7 +50,7 @@ static void demangled_name_complaint (const char *name);
+ 
+ /* Functions/variables related to overload resolution.  */
+ 
+-static int sym_return_val_size;
++static int sym_return_val_size = -1;
+ static int sym_return_val_index;
+ static struct symbol **sym_return_val;
+ 
 @@ -190,7 +190,8 @@ mangled_name_to_comp (const char *mangled_name, int options,
    return ret;
  }
@@ -2221,7 +2304,112 @@ index c31fcff..fc294ae 100644
  
  char *
  cp_class_name_from_physname (const char *physname)
-@@ -840,9 +841,9 @@ read_in_psymtabs (const char *func_name)
+@@ -711,6 +712,82 @@ make_symbol_overload_list (const char *func_name,
+ 
+   return sym_return_val;
+ }
++/* Adds the function FUNC_NAME from NAMESPACE to the overload set.  */
++
++static void
++make_symbol_overload_list_namespace (const char *func_name,
++                                     const char *namespace)
++{
++
++  if (namespace[0] == '\0')
++    {
++      make_symbol_overload_list_qualified (func_name);
++    }
++  else
++    {
++      char *concatenated_name
++	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
++      strcpy (concatenated_name, namespace);
++      strcat (concatenated_name, "::");
++      strcat (concatenated_name, func_name);
++      make_symbol_overload_list_qualified (concatenated_name);
++    }
++}
++
++/* Search the namespace of the given type and namespace of and public base
++ types.  */
++static void make_symbol_overload_list_adl_namespace (struct type *type,
++						     const char *func_name)
++{
++  char *namespace;
++  char *type_name;
++  int i, prefix_len;
++
++  if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF
++      || TYPE_CODE (type) == TYPE_CODE_ARRAY)
++    return make_symbol_overload_list_adl_namespace (TYPE_TARGET_TYPE (type),
++                                                    func_name);
++
++  type_name = TYPE_NAME (type);
++
++  prefix_len = cp_entire_prefix_len (type_name);
++
++  if (prefix_len != 0)
++    {
++      namespace = alloca (prefix_len + 1);
++      strncpy (namespace, type_name, prefix_len);
++      namespace[prefix_len] = '\0';
++
++      make_symbol_overload_list_namespace (func_name, namespace);
++    }
++
++  /* Check public base type */
++  if (TYPE_CODE(type) == TYPE_CODE_CLASS)
++    for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
++      {
++	if (BASETYPE_VIA_PUBLIC (type, i))
++	  make_symbol_overload_list_adl_namespace (TYPE_BASECLASS (type, i),
++						   func_name);
++      }
++
++}
++
++/* Adds the the overload list overload candidates for FUNC_NAME found through
++   argument dependent lookup.  */
++
++struct symbol **
++make_symbol_overload_list_adl (struct type **arg_types, int nargs,
++                               const char *func_name)
++{
++  int i;
++
++  gdb_assert (sym_return_val_size != -1);
++
++  for (i = 1; i <= nargs; i++)
++    make_symbol_overload_list_adl_namespace (arg_types[i - 1], func_name);
++
++  return sym_return_val;
++}
+ 
+ /* This applies the using directives to add namespaces to search in,
+    and then searches for overloads in all of those namespaces.  It
+@@ -739,20 +816,7 @@ make_symbol_overload_list_using (const char *func_name,
+     }
+ 
+   /* Now, add names for this namespace.  */
+-  
+-  if (namespace[0] == '\0')
+-    {
+-      make_symbol_overload_list_qualified (func_name);
+-    }
+-  else
+-    {
+-      char *concatenated_name
+-	= alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
+-      strcpy (concatenated_name, namespace);
+-      strcat (concatenated_name, "::");
+-      strcat (concatenated_name, func_name);
+-      make_symbol_overload_list_qualified (concatenated_name);
+-    }
++  make_symbol_overload_list_namespace (func_name, namespace);
+ }
+ 
+ /* This does the bulk of the work of finding overloaded symbols.
+@@ -840,9 +904,9 @@ read_in_psymtabs (const char *func_name)
      if (ps->readin)
        continue;
  
@@ -2234,43 +2422,41 @@ index c31fcff..fc294ae 100644
        psymtab_to_symtab (ps);
    }
 diff --git a/gdb/cp-support.h b/gdb/cp-support.h
-index 33b1b44..50f8fe9 100644
+index a6a9af1..57aa5e5 100644
 --- a/gdb/cp-support.h
 +++ b/gdb/cp-support.h
-@@ -38,14 +38,29 @@ struct demangle_component;
+@@ -38,20 +38,24 @@ struct demangle_component;
  
  /* This struct is designed to store data from using directives.  It
     says that names from namespace IMPORT_SRC should be visible within
--   namespace IMPORT_DEST. IMPORT_DEST should always be a strict initial
--   substring of IMPORT_SRC. These form a linked list; NEXT is the next element
--   of the list.  */
-+   namespace IMPORT_DEST.  IMPORT_DEST should always be a strict initial
-+   substring of IMPORT_SRC.  These form a linked list; NEXT is the next
+-   namespace IMPORT_DEST.  These form a linked list; NEXT is the next element
+-   of the list.  If the imported namespace has been aliased, ALIAS is set to a
+-   string representing the alias.  Otherwise, ALIAS is NULL.
+-   Eg:
+-       namespace C = A::B;
++   namespace IMPORT_DEST.  These form a linked list; NEXT is the next
 +   element of the list.  ALIAS is set to a non empty string if the imported
 +   namespace has been aliased.Eg:
 +       namespace C=A::B;
-+   ALIAS = "C"
+    ALIAS = "C"
 +   DECLARATION is the name of the imported declaration, if this import 
 +   statement represents one. Eg:
 +       using A::x;
 +   Where x is variable in namespace A. declaration is set to x.  
-+*/
+ */
  
  struct using_direct
  {
    char *import_src;
    char *import_dest;
-+
-+  char *alias;
-+
+-
+   char *alias;
 +  char *declaration;
-+
 +  int line_number;
-+
+ 
    struct using_direct *next;
  
-   /* Used during import search to temporarily mark this node as searched.  */
-@@ -57,6 +72,7 @@ struct using_direct
+@@ -64,6 +68,7 @@ struct using_direct
  
  extern char *cp_canonicalize_string (const char *string);
  
@@ -2278,25 +2464,35 @@ index 33b1b44..50f8fe9 100644
  extern char *cp_class_name_from_physname (const char *physname);
  
  extern char *method_name_from_physname (const char *physname);
-@@ -82,10 +98,16 @@ extern int cp_validate_operator (const char *input);
- extern int cp_is_anonymous (const char *namespace);
+@@ -79,6 +84,10 @@ extern char *cp_remove_params (const char *demangled_name);
+ extern struct symbol **make_symbol_overload_list (const char *,
+ 						  const char *);
+ 
++extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types,
++                                                      int nargs,
++                                                      const char *func_name);
++
+ extern struct type *cp_lookup_rtti_type (const char *name,
+ 					 struct block *block);
+ 
+@@ -90,11 +99,15 @@ extern int cp_is_anonymous (const char *namespace);
  
  extern void cp_add_using_directive (const char *dest,
--                                    const char *src);
-+                                    const char *src,
+                                     const char *src,
+-                                    const char *alias);
 +                                    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 *alias,
 +                                          const char *declaration,
 +                                          const int line_number,
  					  struct using_direct *next);
  
  extern void cp_initialize_namespace (void);
-@@ -102,16 +124,20 @@ extern void cp_set_block_scope (const struct symbol *symbol,
+@@ -111,16 +124,20 @@ extern void cp_set_block_scope (const struct symbol *symbol,
  extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol);
  
  extern struct symbol *cp_lookup_symbol_nonlocal (const char *name,
@@ -2324,7 +2520,7 @@ index 33b1b44..50f8fe9 100644
  extern struct type *cp_lookup_nested_type (struct type *parent_type,
  					   const char *nested_name,
 diff --git a/gdb/dbxread.c b/gdb/dbxread.c
-index 6ef6767..5f4825c 100644
+index c9a5754..fc33da2 100644
 --- a/gdb/dbxread.c
 +++ b/gdb/dbxread.c
 @@ -3565,6 +3565,7 @@ static struct sym_fns aout_sym_fns =
@@ -2336,7 +2532,7 @@ index 6ef6767..5f4825c 100644
    default_symfile_offsets, /* sym_offsets: parse user's offsets to
  			      internal form */
 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
-index 2145f2b..84cadd4 100644
+index 0e3e093..661ba18 100644
 --- a/gdb/doc/gdb.texinfo
 +++ b/gdb/doc/gdb.texinfo
 @@ -1157,6 +1157,16 @@ for remote debugging.
@@ -2356,7 +2552,7 @@ index 2145f2b..84cadd4 100644
  @c resolve the situation of these eventually
  @item -tui
  @cindex @code{--tui}
-@@ -19206,7 +19216,7 @@ using the @code{script-extension} setting.
+@@ -19215,7 +19225,7 @@ using the @code{script-extension} setting.
  @table @code
  @kindex source
  @cindex execute commands from a file
@@ -2365,7 +2561,7 @@ index 2145f2b..84cadd4 100644
  Execute the command file @var{filename}.
  @end table
  
-@@ -19484,8 +19494,6 @@ containing @code{end}.  For example:
+@@ -19493,8 +19503,6 @@ containing @code{end}.  For example:
  
  @smallexample
  (@value{GDBP}) python
@@ -2374,7 +2570,7 @@ index 2145f2b..84cadd4 100644
  >print 23
  >end
  23
-@@ -19498,6 +19506,14 @@ in a Python script.  This can be controlled using @code{maint set
+@@ -19507,6 +19515,14 @@ in a Python script.  This can be controlled using @code{maint set
  python print-stack}: if @code{on}, the default, then Python stack
  printing is enabled; if @code{off}, then Python stack printing is
  disabled.
@@ -2389,7 +2585,7 @@ index 2145f2b..84cadd4 100644
  @end table
  
  It is also possible to execute a Python script from the @value{GDBN}
-@@ -19519,6 +19535,14 @@ and thus is always available.
+@@ -19528,6 +19544,14 @@ and thus is always available.
  @cindex python api
  @cindex programming in python
  
@@ -2404,7 +2600,7 @@ index 2145f2b..84cadd4 100644
  @cindex python stdout
  @cindex python pagination
  At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
-@@ -19531,13 +19555,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
+@@ -19540,13 +19564,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
  * Basic Python::                Basic Python Functions.
  * Exception Handling::
  * Auto-loading::                Automatically loading Python code.
@@ -2423,7 +2619,7 @@ index 2145f2b..84cadd4 100644
  * Frames In Python::            Acessing inferior stack frames from Python.
  * Lazy Strings In Python::      Python representation of lazy strings.
  @end menu
-@@ -19565,6 +19593,12 @@ command as having originated from the user invoking it interactively.
+@@ -19574,6 +19602,12 @@ command as having originated from the user invoking it interactively.
  It must be a boolean value.  If omitted, it defaults to @code{False}.
  @end defun
  
@@ -2436,7 +2632,7 @@ index 2145f2b..84cadd4 100644
  @findex gdb.parameter
  @defun parameter parameter
  Return the value of a @value{GDBN} parameter.  @var{parameter} is a
-@@ -19581,6 +19615,7 @@ a Python value of the appropriate type, and returned.
+@@ -19590,6 +19624,7 @@ a Python value of the appropriate type, and returned.
  @defun history number
  Return a value from @value{GDBN}'s value history (@pxref{Value
  History}).  @var{number} indicates which history element to return.
@@ -2444,7 +2640,7 @@ index 2145f2b..84cadd4 100644
  If @var{number} is negative, then @value{GDBN} will take its absolute value
  and count backward from the last element (i.e., the most recent element) to
  find the value to return.  If @var{number} is zero, then @value{GDBN} will
-@@ -19605,6 +19640,21 @@ compute values, for example, it is the only way to get the value of a
+@@ -19614,6 +19649,21 @@ compute values, for example, it is the only way to get the value of a
  convenience variable (@pxref{Convenience Vars}) as a @code{gdb.Value}.
  @end defun
  
@@ -2466,7 +2662,7 @@ index 2145f2b..84cadd4 100644
  @findex gdb.write
  @defun write string
  Print a string to @value{GDBN}'s paginated standard output stream.
-@@ -19619,6 +19669,11 @@ Flush @value{GDBN}'s paginated standard output stream.  Flushing
+@@ -19628,6 +19678,11 @@ Flush @value{GDBN}'s paginated standard output stream.  Flushing
  function.
  @end defun
  
@@ -2478,7 +2674,7 @@ index 2145f2b..84cadd4 100644
  @node Exception Handling
  @subsubsection Exception Handling
  @cindex python exceptions
-@@ -19857,6 +19912,9 @@ module:
+@@ -19866,6 +19921,9 @@ module:
  This function looks up a type by name.  @var{name} is the name of the
  type to look up.  It must be a string.
  
@@ -2488,7 +2684,7 @@ index 2145f2b..84cadd4 100644
  Ordinarily, this function will return an instance of @code{gdb.Type}.
  If the named type cannot be found, it will throw an exception.
  @end defun
-@@ -19979,7 +20037,7 @@ If the type does not have a target, this method will throw an
+@@ -19988,7 +20046,7 @@ If the type does not have a target, this method will throw an
  exception.
  @end defmethod
  
@@ -2497,7 +2693,7 @@ index 2145f2b..84cadd4 100644
  If this @code{gdb.Type} is an instantiation of a template, this will
  return a new @code{gdb.Type} which represents the type of the
  @var{n}th template argument.
-@@ -19987,7 +20045,8 @@ return a new @code{gdb.Type} which represents the type of the
+@@ -19996,7 +20054,8 @@ return a new @code{gdb.Type} which represents the type of the
  If this @code{gdb.Type} is not a template type, this will throw an
  exception.  Ordinarily, only C@t{++} code will have template types.
  
@@ -2507,7 +2703,7 @@ index 2145f2b..84cadd4 100644
  @end defmethod
  @end table
  
-@@ -20341,6 +20400,121 @@ import gdb.libstdcxx.v6
+@@ -20350,6 +20409,121 @@ import gdb.libstdcxx.v6
  gdb.libstdcxx.v6.register_printers (gdb.current_objfile ())
  @end smallexample
  
@@ -2629,7 +2825,7 @@ index 2145f2b..84cadd4 100644
  @node Commands In Python
  @subsubsection Commands In Python
  
-@@ -20593,6 +20767,135 @@ registration of the command with @value{GDBN}.  Depending on how the
+@@ -20602,6 +20776,135 @@ registration of the command with @value{GDBN}.  Depending on how the
  Python code is read into @value{GDBN}, you may need to import the
  @code{gdb} module explicitly.
  
@@ -2765,7 +2961,7 @@ index 2145f2b..84cadd4 100644
  @node Functions In Python
  @subsubsection Writing new convenience functions
  
-@@ -20697,6 +21000,82 @@ which is used to format the value.  @xref{Pretty Printing}, for more
+@@ -20706,6 +21009,82 @@ which is used to format the value.  @xref{Pretty Printing}, for more
  information.
  @end defivar
  
@@ -2848,7 +3044,7 @@ index 2145f2b..84cadd4 100644
  @node Frames In Python
  @subsubsection Acessing inferior stack frames from Python.
  
-@@ -20761,6 +21140,14 @@ function to a string.
+@@ -20770,6 +21149,14 @@ function to a string.
  Returns the frame's resume address.
  @end defmethod
  
@@ -2863,7 +3059,7 @@ index 2145f2b..84cadd4 100644
  @defmethod Frame older
  Return the frame that called this frame.
  @end defmethod
-@@ -20769,10 +21156,18 @@ Return the frame that called this frame.
+@@ -20778,10 +21165,18 @@ Return the frame that called this frame.
  Return the frame called by this frame.
  @end defmethod
  
@@ -2883,7 +3079,7 @@ index 2145f2b..84cadd4 100644
  
  @node Lazy Strings In Python
 diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
-index 347c860..5d7002e 100644
+index 7741855..df3fc87 100644
 --- a/gdb/doc/gdbint.texinfo
 +++ b/gdb/doc/gdbint.texinfo
 @@ -2107,6 +2107,18 @@ time, and so we attempt to handle symbols incrementally.  For instance,
@@ -3089,10 +3285,23 @@ index 437ca39..f7fce92 100644
    /* The current depth of dwarf expression recursion, via DW_OP_call*,
       DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum
 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
-index 6679d74..54d2bae 100644
+index 1c4d057..20dcacd 100644
 --- a/gdb/dwarf2loc.c
 +++ b/gdb/dwarf2loc.c
-@@ -121,6 +121,9 @@ struct dwarf_expr_baton
+@@ -46,6 +46,12 @@ static void
+ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
+ 			 gdb_byte **start, size_t *length);
+ 
++static struct value *dwarf2_evaluate_loc_desc (struct type *type,
++					       struct frame_info *frame,
++					       gdb_byte *data,
++					       unsigned short size,
++					     struct dwarf2_per_cu_data *per_cu);
++
+ /* A helper function for dealing with location lists.  Given a
+    symbol baton (BATON) and a pc value (PC), find the appropriate
+    location expression, set *LOCEXPR_LENGTH, and return a pointer
+@@ -121,6 +127,9 @@ struct dwarf_expr_baton
  {
    struct frame_info *frame;
    struct objfile *objfile;
@@ -3102,7 +3311,7 @@ index 6679d74..54d2bae 100644
  };
  
  /* Helper functions for dwarf2_evaluate_loc_desc.  */
-@@ -189,22 +192,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
+@@ -189,22 +198,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
        symbaton = SYMBOL_LOCATION_BATON (framefunc);
        *start = find_location_expression (symbaton, length, pc);
      }
@@ -3145,7 +3354,7 @@ index 6679d74..54d2bae 100644
  }
  
  /* Helper function for dwarf2_evaluate_loc_desc.  Computes the CFA for
-@@ -227,6 +241,129 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
+@@ -227,6 +247,155 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
    return target_translate_tls_address (debaton->objfile, offset);
  }
  
@@ -3272,10 +3481,42 @@ index 6679d74..54d2bae 100644
 +  return retval;
 +}
 +
++/* Evaluate DWARF location list at DLLBATON expecting it produces exactly one
++   CORE_ADDR result stored to *ADDRP on the DWARF stack stack.  If the result
++   could not be found return zero and keep *ADDRP unchanged.  */
++
++int
++dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton,
++			  struct type *type, CORE_ADDR *addrp)
++{
++  struct frame_info *frame = get_selected_frame (NULL);
++  gdb_byte *data;
++  size_t size;
++  struct value *val;
++
++  data = find_location_expression (dllbaton, &size,
++				   get_frame_address_in_block (frame));
++  if (data == NULL)
++    return 0;
++
++  val = dwarf2_evaluate_loc_desc (type, frame, data, size, dllbaton->per_cu);
++  if (value_optimized_out (val))
++    return 0;
++
++  *addrp = value_as_address (val);
++  return 1;
++}
++
  struct piece_closure
  {
    /* The number of pieces used to describe this variable.  */
-@@ -408,9 +545,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+@@ -401,48 +570,31 @@ static struct lval_funcs pieced_value_funcs = {
+    SIZE, to find the current location of variable VAR in the context
+    of FRAME.  */
+ static struct value *
+-dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
++dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
+ 			  gdb_byte *data, unsigned short size,
  			  struct dwarf2_per_cu_data *per_cu)
  {
    struct value *retval;
@@ -3286,7 +3527,10 @@ index 6679d74..54d2bae 100644
  
    if (size == 0)
      {
-@@ -420,22 +556,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+-      retval = allocate_value (SYMBOL_TYPE (var));
++      retval = allocate_value (type);
+       VALUE_LVAL (retval) = not_lval;
+       set_value_optimized_out (retval, 1);
        return retval;
      }
  
@@ -3310,19 +3554,88 @@ index 6679d74..54d2bae 100644
    if (ctx->num_pieces > 0)
      {
        struct piece_closure *c;
-@@ -465,6 +587,11 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+       struct frame_id frame_id = get_frame_id (frame);
+ 
+       c = allocate_piece_closure (ctx->num_pieces, ctx->pieces, ctx->gdbarch);
+-      retval = allocate_computed_value (SYMBOL_TYPE (var),
+-					&pieced_value_funcs,
+-					c);
++      retval = allocate_computed_value (type, &pieced_value_funcs, c);
+       VALUE_FRAME_ID (retval) = frame_id;
+     }
+   else
+@@ -454,7 +606,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+ 	    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 (SYMBOL_TYPE (var), gdb_regnum, frame);
++	    retval = value_from_register (type, gdb_regnum, frame);
+ 	  }
+ 	  break;
+ 
+@@ -463,7 +615,12 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
  	    CORE_ADDR address = dwarf_expr_fetch (ctx, 0);
  	    int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
  
+-	    retval = allocate_value (SYMBOL_TYPE (var));
 +	    /* object_address_set called here is required in ALLOCATE_VALUE's
 +	       CHECK_TYPEDEF for the object's possible
 +	       DW_OP_push_object_address.  */
 +	    object_address_set (address);
 +
- 	    retval = allocate_value (SYMBOL_TYPE (var));
++	    retval = allocate_value (type);
  	    VALUE_LVAL (retval) = lval_memory;
  	    set_value_lazy (retval, 1);
-@@ -872,7 +999,7 @@ static int
+ 	    if (in_stack_memory)
+@@ -478,10 +635,10 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+ 	    bfd_byte *contents;
+ 	    size_t n = ctx->addr_size;
+ 
+-	    retval = allocate_value (SYMBOL_TYPE (var));
++	    retval = allocate_value (type);
+ 	    contents = value_contents_raw (retval);
+-	    if (n > TYPE_LENGTH (SYMBOL_TYPE (var)))
+-	      n = TYPE_LENGTH (SYMBOL_TYPE (var));
++	    if (n > TYPE_LENGTH (type))
++	      n = TYPE_LENGTH (type);
+ 	    store_unsigned_integer (contents, n,
+ 				    gdbarch_byte_order (ctx->gdbarch),
+ 				    value);
+@@ -493,10 +650,10 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+ 	    bfd_byte *contents;
+ 	    size_t n = ctx->len;
+ 
+-	    retval = allocate_value (SYMBOL_TYPE (var));
++	    retval = allocate_value (type);
+ 	    contents = value_contents_raw (retval);
+-	    if (n > TYPE_LENGTH (SYMBOL_TYPE (var)))
+-	      n = TYPE_LENGTH (SYMBOL_TYPE (var));
++	    if (n > TYPE_LENGTH (type))
++	      n = TYPE_LENGTH (type);
+ 	    memcpy (contents, ctx->data, n);
+ 	  }
+ 	  break;
+@@ -720,8 +877,8 @@ locexpr_read_variable (struct symbol *symbol, struct frame_info *frame)
+ {
+   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+   struct value *val;
+-  val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size,
+-				  dlbaton->per_cu);
++  val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
++				  dlbaton->size, dlbaton->per_cu);
+ 
+   return val;
+ }
+@@ -844,7 +1001,7 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame)
+       set_value_optimized_out (val, 1);
+     }
+   else
+-    val = dwarf2_evaluate_loc_desc (symbol, frame, data, size,
++    val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
+ 				    dlbaton->per_cu);
+ 
+   return val;
+@@ -868,7 +1025,7 @@ static int
  loclist_describe_location (struct symbol *symbol, struct ui_file *stream)
  {
    /* FIXME: Could print the entire list of locations.  */
@@ -3331,7 +3644,7 @@ index 6679d74..54d2bae 100644
    return 1;
  }
  
-@@ -888,16 +1015,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
+@@ -884,16 +1041,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
  
    data = find_location_expression (dlbaton, &size, ax->scope);
    if (data == NULL)
@@ -3392,10 +3705,10 @@ index 6679d74..54d2bae 100644
 +  missing_tracepoint_var_ref
 +};
 diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
-index fa0bd11..fdea2b4 100644
+index fa0bd11..3535c1f 100644
 --- a/gdb/dwarf2loc.h
 +++ b/gdb/dwarf2loc.h
-@@ -72,5 +72,11 @@ struct dwarf2_loclist_baton
+@@ -72,5 +72,14 @@ struct dwarf2_loclist_baton
  
  extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
  extern const struct symbol_computed_ops dwarf2_loclist_funcs;
@@ -3405,13 +3718,16 @@ index fa0bd11..fdea2b4 100644
 +
 +extern CORE_ADDR dwarf_locexpr_baton_eval
 +  (struct dwarf2_locexpr_baton *dlbaton);
++
++extern int dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton,
++				     struct type *type, CORE_ADDR *addrp);
  
  #endif /* dwarf2loc.h */
 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
-index 86bfecb..ddf2189 100644
+index a05c946..9452844 100644
 --- a/gdb/dwarf2read.c
 +++ b/gdb/dwarf2read.c
-@@ -48,6 +48,11 @@
+@@ -48,6 +48,10 @@
  #include "gdbcmd.h"
  #include "block.h"
  #include "addrmap.h"
@@ -3419,11 +3735,10 @@ index 86bfecb..ddf2189 100644
 +#include "f-lang.h"
 +#include "typeprint.h"
 +#include "jv-lang.h"
-+#include "vec.h"
  
  #include <fcntl.h>
  #include "gdb_string.h"
-@@ -96,7 +101,7 @@ typedef struct pubnames_header
+@@ -96,7 +100,7 @@ typedef struct pubnames_header
  _PUBNAMES_HEADER;
  #define _ACTUAL_PUBNAMES_HEADER_SIZE 13
  
@@ -3432,7 +3747,7 @@ index 86bfecb..ddf2189 100644
     Because of alignment constraints, this structure has padding and cannot
     be mapped directly onto the beginning of the .debug_info section.  */
  typedef struct aranges_header
-@@ -153,7 +158,10 @@ struct dwarf2_section_info
+@@ -153,7 +157,10 @@ struct dwarf2_section_info
    asection *asection;
    gdb_byte *buffer;
    bfd_size_type size;
@@ -3444,7 +3759,7 @@ index 86bfecb..ddf2189 100644
  };
  
  struct dwarf2_per_objfile
-@@ -333,6 +341,19 @@ struct dwarf2_cu
+@@ -333,6 +340,19 @@ struct dwarf2_cu
       DIEs for namespaces, we don't need to try to infer them
       from mangled names.  */
    unsigned int has_namespace_info : 1;
@@ -3464,7 +3779,7 @@ index 86bfecb..ddf2189 100644
  };
  
  /* Persistent data held for a compilation unit, even when not
-@@ -487,8 +508,7 @@ struct partial_die_info
+@@ -487,8 +507,7 @@ struct partial_die_info
      unsigned int has_byte_size : 1;
  
      /* The name of this DIE.  Normally the value of DW_AT_name, but
@@ -3474,31 +3789,17 @@ index 86bfecb..ddf2189 100644
      char *name;
  
      /* The scope to prepend to our children.  This is generally
-@@ -677,6 +697,11 @@ struct field_info
-     int nfnfields;
-   };
- 
-+/* A vector used during linkage name generation.  */
-+typedef struct die_info *die_info_p;
-+DEF_VEC_P (die_info_p);
-+static VEC(die_info_p) *die_list;
-+
- /* One item on the queue of compilation units to read in full symbols
-    for.  */
- struct dwarf2_queue_item
-@@ -788,7 +813,10 @@ static void scan_partial_symbols (struct partial_die_info *,
+@@ -788,7 +807,8 @@ static void scan_partial_symbols (struct partial_die_info *,
  static void add_partial_symbol (struct partial_die_info *,
  				struct dwarf2_cu *);
  
 -static int pdi_needs_namespace (enum dwarf_tag tag);
 +static gdb_byte *read_comp_unit_head (struct comp_unit_head *, gdb_byte *,
 +				      bfd *);
-+
-+static int die_needs_namespace (struct die_info *, struct dwarf2_cu *);
  
  static void add_partial_namespace (struct partial_die_info *pdi,
  				   CORE_ADDR *lowpc, CORE_ADDR *highpc,
-@@ -813,6 +841,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
+@@ -813,6 +833,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
  
  static void psymtab_to_symtab_1 (struct partial_symtab *);
  
@@ -3509,19 +3810,7 @@ index 86bfecb..ddf2189 100644
  static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu);
  
  static void dwarf2_free_abbrev_table (void *);
-@@ -940,6 +972,11 @@ static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *);
- 
- static struct type *read_type_die (struct die_info *, struct dwarf2_cu *);
- 
-+static char *physname_prefix (struct die_info *die, struct dwarf2_cu *);
-+
-+static void physname_prefix_1 (struct ui_file *, struct die_info *,
-+			       struct dwarf2_cu *);
-+
- static char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
- 
- static char *typename_concat (struct obstack *,
-@@ -984,17 +1021,25 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *,
+@@ -984,17 +1008,25 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *,
  
  static void process_structure_scope (struct die_info *, struct dwarf2_cu *);
  
@@ -3550,19 +3839,27 @@ index 86bfecb..ddf2189 100644
  static const char *namespace_name (struct die_info *die,
  				   int *is_anonymous, struct dwarf2_cu *);
  
-@@ -1028,7 +1073,10 @@ static gdb_byte *read_full_die (const struct die_reader_specs *reader,
+@@ -1028,7 +1060,8 @@ static gdb_byte *read_full_die (const struct die_reader_specs *reader,
  
  static void process_die (struct die_info *, struct dwarf2_cu *);
  
 -static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *);
-+static char *dwarf2_physname (struct die_info *, struct dwarf2_cu *);
-+
 +static char *fortran_module_linkage_name (struct die_info *die,
 +					  struct dwarf2_cu *cu);
  
  static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *,
  				       struct obstack *);
-@@ -1144,6 +1192,9 @@ static void age_cached_comp_units (void);
+@@ -1114,6 +1147,9 @@ static int attr_form_is_section_offset (struct attribute *);
+ 
+ static int attr_form_is_constant (struct attribute *);
+ 
++static struct dwarf2_loclist_baton *dwarf2_attr_to_loclist_baton
++  (struct attribute *attr, struct dwarf2_cu *cu);
++
+ static void dwarf2_symbol_mark_computed (struct attribute *attr,
+ 					 struct symbol *sym,
+ 					 struct dwarf2_cu *cu);
+@@ -1144,6 +1180,9 @@ static void age_cached_comp_units (void);
  
  static void free_one_cached_comp_unit (void *);
  
@@ -3572,7 +3869,7 @@ index 86bfecb..ddf2189 100644
  static struct type *set_die_type (struct die_info *, struct type *,
  				  struct dwarf2_cu *);
  
-@@ -1163,22 +1214,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
+@@ -1163,22 +1202,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
  
  static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu);
  
@@ -3613,7 +3910,7 @@ index 86bfecb..ddf2189 100644
  }
  
  /* When loading sections, we can either look for ".<name>", or for
-@@ -1271,10 +1331,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
+@@ -1271,10 +1319,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
  }
  
  /* Decompress a section that was compressed using zlib.  Store the
@@ -3629,7 +3926,7 @@ index 86bfecb..ddf2189 100644
                           gdb_byte **outbuf, bfd_size_type *outsize)
  {
    bfd *abfd = objfile->obfd;
-@@ -1291,6 +1354,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
+@@ -1291,6 +1342,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
    z_stream strm;
    int rc;
    int header_size = 12;
@@ -3637,7 +3934,7 @@ index 86bfecb..ddf2189 100644
  
    if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
        || bfd_bread (compressed_buffer, compressed_size, abfd) != compressed_size)
-@@ -1320,8 +1384,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
+@@ -1320,8 +1372,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
    strm.avail_in = compressed_size - header_size;
    strm.next_in = (Bytef*) compressed_buffer + header_size;
    strm.avail_out = uncompressed_size;
@@ -3653,7 +3950,7 @@ index 86bfecb..ddf2189 100644
    rc = inflateInit (&strm);
    while (strm.avail_in > 0)
      {
-@@ -1342,26 +1411,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
+@@ -1342,26 +1399,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
      error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"),
             bfd_get_filename (abfd), rc);
  
@@ -3835,7 +4132,7 @@ index 86bfecb..ddf2189 100644
  
    if (info->asection == NULL || info->size == 0)
      return;
-@@ -1374,7 +1593,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1374,7 +1581,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
        /* Upon decompression, update the buffer and its size.  */
        if (strncmp (header, "ZLIB", sizeof (header)) == 0)
          {
@@ -3844,7 +4141,7 @@ index 86bfecb..ddf2189 100644
  				   &info->size);
            return;
          }
-@@ -1397,7 +1616,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1397,7 +1604,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
  
        if (retbuf != MAP_FAILED)
  	{
@@ -3853,7 +4150,7 @@ index 86bfecb..ddf2189 100644
  	  info->buffer = retbuf + (sectp->filepos & (pagesize - 1)) ;
  	  return;
  	}
-@@ -1405,8 +1624,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1405,8 +1612,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
  #endif
  
    /* If we get here, we are a normal, not-compressed section.  */
@@ -3871,8 +4168,8 @@ index 86bfecb..ddf2189 100644
  
    /* When debugging .o files, we may need to apply relocations; see
       http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html .
-@@ -1415,6 +1641,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
-   retbuf = symfile_relocate_debug_section (abfd, sectp, buf);
+@@ -1415,6 +1629,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+   retbuf = symfile_relocate_debug_section (objfile, sectp, buf);
    if (retbuf != NULL)
      {
 +      if (old)
@@ -3880,7 +4177,7 @@ index 86bfecb..ddf2189 100644
        info->buffer = retbuf;
        return;
      }
-@@ -1423,6 +1651,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1423,6 +1639,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
        || bfd_bread (buf, info->size, abfd) != info->size)
      error (_("Dwarf Error: Can't read DWARF data from '%s'"),
  	   bfd_get_filename (abfd));
@@ -3900,7 +4197,62 @@ index 86bfecb..ddf2189 100644
  }
  
  /* Fill in SECTP, BUFP and SIZEP with section info, given OBJFILE and
-@@ -2389,11 +2630,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
+@@ -2070,6 +2299,29 @@ build_type_psymtabs (struct objfile *objfile)
+ 			  process_type_comp_unit, objfile);
+ }
+ 
++/* A cleanup function that clears an objfile's psymtabs.  There are
++   two cases to consider.  If we are reading symbols directly, then on
++   a failure the objfile will be destroyed.  In this case, clearing
++   the psymtabs is fine -- a little wasted time, but nothing serious.
++   If we are reading symbols lazily, then it is too late to destroy
++   the objfile.  Instead we just make it look like the objfile has no
++   psymtabs.  */
++
++static void
++do_clear_psymtabs (void *arg)
++{
++  struct objfile *objfile = arg;
++
++  objfile->psymtabs_addrmap = NULL;
++  objfile->psymtabs = NULL;
++  bcache_xfree (objfile->psymbol_cache);
++  objfile->psymbol_cache = bcache_xmalloc ();
++  xfree (objfile->global_psymbols.list);
++  memset (&objfile->global_psymbols, 0, sizeof (objfile->global_psymbols));
++  xfree (objfile->static_psymbols.list);
++  memset (&objfile->static_psymbols, 0, sizeof (objfile->static_psymbols));
++}
++
+ /* Build the partial symbol table by doing a quick pass through the
+    .debug_info and .debug_abbrev sections.  */
+ 
+@@ -2080,7 +2332,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
+      mmap()  on architectures that support it. (FIXME) */
+   bfd *abfd = objfile->obfd;
+   gdb_byte *info_ptr;
+-  struct cleanup *back_to;
++  struct cleanup *back_to, *clear_psymtabs;
+ 
+   info_ptr = dwarf2_per_objfile->info.buffer;
+ 
+@@ -2094,6 +2346,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
+ 
+   objfile->psymtabs_addrmap =
+     addrmap_create_mutable (&objfile->objfile_obstack);
++  clear_psymtabs = make_cleanup (do_clear_psymtabs, objfile);
+ 
+   /* Since the objects we're extracting from .debug_info vary in
+      length, only the individual functions to extract them (like
+@@ -2123,6 +2376,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
+ 					    dwarf2_per_objfile->info.size);
+     }
+ 
++  discard_cleanups (clear_psymtabs);
+   objfile->psymtabs_addrmap = addrmap_create_fixed (objfile->psymtabs_addrmap,
+ 						    &objfile->objfile_obstack);
+ 
+@@ -2389,11 +2643,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
        || parent->tag == DW_TAG_union_type
        || parent->tag == DW_TAG_enumeration_type)
      {
@@ -3921,7 +4273,7 @@ index 86bfecb..ddf2189 100644
      }
    else if (parent->tag == DW_TAG_enumerator)
      /* Enumerators should not get the name of the enumeration as a prefix.  */
-@@ -2405,7 +2653,7 @@ partial_die_parent_scope (struct partial_die_info *pdi,
+@@ -2405,7 +2666,7 @@ partial_die_parent_scope (struct partial_die_info *pdi,
  	 ignoring them.  */
        complaint (&symfile_complaints,
  		 _("unhandled containing DIE tag %d for DIE at %d"),
@@ -3930,7 +4282,7 @@ index 86bfecb..ddf2189 100644
        parent->scope = grandparent_scope;
      }
  
-@@ -2420,12 +2668,22 @@ partial_die_full_name (struct partial_die_info *pdi,
+@@ -2420,12 +2681,22 @@ partial_die_full_name (struct partial_die_info *pdi,
  		       struct dwarf2_cu *cu)
  {
    char *parent_scope;
@@ -3957,7 +4309,7 @@ index 86bfecb..ddf2189 100644
  }
  
  static void
-@@ -2441,12 +2699,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
+@@ -2441,12 +2712,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
  
    baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
@@ -3973,7 +4325,7 @@ index 86bfecb..ddf2189 100644
  
    if (actual_name == NULL)
      actual_name = pdi->name;
-@@ -2543,6 +2798,13 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
+@@ -2543,6 +2811,13 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
  			   &objfile->global_psymbols,
  			   0, (CORE_ADDR) 0, cu->language, objfile);
        break;
@@ -3987,7 +4339,7 @@ index 86bfecb..ddf2189 100644
      case DW_TAG_class_type:
      case DW_TAG_interface_type:
      case DW_TAG_structure_type:
-@@ -2586,34 +2848,17 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
+@@ -2586,49 +2861,10 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
        break;
      }
  
@@ -4014,50 +4366,30 @@ index 86bfecb..ddf2189 100644
 -/* Determine whether a die of type TAG living in a C++ class or
 -   namespace needs to have the name of the scope prepended to the
 -   name listed in the die.  */
-+/* Determine whether DIE needs to have the name of the scope prepended
-+   to the name listed in the die.  */
- 
- static int
+-
+-static int
 -pdi_needs_namespace (enum dwarf_tag tag)
-+die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
- {
+-{
 -  switch (tag)
-+  switch (die->tag)
-     {
-     case DW_TAG_namespace:
-     case DW_TAG_typedef:
-@@ -2623,7 +2868,30 @@ pdi_needs_namespace (enum dwarf_tag tag)
-     case DW_TAG_union_type:
-     case DW_TAG_enumeration_type:
-     case DW_TAG_enumerator:
-+    case DW_TAG_subprogram:
-+    case DW_TAG_member:
-       return 1;
-+
-+    case DW_TAG_variable:
-+      {
-+	struct attribute *attr;
-+	attr = dwarf2_attr (die, DW_AT_specification, cu);
-+	if (attr)
-+	  return 1;
-+	attr = dwarf2_attr (die, DW_AT_external, cu);
-+	if (attr == NULL && die->parent->tag != DW_TAG_namespace)
-+	  return 0;
-+	/* A variable in a lexical block of some kind does not need a
-+	   namespace, even though in C++ such variables may be
-+	   external and have a mangled name.  */
-+	if (die->parent->tag ==  DW_TAG_lexical_block
-+	    || die->parent->tag ==  DW_TAG_try_block
-+	    || die->parent->tag ==  DW_TAG_catch_block)
-+	  return 0;
-+	return 1;
-+      }
-+      break;
-+
-     default:
-       return 0;
-     }
-@@ -2656,12 +2924,12 @@ static void
+-    {
+-    case DW_TAG_namespace:
+-    case DW_TAG_typedef:
+-    case DW_TAG_class_type:
+-    case DW_TAG_interface_type:
+-    case DW_TAG_structure_type:
+-    case DW_TAG_union_type:
+-    case DW_TAG_enumeration_type:
+-    case DW_TAG_enumerator:
+-      return 1;
+-    default:
+-      return 0;
+-    }
+-}
+-
+ /* Read a partial die corresponding to a namespace; also, add a symbol
+    corresponding to that namespace to the symbol table.  NAMESPACE is
+    the name of the enclosing namespace.  */
+@@ -2656,12 +2892,12 @@ static void
  add_partial_module (struct partial_die_info *pdi, CORE_ADDR *lowpc,
  		    CORE_ADDR *highpc, int need_pc, struct dwarf2_cu *cu)
  {
@@ -4074,7 +4406,15 @@ index 86bfecb..ddf2189 100644
  }
  
  /* Read a partial die corresponding to a subprogram and create a partial
-@@ -2752,27 +3020,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
+@@ -2739,7 +2975,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
+ 	 could fix this by only using the demangled name to get the
+ 	 prefix (but see comment in read_structure_type).  */
+ 
+-      struct partial_die_info *child_pdi = struct_pdi->die_child;
+       struct partial_die_info *real_pdi;
+ 
+       /* If this DIE (this DIE's specification, if any) has a parent, then
+@@ -2752,27 +2987,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
  
        if (real_pdi->die_parent != NULL)
  	return;
@@ -4091,7 +4431,7 @@ index 86bfecb..ddf2189 100644
 -		  struct_pdi->name
 -		    = obsavestring (actual_class_name,
 -				    strlen (actual_class_name),
--				    &cu->comp_unit_obstack);
+-				    &cu->objfile->objfile_obstack);
 -		  xfree (actual_class_name);
 -		}
 -	      break;
@@ -4102,7 +4442,7 @@ index 86bfecb..ddf2189 100644
      }
  }
  
-@@ -3325,6 +3572,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3325,6 +3539,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
      case DW_TAG_imported_declaration:
      case DW_TAG_imported_module:
        processing_has_namespace_info = 1;
@@ -4117,31 +4457,81 @@ index 86bfecb..ddf2189 100644
        if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
  				 || cu->language != language_fortran))
  	complaint (&symfile_complaints, _("Tag '%s' has unexpected children"),
-@@ -3340,41 +3595,71 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
- /* Return the fully qualified name of DIE, based on its DW_AT_name.
-    If scope qualifiers are appropriate they will be added.  The result
-    will be allocated on the objfile_obstack, or NULL if the DIE does
--   not have a name.  */
-+   not have a name.
-+
-+   The output string will be canonicalized (if C++/Java). */
- 
- static const char *
- dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu)
- {
--  struct attribute *attr;
--  char *prefix, *name;
--  struct ui_file *buf = NULL;
-+  char *name;
- 
-   name = dwarf2_name (die, cu);
--  if (!name)
--    return NULL;
+@@ -3337,42 +3559,183 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+     }
+ }
  
-   /* These are the only languages we know how to qualify names in.  */
--  if (cu->language != language_cplus
--      && cu->language != language_java)
--    return name;
++/* A helper function for dwarf2_compute_name which determines whether DIE
++   needs to have the name of the scope prepended to the name listed in the
++   die.  */
++
++static int
++die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
++{
++  switch (die->tag)
++    {
++    case DW_TAG_namespace:
++    case DW_TAG_typedef:
++    case DW_TAG_class_type:
++    case DW_TAG_interface_type:
++    case DW_TAG_structure_type:
++    case DW_TAG_union_type:
++    case DW_TAG_enumeration_type:
++    case DW_TAG_enumerator:
++    case DW_TAG_subprogram:
++    case DW_TAG_member:
++      return 1;
++
++    case DW_TAG_variable:
++      {
++	struct attribute *attr;
++
++	/* We only need to prefix "globally" visible variables.  These include
++	   any variable marked with DW_AT_external or any variable that
++	   lives in a namespace.  [Variables in anonymous namespaces
++	   require prefixing, but they are not DW_AT_external.]  */
++
++	if (dwarf2_attr (die, DW_AT_specification, cu))
++	  {
++	    struct dwarf2_cu *spec_cu = cu;
++	    return die_needs_namespace (die_specification (die, &spec_cu),
++					spec_cu);
++	  }
++
++	/* A variable in a lexical block of some kind does not need
++	   a namespace, even though in C++ such variables may be
++	   external and have a mangled name.  */
++	if (die->parent->tag == DW_TAG_lexical_block
++	    || die->parent->tag == DW_TAG_try_block
++	    || die->parent->tag == DW_TAG_catch_block)
++	  return 0;
++
++	attr = dwarf2_attr (die, DW_AT_external, cu);
++	if (attr || die->parent->tag == DW_TAG_namespace)
++	  return 1;
++
++	return 0;
++      }
++
++    default:
++      return 0;
++    }
++}
++
++/* Compute the fully qualified name of DIE in CU.  If PHYSNAME is nonzero,
++   compute the physname for the object, which include a method's
++   formal parameters (C++/Java) and return type (Java).
++
++   The result is allocated on the objfile_obstack and canonicalized.  */
++
++static const char *
++dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
++		     int physname)
++{
++  if (name == NULL)
++    name = dwarf2_name (die, cu);
++
++  /* These are the only languages we know how to qualify names in.  */
 +  if (name != NULL
 +      && (cu->language == language_cplus || cu->language == language_java))
 +    {
@@ -4150,17 +4540,9 @@ index 86bfecb..ddf2189 100644
 +	  long length;
 +	  char *prefix;
 +	  struct ui_file *buf;
- 
--  /* If no prefix is necessary for this type of DIE, return the
--     unqualified name.  The other three tags listed could be handled
--     in pdi_needs_namespace, but that requires broader changes.  */
--  if (!pdi_needs_namespace (die->tag)
--      && die->tag != DW_TAG_subprogram
--      && die->tag != DW_TAG_variable
--      && die->tag != DW_TAG_member)
--    return name;
-+	  buf = mem_fileopen ();
++
 +	  prefix = determine_prefix (die, cu);
++	  buf = mem_fileopen ();
 +	  if (*prefix != '\0')
 +	    {
 +	      char *prefixed_name = typename_concat (NULL, prefix, name, cu);
@@ -4168,12 +4550,36 @@ index 86bfecb..ddf2189 100644
 +	      xfree (prefixed_name);
 +	    }
 +	  else
-+	    fputs_unfiltered (name, buf);
- 
--  prefix = determine_prefix (die, cu);
--  if (*prefix != '\0')
--    name = typename_concat (&cu->objfile->objfile_obstack, prefix,
--			    name, cu);
++	    fputs_unfiltered (name ? name : "", buf);
++
++	  /* For Java and C++ methods, append formal parameter type
++	     information, if PHYSNAME.  */
++
++	  if (physname && die->tag == DW_TAG_subprogram
++	      && (cu->language == language_cplus
++		  || cu->language == language_java))
++	    {
++	      struct type *type = read_type_die (die, cu);
++
++	      c_type_print_args (type, buf, 0, cu->language);
++
++	      if (cu->language == language_java)
++		{
++		  /* For java, we must append the return type to method
++		     names. */
++		  if (die->tag == DW_TAG_subprogram)
++		    java_print_type (TYPE_TARGET_TYPE (type), "", buf,
++				     0, 0);
++		}
++	      else if (cu->language == language_cplus)
++		{
++		  if (TYPE_NFIELDS (type) > 0
++		      && TYPE_FIELD_ARTIFICIAL (type, 0)
++		      && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0))))
++		    fputs_unfiltered (" const", buf);
++		}
++	    }
++
 +	  name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack,
 +				       &length);
 +	  ui_file_delete (buf);
@@ -4188,10 +4594,64 @@ index 86bfecb..ddf2189 100644
 +	    }
 +	}
 +    }
++
++  return name;
++}
++
+ /* Return the fully qualified name of DIE, based on its DW_AT_name.
+    If scope qualifiers are appropriate they will be added.  The result
+    will be allocated on the objfile_obstack, or NULL if the DIE does
+-   not have a name.  */
++   not have a name.  NAME may either be from a previous call to
++   dwarf2_name or NULL.
++
++   The output string will be canonicalized (if C++/Java). */
  
-   return name;
- }
+ static const char *
+-dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu)
++dwarf2_full_name (char *name, struct die_info *die, struct dwarf2_cu *cu)
+ {
+-  struct attribute *attr;
+-  char *prefix, *name;
+-  struct ui_file *buf = NULL;
++  return dwarf2_compute_name (name, die, cu, 0);
++}
+ 
+-  name = dwarf2_name (die, cu);
+-  if (!name)
+-    return NULL;
++/* Construct a physname for the given DIE in CU.  NAME may either be
++   from a previous call to dwarf2_name or NULL.  The result will be
++   allocated on teh objfile_objstack or NULL if the DIE does not have a
++   name.
+ 
+-  /* These are the only languages we know how to qualify names in.  */
+-  if (cu->language != language_cplus
+-      && cu->language != language_java)
+-    return name;
+-
+-  /* If no prefix is necessary for this type of DIE, return the
+-     unqualified name.  The other three tags listed could be handled
+-     in pdi_needs_namespace, but that requires broader changes.  */
+-  if (!pdi_needs_namespace (die->tag)
+-      && die->tag != DW_TAG_subprogram
+-      && die->tag != DW_TAG_variable
+-      && die->tag != DW_TAG_member)
+-    return name;
+-
+-  prefix = determine_prefix (die, cu);
+-  if (*prefix != '\0')
+-    name = typename_concat (&cu->objfile->objfile_obstack, prefix,
+-			    name, cu);
++   The output string will be canonicalized (if C++/Java).  */
  
+-  return name;
++static const char *
++dwarf2_physname (char *name, struct die_info *die, struct dwarf2_cu *cu)
++{
++  return dwarf2_compute_name (name, die, cu, 1);
++}
++
 +/* Read the given DIE's DW_AT_decl_line number.  Return -1 if in case of an
 +   error.  */
 +
@@ -4205,15 +4665,15 @@ index 86bfecb..ddf2189 100644
 +    return DW_UNSND (line_attr);
 +
 +  return -1;
-+}
-+
- /* Read the import statement specified by the given die and record it.  */
+ }
  
- static void
-@@ -3385,9 +3670,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+ /* Read the import statement specified by the given die and record it.  */
+@@ -3385,11 +3748,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
    struct dwarf2_cu *imported_cu;
    const char *imported_name;
    const char *imported_name_prefix;
+-  char *import_alias;
+-
 -  const char *import_prefix;
    char *canonical_name;
 -
@@ -4228,18 +4688,14 @@ index 86bfecb..ddf2189 100644
    import_attr = dwarf2_attr (die, DW_AT_import, cu);
    if (import_attr == NULL)
      {
-@@ -3436,17 +3727,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
-       return;
+@@ -3439,19 +3806,25 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
      }
  
--  /* FIXME: dwarf2_name (die); for the local name after import.  */
--
--  /* Figure out where the statement is being imported to.  */
-+  /* Figure out the local name after import.  */
+   /* Figure out the local name after import.  */
+-  import_alias = dwarf2_name (die, cu);
 +  import_alias = dwarf2_name(die, cu);
-+  if(import_alias == NULL){
-+    import_alias = "";
-+  }
+ 
+-  /* Figure out where the statement is being imported to.  */
 +  
 +  /* Determine the line number at which the import was made */
 +  line_number = dwarf2_read_decl_line(die, cu);
@@ -4249,38 +4705,38 @@ index 86bfecb..ddf2189 100644
  
    /* Figure out what the scope of the imported die is and prepend it
       to the name of the imported die.  */
--  imported_name_prefix = determine_prefix (imported_die, imported_cu);
+   imported_name_prefix = determine_prefix (imported_die, imported_cu);
 -
 -  if (strlen (imported_name_prefix) > 0)
 -    {
-+  imported_name_prefix = determine_prefix (imported_die, cu);
+-      canonical_name = alloca (strlen (imported_name_prefix)
+-                               + 2 + strlen (imported_name) + 1);
 +  
 +  if(imported_die->tag != DW_TAG_namespace){
 +    imported_declaration = imported_name;
 +    canonical_name = (char*)imported_name_prefix;
 +  }else{
 +    if(strlen (imported_name_prefix) > 0){
-       canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
++      canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
        strcpy (canonical_name, imported_name_prefix);
        strcat (canonical_name, "::");
-@@ -3457,8 +3758,14 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+       strcat (canonical_name, imported_name);
+@@ -3461,10 +3834,13 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
        canonical_name = alloca (strlen (imported_name) + 1);
        strcpy (canonical_name, imported_name);
      }
 -
--  using_directives = cp_add_using (import_prefix,canonical_name, using_directives);
 +  }
 +  
-+  using_directives = cp_add_using (import_prefix,
-+                                   canonical_name,
-+                                   import_alias,
+   using_directives = cp_add_using (import_prefix,
+                                    canonical_name,
+                                    import_alias,
 +                                   imported_declaration,
 +                                   line_number,
-+                                   using_directives);
+                                    using_directives);
  }
  
- static void
-@@ -3727,6 +4034,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3734,6 +4110,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
    struct attribute *attr;
  
    attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
@@ -4295,7 +4751,7 @@ index 86bfecb..ddf2189 100644
    if (!attr)
      return;
  
-@@ -3825,6 +4140,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3832,6 +4216,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
    char *name;
    CORE_ADDR baseaddr;
    struct block *block;
@@ -4303,7 +4759,7 @@ index 86bfecb..ddf2189 100644
    int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
  
    if (inlined_func)
-@@ -3843,13 +4159,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3850,13 +4235,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  
    baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
@@ -4330,7 +4786,7 @@ index 86bfecb..ddf2189 100644
    lowpc += baseaddr;
    highpc += baseaddr;
  
-@@ -3876,14 +4202,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3883,14 +4278,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  
    cu->list_in_scope = &local_symbols;
  
@@ -4357,7 +4813,7 @@ index 86bfecb..ddf2189 100644
      }
  
    inherit_abstract_dies (die, cu);
-@@ -3899,6 +4230,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3906,6 +4306,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  			determine_prefix (die, cu),
  			processing_has_namespace_info);
  
@@ -4371,31 +4827,31 @@ index 86bfecb..ddf2189 100644
    /* If we have address ranges, record them.  */
    dwarf2_record_block_ranges (die, block, baseaddr, cu);
    
-@@ -4517,7 +4855,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
+@@ -4524,7 +4931,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
  	return;
  
        /* Get physical name.  */
 -      physname = dwarf2_linkage_name (die, cu);
-+      physname = dwarf2_physname (die, cu);
++      physname = (char *) dwarf2_physname (fieldname, die, cu);
  
        /* The name is already allocated along with this objfile, so we don't
  	 need to duplicate it for the type.  */
-@@ -4679,7 +5017,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4686,7 +5093,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
      return;
  
    /* Get the mangled name.  */
 -  physname = dwarf2_linkage_name (die, cu);
-+  physname = dwarf2_physname (die, cu);
++  physname = (char *) dwarf2_physname (fieldname, die, cu);
  
    /* Look up member function name in fieldlist.  */
    for (i = 0; i < fip->nfnfields; i++)
-@@ -4986,14 +5324,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4993,14 +5400,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
        if (cu->language == language_cplus
  	  || cu->language == language_java)
  	{
 -	  const char *new_prefix = determine_class_name (die, cu);
 -	  TYPE_TAG_NAME (type) = (char *) new_prefix;
-+	  TYPE_TAG_NAME (type) = (char *) dwarf2_full_name (die, cu);
++	  TYPE_TAG_NAME (type) = (char *) dwarf2_full_name (name, die, cu);
 +	  if (die->tag == DW_TAG_structure_type
 +	      || die->tag == DW_TAG_class_type)
 +	    TYPE_NAME (type) = TYPE_TAG_NAME (type);
@@ -4411,7 +4867,16 @@ index 86bfecb..ddf2189 100644
  	}
      }
  
-@@ -5237,51 +5579,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5219,7 +5630,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+   type = alloc_type (objfile);
+ 
+   TYPE_CODE (type) = TYPE_CODE_ENUM;
+-  name = dwarf2_full_name (die, cu);
++  name = dwarf2_full_name (NULL, die, cu);
+   if (name != NULL)
+     TYPE_TAG_NAME (type) = (char *) name;
+ 
+@@ -5244,51 +5655,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
    return set_die_type (die, type, cu);
  }
  
@@ -4463,7 +4928,7 @@ index 86bfecb..ddf2189 100644
  /* Given a pointer to a die which begins an enumeration, process all
     the dies that define the members of the enumeration, and create the
     symbol for the enumeration type.
-@@ -5359,6 +5656,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5366,6 +5732,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
    new_symbol (die, this_type, cu);
  }
  
@@ -4493,7 +4958,7 @@ index 86bfecb..ddf2189 100644
  /* Extract all information from a DW_TAG_array_type DIE and put it in
     the DIE's type field.  For now, this only handles one dimensional
     arrays.  */
-@@ -5372,7 +5692,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5379,7 +5768,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
    struct type *element_type, *range_type, *index_type;
    struct type **range_types = NULL;
    struct attribute *attr;
@@ -4502,7 +4967,7 @@ index 86bfecb..ddf2189 100644
    struct cleanup *back_to;
    char *name;
  
-@@ -5419,16 +5739,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5426,16 +5815,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
    type = element_type;
  
    if (read_array_order (die, cu) == DW_ORD_col_major)
@@ -4524,16 +4989,16 @@ index 86bfecb..ddf2189 100644
  
    /* Understand Dwarf2 support for vector types (like they occur on
       the PowerPC w/ AltiVec).  Gcc just adds another attribute to the
-@@ -5617,7 +5932,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5624,7 +6008,7 @@ 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));
-+	  cp_add_using_directive (previous_prefix, TYPE_NAME (type), "", "", dwarf2_read_decl_line(die, cu));
+-	  cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL);
++	  cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, "", dwarf2_read_decl_line(die, cu));
  	}
      }
  
-@@ -5633,20 +5948,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5640,20 +6024,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
      }
  }
  
@@ -4546,14 +5011,13 @@ index 86bfecb..ddf2189 100644
  {
 -  struct die_info *child_die = die->child;
 +  struct type *type;
- 
--  /* FIXME: Support the separate Fortran module namespaces.  */
++
 +  type = read_module_type (die, cu);
 +
 +  if (type)
 +    new_symbol (die, type, cu);
 +}
- 
++
 +/* Read a Fortran module as type.
 +
 +   Modules present only as declarations - being used only for DW_AT_import of
@@ -4590,9 +5054,10 @@ index 86bfecb..ddf2189 100644
 +  save_global_symbols = global_symbols;
 +  global_symbols = NULL;
 +  save_list_in_scope = cu->list_in_scope;
-+
+ 
+-  /* FIXME: Support the separate Fortran module namespaces.  */
 +  /* Process the child DIEs.  */
-+
+ 
 +  child_die = die->child;
    while (child_die && child_die->tag)
      {
@@ -4692,7 +5157,7 @@ index 86bfecb..ddf2189 100644
  }
  
  /* Return the name of the namespace represented by DIE.  Set
-@@ -5811,29 +6261,113 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5818,29 +6337,115 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
    struct gdbarch *gdbarch = get_objfile_arch (objfile);
    struct type *type, *range_type, *index_type, *char_type;
    struct attribute *attr;
@@ -4777,7 +5242,8 @@ index 86bfecb..ddf2189 100644
 +		}
 +	    }
 +
-+	  TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++	  TYPE_RANGE_DATA (range_type)->high.kind
++	    = RANGE_BOUND_KIND_DWARF_BLOCK;
 +	  TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = length_baton;
 +	  TYPE_DYNAMIC (range_type) = 1;
 +	}
@@ -4801,7 +5267,8 @@ index 86bfecb..ddf2189 100644
 -        }
 +      if (attr && attr_form_is_block (attr))
 +	{
-+	  TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++	  TYPE_RANGE_DATA (range_type)->high.kind
++	    = RANGE_BOUND_KIND_DWARF_BLOCK;
 +	  TYPE_RANGE_DATA (range_type)->high.u.dwarf_block =
 +					dwarf2_attr_to_locexpr_baton (attr, cu);
 +	  TYPE_DYNAMIC (range_type) = 1;
@@ -4820,7 +5287,7 @@ index 86bfecb..ddf2189 100644
    char_type = language_string_char_type (cu->language_defn, gdbarch);
    type = create_string_type (NULL, char_type, range_type);
  
-@@ -5933,7 +6467,6 @@ static struct type *
+@@ -5940,11 +6545,10 @@ static struct type *
  read_typedef (struct die_info *die, struct dwarf2_cu *cu)
  {
    struct objfile *objfile = cu->objfile;
@@ -4828,7 +5295,12 @@ index 86bfecb..ddf2189 100644
    const char *name = NULL;
    struct type *this_type;
  
-@@ -6041,8 +6574,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+-  name = dwarf2_full_name (die, cu);
++  name = dwarf2_full_name (NULL, die, cu);
+   this_type = init_type (TYPE_CODE_TYPEDEF, 0,
+ 			 TYPE_FLAG_TARGET_STUB, NULL, objfile);
+   TYPE_NAME (this_type) = (char *) name;
+@@ -6048,8 +6652,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
    struct type *base_type;
    struct type *range_type;
    struct attribute *attr;
@@ -4838,7 +5310,7 @@ index 86bfecb..ddf2189 100644
    char *name;
    LONGEST negative_mask;
    
-@@ -6056,49 +6588,101 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -6063,49 +6666,157 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
  		     0, NULL, cu->objfile);
      }
  
@@ -4861,13 +5333,32 @@ index 86bfecb..ddf2189 100644
 -    low = dwarf2_get_attr_constant_value (attr, 0);
 +  if (attr && attr_form_is_block (attr))
 +    {
-+      TYPE_LOW_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++      TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_BLOCK;
 +      TYPE_RANGE_DATA (range_type)->low.u.dwarf_block =
 +					dwarf2_attr_to_locexpr_baton (attr, cu);
 +      TYPE_DYNAMIC (range_type) = 1;
 +      /* For setting a default if DW_AT_UPPER_BOUND would be missing.  */
 +      low = 0;
 +    }
++  else if (attr && is_ref_attr (attr))
++    {
++      struct die_info *target_die;
++      struct dwarf2_cu *target_cu = cu;
++      struct attribute *target_loc_attr;
++
++      target_die = follow_die_ref_or_sig (die, attr, &target_cu);
++      gdb_assert (target_cu->objfile == cu->objfile);
++      target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu);
++
++      TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_LOCLIST;
++      TYPE_RANGE_DATA (range_type)->low.u.dwarf_loclist.loclist
++        = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu);
++      TYPE_RANGE_DATA (range_type)->low.u.dwarf_loclist.type
++        = die_type (target_die, target_cu);
++      TYPE_DYNAMIC (range_type) = 1;
++      /* For setting a default if DW_AT_UPPER_BOUND would be missing.  */
++      low = 0;
++    }
 +  else
 +    {
 +      if (attr && attr_form_is_constant (attr))
@@ -4911,9 +5402,8 @@ index 86bfecb..ddf2189 100644
 -             the lower bound we've computed above.  */
 -          high = low - 1;
 -        }
--      else
--        high = dwarf2_get_attr_constant_value (attr, 1);
-+  if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr)))
++  if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr)
++		&& !is_ref_attr (attr)))
 +    {
 +      attr = dwarf2_attr (die, DW_AT_count, cu);
 +      /* It does not hurt but it is needlessly ineffective in check_typedef.  */
@@ -4923,21 +5413,32 @@ index 86bfecb..ddf2189 100644
 +	  TYPE_DYNAMIC (range_type) = 1;
 +	}
 +      /* Pass it now as the regular DW_AT_upper_bound.  */
-     }
- 
--  negative_mask = 
--    (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
--  if (!TYPE_UNSIGNED (base_type) && (low & negative_mask))
--    low |= negative_mask;
--  if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
--    high |= negative_mask;
++    }
++
 +  if (attr && attr_form_is_block (attr))
 +    {
-+      TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++      TYPE_RANGE_DATA (range_type)->high.kind = RANGE_BOUND_KIND_DWARF_BLOCK;
 +      TYPE_RANGE_DATA (range_type)->high.u.dwarf_block =
 +					dwarf2_attr_to_locexpr_baton (attr, cu);
 +      TYPE_DYNAMIC (range_type) = 1;
 +    }
++  else if (attr && is_ref_attr (attr))
++    {
++      struct die_info *target_die;
++      struct dwarf2_cu *target_cu = cu;
++      struct attribute *target_loc_attr;
++
++      target_die = follow_die_ref_or_sig (die, attr, &target_cu);
++      gdb_assert (target_cu->objfile == cu->objfile);
++      target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu);
++
++      TYPE_RANGE_DATA (range_type)->high.kind = RANGE_BOUND_KIND_DWARF_LOCLIST;
++      TYPE_RANGE_DATA (range_type)->high.u.dwarf_loclist.loclist
++        = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu);
++      TYPE_RANGE_DATA (range_type)->high.u.dwarf_loclist.type
++        = die_type (target_die, target_cu);
++      TYPE_DYNAMIC (range_type) = 1;
++    }
 +  else
 +    {
 +      if (attr && attr_form_is_constant (attr))
@@ -4949,23 +5450,49 @@ index 86bfecb..ddf2189 100644
 +	    high |= negative_mask;
 +	  TYPE_HIGH_BOUND (range_type) = high;
 +	}
-+      else
+       else
+-        high = dwarf2_get_attr_constant_value (attr, 1);
 +	{
 +	  TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
 +	  TYPE_HIGH_BOUND (range_type) = low - 1;
 +	}
-+    }
+     }
  
--  range_type = create_range_type (NULL, base_type, low, high);
+-  negative_mask = 
+-    (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
+-  if (!TYPE_UNSIGNED (base_type) && (low & negative_mask))
+-    low |= negative_mask;
+-  if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
+-    high |= negative_mask;
 +  /* DW_AT_bit_stride is currently unsupported as we count in bytes.  */
 +  attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
 +  if (attr && attr_form_is_block (attr))
 +    {
-+      TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (range_type) = 1;
++      TYPE_RANGE_DATA (range_type)->byte_stride.kind
++        = RANGE_BOUND_KIND_DWARF_BLOCK;
 +      TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_block =
 +					dwarf2_attr_to_locexpr_baton (attr, cu);
 +      TYPE_DYNAMIC (range_type) = 1;
 +    }
++  else if (attr && is_ref_attr (attr))
++    {
++      struct die_info *target_die;
++      struct dwarf2_cu *target_cu = cu;
++      struct attribute *target_loc_attr;
+ 
+-  range_type = create_range_type (NULL, base_type, low, high);
++      target_die = follow_die_ref_or_sig (die, attr, &target_cu);
++      gdb_assert (target_cu->objfile == cu->objfile);
++      target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu);
++
++      TYPE_RANGE_DATA (range_type)->byte_stride.kind
++        = RANGE_BOUND_KIND_DWARF_LOCLIST;
++      TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.loclist
++        = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu);
++      TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.type
++        = die_type (target_die, target_cu);
++      TYPE_DYNAMIC (range_type) = 1;
++    }
 +  else if (attr && attr_form_is_constant (attr))
 +    {
 +      TYPE_BYTE_STRIDE (range_type) = dwarf2_get_attr_constant_value (attr, 0);
@@ -4976,7 +5503,7 @@ index 86bfecb..ddf2189 100644
  
    name = dwarf2_name (die, cu);
    if (name)
-@@ -6557,6 +7141,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
+@@ -6564,6 +7275,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
  	  && abbrev->tag != DW_TAG_lexical_block
  	  && abbrev->tag != DW_TAG_variable
  	  && abbrev->tag != DW_TAG_namespace
@@ -4984,18 +5511,17 @@ index 86bfecb..ddf2189 100644
  	  && abbrev->tag != DW_TAG_member)
  	{
  	  /* Otherwise we skip to the next sibling, if any.  */
-@@ -6765,8 +7350,8 @@ read_partial_die (struct partial_die_info *part_die,
+@@ -6772,7 +7484,8 @@ read_partial_die (struct partial_die_info *part_die,
  	    }
  	  break;
  	case DW_AT_MIPS_linkage_name:
 -	  part_die->name = DW_STRING (&attr);
--	  break;
 +	  if (cu->language == language_ada)
 +	    part_die->name = DW_STRING (&attr);
+ 	  break;
  	case DW_AT_low_pc:
  	  has_low_pc_attr = 1;
- 	  part_die->lowpc = DW_ADDR (&attr);
-@@ -6963,7 +7548,8 @@ fixup_partial_die (struct partial_die_info *part_die,
+@@ -6970,7 +7683,8 @@ fixup_partial_die (struct partial_die_info *part_die,
    /* If we found a reference attribute and the DIE has no name, try
       to find a name in the referred to DIE.  */
  
@@ -5005,7 +5531,7 @@ index 86bfecb..ddf2189 100644
      {
        struct partial_die_info *spec_die;
  
-@@ -8305,10 +8891,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
+@@ -8312,10 +9026,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
       (i.e. when the value of a register or memory location is
       referenced, or a thread-local block, etc.).  Then again, it might
       not be worthwhile.  I'm assuming that it isn't unless performance
@@ -5020,7 +5546,7 @@ index 86bfecb..ddf2189 100644
  }
  
  /* Given a pointer to a DWARF information entry, figure out if we need
-@@ -8330,21 +8918,29 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8337,21 +9053,27 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  
    baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
@@ -5041,13 +5567,10 @@ index 86bfecb..ddf2189 100644
 +      /* Some methods are called w/o checking SYMBOL_COMPUTED_OPS validity.  */
 +      SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs;
  
--      /* Cache this symbol's name and the name's demangled form (if any).  */
+       /* Cache this symbol's name and the name's demangled form (if any).  */
        SYMBOL_LANGUAGE (sym) = cu->language;
 -      SYMBOL_SET_NAMES (sym, name, strlen (name), 0, objfile);
-+
-+      /* Cache this symbol's name and the name's demangled form (if any).  */
-+
-+      linkagename = dwarf2_physname (die, cu);
++      linkagename = dwarf2_physname (name, die, cu);
 +      SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
 +      if (cu->language == language_fortran)
 +	{
@@ -5057,7 +5580,7 @@ index 86bfecb..ddf2189 100644
  
        /* Default assumptions.
           Use the passed type or decode it from the die.  */
-@@ -8444,7 +9040,24 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8451,7 +9173,24 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  	      var_decode_location (attr, sym, cu);
  	      attr2 = dwarf2_attr (die, DW_AT_external, cu);
  	      if (attr2 && (DW_UNSND (attr2) != 0))
@@ -5083,7 +5606,27 @@ index 86bfecb..ddf2189 100644
  	      else
  		add_symbol_to_list (sym, cu->list_in_scope);
  	    }
-@@ -8605,6 +9218,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8576,7 +9315,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+ 	  }
+ 	  break;
+ 	case DW_TAG_typedef:
+-	  SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu);
++	  SYMBOL_LINKAGE_NAME (sym)
++	    = (char *) dwarf2_full_name (name, die, cu);
+ 	  SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ 	  SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
+ 	  add_symbol_to_list (sym, cu->list_in_scope);
+@@ -8588,7 +9328,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+ 	  add_symbol_to_list (sym, cu->list_in_scope);
+ 	  break;
+ 	case DW_TAG_enumerator:
+-	  SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu);
++	  SYMBOL_LINKAGE_NAME (sym)
++	    = (char *) dwarf2_full_name (name, die, cu);
+ 	  attr = dwarf2_attr (die, DW_AT_const_value, cu);
+ 	  if (attr)
+ 	    {
+@@ -8612,6 +9353,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  	  SYMBOL_CLASS (sym) = LOC_TYPEDEF;
  	  add_symbol_to_list (sym, &global_symbols);
  	  break;
@@ -5095,7 +5638,7 @@ index 86bfecb..ddf2189 100644
  	default:
  	  /* Not a tag we recognize.  Hopefully we aren't processing
  	     trash data, but since we must specifically ignore things
-@@ -8618,8 +9236,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8625,8 +9371,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
        /* For the benefit of old versions of GCC, check for anonymous
  	 namespaces based on the demangled name.  */
        if (!processing_has_namespace_info
@@ -5105,7 +5648,7 @@ index 86bfecb..ddf2189 100644
  	cp_scan_for_anonymous_namespaces (sym);
      }
    return (sym);
-@@ -8931,12 +9548,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -8938,12 +9683,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
      case DW_TAG_namespace:
        this_type = read_namespace_type (die, cu);
        break;
@@ -5124,7 +5667,18 @@ index 86bfecb..ddf2189 100644
    return this_type;
  }
  
-@@ -9018,10 +9641,103 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
+@@ -9011,6 +9762,10 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
+       case DW_TAG_namespace:
+ 	parent_type = read_type_die (parent, cu);
+ 	/* We give a name to even anonymous namespaces.  */
++
++	/* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::".  */
++	if (strcmp (TYPE_TAG_NAME (parent_type), "::") == 0)
++	  return "";
+ 	return TYPE_TAG_NAME (parent_type);
+       case DW_TAG_class_type:
+       case DW_TAG_interface_type:
+@@ -9025,7 +9780,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
  	     So it does not need a prefix.  */
  	  return "";
        default:
@@ -5133,233 +5687,64 @@ index 86bfecb..ddf2189 100644
        }
  }
  
-+/* Determines the prefix for a symbol's physname.  Unlike determine_prefix,
-+   this method does not simply look at the DIE's immediate parent.
-+   It will compute the symbol's physname by scanning through all parent
-+   DIEs until it gets to the compilation unit's DIE.  */
-+
-+static char *
-+physname_prefix (struct die_info *die, struct dwarf2_cu *cu)
-+{
-+  long length;
-+  struct ui_file *buf;
-+  struct die_info *d, *spec_die;
-+  struct dwarf2_cu *spec_cu;
+@@ -9078,17 +9833,37 @@ sibling_die (struct die_info *die)
+   return die->sibling;
+ }
+ 
+-/* Get linkage name of a die, return NULL if not found.  */
++/* Return the fully qualified .symtab name for symbols contained in Fortran
++   modules.  Return DWARF2_NAME otherwise.  */
+ 
+ static char *
+-dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
++fortran_module_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
+ {
+-  struct attribute *attr;
 +  char *name;
 +
-+  /* Construct a stack containing all of the DIE's parents.  Caution
-+     must be observed for dealing with DW_AT_specification. */
-+  spec_cu = cu;
-+  spec_die = die_specification (die, &spec_cu);
-+  if (spec_die != NULL)
-+    d = spec_die->parent;
-+  else
-+    d = die->parent;
-+  while (d != NULL && d->tag != DW_TAG_compile_unit)
-+    {
-+      struct attribute *attr;
-+
-+      spec_die = die_specification (d, &spec_cu);
-+      if (spec_die != NULL)
-+	d = spec_die;
++  gdb_assert (cu->language == language_fortran);
 +
-+      VEC_quick_push (die_info_p, die_list, d);
-+      d = d->parent;
-+    }
++  name = dwarf2_name (die, cu);
 +
-+  /* Now pop all the elements, printing their names as we go.  */
-+  buf = mem_fileopen ();
-+  while (!VEC_empty (die_info_p, die_list))
++  if (name && die->parent && die->parent->tag == DW_TAG_module)
 +    {
-+      d = VEC_pop (die_info_p, die_list);
-+      physname_prefix_1 (buf, d, cu);
++      char *module_name = dwarf2_name (die->parent, cu);
 +
-+      if (!VEC_empty (die_info_p, die_list))
++      if (module_name)
 +	{
-+	  if (cu->language == language_cplus)
-+	    fputs_unfiltered ("::", buf);
-+	  else
-+	    fputs_unfiltered (".", buf);
++	  char *retval;
+ 
+-  attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+-  if (attr && DW_STRING (attr))
+-    return DW_STRING (attr);
+-  return dwarf2_name (die, cu);
++	  /* `__modulename_MOD_variablename0'.  */
++	  retval = obstack_alloc (&cu->objfile->objfile_obstack,
++				  2 + strlen (module_name) + 5 + strlen (name)
++				  + 1);
++	  sprintf (retval, "__%s_MOD_%s", module_name, name);
++
++	  return retval;
 +	}
 +    }
 +
-+  name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack, &length);
-+  ui_file_delete (buf);
 +  return name;
-+}
+ }
+ 
+ /* Get name of a die, return NULL if not found.  */
+@@ -11436,64 +12211,94 @@ attr_form_is_constant (struct attribute *attr)
+     }
+ }
+ 
++/* Convert DW_BLOCK into struct dwarf2_locexpr_baton.  ATTR must be a DW_BLOCK
++   attribute type.  */
 +
-+static void
-+physname_prefix_1 (struct ui_file *buf, struct die_info *die,
-+		   struct dwarf2_cu *cu)
++static struct dwarf2_locexpr_baton *
++dwarf2_attr_to_locexpr_baton (struct attribute *attr, struct dwarf2_cu *cu)
 +{
-+  const char *name = NULL;
-+  gdb_assert (buf != NULL);
++  struct dwarf2_locexpr_baton *baton;
 +
-+  if (die != NULL)
-+    {
-+      switch (die->tag)
-+	{
-+	case DW_TAG_namespace:
-+	  name = dwarf2_name (die, cu);
-+	  if (name == NULL)
-+	    name = "(anonymous namespace)";
-+	  /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::".  */
-+	  else if (strcmp (name, "::") == 0)
-+	    name = NULL;
-+	  break;
-+
-+	case DW_TAG_class_type:
-+	case DW_TAG_structure_type:
-+	case DW_TAG_union_type:
-+	case DW_TAG_enumeration_type:
-+	case DW_TAG_interface_type:
-+	case DW_TAG_subprogram:
-+	  name = dwarf2_name (die, cu);
-+	  break;
-+
-+	default:
-+	  break;
-+	}
-+    }
-+
-+  if (name != NULL)
-+    fputs_unfiltered (name, buf);
-+}
-+
- /* Return a newly-allocated string formed by concatenating PREFIX and
-    SUFFIX with appropriate separator.  If PREFIX or SUFFIX is NULL or empty, then
-    simply copy the SUFFIX or PREFIX, respectively.  If OBS is non-null,
-@@ -9071,17 +9787,111 @@ sibling_die (struct die_info *die)
-   return die->sibling;
- }
- 
--/* Get linkage name of a die, return NULL if not found.  */
-+/* Construct a physname for the given DIE in CU. */
- 
- static char *
--dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
-+dwarf2_physname (struct die_info *die, struct dwarf2_cu *cu)
- {
-   struct attribute *attr;
-+  char *name;
- 
--  attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
--  if (attr && DW_STRING (attr))
--    return DW_STRING (attr);
--  return dwarf2_name (die, cu);
-+  name = dwarf2_name (die, cu);
-+
-+  /* These are the only languages we know how to qualify names in.  */
-+  if (cu->language != language_cplus
-+      && cu->language != language_java)
-+    return name;
-+
-+  if (die_needs_namespace (die, cu))
-+    {
-+      long length;
-+      char *prefix;
-+      struct ui_file *buf;
-+
-+      prefix = physname_prefix (die, cu);
-+      buf = mem_fileopen ();
-+      if (*prefix != '\0')
-+	{
-+	  char *prefixed_name = typename_concat (NULL, prefix, name, cu);
-+	  fputs_unfiltered (prefixed_name, buf);
-+	  xfree (prefixed_name);
-+	}
-+      else
-+	fputs_unfiltered (name ? name : "", buf);
-+
-+      /* For Java and C++ methods, append formal parameter type
-+	 information. */
-+      if ((cu->language == language_cplus || cu->language == language_java)
-+	  && die->tag == DW_TAG_subprogram)
-+	{
-+	  struct type *type = read_type_die (die, cu);
-+
-+	  c_type_print_args (type, buf, 0, cu->language);
-+
-+	  if (cu->language == language_java)
-+	    {
-+	      /* For java, we must append the return type to method names. */
-+	      if (die->tag == DW_TAG_subprogram)
-+		java_print_type (TYPE_TARGET_TYPE (type), "", buf, 0, 0);
-+	    }
-+	  else if (cu->language == language_cplus)
-+	    {
-+	      /* c_type_print_args adds argument types, but it does
-+		 not add any necessary "const". */
-+	      if (TYPE_NFIELDS (type) > 0 && TYPE_FIELD_ARTIFICIAL (type, 0)
-+		  && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0))))
-+		fputs_unfiltered (" const", buf);
-+	    }
-+	}
-+
-+      name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack,
-+				   &length);
-+      ui_file_delete (buf);
-+
-+      if (cu->language == language_cplus)
-+	{
-+	  char *cname
-+	    = dwarf2_canonicalize_name (name, cu,
-+					&cu->objfile->objfile_obstack);
-+	  if (cname != NULL)
-+	    name = cname;
-+	}
-+    }
-+
-+  return name;
-+}
-+
-+/* Return the fully qualified .symtab name for symbols contained in Fortran
-+   modules.  Return DWARF2_NAME otherwise.  */
-+
-+static char *
-+fortran_module_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
-+{
-+  char *name;
-+
-+  gdb_assert (cu->language == language_fortran);
-+
-+  name = dwarf2_name (die, cu);
-+
-+  if (name && die->parent && die->parent->tag == DW_TAG_module)
-+    {
-+      char *module_name = dwarf2_name (die->parent, cu);
-+
-+      if (module_name)
-+	{
-+	  char *retval;
-+
-+	  /* `__modulename_MOD_variablename0'.  */
-+	  retval = obstack_alloc (&cu->objfile->objfile_obstack,
-+				  2 + strlen (module_name) + 5 + strlen (name)
-+				  + 1);
-+	  sprintf (retval, "__%s_MOD_%s", module_name, name);
-+
-+	  return retval;
-+	}
-+    }
-+
-+  return name;
- }
- 
- /* Get name of a die, return NULL if not found.  */
-@@ -11429,6 +12239,34 @@ attr_form_is_constant (struct attribute *attr)
-     }
- }
- 
-+/* Convert DW_BLOCK into struct dwarf2_locexpr_baton.  ATTR must be a DW_BLOCK
-+   attribute type.  */
-+
-+static struct dwarf2_locexpr_baton *
-+dwarf2_attr_to_locexpr_baton (struct attribute *attr, struct dwarf2_cu *cu)
-+{
-+  struct dwarf2_locexpr_baton *baton;
-+
-+  gdb_assert (attr_form_is_block (attr));
++  gdb_assert (attr_form_is_block (attr));
 +
 +  baton = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (*baton));
 +  baton->per_cu = cu->per_cu;
@@ -5377,20 +5762,76 @@ index 86bfecb..ddf2189 100644
 +  return baton;
 +}
 +
++static struct dwarf2_loclist_baton *
++dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
++{
++  struct dwarf2_loclist_baton *baton;
++
++  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
++	   other branch.  */
++	&& DW_UNSND (attr) < dwarf2_per_objfile->loc.size))
++    return NULL;
++
++  baton = obstack_alloc (&cu->objfile->objfile_obstack,
++			 sizeof (struct dwarf2_loclist_baton));
++  baton->per_cu = cu->per_cu;
++  gdb_assert (baton->per_cu);
++
++  /* We don't know how long the location list is, but make sure we
++     don't run off the edge of the section.  */
++  baton->size = dwarf2_per_objfile->loc.size - DW_UNSND (attr);
++  baton->data = dwarf2_per_objfile->loc.buffer + DW_UNSND (attr);
++  baton->base_address = cu->base_address;
++  if (cu->base_known == 0)
++    complaint (&symfile_complaints,
++	       _("Location list used without specifying the CU base address."));
++
++  return baton;
++}
++
 +/* SYM may get its SYMBOL_CLASS overriden on invalid ATTR content.  */
 +
  static void
  dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
  			     struct dwarf2_cu *cu)
-@@ -11458,35 +12296,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+ {
+-  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
+-	 other branch.  */
+-      && DW_UNSND (attr) < dwarf2_per_objfile->loc.size)
+-    {
+-      struct dwarf2_loclist_baton *baton;
+-
+-      baton = obstack_alloc (&cu->objfile->objfile_obstack,
+-			     sizeof (struct dwarf2_loclist_baton));
+-      baton->per_cu = cu->per_cu;
+-      gdb_assert (baton->per_cu);
+-
+-      /* We don't know how long the location list is, but make sure we
+-	 don't run off the edge of the section.  */
+-      baton->size = dwarf2_per_objfile->loc.size - DW_UNSND (attr);
+-      baton->data = dwarf2_per_objfile->loc.buffer + DW_UNSND (attr);
+-      baton->base_address = cu->base_address;
+-      if (cu->base_known == 0)
+-	complaint (&symfile_complaints,
+-		   _("Location list used without specifying the CU base address."));
++  struct dwarf2_loclist_baton *loclist_baton;
+ 
++  loclist_baton = dwarf2_attr_to_loclist_baton (attr, cu);
++  if (loclist_baton)
++    {
        SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs;
-       SYMBOL_LOCATION_BATON (sym) = baton;
-     }
+-      SYMBOL_LOCATION_BATON (sym) = baton;
++      SYMBOL_LOCATION_BATON (sym) = loclist_baton;
++    }
 +  else if (attr_form_is_block (attr))
 +    {
 +      SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs;
 +      SYMBOL_LOCATION_BATON (sym) = dwarf2_attr_to_locexpr_baton (attr, cu);
-+    }
+     }
    else
      {
 -      struct dwarf2_locexpr_baton *baton;
@@ -5433,7 +5874,7 @@ index 86bfecb..ddf2189 100644
      }
  }
  
-@@ -11774,6 +12602,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
+@@ -11781,6 +12586,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
    return ofs_lhs->offset == ofs_rhs->offset;
  }
  
@@ -5465,7 +5906,7 @@ index 86bfecb..ddf2189 100644
  /* Set the type associated with DIE to TYPE.  Save it in CU's hash
     table if necessary.  For convenience, return TYPE.  */
  
-@@ -11782,6 +12635,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -11789,6 +12619,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  {
    struct dwarf2_offset_and_type **slot, ofs;
  
@@ -5474,7 +5915,7 @@ index 86bfecb..ddf2189 100644
    /* For Ada types, make sure that the gnat-specific data is always
       initialized (if not already set).  There are a few types where
       we should not be doing so, because the type-specific area is
-@@ -11937,23 +12792,13 @@ show_dwarf2_cmd (char *args, int from_tty)
+@@ -11944,23 +12776,13 @@ show_dwarf2_cmd (char *args, int from_tty)
    cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
  }
  
@@ -5502,7 +5943,7 @@ index 86bfecb..ddf2189 100644
  }
  
  /* munmap debug sections for OBJFILE, if necessary.  */
-@@ -11962,15 +12807,15 @@ static void
+@@ -11969,15 +12791,15 @@ static void
  dwarf2_per_objfile_free (struct objfile *objfile, void *d)
  {
    struct dwarf2_per_objfile *data = d;
@@ -5527,16 +5968,8 @@ index 86bfecb..ddf2189 100644
  }
  
  void _initialize_dwarf2_read (void);
-@@ -11978,6 +12823,7 @@ void _initialize_dwarf2_read (void);
- void
- _initialize_dwarf2_read (void)
- {
-+  die_list = VEC_alloc (die_info_p, 32);
-   dwarf2_objfile_data_key
-     = register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free);
- 
 diff --git a/gdb/elfread.c b/gdb/elfread.c
-index 78e9163..dc8a752 100644
+index 9a2a1e3..72b1d13 100644
 --- a/gdb/elfread.c
 +++ b/gdb/elfread.c
 @@ -179,7 +179,8 @@ record_minimal_symbol (const char *name, int name_len, int copy_name,
@@ -5615,7 +6048,7 @@ index 78e9163..dc8a752 100644
    default_symfile_offsets,	/* sym_offsets:  Translate ext. to int. relocation */
    elf_symfile_segments,		/* sym_segments: Get segment information from
 diff --git a/gdb/eval.c b/gdb/eval.c
-index a0556cf..abe6a06 100644
+index e2ceea7..1bcb4a7 100644
 --- a/gdb/eval.c
 +++ b/gdb/eval.c
 @@ -43,6 +43,7 @@
@@ -5631,10 +6064,18 @@ index a0556cf..abe6a06 100644
    struct type **arg_types;
    int save_pos1;
 +  struct cleanup *old_chain;
+   struct symbol *function = NULL;
+   char *function_name = NULL;
  
-   pc = (*pos)++;
-   op = exp->elts[pc].opcode;
-@@ -1332,7 +1334,6 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -731,6 +733,7 @@ evaluate_subexp_standard (struct type *expect_type,
+       return value_from_decfloat (exp->elts[pc + 1].type,
+ 				  exp->elts[pc + 2].decfloatconst);
+ 
++    case OP_ADL_FUNC:
+     case OP_VAR_VALUE:
+       (*pos) += 3;
+       if (noside == EVAL_SKIP)
+@@ -1334,7 +1337,6 @@ evaluate_subexp_standard (struct type *expect_type,
        argvec = (struct value **) alloca (sizeof (struct value *) * (nargs + 3));
        if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
  	{
@@ -5642,7 +6083,7 @@ index a0556cf..abe6a06 100644
  	  /* First, evaluate the structure into arg2 */
  	  pc2 = (*pos)++;
  
-@@ -1356,21 +1357,40 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1358,21 +1360,40 @@ evaluate_subexp_standard (struct type *expect_type,
  
  	  arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
  
@@ -5695,7 +6136,71 @@ index a0556cf..abe6a06 100644
  	}
        else if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
  	{
-@@ -1496,8 +1516,7 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1412,6 +1433,17 @@ evaluate_subexp_standard (struct type *expect_type,
+ 	  /* Now, say which argument to start evaluating from */
+ 	  tem = 2;
+ 	}
++      else if (op == OP_ADL_FUNC)
++        {
++          /* Save the function position and move pos so that the arguments
++             can be evaluated. */
++          int func_name_len;
++          save_pos1 = *pos;
++          tem = 1;
++
++          func_name_len = longest_to_int (exp->elts[save_pos1 + 3].longconst);
++          (*pos) += 6 + BYTES_TO_EXP_ELEM (func_name_len + 1);
++        }
+       else if (op == OP_SCOPE
+ 	       && overload_resolution
+ 	       && (exp->language_defn->la_language == language_cplus))
+@@ -1433,9 +1465,9 @@ evaluate_subexp_standard (struct type *expect_type,
+ 	  if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
+ 	    {
+ 	      function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type),
+-						     name, NULL,
++						     name,
+ 						     get_selected_block (0),
+-						     VAR_DOMAIN, 1);
++						     VAR_DOMAIN);
+ 	      if (function == NULL)
+ 		error (_("No symbol \"%s\" in namespace \"%s\"."), 
+ 		       name, TYPE_TAG_NAME (type));
+@@ -1484,6 +1516,33 @@ evaluate_subexp_standard (struct type *expect_type,
+       /* signal end of arglist */
+       argvec[tem] = 0;
+ 
++      if (op == OP_ADL_FUNC)
++        {
++          struct symbol *symp;
++          char *func_name;
++          int  name_len;
++          int string_pc = save_pos1 + 3;
++
++          /* Extract the function name.  */
++          name_len = longest_to_int (exp->elts[string_pc].longconst);
++          func_name = (char *) alloca (name_len + 1);
++          strcpy (func_name, &exp->elts[string_pc + 1].string);
++
++          /* Prepare list of argument types for overload resolution */
++          arg_types = (struct type **) alloca (nargs * (sizeof (struct type *)));
++          for (ix = 1; ix <= nargs; ix++)
++            arg_types[ix - 1] = value_type (argvec[ix]);
++
++          find_overload_match (arg_types, nargs, func_name,
++                               0 /* not method */ , 0 /* strict match */ ,
++                               NULL, NULL /* pass NULL symbol since symbol is unknown */ ,
++                               NULL, &symp, NULL);
++
++          /* Now fix the expression being evaluated */
++          exp->elts[save_pos1 + 2].symbol = symp;
++          argvec[0] = evaluate_subexp_with_coercion (exp, &save_pos1, noside);
++        }
++
+       if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR
+ 	  || (op == OP_SCOPE && function_name != NULL))
+ 	{
+@@ -1552,8 +1611,7 @@ evaluate_subexp_standard (struct type *expect_type,
  	}
        else if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
  	{
@@ -5703,9 +6208,9 @@ index a0556cf..abe6a06 100644
 -	  argvec[0] = arg1;
 +	  /* Pointer to member.  argvec is already set up.  */
  	}
-       else if (op == OP_VAR_VALUE)
+       else if (op == OP_VAR_VALUE || (op == OP_SCOPE && function != NULL))
  	{
-@@ -1588,6 +1607,8 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1653,6 +1711,8 @@ evaluate_subexp_standard (struct type *expect_type,
  
        /* First determine the type code we are dealing with.  */
        arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
@@ -5714,7 +6219,7 @@ index a0556cf..abe6a06 100644
        type = check_typedef (value_type (arg1));
        code = TYPE_CODE (type);
  
-@@ -1608,6 +1629,7 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1673,6 +1733,7 @@ evaluate_subexp_standard (struct type *expect_type,
  	      code = TYPE_CODE (type);
  	    }
  	} 
@@ -5722,7 +6227,7 @@ index a0556cf..abe6a06 100644
  
        switch (code)
  	{
-@@ -1769,6 +1791,27 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1834,6 +1895,26 @@ evaluate_subexp_standard (struct type *expect_type,
        xfree (expect_type);
        return arg1;
  
@@ -5732,7 +6237,6 @@ index a0556cf..abe6a06 100644
 +	struct symbol *sym;
 +	struct type **arg_types;
 +	(*pos) += 3;
-+	printf ("TYPE_INSTANCE_LOOKUP\n");
 +	arg_types = (struct type **) alloca (TYPE_NFIELDS (expect_type)
 +					     * sizeof (struct type *));
 +	for (i = 0; i < TYPE_NFIELDS (expect_type); ++i)
@@ -5750,7 +6254,7 @@ index a0556cf..abe6a06 100644
      case BINOP_CONCAT:
        arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
        arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-@@ -2040,13 +2083,19 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2105,13 +2186,19 @@ evaluate_subexp_standard (struct type *expect_type,
        {
  	int subscript_array[MAX_FORTRAN_DIMS];
  	int array_size_array[MAX_FORTRAN_DIMS];
@@ -5770,7 +6274,7 @@ index a0556cf..abe6a06 100644
  	tmp_type = check_typedef (value_type (arg1));
  	ndimensions = calc_f77_array_dims (type);
  
-@@ -2076,6 +2125,9 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2141,6 +2228,9 @@ evaluate_subexp_standard (struct type *expect_type,
  	    upper = f77_get_upperbound (tmp_type);
  	    lower = f77_get_lowerbound (tmp_type);
  
@@ -5780,7 +6284,7 @@ index a0556cf..abe6a06 100644
  	    array_size_array[nargs - i - 1] = upper - lower + 1;
  
  	    /* Zero-normalize subscripts so that offsetting will work. */
-@@ -2094,13 +2146,25 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2159,13 +2249,25 @@ evaluate_subexp_standard (struct type *expect_type,
  	      tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
  	  }
  
@@ -5810,7 +6314,7 @@ index a0556cf..abe6a06 100644
  
  	/* Let us now play a dirty trick: we will take arg1 
  	   which is a value node pointing to the topmost level
-@@ -2110,7 +2174,7 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2175,7 +2277,7 @@ evaluate_subexp_standard (struct type *expect_type,
  	   returns the correct type value */
  
  	deprecated_set_value_type (arg1, tmp_type);
@@ -5819,7 +6323,7 @@ index a0556cf..abe6a06 100644
        }
  
      case BINOP_LOGICAL_AND:
-@@ -2344,14 +2408,22 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2409,14 +2511,22 @@ evaluate_subexp_standard (struct type *expect_type,
        if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
  	expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
        arg1 = evaluate_subexp (expect_type, exp, pos, noside);
@@ -5844,7 +6348,7 @@ index a0556cf..abe6a06 100644
        else if (noside == EVAL_AVOID_SIDE_EFFECTS)
  	{
  	  type = check_typedef (value_type (arg1));
-@@ -2360,12 +2432,18 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2425,12 +2535,18 @@ evaluate_subexp_standard (struct type *expect_type,
  	  /* In C you can dereference an array to get the 1st elt.  */
  	      || TYPE_CODE (type) == TYPE_CODE_ARRAY
  	    )
@@ -5868,7 +6372,7 @@ index a0556cf..abe6a06 100644
  	  else
  	    error (_("Attempt to take contents of a non-pointer value."));
  	}
-@@ -2375,9 +2453,14 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2440,9 +2556,14 @@ evaluate_subexp_standard (struct type *expect_type,
  	 do.  "long long" variables are rare enough that
  	 BUILTIN_TYPE_LONGEST would seem to be a mistake.  */
        if (TYPE_CODE (type) == TYPE_CODE_INT)
@@ -5886,7 +6390,7 @@ index a0556cf..abe6a06 100644
  
      case UNOP_ADDR:
        /* C++: check for and handle pointer to members.  */
-@@ -2712,7 +2795,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -2777,7 +2898,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
  {
    enum exp_opcode op;
    int pc;
@@ -5895,7 +6399,7 @@ index a0556cf..abe6a06 100644
    struct symbol *var;
    struct type *type;
  
-@@ -2723,12 +2806,17 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -2788,12 +2909,17 @@ evaluate_subexp_with_coercion (struct expression *exp,
      {
      case OP_VAR_VALUE:
        var = exp->elts[pc + 2].symbol;
@@ -5914,7 +6418,7 @@ index a0556cf..abe6a06 100644
  	  return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
  			     val);
  	}
-@@ -2780,9 +2868,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
+@@ -2845,9 +2971,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
  
      case OP_VAR_VALUE:
        (*pos) += 4;
@@ -5931,8 +6435,21 @@ index a0556cf..abe6a06 100644
  
      default:
        val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+diff --git a/gdb/expprint.c b/gdb/expprint.c
+index e378831..45deffe 100644
+--- a/gdb/expprint.c
++++ b/gdb/expprint.c
+@@ -816,6 +816,8 @@ op_name_standard (enum exp_opcode opcode)
+       return "OP_TYPE";
+     case OP_LABELED:
+       return "OP_LABELED";
++    case OP_ADL_FUNC:
++      return "OP_ADL_FUNC";
+     }
+ }
+ 
 diff --git a/gdb/expression.h b/gdb/expression.h
-index ca216cf..2195fef 100644
+index ca216cf..6be0b1e 100644
 --- a/gdb/expression.h
 +++ b/gdb/expression.h
 @@ -95,6 +95,11 @@ enum exp_opcode
@@ -5947,7 +6464,18 @@ index ca216cf..2195fef 100644
      /* end of C++.  */
  
      /* For Modula-2 integer division DIV */
-@@ -451,4 +456,5 @@ extern char *op_string (enum exp_opcode);
+@@ -347,6 +352,10 @@ enum exp_opcode
+        Then comes another OP_DECFLOAT.  */
+     OP_DECFLOAT,
+ 
++    /* OP_ADL_FUNC specifies that the argument is to be looked up in an
++       Argument Dependent manner (Koenig lookup) */
++    OP_ADL_FUNC,
++
+      /* First extension operator.  Individual language modules define
+ 	extra operators in *.inc include files below always starting with
+ 	numbering at OP_EXTENDED0:
+@@ -451,4 +460,5 @@ extern char *op_string (enum exp_opcode);
  extern void dump_raw_expression (struct expression *, struct ui_file *, char *);
  extern void dump_prefix_expression (struct expression *, struct ui_file *);
  
@@ -6749,7 +7277,7 @@ index cd24eaf..119af7d 100644
     once for each known thread.  */
  typedef int (*thread_callback_func) (struct thread_info *, void *);
 diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
-index 46846c4..bf6e891 100644
+index 46846c4..95bcca4 100644
 --- a/gdb/gdbtypes.c
 +++ b/gdb/gdbtypes.c
 @@ -39,6 +39,9 @@
@@ -6878,8 +7406,8 @@ index 46846c4..bf6e891 100644
 +  /* DWARF blocks may depend on runtime information like
 +     DW_OP_PUSH_OBJECT_ADDRESS not being available during the
 +     CREATE_ARRAY_TYPE time.  */
-+  if (TYPE_LOW_BOUND_IS_DWARF_BLOCK (range_type)
-+      || TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type)
++  if (TYPE_RANGE_DATA (range_type)->low.kind != RANGE_BOUND_KIND_CONSTANT
++      || TYPE_RANGE_DATA (range_type)->high.kind != RANGE_BOUND_KIND_CONSTANT
 +      || TYPE_LOW_BOUND_UNDEFINED (range_type) 
 +      || TYPE_HIGH_BOUND_UNDEFINED (range_type) 
 +      || get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
@@ -7211,7 +7739,7 @@ index 46846c4..bf6e891 100644
    if (TYPE_NAME (type))
      TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
    if (TYPE_TAG_NAME (type))
-@@ -3053,12 +3241,45 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3053,12 +3241,48 @@ copy_type_recursive (struct objfile *objfile,
    TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
    TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
  
@@ -7252,12 +7780,15 @@ index 46846c4..bf6e891 100644
      {
        int i, nfields;
  
++      /* TYPE_CODE_RANGE uses TYPE_RANGE_DATA of the union with TYPE_FIELDS.  */
++      gdb_assert (TYPE_CODE (type) != TYPE_CODE_RANGE);
++
        nfields = TYPE_NFIELDS (type);
 +      TYPE_NFIELDS (new_type) = nfields;
        TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field);
        for (i = 0; i < nfields; i++)
  	{
-@@ -3067,8 +3288,8 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3067,8 +3291,8 @@ copy_type_recursive (struct objfile *objfile,
  	  TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
  	  if (TYPE_FIELD_TYPE (type, i))
  	    TYPE_FIELD_TYPE (new_type, i)
@@ -7268,7 +7799,7 @@ index 46846c4..bf6e891 100644
  	  if (TYPE_FIELD_NAME (type, i))
  	    TYPE_FIELD_NAME (new_type, i) = 
  	      xstrdup (TYPE_FIELD_NAME (type, i));
-@@ -3095,24 +3316,75 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3095,24 +3319,166 @@ copy_type_recursive (struct objfile *objfile,
  	}
      }
  
@@ -7277,55 +7808,147 @@ index 46846c4..bf6e891 100644
 +  TYPE_DYNAMIC (new_type) = 0;
 +
    /* For range types, copy the bounds information. */
-   if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+-  if (TYPE_CODE (type) == TYPE_CODE_RANGE)
++  if (TYPE_CODE (new_type) == TYPE_CODE_RANGE)
      {
        TYPE_RANGE_DATA (new_type) = xmalloc (sizeof (struct range_bounds));
        *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
 +
-+      if (TYPE_LOW_BOUND_IS_DWARF_BLOCK (type))
++      switch (TYPE_RANGE_DATA (new_type)->low.kind)
 +	{
++	case RANGE_BOUND_KIND_CONSTANT:
++	  break;
++	case RANGE_BOUND_KIND_DWARF_BLOCK:
 +	  /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
-+	     it is expected to be made constant by CHECK_TYPEDEF.  */
-+	  if (TYPE_NOT_ALLOCATED (type)
-+	      || TYPE_NOT_ASSOCIATED (type))
-+	    TYPE_RANGE_DATA (new_type)->low.u.dwarf_block = NULL;
++	     it is expected to be made constant by CHECK_TYPEDEF.
++	     TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++	     */
++	  if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
++	      || ! has_stack_frames ())
++	    {
++	      /* We should set 1 for Fortran but how to find the language?  */
++	      TYPE_LOW_BOUND (new_type) = 0;
++	      TYPE_LOW_BOUND_UNDEFINED (new_type) = 1;
++	    }
 +	  else
 +	    TYPE_LOW_BOUND (new_type) = dwarf_locexpr_baton_eval
 +				(TYPE_RANGE_DATA (new_type)->low.u.dwarf_block);
-+	  TYPE_LOW_BOUND_IS_DWARF_BLOCK (new_type) = 0;
++	  TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT;
++	  break;
++	case RANGE_BOUND_KIND_DWARF_LOCLIST:
++	  {
++	    CORE_ADDR addr;
++
++	    /* `struct dwarf2_loclist_baton' is too bound to its objfile so
++	       it is expected to be made constant by CHECK_TYPEDEF.
++	       TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++	       */
++	    if (! TYPE_NOT_ALLOCATED (new_type)
++	        && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()
++	        && dwarf_loclist_baton_eval
++		  (TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.loclist,
++		   TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.type, &addr))
++	      TYPE_LOW_BOUND (new_type) = addr;
++	    else
++	      {
++		/* We should set 1 for Fortran but how to find the language?  */
++		TYPE_LOW_BOUND (new_type) = 0;
++		TYPE_LOW_BOUND_UNDEFINED (new_type) = 1;
++	      }
++	    TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT;
++	  }
++	  break;
 +	}
 +
-+      if (TYPE_HIGH_BOUND_IS_DWARF_BLOCK (type))
++      switch (TYPE_RANGE_DATA (new_type)->high.kind)
 +	{
++	case RANGE_BOUND_KIND_CONSTANT:
++	  break;
++	case RANGE_BOUND_KIND_DWARF_BLOCK:
 +	  /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
-+	     it is expected to be made constant by CHECK_TYPEDEF.  */
-+	  if (TYPE_NOT_ALLOCATED (type)
-+	      || TYPE_NOT_ASSOCIATED (type))
-+	    TYPE_RANGE_DATA (new_type)->high.u.dwarf_block = NULL;
++	     it is expected to be made constant by CHECK_TYPEDEF.
++	     TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++	     */
++	  if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
++	      || ! has_stack_frames ())
++	    {
++	      TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1;
++	      TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1;
++	    }
 +	  else
 +	    TYPE_HIGH_BOUND (new_type) = dwarf_locexpr_baton_eval
 +			       (TYPE_RANGE_DATA (new_type)->high.u.dwarf_block);
-+	  TYPE_HIGH_BOUND_IS_DWARF_BLOCK (new_type) = 0;
++	  TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT;
++	  break;
++	case RANGE_BOUND_KIND_DWARF_LOCLIST:
++	  {
++	    CORE_ADDR addr;
++
++	    /* `struct dwarf2_loclist_baton' is too bound to its objfile so
++	       it is expected to be made constant by CHECK_TYPEDEF.
++	       TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++	       */
++	    if (! TYPE_NOT_ALLOCATED (new_type)
++	        && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()
++	        && dwarf_loclist_baton_eval
++		      (TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.loclist,
++		       TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.type,
++		       &addr))
++	      TYPE_HIGH_BOUND (new_type) = addr;
++	    else
++	      {
++		TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1;
++		TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1;
++	      }
++	    TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT;
++	  }
++	  break;
 +	}
 +
-+      if (TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (type))
++      switch (TYPE_RANGE_DATA (new_type)->byte_stride.kind)
 +	{
++	case RANGE_BOUND_KIND_CONSTANT:
++	  break;
++	case RANGE_BOUND_KIND_DWARF_BLOCK:
 +	  /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
-+	     it is expected to be made constant by CHECK_TYPEDEF.  */
-+	  if (TYPE_NOT_ALLOCATED (type)
-+	      || TYPE_NOT_ASSOCIATED (type))
-+	    TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block = NULL;
++	     it is expected to be made constant by CHECK_TYPEDEF.
++	     TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++	     */
++	  if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
++	      || ! has_stack_frames ())
++	    TYPE_BYTE_STRIDE (new_type) = 0;
 +	  else
 +	    TYPE_BYTE_STRIDE (new_type) = dwarf_locexpr_baton_eval
 +			(TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block);
-+	  TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (new_type) = 0;
++	  TYPE_RANGE_DATA (new_type)->byte_stride.kind
++	    = RANGE_BOUND_KIND_CONSTANT;
++	  break;
++	case RANGE_BOUND_KIND_DWARF_LOCLIST:
++	  {
++	    CORE_ADDR addr = 0;
++
++	    /* `struct dwarf2_loclist_baton' is too bound to its objfile so
++	       it is expected to be made constant by CHECK_TYPEDEF.
++	       TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++	       */
++	    if (! TYPE_NOT_ALLOCATED (new_type)
++		&& ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ())
++	      dwarf_loclist_baton_eval
++	       (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.loclist,
++		TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.type,
++		&addr);
++	    TYPE_BYTE_STRIDE (new_type) = addr;
++	    TYPE_RANGE_DATA (new_type)->byte_stride.kind
++	      = RANGE_BOUND_KIND_CONSTANT;
++	  }
++	  break;
 +	}
 +
 +      /* Convert TYPE_RANGE_HIGH_BOUND_IS_COUNT into a regular bound.  */
-+      if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (type))
++      if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type))
 +	{
-+	  TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (type)
-+				       + TYPE_HIGH_BOUND (type) - 1;
++	  TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type)
++				       + TYPE_HIGH_BOUND (new_type) - 1;
 +	  TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type) = 0;
 +	}
      }
@@ -7350,7 +7973,7 @@ index 46846c4..bf6e891 100644
    /* Maybe copy the type_specific bits.
  
       NOTE drow/2005-12-09: We do not copy the C++-specific bits like
-@@ -3130,6 +3402,17 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3130,6 +3496,17 @@ copy_type_recursive (struct objfile *objfile,
    return new_type;
  }
  
@@ -7368,7 +7991,7 @@ index 46846c4..bf6e891 100644
  /* Make a copy of the given TYPE, except that the pointer & reference
     types are not preserved.
     
-@@ -3152,6 +3435,211 @@ copy_type (const struct type *type)
+@@ -3152,6 +3529,211 @@ copy_type (const struct type *type)
    return new_type;
  }
  
@@ -7580,7 +8203,7 @@ index 46846c4..bf6e891 100644
  
  /* Helper functions to initialize architecture-specific types.  */
  
-@@ -3475,6 +3963,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
+@@ -3475,6 +4057,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
      = lookup_pointer_type (builtin_type->builtin_void);
    builtin_type->builtin_func_ptr
      = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
@@ -7589,7 +8212,7 @@ index 46846c4..bf6e891 100644
  
    /* This type represents a GDB internal function.  */
    builtin_type->internal_fn
-@@ -3588,6 +4078,11 @@ objfile_type (struct objfile *objfile)
+@@ -3588,6 +4172,11 @@ objfile_type (struct objfile *objfile)
  		 "<text variable, no debug info>", objfile);
    TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
      = objfile_type->builtin_int;
@@ -7601,7 +8224,7 @@ index 46846c4..bf6e891 100644
    objfile_type->nodebug_data_symbol
      = init_type (TYPE_CODE_INT,
  		 gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
-@@ -3642,6 +4137,11 @@ void
+@@ -3642,6 +4231,11 @@ void
  _initialize_gdbtypes (void)
  {
    gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init);
@@ -7614,7 +8237,7 @@ index 46846c4..bf6e891 100644
  
    add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\
 diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
-index 643fa03..6381dcf 100644
+index 643fa03..efe5512 100644
 --- a/gdb/gdbtypes.h
 +++ b/gdb/gdbtypes.h
 @@ -138,6 +138,8 @@ enum type_code
@@ -7772,7 +8395,7 @@ index 643fa03..6381dcf 100644
        }
        loc;
  
-@@ -544,13 +615,22 @@ struct main_type
+@@ -544,13 +615,34 @@ struct main_type
  
      struct range_bounds
      {
@@ -7780,11 +8403,23 @@ index 643fa03..6381dcf 100644
 +	{
 +	  union
 +	    {
-+	      struct dwarf2_locexpr_baton *dwarf_block;
 +	      LONGEST constant;
++	      struct dwarf2_locexpr_baton *dwarf_block;
++	      struct
++		{
++		  struct dwarf2_loclist_baton *loclist;
++		  struct type *type;
++		}
++	      dwarf_loclist;
 +	    }
 +	  u;
-+	  unsigned is_dwarf_block : 1;
++	  enum range_bound_kind
++	    {
++	      RANGE_BOUND_KIND_CONSTANT,
++	      RANGE_BOUND_KIND_DWARF_BLOCK,
++	      RANGE_BOUND_KIND_DWARF_LOCLIST
++	    }
++	  kind;
 +	}
        /* Low bound of range. */
 -
@@ -7800,7 +8435,7 @@ index 643fa03..6381dcf 100644
  
        /* Flags indicating whether the values of low and high are
           valid.  When true, the respective range value is
-@@ -602,6 +682,9 @@ struct main_type
+@@ -602,6 +694,9 @@ struct main_type
         supporting multiple ABIs.  Right now this is only fetched from
         the Dwarf-2 DW_AT_calling_convention attribute.  */
      unsigned calling_convention;
@@ -7810,7 +8445,7 @@ index 643fa03..6381dcf 100644
    } type_specific;
  };
  
-@@ -838,13 +921,6 @@ struct cplus_struct_type
+@@ -838,13 +933,6 @@ struct cplus_struct_type
      int is_dynamic : 2;
    };
  
@@ -7824,7 +8459,7 @@ index 643fa03..6381dcf 100644
  /* Struct used for ranking a function for overload resolution */
  struct badness_vector
    {
-@@ -899,9 +975,9 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -899,9 +987,9 @@ extern void allocate_gnat_aux_type (struct type *);
  #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
  #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
  #define TYPE_CHAIN(thistype) (thistype)->chain
@@ -7837,7 +8472,7 @@ index 643fa03..6381dcf 100644
     calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe.  */
  #define TYPE_LENGTH(thistype) (thistype)->length
  /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
-@@ -910,15 +986,26 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -910,11 +998,16 @@ extern void allocate_gnat_aux_type (struct type *);
  #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
  #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
  #define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args
@@ -7856,26 +8491,7 @@ index 643fa03..6381dcf 100644
  #define TYPE_LOW_BOUND_UNDEFINED(range_type) \
     TYPE_RANGE_DATA(range_type)->low_undefined
  #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \
-    TYPE_RANGE_DATA(range_type)->high_undefined
-+#define TYPE_LOW_BOUND_IS_DWARF_BLOCK(range_type) \
-+   TYPE_RANGE_DATA(range_type)->low.is_dwarf_block
-+#define TYPE_HIGH_BOUND_IS_DWARF_BLOCK(range_type) \
-+   TYPE_RANGE_DATA(range_type)->high.is_dwarf_block
-+#define TYPE_BYTE_STRIDE_IS_DWARF_BLOCK(range_type) \
-+   TYPE_RANGE_DATA(range_type)->byte_stride.is_dwarf_block
- 
- /* Moto-specific stuff for FORTRAN arrays */
- 
-@@ -927,11 +1014,23 @@ extern void allocate_gnat_aux_type (struct type *);
- #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
-    TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
- 
-+#define TYPE_ARRAY_UPPER_BOUND_IS_DWARF_BLOCK(arraytype) \
-+   TYPE_HIGH_BOUND_IS_DWARF_BLOCK(TYPE_INDEX_TYPE(arraytype))
-+#define TYPE_ARRAY_LOWER_BOUND_IS_DWARF_BLOCK(arraytype) \
-+   TYPE_LOW_BOUND_IS_DWARF_BLOCK(TYPE_INDEX_TYPE(arraytype))
-+
- #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
+@@ -931,7 +1024,14 @@ extern void allocate_gnat_aux_type (struct type *);
     (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
  
  #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
@@ -7891,7 +8507,7 @@ index 643fa03..6381dcf 100644
  
  /* C++ */
  
-@@ -959,6 +1058,7 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -959,6 +1059,7 @@ extern void allocate_gnat_aux_type (struct type *);
  #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
  #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
  #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.calling_convention
@@ -7899,7 +8515,7 @@ index 643fa03..6381dcf 100644
  #define TYPE_BASECLASS(thistype,index) TYPE_FIELD_TYPE(thistype, index)
  #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
  #define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index)
-@@ -977,7 +1077,6 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -977,7 +1078,6 @@ extern void allocate_gnat_aux_type (struct type *);
  #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
  #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
  #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
@@ -7907,7 +8523,7 @@ index 643fa03..6381dcf 100644
  #define SET_FIELD_BITPOS(thisfld, bitpos)			\
    (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS,		\
     FIELD_BITPOS (thisfld) = (bitpos))
-@@ -987,9 +1086,6 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -987,9 +1087,6 @@ extern void allocate_gnat_aux_type (struct type *);
  #define SET_FIELD_PHYSADDR(thisfld, addr)			\
    (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR,		\
     FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -7917,7 +8533,7 @@ index 643fa03..6381dcf 100644
  #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
  #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
  
-@@ -1000,7 +1096,6 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -1000,7 +1097,6 @@ extern void allocate_gnat_aux_type (struct type *);
  #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))
  #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
@@ -7925,7 +8541,7 @@ index 643fa03..6381dcf 100644
  #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
  #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
  #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
-@@ -1139,6 +1234,10 @@ struct builtin_type
+@@ -1139,6 +1235,10 @@ struct builtin_type
       (*) () can server as a generic function pointer.  */
    struct type *builtin_func_ptr;
  
@@ -7936,7 +8552,7 @@ index 643fa03..6381dcf 100644
  
    /* Special-purpose types.  */
  
-@@ -1179,6 +1278,7 @@ struct objfile_type
+@@ -1179,6 +1279,7 @@ struct objfile_type
  
    /* Types used for symbols with no debug information.  */
    struct type *nodebug_text_symbol;
@@ -7944,7 +8560,7 @@ index 643fa03..6381dcf 100644
    struct type *nodebug_data_symbol;
    struct type *nodebug_unknown_symbol;
    struct type *nodebug_tls_symbol;
-@@ -1333,6 +1433,18 @@ extern struct type *create_array_type (struct type *, struct type *,
+@@ -1333,6 +1434,18 @@ extern struct type *create_array_type (struct type *, struct type *,
  				       struct type *);
  extern struct type *lookup_array_range_type (struct type *, int, int);
  
@@ -7963,7 +8579,7 @@ index 643fa03..6381dcf 100644
  extern struct type *create_string_type (struct type *, struct type *,
  					struct type *);
  extern struct type *lookup_string_range_type (struct type *, int, int);
-@@ -1375,6 +1487,8 @@ extern int is_public_ancestor (struct type *, struct type *);
+@@ -1375,6 +1488,8 @@ extern int is_public_ancestor (struct type *, struct type *);
  
  extern int is_unique_ancestor (struct type *, struct value *);
  
@@ -7972,7 +8588,7 @@ index 643fa03..6381dcf 100644
  /* Overload resolution */
  
  #define LENGTH_MATCH(bv) ((bv)->rank[0])
-@@ -1437,10 +1551,11 @@ extern void maintenance_print_type (char *, int);
+@@ -1437,10 +1552,11 @@ extern void maintenance_print_type (char *, int);
  
  extern htab_t create_copied_types_hash (struct objfile *objfile);
  
@@ -8258,10 +8874,10 @@ index e642894..6ac95cc 100644
      }
    else if (code == TYPE_CODE_INT)
 diff --git a/gdb/infcmd.c b/gdb/infcmd.c
-index f99a4ae..5599908 100644
+index 29cf427..0ec598e 100644
 --- a/gdb/infcmd.c
 +++ b/gdb/infcmd.c
-@@ -806,7 +806,7 @@ nexti_command (char *count_string, int from_tty)
+@@ -808,7 +808,7 @@ nexti_command (char *count_string, int from_tty)
    step_1 (1, 1, count_string);
  }
  
@@ -8270,7 +8886,7 @@ index f99a4ae..5599908 100644
  delete_longjmp_breakpoint_cleanup (void *arg)
  {
    int thread = * (int *) arg;
-@@ -846,10 +846,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
+@@ -848,10 +848,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
  
    if (!single_inst || skip_subroutines)		/* leave si command alone */
      {
@@ -8284,7 +8900,7 @@ index f99a4ae..5599908 100644
  
        make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
      }
-@@ -1198,6 +1201,15 @@ signal_command (char *signum_exp, int from_tty)
+@@ -1200,6 +1203,15 @@ signal_command (char *signum_exp, int from_tty)
    proceed ((CORE_ADDR) -1, oursig, 0);
  }
  
@@ -8300,7 +8916,7 @@ index f99a4ae..5599908 100644
  /* Proceed until we reach a different source line with pc greater than
     our current one or exit the function.  We skip calls in both cases.
  
-@@ -1214,6 +1226,8 @@ until_next_command (int from_tty)
+@@ -1216,6 +1228,8 @@ until_next_command (int from_tty)
    struct symbol *func;
    struct symtab_and_line sal;
    struct thread_info *tp = inferior_thread ();
@@ -8309,7 +8925,7 @@ index f99a4ae..5599908 100644
  
    clear_proceed_status ();
    set_step_frame ();
-@@ -1249,7 +1263,19 @@ until_next_command (int from_tty)
+@@ -1251,7 +1265,19 @@ until_next_command (int from_tty)
  
    tp->step_multi = 0;		/* Only one call to proceed */
  
@@ -8329,7 +8945,7 @@ index f99a4ae..5599908 100644
  }
  
  static void
-@@ -1426,6 +1452,7 @@ finish_command_continuation (void *arg)
+@@ -1428,6 +1454,7 @@ finish_command_continuation (void *arg)
    if (bs != NULL && tp->proceed_to_finish)
      observer_notify_normal_stop (bs, 1 /* print frame */);
    delete_breakpoint (a->breakpoint);
@@ -8337,7 +8953,7 @@ index f99a4ae..5599908 100644
  }
  
  static void
-@@ -1509,6 +1536,7 @@ finish_forward (struct symbol *function, struct frame_info *frame)
+@@ -1511,6 +1538,7 @@ finish_forward (struct symbol *function, struct frame_info *frame)
    struct breakpoint *breakpoint;
    struct cleanup *old_chain;
    struct finish_command_continuation_args *cargs;
@@ -8345,7 +8961,7 @@ index f99a4ae..5599908 100644
  
    sal = find_pc_line (get_frame_pc (frame), 0);
    sal.pc = get_frame_pc (frame);
-@@ -1519,6 +1547,10 @@ finish_forward (struct symbol *function, struct frame_info *frame)
+@@ -1521,6 +1549,10 @@ finish_forward (struct symbol *function, struct frame_info *frame)
  
    old_chain = make_cleanup_delete_breakpoint (breakpoint);
  
@@ -8370,7 +8986,7 @@ index e557d6c..d4ae1df 100644
  
  extern void notice_new_inferior (ptid_t, int, int);
 diff --git a/gdb/infrun.c b/gdb/infrun.c
-index 8307986..b4110a8 100644
+index 9a5c3a8..ed2f530 100644
 --- a/gdb/infrun.c
 +++ b/gdb/infrun.c
 @@ -45,6 +45,8 @@
@@ -8382,7 +8998,7 @@ index 8307986..b4110a8 100644
  #include "gdb_assert.h"
  #include "mi/mi-common.h"
  #include "event-top.h"
-@@ -2013,6 +2015,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch,
+@@ -2024,6 +2026,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch,
  						  struct symtab_and_line sr_sal,
  						  struct frame_id sr_id);
  static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
@@ -8391,7 +9007,7 @@ index 8307986..b4110a8 100644
  
  static void stop_stepping (struct execution_control_state *ecs);
  static void prepare_to_wait (struct execution_control_state *ecs);
-@@ -2958,6 +2962,10 @@ handle_inferior_event (struct execution_control_state *ecs)
+@@ -2971,6 +2975,10 @@ handle_inferior_event (struct execution_control_state *ecs)
  
        stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
  
@@ -8402,7 +9018,7 @@ index 8307986..b4110a8 100644
        ecs->event_thread->stop_bpstat
  	= bpstat_stop_status (get_regcache_aspace (get_current_regcache ()),
  			      stop_pc, ecs->ptid);
-@@ -3042,6 +3050,10 @@ handle_inferior_event (struct execution_control_state *ecs)
+@@ -3055,6 +3063,10 @@ handle_inferior_event (struct execution_control_state *ecs)
  
        stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
  
@@ -8413,7 +9029,7 @@ index 8307986..b4110a8 100644
        /* Do whatever is necessary to the parent branch of the vfork.  */
        handle_vfork_child_exec_or_exit (1);
  
-@@ -3780,23 +3792,33 @@ process_event_stop_test:
+@@ -3793,23 +3805,33 @@ process_event_stop_test:
  
  	ecs->event_thread->stepping_over_breakpoint = 1;
  
@@ -8459,7 +9075,7 @@ index 8307986..b4110a8 100644
  	keep_going (ecs);
  	return;
  
-@@ -3808,6 +3830,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
+@@ -3821,6 +3843,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
  	gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
  	delete_step_resume_breakpoint (ecs->event_thread);
  
@@ -8513,7 +9129,7 @@ index 8307986..b4110a8 100644
  	ecs->event_thread->stop_step = 1;
  	print_stop_reason (END_STEPPING_RANGE, 0);
  	stop_stepping (ecs);
-@@ -4827,6 +4896,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
+@@ -4840,6 +4909,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
      set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume);
  }
  
@@ -8635,14 +9251,14 @@ index 4f78a28..e0096f5 100644
  						 const domain_enum);
  
 diff --git a/gdb/linespec.c b/gdb/linespec.c
-index 74902b6..4e54a3a 100644
+index 75a74e2..ec4d569 100644
 --- a/gdb/linespec.c
 +++ b/gdb/linespec.c
 @@ -40,6 +40,7 @@
  #include "interps.h"
  #include "mi/mi-cmds.h"
  #include "target.h"
-+#include <ctype.h>
++#include "arch-utils.h"
  
  /* We share this one with symtab.c, but it is not exported widely. */
  
@@ -8655,7 +9271,57 @@ index 74902b6..4e54a3a 100644
  static struct symtabs_and_lines decode_indirect (char **argptr);
  
  static char *locate_first_half (char **argptr, int *is_quote_enclosed);
-@@ -688,9 +687,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+@@ -313,10 +312,7 @@ add_matching_methods (int method_counter, struct type *t,
+ 				   NULL, VAR_DOMAIN,
+ 				   language,
+ 				   (int *) NULL);
+-      /* See PR10966.  Remove check on symbol domain and class when
+-	 we stop using (bad) linkage names on constructors.  */
+-      if (sym_arr[i1] && (SYMBOL_DOMAIN (sym_arr[i1]) == VAR_DOMAIN
+-			  && SYMBOL_CLASS (sym_arr[i1]) == LOC_BLOCK))
++      if (sym_arr[i1])
+ 	i1++;
+       else
+ 	{
+@@ -631,6 +627,37 @@ See set/show multiple-symbol."));
+   discard_cleanups (old_chain);
+   return return_values;
+ }
++
++/* A helper function for decode_line_1 and friends which skips P
++   past any method overload information at the beginning of P, e.g.,
++   "(const struct foo *)".
++
++   This function assumes that P has already been validated to contain
++   overload information, and it will assert if *P != '('.  */
++static char *
++find_method_overload_end (char *p)
++{
++  int depth = 0;
++
++  gdb_assert (*p == '(');
++
++  while (*p)
++    {
++      if (*p == '(')
++	++depth;
++      else if (*p == ')')
++	{
++	  if (--depth == 0)
++	    {
++	      ++p;
++	      break;
++	    }
++	}
++      ++p;
++    }
++
++  return p;
++}
+ \f
+ /* The parser of linespec itself. */
+ 
+@@ -691,18 +718,17 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
    struct symtab *file_symtab = NULL;
  
    char *copy;
@@ -8665,7 +9331,19 @@ index 74902b6..4e54a3a 100644
    /* This says whether or not something in *ARGPTR is quoted with
       completer_quotes (i.e. with single quotes).  */
    int is_quoted;
-@@ -711,12 +707,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+-  /* Is part of *ARGPTR is enclosed in double quotes?  */
++  /* Is *ARGPTR is enclosed in double quotes?  */
+   int is_quote_enclosed;
+   int is_objc_method = 0;
+   char *saved_arg = *argptr;
+   /* If IS_QUOTED, the end of the quoted bit.  */
+   char *end_quote = NULL;
++  /* The "first half" of the linespec.  */
++  char *first_half;
+ 
+   if (not_found_ptr)
+     *not_found_ptr = 0;
+@@ -716,12 +742,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
    if (**argptr == '*')
      return decode_indirect (argptr);
  
@@ -8678,10 +9356,16 @@ index 74902b6..4e54a3a 100644
 +  is_quoted = (*argptr
 +	       && strchr (get_gdb_completer_quote_characters (),
 +			  **argptr) != NULL);
+   if (is_quoted)
+     end_quote = skip_quoted (*argptr);
+ 
+@@ -734,15 +757,12 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+      will point to "". If this is a C++ name, like "A::B::foo", p will
+      point to "::B::foo". Argptr is not changed by this call.  */
+ 
+-  p = locate_first_half (argptr, &is_quote_enclosed);
++  first_half = p = locate_first_half (argptr, &is_quote_enclosed);
  
-   /* Check to see if it's a multipart linespec (with colons or
-      periods).  */
-@@ -732,10 +725,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
    /* Check if this is an Objective-C method (anything that starts with
       a '+' or '-' and a '[').  */
    if (is_objc_method_format (p))
@@ -8693,43 +9377,53 @@ index 74902b6..4e54a3a 100644
  
    /* Check if the symbol could be an Objective-C selector.  */
  
-@@ -749,11 +739,11 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+@@ -754,9 +774,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+       return values;
+   }
  
+-  if (is_quoted)
+-    *argptr = *argptr + 1;
+-
    /* Does it look like there actually were two parts?  */
  
--  if ((p[0] == ':' || p[0] == '.') && paren_pointer == NULL)
-+  if (p[0] == ':' || p[0] == '.')
-     {
-       if (is_quoted)
- 	*argptr = *argptr + 1;
--      
-+
-       /* Is it a C++ or Java compound data structure?
- 	 The check on p[1] == ':' is capturing the case of "::",
- 	 since p[0]==':' was checked above.  
-@@ -762,48 +752,31 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
- 	 can return now. */
+   if (p[0] == ':' || p[0] == '.')
+@@ -770,67 +787,48 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
  	
        if (p[0] == '.' || p[1] == ':')
--	return decode_compound (argptr, funfirstline, canonical,
--				saved_arg, p, not_found_ptr);
-+	{
+ 	{
+-	  if (paren_pointer == NULL)
+-	    return decode_compound (argptr, funfirstline, canonical,
 +	  struct symtabs_and_lines values;
 +
 +	  if (is_quote_enclosed)
 +	    ++saved_arg;
 +	  values = decode_compound (argptr, funfirstline, canonical,
-+				    saved_arg, p, not_found_ptr);
+ 				    saved_arg, p, not_found_ptr);
+-	  /* Otherwise, fall through to decode_variable below.  */
 +	  if (is_quoted && **argptr == '\'')
 +	    *argptr = *argptr + 1;
 +	  return values;
-+	}
+ 	}
+-      else
+-	{
+-	  /* No, the first part is a filename; set file_symtab to be that file's
+-	     symtab.  Also, move argptr past the filename.  */
  
-       /* No, the first part is a filename; set file_symtab to be that file's
- 	 symtab.  Also, move argptr past the filename.  */
+-	  file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
+-					      not_found_ptr);
++      /* No, the first part is a filename; set file_symtab to be that file's
++	 symtab.  Also, move argptr past the filename.  */
  
-       file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed, 
- 		      			  not_found_ptr);
+-	  /* Check for single quotes on the non-filename part.  */
+-	  if (!is_quoted)
+-	    {
+-	      is_quoted = (**argptr
+-			   && strchr (get_gdb_completer_quote_characters (),
+-				      **argptr) != NULL);
+-	      if (is_quoted)
+-		end_quote = skip_quoted (*argptr);
+-	    }
+-	}
 -    }
 -#if 0
 -  /* No one really seems to know why this was added. It certainly
@@ -8742,7 +9436,9 @@ index 74902b6..4e54a3a 100644
 -  else
 -    {
 -      /* Check if what we have till now is a symbol name */
--
++      file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
++					  not_found_ptr);
+ 
 -      /* We may be looking at a template instantiation such
 -         as "foo<int>".  Check here whether we know about it,
 -         instead of falling through to the code below which
@@ -8756,14 +9452,16 @@ index 74902b6..4e54a3a 100644
 -      copy[p - *argptr] = '\000';
 -      sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
 -      if (sym)
-+      if (file_symtab != NULL)
++      /* Check for single quotes on the non-filename part.  */
++      if (!is_quoted)
  	{
 -	  *argptr = (*p == '\'') ? p + 1 : p;
 -	  return symbol_found (funfirstline, canonical, copy, sym, NULL);
-+	  /* Double-check if the remainder of the argument is quoted.
-+	     The rbreak command uses syntax like this.  */
-+	  if (**argptr == '\'')
-+	    is_quoted = 1;
++	  is_quoted = (**argptr
++		       && strchr (get_gdb_completer_quote_characters (),
++				  **argptr) != NULL);
++	  if (is_quoted)
++	    end_quote = skip_quoted (*argptr);
  	}
 -      /* Otherwise fall out from here and go to file/line spec
 -         processing, etc. */
@@ -8772,7 +9470,22 @@ index 74902b6..4e54a3a 100644
  
    /* file_symtab is specified file's symtab, or 0 if no file specified.
       arg no longer contains the file name.  */
-@@ -838,10 +811,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+ 
++  /* If the filename was quoted, we must re-check the quotation.  */
++
++  if (end_quote == first_half && *end_quote!= '\0')
++    {
++      is_quoted = (**argptr
++		   && strchr (get_gdb_completer_quote_characters (),
++			      **argptr) != NULL);
++      if (is_quoted)
++	end_quote = skip_quoted (*argptr);
++    }
++
+   /* Check whether arg is all digits (and sign).  */
+ 
+   q = *argptr;
+@@ -861,10 +859,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
        /* allow word separators in method names for Obj-C */
        p = skip_quoted_chars (*argptr, NULL, "");
      }
@@ -8783,20 +9496,13 @@ index 74902b6..4e54a3a 100644
    else
      {
        p = skip_quoted (*argptr);
-@@ -851,6 +820,21 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+@@ -874,6 +868,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
    if (*p == '<')
      p = find_template_name_end (p);
  
 +  /* Keep method overload information.  */
-+  q = strchr (p, '(');
-+  if (q != NULL)
-+    {
-+      /* Ignore '(' used after " if".  */
-+      while (q > p && isspace (q[-1]))
-+	q--;
-+      if (!(q >= p + 3 && strncmp (&q[-2], "if", 2) == 0 && isspace (q[-3])))
-+	p = strrchr (q, ')') + 1;
-+    }
++  if (*p == '(')
++    p = find_method_overload_end (p);
 +
 +  /* Make sure we keep important kewords like "const" */
 +  if (strncmp (p, " const", 6) == 0)
@@ -8805,7 +9511,21 @@ index 74902b6..4e54a3a 100644
    copy = (char *) alloca (p - *argptr + 1);
    memcpy (copy, *argptr, p - *argptr);
    copy[p - *argptr] = '\0';
-@@ -926,44 +910,6 @@ initialize_defaults (struct symtab **default_symtab, int *default_line)
+@@ -921,10 +923,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+    function is passed ARGPTR as an argument, it modifies what ARGPTR
+    points to; typically, it advances *ARGPTR past whatever substring
+    it has just looked at.  (If it doesn't modify *ARGPTR, then the
+-   function gets passed *ARGPTR instead, which is then called ARG: see
+-   set_flags, for example.)  Also, functions that return a struct
+-   symtabs_and_lines may modify CANONICAL, as in the description of
+-   decode_line_1.
++   function gets passed *ARGPTR instead, which is then called ARG.)
++   Also, functions that return a struct symtabs_and_lines may modify
++   CANONICAL, as in the description of decode_line_1.
+ 
+    If a function returns a struct symtabs_and_lines, then that struct
+    will immediately make its way up the call chain to be returned by
+@@ -951,44 +952,6 @@ initialize_defaults (struct symtab **default_symtab, int *default_line)
      }
  }
  
@@ -8850,7 +9570,43 @@ index 74902b6..4e54a3a 100644
  \f
  
  /* Decode arg of the form *PC.  */
-@@ -1264,7 +1210,8 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+@@ -1059,7 +1022,14 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
+       p++;
+     }
+   else
+-    *is_quote_enclosed = 0;
++    {
++      *is_quote_enclosed = 0;
++      if (strchr (get_gdb_completer_quote_characters (), *p))
++	{
++	  ++(*argptr);
++	  ++p;
++	}
++    }
+   for (; *p; p++)
+     {
+       if (p[0] == '<')
+@@ -1088,8 +1058,9 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
+       if (p[0] == '.' && strchr (p, ':') == NULL)
+ 	{
+ 	  /* Java qualified method.  Find the *last* '.', since the
+-	     others are package qualifiers.  */
+-	  for (p1 = p; *p1; p1++)
++	     others are package qualifiers.  Stop at any open parenthesis
++	     which might provide overload information.  */
++	  for (p1 = p; *p1 && *p1 != '('; p1++)
+ 	    {
+ 	      if (*p1 == '.')
+ 		p = p1;
+@@ -1241,6 +1212,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+   struct symbol *sym_class;
+   struct symbol **sym_arr;
+   struct type *t;
++  char *saved_java_argptr = NULL;
+ 
+   /* First check for "global" namespace specification, of the form
+      "::foo".  If found, skip over the colons and jump to normal
+@@ -1289,7 +1261,8 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
        /* PASS2: p2->"::fun", p->":fun" */
  
        /* Move pointer ahead to next double-colon.  */
@@ -8860,7 +9616,7 @@ index 74902b6..4e54a3a 100644
  	{
  	  if (current_language->la_language == language_cplus)
  	    p += cp_validate_operator (p);
-@@ -1342,8 +1289,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+@@ -1367,8 +1340,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
        else
  	{
  	  /* At this point argptr->"fun".  */
@@ -8872,7 +9628,7 @@ index 74902b6..4e54a3a 100644
  	    p++;
  	  /* At this point p->"".  String ended.  */
  	  /* Nope, C++ operators could have spaces in them
-@@ -1355,6 +1304,19 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+@@ -1380,6 +1355,42 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
  	      /* The above loop has already swallowed "operator".  */
  	      p += cp_validate_operator (p - 8) - 8;
  	    }
@@ -8884,15 +9640,68 @@ index 74902b6..4e54a3a 100644
 +	  /* Keep method overload information.  */
 +	  a = strchr (p, '(');
 +	  if (a != NULL)
-+	    p = strrchr (a, ')') + 1;
++	    p = find_method_overload_end (a);
 +
 +	  /* Make sure we keep important kewords like "const" */
 +	  if (strncmp (p, " const", 6) == 0)
 +	    p += 6;
++
++	  /* Java may append typenames,  so assume that if there is
++	     anything else left in *argptr, it must be a typename.  */
++	  if (*p && current_language->la_language == language_java)
++	    {
++	      struct type *type;
++	      p2 = p;
++	      while (*p2)
++		++p2;
++	      copy = (char *) alloca (p2 - p + 1);
++	      memcpy (copy, p, p2 - p);
++	      copy[p2 - p] = '\0';
++	      type = lookup_typename (current_language, get_current_arch (),
++				      copy, NULL, 1);
++	      if (type != NULL)
++		{
++		  /* Save the location of this just in case this
++		     method/type combination isn't actually defined.
++		     It will be checked later.  */
++		  saved_java_argptr = p;
++		  p = p2;
++		}
++	    }
  	}
  
        /* Allocate our own copy of the substring between argptr and
-@@ -1509,8 +1471,39 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
+@@ -1408,9 +1419,26 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+ 	 here, we return. If not, and we are at the and of the string,
+ 	 we'll lookup the whole string in the symbol tables.  */
+ 
+-      return find_method (funfirstline, canonical, saved_arg,
+-			  copy, t, sym_class, not_found_ptr);
+-
++      values = find_method (funfirstline, canonical, saved_arg,
++			    copy, t, sym_class, not_found_ptr);
++      if (saved_java_argptr != NULL && values.nelts == 1)
++	{
++	  /* The user specified a specific return type for a java method.
++	     Double-check that it really is the one the user specified.
++	     [This is a necessary evil because strcmp_iw_ordered stops
++	     comparisons too prematurely.]  */
++	  sym = find_pc_sect_function (values.sals[0].pc,
++				       values.sals[0].section);
++	  /* We just found a SAL, we had better be able to go backwards!  */
++	  gdb_assert (sym != NULL);
++	  if (strcmp_iw (SYMBOL_LINKAGE_NAME (sym), saved_arg) != 0)
++	    {
++	      xfree (values.sals);
++	      error (_("the class `%s' does not have any method instance named %s\n"),
++		     SYMBOL_PRINT_NAME (sym_class), copy);
++	    }
++	}
++      return values;
+     } /* End if symbol found */
+ 
+ 
+@@ -1534,8 +1562,39 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
      }
    if (i1 > 0)
      {
@@ -8928,13 +9737,23 @@ index 74902b6..4e54a3a 100644
 +	    }
 +
 +	  error (_("the class `%s' does not have any method instance named %s\n"),
-+		   SYMBOL_PRINT_NAME (sym_class), copy);
++		 SYMBOL_PRINT_NAME (sym_class), copy);
 +	}
 +
        return decode_line_2 (sym_arr, i1, funfirstline, canonical);
      }
    else
-@@ -1815,7 +1808,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy,
+@@ -1577,7 +1636,8 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed,
+   copy = (char *) alloca (p - *argptr + 1);
+   memcpy (copy, *argptr, p - *argptr);
+   /* It may have the ending quote right after the file name.  */
+-  if (is_quote_enclosed && copy[p - *argptr - 1] == '"')
++  if ((is_quote_enclosed && copy[p - *argptr - 1] == '"')
++      || copy[p - *argptr - 1] == '\'')
+     copy[p - *argptr - 1] = 0;
+   else
+     copy[p - *argptr] = 0;
+@@ -1840,7 +1900,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy,
  	{
  	  struct blockvector *bv = BLOCKVECTOR (SYMBOL_SYMTAB (sym));
  	  struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
@@ -8944,10 +9763,10 @@ index 74902b6..4e54a3a 100644
  	}
        return values;
 diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
-index 7fc9584..b286dfd 100644
+index e55d958..e41ed74 100644
 --- a/gdb/linux-nat.c
 +++ b/gdb/linux-nat.c
-@@ -2624,6 +2624,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
+@@ -2618,6 +2618,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
    return lp->stopped_data_address_p;
  }
  
@@ -8987,7 +9806,7 @@ index 7fc9584..b286dfd 100644
  /* Wait until LP is stopped.  */
  
  static int
-@@ -5500,6 +5533,8 @@ linux_nat_add_target (struct target_ops *t)
+@@ -5584,6 +5617,8 @@ linux_nat_add_target (struct target_ops *t)
    t->to_thread_address_space = linux_nat_thread_address_space;
    t->to_stopped_by_watchpoint = linux_nat_stopped_by_watchpoint;
    t->to_stopped_data_address = linux_nat_stopped_data_address;
@@ -9104,10 +9923,10 @@ index 6804609..2cb1bf9 100644
  
  /* Provide a prototype to silence -Wmissing-prototypes.  */
 diff --git a/gdb/machoread.c b/gdb/machoread.c
-index 02b61d3..13ab595 100644
+index a810bb2..b416970 100644
 --- a/gdb/machoread.c
 +++ b/gdb/machoread.c
-@@ -755,6 +755,7 @@ static struct sym_fns macho_sym_fns = {
+@@ -842,6 +842,7 @@ static struct sym_fns macho_sym_fns = {
    macho_new_init,               /* sym_new_init: init anything gbl to entire symtab */
    macho_symfile_init,           /* sym_init: read initial info, setup for sym_read() */
    macho_symfile_read,           /* sym_read: read a symbol file into symtab */
@@ -9369,7 +10188,7 @@ index 287f9de..1fe0fbe 100644
  		       SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
  	  return SYMBOL_VALUE_ADDRESS (msymbol);
 diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
-index 6bb4eb6..2b07942 100644
+index 5924b30..2957024 100644
 --- a/gdb/mips-linux-tdep.c
 +++ b/gdb/mips-linux-tdep.c
 @@ -38,6 +38,7 @@
@@ -9380,7 +10199,7 @@ index 6bb4eb6..2b07942 100644
  
  static struct target_so_ops mips_svr4_so_ops;
  
-@@ -1225,6 +1226,9 @@ mips_linux_init_abi (struct gdbarch_info info,
+@@ -1222,6 +1223,9 @@ mips_linux_init_abi (struct gdbarch_info info,
  	tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM,
  				 "restart");
      }
@@ -9391,7 +10210,7 @@ index 6bb4eb6..2b07942 100644
  
  /* Provide a prototype to silence -Wmissing-prototypes.  */
 diff --git a/gdb/mipsread.c b/gdb/mipsread.c
-index 4ef817e..1c53574 100644
+index 093313e..9144d00 100644
 --- a/gdb/mipsread.c
 +++ b/gdb/mipsread.c
 @@ -394,6 +394,7 @@ static struct sym_fns ecoff_sym_fns =
@@ -9464,10 +10283,10 @@ index a050f15..04d1f1c 100644
  	  if (sym != NULL)
  	    {
 diff --git a/gdb/objfiles.c b/gdb/objfiles.c
-index 0b07e37..5de5300 100644
+index c2763c2..5d62020 100644
 --- a/gdb/objfiles.c
 +++ b/gdb/objfiles.c
-@@ -789,6 +789,10 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
+@@ -792,6 +792,10 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
      }
    }
  
@@ -9478,7 +10297,7 @@ index 0b07e37..5de5300 100644
    {
      struct partial_symbol **psym;
  
-@@ -914,7 +918,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+@@ -917,7 +921,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
  int
  objfile_has_partial_symbols (struct objfile *objfile)
  {
@@ -9487,7 +10306,7 @@ index 0b07e37..5de5300 100644
  }
  
  /* Return non-zero if OBJFILE has full symbols.  */
-@@ -954,6 +958,20 @@ have_partial_symbols (void)
+@@ -957,6 +961,20 @@ have_partial_symbols (void)
      if (objfile_has_partial_symbols (ofp))
        return 1;
    }
@@ -9555,7 +10374,7 @@ index c689622..eb3ae10 100644
    ALL_PSPACE_OBJFILES (ss, objfile)			\
      ALL_OBJFILE_PSYMTABS (objfile, p)
 diff --git a/gdb/parse.c b/gdb/parse.c
-index d5a199b..c3ef9e1 100644
+index aabc461..e2ab8d9 100644
 --- a/gdb/parse.c
 +++ b/gdb/parse.c
 @@ -62,6 +62,7 @@ const struct exp_descriptor exp_descriptor_standard =
@@ -9566,7 +10385,7 @@ index d5a199b..c3ef9e1 100644
      op_name_standard,
      dump_subexp_body_standard,
      evaluate_subexp_standard
-@@ -511,6 +512,11 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
+@@ -523,6 +524,11 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
        write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
        break;
  
@@ -9578,7 +10397,7 @@ index d5a199b..c3ef9e1 100644
      case mst_data:
      case mst_file_data:
      case mst_bss:
-@@ -841,6 +847,10 @@ operator_length_standard (struct expression *expr, int endpos,
+@@ -853,6 +859,10 @@ operator_length_standard (struct expression *expr, int endpos,
        args = 1;
        break;
  
@@ -9589,7 +10408,21 @@ index d5a199b..c3ef9e1 100644
      case OP_OBJC_MSGCALL:	/* Objective C message (method) call */
        oplen = 4;
        args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
-@@ -1361,6 +1371,151 @@ parser_fprintf (FILE *x, const char *y, ...)
+@@ -889,6 +899,13 @@ operator_length_standard (struct expression *expr, int endpos,
+       args = 1;
+       break;
+ 
++    case OP_ADL_FUNC:
++      oplen = longest_to_int (expr->elts[endpos - 2].longconst);
++      oplen = 4 + BYTES_TO_EXP_ELEM (oplen + 1);
++      oplen++;
++      oplen++;
++      break;
++
+     case OP_LABELED:
+     case STRUCTOP_STRUCT:
+     case STRUCTOP_PTR:
+@@ -1373,6 +1390,151 @@ parser_fprintf (FILE *x, const char *y, ...)
    va_end (args);
  }
  
@@ -9742,10 +10575,10 @@ index d5a199b..c3ef9e1 100644
  _initialize_parse (void)
  {
 diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
-index 6fcf7ae..3f5efe8 100644
+index c4eb1a0..2a43fe3 100644
 --- a/gdb/parser-defs.h
 +++ b/gdb/parser-defs.h
-@@ -190,6 +190,13 @@ extern void operator_length (struct expression *, int, int *, int *);
+@@ -192,6 +192,13 @@ extern void operator_length (struct expression *, int, int *, int *);
  
  extern void operator_length_standard (struct expression *, int, int *, int *);
  
@@ -9759,7 +10592,7 @@ index 6fcf7ae..3f5efe8 100644
  extern char *op_name_standard (enum exp_opcode);
  
  extern struct type *follow_types (struct type *);
-@@ -268,6 +275,20 @@ struct exp_descriptor
+@@ -270,6 +277,20 @@ struct exp_descriptor
         the number of subexpressions it takes.  */
      void (*operator_length) (struct expression*, int, int*, int *);
  
@@ -9780,7 +10613,7 @@ index 6fcf7ae..3f5efe8 100644
      /* Name of this operator for dumping purposes.  */
      char *(*op_name) (enum exp_opcode);
  
-@@ -300,4 +321,8 @@ extern void print_subexp_standard (struct expression *, int *,
+@@ -302,4 +323,8 @@ extern void print_subexp_standard (struct expression *, int *,
  
  extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3);
  
@@ -15451,7 +16284,7 @@ index a792819..bdac80e 100644
  
  \f
 diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
-index 9196f08..5230a8c 100644
+index 1bfa700..52f9b39 100644
 --- a/gdb/python/python-internal.h
 +++ b/gdb/python/python-internal.h
 @@ -61,36 +61,79 @@ typedef int Py_ssize_t;
@@ -16166,10 +16999,10 @@ index 94a77fb..7ea68d2 100644
  }
  
 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
-index 5689bf3..2b609af 100644
+index 8edc889..5ea1779 100644
 --- a/gdb/solib-svr4.c
 +++ b/gdb/solib-svr4.c
-@@ -1218,7 +1218,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc)
+@@ -1241,7 +1241,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc)
  	   && pc < info->interp_text_sect_high)
  	  || (pc >= info->interp_plt_sect_low
  	      && pc < info->interp_plt_sect_high)
@@ -16179,7 +17012,7 @@ index 5689bf3..2b609af 100644
  }
  
  /* Given an executable's ABFD and target, compute the entry-point
-@@ -1971,7 +1972,6 @@ struct target_so_ops svr4_so_ops;
+@@ -2038,7 +2039,6 @@ struct target_so_ops svr4_so_ops;
  static struct symbol *
  elf_lookup_lib_symbol (const struct objfile *objfile,
  		       const char *name,
@@ -16187,7 +17020,7 @@ index 5689bf3..2b609af 100644
  		       const domain_enum domain)
  {
    bfd *abfd;
-@@ -1989,8 +1989,7 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
+@@ -2056,8 +2056,7 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
    if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1)
      return NULL;
  
@@ -16237,7 +17070,7 @@ index 573f736..51bfce9 100644
  
  #endif
 diff --git a/gdb/somread.c b/gdb/somread.c
-index c7beaba..e31164c 100644
+index 3d93c5e..a943806 100644
 --- a/gdb/somread.c
 +++ b/gdb/somread.c
 @@ -432,6 +432,7 @@ static struct sym_fns som_sym_fns =
@@ -16353,10 +17186,10 @@ index 2caf9d2..7adc399 100644
    for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi))
      {
 diff --git a/gdb/symfile.c b/gdb/symfile.c
-index bc52406..5d5d83f 100644
+index 8705420..16f96a1 100644
 --- a/gdb/symfile.c
 +++ b/gdb/symfile.c
-@@ -966,13 +966,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+@@ -968,13 +968,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
    /* Give user a chance to burp if we'd be
       interactively wiping out any existing symbols.  */
  
@@ -16375,7 +17208,7 @@ index bc52406..5d5d83f 100644
    discard_cleanups (my_cleanups);
  
    /* We either created a new mapped symbol table, mapped an existing
-@@ -999,6 +1002,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+@@ -1001,6 +1004,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
  
    if ((flags & OBJF_READNOW) || readnow_symbol_files)
      {
@@ -16384,7 +17217,7 @@ index bc52406..5d5d83f 100644
        if (from_tty || info_verbose)
  	{
  	  printf_unfiltered (_("expanding to full symbols..."));
-@@ -2321,6 +2326,7 @@ reread_symbols (void)
+@@ -2323,6 +2328,7 @@ reread_symbols (void)
  	  objfile->symtabs = NULL;
  	  objfile->psymtabs = NULL;
  	  objfile->psymtabs_addrmap = NULL;
@@ -16392,7 +17225,7 @@ index bc52406..5d5d83f 100644
  	  objfile->free_psymtabs = NULL;
  	  objfile->cp_namespace_symtab = NULL;
  	  objfile->msymbols = NULL;
-@@ -2331,6 +2337,8 @@ reread_symbols (void)
+@@ -2333,6 +2339,8 @@ reread_symbols (void)
  	  memset (&objfile->msymbol_demangled_hash, 0,
  		  sizeof (objfile->msymbol_demangled_hash));
  
@@ -16402,10 +17235,10 @@ index bc52406..5d5d83f 100644
  	  objfile->macro_cache = bcache_xmalloc ();
  	  objfile->filename_cache = bcache_xmalloc ();
 diff --git a/gdb/symfile.h b/gdb/symfile.h
-index efa069e..b520b93 100644
+index fe95255..075610b 100644
 --- a/gdb/symfile.h
 +++ b/gdb/symfile.h
-@@ -139,6 +139,12 @@ struct sym_fns
+@@ -141,6 +141,12 @@ struct sym_fns
  
    void (*sym_read) (struct objfile *, int);
  
@@ -16418,7 +17251,7 @@ index efa069e..b520b93 100644
    /* Called when we are finished with an objfile.  Should do all
       cleanup that is specific to the object file format for the
       particular objfile.  */
-@@ -315,8 +321,7 @@ extern int auto_solib_limit;
+@@ -330,8 +336,7 @@ extern int auto_solib_limit;
  
  extern void set_initial_language (void);
  
@@ -16428,7 +17261,7 @@ index efa069e..b520b93 100644
  
  extern void discard_psymtab (struct partial_symtab *);
  
-@@ -387,7 +392,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data);
+@@ -402,7 +407,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data);
  /* From dwarf2read.c */
  
  extern int dwarf2_has_info (struct objfile *);
@@ -19178,18 +20011,18 @@ index 0000000..5da7378
 +gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
 +gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
 diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in
-index c990a64..c964db9 100644
+index d78258e..1774244 100644
 --- a/gdb/testsuite/gdb.cp/Makefile.in
 +++ b/gdb/testsuite/gdb.cp/Makefile.in
 @@ -4,7 +4,7 @@ srcdir = @srcdir@
  EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
  	derivation inherit local member-ptr method misc \
          overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \
--	ref-types ref-params method2 pr9594 gdb2495 virtfunc2
-+	ref-types ref-params method2 pr9594 gdb2495 gdb9593 virtfunc2
+-	ref-types ref-params method2 pr9594 gdb2495 virtfunc2 pr9067 \
++	ref-types ref-params method2 pr9594 gdb2495 gdb9593 virtfunc2 pr9067 \
+ 	pr1072
  
  all info install-info dvi install uninstall installcheck check:
- 	@echo "Nothing to be done for $@..."
 diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp
 index f81a212..30d362a 100644
 --- a/gdb/testsuite/gdb.cp/cp-relocate.exp
@@ -19213,11 +20046,1178 @@ index f81a212..30d362a 100644
 -gdb_test "break *'$func2_name'" \
 +gdb_test "break *$func2_name" \
      "Breakpoint $decimal at 0x2....: file .*"
-diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc
-index f4f78a6..11dba06 100644
---- a/gdb/testsuite/gdb.cp/cplusfuncs.cc
-+++ b/gdb/testsuite/gdb.cp/cplusfuncs.cc
-@@ -195,6 +195,12 @@ char *	dm_type_char_star (char * p)		{ return p; }
+diff --git a/gdb/testsuite/gdb.cp/cpexprs.cc b/gdb/testsuite/gdb.cp/cpexprs.cc
+new file mode 100644
+index 0000000..2bca4cd
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/cpexprs.cc
+@@ -0,0 +1,431 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
++
++   Contributed by Red Hat, originally written by Keith Seitz.
++
++   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@gnu.org  */
++
++#include <stdlib.h>
++#include <iostream>
++
++// Forward decls
++class base;
++class derived;
++
++// A simple template with specializations
++template <typename T>
++class tclass
++{
++public:
++  void do_something () { } // tclass<T>::do_something
++};
++
++template <>
++void tclass<char>::do_something () { } // tclass<char>::do_something
++
++template <>
++void tclass<int>::do_something () { } // tclass<int>::do_something
++
++template<>
++void tclass<long>::do_something () { } // tclass<long>::do_something
++
++template<>
++void tclass<short>::do_something () { } // tclass<short>::do_something
++
++// A simple template with multiple template parameters
++template <class A, class B, class C, class D, class E>
++void flubber (void) // flubber
++{
++  A a;
++  B b;
++  C c;
++  D d;
++  E e;
++
++  ++a;
++  ++b;
++  ++c;
++  ++d;
++  ++e;
++}
++
++// Some contrived policies
++template <class T>
++struct operation_1
++{
++  static void function (void) { } // operation_1<T>::function
++};
++
++template <class T>
++struct operation_2
++{
++  static void function (void) { } // operation_2<T>::function
++};
++
++template <class T>
++struct operation_3
++{
++  static void function (void) { } // operation_3<T>::function
++};
++
++template <class T>
++struct operation_4
++{
++  static void function (void) { } // operation_4<T>::function
++};
++
++// A policy-based class w/ and w/o default policy
++template <class T, class Policy>
++class policy : public Policy
++{
++public:
++  policy (T obj) : obj_ (obj) { } // policy<T, Policy>::policy
++
++private:
++  T obj_;
++};
++
++template <class T, class Policy = operation_1<T> >
++class policyd : public Policy
++{
++public:
++  policyd (T obj) : obj_ (obj) { } // policyd<T, Policy>::policyd
++  ~policyd (void) { } // policyd<T, Policy>::~policyd
++
++private:
++  T obj_;
++};
++
++typedef policy<int, operation_1<void*> > policy1;
++typedef policy<int, operation_2<void*> > policy2;
++typedef policy<int, operation_3<void*> > policy3;
++typedef policy<int, operation_4<void*> > policy4;
++
++typedef policyd<int> policyd1;
++typedef policyd<long> policyd2;
++typedef policyd<char> policyd3;
++typedef policyd<base> policyd4;
++typedef policyd<tclass<int> > policyd5;
++
++class fluff { };
++static fluff *g_fluff = new fluff ();
++
++class base
++{
++protected:
++  int foo_;
++
++public:
++  base (void) : foo_ (42) { } // base::base(void)
++  base (int foo) : foo_ (foo) { } // base::base(int)
++  ~base (void) { } // base::~base
++
++  // Some overloaded methods
++  int overload (void) const { return 0; } // base::overload(void) const
++  int overload (int i) const { return 1; } // base::overload(int) const
++  int overload (short s) const { return 2; } // base::overload(short) const
++  int overload (long l) const { return 3; } // base::overload(long) const
++  int overload (char* a) const { return 4; } // base::overload(char*) const
++  int overload (base& b) const { return 5; } // base::overload(base&) const
++
++  // Operators
++  int operator+ (base const& o) const // base::operator+
++  { return foo_ + o.foo_; }
++
++  base operator++ (void) // base::operator++
++  { ++foo_; return *this; }
++
++  base operator+=(base const& o) // base::operator+=
++  { foo_ += o.foo_; return *this; }
++
++  int operator- (base const& o) const // base::operator-
++  { return foo_ - o.foo_; }
++
++  base operator-- (void) // base::operator--
++  { --foo_; return *this; }
++
++  base operator-= (base const& o) // base::operator-=
++  { foo_ -= o.foo_; return *this; }
++
++  int operator* (base const& o) const // base::operator*
++  { return foo_ * o.foo_; }
++
++  base operator*= (base const& o) // base::operator*=
++  { foo_ *= o.foo_; return *this; }
++
++  int operator/ (base const& o) const // base::operator/
++  { return foo_ / o.foo_; }
++
++  base operator/= (base const& o) // base::operator/=
++  { foo_ /= o.foo_; return *this; }
++
++  int operator% (base const& o) const // base::operator%
++  { return foo_ % o.foo_; }
++  
++  base operator%= (base const& o) // base::operator%=
++  { foo_ %= o.foo_; return *this; }
++
++  bool operator< (base const& o) const // base::operator<
++  { return foo_ < o.foo_; }
++
++  bool operator<= (base const& o) const // base::operator<=
++  { return foo_ <= o.foo_; }
++
++  bool operator> (base const& o) const // base::operator>
++  { return foo_ > o.foo_; }
++
++  bool operator>= (base const& o) const // base::operator>=
++  { return foo_ >= o.foo_; }
++
++  bool operator!= (base const& o) const // base::operator!=
++  { return foo_ != o.foo_; }
++
++  bool operator== (base const& o) const // base::operator==
++  { return foo_ == o.foo_; }
++
++  bool operator! (void) const // base::operator!
++  { return !foo_; }
++
++  bool operator&& (base const& o) const // base::operator&&
++  { return foo_ && o.foo_; }
++
++  bool operator|| (base const& o) const // base::operator||
++  { return foo_ || o.foo_; }
++
++  int operator<< (int value) const // base::operator<<
++  { return foo_  << value; }
++
++  base operator<<= (int value) // base::operator<<=
++  { foo_ <<= value; return *this; }
++
++  int operator>> (int value) const // base::operator>>
++  { return foo_  >> value; }
++
++  base operator>>= (int value) // base::operator>>=
++  { foo_ >>= value; return *this; }
++
++  int operator~ (void) const // base::operator~
++  { return ~foo_; }
++
++  int operator& (base const& o) const // base::operator&
++  { return foo_ & o.foo_; }
++
++  base operator&= (base const& o) // base::operator&=
++  { foo_ &= o.foo_; return *this; }
++
++  int operator| (base const& o) const // base::operator|
++  { return foo_ | o.foo_; }
++
++  base operator|= (base const& o) // base::operator|=
++  { foo_ |= o.foo_; return *this; }
++  
++  int operator^ (base const& o) const // base::operator^
++  { return foo_ ^ o.foo_; }
++
++  base operator^= (base const& o) // base::operator^=
++  { foo_ ^= o.foo_; return *this; }
++
++  base operator= (base const& o) // base::operator=
++  { foo_ = o.foo_; return *this; }
++
++  void operator() (void) const // base::operator()
++  { return; }
++
++  int operator[] (int idx) const // base::operator[]
++  { return idx; }
++
++  void* operator new (size_t size) throw () // base::operator new
++  { return malloc (size); }
++
++  void operator delete (void* ptr) // base::operator delete
++  { free (ptr); }
++
++  void* operator new[] (size_t size) throw () // base::operator new[]
++  { return malloc (size); }
++
++  void operator delete[] (void* ptr) // base::operator delete[]
++  { free (ptr); }
++
++  base const* operator-> (void) const // base::opeartor->
++  { return this; }
++
++  int operator->* (base const& b) const // base::operator->*
++  {  return foo_ * b.foo_; }
++
++  operator char* () const { return const_cast<char*> ("hello"); } // base::operator char*
++  operator int () const { return 21; } // base::operator int
++  operator fluff* () const { return new fluff (); } // base::operator fluff*
++  operator fluff** () const { return &g_fluff; } // base::operator fluff**
++};
++
++class base1 : public virtual base
++{
++public:
++  base1 (void) : foo_ (21) { } // base1::base1(void)
++  base1 (int a) : foo_(a) { } // base1::base1(int)
++  void a_function (void) const { } // base1::a_function
++
++protected:
++  int foo_;
++};
++
++class base2 : public virtual base
++{
++public:
++  base2 () : foo_ (3) { } // base2::base2
++
++protected:
++  void a_function (void) const { } // base2::a_function
++  int foo_;
++};
++
++class derived : public base1, public base2
++{
++  public:
++  derived(void) : foo_ (4) { } // derived::derived
++  void a_function (void) const // derived::a_function
++  { 
++    this->base1::a_function ();
++    this->base2::a_function ();
++  }
++
++  protected:
++  int foo_;
++};
++
++int
++main (int argc, char* argv[]) // main
++{ // main
++  derived d;
++  void (derived::*pfunc) (void) const = &derived::a_function;
++  (d.*pfunc) ();
++
++  base a (1), b (3), c (8);
++  (void) a.overload ();
++  (void) a.overload (static_cast<int> (0));
++  (void) a.overload (static_cast<short> (0));
++  (void) a.overload (static_cast<long> (0));
++  (void) a.overload (static_cast<char*> (0));
++  (void) a.overload (a);
++
++  int r;
++  r = b + c;
++  ++a;
++  a += b;
++  r = b - c;
++  --a;
++  a -= b;
++  r = b * c;
++  a *= b;
++  r = b / c;
++  a /= b;
++  r = b % c;
++  a %= b;
++  bool x = (b < c);
++  x = (b <= c);
++  x = (b > c);
++  x = (b >= c);
++  x = (b != c);
++  x = (b == c);
++  x = (!b);
++  x = (b && c);
++  x = (b || c);
++  r = b << 2;
++  a <<= 1;
++  r = b >> 2;
++  a >>= 1;
++  r = ~b;
++  r = b & c;
++  a &= c;
++  r = b | c;
++  a |= c;
++  r = b ^ c;
++  a ^= c;
++  a = c;
++  a ();
++  int i = a[3];
++  derived* f = new derived ();
++  derived* g = new derived[3];
++  delete f;
++  delete[] g;
++  a->overload ();
++  r = a->*b;
++
++  tclass<char> char_tclass;
++  tclass<int> int_tclass;
++  tclass<short> short_tclass;
++  tclass<long> long_tclass;
++  tclass<base> base_tclass;
++  char_tclass.do_something ();
++  int_tclass.do_something ();
++  short_tclass.do_something ();
++  long_tclass.do_something ();
++  base_tclass.do_something ();
++
++  flubber<int, int, int, int, int> ();
++  flubber<int, int, int, int, short> ();
++  flubber<int, int, int, int, long> ();
++  flubber<int, int, int, int, char> ();
++  flubber<int, int, int, short, int> ();
++  flubber<int, int, int, short, short> ();
++  flubber<int, int, int, short, long> ();
++  flubber<int, int, int, short, char> ();
++  flubber<int, int, int, long, int> ();
++  flubber<int, int, int, long, short> ();
++  flubber<int, int, int, long, long> ();
++  flubber<int, int, int, long, char> ();
++  flubber<int, int, int, char, int> ();
++  flubber<int, int, int, char, short> ();
++  flubber<int, int, int, char, long> ();
++  flubber<int, int, int, char, char> ();
++  flubber<int, int, short, int, int> ();
++  flubber<int, int, short, int, short> ();
++  flubber<int, int, short, int, long> ();
++  flubber<int, int, short, int, char> ();
++  flubber<int, int, short, short, int> ();
++  flubber<short, int, short, int, short> ();
++  flubber<long, short, long, short, long> ();
++
++  policy1 p1 (1);
++  p1.function ();
++  policy2 p2 (2);
++  p2.function ();
++  policy3 p3 (3);
++  p3.function ();
++  policy4 p4 (4);
++  p4.function ();
++
++  policyd1 pd1 (5);
++  pd1.function ();
++  policyd2 pd2 (6);
++  pd2.function ();
++  policyd3 pd3 (7);
++  pd3.function ();
++  policyd4 pd4 (d);
++  pd4.function ();
++  policyd5 pd5 (int_tclass);
++  pd5.function ();
++
++  base1 b1 (3);
++
++  r = a;
++  char* str = a;
++  fluff* flp = a;
++  fluff** flpp = a;
++}
++
+diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp
+new file mode 100644
+index 0000000..6074763
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/cpexprs.exp
+@@ -0,0 +1,724 @@
++# cpexprs.exp - C++ expressions tests
++#
++# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
++#
++# Contributed by Red Hat, originally written by Keith Seitz.
++#
++# 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 file is part of the gdb testsuite.
++
++# A helper proc which sets a breakpoint at FUNC and attempts to
++# run to the breakpoint.
++proc test_breakpoint {func} {
++    global DEC
++
++    # Restart every time
++    if {![runto_main]} {
++	perror "could not run to main when attempting to break at $func"
++    } else {
++	gdb_breakpoint "$func"
++	set i [expr {[string last : $func] + 1}]
++	set efunc [string_to_regexp [string range $func $i end]]
++	gdb_test "continue" \
++	    "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \
++	    "continue to $func"
++    }
++}
++
++# Add a function to the list of tested functions
++# FUNC is the name of the function (which will be passed to gdb commands)
++# TYPE is the type of the function, as expected from the "print" command
++# PRINT is the name of the function, as expected result of the print command
++#  *OR* "-", indicating that FUNC should be used (needed for virtual/inherited
++#   funcs)
++# LST is either the expected result of the list command (the comment from
++#  the source code) *OR* "-", in which case FUNC will be used
++#
++# Usage:
++# add NAME TYPE PRINT LST
++# add NAME TYPE PRINT -
++proc add {func type print lst} {
++    global all_functions CONVAR ADDR
++
++    set all_functions($func,type) $type
++    if {$print == "-"} {
++	set print $func
++    }
++
++    # An exception: since gdb canonicalizes C++ output,
++    # "(void)" must be mutated to "()".
++    regsub {\(void\)} $print {()} print
++
++    set all_functions($func,print) \
++	"$CONVAR = {[string_to_regexp $type]} $ADDR <[string_to_regexp $print].*>"
++    if {$lst == "-"} {
++	set lst "$func"
++    }
++    set all_functions($func,list) ".*// [string_to_regexp $lst]"
++}
++
++proc get {func cmd} {
++    global all_functions
++    return $all_functions($func,$cmd)
++}
++
++# Returns a list of function names for a given command
++proc get_functions {cmd} {
++    global all_functions
++    set result {}
++    foreach i [array names all_functions *,$cmd] {
++	if {$all_functions($i) != ""} {
++	    set idx [string last , $i]
++	    if {$idx != -1} {
++		lappend result [string range $i 0 [expr {$idx - 1}]]
++	    }
++	}
++    }
++
++    return [lsort $result]
++}
++
++# Some convenience variables for this test
++set DEC {[0-9]}; # a decimal number
++set HEX {[0-9a-fA-F]}; # a hexidecimal number
++set CONVAR "\\\$$DEC+"; # convenience variable regexp
++set ADDR "0x$HEX+"; # address
++
++# An array of functions/methods that we are testing...
++# Each element consists is indexed by NAME,COMMAND, where
++# NAME is the function name and COMMAND is the gdb command that
++# we are testing. The value of the array for any index pair is
++# the expected result of running COMMAND with the NAME as argument.
++
++# The array holding all functions/methods to test. Valid subindexes
++# are (none need character escaping -- "add" will take care of that):
++
++# add name type print_name list
++# NAME,type: value is type of function 
++# NAME,print: value is print name of function (careful w/inherited/virtual!)
++# NAME,list: value is comment in source code on first line of function
++#   (without the leading "//")
++array set all_functions {}
++
++# "Normal" functions/methods
++add {main} \
++    {int (int, char **)} \
++    - \
++    -
++add {derived::a_function} \
++    {void (const derived * const)} \
++    - \
++    -
++add {base1::a_function} \
++    {void (const base1 * const)} \
++    - \
++    -
++add {base2::a_function} \
++    {void (const base2 * const)} \
++    - \
++    -
++
++# Constructors
++
++# On targets using the ARM EABI, the constructor is expected to return
++# "this".
++proc ctor { type arglist } {
++    if { [istarget arm*-*eabi*] } {
++	set ret "$type *"
++    } else {
++	set ret "void "
++    }
++    if { $arglist != "" } {
++	set arglist ", $arglist"
++    }
++    return "${ret}($type * const$arglist)"
++}
++
++add {derived::derived} \
++    [ctor derived ""] \
++    - \
++    -
++add {base1::base1(void)} \
++    [ctor base1 "const void ** const"] \
++    - \
++    -
++add {base1::base1(int)} \
++    [ctor base1 "int"] \
++    - \
++    -
++add {base2::base2} \
++    [ctor base2 "const void ** const"] \
++    - \
++    -
++add {base::base(void)} \
++    [ctor base ""] \
++    - \
++    -
++add {base::base(int)} \
++    [ctor base "int"] \
++    - \
++    -
++
++# Destructors
++
++# On targets using the ARM EABI, some destructors are expected
++# to return "this".  Others are void.  For internal reasons,
++# GCC returns void * instead of $type *; RealView appears to do
++# the same.
++proc dtor { type } {
++    if { [istarget arm*-*eabi*] } {
++	set ret "void *"
++    } else {
++	set ret "void "
++    }
++    return "${ret}($type * const)"
++}
++
++add {base::~base} \
++    [dtor base] \
++    - \
++    -
++
++# Overloaded methods (all are const -- we try to use the void
++# method with and without specifying "const")
++add {base::overload(void)} \
++    {int (const base * const)} \
++    - \
++    {base::overload(void) const}
++add {base::overload(void) const} \
++    {int (const base * const)} \
++    - \
++    {base::overload(void) const}
++add {base::overload(int) const} \
++    {int (const base * const, int)} \
++    - \
++    -
++add {base::overload(short) const} \
++    {int (const base * const, short)} \
++    - \
++    -
++add {base::overload(long) const} \
++    {int (const base * const, long)} \
++    - \
++    -
++add {base::overload(char*) const} \
++    {int (const base * const, char *)} \
++    - \
++    -
++add {base::overload(base&) const} \
++    {int (const base * const, base &)} \
++    - \
++    -
++
++# Operators
++add {base::operator+} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator++} \
++    {base (base * const)} \
++    - \
++    -
++add {base::operator+=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator-} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator--} \
++    {base (base * const)} \
++    - \
++    -
++add {base::operator-=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator*} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator*=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator/} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator/=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator%} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator%=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator<} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator<=} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator>} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator>=} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator!=} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator==} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator!} \
++    {bool (const base * const)} \
++    - \
++    -
++add {base::operator&&} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator||} \
++    {bool (const base * const, const base &)} \
++    - \
++    -
++add {base::operator<<} \
++    {int (const base * const, int)} \
++    - \
++    -
++add {base::operator<<=} \
++    {base (base * const, int)} \
++    - \
++    -
++add {base::operator>>} \
++    {int (const base * const, int)} \
++    - \
++    -
++add {base::operator>>=} \
++    {base (base * const, int)} \
++    - \
++    -
++add {base::operator~} \
++    {int (const base * const)} \
++    - \
++    -
++add {base::operator&} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator&=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator|} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator|=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator^} \
++    {int (const base * const, const base &)} \
++    - \
++    -
++add {base::operator^=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator=} \
++    {base (base * const, const base &)} \
++    - \
++    -
++add {base::operator()} \
++    {void (const base * const)} \
++    - \
++    -
++add {base::operator[]} \
++    {int (const base * const, int)} \
++    - \
++    -
++add {base::operator new} \
++    {void *(size_t)} \
++    - \
++    -
++add {base::operator delete} \
++    {void (void *)} \
++    - \
++    -
++add {base::operator new[]} \
++    {void *(size_t)} \
++    - \
++    -
++add {base::operator delete[]} \
++    {void (void *)} \
++    - \
++    -
++add {base::operator char*} \
++    {char *(const base * const)} \
++    - \
++    -
++add {base::operator fluff*} \
++    {fluff *(const base * const)} \
++    - \
++    -
++add {base::operator fluff**} \
++    {fluff **(const base * const)} \
++    - \
++    -
++add {base::operator int} \
++    {int (const base * const)} \
++    - \
++    -
++
++# Templates
++add {tclass<char>::do_something} \
++    {void (tclass<char> * const)} \
++    - \
++    -
++add {tclass<int>::do_something} \
++    {void (tclass<int> * const)} \
++    - \
++    -
++add {tclass<long>::do_something} \
++    {void (tclass<long> * const)} \
++    - \
++    -
++add {tclass<short>::do_something} \
++    {void (tclass<short> * const)} \
++    - \
++    -
++add {tclass<base>::do_something} \
++    {void (tclass<base> * const)} \
++    - \
++    -
++add {flubber<int, int, int, int, int>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, int, short>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, int, long>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, int, char>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, short, int>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, short, short>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, short, long>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, short, char>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, long, int>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, long, short>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, long, long>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, long, char>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, char, int>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, char, short>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, char, long>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, int, char, char>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, short, int, int>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, short, int, short>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, short, int, long>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, short, int, char>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<int, int, short, short, int>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<short, int, short, int, short>} \
++    {void (void)} \
++    - \
++    flubber
++add {flubber<long, short, long, short, long>} \
++    {void (void)} \
++    - \
++    flubber
++add {tclass<base>::do_something} \
++    {void (tclass<base> * const)} \
++    - \
++    {tclass<T>::do_something}
++add {policy1::policy} \
++    [ctor "policy<int, operation_1<void*> >" "int"] \
++    {policy<int, operation_1<void*> >::policy} \
++    {policy<T, Policy>::policy}
++add {policy2::policy} \
++    [ctor "policy<int, operation_2<void*> >" int] \
++    {policy<int, operation_2<void*> >::policy} \
++    {policy<T, Policy>::policy}
++add {policy3::policy} \
++    [ctor "policy<int, operation_3<void*> >" "int"] \
++    {policy<int, operation_3<void*> >::policy} \
++    {policy<T, Policy>::policy}
++add {policy4::policy} \
++    [ctor "policy<int, operation_4<void*> >" "int"] \
++    {policy<int, operation_4<void*> >::policy} \
++    {policy<T, Policy>::policy}
++add {policy1::function} \
++    {void (void)} \
++    {operation_1<void*>::function} \
++    {operation_1<T>::function}
++add {policy2::function} \
++    {void (void)} \
++    {operation_2<void*>::function} \
++    {operation_2<T>::function}
++add {policy3::function} \
++    {void (void)} \
++    {operation_3<void*>::function} \
++    {operation_3<T>::function}
++add {policy4::function} \
++    {void (void)} \
++    {operation_4<void*>::function} \
++    {operation_4<T>::function}
++add {policyd<int, operation_1<int> >::policyd} \
++    [ctor "policyd<int, operation_1<int> >" "int"] \
++    - \
++    {policyd<T, Policy>::policyd}
++add {policyd1::policyd} \
++    [ctor "policyd<int, operation_1<int> >" "int"] \
++    {policyd<int, operation_1<int> >::policyd} \
++    {policyd<T, Policy>::policyd}
++add {policyd<int, operation_1<int> >::~policyd} \
++    [dtor "policyd<int, operation_1<int> >"] \
++    - \
++    {policyd<T, Policy>::~policyd}
++add {policyd1::~policyd} \
++    [dtor "policyd<int, operation_1<int> >"] \
++    {policyd<int, operation_1<int> >::~policyd} \
++    {policyd<T, Policy>::~policyd}
++add {policyd<long, operation_1<long> >::policyd} \
++    [ctor "policyd<long, operation_1<long> >" "long"] \
++    - \
++    {policyd<T, Policy>::policyd}
++add {policyd2::policyd} \
++    [ctor "policyd<long, operation_1<long> >" "long"] \
++    {policyd<long, operation_1<long> >::policyd} \
++    {policyd<T, Policy>::policyd}
++add {policyd<long, operation_1<long> >::~policyd} \
++    [dtor "policyd<long, operation_1<long> >"] \
++    - \
++    {policyd<T, Policy>::~policyd}
++add {policyd2::~policyd} \
++    [dtor "policyd<long, operation_1<long> >"] \
++    {policyd<long, operation_1<long> >::~policyd} \
++    {policyd<T, Policy>::~policyd}
++add {policyd<char, operation_1<char> >::policyd} \
++    [ctor "policyd<char, operation_1<char> >" "char"] \
++    - \
++    {policyd<T, Policy>::policyd}
++add {policyd3::policyd} \
++    [ctor "policyd<char, operation_1<char> >" "char"] \
++    {policyd<char, operation_1<char> >::policyd} \
++    {policyd<T, Policy>::policyd}
++add {policyd<char, operation_1<char> >::~policyd} \
++    [dtor "policyd<char, operation_1<char> >"] \
++    - \
++    {policyd<T, Policy>::~policyd}
++add {policyd3::~policyd} \
++    [dtor "policyd<char, operation_1<char> >"] \
++    {policyd<char, operation_1<char> >::~policyd} \
++    {policyd<T, Policy>::~policyd}
++add {policyd<base, operation_1<base> >::policyd} \
++    [ctor "policyd<base, operation_1<base> >" "base"] \
++    - \
++    {policyd<T, Policy>::policyd}
++add {policyd4::policyd} \
++    [ctor "policyd<base, operation_1<base> >" "base"] \
++    {policyd<base, operation_1<base> >::policyd} \
++    {policyd<T, Policy>::policyd}
++add {policyd<base, operation_1<base> >::~policyd} \
++    [dtor "policyd<base, operation_1<base> >"] \
++    - \
++    {policyd<T, Policy>::~policyd}
++add {policyd4::~policyd} \
++    [dtor "policyd<base, operation_1<base> >"] \
++    {policyd<base, operation_1<base> >::~policyd} \
++    {policyd<T, Policy>::~policyd}
++add {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \
++    [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \
++    - \
++    {policyd<T, Policy>::policyd}
++add {policyd5::policyd} \
++    [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \
++    {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \
++    {policyd<T, Policy>::policyd}
++add {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \
++    [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \
++    - \
++    {policyd<T, Policy>::~policyd}
++add {policyd5::~policyd} \
++    [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \
++    {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \
++    {policyd<T, Policy>::~policyd}
++add {policyd<int, operation_1<int> >::function} \
++    {void (void)} \
++    {operation_1<int>::function}\
++    {operation_1<T>::function}
++add {policyd1::function} \
++    {void (void)} \
++    {operation_1<int>::function} \
++    {operation_1<T>::function}
++add {policyd2::function} \
++    {void (void)} \
++    {operation_1<long>::function} \
++    {operation_1<T>::function}
++add {policyd<char, operation_1<char> >::function} \
++    {void (void)} \
++    {operation_1<char>::function} \
++    {operation_1<T>::function}
++add {policyd3::function} \
++    {void (void)} \
++    {operation_1<char>::function} \
++    {operation_1<T>::function}
++add {policyd<base, operation_1<base> >::function} \
++    {void (void)} \
++    {operation_1<base>::function} \
++    {operation_1<T>::function}
++add {policyd4::function} \
++    {void (void)} \
++    {operation_1<base>::function} \
++    {operation_1<T>::function}
++add {policyd<tclass<int>, operation_1<tclass<int> > >::function} \
++    {void (void)} \
++    {operation_1<tclass<int> >::function} \
++    {operation_1<T>::function}
++add {policyd5::function} \
++    {void (void)} \
++    {operation_1<tclass<int> >::function} \
++    {operation_1<T>::function}
++
++# Start the test
++if {$tracelevel} {
++    strace $tracelevel
++}
++
++if {[skip_cplus_tests]} { continue }
++
++#
++# test running programs
++#
++set prms_id 0
++set bug_id 0
++
++set testfile "cpexprs"
++set srcfile "${testfile}.cc"
++set binfile [file join $objdir $subdir $testfile]
++
++if  {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \
++	  executable {debug c++}] != "" } {
++    untested "$testfile.exp"
++    return -1
++}
++
++if {[get_compiler_info $binfile "c++"]} {
++    return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir [file join $srcdir $subdir]
++gdb_load $binfile
++
++if {![runto_main]} {
++    perror "couldn't run to breakpoint"
++    continue
++}
++
++# Set the listsize to one. This will help with testing "list".
++gdb_test "set listsize 1"
++
++# "print METHOD"
++foreach name [get_functions print] {
++    gdb_test "print $name" [get $name print] "print $name"
++}
++
++# "list METHOD"
++foreach name [get_functions list] {
++    gdb_test "list $name" [get $name list] "list $name"
++}
++
++# Running to breakpoint -- use any function we can "list"
++foreach name [get_functions list] {
++    # Skip "main", since test_breakpoint uses it
++    if {[string compare $name "main"] != 0} {
++	test_breakpoint $name
++    }
++}
++
++gdb_exit
++return 0
+diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc
+index f4f78a6..11dba06 100644
+--- a/gdb/testsuite/gdb.cp/cplusfuncs.cc
++++ b/gdb/testsuite/gdb.cp/cplusfuncs.cc
+@@ -195,6 +195,12 @@ char *	dm_type_char_star (char * p)		{ return p; }
  int	dm_type_foo_ref (foo & foo)		{ return foo.ifoo; }
  int *	dm_type_int_star (int * p)		{ return p; }
  long *	dm_type_long_star (long * p)		{ return p; }
@@ -20094,46 +22094,402 @@ index 6832f3b..baf08d7 100644
 +gdb_test "print diamond.*diamond_pfunc_ptr (20)" \
 +    "Invalid data type for function to be called."
 +
-+# With parentheses, it is valid.
++# With parentheses, it is valid.
++
++gdb_test "print (diamond.*diamond_pfunc_ptr) (20)" \
++    "$vhn = 39"
++
++# Make sure that we do not interpret this as either a member pointer
++# call or a member function call.
++
++gdb_test "print diamond.func_ptr (20)" \
++    "$vhn = 39"
++
+ # ==========================
+ # pointer to member function
+ # ==========================
+@@ -420,7 +447,7 @@ gdb_test_multiple "ptype pmf" $name {
+ 
+ set name "print pmf"
+ gdb_test_multiple "print pmf" $name {
+-    -re "$vhn = $hex <A::bar\\(int\\)>\r\n$gdb_prompt $" {
++    -re "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex <A::bar\\(int\\)>\r\n$gdb_prompt $" {
+ 	pass $name
+     }
+     -re "$vhn = .*not supported with HP aCC.*\r\n$gdb_prompt $" {
+@@ -608,6 +635,9 @@ gdb_test_multiple "print (a.*pmf)(3)" $name {
+     }
+ }
+ 
++gdb_test "ptype a.*pmf" "type = int \\(A \\*, int\\)"
++gdb_test "ptype (a.*pmf)(3)" "type = int"
++
+ # Print out a pointer to data member which requires looking into
+ # a base class.
+ gdb_test "print diamond_pmi" "$vhn = &Base::x"
+@@ -658,5 +688,5 @@ gdb_test "print null_pmi = &A::j" "$vhn = &A::j"
+ gdb_test "print null_pmi = 0" "$vhn = NULL"
+ 
+ gdb_test "print null_pmf" "$vhn = NULL"
+-gdb_test "print null_pmf = &A::foo" "$vhn = $hex <A::foo ?\\(int\\)>"
++gdb_test "print null_pmf = &A::foo" "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex <A::foo ?\\(int\\)>"
+ gdb_test "print null_pmf = 0" "$vhn = NULL"
+diff --git a/gdb/testsuite/gdb.cp/namespace-koenig.cc b/gdb/testsuite/gdb.cp/namespace-koenig.cc
+new file mode 100644
+index 0000000..3c30cb2
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-koenig.cc
+@@ -0,0 +1,232 @@
++namespace A
++{
++  class C
++  {
++  public:
++    static const int x = 11;
++  };
++
++  int
++  first (C c)
++  {
++    return 11;
++  }
++
++  int
++  first (int a, C c)
++  {
++    return 22;
++  }
++
++  int
++  second (int a, int b, C cc, int c, int d)
++  {
++    return 33;
++  }
++
++}
++
++struct B
++{
++  A::C c;
++};
++
++//------------
++
++namespace E
++{
++  class O{};
++  int foo (O o){return 1; }
++  int foo (O o, O o2){return 2; }
++  int foo (O o, O o2, int i){return 3; }
++}
++
++namespace F
++{
++  class O{};
++  int foo (       O fo, ::E::O eo){ return 4;}
++  int foo (int i, O fo, ::E::O eo){ return 5;}
++}
++
++namespace G
++{
++  class O{};
++  int foo (O go, ::F::O fo, ::E::O eo){ return 6; }
++}
++
++//------------
++
++namespace H
++{
++  class O{};
++  int foo (O){ return 7;}
++}
++
++namespace I
++{
++  class O: public H::O {};
++  class X: H::O{};
++}
++
++//------------
++
++namespace J
++{
++  union U{};
++  struct S{};
++  enum E{};
++
++  class A{
++  public:
++    class B{};
++  };
++
++  class C{};
++
++  int foo (U){ return 8;}
++  int foo (S){ return 9;}
++  int foo (E){ return 10;}
++  int foo (A::B){ return 11;}
++  int foo (A*){ return 12;}
++  int foo (A**){ return 13;}
++  int foo (C[]){ return 14;}
++
++}
++//------------
++
++namespace K{
++  class O{};
++
++  int foo(O, int){
++    return 15;
++  }
++
++  int bar(O, int){
++    return 15;
++  }
++}
++
++int foo(K::O, float){
++  return 16;
++}
++
++int bar(K::O, int){
++  return 16;
++}
++//------------
++
++namespace L {
++  namespace A{
++    namespace B{
++    class O {};
++
++    int foo (O){
++      return 17;
++    }
++
++    }
++  }
++}
++
++//------------
++
++namespace M {
++  class O{
++  public:
++    int operator== (int){
++      return 18;
++    }
++
++    int operator== (float){
++      return 19;
++    }
++
++    int operator+ (float){
++      return 22;
++    }
++
++  };
++
++  int operator!= (O, int){
++    return 20;
++  }
++
++  int operator!= (O, double){
++    return 21;
++  }
++
++  int operator+ (O, int){
++    return 23;
++  }
++
++  int operator++ (O){
++    return 24;
++  }
++
++}
++//------------
++int
++main ()
++{
++  A::C c;
++  B b;
++
++  A::first (c);
++  first (0, c);
++  second (0, 0, c, 0, 0);
++  A::first (b.c);
++
++  E::O eo;
++  F::O fo;
++  G::O go;
++
++  foo (eo);
++  foo (eo, eo);
++  foo (eo, eo, 1);
++  foo (fo, eo);
++  foo (1  ,fo, eo);
++  foo (go, fo, eo);
++
++  I::O io;
++  I::X ix;
++
++  foo (io);
++//foo (ix);
++
++  J::U ju;
++  J::S js;
++  J::E je;
++  J::A::B jab;
++  J::A *jap;
++  J::A **japp;
++  J::C jca[3];
++
++  foo (ju);
++  foo (js);
++  foo (je);
++  foo (jab);
++  foo (jap);
++  foo (japp);
++  foo (jca);
++
++  K::O ko;
++  foo (ko, 1);
++  foo (ko, 1.0f);
++  //bar(ko,1);
++
++  L::A::B::O labo;
++  foo (labo);
++
++  M::O o;
++  o == 5;
++  o == 5.0f;
++  o != 5;
++  o != 5.0f;
++  o + 5;
++  o + 5.0f;
++
++  return first (0, c) + foo (eo) +
++         foo (eo, eo) + foo (eo, eo, 1)  +
++         foo (fo, eo) + foo (1  ,fo, eo) +
++         foo (go, fo, eo);
++}
+diff --git a/gdb/testsuite/gdb.cp/namespace-koenig.exp b/gdb/testsuite/gdb.cp/namespace-koenig.exp
+new file mode 100644
+index 0000000..c73e239
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-koenig.exp
+@@ -0,0 +1,112 @@
++# Copyright 2008 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 $tracelevel then {
++    strace $tracelevel
++}
++
++set prms_id 0
++set bug_id 0
++
++set testfile namespace-koenig
++set srcfile ${testfile}.cc
++set binfile ${objdir}/${subdir}/${testfile}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++############################################
++
++if ![runto_main] then {
++    perror "couldn't run to breakpoint main"
++    continue
++}
++
++# Test that koenig lookup finds correct function
++gdb_test "p first(c)" "= 11"
++
++# Change the number of parameters and position of
++# the qualifying parameter
++gdb_test "p second(0,0,c,0,0)" "= 33"
++
++# Test that koenig lookup finds correct function
++# even if it is overloaded
++gdb_test "p first(0,c)" "= 22"
++
++# Test that koenig lookup finds correct function
++# when the argument is an expression
++gdb_test "p first(b.c)" "= 11"
++
++# test that resolutions can be made across namespaces
++gdb_test "p foo(eo)"         "= 1"
++gdb_test "p foo(eo, eo)"     "= 2"
++gdb_test "p foo(eo, eo, 1)"  "= 3"
++gdb_test "p foo(fo, eo)"     "= 4"
++gdb_test "p foo(1 ,fo, eo)"  "= 5"
++gdb_test "p foo(go, fo, eo)" "= 6"
++
++#test that gdb fails gracefully
++gdb_test "p fake(eo)" "No symbol \"fake\" in current context."
++
++#test that namespaces of base classes are searched
++gdb_test "p foo(io)" "= 7"
++gdb_test "p foo(ix)" "Cannot resolve function foo to any overloaded instance"
++
++#test for other types
++gdb_test "p foo(ju)" "= 8"
++gdb_test "p foo(js)" "= 9"
++gdb_test "p foo(je)" "= 10"
++
++#test for class members
++setup_xfail "*-*-*"
++gdb_test "p foo(jab)" "= 11"
++
++gdb_test "p foo(jap)" "= 12"
++gdb_test "p foo(japp)" "= 13"
++gdb_test "p foo(jca)" "= 14"
++
++#test overload resolution
++gdb_test "p foo(ko,1)" "= 15"
++gdb_test "p foo(ko,1.0f)" "= 16"
++setup_xfail "*-*-*"
++gdb_test "p bar(ko,1)" "= -1"
 +
-+gdb_test "print (diamond.*diamond_pfunc_ptr) (20)" \
-+    "$vhn = 39"
++#test lookup of objects belonging to nested namespaces
++gdb_test "p foo(labo)" "= 17"
 +
-+# Make sure that we do not interpret this as either a member pointer
-+# call or a member function call.
++# test lookup of namespace user-defined operators
++# and overload resolution:
 +
-+gdb_test "print diamond.func_ptr (20)" \
-+    "$vhn = 39"
++# within class
++gdb_test "p o == 5" "= 18"
++gdb_test "p o == 5.0f" "= 19"
 +
- # ==========================
- # pointer to member function
- # ==========================
-@@ -420,7 +447,7 @@ gdb_test_multiple "ptype pmf" $name {
- 
- set name "print pmf"
- gdb_test_multiple "print pmf" $name {
--    -re "$vhn = $hex <A::bar\\(int\\)>\r\n$gdb_prompt $" {
-+    -re "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex <A::bar\\(int\\)>\r\n$gdb_prompt $" {
- 	pass $name
-     }
-     -re "$vhn = .*not supported with HP aCC.*\r\n$gdb_prompt $" {
-@@ -608,6 +635,9 @@ gdb_test_multiple "print (a.*pmf)(3)" $name {
-     }
- }
- 
-+gdb_test "ptype a.*pmf" "type = int \\(A \\*, int\\)"
-+gdb_test "ptype (a.*pmf)(3)" "type = int"
++# within namespace
++gdb_test "p o != 5" "= 20"
++gdb_test "p o != 5.0f" "= 21"
 +
- # Print out a pointer to data member which requires looking into
- # a base class.
- gdb_test "print diamond_pmi" "$vhn = &Base::x"
-@@ -658,5 +688,5 @@ gdb_test "print null_pmi = &A::j" "$vhn = &A::j"
- gdb_test "print null_pmi = 0" "$vhn = NULL"
- 
- gdb_test "print null_pmf" "$vhn = NULL"
--gdb_test "print null_pmf = &A::foo" "$vhn = $hex <A::foo ?\\(int\\)>"
-+gdb_test "print null_pmf = &A::foo" "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex <A::foo ?\\(int\\)>"
- gdb_test "print null_pmf = 0" "$vhn = NULL"
++# across namespace and class
++gdb_test "p o + 5.0f" "= 22"
++gdb_test "p o + 5" "= 23"
++
++gdb_test "p o++" "= 24"
 diff --git a/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc b/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc
 new file mode 100644
 index 0000000..6b180d6
@@ -20907,7 +23263,7 @@ index 4362fd8..f7cfd57 100644
  
  # Some anonymous namespace tests.
 diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp
-index bd115c4..5f80f7d 100644
+index 72a616e..fd99f87 100644
 --- a/gdb/testsuite/gdb.cp/nsusing.exp
 +++ b/gdb/testsuite/gdb.cp/nsusing.exp
 @@ -30,7 +30,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
@@ -20920,7 +23276,7 @@ index bd115c4..5f80f7d 100644
  
  
 diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp
-index 1bfa0f3..9fd31a8 100644
+index ae8fd26..8291022 100644
 --- a/gdb/testsuite/gdb.cp/overload.exp
 +++ b/gdb/testsuite/gdb.cp/overload.exp
 @@ -74,12 +74,12 @@ set re_methods	"${re_methods}${ws}int overload1arg\\((void|)\\);"
@@ -22749,6 +25105,242 @@ index 0000000..39632d5
 +
 +# Failed gdb_load would abort the testcase execution earlier.
 +pass "file loaded"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+new file mode 100644
+index 0000000..9353698
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+@@ -0,0 +1,176 @@
++/* 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/>.  */
++
++/* Debug information */
++
++/* We will `break *main' at the very first instruction.  */
++#define main_length 1
++
++	.section	.data
++vardata:
++	/* See DW_OP_lit3 + 1 (0-based).  */
++	.string		"seennotseen"
++
++	.section	.debug_info
++.Lcu1_begin:
++	.4byte		.Lcu1_end - .Lcu1_start	/* Length of Compilation Unit */
++.Lcu1_start:
++	.2byte		2			/* DWARF version number */
++	.4byte		.Ldebug_abbrev0		/* Offset Into Abbrev. Section */
++	.byte		4			/* Pointer Size (in bytes) */
++
++	/* CU die */
++	.uleb128	1			/* Abbrev: DW_TAG_compile_unit */
++	.4byte		.Lproducer		/* DW_AT_producer */
++	/* Use C++ to exploit a bug in parsing DW_AT_name "".  */
++	.byte		4			/* DW_AT_language (C++) -  */
++	.4byte		main			/* DW_AT_low_pc */
++	.byte		main_length		/* DW_AT_high_pc */
++
++.Larray_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		.Llen_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 */
++	.byte		4			/* DW_AT_byte_size */
++	.byte		7			/* DW_AT_encoding */
++
++.Lchar_type:
++	.uleb128	4			/* Abbrev: DW_TAG_base_type */
++	.4byte		.Lchar_str		/* DW_AT_name */
++	.byte		1			/* DW_AT_byte_size */
++	.byte		6			/* DW_AT_encoding */
++
++.Llen_var:
++	.uleb128	5			/* Abbrev: DW_TAG_variable artificial */
++	.byte		1			/* DW_AT_artificial */
++	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
++	.4byte		.Llen_loclist-.Lloclist	/* DW_AT_location */
++
++	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
++	.string		"a_string"		/* DW_AT_name */
++	.4byte		.Larray_type-.Lcu1_begin/* DW_AT_type */
++	.byte		2f - 1f			/* DW_AT_location */
++1:	.byte		3			/*   DW_OP_addr */
++	.4byte		vardata			/*   <addr> */
++2:
++
++	.byte		0			/* End of children of CU */
++.Lcu1_end:
++
++	.section	.debug_loc
++.Lloclist:
++.Llen_loclist:
++	.4byte	0			# Location list begin address
++	.4byte	main_length		# Location list end address
++	.value	2f-1f	# Location expression size
++1:	.byte	0x33	# DW_OP_lit3
++	.byte	0x9f	# DW_OP_stack_value
++2:
++	.quad	0x0	# Location list terminator begin (*.LLST2)
++	.quad	0x0	# Location list terminator end (*.LLST2)
++
++	.section .debug_abbrev
++.Ldebug_abbrev0:
++	.uleb128	1			/* Abbrev code */
++	.uleb128	0x11			/* DW_TAG_compile_unit */
++	.byte		0x1			/* has_children */
++	.uleb128	0x25			/* DW_AT_producer */
++	.uleb128	0xe			/* DW_FORM_strp */
++	.uleb128	0x13			/* DW_AT_language */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.uleb128	0x11			/* DW_AT_low_pc */
++	.uleb128	0x1			/* DW_FORM_addr */
++	.uleb128	0x12			/* DW_AT_high_pc */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	2			/* Abbrev code */
++	.uleb128	0x1			/* TAG: DW_TAG_array_type */
++	.byte		0x1			/* DW_children_yes */
++	.uleb128	0x49			/* DW_AT_type */
++	.uleb128	0x13			/* DW_FORM_ref4 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	3			/* Abbrev code */
++	.uleb128	0x21			/* DW_TAG_subrange_type */
++	.byte		0x0			/* no children */
++	.uleb128	0x49			/* DW_AT_type */
++	.uleb128	0x13			/* DW_FORM_ref4 */
++	.uleb128	0x22			/* DW_AT_lower_bound */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.uleb128	0x2f			/* DW_AT_upper_bound */
++	.uleb128	0x13			/* DW_FORM_ref4 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	4			/* Abbrev code */
++	.uleb128	0x24			/* DW_TAG_base_type */
++	.byte		0x0			/* no_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0xe			/* DW_FORM_strp */
++	.uleb128	0xb			/* DW_AT_byte_size */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.uleb128	0x3e			/* DW_AT_encoding */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	5			/* 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 */
++	.uleb128	0x02			/* DW_AT_location */
++	.uleb128	0x06			/* DW_FORM_data4 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	6			/* Abbrev code */
++	.uleb128	0x34			/* DW_TAG_variable */
++	.byte		0x0			/* no_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x49			/* DW_AT_type */
++	.uleb128	0x13			/* DW_FORM_ref4 */
++	.uleb128	0x2			/* DW_AT_location */
++	.uleb128	0xa			/* DW_FORM_block1 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.byte		0x0			/* Terminator */
++
++/* String table */
++	.section .debug_str
++.Lproducer:
++	.string		"GNU C 3.3.3"
++.Lchar_str:
++	.string		"char"
++.Luint_str:
++	.string		"unsigned int"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+new file mode 100644
+index 0000000..28db005
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+@@ -0,0 +1,48 @@
++# 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 printing variable with dynamic bounds which reference a different
++# (artificial in the GCC case) variable containing loclist as its location.
++# This testcase uses value (not address) of the referenced variable:
++# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
++
++# 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-bound-loclist
++if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
++    return -1
++}
++
++# Verify it behaves at least as an unbound array without inferior.
++
++gdb_test "p a_string" { = 0x[0-9a-f]+ "seennotseen"}
++gdb_test "ptype a_string" {type = char \[\]}
++
++# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
++if ![runto "*main"] {
++    return -1
++}
++
++gdb_test "p a_string" { = "seen"}
++gdb_test "ptype a_string" {type = char \[4\]}
 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
 new file mode 100644
 index 0000000..7b03ff1
@@ -23875,6 +26467,43 @@ index 9e787f0..5ca15d5 100644
  	    -re ".*time_at_startup = get_run_time.*$gdb_prompt $" {
  		set description "next over get_run_time and everything it calls"
  		set command "next"
+diff --git a/gdb/testsuite/gdb.java/jmain.exp b/gdb/testsuite/gdb.java/jmain.exp
+index ab95247..9814921 100644
+--- a/gdb/testsuite/gdb.java/jmain.exp
++++ b/gdb/testsuite/gdb.java/jmain.exp
+@@ -65,7 +65,7 @@ gdb_test "break jmain.main" "${bpmain}"
+ 
+ # Check that a fully qualified "main" works.
+ gdb_load "${binfile}"
+-set cmd "break \'${testfile}.main(java.lang.String\[\])\'"
++set cmd "break ${testfile}.main(java.lang.String\[\])"
+ set msg $cmd
+ gdb_test_multiple $cmd $msg {
+     -re "${bpmain}\r\n$gdb_prompt $" {
+@@ -79,7 +79,7 @@ gdb_test_multiple $cmd $msg {
+ 	gdb_test "n" "" ""
+ 
+ 	# Check again with a method signature at the end.
+-	set cmd "break \'${testfile}.main(java.lang.String\[\])void\'"
++	set cmd "break ${testfile}.main(java.lang.String\[\])void"
+ 	set msg $cmd
+ 	gdb_test_multiple $cmd $msg {
+ 	    -re "${bpmain}\r\n$gdb_prompt $" {
+diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp
+index 6f7188d..e3ab657 100644
+--- a/gdb/testsuite/gdb.java/jmisc.exp
++++ b/gdb/testsuite/gdb.java/jmisc.exp
+@@ -71,8 +71,8 @@ if ![set_lang_java] then {
+     # signature.
+     runto_main
+     set function "${testfile}.main(java.lang.String\[\])"
+-    gdb_breakpoint "\'$function\'" { allow-pending }
+-    gdb_breakpoint "\'${function}void\'" { allow-pending }
++    gdb_breakpoint "$function" { allow-pending }
++    gdb_breakpoint "${function}void" { allow-pending }
+     gdb_continue_to_breakpoint $function
+ 
+     send_gdb "ptype jmisc\n"   
 diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp
 new file mode 100644
 index 0000000..e71391e
@@ -24002,6 +26631,21 @@ index 0000000..3524830
 +      }
 +  }
 +}
+diff --git a/gdb/testsuite/gdb.java/jprint.exp b/gdb/testsuite/gdb.java/jprint.exp
+index 29dbf4b..447ca73 100644
+--- a/gdb/testsuite/gdb.java/jprint.exp
++++ b/gdb/testsuite/gdb.java/jprint.exp
+@@ -70,8 +70,8 @@ if ![set_lang_java] then {
+     # signature.
+     runto_main
+     set function "${testfile}.main(java.lang.String\[\])"
+-    gdb_breakpoint "\'$function\'" { allow-pending }
+-    gdb_breakpoint "\'${function}void\'" { allow-pending }
++    gdb_breakpoint "$function" { allow-pending }
++    gdb_breakpoint "${function}void" { allow-pending }
+     gdb_continue_to_breakpoint $function
+ 
+     gdb_test "p jvclass.addprint(4,5,6)" "sum is 15\r\n.*" "unambiguous static call"
 diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c
 new file mode 100644
 index 0000000..729f457
@@ -24792,10 +27436,10 @@ index 713ad5f..5d17b26 100644
      global testfile srcdir subdir srcfile binfile
      if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
-index aa4e519..f87277d 100644
+index d980a3d..6a75595 100644
 --- a/gdb/testsuite/gdb.python/py-value.exp
 +++ b/gdb/testsuite/gdb.python/py-value.exp
-@@ -305,6 +305,15 @@ proc test_value_after_death {} {
+@@ -307,6 +307,15 @@ proc test_value_after_death {} {
      "print value's type"
  }
  
@@ -24811,7 +27455,7 @@ index aa4e519..f87277d 100644
  # Regression test for invalid subscript operations.  The bug was that
  # the type of the value was not being checked before allowing a
  # subscript operation to proceed.
-@@ -390,16 +399,23 @@ proc test_parse_and_eval {} {
+@@ -392,16 +401,23 @@ proc test_parse_and_eval {} {
  gdb_exit
  gdb_start
  gdb_reinitialize_dir $srcdir/$subdir
@@ -24842,7 +27486,7 @@ index aa4e519..f87277d 100644
  test_value_creation
  test_value_numeric_ops
  test_value_boolean
-@@ -417,6 +433,7 @@ if ![runto_main] then {
+@@ -419,6 +435,7 @@ if ![runto_main] then {
  test_value_in_inferior
  test_lazy_strings
  test_value_after_death
@@ -25415,7 +28059,7 @@ index 6fbee84..1189cfd 100644
  
      # Check the actual key.  It would be nice to require that it match
 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
-index 9b06a2f..419d5a9 100644
+index 627941d..1f9b228 100644
 --- a/gdb/testsuite/lib/gdb.exp
 +++ b/gdb/testsuite/lib/gdb.exp
 @@ -27,6 +27,7 @@ if {$tool == ""} {
@@ -25662,36 +28306,19 @@ index 6155699..bb94f4b 100644
  
  extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
  
-diff --git a/gdb/utils.c b/gdb/utils.c
-index 82a66a1..c305506 100644
---- a/gdb/utils.c
-+++ b/gdb/utils.c
-@@ -2656,7 +2656,10 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name,
-    As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
-    This "feature" is useful when searching for matching C++ function names
-    (such as if the user types 'break FOO', where FOO is a mangled C++
--   function). */
-+   function).
-+
-+   As an extra-special hack, we do the same with ' ', so that
-+   "FOO(ARGS) const" can match "FOO", too.  */
- 
- int
- strcmp_iw (const char *string1, const char *string2)
-@@ -2681,7 +2684,7 @@ strcmp_iw (const char *string1, const char *string2)
- 	  string2++;
- 	}
-     }
--  return (*string1 != '\0' && *string1 != '(') || (*string2 != '\0');
-+  return (*string1 != ' ' && *string1 != '\0' && *string1 != '(') || (*string2 != '\0' && *string2 != '(');
- }
- 
- /* This is like strcmp except that it ignores whitespace and treats
 diff --git a/gdb/valarith.c b/gdb/valarith.c
-index ed76b09..8bf3634 100644
+index 9f91f4e..753927f 100644
 --- a/gdb/valarith.c
 +++ b/gdb/valarith.c
-@@ -139,7 +139,6 @@ an integer nor a pointer of the same type."));
+@@ -31,6 +31,7 @@
+ #include "dfp.h"
+ #include <math.h>
+ #include "infcall.h"
++#include "exceptions.h"
+ 
+ /* Define whether or not the C operator '/' truncates towards zero for
+    differently signed operands (truncation direction is undefined in C). */
+@@ -146,7 +147,6 @@ an integer nor a pointer of the same type."));
  struct value *
  value_subscript (struct value *array, LONGEST index)
  {
@@ -25699,7 +28326,7 @@ index ed76b09..8bf3634 100644
    int c_style = current_language->c_style_arrays;
    struct type *tarray;
  
-@@ -154,12 +153,26 @@ value_subscript (struct value *array, LONGEST index)
+@@ -161,12 +161,26 @@ value_subscript (struct value *array, LONGEST index)
        get_discrete_bounds (range_type, &lowerbound, &upperbound);
  
        if (VALUE_LVAL (array) != lval_memory)
@@ -25728,7 +28355,7 @@ index ed76b09..8bf3634 100644
  	  /* Emit warning unless we have an array of unknown size.
  	     An array of unknown size has lowerbound 0 and upperbound -1.  */
  	  if (upperbound > -1)
-@@ -178,33 +191,37 @@ value_subscript (struct value *array, LONGEST index)
+@@ -185,33 +199,37 @@ value_subscript (struct value *array, LONGEST index)
      error (_("not an array or string"));
  }
  
@@ -25777,8 +28404,97 @@ index ed76b09..8bf3634 100644
    return v;
  }
  
+@@ -318,6 +336,68 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
+     }
+ }
+ 
++/* Try to find OPERATOR as through argument dependent lookup.  */
++
++static struct value *
++value_user_defined_adl_op (struct value **args, int nargs, char *operator)
++{
++
++  struct symbol *symp;
++  struct type **arg_types;
++  int i;
++
++  /* This function, if found, will not be a member function
++     and does not expect a pointer as its first argument
++     rather the explicit structure.  */
++  args[0] = value_ind (args[0]);
++
++  arg_types = (struct type **)alloca (nargs * (sizeof (struct type *)));
++  /* Prepare list of argument types for overload resolution */
++  for (i = 0; i < nargs; i++)
++    arg_types [i] = value_type (args [i]);
++
++  find_overload_match (arg_types, nargs, operator, 0 /* not method */,
++                       0 /* strict match */, NULL,
++                       NULL /* pass NULL symbol since symbol is unknown */,
++                       NULL, &symp, NULL);
++
++  if (symp)
++    return value_of_variable (symp, 0);
++
++  return NULL;
++}
++
++/* Lookup user defined operator NAME. First try to find it as a member
++   of the struct ARGP[0]. If not found try to find the operator through
++   argument dependent lookup.  */
++
++static struct value *
++value_user_defined_op (struct value **argp, struct value **args, char *name,
++                       int *static_memfuncp, int nargs)
++{
++  struct value *result = NULL;
++  volatile struct gdb_exception except;
++
++  TRY_CATCH (except, RETURN_MASK_ERROR)
++    {
++      result = value_struct_elt (argp, args, name, static_memfuncp,
++                                 "structure");
++    }
++
++  if (except.reason < 0)
++    {
++
++      if (current_language->la_language == language_cplus)
++        /* Try ADL.  */
++        result = value_user_defined_adl_op (args, nargs, name);
++
++      if (!result)
++        error ("%s", except.message);
++    }
++
++  return result;
++}
++
+ /* We know either arg1 or arg2 is a structure, so try to find the right
+    user defined function.  Create an argument vector that calls 
+    arg1.operator @ (arg1,arg2) and return that value (where '@' is any
+@@ -458,7 +538,8 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
+       error (_("Invalid binary operation specified."));
+     }
+ 
+-  argvec[0] = value_struct_elt (&arg1, argvec + 1, tstr, &static_memfuncp, "structure");
++  argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
++                                     &static_memfuncp, 2);
+ 
+   if (argvec[0])
+     {
+@@ -555,7 +636,8 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
+       error (_("Invalid unary operation specified."));
+     }
+ 
+-  argvec[0] = value_struct_elt (&arg1, argvec + 1, tstr, &static_memfuncp, "structure");
++  argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
++                                     &static_memfuncp, 1);
+ 
+   if (argvec[0])
+     {
 diff --git a/gdb/valops.c b/gdb/valops.c
-index cee10fb..b08cb21 100644
+index b94c411..9875f96 100644
 --- a/gdb/valops.c
 +++ b/gdb/valops.c
 @@ -38,6 +38,7 @@
@@ -25934,7 +28650,16 @@ index cee10fb..b08cb21 100644
  }
  
  /* Given a value which is a function, return a value which is a pointer
-@@ -2352,12 +2431,25 @@ find_overload_match (struct type **arg_types, int nargs,
+@@ -2336,7 +2415,7 @@ find_overload_match (struct type **arg_types, int nargs,
+   int boffset;
+   int ix;
+   int static_offset;
+-  struct cleanup *old_cleanups = NULL;
++  struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
+ 
+   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);
-     }
- }
--\f
-+
- 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 =

diff --git a/gdb-bz539590-gnu-ifunc-fix-cond.patch b/gdb-bz539590-gnu-ifunc-fix-cond.patch
new file mode 100644
index 0000000..98bf5c0
--- /dev/null
+++ b/gdb-bz539590-gnu-ifunc-fix-cond.patch
@@ -0,0 +1,14 @@
+--- ./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)
+ 	    {

diff --git a/gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch b/gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
new file mode 100644
index 0000000..8729a62
--- /dev/null
+++ b/gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
@@ -0,0 +1,43 @@
+2010-06-01  Chris Moller  <cmoller@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.

diff --git a/gdb-bz562763-pretty-print-2d-vectors-prereq.patch b/gdb-bz562763-pretty-print-2d-vectors-prereq.patch
new file mode 100644
index 0000000..3cc1e17
--- /dev/null
+++ b/gdb-bz562763-pretty-print-2d-vectors-prereq.patch
@@ -0,0 +1,427 @@
+commit e5ea8d026015c2a0c7774788b425914857de1ffb
+Author: pmuldoon <pmuldoon>
+Date:   Wed Apr 14 12:02:42 2010 +0000
+
+    2010-04-14  Phil Muldoon  <pmuldoon@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@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@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@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@gnu.org>
+ 
+ 	PR corefiles/11481
+### a/gdb/doc/ChangeLog
+### b/gdb/doc/ChangeLog
+## -1,3 +1,8 @@
++2010-04-14  Phil Muldoon  <pmuldoon@redhat.com>
++
++	* gdb.texinfo (Pretty Printing): Document behaviour when to_string
++	returns None.
++
+ 2010-04-09  Stan Shebs  <stan@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

diff --git a/gdb-bz562763-pretty-print-2d-vectors.patch b/gdb-bz562763-pretty-print-2d-vectors.patch
new file mode 100644
index 0000000..f1a8973
--- /dev/null
+++ b/gdb-bz562763-pretty-print-2d-vectors.patch
@@ -0,0 +1,404 @@
+2010-05-31  Chris Moller  <cmoller@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@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.  */

diff --git a/gdb-bz562975-std-terminate-double-free.patch b/gdb-bz562975-std-terminate-double-free.patch
new file mode 100644
index 0000000..a54c550
--- /dev/null
+++ b/gdb-bz562975-std-terminate-double-free.patch
@@ -0,0 +1,159 @@
+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@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;
++}
+ \f
+ 
+ /* 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,

diff --git a/gdb-bz570635-prettyprint-doc1.patch b/gdb-bz570635-prettyprint-doc1.patch
new file mode 100644
index 0000000..df910f4
--- /dev/null
+++ b/gdb-bz570635-prettyprint-doc1.patch
@@ -0,0 +1,40 @@
+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@redhat.com>
++
++	* gdb.texinfo (Data): Link to pretty-printing.
++	(Output Formats): Likewise.  Correct text.
++
+ 2010-03-01  Daniel Jacobowitz  <dan@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

diff --git a/gdb-bz570635-prettyprint-doc2.patch b/gdb-bz570635-prettyprint-doc2.patch
new file mode 100644
index 0000000..aa76fe1
--- /dev/null
+++ b/gdb-bz570635-prettyprint-doc2.patch
@@ -0,0 +1,182 @@
+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@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@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@t{++} virtual func
+ Show whether C@t{++} virtual function tables are pretty printed, or not.
+ @end table
+ 
++@node Pretty Printing
++@section Pretty Printing
++
++@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@t{++} @code{std::string} looks without a
++pretty-printer:
++
++@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"
++  @}
++@}
++@end smallexample
++
++With a pretty-printer for @code{std::string} only the contents are printed:
++
++@smallexample
++(@value{GDBP}) print s
++$2 = "abcd"
++@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
+ 
+-@node Pretty Printing
+-@subsubsection Pretty Printing
+-
+-@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@t{++} @code{std::string} looks without a
+-pretty-printer:
++@node Pretty Printing API
++@subsubsection Pretty Printing API
+ 
+-@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"
+-  @}
+-@}
+-@end smallexample
+-
+-After a pretty-printer for @code{std::string} has been installed, only
+-the contents are printed:
+-
+-@smallexample
+-(@value{GDBP}) print s
+-$2 = "abcd"
+-@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
+-@code{display_hint} method.  @xref{Pretty Printing}.
++@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
+-@code{display_hint} method.  @xref{Pretty Printing}.
++@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

diff --git a/gdb-bz574483-display-sepdebug.patch b/gdb-bz574483-display-sepdebug.patch
new file mode 100644
index 0000000..64ddfa7
--- /dev/null
+++ b/gdb-bz574483-display-sepdebug.patch
@@ -0,0 +1,73 @@
+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@redhat.com>
+
+	* printcmd.c (display_uses_solib_p): Check also
+	SEPARATE_DEBUG_OBJFILE.
+
+gdb/testsuite/
+2010-04-03  Jan Kratochvil  <jan.kratochvil@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
+

diff --git a/gdb-bz575292-delayed-physname.patch b/gdb-bz575292-delayed-physname.patch
new file mode 100644
index 0000000..770d52d
--- /dev/null
+++ b/gdb-bz575292-delayed-physname.patch
@@ -0,0 +1,624 @@
+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\)\)}.*}

diff --git a/gdb-bz575292-void-workaround.patch b/gdb-bz575292-void-workaround.patch
new file mode 100644
index 0000000..4d5a934
--- /dev/null
+++ b/gdb-bz575292-void-workaround.patch
@@ -0,0 +1,187 @@
+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@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@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"
+

diff --git a/gdb-bz578250-avx-01of10.patch b/gdb-bz578250-avx-01of10.patch
new file mode 100644
index 0000000..90fdc0d
--- /dev/null
+++ b/gdb-bz578250-avx-01of10.patch
@@ -0,0 +1,1733 @@
+[ Backported.  ]
+
+commit d454b7529a5e6134ace8541b341d079534f2062a
+Author: H.J. Lu <hjl.tools@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@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@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@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 ();
++}
+ \f
+ 
+ /* 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
+ }
+ \f
+ 
+-/* 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;
++}
++
+ \f
+ 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\"/>"
+ 	    }

diff --git a/gdb-bz578250-avx-02of10.patch b/gdb-bz578250-avx-02of10.patch
new file mode 100644
index 0000000..52af055
--- /dev/null
+++ b/gdb-bz578250-avx-02of10.patch
@@ -0,0 +1,751 @@
+[ Backported.  ]
+
+commit cb928c67c90cfb5bbb0636d91855b95e51ad275d
+Author: Daniel Jacobowitz <dan@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
+ 
++@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.
++
++@smallexample
++<struct id="@var{id}" size="@var{size}">
++  <field name="@var{name}" start="@var{start}" end="@var{end}"/>
++  @dots{}
++</struct>
++@end smallexample
++
++If the structure contains no bitfields, then each field has an
++explicit type, and no implicit padding is added.
++
++@smallexample
++<struct id="@var{id}">
++  <field name="@var{name}" type="@var{type}"/>
++  @dots{}
++</struct>
++@end smallexample
++
++@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
++@var{name}, a @var{start}, and an @var{end}.  Only single-bit flags
++are supported.
++
++@smallexample
++<flags id="@var{id}" size="@var{size}">
++  <field name="@var{name}" start="@var{start}" end="@var{end}"/>
++  @dots{}
++</flags>
++@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 },

diff --git a/gdb-bz578250-avx-03of10.patch b/gdb-bz578250-avx-03of10.patch
new file mode 100644
index 0000000..7cfb551
--- /dev/null
+++ b/gdb-bz578250-avx-03of10.patch
@@ -0,0 +1,457 @@
+[ Backported.  ]
+
+commit 0257d639d42f896a359993ae8adb5792e280f65f
+Author: H.J. Lu <hjl.tools@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@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);
+ 	    }

diff --git a/gdb-bz578250-avx-04of10.patch b/gdb-bz578250-avx-04of10.patch
new file mode 100644
index 0000000..b3619dc
--- /dev/null
+++ b/gdb-bz578250-avx-04of10.patch
@@ -0,0 +1,1366 @@
+[ Backported.  ]
+
+commit 9d625812f24608f99fd99e8591ef3c80d729f9b5
+Author: H.J. Lu <hjl.tools@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@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@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);
++}
++
+ \f
+ 
+ /* 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"));
++    }
+ }
+ \f
+ 
+@@ -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@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@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@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@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@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)"
++}

diff --git a/gdb-bz578250-avx-05of10.patch b/gdb-bz578250-avx-05of10.patch
new file mode 100644
index 0000000..a9f0908
--- /dev/null
+++ b/gdb-bz578250-avx-05of10.patch
@@ -0,0 +1,30 @@
+[ Backported.  ]
+
+commit 6448aace637843e8e7c021d7f8c5d5d5fdd71974
+Author: H.J. Lu <hjl.tools@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@intel.com>
+    	    Eli Zaretskii  <eliz@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

diff --git a/gdb-bz578250-avx-06of10.patch b/gdb-bz578250-avx-06of10.patch
new file mode 100644
index 0000000..c7e55f2
--- /dev/null
+++ b/gdb-bz578250-avx-06of10.patch
@@ -0,0 +1,35 @@
+[ Backported.  ]
+
+commit 49f8d1c24c639d891f58a3b9feda425833b702fb
+Author: H.J. Lu <hjl.tools@gmail.com>
+Date:   Fri Mar 12 15:12:34 2010 +0000
+
+    Restore sp for x86.
+    
+    2010-03-12  H.J. Lu  <hongjiu.lu@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?  */

diff --git a/gdb-bz578250-avx-07of10.patch b/gdb-bz578250-avx-07of10.patch
new file mode 100644
index 0000000..c7029e0
--- /dev/null
+++ b/gdb-bz578250-avx-07of10.patch
@@ -0,0 +1,183 @@
+[ Backported.  ]
+
+commit d5ea7042210f5ad319ad19910bce13fd5717c6d6
+Author: H.J. Lu <hjl.tools@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@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@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.
++
++@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);

diff --git a/gdb-bz578250-avx-08of10.patch b/gdb-bz578250-avx-08of10.patch
new file mode 100644
index 0000000..4f1e4ab
--- /dev/null
+++ b/gdb-bz578250-avx-08of10.patch
@@ -0,0 +1,32 @@
+[ Backported.  ]
+
+commit 684341392f3ca6703dc28dac548d3051811bff47
+Author: H.J. Lu <hjl.tools@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@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:
++
++@itemize @minus
++@item
++@samp{ymm0h} through @samp{ymm7h} for i386
++@item
++@samp{ymm0h} through @samp{ymm15h} for amd64
++@item 
++@end itemize
++
+ The @samp{org.gnu.gdb.i386.linux} feature is optional.  It should
+ describe a single register, @samp{orig_eax}.
+ 

diff --git a/gdb-bz578250-avx-09of10.patch b/gdb-bz578250-avx-09of10.patch
new file mode 100644
index 0000000..d7a41b1
--- /dev/null
+++ b/gdb-bz578250-avx-09of10.patch
@@ -0,0 +1,183 @@
+[ Backported.  ]
+
+commit 5362e5e1dc4cfac24fbd58773aaa7a82c615b662
+Author: H.J. Lu <hjl.tools@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@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@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)"

diff --git a/gdb-bz578250-avx-10of10-ppc.patch b/gdb-bz578250-avx-10of10-ppc.patch
new file mode 100644
index 0000000..c5ce275
--- /dev/null
+++ b/gdb-bz578250-avx-10of10-ppc.patch
@@ -0,0 +1,16 @@
+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 },

diff --git a/gdb-bz578250-avx-10of10.patch b/gdb-bz578250-avx-10of10.patch
new file mode 100644
index 0000000..41196c3
--- /dev/null
+++ b/gdb-bz578250-avx-10of10.patch
@@ -0,0 +1,8271 @@
+[ 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@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@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@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@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@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@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@intel.com>
++
++	* config/djgpp/fnchange.lst: Add x86 AVX XML files.
++
++2010-03-02  H.J. Lu  <hongjiu.lu@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@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@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@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@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@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.
++
++2010-01-31  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_g_packet_size): New.
++	(amd64_linux_init_abi): Pass amd64_linux_g_packet_size to
++	i386_register_g_packet_guesses.
++
++	* i386-linux-tdep.c (i386_linux_g_packet_size): New.
++	(i386_linux_init_abi): Pass i386_linux_g_packet_size to
++	i386_register_g_packet_guesses.
++
++	* i386-tdep.c (i386_register_g_packet_guesses): Updated to
++	take an array of the g/G packet sizes.
++	(i386_g_packet_size): New.
++	(i386_gdbarch_init): Pass i386_g_packet_size to
++	i386_register_g_packet_guesses.
++
++	* i386-tdep.h (i386_g_packet_size_index): New.
++	(i386_register_g_packet_guesses): Updated.
++
++2010-01-31  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.h (AMD64_G_PACKET_SIZE_AVX): Correct comments.
++	* i386-tdep.h (I386_G_PACKET_SIZE_AVX): Likewise.
++	
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_fxsave): Remove vector unit check.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Remove the
++	duplicate.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Call 
++	i386_xstate_init and initialize vector_unit properly.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Initialize
++	vector_unit only if target_desc isn't NULL.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_sse_type): Renamed to ...
++	(i386_vector_type): This.  Updated.
++	(i386_register_type): Updated.
++
++	* i386-tdep.h (i386_sse_type): Renamed to ...
++	(i386_vector_type): This.
++
++	* amd64-tdep.c (amd64_register_type): Updated.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_register_name): Replace sse_unit with
++	vector_unit.
++	(amd64_init_abi): Likewise.
++	* i386-tdep.c (i386_register_name): Likewise.
++	(i386_sse_type): Likewise.
++	(i386_register_g_packet_guesses): Likewise.
++	(i386_gdbarch_sse_unit_init): Renamed to ...
++	(i386_gdbarch_vector_unit_init): This.
++	(i386_gdbarch_init): Updated.
++
++	* i386-tdep.h (x86_sse_unit): Renamed to ...
++	(x86_vector_unit): This.
++	(i386_gdbarch_sse_unit_init): Renamed to ...
++	(i386_gdbarch_vector_unit_init): This.
++
++	* i387-tdep.c (i387_supply_fxsave): Replace sse_unit with
++	vector_unit.
++
++2009-10-14  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_init_abi): Call
++	register_remote_g_packet_guess.
++
++	* amd64-tdep.c (amd64_register_names): Renamed to ...
++	(amd64_sse_register_names): This.  Remove AVX registers.
++	(amd64_avx_register_names): New.
++	(AMD64_NUM_REGS): Updated.
++	(amd64_register_name): Handle sse_unit.
++	(amd64_register_type): Remove AVX registers.
++	(amd64_init_abi): Call i386_gdbarch_sse_unit_init to
++	initialize sse_unit.
++
++	* amd64-tdep.h (AMD64_G_PACKET_SIZE_SSE): New.
++	(AMD64_G_PACKET_SIZE_AVX): Likewise.
++
++	* defs.h (MAX_REGISTER_SIZE): Increase to 32.
++
++	* i386-linux-tdep.c (i386_linux_init_abi): Call
++	i386_register_g_packet_guesses.
++
++	* i386-tdep.c: Include "remote.h" and "target-descriptions.h".
++	(I386_PROPERTY_SSE): New.
++	(I386_PROPERTY_AVX): Likewise.
++	(i386_tdesc_sse): Likewise.
++	(i386_tdesc_avx): Likewise.
++	(i386_avx_register_names): Likewise.
++	(i386_vec128_type): Likewise.
++	(i386_vec256_type): Likewise.
++	(i386_init_tdesc): Likewise.
++	(i386_register_g_packet_guesses): Likewise.
++	(i386_gdbarch_sse_unit_init): Likewise.
++	(i386_register_names): Renamed to ...
++	(i386_sse_register_names): This.
++	(i386_num_register_names): Updated.
++	(i386_register_name): Handle sse_unit.
++	(i386_sse_type): Likewise.
++	(i386_gdbarch_init): Call i386_gdbarch_sse_unit_init to
++	initialize sse_unit.  Call i386_register_g_packet_guesses.
++	(_initialize_i386_tdep): Call i386_tdesc_init.
++
++	* i386-tdep.h (x86_sse_unit): New.
++	(I386_G_PACKET_SIZE_SSE): Likewise.
++	(I386_G_PACKET_SIZE_AVX): Likewise.
++	(i386_register_g_packet_guesses): Likewise.
++	(i386_gdbarch_sse_unit_init): Likewise.
++	(gdbarch_tdep): Add sse_unit.
++	(I386_MAX_REGISTER_SIZE): Increase to 32.
++
++	* i387-tdep.c (i387_supply_fxsave): Assert sse_unit on SSE
++	registers.
++
++	* regformats/reg-i386-avx-linux.dat: New.
++	* regformats/reg-i386-avx.dat: Likewise.
++	* regformats/reg-x86-64-avx-linux.dat: Likewise.
++	* regformats/reg-x86-64-avx.dat: Likewise.
++
++	* regformats/reg-x86-64.dat: Add xmlarch.
+--- ./gdb/ChangeLog.pseudo	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/ChangeLog.pseudo	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,189 @@
++2010-02-25  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_mmx_regnum_p): Optimized.
++	(i386_byte_regnum_p): Likewise.
++	(i386_word_regnum_p): Likewise.
++	(i386_dword_regnum_p): Likewise.
++
++2010-02-19  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_register_reggroup_p): Minimize function
++	calls.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_register_reggroup_p): Don't include pseudo
++	registers, except for MXX, in any register groups.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Set mm0_regnum only once.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_pseudo_register_name): Don't check MMX
++	pseudo registers.  Call i386_pseudo_register_name.
++	(amd64_init_abi): Restore num_xmm_regs.
++
++	* i386-tdep.c (i386_mmx_names): Make it static.
++	(i386_mmx_regnum_p): Likewise.
++	(i386_pseudo_register_name): Make it global.
++
++	* i386-tdep.h (i386_mmx_regnum_p): Removed.
++	(i386_mmx_names): Likewise.
++	(i386_pseudo_register_name): New.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Call set_gdbarch_num_pseudo_regs
++	before tdesc_use_registers.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_pseudo_register_read): Check invalid
++	register number.
++	(i386_pseudo_register_write): Likewise.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_pseudo_register_read): New.
++	(amd64_pseudo_register_write): Likewise.
++	(amd64_init_abi): Call set_gdbarch_pseudo_register_read and
++	set_gdbarch_pseudo_register_write.
++
++	* i386-tdep.c (i386_pseudo_register_read): Make it global.
++	Don't handle 64bit nor DWORD.
++	(i386_pseudo_register_write): Likewise.
++
++	* i386-tdep.h (i386_pseudo_register_read): New.
++	(i386_pseudo_register_write): Likewise.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_byte_names): Make it static.
++	(amd64_word_names): Likewise.
++	(amd64_dword_names): Likewise.
++	(amd64_pseudo_register_name): New.
++	(amd64_init_abi): Set num_byte_regs, num_word_regs, num_dword_regs
++	and num_mmx_regs.  Call set_tdesc_pseudo_register_name.
++
++	* i386-tdep.c (i386_mmx_names): Make it global.
++	(i386_mmx_regnum_p): Likewise.
++	(i386_byte_regnum_p): Likewise.
++	(i386_word_regnum_p): Likewise.
++	(i386_dword_regnum_p): Likewise.
++	(i386_pseudo_register_name): Remove XBFD64.
++	(i386_pseudo_register_read): Remove BFD64.
++	(i386_pseudo_register_write): Likewise.
++	(i386_gdbarch_init): Move set_gdbarch_pseudo_register_read and
++	set_gdbarch_pseudo_register_write before gdbarch_init_osabi.
++
++	* i386-tdep.h (i386_byte_regnum_p): New.
++	(i386_word_regnum_p): Likewise.
++	(i386_dword_regnum_p): Likewise.
++	(i386_mmx_regnum_p): Likewise.
++	(i386_mmx_names): Likewise.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (AMD64_NUM_REGS): Restored.
++
++	* amd64-tdep.h (AMD64_NUM_GREGS): Removed.
++
++2010-02-10  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (AMD64_NUM_REGS): Removed.
++
++	* amd64-tdep.h (AMD64_NUM_GREGS): New.
++
++	* i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS
++	with I387_NUM_REGS.
++	* i386-tdep.c (i386_go32_init_abi): Likewise.
++	(i386_gdbarch_init): Likewise.
++
++	* i386-tdep.h (i386_regnum): Add I386_MXCSR_REGNUM.
++	(I386_NUM_FREGS): Removed.
++	(I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM.
++
++	* i387-tdep.h (I387_NUM_REGS): New.
++
++2010-02-10  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Don't set num_xmm_regs.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_register_reggroup_p): Call
++	i386_register_reggroup_p instead of default_register_reggroup_p.
++
++	* amd64-tdep.c (amd64_num_pseudo_regs): Removed.
++	(amd64_init_abi): 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_mmx_regnum_p): Updated.
++	(i386_register_reggroup_p): Don't include pseudo byte, word,
++	dword registers in general_reggroup.
++	(i386_gdbarch_init): Updated.
++
++	* i386-tdep.h (gdbarch_tdep): Add num_mmx_regs.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_word_names): Add a missing ','.
++	(amd64_dword_names): New.
++	(amd64_num_pseudo_regs): Updated.
++
++	* amd64-tdep.h (amd64_dword_names): New.
++
++	* i386-tdep.c (i386_dword_regnum_p): New.
++	(i386_pseudo_register_name): Use i386_dword_regnum_p.
++	(i386_pseudo_register_type): Likewise.
++	(i386_pseudo_register_read): Likewise.
++	(i386_pseudo_register_write): Likewise.
++	(i386_gdbarch_init): Set num_dword_regs and eax_regnum.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Optimized.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_byte_names): New.
++	(amd64_word_names): Likewise.
++	(amd64_num_pseudo_regs): Likewise.
++	(amd64_init_abi): Call set_gdbarch_num_pseudo_regs with
++	amd64_num_pseudo_regs,
++
++	* amd64-tdep.h (amd64_byte_names): New.
++	(amd64_word_names): Likewise.
++
++	* i386-tdep.c (i386_num_byte_regs): Removed.
++	(i386_num_word_regs): Likewise.
++	(i386_byte_regnum_p): Updated.
++	(i386_word_regnum_p): Likewise.
++	(i386_pseudo_register_name): Support 64bit.
++	(i386_pseudo_register_read): Likewise.
++	(i386_pseudo_register_write): Likewise.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_byte_names): New.
++	(i386_word_names): Likewise.
++	(i386_num_byte_regs): Likewise.
++	(i386_num_word_regs): Likewise.
++	(i386_num_pseudo_regs): Likewise.
++	(i386_byte_regnum_p): Likewise.
++	(i386_word_regnum_p): Likewise.
++	(i386_pseudo_register_name): Handle byte and word pseudo-registers.
++	(i386_pseudo_register_type): Likewise.
++	(i386_pseudo_register_read): Likewise.
++	(i386_pseudo_register_write): Likewise.
++	(i386_gdbarch_init): Call set_gdbarch_num_pseudo_regs with
++	i386_num_pseudo_regs.  Set num_byte_regs, num_word_regs,
++	al_regnum, ax_regnum.  Put MMX pseudo-registers after word
++	pseudo-registers.
++
++	* i386-tdep.h (gdbarch_tdep): Add num_byte_regs, al_regnum,
++	num_word_regs, ax_regnum, num_dword_regs and eax_regnum.
+--- ./gdb/ChangeLog.xcr	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/ChangeLog.xcr	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,1304 @@
++2010-04-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): Call
++	i386_linux_update_xstateregset.
++
++2010-04-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_process_record): Replace i386_sse_regnum_p
++	with i386_xmm_regnum_p.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): Call
++	amd64_linux_update_xstateregset instead of
++	i386_linux_update_xstateregset.
++
++	* amd64-linux-tdep.c (amd64_linux_regset_sections): Make it
++	static.
++	(amd64_linux_update_xstateregset): New.
++
++	* amd64-linux-tdep.h (amd64_linux_regset_sections): Removed.
++	(amd64_linux_update_xstateregset): New.
++
++	* i386-linux-nat.c (i386_linux_read_description): Remove
++	i386_linux_regset_sections from i386_linux_update_xstateregset.
++
++	* i386-linux-tdep.c (i386_linux_regset_sections): Make it
++	static.
++	(i386_linux_update_xstateregset): Remove regset_sections.  Use
++	i386_linux_regset_sections.
++
++	* i386-linux-tdep.h (i386_linux_regset_sections): Removed.
++	(i386_linux_update_xstateregset): Remove regset_sections.
++	i386_linux_regset_sections.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-nat.c (fetch_xstateregs): Don't cast &iov to int.
++	(store_xstateregs): Likewise.
++	(i386_linux_read_description): Don't cast &iov to long.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.h (I386_LINUX_XSAVE_XCR0_OFFSET): Update
++	comments.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (xstate_size): Removed.
++	(amd64_linux_fetch_inferior_registers): Replace xstate_size
++	with I386_XSTATE_MAX_SIZE.
++	(amd64_linux_store_inferior_registers): Likewise.
++	(amd64_linux_read_description): Updated.
++
++	* i386-linux-nat.c (xstate_size): Removed.
++	(fetch_xstateregs): Replace xstate_size with
++	I386_XSTATE_MAX_SIZE.
++	(fetch_xstateregs): Likewise.
++	(i386_linux_read_description): Updated.
++
++	* common/i386-xstate.h (I386_XSTATE_MAX_SIZE): New.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): Replace
++	unsigned long long with uint64_t.
++	* amd64-linux-tdep.c (amd64_linux_core_read_description):
++	Likewise.
++	* i386-linux-nat.c (i386_linux_read_description): Likewise.
++	* i386-linux-tdep.h (i386_linux_core_read_xcr0): Likewise.
++
++	* i386-linux-tdep.c (i386_linux_core_read_xcr0): Replace
++	unsigned long long with uint64_t.  Don't assert section size.
++	(i386_linux_core_read_description): Replace unsigned long long
++	with uint64_t.
++
++	* i386-tdep.c (i386_ymm_type): Fix typos in comments.
++	(i386_pseudo_register_read): Change 16byte to 128bits in
++	comments.
++	(i386_validate_tdesc_p): Update comments.
++	(i386_gdbarch_init): Likewise.
++
++	* i386-tdep.h (gdbarch_tdep): Replace unsigned long long with
++	uint64_t.  Replace gdb with GDB in comments.
++
++2010-03-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Replace "x86=xml" with
++	"xmlRegisters+".
++
++2010-03-12  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (xstate_size_n_of_int64): Removed.
++	(amd64_linux_fetch_inferior_registers): Updated.
++	(amd64_linux_store_inferior_registers): Likewise.
++	(amd64_linux_read_description): Likewise.
++
++	* i386-linux-nat.c (xstate_size_n_of_int64): Removed.
++	(fetch_xstateregs): Updated.
++	(store_xstateregs): Likewise.
++	(i386_linux_read_description): Likewise.
++
++2010-03-12  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Include "i386-xstate.h".
++	(PTRACE_GETREGSET): New.
++	(PTRACE_SETREGSET): Likewise.
++	* i386-linux-nat.c: Likewise.
++
++	* amd64-linux-tdep.c: Include "i386-xstate.h".
++
++	* config/i386/linux64.mh (NAT_FILE): Set to config/nm-linux.h.
++
++	* config/i386/nm-linux.h: Don't include
++	"config/i386/nm-linux-xstate.h".
++
++	* config/i386/nm-linux-xstate.h: Removed.
++	* config/i386/nm-linux64.h: Likewise.
++
++2010-03-12  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_xsave): Replace I386_XSTATE_MAX_MASK
++	with I386_XSTATE_AVX_MASK.
++
++	* common/i386-xstate.h (I386_XSTATE_MAX_MASK): Removed.
++	(I386_XSTATE_MAX_SIZE): Likewise.
++
++2010-03-12  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_register_reggroup_p): Replace
++	bit_I386_XSTATE_XXX with I386_XSTATE_XXX.
++	* i387-tdep.c (i387_supply_xsave): Likewise.
++	(i387_collect_xsave): Likewise.
++
++	* common/i386-xstate.h (bit_I386_XSTATE_XXX): Renamed to ...
++	(I386_XSTATE_XXX): This.
++	(I386_XSTATE_XXX_MASK): Replace bit_I386_XSTATE_XXX with
++	I386_XSTATE_XXX.
++	(I386_XSTATE_SIZE): Likewise.
++
++2010-03-07  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_dwarf_reg_to_regnum): Return %ymmN
++	register number for %xmmN if AVX is available.
++
++	* i386-tdep.c (i386_xmm_regnum_p): Make it global.
++	(i386_dbx_reg_to_regnum): Return %ymmN register number for
++	%xmmN if AVX is available.
++
++	* i386-tdep.h (i386_xmm_regnum_p): New.
++
++2010-03-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Replace AMD64_AVX_NUM_REGS
++	with AMD64_NUM_REGS.
++
++	* amd64-tdep.h (AMD64_AVX_NUM_REGS): Renamed to ...
++	(AMD64_NUM_REGS): This.
++
++	* i386-linux-nat.c (GETFPXREGS_SUPPLIES): Replace
++	I386_AVX_NUM_REGS with I386_SSE_NUM_REGS.
++	(GETXSTATEREGS_SUPPLIES): New.
++	(i386_linux_fetch_inferior_registers): Use GETXSTATEREGS_SUPPLIES.
++	(i386_linux_store_inferior_registers): Likewise.
++
++2010-03-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_gregset_reg_offset): Count 8
++	upper YMM registers.
++
++2010-03-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_register_reggroup_p): For all_group, don't
++	include upper YMM registers nor XMM registers when AVX is
++	supported.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_collect_xsave): Replace regcache_raw_read
++	with regcache_raw_collect.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_register_reggroup_p): Don't return 0
++	for uppper YMM nor XMM registers.
++
++	* i387-tdep.c (xsave_sse_offset): Removed.
++	(XSAVE_SSE_ADDR): Likewise.
++	(i387_supply_xsave): Replace XSAVE_SSE_ADDR with FXSAVE_ADDR.
++	(i387_collect_xsave): Likewise.  Replace the second
++	regcache_raw_collect with memcpy.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (xsave_offset): Removed.
++	(XSAVE_ADDR): Likewise.
++	(xsave_sse_offset): New.
++	(XSAVE_SSE_ADDR): Likewise.
++	(xsave_avxh_offset): Likewise.
++	(XSAVE_AVXH_ADDR): Likewise.
++	(i387_supply_xsave): Updated.
++	(i387_collect_xsave): Likewise.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_xsave): Fix typos.
++	(i387_collect_xsave): Properly handle gcore.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Count
++	16 upper YMM registers.
++	(amd64_linux_gregset32_reg_offset): Count 8 upper YMM registers.
++
++	* amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace
++	AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM.
++
++	* amd64-tdep.c (amd64_sse_register_names): Renamed to ...
++	(amd64_register_names): This.
++	(amd64_avx_register_names): Removed.
++	(amd64_xmm_names): Likewise.
++	(AMD64_NUM_REGS): Likewise.
++	(amd64_ymm_names): New.
++	(amd64_ymmh_names): Likewise.
++	(amd64_register_name): Likewise.
++	(amd64_pseudo_register_name): Remove i386_xmm_regnum_p.  Add
++	i386_ymm_regnum_p.
++	(amd64_init_abi): Set ymmh_register_names, num_ymm_regs
++	and ymm0h_regnum.  Call set_gdbarch_register_name.  Replace
++	num_vector_regs with num_xmm_regs.  Replace AMD64_NUM_REGS
++	with AMD64_AVX_NUM_REGS.
++
++	* amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and
++	AMD64_YMM15H_REGNUM.
++	(AMD64_AVX_NUM_REGS): New.
++	(amd64_register_name): Removed.
++	(amd64_register_type): Likewise.
++
++	* i386-darwin-tdep.c (i386_darwin_init_abi): Replace
++	num_vector_regs with num_xmm_regs.
++
++	* i386-linux-nat.c (regmap): Count 8 upper YMM registers.
++	(GETFPXREGS_SUPPLIES): Replace I386_SSE_NUM_REGS with
++	I386_AVX_NUM_REGS.
++	* i386-linux-tdep.h (I386_LINUX_ORIG_EAX_REGNUM): Likewise.
++
++	* i386-nto-tdep.c (i386nto_register_area): Replace
++	I387_VECTOR0_REGNUM with I387_XMM0_REGNUM.
++
++	* i386-tdep.c (i386_sse_register_names): Renamed to ...
++	(i386_register_names): This.
++	(i386_avx_register_names): Removed.
++	(i386_xmm_names): Likewise.
++	(i386_vector_regnum_p): Likewise.
++	(i386_xmm_type): Likewise.
++	(): Likewise.
++	(): Likewise.
++	(i386_ymm_names): New.
++	(i386_ymmh_names): Likewise.
++	(i386_ymmh_regnum_p): Likewise.
++	(i386_ymm_regnum_p): Likewise.
++	(i386_register_name): Likewise.
++	(i386_ymm_type): Likewise.
++	(): Likewise.
++	(i386_mxcsr_regnum_p): Replace I387_VECTOR0_REGNUM with
++	I387_XMM0_REGNUM.
++	(i386_dbx_reg_to_regnum): Likewise.
++	(i386_pseudo_register_name): Remove i386_xmm_regnum_p.  Add
++	i386_ymm_regnum_p.
++	(i386_pseudo_register_type): Likewise.
++	(i386_pseudo_register_read): Likewise.
++	(i386_pseudo_register_write): Likewise.
++	(i386_go32_init_abi): Replace num_vector_regs with num_xmm_regs.
++	(i386_register_reggroup_p): Replace i386_vector_regnum_p. Add
++	i386_ymm_regnum_p.
++	(i386_validate_tdesc_p): Get SSE registers.  Try AVX registers.
++	(i386_gdbarch_init): Replace num_vector_regs with num_xmm_regs.
++	Call set_gdbarch_register_name.  Replace I386_SSE_NUM_REGS
++	with I386_AVX_NUM_REGS.  Set ymmh_register_names, ymm0h_regnum,
++	num_ymm_regs and ymm0_regnum.  Call set_gdbarch_qsupported
++	with "x86=xml".
++
++	* i386-tdep.h (gdbarch_tdep): Add num_ymm_regs, ymm0_regnum,
++	ymm0h_regnum, ymmh_register_names and i386_ymm_type.  Remove
++	xmm0_regnum, num_vector_regs and i386_xmm_type.
++	(i386_regnum): Add I386_YMM0H_REGNUM and I386_YMM7H_REGNUM.
++	(I386_AVX_NUM_REGS): New.
++	(i386_ymm_regnum_p): Likewise.
++	(i386_ymmh_regnum_p): Likewise.
++	(I386_MAX_REGISTER_SIZE): Changed to 16.
++	(i386_xmm_regnum_p): Removed.
++
++	* i387-tdep.c (i387_supply_fsave): Replace I387_VECTOR0_REGNUM
++	with I387_XMM0_REGNUM.
++	(i387_collect_fsave): Likewise.
++	(i387_supply_fxsave): Replace I387_VECTOR0_REGNUM/num_vector_regs
++	with I387_XMM0_REGNUM/num_vector_regs.
++	(i387_collect_fxsave): Likewise.
++	(xsave_sse_offset): Removed.
++	(XSAVE_SSE_ADDR): Likewise.
++	(xsave_avxh_offset): Likewise.
++	(XSAVE_AVXH_ADDR): Likewise.
++	(xsave_offset): New.
++	(XSAVE_ADDR): Likewise.
++	(i387_supply_xsave): Rewrite.
++	(i387_collect_xsave): Likewise.
++
++	* i387-tdep.h (I387_NUM_VECTOR_REGS): Renamed to ...
++	(I387_NUM_XMM_REGS): This.
++	(I387_NUM_YMM_REGS): New.
++	(I387_YMM0H_REGNUM): Likewise.
++	(I387_VECTOR0_REGNUM): Renamed to ...
++	(I387_XMM0_REGNUM): This.
++	(I387_MXCSR_REGNUM): Updated.
++	(I387_YMMENDH_REGNUM): New.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* features/i386/32bit-avx.xml: Only define upper YMM registers.
++	* features/i386/64bit-avx.xml: Likewise.
++
++	* features/i386/amd64-avx-linux.xml: Include 64bit-sse.xml.
++	* features/i386/amd64-avx.xml: Likewise.
++
++	* features/i386/i386-avx-linux.xml: Include 32bit-sse.xml.
++	* features/i386/i386-avx.xml: Likewise.
++
++	* features/i386/amd64-avx-linux.c: Regenerated.
++	* features/i386/amd64-avx.c: Likewise.
++	* features/i386/i386-avx-linux.c: Likewise.
++	* features/i386/i386-avx.c: Likewise.
++	* regformats/i386/amd64-avx-linux.dat: Likewise.
++	* regformats/i386/amd64-avx.dat: Likewise.
++	* regformats/i386/i386-avx-linux.dat: Likewise.
++	* regformats/i386/i386-avx.dat: Likewise.
++
++2010-03-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.h (XSAVE_XCR0_OFFSET): Renamed to ...
++	(I386_LINUX_XSAVE_XCR0_OFFSET): This.
++	* amd64-linux-tdep.c (amd64_linux_init_abi): Updated.
++	* i386-linux-tdep.c (i386_linux_core_read_xcr0): Likewise.
++	(i386_linux_init_abi): Likewise.
++
++2010-03-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_init_abi): Set xsave_xcr0_offset.
++	* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
++
++	* i386-tdep.c (i386_gdbarch_init): Set xsave_xcr0_offset to -1.
++
++	* i387-tdep.c (i387_collect_xsave): Updated.
++
++	* i387-tdep.h (XSAVE_XCR0_OFFSET): Moved to ...
++	* i386-linux-tdep.h (XSAVE_XCR0_OFFSET): Here.
++
++2010-03-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* features/i386/32bit-avx.xml: Define i386_mxcsr.
++	* features/i386/64bit-avx.xml: Likewise.
++
++	* features/i386/amd64-avx-linux.c: Regenerated.
++	* features/i386/amd64-avx.c: Likewise.
++	* features/i386/i386-avx-linux.c: Likewise.
++	* features/i386/i386-avx.c: Likewise.
++
++2010-02-25  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_xmm_regnum_p): Optimized.
++	(i386_vector_regnum_p): Likewise.
++
++2010-02-24  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_store_inferior_registers): Pass
++	0 to amd64_collect_xsave.
++
++	* amd64-tdep.c (amd64_collect_xstateregset): Pass 1 to
++	amd64_collect_xsave.
++	(amd64_collect_xsave): Add an integer argument and pass it to
++	i387_collect_xsave.
++
++	* amd64-tdep.h (amd64_collect_xsave): Add an integer argument.
++	* i387-tdep.h (i387_collect_xsave): Likewise.
++
++	* i386-linux-nat.c (store_xstateregs): Pass 1 to
++	i387_collect_xsave.
++	* i386-tdep.c (i386_collect_xstateregset): Likewise.
++
++	* i387-tdep.c (i387_collect_xsave): Add an integer argument
++	to indicate gcore.  Update the first 8 bytes of the
++	sw_usable_bytes[464..467] and `xstate_bv' with XCR0 for gcore.
++
++2010-02-24  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_collect_xsave): Fix more typos.
++
++2010-02-24  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_collect_xsave): Fix a typo.
++
++2010-02-24  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): Fix a typo.
++
++	* i386-tdep.c (i386_register_reggroup_p): Return 0 for pseudo
++	XMM registers if group isn't SSE.
++
++2010-02-24  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Include "regset.h".
++	(amd64_linux_read_description): Set .reg-xstate section size if
++	it is supported.
++	(_initialize_amd64_linux_nat): Call i386_xstate_init.
++
++	* amd64-linux-tdep.c: Include "regset.h" before
++	"amd64-linux-tdep.h".
++	(amd64_linux_regset_sections): Make it global.
++	(_initialize_amd64_linux_tdep): Don't call i386_xstate_init.
++
++	* amd64-linux-tdep.h (amd64_linux_regset_sections): New.
++
++	* config/i386/nm-linux-xstate.h (FILL_XSTATEREGSET): Removed.
++
++	* i386-linux-nat.c: Include "regset.h".
++	(i386_linux_read_description): Set .reg-xstate section size if
++	it is supported.
++	(_initialize_i386_linux_nat): Call i386_xstate_init.
++
++	* i386-linux-tdep.c: Include "regset.h" before "inferior.h".
++	(i386_linux_regset_sections): Make it global.
++	(_initialize_i386_linux_tdep): Don't call i386_xstate_init.
++
++	* i386-linux-tdep.h (i386_linux_regset_sections): New.
++
++2010-02-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_validate_tdesc_p): Use num_vector_regs instead
++	of num_xmm_regs to check vector registers.
++
++2010-02-20  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* features/i386/Makefile: New.
++
++2010-02-19  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_xsave): Remove one regcache_raw_supply
++	for x87.
++
++2010-02-19  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (have_ptrace_getregset): Make it static
++	and initialized to -1.
++	(amd64_linux_fetch_inferior_registers): Error if PTRACE_GETREGSET
++	fails.
++	(amd64_linux_store_inferior_registers): Likewise.
++	(amd64_linux_read_description): Set have_ptrace_getregset.
++	Check the native XCR0 only if PTRACE_GETREGSET is available.
++	(_initialize_amd64_linux_nat): Don't set have_ptrace_getregset.
++
++	* i386-linux-nat.c (have_ptrace_getregset): Make it static
++	and initialized to -1.
++	(fetch_xstateregs): Error if PTRACE_GETREGSET fails.
++	(store_xstateregs): Likewise.
++	(i386_linux_read_description): Set have_ptrace_getregset.
++	Check the native XCR0 only if PTRACE_GETREGSET is available.
++	(_initialize_i386_linux_nat): Don't set have_ptrace_getregset.
++
++2010-02-19  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common/i386-xstate.h (XSTATE_SSE_MASK): Add bit_XSTATE_X87.
++	(XSTATE_MAX_MASK): Defined with XSTATE_AVX_MASK only.
++	(XSTATE_SSE_MASK_STRING): Updated.
++	(XSTATE_AVX_MASK_STRING): Likewise.
++
++	* i387-tdep.c (i387_supply_xsave): Also check x87 registers.
++	(i387_collect_xsave): Likewise.
++
++2010-02-19  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Use num_vector_regs instead
++	of num_xmm_regs to check vector registers.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Set num_xmm_regs based on
++	vector feature.
++	* i386-tdep.c (i386_gdbarch_init): Likewise.
++
++	* i386-darwin-tdep.c (i386_darwin_init_abi): Replace num_xmm_regs
++	with num_vector_regs.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Set num_vector_regs to 16.
++
++	* i386-tdep.c (i386_gdbarch_init): Add num_xmm_regs to
++	set_gdbarch_num_pseudo_regs.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): Check the
++	native XCR0.
++
++	* amd64-linux-tdep.c: Include "features/i386/amd64-avx-linux.c".
++	(amd64_linux_core_read_description): Check XCR0 from core dump.
++	(_initialize_amd64_linux_tdep): Call
++	initialize_tdesc_amd64_avx_linux.
++
++	* amd64-tdep.c: Include "features/i386/amd64-avx.c".
++	(AMD64_NUM_REGS): Use amd64_sse_register_names.
++	(amd64_xmm_names): Make it static.
++	(amd64_pseudo_register_name): Handle XMM pseud registers.
++	(amd64_init_abi): Set register_names based on target description.
++	(_initialize_amd64_tdep): Call initialize_tdesc_amd64_avx.
++
++	* i386-linux-nat.c (i386_linux_read_description): Check the
++	native XCR0.
++
++	* i386-linux-tdep.c (i386_linux_core_read_xcr0): New.
++	(i386_linux_core_read_description): Use it.  Remove BFD64.
++	(i386_linux_read_description): Removed.
++	(_initialize_i386_linux_tdep): Call
++	initialize_tdesc_i386_avx_linux.
++
++	* i386-tdep.c (i386_xmm_regnum_p): Make it global.
++	(i386_pseudo_register_name): Remove BFD64.
++	(i386_pseudo_register_read): Likewise.
++	(i386_pseudo_register_write): Likewise.
++	(i386_gdbarch_init): Set register_names based on target
++	description.
++
++2010-02-13  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Properly
++	check extended state size.
++	(i386_linux_read_description): Properly check the native XCR0.
++
++2010-02-13  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common/i386-xstate.h (XSTATE_SSE_MASK): Defined with
++	bit_XSTATE_SSE.
++	(XSTATE_AVX_MASK): Defined with XSTATE_SSE_MASK and bit_XSTATE_AVX.
++	(XSTATE_MAX_MASK): Defined with XSTATE_AVX_MASK and bit_XSTATE_X87.
++	(XSTATE_SSE_MASK_STRING): Updated.
++	(XSTATE_AVX_MASK_STRING): Likewise.
++
++	* 386-linux-tdep.c (i386_linux_core_read_description): Use
++	XSTATE_XXX_MASK.
++	(i386_linux_core_read_description): Likewise.
++
++	* i386-tdep.c (i386_register_reggroup_p): Check xcr0 instead
++	of vector_unit.
++	(i386_gdbarch_init): Set xcr0 instead of vector_unit.
++
++	* i386-tdep.h (x86_vector_unit): Removed.
++	(gdbarch_tdep): Remove vector_unit.  Add xcr0.
++
++	* i387-tdep.c (i387_supply_fxsave): Check xcr0 instead of
++	vector_unit.
++	(i387_supply_xsave): Likewise.
++	(i387_collect_xsave): Likewise.
++
++2010-02-11  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Don't set xcr0 on x86 host.
++	(_initialize_i386_tdep): Don't call i386_xstate_init on x86 host.
++
++	* i386-tdep.h (gdbarch_tdep): Remove xcr0.
++
++	* i387-tdep.c (i387_supply_xsave): Replace tdep->xcr0 with
++	i386_xstate.xcr0.
++	(i387_collect_xsave): Likewise.
++
++2010-02-11  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Don't
++	set xcr0 here.
++
++2010-02-11  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Re-indent.
++
++	* i386-linux-tdep.c (i386_linux_read_description): Don't set
++	xcr0 here.
++	(_initialize_i386_linux_tdep): Re-indent.
++
++	* i386-tdep.c (i386_gdbarch_init): Set xcr0 on x86 host.
++	(_initialize_i386_tdep): Call i386_xstate_init on x86 host.
++
++	* i386-tdep.h (gdbarch_tdep): Mention xcr0 is used only for
++	native debug.
++
++2010-02-11  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Cast
++	NT_X86_XSTATE to unsigned int.
++	(amd64_linux_store_inferior_registers): Likewise.
++	* i386-linux-nat.c (fetch_xstateregs): Likewise.
++	(store_xstateregs): Likewise.
++
++2010-02-10  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Include "elf/common.h" and <sys/uio.h>.
++	(amd64_linux_fetch_inferior_registers): Use iovec.
++	(amd64_linux_store_inferior_registers): Likewise.
++
++	* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Don't
++	check i386_xstate.size.
++	* i386-linux-tdep.c (_initialize_i386_linux_tdep): Likewise.
++
++	* config/i386/nm-linux-xstate.h: Don't include "elf/common.h".
++	(PTRACE_REGSET_NT_SHIFT): Removed.
++	(PTRACE_REGSET_MAX_SIZE): Likewise.
++	(PTRACE_REGSET_XSTATE_ADDR): Likewise.
++
++	* i386-linux-nat.c: Include "elf/common.h" and <sys/uio.h>.
++	(fetch_xstateregs): Use iovec.
++	(store_xstateregs): Likewise.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_pseudo_register_read): Properly convert
++	XMM pseudo register to vector register.
++	(i386_pseudo_register_write): Likewise.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* features/i386/32bit-avx.xml: Fix typos.
++	* features/i386/64bit-avx.xml: Likewise.
++
++	* features/i386/amd64-avx-linux.c: Regenerated.
++	* features/i386/amd64-avx.c: Likewise.
++	* features/i386/i386-avx-linux.c: Likewise.
++	* features/i386/i386-avx.c: Likewise.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Count XMM pseudo registers.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.h (I387_XMM0_REGNUM): Renamed to ...
++	(I387_VECTOR0_REGNUM): This.
++	(I387_MXCSR_REGNUM): Updated.
++
++	* i386-nto-tdep.c (i386nto_register_area): Replace
++	I387_XMM0_REGNUM with I387_VECTOR0_REGNUM.
++
++	* i386-tdep.c (i386_sse_regnum_p): Renamed to ...
++	(i386_vector_regnum_p): This.  Replace I387_XMM0_REGNUM
++	with I387_VECTOR0_REGNUM.
++	(i386_fpc_regnum_p): Replace I387_XMM0_REGNUM with
++	I387_VECTOR0_REGNUM.
++	(i386_register_reggroup_p): Updated.  Handle XMM pseudo
++	registers.
++
++	* i387-tdep.c (i386_fpc_regnum_p): Replace I387_XMM0_REGNUM
++	with I387_VECTOR0_REGNUM.
++	(i387_supply_fxsave): Likewise.
++	(i387_collect_fxsave): Likewise.
++	(XSAVE_SSE_ADDR): Likewise.
++	(XSAVE_AVXH_ADDR): Likewise.
++	(i387_supply_xsave): Likewise.
++	(i387_collect_xsave): Likewise.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_pseudo_register_name): Handle XMM pseudo
++	registers.
++	(i386_pseudo_register_type): Likewise.
++	(i386_pseudo_register_read): Likewise.
++	(i386_pseudo_register_write): Likewise.
++	(i386_gdbarch_init): Likewise.
++	(i386_xmm_type): New.
++
++	* 386-tdep.h (gdbarch_tdep): Add num_xmm_regs, xmm0_regnum
++	and i386_xmm_type.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_xmm_names): New.
++	(amd64_num_pseudo_regs): Updated.
++
++	* amd64-tdep.h (amd64_xmm_names): New.
++
++	* i386-tdep.c (i386_xmm_names): New.
++	(i386_xmm_regnum_p): Likewise.
++	(i386_num_pseudo_regs): Updated.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.h (gdbarch_tdep): Rename num_xmm_regs to
++	num_vector_regs.
++
++	* i387-tdep.h (I387_NUM_XMM_REGS): Removed.
++	(I387_NUM_VECTOR_REGS): New.
++	(I387_MXCSR_REGNUM): Updated.
++
++	* amd64-tdep.c (amd64_init_abi): Updated.
++	* i386-tdep.c (i386_sse_regnum_p): Likewise.
++	(i386_mxcsr_regnum_p): Likewise.
++	(i386_go32_init_abi): Likewise.
++	(i386_gdbarch_init): Likewise.
++	* i387-tdep.c (i387_supply_fxsave): Likewise.
++	(i387_collect_fxsave): Likewise.
++	(i387_supply_xsave): Likewise.
++	(i387_collect_xsave): Likewise.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Replace PTRACE_GETXSTATEREGS with
++	PTRACE_GETREGSET in comments.
++	(have_ptrace_getxstateregs): Renamed to ...
++	(have_ptrace_getregset): This.
++	(amd64_linux_fetch_inferior_registers): Updated to use
++	PTRACE_GETREGSET.
++	(amd64_linux_store_inferior_registers): Updated to use
++	PTRACE_GETREGSET and PTRACE_SETREGSET.
++
++	* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Assert
++	the XSAVE extended state size.
++
++	* i386-linux-nat.c: Replace PTRACE_GETXSTATEREGS with
++	PTRACE_GETREGSET in comments.
++	(have_ptrace_getxstateregs): Renamed to ...
++	(have_ptrace_getregset): This.
++	(fetch_xstateregs): Updated to use PTRACE_GETREGSET.
++	(store_xstateregs): Updated to use PTRACE_GETREGSET and
++	PTRACE_SETREGSET.
++
++	* i386-linux-tdep.c (_initialize_i386_linux_tdep): Assert
++	the XSAVE extended state size.
++
++	* config/i386/nm-linux-xstate.h: Include "elf/common.h".
++	(PTRACE_GETXSTATEREGS): Removed.
++	(PTRACE_SETXSTATEREGS): Likewise.
++	(PTRACE_GETREGSET): New.
++	(PTRACE_SETREGSET): Likewise.
++	(PTRACE_REGSET_NT_SHIFT): Likewise.
++	(PTRACE_REGSET_MAX_SIZE): Likewise.
++	(PTRACE_REGSET_XSTATE_ADDR): Likewise.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c: Replace x86-64/x86_64 with amd64.
++	* i386-tdep.c: Likewise.
++
++	* features/Makefile: Replace x86-64 with amd64.
++	* features/i386/*: Rename x86-64* to amd64*.
++
++	* regformats/i386/*: Rename x86-64* to amd64*.
++
++2010-02-07  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common/i386-xstate.c: Don't include "config.h" if XSTATE_MAIN
++	is defined.
++	(main): Fix typo.
++
++2010-02-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common/i386-xstate.c (main): New.  Defined only if XSTATE_MAIN
++	is defined.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Set vector_unit.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* config/i386/nm-linux-xstate.h: Don't include <sys/ptrace.h>.
++
++	* i386-linux-tdep.c (i386_linux_read_description): Don't use
++	ptrace.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Pass
++	i386_xstate.size to XSTATE ptrace.
++	(amd64_linux_store_inferior_registers): Likewise.
++	* i386-linux-nat.c (fetch_xstateregs): Likewise.
++	(store_xstateregs): Likewise.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (PTRACE_GETXSTATEREGS): Don't define.
++	(PTRACE_SETXSTATEREGS): Likewise.
++	* i386-linux-nat.c (PTRACE_GETXSTATEREGS):
++	(PTRACE_SETXSTATEREGS): Likewise.
++
++	* config/i386/nm-linux.h: Include "config/i386/nm-linux-xstate.h".
++	* config/i386/nm-linux64.h: Likewise.
++
++	* 386-linux-tdep.c (i386_linux_read_description): Define only if
++	FILL_XSTATEREGSET is defined.  Use ptrace to get xcr0 from
++	kernel.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Update
++	comments.
++
++	* i386-linux-tdep.c: Include features/i386/i386-avx-linux.c
++	and features/i386/x86-64-avx-linux.c.
++	(i386_linux_core_read_description): Handle AVX.
++	(_initialize_i386_linux_tdep): Call initialize_tdesc_i386_avx_linux
++	and initialize_tdesc_x86_64_avx_linux.
++
++	* i386-tdep.c: Include features/i386/i386-avx.c and
++	features/i386/x86-64-avx.c.
++	(_initialize_i386_tdep): Call initialize_tdesc_i386_avx and
++	initialize_tdesc_x86_64_avx.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Try org.gnu.gdb.i386.avx.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* features/i386/32bit-avx.xml: New.
++	* features/i386/64bit-avx.xml: Likewise.
++	* features/i386/i386-avx-linux.c: Likewise.
++	* features/i386/i386-avx-linux.xml: Likewise.
++	* features/i386/i386-avx.c: Likewise.
++	* features/i386/i386-avx.xml: Likewise.
++	* features/i386/x86-64-avx-linux.c: Likewise.
++	* features/i386/x86-64-avx-linux.xml: Likewise.
++	* features/i386/x86-64-avx.c: Likewise.
++	* features/i386/x86-64-avx.xml: Likewise.
++
++	* features/Makefile (WHICH): Add i386/i386-avx,
++	i386/i386-avx-linux, i386/x86-64-avx and i386/x86-64-avx-linux.
++	(i386/i386-avx-expedite): New.
++	(i386/i386-avx-linux-expedite): Likewise.
++	(i386/x86-64-avx-expedite):Likewise.
++	(i386/x86-64-avx-linux-expedite): Likewise.
++	($(outdir)/i386/i386-avx.dat): New dependency.
++	($(outdir)/i386/i386-avx-linux.dat): Likewise.
++	($(outdir)/i386/x86-avx-64.dat): Likewise.
++	($(outdir)/i386/x86-64-avx-linux.dat): Likewise.
++
++	* regformats/reg-i386-avx-linux.dat: Moved to ..
++	* regformats/i386/i386-avx-linux.dat: Here.
++
++	* regformats/reg-i386-avx.dat: Moved to ..
++	* regformats/i386/i386-avx.dat: Here.
++
++	* regformats/reg-x86-64-avx-linux.dat: Moved to ...
++	* regformats/i386/x86-64-avx-linux.dat: Here.
++
++	* regformats/reg-x86-64-avx.dat: Moved to ...
++	* regformats/i386/x86-64-avx.dat: Here.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_sse_register_names): Make it global.
++	(amd64_avx_register_names): Likewise.
++	(amd64_init_abi): Don't call i386_gdbarch_vector_unit_init.
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Removed.
++	(i386_gdbarch_init): Don't call i386_gdbarch_vector_unit_init.
++	* i386-tdep.h (i386_gdbarch_vector_unit_init): Removed.
++
++2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Check
++	core size for AVX support.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_fxsave): Optimize xstate_bv == 0.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_fxsave): Don't use
++	regcache_raw_supply_part.
++	(i387_supply_xsave): Likewise.
++	(i387_collect_fxsave): Don't use regcache_raw_collect_part.
++	(i387_collect_xsave): Likewise.
++
++	* regcache.c (regcache_raw_supply_part): Removed.
++	(regcache_raw_collect_part): Likewise.
++	* regcache.h (regcache_raw_supply_part): Likewise.
++	(regcache_raw_collect_part): Likewise.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Update
++	warning message for xcr0.
++
++	* i387-tdep.c (i387_collect_xsave): Move comments on xstate_bv.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Check
++	FILL_XSTATEREGSET instead of bit_XSTATE_AVX.
++
++	* config/i386/nm-linux.h (FILL_XSTATEREGSET): Update comments.
++	* config/i386/nm-linux64.h (FILL_XSTATEREGSET): Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c: Include "i386-xstate.h".
++	* i387-tdep.c: Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Check if
++	bit_XSTATE_AVX is defined before using it.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (xstate-nat.o): Renamed to ...
++	(i386-xstate.o): This.
++
++	* i386-linux-tdep.c: Include "i386-xstate.h" instead of
++	"xstate-nat.h".
++	* config/i386/nm-linux.h: Likewise.
++	* config/i386/nm-linux64.h: Likewise.
++
++	* common/xstate-nat.c: Moved to ...
++	* common/i386-xstate.c: This.
++
++	* common/xstate-nat.h: Moved to ...
++	* common/i386-xstate.h: This.
++
++	* config/i386/linux.mh (NATDEPFILES): Replace xstate-nat.o with
++	i386-xstate.o.
++	* config/i386/linux64.mh (NATDEPFILES): Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Remove
++	xstate_bv offset.
++	(amd64_linux_gregset32_reg_offset): Likewise.
++
++	* amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Updated.
++
++	* amd64-tdep.c (amd64_sse_register_names): Remove xstate_bv.
++	(amd64_avx_register_names): Likewise.
++	(amd64_register_name): Remove AMD64_XSTATE_BV_REGNUM.
++	(amd64_register_type): Likewise.
++
++	* amd64-tdep.h (AMD64_XSTATE_BV_REGNUM): Removed.
++
++	* i386-linux-nat.c (regmap): Remove xstate_bv.
++
++	* i386-tdep.c (i386_sse_register_names): Remove xstate_bv.
++	(i386_avx_register_names): Likewise.
++	(i386_xstate_regnum_p): Removed.
++	(i386_register_name): Remove I387_XSTATE_BV_REGNUM.
++
++	* i386-tdep.h (I386_SSE_NUM_REGS): Remove xstate_bv.
++
++	* i387-tdep.c (XSAVE_XSTATE_BV_ADDR): Update comments.
++
++	* i387-tdep.h (I387_XSTATE_BV_REGNUM): Removed.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Update call to
++	i386_gdbarch_vector_unit_init.
++
++	* gdbarch.c (gdbarch_qsupported_process_ack): Return void.
++	* gdbarch.h (gdbarch_qsupported_process_ack_ftype): Likewise.
++	(gdbarch_qsupported_process_ack): Likewise.
++
++	* i386-tdep.c (remote_xcr0): New.
++	(i386_gdbarch_vector_unit_init): Use remote_xcr0 for remote
++	client.
++	(i386_qsupported_process_ack): Set remote_xcr0.
++	(i386_gdbarch_init): Update i386_gdbarch_vector_unit_init call.
++
++	* i386-tdep.h (i386_gdbarch_vector_unit_init): Updated.
++
++	* remote.c (remote_query_supported): Call
++	gdbarch_qsupported_process_ack with NULL to prepare qSupported
++	ACK processing.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* regformats/reg-i386-avx-linux.dat: Add xmlarch and osabi.
++	* regformats/reg-x86-64-avx-linux.dat: Likewise.
++
++	* regformats/reg-i386-avx.dat: Add xmlarch.
++	* regformats/reg-x86-64-avx.dat: Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Use
++	XSTATE_SSE_SIZE instead of 576.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_g_packet_size): Removed.
++	(amd64_linux_init_abi): Remove i386_register_g_packet_guesses.
++
++	* amd64-tdep.c (amd64_g_packet_size): Removed.
++	(amd64_init_abi): Update i386_gdbarch_vector_unit_init call.
++	Remove i386_register_g_packet_guesses.
++
++	* amd64-tdep.h (AMD64_G_PACKET_SIZE_SSE): Removed.
++	(AMD64_G_PACKET_SIZE_AVX): Likewise.
++
++	* gdbarch.c (gdbarch_qsupported_process_ack): Add value.
++	* gdbarch.h (gdbarch_qsupported_process_ack_ftype): Likewise.
++	(gdbarch_qsupported_process_ack): Likewise.
++
++	* i386-linux-tdep.c (i386_linux_g_packet_size): Removed.
++	(i386_linux_init_abi): Remove i386_register_g_packet_guesses.
++
++	* i386-tdep.c: Don't include "remote.h" nor
++	"target-descriptions.h".
++	(i386_register_g_packet_guesses): Removed.
++	(i386_g_packet_size): Likewise.
++	(386_gdbarch_vector_unit_init): Rewrite.
++	(i386_qsupported_process_ack): New.
++	(i386_gdbarch_init): Update i386_gdbarch_vector_unit_init call.
++	Remove i386_register_g_packet_guesses. Call
++	set_gdbarch_qsupported_process_ack.
++
++	* i386-tdep.h (x86_vector_unit): Remove unknown.
++	(I386_G_PACKET_SIZE_SSE): Removed.
++	(I386_G_PACKET_SIZE_AVX): Likewise.
++	(I386_PROPERTY_SSE): Likewise.
++	(I386_PROPERTY_AVX): Likewise.
++	(AMD64_PROPERTY_SSE): Likewise.
++	(AMD64_PROPERTY_AVX): Likewise.
++	(i386_g_packet_size): Likewise.
++	(i386_register_g_packet_guesses): Likewise.
++	(i386_gdbarch_vector_unit_init): Updated.
++
++	* remote.c (remote_query_supported): Pass value to
++	gdbarch_qsupported_process_ack.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_collect_xsave): Optimized.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* regformats/reg-i386-avx-linux.dat: Remove xcr0.
++	* regformats/reg-i386-avx.dat: Likewise.
++	* regformats/reg-x86-64-avx-linux.dat: Likewise.
++	* regformats/reg-x86-64-avx.dat: Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common/xstate-nat.h (XSTATE_SSE_MASK): New.
++	(XSTATE_AVX_MASK): Likewise.
++	(XSTATE_MAX_MASK): Likewise.
++	(XSTATE_SSE_MASK_STRING): Likewise.
++	(XSTATE_AVX_MASK_STRING): Likewise.
++	(XSTATE_MAX_MASK_STRING): Likewise.
++	(XSTATE_SSE_SIZE): Likewise.
++	(XSTATE_AVX_SIZE): Likewise.
++	(XSTATE_MAX_SIZE): Likewise.
++	(XSTATE_SSE_SIZE_STRING): Likewise.
++	(XSTATE_AVX_SIZE_STRING): Likewise.
++	(XSTATE_MAX_SIZE_STRING): Likewise.
++
++	* i386-tdep.c (i386_gdbarch_init): Use XSTATE_MAX_SIZE_STRING
++	and XSTATE_MAX_MASK_STRING on set_gdbarch_qsupported.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdbarch.c (gdbarch): Add qsupported_process_ack.
++	(startup_gdbarch): Likewise.
++	(gdbarch_alloc): Likewise.
++	(verify_gdbarch): Likewise.
++	(gdbarch_dump): Likewise.
++	(gdbarch_qsupported_process_ack): New.
++	(set_gdbarch_qsupported_process_ack): Likewise.
++
++	* gdbarch.h (gdbarch_qsupported_process_ack_ftype): New.
++	(gdbarch_qsupported_process_ack): Likewise.
++	(set_gdbarch_qsupported_process_ack): Likewise.
++
++	* i386-tdep.c (i386_gdbarch_init): Update call to
++	set_gdbarch_qsupported.
++
++	* remote.c (remote_state): Replace qsupported with gdbarch.
++	(init_remote_state): Set gdbarch instead of  qsupported.
++	(remote_query_supported): Replace qsupported with
++	gdbarch_qsupported.  Call gdbarch_qsupported_process_ack on
++	unprocessed ACKs.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_xsave): Apply XCR0 mask to clear_bv.
++	(i387_collect_xsave): Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Remove
++	xcr0 offset.
++	(amd64_linux_gregset32_reg_offset): Likewise.
++
++	* amd64-tdep.c (amd64_sse_register_names): Remove xcr0.
++	(amd64_avx_register_names): Likewise.
++	(amd64_register_name): Remove AMD64_XCR0_REGNUM.
++	(amd64_register_type): Remove AMD64_XCR0_REGNUM.  Update
++	AMD64_XSTATE_BV_REGNUM.
++
++	* amd64-tdep.h (AMD64_XCR0_REGNUM): Removed.
++
++	* i386-linux-nat.c (regmap): Remove xcr0.
++
++	* i386-tdep.c (i386_sse_register_names): Remove xcr0.
++	(i386_avx_register_names): Likewise.
++	(i386_xstate_regnum_p): Removed.
++	(i386_register_name): Remove I387_XCR0_REGNUM.
++	(i386_xcr0_type): Removed.
++	(i386_register_type): Remove I387_XCR0_REGNUM and
++	I387_XSTATE_BV_REGNUM.
++	(i386_register_reggroup_p): Remove i386_xstate_regnum_p.
++
++	* i386-tdep.h (gdbarch_tdep): Remove i386_xcr0_type.
++	(I386_SSE_NUM_REGS): Remove xcr0.
++	(i386_xcr0_type): Removed.
++
++	* i387-tdep.c (XSAVE_XCR0_ADDR): Removed.
++	(i387_supply_xsave): Clear part in vector registers if its bit in
++	xstat_bv is zero.  Don't update I387_XCR0_REGNUM nor
++	I387_XSTATE_BV_REGNUM.
++	(i387_collect_xsave): Clear part in vector registers if its bit
++	in xstat_bv is zero.  Update xstat_bv directly.
++
++	* i387-tdep.h (I387_XCR0_REGNUM): Removed.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdbarch.c (gdbarch): Add qsupported.
++	(startup_gdbarch): Likewise.
++	(gdbarch_alloc): Likewise.
++	(verify_gdbarch): Likewise.
++	(gdbarch_dump): Likewise.
++	(gdbarch_qsupported): New.
++	(set_gdbarch_qsupported): Likewise.
++
++	* gdbarch.h (gdbarch_qsupported): New.
++	(set_gdbarch_qsupported): Likewise.
++
++	* i386-tdep.c (i386_gdbarch_init): Call set_gdbarch_qsupported.
++
++	* remote.c (remote_state): Add qsupported.
++	(init_remote_state): Set qsupported from gdbarch_qsupported.
++	(remote_query_supported): Support qsupported.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_collect_xsave): Optimize updating single
++	vector register.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_collect_xsave): Get the original `xstat_bv'.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Use
++	regcache_cooked_read_unsigned.
++
++	* i387-tdep.c (i387_collect_xsave): Update the bits in
++	`xstate_bv' if any SSE/AVX registers are changed.  Don't change
++	`xcr0'.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_sse_register_names): Use NULL on xstate_bv.
++	(amd64_avx_register_names): Likewise.
++	(amd64_register_name): Return NULL for AMD64_XSTATE_BV_REGNUM.
++
++	* amd64-tdep. (AMD64_G_PACKET_SIZE_AVX): Don't include xstate_bv.
++
++	* i386-tdep.c (i386_sse_register_names): Use NULL on xstate_bv.
++	(i386_avx_register_names): Likewise.
++	(i386_register_name): Return NULL for I386_XSTATE_BV_REGNUM.
++
++	* i386-tdep. (I386_G_PACKET_SIZE_AVX): Don't include xstate_bv.
++
++	* i387-tdep.c (XSAVE_XSTATE_BV_ADDR): Update comments.
++
++	* regformats/reg-i386-avx-linux.dat: Remove xstate_bv.
++	* regformats/reg-i386-avx.dat: Likewise.
++	* regformats/reg-x86-64-avx-linux.dat: Likewise.
++	* regformats/reg-x86-64-avx.dat: Likewise.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Correct the
++	XCR0 register number for 64bit.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Get xcr0 from
++	the remote target.
++
++2010-01-31  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.h (AMD64_G_PACKET_SIZE_AVX): Add sizes for xcr0
++	and xstate_bv.
++	* i386-tdep.h (I386_G_PACKET_SIZE_AVX): Likewise.
++
++	* regformats/reg-i386-avx-linux.dat: Add xcr0 and xstate_bv.
++	* regformats/reg-i386-avx.dat: Likewise.
++	* regformats/reg-x86-64-avx-linux.dat: Likewise.
++	* regformats/reg-x86-64-avx.dat: Likewise.
++
++2010-01-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Read 8
++	bytes for xcr0.
++
++2010-01-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.h (XSAVE_XCR0_OFFSET): Update comments.
++
++2010-01-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_register_name): Return NULL for xcr0
++	and xstate_bv if XSAVE extended state isn't supported.
++	* i386-tdep.c (i386_register_name): Likewise.
++	(i386_xstate_regnum_p): Return 0 of XSAVE extended state isn't
++	supported.
++
++2010-01-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_xstate_regnum_p): New.
++	(i386_register_reggroup_p): Use it.
++
++2010-01-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c: Include i387-tdep.h and xstate-nat.h.
++	(i386_linux_core_read_description): Read xcr0 from core file.
++
++	* i387-tdep.c (XSAVE_XCR0_ADDR): New.
++	(XSAVE_XSTATE_BV_ADDR): Likewise.
++
++	* i387-tdep.h (XSAVE_XCR0_OFFSET): New.
++	(XSAVE_XCR0_ADDR): Removed.
++	(XSAVE_XSTATE_BV_ADDR): Likewise.
++
++2010-01-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Add
++	entries of -1 for xcr0 and xstate_bv.
++	(amd64_linux_gregset32_reg_offset): Likewise.
++	* i386-linux-nat.c (regmap): Likewise.
++
++	* amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace
++	AMD64_MXCSR_REGNUM with AMD64_XSTATE_BV_REGNUM.
++
++	* amd64-tdep.c (amd64_sse_register_names): Add xcr0 and xstate_bv.
++	(amd64_avx_register_names): Likewise.
++	(amd64_register_type): Handle AMD64_XCR0_REGNUM and
++	AMD64_XSTATE_BV_REGNUM.
++
++	* amd64-tdep.h (amd64_regnum): Add AMD64_XCR0_REGNUM and
++	AMD64_XSTATE_BV_REGNUM.
++
++	* i386-tdep.c (i386_sse_register_names): Add xcr0 and xstate_bv.
++	(i386_avx_register_names): Likewise.
++	(i386_xcr0_type): New.
++	(i386_register_type): Handle AMD64_XCR0_REGNUM and
++	AMD64_XSTATE_BV_REGNUM.
++	(i386_gdbarch_vector_unit_init): Set the xcr0 field.
++
++	* i386-tdep.h (gdbarch_tdep): Add xcr0 and i386_xcr0_type.
++	(I386_SSE_NUM_REGS): Increase by 2.
++	(i386_xcr0_type): New.
++
++	* i387-tdep.c (i387_supply_xsave): Handle I387_XCR0_REGNUM
++	and I387_XSTATE_BV_REGNUM.
++	(i387_collect_xsave): Likewise.
++
++	* i387-tdep.h (I387_XCR0_REGNUM): New.
++	(I387_XSTATE_BV_REGNUM): Likewise.
++	(XSAVE_XCR0_ADDR): Likewise.
++	(XSAVE_XSTATE_BV_ADDR): Likewise.
++
++2010-01-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Fall
++	back after PTRACE_GETXSTATEREGS if have_ptrace_getxstateregs == 1.
++	(amd64_linux_store_inferior_registers): Likewise.
++	(_initialize_amd64_linux_nat): Initialize have_ptrace_getxstateregs
++	to 2 for AVX.
++
++	* i386-linux-nat.c (fetch_xstateregs): Fall back after
++	PTRACE_GETXSTATEREGS if have_ptrace_getxstateregs == 1.
++	(store_xstateregs): Likewise.
++	(_initialize_i386_linux_nat): Initialize have_ptrace_getxstateregs
++	to 2 for AVX.
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Updated.
++
++	* common/xstate-nat.h (xstate): Removed.
++	(xstate_status): New.
++	(bit_XSTATE_X87): Likewise.
++	(bit_XSTATE_SSE): Likewise.
++	(bit_XSTATE_AVX): Likewise.
++	(i386_xstate_type): Remove state.  Add status and xcr0.
++
++	* common/xstate-nat.c (i386_xstate_init): Updated.
+--- ./gdb/ChangeLog.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/ChangeLog.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,464 @@
++2010-03-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* remote.c (register_remote_support_xml): Use strtok.
++
++2010-03-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* NEWS: Mention xmlRegisters= in qSupported packet.
++
++2010-03-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Move
++	register_remote_support_xml call to ...
++	(_initialize_i386_tdep): Here.
++
++2010-03-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Pass "i386" instead of "x86"
++	to register_remote_support_xml.
++
++2010-03-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* remote.c (register_remote_support_xml): Do nothing if
++	HAVE_LIBEXPAT is undefined.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* remote.c (register_remote_support_xml): Add "xmlRegisters="
++	prefix.  Free the unused old memory.
++	(remote_query_supported_append): New.
++	(remote_query_supported): Call remote_query_supported_append.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c: Include "remote.h".
++	(i386_gdbarch_init): Call register_remote_support_xml.
++
++	* remote.c (remote_support_xml): New.
++	(register_remote_support_xml): Likewise.
++	(remote_query_supported): Support remote_support_xml.
++
++	* remote.h (register_remote_support_xml): New.
++
++2010-02-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_core_read_description): Don't
++	check .reg section size.
++	* i386-linux-tdep.c (i386_linux_core_read_description): Likewise.
++
++2010-02-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New.
++	(amd64_linux_read_description): Use it.
++
++2010-02-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_init_abi): Check orig_rax
++	right after amd64_init_abi.
++
++	* i386-linux-tdep.c (i386_linux_init_abi): Check orig_eax
++	right after i386_elf_init_abi.
++
++2010-02-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): Read CS
++	register to check process address space.
++
++2010-02-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_validate_tdesc_p): New.
++	(i386_gdbarch_init): Use it.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): Return
++	tdesc_i386_linux for 32bit.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Set num_core_regs and
++	register_names after tdesc.
++	* i386-tdep.c (i386_gdbarch_init): Don't check bfd_arch_i386.  Set 
++	num_core_regs and register_names after tdesc.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_init_abi): Remove a strayed
++	comment.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Don't include "i387-tdep.h".
++	* amd64-linux-tdep.c: Likewise.
++	* i386-linux-tdep.c: Likewise.
++
++	* i386-tdep.h (i386_regnum): Add I386_MXCSR_REGNUM.
++	(I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM.
++
++2010-02-17  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.h (tdesc_i386): Removed.
++
++2010-02-17  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Include "i387-tdep.h".
++	(amd64_linux_read_description): Just return tdesc_amd64_linux.
++
++	* amd64-linux-tdep.c: Don't include "i386-linux-tdep.h".
++	Include "i387-tdep.h".
++	(amd64_linux_register_name): Removed.
++	(amd64_linux_register_type): Likewise.
++	(amd64_linux_core_read_description): Just return
++	tdesc_amd64_linux.
++	(amd64_linux_init_abi): Set target description to
++	tdesc_amd64_linux if needed.  Support orig_rax.  Set
++	register_reggroup_p.
++
++	* amd64-tdep.c (amd64_register_names): Make it static.
++	(amd64_core_read_description): Removed.
++	(amd64_init_abi): Set num_core_regs and register_names.  Set
++	target description to tdesc_amd64 if needed.  Call
++	set_gdbarch_num_regs. 
++
++	* amd64-tdep.h (amd64_register_names): Removed.
++	(tdesc_amd64): Likewise.
++
++	* i386-linux-tdep.c: Include "i387-tdep.h".
++	(i386_linux_register_name): Removed.
++	(i386_linux_register_type): Likewise.
++	(amd64_linux_init_abi): Set target description to
++	tdesc_i386_linux if needed.  Support orig_eax.  Set
++	register_reggroup_p.
++
++	* i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS
++	with I387_NUM_REGS.
++
++	* i386-tdep.c: Don't include "amd64-tdep.h".
++	(i386_go32_init_abi): Replace I386_NUM_FREGS with I387_NUM_REGS.
++	(i386_core_read_description): Removed.
++	(i386_gdbarch_init): Set target description to tdesc_i386 if
++	needed.  Set gregset_num_regs to I386_NUM_GREGS.  Set
++	num_core_regs and register_names.  Set register_reggroup_p.
++
++2010-02-17  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Move tdesc_use_registers
++	more toward the end of the function.  Call tdesc_use_registers
++	after gdbarch_init_osabi.  Update
++	set_gdbarch_register_reggroup_p.
++
++	* i386-tdep.h (gdbarch_tdep): Add num_core_regs,
++	register_names, tdesc and register_reggroup_p.
++	(I386_NUM_FREGS): Removed.
++	(I386_SSE_NUM_REGS): Replace I386_NUM_FREGS with I387_NUM_REGS.
++
++	* i387-tdep.h (I387_NUM_REGS): New.
++
++2010-02-17  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Move tdesc_use_registers
++	further toward the end of the function.
++
++2010-02-17  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Move tdesc_use_registers
++	toward the end of the function.
++
++2010-02-17  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c: Include "features/i386/amd64.c".
++	(amd64_core_read_description): New.
++	(_initialize_amd64_tdep): Likewise.
++	(amd64_init_abi): Call set_gdbarch_core_read_description.
++
++	* amd64-tdep.h (tdesc_amd64): New.
++
++	* i386-tdep.c: Include i386-tdep.h" instead of "amd64-tdep.h".
++	Include "amd64-tdep.h" instead of "features/i386/amd64.c" when
++	BFD64 is defined.
++	(i386_core_read_description): New.
++	(i386_gdbarch_init): Call set_gdbarch_core_read_description.
++	(_initialize_i386_tdep): Don't Call initialize_tdesc_amd64.
++
++	* i386-tdep.h (tdesc_i386): New.
++
++2010-02-17  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_read_description): New.
++	(_initialize_amd64_linux_nat): Use it.
++
++	* amd64-linux-tdep.c: Include "i386-linux-tdep.h" and
++	features/i386/amd64-linux.c.
++	(amd64_linux_register_name): New.
++	(amd64_linux_register_type): Likewise.
++	(amd64_linux_core_read_description): Likewise.
++	(amd64_linux_init_abi): Support remote stub without XML target
++	description.  Use amd64_linux_core_read_description instead of
++	i386_linux_core_read_description.
++	(_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux.
++
++	* amd64-linux-tdep.h: Don't include "i386-linux-tdep.h".
++	(tdesc_amd64_linux): New.
++
++	* i386-linux-nat.c (i386_linux_read_description): New.
++
++	* i386-linux-tdep.c: Include "i386-tdep.h/"i386-linux-tdep.h"
++	instead of "amd64-tdep.h"/"amd64-linux-tdep.h".
++	(i386_linux_register_name): Don't check BFD64.
++	(i386_linux_register_type): Likewise.
++	(_initialize_i386_linux_tdep): Likewise.
++	(i386_linux_init_orig_eax): Removed.
++	(i386_linux_core_read_description): Make it static.  Don't
++	check BFD64.
++	(i386_linux_read_description): Removed.
++	(i386_linux_init_abi): Support remote stub without XML target
++	description.
++
++	* i386-linux-tdep.h (i386_linux_core_read_description): Removed.
++	(i386_linux_read_description): Likewise.
++	(i386_linux_init_orig_eax): Likewise.
++	(tdesc_i386_linux): New.
++
++2010-02-10  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Optimize for BFD64.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_register_name): Optimized for
++	BFD64.
++	(i386_linux_register_type): Likewise.
++	(i386_linux_init_orig_eax): Likewise.
++	(i386_linux_read_description): Likewise.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* target-descriptions.c (tdesc_gdb_type): Correct i386_eflags
++	type.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Set numbers of different
++	registers separately for 32bit and 64bit.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i387_ext_type): Call tdesc_find_type instead of
++	arch_float_type.
++
++	* target-descriptions.c (tdesc_find_type): New.
++	(tdesc_gdb_type): Use it.
++
++	* target-descriptions.h (tdesc_find_type): New.
++
++2010-02-07  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c: Replace x86-64/x86_64 with amd64.
++	* i386-tdep.c: Likewise.
++
++	* features/Makefile: Replace x86-64 with amd64.
++	* features/i386/*: Rename x86-64* to amd64*.
++
++	* regformats/i386/*: Rename x86-64* to amd64*.
++
++2010-02-07  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* features/Makefile (I386-XMLTOC): Removed. 
++	(I386-CFILES): Likewise.
++	(i386-cfiles): Likewise.
++
++2010-02-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_init_orig_eax): Return only
++	if XML target description is available.
++
++2010-02-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_init_orig_eax): Check
++	org.gnu.gdb.i386.linux instead of org.gnu.gdb.i386.core.
++
++2010-02-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_init_abi): Revert the last
++	change.  Call i386_linux_init_orig_eax.
++
++	* i386-linux-tdep.c (i386_linux_register_name): Make it static.
++	(i386_linux_register_type): Likewise.
++	(i386_linux_init_orig_eax): New.
++	(i386_linux_init_abi): Revert the last change.  Call
++	i386_linux_init_orig_eax.
++
++	* i386-linux-tdep.h (i386_linux_register_name): Removed.
++	(i386_linux_register_type): Likewise.
++	(i386_linux_init_orig_eax): New.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (amd64_linux_init_abi): Restore
++	set_gdbarch_num_regs.  Call set_gdbarch_register_name,
++	set_gdbarch_register_type and set_gdbarch_remote_register_number.
++
++	* amd64-linux-tdep.h: Include "i386-linux-tdep.h".
++
++	* i386-linux-tdep.c: Include "i386-tdep.h" and
++	"i386-linux-tdep.h" with "amd64-tdep.h" and "amd64-linux-tdep.h".
++	(i386_linux_register_name): Restored and rewote.  Make it global.
++	(i386_linux_register_type): New.
++	(i386_linux_init_abi): Restore set_gdbarch_num_regs and
++	set_gdbarch_register_name.  Call set_gdbarch_register_type and
++	set_gdbarch_remote_register_number.
++
++	* i386-linux-tdep.h (i386_linux_register_name): New.
++	(i386_linux_register_type): Likewise.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Fix a
++	typo in comments.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_init): Optimize target description
++	check.
++
++2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c: Include "i386-linux-tdep.h"
++	(amd64_linux_init_abi): Call set_gdbarch_core_read_description.
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Fix a
++	typo.
++
++2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (_initialize_amd64_linux_nat): Set
++	to_read_description to i386_linux_read_description.
++	* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
++
++	* amd64-linux-tdep.c (amd64_linux_register_name): Removed.
++	(amd64_linux_register_type): Likewise.
++	(amd64_linux_init_abi): Don't call set_gdbarch_num_regs,
++	set_gdbarch_register_name nor set_gdbarch_register_type.
++
++	* amd64-tdep.c (amd64_register_names): Make it global.
++	(amd64_register_name): Removed.
++	(amd64_register_type): Likewise.
++	(amd64_init_abi): Don't call set_gdbarch_num_regs,
++	set_gdbarch_register_name nor set_gdbarch_register_type.
++
++	* amd64-tdep.h (amd64_register_names): New.
++
++	* i386-linux-tdep.c: Include features/i386/i386-linux.c and
++	features/i386/x86-64-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_num_regs nor
++	set_gdbarch_register_name.  Call
++	set_gdbarch_core_read_description.
++	(_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux
++	and initialize_tdesc_x86_64_linux.
++
++	* i386-linux-tdep.h (i386_linux_core_read_description): New.
++	(i386_linux_read_description): Likewise.
++
++	* i386-tdep.c: Include "amd64-tdep.h" instead of "i386-tdep.h".
++	Include features/i386/i386.c and features/i386/x86-64.c.
++	(i386_num_register_names): Removed.
++	(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.
++	(i386_pseudo_register_name): New.
++	(i386_pseudo_register_type): Likewise.
++	(i386_mmx_type): Make it static.
++	(i386_gdbarch_init): Don't call set_gdbarch_register_name
++	nor set_gdbarch_register_type.  Call
++	set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name
++	and tdesc_use_registers.
++	(_initialize_i386_tdep): Call initialize_tdesc_i386 and
++	initialize_tdesc_x86_64.
++
++	* i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type,
++	i386_mxcsr_type and i386_sse_type.
++	(i386_eflags_type): Removed.
++	(i386_mxcsr_type): Likewise.
++	(i386_mmx_type): Likewise.
++	(i386_sse_type): Likewise.
++	(i386_register_name): Likewise.
++
++	* features/Makefile (I386-XMLTOC): New.
++	(I386-CFILES): Likewise.
++	(i386-cfiles): Likewise.
++
++	* features/i386/32bit-sse.xml: Update vec128 type.
++	* features/i386/64bit-sse.xml: Likewise.
++
++	* features/i386/i386-linux.c: Regenerated.
++	* features/i386/i386.c: Likewise.
++	* features/i386/x86-64-linux.c: Likewise.
++	* features/i386/x86-64.c: Likewise.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* target-descriptions.c (tdesc_type): Add TDESC_TYPE_I387_EXT,
++	TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
++	(tdesc_predefined_types): Add i387_ext, i386_eflags and
++	i386_mxcsr.
++	(tdesc_gdb_type): Handle TDESC_TYPE_I387_EXT,
++	TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
++	(
++	* features/i386/32bit-core.xml: Replace i386_ext with i387_ext.
++	* features/i386/64bit-core.xml: Likewise.
++
++	* features/i386/i386-linux.c: New.
++	* features/i386/i386.c: Likewise.
++	* features/i386/x86-64-linux.c: Likewise.
++	* features/i386/x86-64.c: Likewise.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* features/i386/32bit-core.xml: New.
++	* features/i386/32bit-linux.xml: Likewise.
++	* features/i386/32bit-sse.xml: Likewise.
++	* features/i386/64bit-core.xml: Likewise.
++	* features/i386/64bit-linux.xml: Likewise.
++	* features/i386/64bit-sse.xml: Likewise.
++	* features/i386/i386-linux.xml: Likewise.
++	* features/i386/i386.xml: Likewise.
++	* features/i386/x86-64-linux.xml: Likewise.
++	* features/i386/x86-64.xml: Likewise.
++
++	* features/Makefile (WHICH): Add i386/i386, i386/i386-linux,
++	i386/x86-64 and i386/x86-64-linux.
++	(i386/i386-expedite): New.
++	(i386/i386-linux-expedite): Likewise.
++	(i386/x86-64-expedite):Likewise.
++	(i386/x86-64-linux-expedite): Likewise.
++	($(outdir)/i386/i386.dat): New dependency.
++	($(outdir)/i386/i386-linux.dat): Likewise.
++	($(outdir)/i386/x86-64.dat): Likewise.
++	($(outdir)/i386/x86-64-linux.dat): Likewise.
++
++	* regformats/i386/i386-linux.dat: Regenerated.
++	* regformats/i386/i386.dat: Likewise.
++	* regformats/i386/x86-64-linux.dat: Likewise.
++	* regformats/i386/x86-64.dat: Likewise.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* regformats/reg-i386-linux.dat: Moved to ...
++	* regformats/i386/i386-linux.dat: Here.
++
++	* regformats/reg-i386.dat: Moved to ...
++	* regformats/i386/i386.dat: Here.
++
++	* regformats/reg-x86-64-linux.dat: Moved to ...
++	* regformats/i386/x86-64-linux.dat: Here.
++
++	* regformats/reg-x86-64.dat: Moved to ...
++	* regformats/i386/x86-64.dat: Here.
+--- ./gdb/ChangeLog.xstate	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/ChangeLog.xstate	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,384 @@
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Updated.
++
++2010-01-31  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Updated.
++	* i386-tdep.c (i386_gdbarch_init): Likewise.
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Change function
++	arguments.
++	* i386-tdep.h (i386_gdbarch_vector_unit_init): Likeise.
++
++2010-01-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common/xstate-nat.c (i386_xstate_init): Use enabled size.
++
++2010-01-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_fxsave): Check vector_unit.
++	(i387_collect_fxsave): Likewise.
++
++2010-01-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* regcache.c (regcache_raw_supply_part): Group it with ...
++	(regcache_raw_collect_part): This.
++
++2010-01-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-tdep.c (i386_linux_core_read_description): Set
++	vector_unit to sse if there is no .reg-xstate section.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (_initialize_amd64_linux_nat): Assert
++	i386_xstate.state != XSTATE_UNKNOWN instead of calling i386_xstate_init.
++	* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Call
++	i386_xstate_init and update the XSAVE extended state size on
++	Linux/x86 host.
++	* i386-linux-tdep.c (_initialize_i386_linux_tdep): Likewise.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-tdep.c: Include "i386-linux-tdep.h" and "regset.h".
++	(amd64_linux_regset_sections): New.
++	(amd64_linux_init_abi): Call set_gdbarch_core_regset_sections
++	with amd64_linux_regset_sections.  Call
++	set_gdbarch_core_read_description with
++	i386_linux_core_read_description.
++
++	* amd64-tdep.c (amd64_supply_xstateregset): New.
++	(amd64_collect_xstateregset): Likewise.
++	(amd64_regset_from_core_section): Check .reg-xstate section.
++
++	* i386-linux-tdep.c (i386_linux_regset_sections): Add
++	.reg-xstate section.
++	(i386_linux_core_read_description): New.
++	(i386_linux_init_abi): Call set_gdbarch_core_read_description
++	with i386_linux_core_read_description.
++
++	* i386-linux-tdep.h (i386_linux_core_read_description): New.
++
++	* i386-tdep.c (i386_supply_xstateregset): New.
++	(i386_collect_xstateregset): Likewise.
++	(i386_regset_from_core_section): Check .reg-xstate section.
++	(i386_gdbarch_init): Initialize xstateregset to NULL.
++
++	* i386-tdep.h (gdbarch_tdep): Add xstateregset.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_init_abi): Set sizeof_xstateregset to 0.
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): Set
++	sizeof_xstateregset if XSAVE extended state is supported.
++	(i386_gdbarch_init): Set sizeof_xstateregset to 0.
++
++	* i386-tdep.h (gdbarch_tdep): Add sizeof_xstateregset.
++
++	* common/xstate-nat.c (i386_xstate_init): Set i386_xstate.size.
++
++	* common/xstate-nat.h (i386_xstate_type): Add size.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-tdep.c (amd64_register_names): Renamed to ...
++	(amd64_sse_register_names): This.  Remove AVX registers.
++	(amd64_avx_register_names): New.
++	(AMD64_NUM_REGS): Updated.
++	(amd64_register_name): Handle vector_unit.
++	(amd64_register_type): Replace i386_sse_type with
++	i386_vector_type.
++
++	* defs.h (MAX_REGISTER_SIZE): Increase to 32.
++
++	* i386-tdep.c: (i386_register_names): Renamed to ...
++	(i386_sse_register_names): This.
++	(i386_avx_register_names): New.
++	(i386_vec128_type): Likewise.
++	(i386_vec256_type): Likewise.
++	(i386_num_register_names): Updated.
++	(i386_gdbarch_sse_unit_init): Likewise.
++	(i386_register_name): Handle vector_unit.
++	(i386_sse_type): Renamed to ...
++	(i386_vector_type): This.  Handle vector_unit.
++	(amd64_register_type): Replace i386_sse_type with
++	i386_vector_type.
++
++	* i386-tdep.h (gdbarch_tdep): Replace i386_sse_type with
++	i386_vector_type.
++	(I386_MAX_REGISTER_SIZE): Increase to 32.
++	(i386_sse_type): Renamed to ...
++	(i386_vector_type): This.
++
++2010-01-25  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (xsave-nat.o): Renamed to ...
++	(xstate-nat.o): This.
++
++	* common/xsave-nat.c: Moved to ...
++	* common/xstate-nat.c: This.
++
++	* common/xsave-nat.h: Moved to ...
++	* common/xstate-nat.h: This.
++
++	* config/i386/linux.mh (NATDEPFILES): Replace xsave-nat.o with
++	xstate-nat.o.
++	* config/i386/linux64.mh (NATDEPFILES): Likewise.
++
++	* config/i386/nm-linux.h: Include "xstate-nat.h" instead of
++	"xsave-nat.h".
++	* config/i386/nm-linux64.h: Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers):
++	Issue an error if PTRACE_GETXSTATEREGS failed and XSAVE
++	extended state is higher than SSE.
++	(amd64_linux_store_inferior_registers): Likewise.
++	* i386-linux-nat.c (fetch_xstateregs): Likewise.
++	(store_xstateregs): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common/xsave-nat.c: Include "i386-cpuid.h" instead of
++	"config/i386/i386-cpuid.h".
++
++	* config/i386/i386-cpuid.h: Moved to ...
++	* common/i386-cpuid.h: Here.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (xsave-nat.o): New.
++
++	* xsave-nat.c: Moved to ...
++	* common/xsave-nat.c: Here.
++
++	* xsave-nat.h: Moved to ...
++	* common/xsave-nat.h: Here.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i386-linux-nat.c (have_ptrace_getxstateregs): New.
++	(PTRACE_GETXSTATEREGS): Likewise.
++	(PTRACE_SETXSTATEREGS): Likewise.
++	(fetch_xstateregs): Likewise.
++	(store_xstateregs): Likewise.
++	(i386_linux_fetch_inferior_registers): Support XSAVE extended
++	state.
++	(i386_linux_store_inferior_registers): Likewise.
++	(_initialize_i386_linux_nat): Call i386_xstate_init and set
++	have_ptrace_getxstateregs.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (xsave_avxh_offset): New.
++	(XSAVE_AVXH_ADDR): Likewise.
++	(i387_supply_xsave): Use XSAVE_SSE_ADDR and XSAVE_AVXH_ADDR for
++	AVX vector unit.
++	(i387_collect_xsave): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (xsave_sse_offset): New.
++	(XSAVE_SSE_ADDR): Likewise.
++	(i387_supply_xsave): Use XSAVE_SSE_ADDR.
++	(i387_collect_xsave): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-tdep.c (i387_supply_xsave): Check vector unit.
++	(i387_collect_xsave): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gregset.h (GDB_XSTATE_SSE_REGSET_T): Removed.
++	(GDB_XSTATE_AVX_REGSET_T): Likewise.
++	(gdb_xstate_sse_regset_t): Likewise.
++	(gdb_xstate_avx_regset_t): Likewise.
++	(supply_xstate_sse_regset): Likewise.
++	(supply_xstate_avx_regset): Likewise.
++	(fill_xstate_sse_regset): Likewise.
++	(fill_xstate_avx_regset): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* regcache.c (regcache_raw_supply_part): New.
++	(regcache_raw_collect_part): Likewise.
++	* regcache.h (regcache_raw_supply_part): Likewise.
++	(regcache_raw_collect_part): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_init_abi): Call
++	i386_gdbarch_vector_unit_init.
++
++	* i386-tdep.c (i386_gdbarch_vector_unit_init): New.
++	(i386_gdbarch_init): Call i386_gdbarch_vector_unit_init.
++
++	* i386-tdep.h (x86_vector_unit): New.
++	(gdbarch_tdep): Add vector_unit.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (_initialize_amd64_linux_nat): Always call
++	i386_xstate_init ().
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (have_ptrace_getxstateregs): New.
++	(PTRACE_GETXSTATEREGS): Likewise.
++	(PTRACE_SETXSTATEREGS): Likewise.
++	(amd64_linux_fetch_inferior_registers): Support XSAVE extended
++	state.
++	(amd64_linux_store_inferior_registers): Likewise.
++	(amd64_linux_fetch_inferior_registers_with_xsave): Removed.
++	(amd64_linux_store_inferior_registers_with_xsave): Likewise.
++	(_initialize_amd64_linux_nat): Updated.
++
++	* configure.ac: Remove check for PTRACE_GETXSTATEREGS.
++	* config.in: Regenerated.
++	* configure: Likewise.
++
++	* config/i386/nm-linux.h (USE_XSAVE): Changed to ...
++	(FILL_XSTATEREGSET): This.
++	* onfig/i386/nm-linux64.h: Likewise.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* xsave-nat.c (i386_xstate_init): Properly set state.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Don't include "xsave-nat.h".
++	(amd64_linux_fetch_inferior_registers_with_xstate): Renamed to ...
++	(amd64_linux_fetch_inferior_registers_with_xsave): This.
++	(amd64_linux_store_inferior_registers_with_xstate): Renamed to ...
++	(amd64_linux_store_inferior_registers_with_xsave): This.
++
++	* config/i386/nm-linux.h: Include "xsave-nat.h".
++	* config/i386/nm-linux64.h: Likewise.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* config/i386/linux64.mh (NAT_FILE): Set to nm-linux64.h.
++
++	* config/i386/nm-linux.h (USE_XSAVE): New.
++
++	* config/i386/nm-linux64.h: New.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* xsave-nat.c: Include "config/i386/i386-cpuid.h" if <cpuid.h>
++	isn't available.
++
++	* config/i386/i386-cpuid.h: New. Taken from gcc 4.4.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Include "xsave-nat.h"
++	(_initialize_amd64_linux_nat): Check HAVE_PTRACE_GETXSTATEREGS
++	instead of HAVE_SYS_XSTATE_H.
++
++	* configure.ac: Add check for cpuid.h.  Remove check for
++	sys/xstate.h, __get_xstate and __get_xstate_size.
++	* config.in: Regenerated.
++	* configure: Likewise.
++
++	* i386-nat.c (i386_xstate): Removed.
++	(i386_xstate_init): Likewise.
++
++	* i386-nat.h (i386_xstate_type): Removed.
++	(i386_xstate): Likewise.
++	(i386_xstate_init): Likewise.
++
++	* xsave-nat.c: New.
++	* xsave-nat.h: Likewise.
++
++	* config/i386/linux.mh (NATDEPFILES): Add xsave-nat.o.
++	* config/i386/linux64.mh (NATDEPFILES): Likewise.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers_with_xstate):
++	Call amd64_supply_xsave instead of amd64_supply_fxsave.
++	(amd64_linux_store_inferior_registers_with_xstate): Call
++	amd64_collect_fxsave instead of amd64_collect_xsave.
++
++	* amd64-tdep.c (amd64_supply_xsave): New.
++	(amd64_collect_xsave): Likewise.
++	* amd64-tdep.h (amd64_supply_xsave): Likewise.
++	(amd64_collect_xsave): Likewise.
++	* i387-tdep.c (i387_supply_xsave): Likewise.
++	(i387_collect_xsave): Likewise.
++	* i387-tdep.h (i387_supply_xsave): Likewise.
++	(i387_collect_xsave): Likewise.
++
++	* i386-nat.h: Update comments.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Revert
++	the last change,
++	(amd64_linux_store_inferior_registers): Likewise.
++	(amd64_linux_fetch_inferior_registers_with_xstate): New.
++	(amd64_linux_store_inferior_registers_with_xstate): Likewise.
++	(_initialize_amd64_linux_nat): Use
++	amd64_linux_fetch_inferior_registers_with_xstate and
++	amd64_linux_store_inferior_registers_with_xstate if possible.
++
++	* i386-nat.h (i386_xstate_type): Rename size to n_of_int64.
++	* i386-nat.c (i386_xstate): Updated.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers):
++	Use PTRACE_GETXSTATEREGS/PTRACE_SETXSTATEREGS if posssible.
++	(amd64_linux_store_inferior_registers): Likewise.
++	(_initialize_amd64_linux_nat): Call i386_xstate_init.
++
++	* i386-nat.c (i386_xstate): New.
++	(i386_xstate_init): Likewise.
++
++	* i386-nat.h (i386_xstate_type): New.
++	(i386_xstate): Likewise.
++	(i386_xstate_init): Likewise.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Revert the change change.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* configure.ac: Add check for __get_xstate_size.
++	* config.in: Regenerated.
++	* configure: Likewise.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* amd64-linux-nat.c: Include <sys/xstate.h> if HAVE_SYS_XSTATE_H
++	is defined.
++	(have_ptrace_getxstateregs): New.
++	(_initialize_amd64_linux_nat): Clear have_ptrace_getxstateregs
++	if needed.
++
++	* gregset.h (GDB_XSTATE_SSE_REGSET_T): New.
++	(GDB_XSTATE_AVX_REGSET_T): Likewise.
++	(gdb_xstate_sse_regset_t): Likewise.
++	(gdb_xstate_avx_regset_t): Likewise.
++	(supply_xstate_sse_regset): Likewise.
++	(supply_xstate_avx_regset): Likewise.
++	(fill_xstate_sse_regset): Likewise.
++	(fill_xstate_avx_regset): Likewise.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* configure.ac: Add check for sys/xstate.h, __get_xstate and
++	PTRACE_GETXSTATEREGS.
++	* config.in: Regenerated.
++	* configure: Likewise.
+--- ./gdb/amd64-linux-nat.c	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/amd64-linux-nat.c	2010-04-03 21:15:08.000000000 +0200
+@@ -23,11 +23,14 @@
+ #include "inferior.h"
+ #include "gdbcore.h"
+ #include "regcache.h"
++#include "regset.h"
+ #include "linux-nat.h"
+ #include "amd64-linux-tdep.h"
+ 
+ #include "gdb_assert.h"
+ #include "gdb_string.h"
++#include "elf/common.h"
++#include <sys/uio.h>
+ #include <sys/ptrace.h>
+ #include <sys/debugreg.h>
+ #include <sys/syscall.h>
+@@ -54,6 +57,18 @@
+ #include "i387-tdep.h"
+ #include "elf-bfd.h"
+ #include "gdb_procfs32.h"
++#include "i386-xstate.h"
++
++#ifndef PTRACE_GETREGSET
++#define PTRACE_GETREGSET	0x4204
++#endif
++
++#ifndef PTRACE_SETREGSET
++#define PTRACE_SETREGSET	0x4205
++#endif
++
++/* Does the current host support PTRACE_GETREGSET?  */
++static int have_ptrace_getregset = -1;
+ 
+ /* Mapping between the general-purpose registers in GNU/Linux x86-64
+    `struct user' format and GDB's register cache layout.  */
+@@ -76,6 +91,8 @@ static int amd64_linux_gregset64_reg_off
+   -1, -1, -1, -1, -1, -1, -1, -1,
+   -1, -1, -1, -1, -1, -1, -1, -1,
+   -1, -1, -1, -1, -1, -1, -1, -1, -1,
++  -1, -1, -1, -1, -1, -1, -1, -1,
++  -1, -1, -1, -1, -1, -1, -1, -1,
+   ORIG_RAX * 8
+ };
+ \f
+@@ -131,6 +148,7 @@ static int amd64_linux_gregset32_reg_off
+   -1, -1, -1, -1, -1, -1, -1, -1,
+   -1, -1, -1, -1, -1, -1, -1, -1,
+   -1, -1, -1, -1, -1, -1, -1, -1, -1,
++  -1, -1, -1, -1, -1, -1, -1, -1,
+   ORIG_RAX * 8			/* "orig_eax" */
+ };
+ \f
+@@ -312,10 +330,26 @@ amd64_linux_fetch_inferior_registers (st
+     {
+       elf_fpregset_t fpregs;
+ 
+-      if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
+-	perror_with_name (_("Couldn't get floating point status"));
++      if (have_ptrace_getregset)
++	{
++	  char xstateregs[I386_XSTATE_MAX_SIZE];
++	  struct iovec iov;
++
++	  iov.iov_base = xstateregs;
++	  iov.iov_len = sizeof (xstateregs);
++	  if (ptrace (PTRACE_GETREGSET, tid,
++		      (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
++	    perror_with_name (_("Couldn't get extended state status"));
+ 
+-      amd64_supply_fxsave (regcache, -1, &fpregs);
++	  amd64_supply_xsave (regcache, -1, xstateregs);
++	}
++      else
++	{
++	  if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
++	    perror_with_name (_("Couldn't get floating point status"));
++
++	  amd64_supply_fxsave (regcache, -1, &fpregs);
++	}
+     }
+ }
+ 
+@@ -355,15 +389,33 @@ amd64_linux_store_inferior_registers (st
+     {
+       elf_fpregset_t fpregs;
+ 
+-      if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
+-	perror_with_name (_("Couldn't get floating point status"));
++      if (have_ptrace_getregset)
++	{
++	  char xstateregs[I386_XSTATE_MAX_SIZE];
++	  struct iovec iov;
+ 
+-      amd64_collect_fxsave (regcache, regnum, &fpregs);
++	  iov.iov_base = xstateregs;
++	  iov.iov_len = sizeof (xstateregs);
++	  if (ptrace (PTRACE_GETREGSET, tid,
++		      (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
++	    perror_with_name (_("Couldn't get extended state status"));
++
++	  amd64_collect_xsave (regcache, regnum, xstateregs, 0);
++
++	  if (ptrace (PTRACE_SETREGSET, tid,
++		      (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
++	    perror_with_name (_("Couldn't write extended state status"));
++	}
++      else
++	{
++	  if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
++	    perror_with_name (_("Couldn't get floating point status"));
+ 
+-      if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
+-	perror_with_name (_("Couldn't write floating point status"));
++	  amd64_collect_fxsave (regcache, regnum, &fpregs);
+ 
+-      return;
++	  if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
++	    perror_with_name (_("Couldn't write floating point status"));
++	}
+     }
+ }
+ \f
+@@ -831,6 +883,8 @@ amd64_linux_read_description (struct tar
+ {
+   unsigned long cs;
+   int tid;
++  int is_64bit;
++  static uint64_t xcr0;
+ 
+   /* GNU/Linux LWP ID's are process ID's.  */
+   tid = TIDGET (inferior_ptid);
+@@ -844,10 +898,55 @@ amd64_linux_read_description (struct tar
+   if (errno != 0)
+     perror_with_name (_("Couldn't get CS register"));
+ 
+-  if (cs == AMD64_LINUX_USER64_CS)
+-    return tdesc_amd64_linux;
++  is_64bit = cs == AMD64_LINUX_USER64_CS;
++
++  if (have_ptrace_getregset == -1)
++    {
++      uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))];
++      struct iovec iov;
++      unsigned int xstate_size;
++
++      iov.iov_base = xstateregs;
++      iov.iov_len = sizeof (xstateregs);
++
++      /* Check if PTRACE_GETREGSET works.  */
++      if (ptrace (PTRACE_GETREGSET, tid,
++		  (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
++	{
++	  have_ptrace_getregset = 0;
++	  xstate_size = 0;
++	}
++      else
++	{
++	  have_ptrace_getregset = 1;
++
++	  /* Get XCR0 from XSAVE extended state.  */
++	  xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
++			     / sizeof (uint64_t))];
++
++	  xstate_size = I386_XSTATE_SIZE (xcr0);
++	}
++
++      i386_linux_update_xstateregset (xstate_size);
++      amd64_linux_update_xstateregset (xstate_size);
++    }
++
++  /* Check the native XCR0 only if PTRACE_GETREGSET is available.  */
++  if (have_ptrace_getregset
++      && (xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
++    {
++      if (is_64bit)
++	return tdesc_amd64_avx_linux;
++      else
++	return tdesc_i386_avx_linux;
++    }
+   else
+-    return tdesc_i386_linux;
++    {
++      if (is_64bit)
++	return tdesc_amd64_linux;
++      else
++	return tdesc_i386_linux;
++    }
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+--- ./gdb/amd64-linux-tdep.c	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/amd64-linux-tdep.c	2010-04-03 21:12:32.000000000 +0200
+@@ -28,8 +28,11 @@
+ #include "symtab.h"
+ #include "gdbtypes.h"
+ #include "reggroups.h"
++#include "regset.h"
+ #include "amd64-linux-tdep.h"
++#include "i386-linux-tdep.h"
+ #include "linux-tdep.h"
++#include "i386-xstate.h"
+ 
+ #include "gdb_string.h"
+ 
+@@ -38,6 +41,7 @@
+ #include "xml-syscall.h"
+ 
+ #include "features/i386/amd64-linux.c"
++#include "features/i386/amd64-avx-linux.c"
+ 
+ /* The syscall's XML filename for i386.  */
+ #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
+@@ -45,6 +49,15 @@
+ #include "record.h"
+ #include "linux-record.h"
+ 
++/* Supported register note sections.  */
++static struct core_regset_section amd64_linux_regset_sections[] =
++{
++  { ".reg", 144, "general-purpose" },
++  { ".reg2", 512, "floating-point" },
++  { ".reg-xstate", 0, "XSAVE extended state" },
++  { NULL, 0 }
++};
++
+ /* Mapping between the general-purpose registers in `struct user'
+    format and GDB's register cache layout.  */
+ 
+@@ -1316,6 +1329,22 @@ amd64_linux_record_signal (struct gdbarc
+   return 0;
+ }
+ 
++/* Update XSAVE extended state register note section.  */
++
++void
++amd64_linux_update_xstateregset (unsigned int xstate_size)
++{
++  struct core_regset_section *xstate = &amd64_linux_regset_sections[2];
++
++  /* Update the XSAVE extended state register note section for "gcore".
++     Disable it if its size is 0.  */
++  gdb_assert (strcmp (xstate->sect_name, ".reg-xstate") == 0);
++  if (xstate_size)
++    xstate->size = xstate_size;
++  else
++    xstate->sect_name = NULL;
++}
++
+ /* Get Linux/x86 target description from core dump.  */
+ 
+ static const struct target_desc *
+@@ -1324,12 +1353,17 @@ amd64_linux_core_read_description (struc
+ 				  bfd *abfd)
+ {
+   asection *section = bfd_get_section_by_name (abfd, ".reg2");
++  uint64_t xcr0;
+ 
+   if (section == NULL)
+     return NULL;
+ 
+   /* Linux/x86-64.  */
+-  return tdesc_amd64_linux;
++  xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
++  if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
++    return tdesc_amd64_avx_linux;
++  else
++    return tdesc_amd64_linux;
+ }
+ 
+ static void
+@@ -1373,6 +1407,8 @@ amd64_linux_init_abi (struct gdbarch_inf
+ 
+   tdep->outermost_frame_p = amd64_linux_outermost_frame;
+ 
++  tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
++
+   /* GNU/Linux uses SVR4-style shared libraries.  */
+   set_solib_svr4_fetch_link_map_offsets
+     (gdbarch, svr4_lp64_fetch_link_map_offsets);
+@@ -1394,6 +1430,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);
+ 
++  /* Install supported register note sections.  */
++  set_gdbarch_core_regset_sections (gdbarch, amd64_linux_regset_sections);
++
+   set_gdbarch_core_read_description (gdbarch,
+ 				     amd64_linux_core_read_description);
+ 
+@@ -1596,4 +1635,5 @@ _initialize_amd64_linux_tdep (void)
+ 
+   /* Initialize the Linux target description  */
+   initialize_tdesc_amd64_linux ();
++  initialize_tdesc_amd64_avx_linux ();
+ }
+--- ./gdb/amd64-linux-tdep.h	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/amd64-linux-tdep.h	2010-04-03 21:12:32.000000000 +0200
+@@ -26,13 +26,17 @@
+ /* Register number for the "orig_rax" register.  If this register
+    contains a value >= 0 it is interpreted as the system call number
+    that the kernel is supposed to restart.  */
+-#define AMD64_LINUX_ORIG_RAX_REGNUM (AMD64_MXCSR_REGNUM + 1)
++#define AMD64_LINUX_ORIG_RAX_REGNUM (AMD64_YMM15H_REGNUM + 1)
+ 
+ /* 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;
++extern struct target_desc *tdesc_amd64_avx_linux;
++
++/* Update XSAVE extended state register note section.  */
++extern void amd64_linux_update_xstateregset (unsigned int xstate_size);
+ 
+ /* Enum that defines the syscall identifiers for amd64 linux.
+    Used for process record/replay, these will be translated into
+--- ./gdb/amd64-tdep.c	2010-04-03 21:11:41.000000000 +0200
++++ ./gdb/amd64-tdep.c	2010-04-03 21:12:32.000000000 +0200
+@@ -43,6 +43,7 @@
+ #include "i387-tdep.h"
+ 
+ #include "features/i386/amd64.c"
++#include "features/i386/amd64-avx.c"
+ 
+ /* Note that the AMD64 architecture was previously known as x86-64.
+    The latter is (forever) engraved into the canonical system name as
+@@ -71,8 +72,21 @@ static const char *amd64_register_names[
+   "mxcsr",
+ };
+ 
+-/* Total number of registers.  */
+-#define AMD64_NUM_REGS	ARRAY_SIZE (amd64_register_names)
++static const char *amd64_ymm_names[] = 
++{
++  "ymm0", "ymm1", "ymm2", "ymm3",
++  "ymm4", "ymm5", "ymm6", "ymm7",
++  "ymm8", "ymm9", "ymm10", "ymm11",
++  "ymm12", "ymm13", "ymm14", "ymm15"
++};
++
++static const char *amd64_ymmh_names[] = 
++{
++  "ymm0h", "ymm1h", "ymm2h", "ymm3h",
++  "ymm4h", "ymm5h", "ymm6h", "ymm7h",
++  "ymm8h", "ymm9h", "ymm10h", "ymm11h",
++  "ymm12h", "ymm13h", "ymm14h", "ymm15h"
++};
+ 
+ /* The registers used to pass integer arguments during a function call.  */
+ static int amd64_dummy_call_integer_regs[] =
+@@ -163,6 +177,8 @@ static const int amd64_dwarf_regmap_len 
+ static int
+ amd64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
+ {
++  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++  int ymm0_regnum = tdep->ymm0_regnum;
+   int regnum = -1;
+ 
+   if (reg >= 0 && reg < amd64_dwarf_regmap_len)
+@@ -170,6 +186,9 @@ amd64_dwarf_reg_to_regnum (struct gdbarc
+ 
+   if (regnum == -1)
+     warning (_("Unmapped DWARF Register #%d encountered."), reg);
++  else if (ymm0_regnum >= 0
++	   && i386_xmm_regnum_p (gdbarch, regnum))
++    regnum += ymm0_regnum - I387_XMM0_REGNUM (tdep);
+ 
+   return regnum;
+ }
+@@ -238,6 +257,19 @@ static const char *amd64_dword_names[] =
+   "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
+ };
+ 
++/* Return the name of register REGNUM, or the empty string if it is
++   an anonymous register. */
++
++static const char *
++amd64_register_name (struct gdbarch *gdbarch, int regnum)
++{
++  /* Hide the upper YMM registers.  */
++  if (i386_ymmh_regnum_p (gdbarch, regnum))
++    return "";
++
++  return tdesc_register_name (gdbarch, regnum);
++}
++
+ /* Return the name of register REGNUM.  */
+ 
+ static const char *
+@@ -246,6 +278,8 @@ amd64_pseudo_register_name (struct gdbar
+   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_ymm_regnum_p (gdbarch, regnum))
++    return amd64_ymm_names[regnum - tdep->ymm0_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))
+@@ -2181,6 +2215,28 @@ amd64_collect_fpregset (const struct reg
+   amd64_collect_fxsave (regcache, regnum, fpregs);
+ }
+ 
++/* Similar to amd64_supply_fpregset, but use XSAVE extended state.  */
++
++static void
++amd64_supply_xstateregset (const struct regset *regset,
++			   struct regcache *regcache, int regnum,
++			   const void *xstateregs, size_t len)
++{
++  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++  amd64_supply_xsave (regcache, regnum, xstateregs);
++}
++
++/* Similar to amd64_collect_fpregset, but use XSAVE extended state.  */
++
++static void
++amd64_collect_xstateregset (const struct regset *regset,
++			    const struct regcache *regcache,
++			    int regnum, void *xstateregs, size_t len)
++{
++  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++  amd64_collect_xsave (regcache, regnum, xstateregs, 1);
++}
++
+ /* Return the appropriate register set for the core section identified
+    by SECT_NAME and SECT_SIZE.  */
+ 
+@@ -2199,6 +2255,16 @@ amd64_regset_from_core_section (struct g
+       return tdep->fpregset;
+     }
+ 
++  if (strcmp (sect_name, ".reg-xstate") == 0)
++    {
++      if (tdep->xstateregset == NULL)
++	tdep->xstateregset = regset_alloc (gdbarch,
++					   amd64_supply_xstateregset,
++					   amd64_collect_xstateregset);
++
++      return tdep->xstateregset;
++    }
++
+   return i386_regset_from_core_section (gdbarch, sect_name, sect_size);
+ }
+ \f
+@@ -2261,6 +2327,13 @@ amd64_init_abi (struct gdbarch_info info
+   tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS;
+   tdep->register_names = amd64_register_names;
+ 
++  if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx") != NULL)
++    {
++      tdep->ymmh_register_names = amd64_ymmh_names;
++      tdep->num_ymm_regs = 16;
++      tdep->ymm0h_regnum = AMD64_YMM0H_REGNUM;
++    }
++
+   tdep->num_byte_regs = 20;
+   tdep->num_word_regs = 16;
+   tdep->num_dword_regs = 16;
+@@ -2274,6 +2347,8 @@ amd64_init_abi (struct gdbarch_info info
+ 
+   set_tdesc_pseudo_register_name (gdbarch, amd64_pseudo_register_name);
+ 
++  set_gdbarch_register_name (gdbarch, amd64_register_name);
++
+   /* AMD64 has an FPU and 16 SSE registers.  */
+   tdep->st0_regnum = AMD64_ST0_REGNUM;
+   tdep->num_xmm_regs = 16;
+@@ -2354,6 +2429,7 @@ void
+ _initialize_amd64_tdep (void)
+ {
+   initialize_tdesc_amd64 ();
++  initialize_tdesc_amd64_avx ();
+ }
+ \f
+ 
+@@ -2389,6 +2465,30 @@ amd64_supply_fxsave (struct regcache *re
+     }
+ }
+ 
++/* Similar to amd64_supply_fxsave, but use XSAVE extended state.  */
++
++void
++amd64_supply_xsave (struct regcache *regcache, int regnum,
++		    const void *xsave)
++{
++  struct gdbarch *gdbarch = get_regcache_arch (regcache);
++  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++
++  i387_supply_xsave (regcache, regnum, xsave);
++
++  if (xsave && gdbarch_ptr_bit (gdbarch) == 64)
++    {
++      const gdb_byte *regs = xsave;
++
++      if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep))
++	regcache_raw_supply (regcache, I387_FISEG_REGNUM (tdep),
++			     regs + 12);
++      if (regnum == -1 || regnum == I387_FOSEG_REGNUM (tdep))
++	regcache_raw_supply (regcache, I387_FOSEG_REGNUM (tdep),
++			     regs + 20);
++    }
++}
++
+ /* Fill register REGNUM (if it is a floating-point or SSE register) in
+    *FXSAVE with the value from REGCACHE.  If REGNUM is -1, do this for
+    all registers.  This function doesn't touch any of the reserved
+@@ -2412,3 +2512,26 @@ amd64_collect_fxsave (const struct regca
+ 	regcache_raw_collect (regcache, I387_FOSEG_REGNUM (tdep), regs + 20);
+     }
+ }
++
++/* Similar to amd64_collect_fxsave, but but use XSAVE extended state.  */
++
++void
++amd64_collect_xsave (const struct regcache *regcache, int regnum,
++		     void *xsave, int gcore)
++{
++  struct gdbarch *gdbarch = get_regcache_arch (regcache);
++  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++  gdb_byte *regs = xsave;
++
++  i387_collect_xsave (regcache, regnum, xsave, gcore);
++
++  if (gdbarch_ptr_bit (gdbarch) == 64)
++    {
++      if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep))
++	regcache_raw_collect (regcache, I387_FISEG_REGNUM (tdep),
++			      regs + 12);
++      if (regnum == -1 || regnum == I387_FOSEG_REGNUM (tdep))
++	regcache_raw_collect (regcache, I387_FOSEG_REGNUM (tdep),
++			      regs + 20);
++    }
++}
+--- ./gdb/amd64-tdep.h	2010-01-29 06:19:22.000000000 +0100
++++ ./gdb/amd64-tdep.h	2010-04-03 21:12:32.000000000 +0200
+@@ -61,12 +61,16 @@ enum amd64_regnum
+   AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
+   AMD64_XMM0_REGNUM = 40,	/* %xmm0 */
+   AMD64_XMM1_REGNUM,		/* %xmm1 */
+-  AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16
++  AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
++  AMD64_YMM0H_REGNUM,		/* %ymm0h */
++  AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15
+ };
+ 
+ /* Number of general purpose registers.  */
+ #define AMD64_NUM_GREGS		24
+ 
++#define AMD64_NUM_REGS		(AMD64_YMM15H_REGNUM + 1)
++
+ extern struct displaced_step_closure *amd64_displaced_step_copy_insn
+   (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
+    struct regcache *regs);
+@@ -77,12 +81,6 @@ extern void amd64_displaced_step_fixup (
+ 
+ extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
+ 
+-/* Functions from amd64-tdep.c which may be needed on architectures
+-   with extra registers.  */
+-
+-extern const char *amd64_register_name (struct gdbarch *gdbarch, int regnum);
+-extern struct type *amd64_register_type (struct gdbarch *gdbarch, int regnum);
+-
+ /* Fill register REGNUM in REGCACHE with the appropriate
+    floating-point or SSE register value from *FXSAVE.  If REGNUM is
+    -1, do this for all registers.  This function masks off any of the
+@@ -91,6 +89,10 @@ extern struct type *amd64_register_type 
+ extern void amd64_supply_fxsave (struct regcache *regcache, int regnum,
+ 				 const void *fxsave);
+ 
++/* Similar to amd64_supply_fxsave, but use XSAVE extended state.  */
++extern void amd64_supply_xsave (struct regcache *regcache, int regnum,
++				const void *xsave);
++
+ /* Fill register REGNUM (if it is a floating-point or SSE register) in
+    *FXSAVE with the value from REGCACHE.  If REGNUM is -1, do this for
+    all registers.  This function doesn't touch any of the reserved
+@@ -99,6 +101,10 @@ extern void amd64_supply_fxsave (struct 
+ extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
+ 				  void *fxsave);
+ 
++/* Similar to amd64_collect_fxsave, but but use XSAVE extended state.  */
++extern void amd64_collect_xsave (const struct regcache *regcache,
++				 int regnum, void *xsave, int gcore);
++
+ void amd64_classify (struct type *type, enum amd64_reg_class class[2]);
+ 
+ \f
+--- ./gdb/common/i386-xstate.h	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/common/i386-xstate.h	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,41 @@
++/* Common code for i386 XSAVE extended state.
++
++   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/>.  */
++
++#ifndef I386_XSTATE_H
++#define I386_XSTATE_H 1
++
++/* The extended state feature bits.  */
++#define I386_XSTATE_X87		(1ULL << 0)
++#define I386_XSTATE_SSE		(1ULL << 1)
++#define I386_XSTATE_AVX		(1ULL << 2)
++
++/* Supported mask and size of the extended state.  */
++#define I386_XSTATE_SSE_MASK	(I386_XSTATE_X87 | I386_XSTATE_SSE)
++#define I386_XSTATE_AVX_MASK	(I386_XSTATE_SSE_MASK | I386_XSTATE_AVX)
++
++#define I386_XSTATE_SSE_SIZE	576
++#define I386_XSTATE_AVX_SIZE	832
++#define I386_XSTATE_MAX_SIZE	832
++
++/* Get I386 XSAVE extended state size.  */
++#define I386_XSTATE_SIZE(XCR0)	\
++  (((XCR0) & I386_XSTATE_AVX) != 0 \
++   ? I386_XSTATE_AVX_SIZE : I386_XSTATE_SSE_SIZE)
++
++#endif /* I386_XSTATE_H */
+--- ./gdb/config/djgpp/fnchange.lst	2010-02-01 20:27:55.000000000 +0100
++++ ./gdb/config/djgpp/fnchange.lst	2010-04-03 21:12:32.000000000 +0200
+@@ -228,6 +228,14 @@
+ @V@/gdb/features/rs6000/powerpc-vsx64l.xml @V@/gdb/features/rs6000/ppc-v64l.xml
+ @V@/gdb/features/rs6000/powerpc-cell32l.xml @V@/gdb/features/rs6000/ppc-c32l.xml
+ @V@/gdb/features/rs6000/powerpc-cell64l.xml @V@/gdb/features/rs6000/ppc-c64l.xml
++@V@/gdb/features/i386/amd64-avx-linux.c @V@/gdb/features/i386/a64-al.c
++@V@/gdb/features/i386/amd64-avx.c @V@/gdb/features/i386/a64-a.c
++@V@/gdb/features/i386/amd64-avx-linux.xml @V@/gdb/features/i386/a64-al.xml
++@V@/gdb/features/i386/amd64-avx.xml @V@/gdb/features/i386/a64-a.xml
++@V@/gdb/features/i386/i386-avx-linux.c @V@/features/i386/i32-al.c
++@V@/gdb/features/i386/i386-avx.c @V@/gdb/features/i386/i32-a.c
++@V@/gdb/features/i386/i386-avx-linux.xml @V@/gdb/features/i386/i32-al.xml
++@V@/gdb/features/i386/i386-avx.xml @V@/gdb/features/i386/i32-a.xml
+ @V@/gdb/f-exp.tab.c @V@/gdb/f-exp_tab.c
+ @V@/gdb/gdbserver/linux-cris-low.c @V@/gdb/gdbserver/lx-cris.c
+ @V@/gdb/gdbserver/linux-crisv32-low.c @V@/gdb/gdbserver/lx-cris32.c
+--- ./gdb/doc/ChangeLog.xcr	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/doc/ChangeLog.xcr	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,31 @@
++2010-03-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (General Query Packets): Replace "x86=xml" with
++	"xmlRegisters+".
++
++2010-03-12  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (General Query Packets): Updated.
++	(i386 Features): Likewise.
++
++2010-03-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (i386 Features): Make org.gnu.gdb.i386.avx optional.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (General Query Packets): Remove x86:xstate extension.
++	Document x86=xml extension in gdb remote protocol.
++
++2010-02-11  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (i386 Features): Add org.gnu.gdb.i386.avx.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo: Remove x86:xstate from stub reply.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo: Document x86:xstate extension in gdb remote
++	protocol.
+--- ./gdb/doc/ChangeLog.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/doc/ChangeLog.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,28 @@
++2010-03-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (General Query Packets): Updated.
++
++2010-03-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (General Query Packets): Updated.
++
++2010-03-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (General Query Packets): Remove extra supports.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (General Query Packets): Add xmlRegisters.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo (Predefined Target Types): Add i387_ext,
++	i386_eflags and i386_mxcsr.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo: Update i386 target features.
++
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.texinfo: Document i386 target features.
+--- ./gdb/features/Makefile	2010-02-08 06:08:46.000000000 +0100
++++ ./gdb/features/Makefile	2010-04-03 21:12:32.000000000 +0200
+@@ -33,6 +33,8 @@
+ WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \
+ 	i386/i386 i386/i386-linux \
+ 	i386/amd64 i386/amd64-linux \
++	i386/i386-avx i386/i386-avx-linux \
++	i386/amd64-avx i386/amd64-avx-linux \
+ 	mips-linux mips64-linux \
+ 	rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \
+ 	rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \
+@@ -45,6 +47,10 @@ i386/i386-expedite = ebp,esp,eip
+ i386/i386-linux-expedite = ebp,esp,eip
+ i386/amd64-expedite = rbp,rsp,rip
+ i386/amd64-linux-expedite = rbp,rsp,rip
++i386/i386-avx-expedite = ebp,esp,eip
++i386/i386-avx-linux-expedite = ebp,esp,eip
++i386/amd64-avx-expedite = rbp,rsp,rip
++i386/amd64-avx-linux-expedite = rbp,rsp,rip
+ mips-expedite = r29,pc
+ mips64-expedite = r29,pc
+ powerpc-expedite = r1,pc
+@@ -90,3 +96,9 @@ $(outdir)/i386/i386-linux.dat: i386/32bi
+ $(outdir)/i386/amd64.dat: i386/64bit-core.xml i386/64bit-sse.xml
+ $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \
+ 			        i386/64bit-linux.xml
++$(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml
++$(outdir)/i386/i386-avx-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \
++			       i386/32bit-linux.xml
++$(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml
++$(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \
++				    i386/64bit-linux.xml
+--- ./gdb/features/i386/32bit-avx.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/32bit-avx.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,18 @@
++<?xml version="1.0"?>
++<!-- Copyright (C) 2010 Free Software Foundation, Inc.
++
++     Copying and distribution of this file, with or without modification,
++     are permitted in any medium without royalty provided the copyright
++     notice and this notice are preserved.  -->
++
++<!DOCTYPE feature SYSTEM "gdb-target.dtd">
++<feature name="org.gnu.gdb.i386.avx">
++  <reg name="ymm0h" bitsize="128" type="uint128"/>
++  <reg name="ymm1h" bitsize="128" type="uint128"/>
++  <reg name="ymm2h" bitsize="128" type="uint128"/>
++  <reg name="ymm3h" bitsize="128" type="uint128"/>
++  <reg name="ymm4h" bitsize="128" type="uint128"/>
++  <reg name="ymm5h" bitsize="128" type="uint128"/>
++  <reg name="ymm6h" bitsize="128" type="uint128"/>
++  <reg name="ymm7h" bitsize="128" type="uint128"/>
++</feature>
+--- ./gdb/features/i386/64bit-avx.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/64bit-avx.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,26 @@
++<?xml version="1.0"?>
++<!-- Copyright (C) 2010 Free Software Foundation, Inc.
++
++     Copying and distribution of this file, with or without modification,
++     are permitted in any medium without royalty provided the copyright
++     notice and this notice are preserved.  -->
++
++<!DOCTYPE feature SYSTEM "gdb-target.dtd">
++<feature name="org.gnu.gdb.i386.avx">
++  <reg name="ymm0h" bitsize="128" type="uint128"/>
++  <reg name="ymm1h" bitsize="128" type="uint128"/>
++  <reg name="ymm2h" bitsize="128" type="uint128"/>
++  <reg name="ymm3h" bitsize="128" type="uint128"/>
++  <reg name="ymm4h" bitsize="128" type="uint128"/>
++  <reg name="ymm5h" bitsize="128" type="uint128"/>
++  <reg name="ymm6h" bitsize="128" type="uint128"/>
++  <reg name="ymm7h" bitsize="128" type="uint128"/>
++  <reg name="ymm8h" bitsize="128" type="uint128"/>
++  <reg name="ymm9h" bitsize="128" type="uint128"/>
++  <reg name="ymm10h" bitsize="128" type="uint128"/>
++  <reg name="ymm11h" bitsize="128" type="uint128"/>
++  <reg name="ymm12h" bitsize="128" type="uint128"/>
++  <reg name="ymm13h" bitsize="128" type="uint128"/>
++  <reg name="ymm14h" bitsize="128" type="uint128"/>
++  <reg name="ymm15h" bitsize="128" type="uint128"/>
++</feature>
+--- ./gdb/features/i386/Makefile	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/Makefile	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,5 @@
++include Makefile
++
++XMLTOC = $(addsuffix .xml, $(filter i386/%, $(WHICH)))
++CFILES = $(patsubst %.xml,%.c,$(XMLTOC))
++cfiles: $(CFILES)
+--- ./gdb/features/i386/amd64-avx-linux.c	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/amd64-avx-linux.c	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,171 @@
++/* THIS FILE IS GENERATED.  Original: amd64-avx-linux.xml */
++
++#include "defs.h"
++#include "osabi.h"
++#include "target-descriptions.h"
++
++struct target_desc *tdesc_amd64_avx_linux;
++static void
++initialize_tdesc_amd64_avx_linux (void)
++{
++  struct target_desc *result = allocate_target_description ();
++  struct tdesc_feature *feature;
++  struct tdesc_type *field_type, *type;
++
++  set_tdesc_architecture (result, bfd_scan_arch ("i386:x86-64"));
++
++  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");
++  tdesc_create_reg (feature, "rdx", 3, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rsi", 4, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rdi", 5, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rbp", 6, 1, NULL, 64, "data_ptr");
++  tdesc_create_reg (feature, "rsp", 7, 1, NULL, 64, "data_ptr");
++  tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rip", 16, 1, NULL, 64, "code_ptr");
++  tdesc_create_reg (feature, "eflags", 17, 1, NULL, 32, "i386_eflags");
++  tdesc_create_reg (feature, "cs", 18, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ss", 19, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ds", 20, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "es", 21, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "fs", 22, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "gs", 23, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "st0", 24, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st1", 25, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st2", 26, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st3", 27, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st4", 28, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st5", 29, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st6", 30, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st7", 31, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "fctrl", 32, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fstat", 33, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "ftag", 34, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fiseg", 35, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fioff", 36, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "foseg", 37, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fooff", 38, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fop", 39, 1, "float", 32, "int");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse");
++  field_type = tdesc_named_type (feature, "ieee_single");
++  tdesc_create_vector (feature, "v4f", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "ieee_double");
++  tdesc_create_vector (feature, "v2d", field_type, 2);
++
++  field_type = tdesc_named_type (feature, "int8");
++  tdesc_create_vector (feature, "v16i8", field_type, 16);
++
++  field_type = tdesc_named_type (feature, "int16");
++  tdesc_create_vector (feature, "v8i16", field_type, 8);
++
++  field_type = tdesc_named_type (feature, "int32");
++  tdesc_create_vector (feature, "v4i32", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "int64");
++  tdesc_create_vector (feature, "v2i64", field_type, 2);
++
++  type = tdesc_create_union (feature, "vec128");
++  field_type = tdesc_named_type (feature, "v4f");
++  tdesc_add_field (type, "v4_float", field_type);
++  field_type = tdesc_named_type (feature, "v2d");
++  tdesc_add_field (type, "v2_double", field_type);
++  field_type = tdesc_named_type (feature, "v16i8");
++  tdesc_add_field (type, "v16_int8", field_type);
++  field_type = tdesc_named_type (feature, "v8i16");
++  tdesc_add_field (type, "v8_int16", field_type);
++  field_type = tdesc_named_type (feature, "v4i32");
++  tdesc_add_field (type, "v4_int32", field_type);
++  field_type = tdesc_named_type (feature, "v2i64");
++  tdesc_add_field (type, "v2_int64", field_type);
++  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");
++  tdesc_create_reg (feature, "xmm3", 43, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm4", 44, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm5", 45, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm6", 46, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm7", 47, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm8", 48, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm9", 49, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm10", 50, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm11", 51, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm12", 52, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm13", 53, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm14", 54, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux");
++  tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx");
++  tdesc_create_reg (feature, "ymm0h", 58, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm1h", 59, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm2h", 60, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm3h", 61, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm4h", 62, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm5h", 63, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm6h", 64, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm7h", 65, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm8h", 66, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm9h", 67, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm10h", 68, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm11h", 69, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm12h", 70, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm13h", 71, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm14h", 72, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm15h", 73, 1, NULL, 128, "uint128");
++
++  tdesc_amd64_avx_linux = result;
++}
+--- ./gdb/features/i386/amd64-avx-linux.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/amd64-avx-linux.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,18 @@
++<?xml version="1.0"?>
++<!-- Copyright (C) 2010 Free Software Foundation, Inc.
++
++     Copying and distribution of this file, with or without modification,
++     are permitted in any medium without royalty provided the copyright
++     notice and this notice are preserved.  -->
++
++<!-- AMD64 with AVX - Includes Linux-only special "register".  -->
++
++<!DOCTYPE target SYSTEM "gdb-target.dtd">
++<target>
++  <architecture>i386:x86-64</architecture>
++  <osabi>GNU/Linux</osabi>
++  <xi:include href="64bit-core.xml"/>
++  <xi:include href="64bit-sse.xml"/>
++  <xi:include href="64bit-linux.xml"/>
++  <xi:include href="64bit-avx.xml"/>
++</target>
+--- ./gdb/features/i386/amd64-avx.c	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/amd64-avx.c	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,166 @@
++/* THIS FILE IS GENERATED.  Original: amd64-avx.xml */
++
++#include "defs.h"
++#include "osabi.h"
++#include "target-descriptions.h"
++
++struct target_desc *tdesc_amd64_avx;
++static void
++initialize_tdesc_amd64_avx (void)
++{
++  struct target_desc *result = allocate_target_description ();
++  struct tdesc_feature *feature;
++  struct tdesc_type *field_type, *type;
++
++  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");
++  tdesc_create_reg (feature, "rdx", 3, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rsi", 4, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rdi", 5, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rbp", 6, 1, NULL, 64, "data_ptr");
++  tdesc_create_reg (feature, "rsp", 7, 1, NULL, 64, "data_ptr");
++  tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "int64");
++  tdesc_create_reg (feature, "rip", 16, 1, NULL, 64, "code_ptr");
++  tdesc_create_reg (feature, "eflags", 17, 1, NULL, 32, "i386_eflags");
++  tdesc_create_reg (feature, "cs", 18, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ss", 19, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ds", 20, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "es", 21, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "fs", 22, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "gs", 23, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "st0", 24, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st1", 25, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st2", 26, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st3", 27, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st4", 28, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st5", 29, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st6", 30, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st7", 31, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "fctrl", 32, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fstat", 33, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "ftag", 34, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fiseg", 35, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fioff", 36, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "foseg", 37, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fooff", 38, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fop", 39, 1, "float", 32, "int");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse");
++  field_type = tdesc_named_type (feature, "ieee_single");
++  tdesc_create_vector (feature, "v4f", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "ieee_double");
++  tdesc_create_vector (feature, "v2d", field_type, 2);
++
++  field_type = tdesc_named_type (feature, "int8");
++  tdesc_create_vector (feature, "v16i8", field_type, 16);
++
++  field_type = tdesc_named_type (feature, "int16");
++  tdesc_create_vector (feature, "v8i16", field_type, 8);
++
++  field_type = tdesc_named_type (feature, "int32");
++  tdesc_create_vector (feature, "v4i32", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "int64");
++  tdesc_create_vector (feature, "v2i64", field_type, 2);
++
++  type = tdesc_create_union (feature, "vec128");
++  field_type = tdesc_named_type (feature, "v4f");
++  tdesc_add_field (type, "v4_float", field_type);
++  field_type = tdesc_named_type (feature, "v2d");
++  tdesc_add_field (type, "v2_double", field_type);
++  field_type = tdesc_named_type (feature, "v16i8");
++  tdesc_add_field (type, "v16_int8", field_type);
++  field_type = tdesc_named_type (feature, "v8i16");
++  tdesc_add_field (type, "v8_int16", field_type);
++  field_type = tdesc_named_type (feature, "v4i32");
++  tdesc_add_field (type, "v4_int32", field_type);
++  field_type = tdesc_named_type (feature, "v2i64");
++  tdesc_add_field (type, "v2_int64", field_type);
++  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");
++  tdesc_create_reg (feature, "xmm3", 43, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm4", 44, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm5", 45, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm6", 46, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm7", 47, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm8", 48, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm9", 49, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm10", 50, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm11", 51, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm12", 52, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm13", 53, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm14", 54, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx");
++  tdesc_create_reg (feature, "ymm0h", 57, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm1h", 58, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm2h", 59, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm3h", 60, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm4h", 61, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm5h", 62, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm6h", 63, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm7h", 64, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm8h", 65, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm9h", 66, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm10h", 67, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm11h", 68, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm12h", 69, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm13h", 70, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm14h", 71, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128");
++
++  tdesc_amd64_avx = result;
++}
+--- ./gdb/features/i386/amd64-avx.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/amd64-avx.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,16 @@
++<?xml version="1.0"?>
++<!-- Copyright (C) 2010 Free Software Foundation, Inc.
++
++     Copying and distribution of this file, with or without modification,
++     are permitted in any medium without royalty provided the copyright
++     notice and this notice are preserved.  -->
++
++<!-- AMD64 with AVX -->
++
++<!DOCTYPE target SYSTEM "gdb-target.dtd">
++<target>
++  <architecture>i386:x86-64</architecture>
++  <xi:include href="64bit-core.xml"/>
++  <xi:include href="64bit-sse.xml"/>
++  <xi:include href="64bit-avx.xml"/>
++</target>
+--- ./gdb/features/i386/i386-avx-linux.c	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/i386-avx-linux.c	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,147 @@
++/* THIS FILE IS GENERATED.  Original: i386-avx-linux.xml */
++
++#include "defs.h"
++#include "osabi.h"
++#include "target-descriptions.h"
++
++struct target_desc *tdesc_i386_avx_linux;
++static void
++initialize_tdesc_i386_avx_linux (void)
++{
++  struct target_desc *result = allocate_target_description ();
++  struct tdesc_feature *feature;
++  struct tdesc_type *field_type, *type;
++
++  set_tdesc_architecture (result, bfd_scan_arch ("i386"));
++
++  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");
++  tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr");
++  tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr");
++  tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr");
++  tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags");
++  tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse");
++  field_type = tdesc_named_type (feature, "ieee_single");
++  tdesc_create_vector (feature, "v4f", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "ieee_double");
++  tdesc_create_vector (feature, "v2d", field_type, 2);
++
++  field_type = tdesc_named_type (feature, "int8");
++  tdesc_create_vector (feature, "v16i8", field_type, 16);
++
++  field_type = tdesc_named_type (feature, "int16");
++  tdesc_create_vector (feature, "v8i16", field_type, 8);
++
++  field_type = tdesc_named_type (feature, "int32");
++  tdesc_create_vector (feature, "v4i32", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "int64");
++  tdesc_create_vector (feature, "v2i64", field_type, 2);
++
++  type = tdesc_create_union (feature, "vec128");
++  field_type = tdesc_named_type (feature, "v4f");
++  tdesc_add_field (type, "v4_float", field_type);
++  field_type = tdesc_named_type (feature, "v2d");
++  tdesc_add_field (type, "v2_double", field_type);
++  field_type = tdesc_named_type (feature, "v16i8");
++  tdesc_add_field (type, "v16_int8", field_type);
++  field_type = tdesc_named_type (feature, "v8i16");
++  tdesc_add_field (type, "v8_int16", field_type);
++  field_type = tdesc_named_type (feature, "v4i32");
++  tdesc_add_field (type, "v4_int32", field_type);
++  field_type = tdesc_named_type (feature, "v2i64");
++  tdesc_add_field (type, "v2_int64", field_type);
++  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");
++  tdesc_create_reg (feature, "xmm3", 35, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm4", 36, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm5", 37, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm6", 38, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm7", 39, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "mxcsr", 40, 1, "vector", 32, "i386_mxcsr");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux");
++  tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx");
++  tdesc_create_reg (feature, "ymm0h", 42, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm1h", 43, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm2h", 44, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm3h", 45, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm4h", 46, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm5h", 47, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm6h", 48, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm7h", 49, 1, NULL, 128, "uint128");
++
++  tdesc_i386_avx_linux = result;
++}
+--- ./gdb/features/i386/i386-avx-linux.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/i386-avx-linux.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,18 @@
++<?xml version="1.0"?>
++<!-- Copyright (C) 2010 Free Software Foundation, Inc.
++
++     Copying and distribution of this file, with or without modification,
++     are permitted in any medium without royalty provided the copyright
++     notice and this notice are preserved.  -->
++
++<!-- I386 with AVX- Includes Linux-only special "register".  -->
++
++<!DOCTYPE target SYSTEM "gdb-target.dtd">
++<target>
++  <architecture>i386</architecture>
++  <osabi>GNU/Linux</osabi>
++  <xi:include href="32bit-core.xml"/>
++  <xi:include href="32bit-sse.xml"/>
++  <xi:include href="32bit-linux.xml"/>
++  <xi:include href="32bit-avx.xml"/>
++</target>
+--- ./gdb/features/i386/i386-avx.c	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/i386-avx.c	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,142 @@
++/* THIS FILE IS GENERATED.  Original: i386-avx.xml */
++
++#include "defs.h"
++#include "osabi.h"
++#include "target-descriptions.h"
++
++struct target_desc *tdesc_i386_avx;
++static void
++initialize_tdesc_i386_avx (void)
++{
++  struct target_desc *result = allocate_target_description ();
++  struct tdesc_feature *feature;
++  struct tdesc_type *field_type, *type;
++
++  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");
++  tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr");
++  tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr");
++  tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr");
++  tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags");
++  tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32");
++  tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext");
++  tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int");
++  tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse");
++  field_type = tdesc_named_type (feature, "ieee_single");
++  tdesc_create_vector (feature, "v4f", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "ieee_double");
++  tdesc_create_vector (feature, "v2d", field_type, 2);
++
++  field_type = tdesc_named_type (feature, "int8");
++  tdesc_create_vector (feature, "v16i8", field_type, 16);
++
++  field_type = tdesc_named_type (feature, "int16");
++  tdesc_create_vector (feature, "v8i16", field_type, 8);
++
++  field_type = tdesc_named_type (feature, "int32");
++  tdesc_create_vector (feature, "v4i32", field_type, 4);
++
++  field_type = tdesc_named_type (feature, "int64");
++  tdesc_create_vector (feature, "v2i64", field_type, 2);
++
++  type = tdesc_create_union (feature, "vec128");
++  field_type = tdesc_named_type (feature, "v4f");
++  tdesc_add_field (type, "v4_float", field_type);
++  field_type = tdesc_named_type (feature, "v2d");
++  tdesc_add_field (type, "v2_double", field_type);
++  field_type = tdesc_named_type (feature, "v16i8");
++  tdesc_add_field (type, "v16_int8", field_type);
++  field_type = tdesc_named_type (feature, "v8i16");
++  tdesc_add_field (type, "v8_int16", field_type);
++  field_type = tdesc_named_type (feature, "v4i32");
++  tdesc_add_field (type, "v4_int32", field_type);
++  field_type = tdesc_named_type (feature, "v2i64");
++  tdesc_add_field (type, "v2_int64", field_type);
++  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");
++  tdesc_create_reg (feature, "xmm3", 35, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm4", 36, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm5", 37, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm6", 38, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "xmm7", 39, 1, NULL, 128, "vec128");
++  tdesc_create_reg (feature, "mxcsr", 40, 1, "vector", 32, "i386_mxcsr");
++
++  feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx");
++  tdesc_create_reg (feature, "ymm0h", 41, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm1h", 42, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm2h", 43, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm3h", 44, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm4h", 45, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm5h", 46, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm6h", 47, 1, NULL, 128, "uint128");
++  tdesc_create_reg (feature, "ymm7h", 48, 1, NULL, 128, "uint128");
++
++  tdesc_i386_avx = result;
++}
+--- ./gdb/features/i386/i386-avx.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/features/i386/i386-avx.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,16 @@
++<?xml version="1.0"?>
++<!-- Copyright (C) 2010 Free Software Foundation, Inc.
++
++     Copying and distribution of this file, with or without modification,
++     are permitted in any medium without royalty provided the copyright
++     notice and this notice are preserved.  -->
++
++<!-- I386 with AVX -->
++
++<!DOCTYPE target SYSTEM "gdb-target.dtd">
++<target>
++  <architecture>i386</architecture>
++  <xi:include href="32bit-core.xml"/>
++  <xi:include href="32bit-sse.xml"/>
++  <xi:include href="32bit-avx.xml"/>
++</target>
+--- ./gdb/gdbserver/ChangeLog.avx	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/gdbserver/ChangeLog.avx	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,84 @@
++2010-03-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Use
++	I386_XSTATE_SSE_SIZE instead of I386_XSTATE_MAX_SIZE.  Use
++	I386_XSTATE_SIZE.
++
++2010-03-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Updated.
++	(i387_xsave_to_cache): Likewise.
++	(x86_xcr0): Likewise.
++	* linux-x86-low.c (x86_linux_process_qsupported): Likewise.
++
++2010-03-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (i386-xstate.o): Removed.
++
++	* configure.srv (srv_tgtobj): Remove i386-xstate.o for
++	i[34567]86-*-linux* and x86_64-*-linux*.
++
++	* i387-fp.c (x86_xcr0): Initialized to XSTATE_SSE_MASK.
++	(x86_xcr0_init): Removed.
++
++	* i387-fp.h (x86_xcr0_init): Removed.
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Use
++	XSTATE_MAX_SIZE_N_OF_INT64 and XSTATE_MAX_SIZE.  Get xcr0
++	from XSAVE extended state.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (clean): Replace reg-i386-linux-avx.c with
++	reg-i386-avx-linux.c.
++	(reg-x86-64-avx.c): Fixed.
++	(reg-x86-64-avx-linux.c): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* configure.srv (srv_tgtobj): Add xsave-nat.o for
++	i[34567]86-*-linux* and x86_64-*-linux*.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (x86_sse_unit): Renamed to ...
++	(x86_vector_unit): This.
++	(x86_get_sse_unit): Renamed to ...
++	(x86_get_vector_unit): This.
++	(i387_cache_to_fxsave): Updated.
++	* linux-x86-low.c (x86_arch_setup): Likewise.
++
++2010-01-21  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.h (x86_sse_unit): Renamed to ...
++	(x86_vector_unit): This.
++
++2009-10-14  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (clean): Also remove reg-i386-avx.c,
++	reg-i386-avx-linux.c, reg-x86-64-avx.c and reg-x86-64-avx-linux.c.
++	(reg-i386-avx.o): New target.
++	(reg-i386-avx.c): Likewise.
++	(reg-i386-avx-linux.o): Likewise.
++	(reg-i386-avx-linux.c): Likewise.
++	(reg-x86-64-avx.o): Likewise.
++	(reg-x86-64-avx.c): Likewise.
++	(reg-x86-64-avx-linux.o): Likewise.
++	(reg-x86-64-avx-linux.c): Likewise.
++
++	* gdbserver/configure.srv (srv_regobj): Add reg-i386-avx-linux.o
++	for i[34567]86-*-linux*.  Add reg-x86-64-avx-linux.o and
++	reg-i386-avx-linux.o for x86_64-*-linux*.
++
++	* i387-fp.c (x86_sse_unit): New.
++	(x86_get_sse_unit): Likewise.
++	(i387_cache_to_fxsave): Handle x86_sse_unit. Support fake
++	AVX registers.
++	(i387_fxsave_to_cache): Likewise.
++
++	* i387-fp.h (x86_sse_unit): New.
++	(x86_get_sse_unit): Likewise.
++
++	* linux-x86-low.c (init_registers_i386_avx_linux): New.
++	(init_registers_x86_64_avx_linux): Likewise.
++	(x86_arch_setup): Call x86_get_sse_unit () to handle x86_sse_unit.
+--- ./gdb/gdbserver/ChangeLog.xcr	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/gdbserver/ChangeLog.xcr	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,373 @@
++2010-03-30  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c: Don't include <unistd.h>.
++
++2010-03-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_update_xmltarget): Call ptrace
++	only once.
++
++2010-03-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (use_xml): New.
++	(x86_linux_update_xmltarget): Likewise.
++	(x86_linux_process_qsupported): Use x86_linux_update_xmltarget.
++	(x86_arch_setup): Don't call init_registers_amd64_linux,
++	init_registers_i386_linux.  Don't set gdbserver_xmltarget.  Use
++	x86_linux_update_xmltarget.
++
++	* server.c (handle_query): Call target_process_qsupported with
++	NULL query first.
++
++2010-03-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Replace
++	uint64_t with unsigned long long.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Check
++	"xmlRegisters=" instead of "xmlRegisters+".
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (target_regsets): Always use EXTENDED_REGS
++	with NT_X86_XSTATE.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (xmltarget_amd64_linux_no_xml): New.
++	(xmltarget_i386_linux_no_xml): Likewise.
++	(x86_linux_process_qsupported): Remove use_xml.  Update
++	gdbserver_xmltarget.
++	(x86_arch_setup): Set gdbserver_xmltarget to
++	xmltarget_amd64_linux_no_xml/xmltarget_i386_linux_no_xml.
++
++	* server.c (use_xml): Removed.
++	(get_features_xml): Updated.
++	(handle_query): Don't call target_process_qsupported with NULL.
++
++	* server.h (use_xml): Removed.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c: Include <unistd.h>.
++	(x86_linux_process_qsupported): Use getpid.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Replace
++	unsigned long long with uint64_t.
++
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Set use_xml
++	to 1 if XML is supported.
++
++2010-03-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* server.c (handle_query): Don't check "x86:xstate=".
++
++2010-03-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Check
++	xmlRegisters+ instead of x86=xml.
++
++	* server.c (USE_XML): Default to 0.
++	(use_xml): Initialize to USE_XML.
++
++2010-03-12  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Replace bit_I386_XSTATE_XXX
++	with I386_XSTATE_XXX.
++	(i387_xsave_to_cache): Likewise.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Check bit_I386_XSTATE_X87.
++	(i387_xsave_to_cache): Likewise.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Optimized.
++
++2010-03-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Handle upper YMM registers.
++	(i387_xsave_to_cache): Likewise.
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Check x86=xml.
++
++2010-02-19  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Also check x87 registers.
++	(i387_xsave_to_cache): Likewise.
++
++	* linux-x86-low.c: Include <sys/uio.h>.
++	(x86_linux_process_qsupported): Support AVX only if
++	PTRACE_GETREGSET works.
++
++2010-02-13  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Check x86_xcr0 instead of
++	x86_vector_unit.
++	(i387_xsave_to_cache): Likewise.
++	(x86_vector_unit): Removed.
++	(x86_vector_unit_init): Likewise.
++	(x86_xcr0): New.
++	(x86_xcr0_init): Likewise.
++
++	* i387-fp.h (x86_vector_unit): Removed.
++	(x86_vector_unit_init): Likewise.
++	(x86_xcr0): New.
++	(x86_xcr0_init): Likewise.
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Check x86_xcr0
++	instead of x86_vector_unit.
++
++2010-02-11  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-arm-low.c (target_regsets): Initialize nt_type to 0.
++	* linux-crisv32-low.c (target_regsets): Likewise.
++	* linux-m68k-low.c (target_regsets): Likewise.
++	* linux-mips-low.c (target_regsets): Likewise.
++	* linux-ppc-low.c (target_regsets): Likewise.
++	* linux-s390-low.c (target_regsets): Likewise.
++	* linux-sh-low.c (target_regsets): Likewise.
++	* linux-sparc-low.c (target_regsets): Likewise.
++	* linux-xtensa-low.c (target_regsets): Likewise.
++
++2010-02-11  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-low.c (regsets_fetch_inferior_registers): Simplify
++	nt_type.
++	(regsets_store_inferior_registers): Likewise.
++
++2010-02-10  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-low.c: Include <sys/uio.h>.
++	(regsets_fetch_inferior_registers): Support nt_type.
++	(regsets_store_inferior_registers): Likewise.
++
++	* linux-low.h (regset_info): Add nt_type.
++
++	* linux-x86-low.c: Include "elf/common.h".  Don't include
++	"../config/i386/nm-linux-xstate.h".
++	(PTRACE_GETREGSET): New.
++	(PTRACE_SETREGSET): Likewise.
++	(target_regsets): Initialize nt_type.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c: Replace PTRACE_GETXSTATEREGS with
++	PTRACE_GETREGSET in comments.
++
++2010-02-09  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c: Include "../config/i386/nm-linux-xstate.h".
++	(PTRACE_SETXSTATEREGS): Removed.
++	(PTRACE_SETXSTATEREGS): Likewise.
++	(target_regsets): Use PTRACE_GETREGSET/PTRACE_SETREGSET instead
++	of PTRACE_GETXSTATEREGS/PTRACE_SETXSTATEREGS.
++	(x86_linux_process_qsupported): Check PTRACE_GETREGSET instead
++	of PTRACE_GETXSTATEREGS.
++
++2010-02-06  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (x86_vector_unit_init): Properly check xcr0.
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Set use_xml
++	to 0 and return for NULL query.  Set use_xml to 1 if there is
++	"x86:xstate=" in qSupported packet.
++
++	* server.c (get_features_xml): Optimized.
++	(handle_query): Call target_process_qsupported with NULL
++	query first.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Remove unsigned from raw.
++	(i387_xsave_to_cache): Remove unsigned from raw and xmm.  Fix
++	a typo.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Set use_xml
++	to 0 if there is no "x86:xstate=" in qSupported packet.
++
++	* server.c (use_xml): New.
++	(get_features_xml): Don't use XML file if use_xml is 0.
++	(handle_query): Always call target_process_qsupported.
++
++	* server.h (use_xml): New.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (clean): Updated.
++	(i386-avx.o): New.
++	(i386-avx.c): Likewise.
++	(i386-avx-linux.o): Likewise.
++	(i386-avx-linux.c): Likewise.
++	(x86-64-avx.o): Likewise.
++	(x86-64-avx.c): Likewise.
++	(x86-64-avx-linux.o): Likewise.
++	(x86-64-avx-linux.c): Likewise.
++
++	* configure.srv (srv_i386_regobj): Add i386-avx.o.
++	(srv_i386_linux_regobj): Add i386-avx-linux.o.
++	(srv_x86_64_regobj): Add x86-64-avx.o.
++	(srv_x86_64_linux_regobj): Add x86-64-avx-linux.o.
++
++2010-02-05  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* configure.srv (srv_i386_32bit_xmlfiles): Add
++	i386/32bit-avx.xml.
++	(srv_i386_64bit_xmlfiles): Add i386/64bit-avx.xml.
++	(srv_i386_xmlfiles): Add i386/i386-avx.xml.
++	(srv_x86_64_xmlfiles): Add i386/x86-64-avx.xml.
++	(srv_i386_linux_xmlfiles): Add i386/i386-avx-linux.xml.
++	(srv_x86_64_linux_xmlfiles): Add i386/x86-64-avx-linux.xml.
++
++2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-low.c (linux_process_qsupported): Make it void.
++	* linux-x86-low.c (x86_linux_process_qsupported): Likewise.
++
++	* linux-low.h (linux_target_ops): Make process_qsupported void.
++
++	* server.c (handle_query): Make target_process_qsupported void.
++
++	* target.h (target_ops): Make process_qsupported void.
++	(target_process_qsupported): Make it void.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Replace xmm[32] with raw[32].
++	(i387_xsave_to_cache): Optimize xstate_bv == 0.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Remove collect_register_part.
++	(i387_xsave_to_cache): Remove supply_register_part.
++
++	* regcache.c (supply_register_part): Removed.
++	(collect_register_part): Likewise.
++	* regcache.h (supply_register_part): Likewise.
++	(collect_register_part): Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (xstate-nat.o): Renamed to ...
++	(i386-xstate.o): This.
++
++	* configure.srv (srv_tgtobj): Add i386-xstate.o instead of
++	xstate-nat.o for i[34567]86-*-linux* and x86_64-*-linux*.
++
++	* i387-fp.c: Include "i386-xstate.h" instead of "xstate-nat.h".
++	* linux-x86-low.c: Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Add another missing break.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Add the missing break.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* regcache.c (supply_register_part): Clear regcache if buf is
++	NULL.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_linux_process_qsupported): Always
++	initialize size and xcr0.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (x86_vector_unit_init): Support only what both gdb
++	and host support.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Clear part in vector registers
++	if its bit in xstat_bv is zero.  Update xstat_bv if needed.
++	(i387_xsave_to_cache): Clear part in vector registers if its bit
++	in xstat_bv is zero.
++
++	* regcache.c (supply_register): Clear regcache if buf is NULL.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Remove xcr0.
++	(i387_xsave_to_cache): Likewise.
++
++2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (x86_vector_unit_init): Updated.
++	* i387-fp.h (x86_vector_unit_init): Likewise.
++
++	* linux-low.c (linux_update_x86_xstate_size): Renamed to ...
++	(linux_process_qsupported): This.  Updated.
++	(linux_target_ops): Updated.
++
++	* linux-low.h (linux_target_ops): Replace update_x86_xstate_size
++	with process_qsupported.
++
++	* linux-x86-low.c (x86_linux_update_x86_xstate_size): Renamed
++	to ...
++	(x86_linux_process_qsupported): This.  Assemble qSupported ACK.
++
++	* server.c (handle_query): Call target_process_qsupported
++	for unhandled query.
++
++	* target.h (target_ops): Replace update_x86_xstate_size with
++	process_qsupported.
++	(target_update_x86_xstate_size): Removed.
++	(target_process_qsupported): New.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Remove xstate_bv.
++	(i387_xsave_to_cache): Likewise.
++
++2010-02-01  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (x86_vector_unit_init): Add and check size argument.
++
++	* i387-fp.h (x86_vector_unit): Remove unknown.
++	(x86_vector_unit_init): Add size argument.
++
++	* linux-low.c (linux_update_x86_xstate_size): New.
++	(linux_target_ops): Add linux_update_x86_xstate_size.
++
++	* linux-low.h (linux_target_ops): Add update_x86_xstate_size.
++
++	* linux-x86-low.c (x86_update_xstateregset_size): Renamed to
++	...
++	(x86_linux_update_x86_xstate_size): This.  Updated.
++	(x86_arch_setup): Don't call x86_update_xstateregset_size.
++	(the_low_target): Add x86_linux_update_x86_xstate_size.
++
++	* server.c (handle_query): Handle "x86:xstate:SIZE".
++
++	* target.h (target_ops): Add update_x86_xstate_size.
++	(target_update_x86_xstate_size): New.
++
++2010-01-31  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Handle xcr0 and xstate_bv
++	only for AVX and above.
++	(i387_xsave_to_cache): Likewise.
++
++2010-01-31  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_xsave): Add xcr0 and xstate_bv.
++	(i387_cache_to_xsave): Handle xcr0 and xstate_bv.
++	(i387_xsave_to_cache): Likewise.
++
++2010-01-29  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (x86_vector_unit_init): Updated.
++	* linux-x86-low.c (x86_update_xstateregset_size): Likewise.
+--- ./gdb/gdbserver/ChangeLog.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/gdbserver/ChangeLog.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,68 @@
++2010-02-08  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (init_registers_i386_linux): Update comments.
++	(init_registers_amd64_linux): Likewise.
++
++2010-02-07  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in: Replace x86-64 with amd64.
++
++	* configure.srv: Replace x86-64/x86_64 with amd64.
++
++	* linux-x86-low.c: Replace x86_64 with amd64.
++
++2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* configure.srv (srv_i386_regobj): New.
++	(srv_i386_linux_regobj): Likewise.
++	(srv_x86_64_regobj): Likewise.
++	(srv_x86_64_linux_regobj): Likewise.
++	(i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj.
++	(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_x86_64_linux_regobj.
++	(x86_64-*-linux*): Likewise.
++
++2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* configure.srv (srv_i386_32bit_xmlfiles): New.
++	(srv_i386_64bit_xmlfiles): Likewise.
++	(srv_i386_xmlfiles): Likewise.
++	(srv_x86_64_xmlfiles): Likewise.
++	(srv_i386_linux_xmlfiles): Likewise.
++	(srv_x86_64_linux_xmlfiles): Likewise.
++	(i[34567]86-*-cygwin*): 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_xmlfiles to
++	$srv_i386_linux_xmlfiles and $srv_x86_64_linux_xmlfiles.
++	(x86_64-*-linux*): Likewise.
++
++2010-02-03  H.J. Lu  <hongjiu.lu@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, x86-64.c,
++	i386-linux.c and x86-64-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.
++	(x86-64.o): Likewise.
++	(x86-64.c): Likewise.
++	(x86-64-linux.o): Likewise.
++	(x86-64-linux.c): Likewise.
++
++	* configure.srv: Replace reg-i386.o, reg-x86-64.o,
++	reg-i386-linux.o and reg-x86-64-linux.o with i386.o, x86-64.o,
++	i386-linux.o and x86-64-linux.o.
+--- ./gdb/gdbserver/ChangeLog.xstate	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/gdbserver/ChangeLog.xstate	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,89 @@
++2010-01-31  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_xsave): Correct layout.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_update_xstateregset_size): Use
++	i386_xstate.size.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_update_xstateregset_size): Call
++	x86_vector_unit_init here. Turn off other FP PTRACE requests
++	only on AVX host.
++	(x86_arch_setup): Don't call x86_vector_unit_init here.
++
++2010-01-26  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_update_xstateregset_size): Update
++	size for PTRACE_GETXSTATEREGS only if it is supported.
++
++2010-01-26  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_update_xstateregset_size): Use only
++	PTRACE_GETXSTATEREGS if it is supported.
++
++2010-01-26  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c (x86_update_xstateregset_size): For AVX,
++	only use PTRACE_GETXSTATEREGS.
++
++2010-01-26  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* i387-fp.c (i387_cache_to_xsave): Find ymm0 for AVX.
++	(i387_xsave_to_cache): Likewise.
++
++2010-01-25  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (xsave-nat.o): Renamed to ...
++	(xstate-nat.o): This.
++
++	* configure.srv (srv_tgtobj): Add xstate-nat.o instead of
++	xsave-nat.o for i[34567]86-*-linux* and x86_64-*-linux*.
++
++	* i387-fp.c: Include "xstate-nat.h" instead of "xsave-nat.h".
++	* linux-x86-low.c: Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* regcache.c (supply_register_part): Change size to unsigned int.
++	(collect_register_part): Likewise.
++	* regcache.h (supply_register_part): Likewise.
++	(collect_register_part): Likewise.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* linux-x86-low.c: Include "xsave-nat.h"
++	(PTRACE_GETXSTATEREGS): New.
++	(PTRACE_SETXSTATEREGS): Likewise.
++	(x86_fill_xstateregset): Likewise.
++	(x86_store_xstateregset): Likewise.
++	(x86_update_xstateregset_size): Likewise.
++	(target_regsets): Add PTRACE_GETXSTATEREGS entry.
++	(x86_arch_setup): Call x86_update_xstateregset_size.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* configure.srv (srv_tgtobj): Add xsave-nat.o for
++	i[34567]86-*-linux* and x86_64-*-linux*.
++
++	* i387-fp.c (i387_xsave): New.
++	(i387_cache_to_xsave): Likewise.
++	(i387_xsave_to_cache): Likewise.
++	(x86_vector_unit): Likewise.
++	(x86_vector_unit_init): Likewise.
++	* 387-fp.h (i387_cache_to_xsave): Likewise.
++	(i387_xsave_to_cache): Likewise.
++	(x86_vector_unit): Likewise.
++	(x86_vector_unit_init): Likewise.
++	* regcache.c (supply_register_part): Likewise.
++	(collect_register_part): Likewise.
++	* regcache.h (supply_register_part): Likewise.
++	(collect_register_part): Likewise.
++
++	* linux-x86-low.c (x86_arch_setup): Call x86_vector_unit_init.
++
++2010-01-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* Makefile.in (xsave-nat.o): New.
+--- ./gdb/gdbserver/Makefile.in	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/gdbserver/Makefile.in	2010-04-03 21:12:32.000000000 +0200
+@@ -217,6 +217,8 @@ clean:
+ 	rm -f powerpc-isa205-vsx64l.c
+ 	rm -f s390-linux32.c s390-linux64.c s390x-linux64.c
+ 	rm -f xml-builtin.c stamp-xml
++	rm -f i386-avx.c i386-avx-linux.c
++	rm -f amd64-avx.c amd64-avx-linux.c
+ 
+ maintainer-clean realclean distclean: clean
+ 	rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log
+@@ -351,6 +353,12 @@ i386.c : $(srcdir)/../regformats/i386/i3
+ 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
++i386-avx.o : i386-avx.c $(regdef_h)
++i386-avx.c : $(srcdir)/../regformats/i386/i386-avx.dat $(regdat_sh)
++	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx.dat i386-avx.c
++i386-avx-linux.o : i386-avx-linux.c $(regdef_h)
++i386-avx-linux.c : $(srcdir)/../regformats/i386/i386-avx-linux.dat $(regdat_sh)
++	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx-linux.dat i386-avx-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
+@@ -438,6 +446,12 @@ amd64.c : $(srcdir)/../regformats/i386/a
+ 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
++amd64-avx.o : amd64-avx.c $(regdef_h)
++amd64-avx.c : $(srcdir)/../regformats/i386/amd64-avx.dat $(regdat_sh)
++	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx.dat amd64-avx.c
++amd64-avx-linux.o : amd64-avx-linux.c $(regdef_h)
++amd64-avx-linux.c : $(srcdir)/../regformats/i386/amd64-avx-linux.dat $(regdat_sh)
++	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx-linux.dat amd64-avx-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-04-03 20:59:52.000000000 +0200
++++ ./gdb/gdbserver/configure.srv	2010-04-03 21:12:32.000000000 +0200
+@@ -22,17 +22,17 @@
+ # 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_regobj="i386.o i386-avx.o"
++srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o"
++srv_amd64_regobj="amd64.o x86-64-avx.o"
++srv_amd64_linux_regobj="amd64-linux.o amd64-avx-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"
++srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml"
++srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml"
++srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml $srv_i386_32bit_xmlfiles"
++srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml $srv_i386_64bit_xmlfiles"
++srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles"
++srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles"
+ 
+ # Input is taken from the "${target}" variable.
+ 
+--- ./gdb/gdbserver/i387-fp.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/i387-fp.c	2010-04-03 21:12:32.000000000 +0200
+@@ -19,6 +19,7 @@
+ 
+ #include "server.h"
+ #include "i387-fp.h"
++#include "i386-xstate.h"
+ 
+ int num_xmm_registers = 8;
+ 
+@@ -72,6 +73,46 @@ struct i387_fxsave {
+   unsigned char xmm_space[256];
+ };
+ 
++struct i387_xsave {
++  /* All these are only sixteen bits, plus padding, except for fop (which
++     is only eleven bits), and fooff / fioff (which are 32 bits each).  */
++  unsigned short fctrl;
++  unsigned short fstat;
++  unsigned short ftag;
++  unsigned short fop;
++  unsigned int fioff;
++  unsigned short fiseg;
++  unsigned short pad1;
++  unsigned int fooff;
++  unsigned short foseg;
++  unsigned short pad12;
++
++  unsigned int mxcsr;
++  unsigned int mxcsr_mask;
++
++  /* Space for eight 80-bit FP values in 128-bit spaces.  */
++  unsigned char st_space[128];
++
++  /* Space for eight 128-bit XMM values, or 16 on x86-64.  */
++  unsigned char xmm_space[256];
++
++  unsigned char reserved1[48];
++
++  /* The extended control register 0 (the XFEATURE_ENABLED_MASK
++     register).  */
++  unsigned long long xcr0;
++
++  unsigned char reserved2[40];
++
++  /* The XSTATE_BV bit vector.  */
++  unsigned long long xstate_bv;
++
++  unsigned char reserved3[56];
++
++  /* Space for eight upper 128-bit YMM values, or 16 on x86-64.  */
++  unsigned char ymmh_space[256];
++};
++
+ void
+ i387_cache_to_fsave (struct regcache *regcache, void *buf)
+ {
+@@ -199,6 +240,128 @@ i387_cache_to_fxsave (struct regcache *r
+   fp->foseg = val;
+ }
+ 
++void
++i387_cache_to_xsave (struct regcache *regcache, void *buf)
++{
++  struct i387_xsave *fp = (struct i387_xsave *) buf;
++  int i;
++  unsigned long val, val2;
++  unsigned int clear_bv;
++  unsigned long long xstate_bv = 0;
++  char raw[16];
++  char *p;
++
++  /* The supported bits in `xstat_bv' are 1 byte.  Clear part in
++     vector registers if its bit in xstat_bv is zero.  */
++  clear_bv = (~fp->xstate_bv) & x86_xcr0;
++
++  /* Clear part in x87 and vector registers if its bit in xstat_bv is
++     zero.  */
++  if (clear_bv)
++    {
++      if ((clear_bv & I386_XSTATE_X87))
++	for (i = 0; i < 8; i++)
++	  memset (((char *) &fp->st_space[0]) + i * 16, 0, 10);
++
++      if ((clear_bv & I386_XSTATE_SSE))
++	for (i = 0; i < num_xmm_registers; i++) 
++	  memset (((char *) &fp->xmm_space[0]) + i * 16, 0, 16);
++
++      if ((clear_bv & I386_XSTATE_AVX))
++	for (i = 0; i < num_xmm_registers; i++) 
++	  memset (((char *) &fp->ymmh_space[0]) + i * 16, 0, 16);
++    }
++
++  /* Check if any x87 registers are changed.  */
++  if ((x86_xcr0 & I386_XSTATE_X87))
++    {
++      int st0_regnum = find_regno ("st0");
++
++      for (i = 0; i < 8; i++)
++	{
++	  collect_register (regcache, i + st0_regnum, raw);
++	  p = ((char *) &fp->st_space[0]) + i * 16;
++	  if (memcmp (raw, p, 10))
++	    {
++	      xstate_bv |= I386_XSTATE_X87;
++	      memcpy (p, raw, 10);
++	    }
++	}
++    }
++
++  /* Check if any SSE registers are changed.  */
++  if ((x86_xcr0 & I386_XSTATE_SSE))
++    {
++      int xmm0_regnum = find_regno ("xmm0");
++
++      for (i = 0; i < num_xmm_registers; i++) 
++	{
++	  collect_register (regcache, i + xmm0_regnum, raw);
++	  p = ((char *) &fp->xmm_space[0]) + i * 16;
++	  if (memcmp (raw, p, 16))
++	    {
++	      xstate_bv |= I386_XSTATE_SSE;
++	      memcpy (p, raw, 16);
++	    }
++	}
++    }
++
++  /* Check if any AVX registers are changed.  */
++  if ((x86_xcr0 & I386_XSTATE_AVX))
++    {
++      int ymm0h_regnum = find_regno ("ymm0h");
++
++      for (i = 0; i < num_xmm_registers; i++) 
++	{
++	  collect_register (regcache, i + ymm0h_regnum, raw);
++	  p = ((char *) &fp->ymmh_space[0]) + i * 16;
++	  if (memcmp (raw, p, 16))
++	    {
++	      xstate_bv |= I386_XSTATE_AVX;
++	      memcpy (p, raw, 16);
++	    }
++	}
++    }
++
++  /* Update the corresponding bits in xstate_bv if any SSE/AVX
++     registers are changed.  */
++  fp->xstate_bv |= xstate_bv;
++
++  collect_register_by_name (regcache, "fioff", &fp->fioff);
++  collect_register_by_name (regcache, "fooff", &fp->fooff);
++  collect_register_by_name (regcache, "mxcsr", &fp->mxcsr);
++
++  /* This one's 11 bits... */
++  collect_register_by_name (regcache, "fop", &val2);
++  fp->fop = (val2 & 0x7FF) | (fp->fop & 0xF800);
++
++  /* Some registers are 16-bit.  */
++  collect_register_by_name (regcache, "fctrl", &val);
++  fp->fctrl = val;
++
++  collect_register_by_name (regcache, "fstat", &val);
++  fp->fstat = val;
++
++  /* Convert to the simplifed tag form stored in fxsave data.  */
++  collect_register_by_name (regcache, "ftag", &val);
++  val &= 0xFFFF;
++  val2 = 0;
++  for (i = 7; i >= 0; i--)
++    {
++      int tag = (val >> (i * 2)) & 3;
++
++      if (tag != 3)
++	val2 |= (1 << i);
++    }
++  fp->ftag = val2;
++
++  collect_register_by_name (regcache, "fiseg", &val);
++  fp->fiseg = val;
++
++  collect_register_by_name (regcache, "foseg", &val);
++  fp->foseg = val;
++}
++
+ static int
+ i387_ftag (struct i387_fxsave *fp, int regno)
+ {
+@@ -296,3 +459,107 @@ i387_fxsave_to_cache (struct regcache *r
+   val = (fp->fop) & 0x7FF;
+   supply_register_by_name (regcache, "fop", &val);
+ }
++
++void
++i387_xsave_to_cache (struct regcache *regcache, const void *buf)
++{
++  struct i387_xsave *fp = (struct i387_xsave *) buf;
++  struct i387_fxsave *fxp = (struct i387_fxsave *) buf;
++  int i, top;
++  unsigned long val;
++  unsigned int clear_bv;
++  char *p;
++
++  /* The supported bits in `xstat_bv' are 1 byte.  Clear part in
++     vector registers if its bit in xstat_bv is zero.  */
++  clear_bv = (~fp->xstate_bv) & x86_xcr0;
++
++  /* Check if any x87 registers are changed.  */
++  if ((x86_xcr0 & I386_XSTATE_X87))
++    {
++      int st0_regnum = find_regno ("st0");
++
++      if ((clear_bv & I386_XSTATE_X87))
++	p = NULL;
++      else
++	p = (char *) buf;
++
++      for (i = 0; i < 8; i++)
++	{
++	  if (p)
++	    p = ((char *) &fp->st_space[0]) + i * 16;
++	  supply_register (regcache, i + st0_regnum, p);
++	}
++    }
++
++  if ((x86_xcr0 & I386_XSTATE_SSE))
++    {
++      int xmm0_regnum = find_regno ("xmm0");
++
++      if ((clear_bv & I386_XSTATE_SSE))
++	p = NULL;
++      else
++	p = (char *) buf;
++
++      for (i = 0; i < num_xmm_registers; i++)
++	{
++	  if (p)
++	    p = ((char *) &fp->xmm_space[0]) + i * 16;
++	  supply_register (regcache, i + xmm0_regnum, p);
++	}
++    }
++
++  if ((x86_xcr0 & I386_XSTATE_AVX))
++    {
++      int ymm0h_regnum = find_regno ("ymm0h");
++
++      if ((clear_bv & I386_XSTATE_AVX))
++	p = NULL;
++      else
++	p = (char *) buf;
++
++      for (i = 0; i < num_xmm_registers; i++)
++	{
++	  if (p)
++	    p = ((char *) &fp->ymmh_space[0]) + i * 16;
++	  supply_register (regcache, i + ymm0h_regnum, p);
++	}
++    }
++
++  supply_register_by_name (regcache, "fioff", &fp->fioff);
++  supply_register_by_name (regcache, "fooff", &fp->fooff);
++  supply_register_by_name (regcache, "mxcsr", &fp->mxcsr);
++
++  /* Some registers are 16-bit.  */
++  val = fp->fctrl & 0xFFFF;
++  supply_register_by_name (regcache, "fctrl", &val);
++
++  val = fp->fstat & 0xFFFF;
++  supply_register_by_name (regcache, "fstat", &val);
++
++  /* Generate the form of ftag data that GDB expects.  */
++  top = (fp->fstat >> 11) & 0x7;
++  val = 0;
++  for (i = 7; i >= 0; i--)
++    {
++      int tag;
++      if (fp->ftag & (1 << i))
++	tag = i387_ftag (fxp, (i + 8 - top) % 8);
++      else
++	tag = 3;
++      val |= tag << (2 * i);
++    }
++  supply_register_by_name (regcache, "ftag", &val);
++
++  val = fp->fiseg & 0xFFFF;
++  supply_register_by_name (regcache, "fiseg", &val);
++
++  val = fp->foseg & 0xFFFF;
++  supply_register_by_name (regcache, "foseg", &val);
++
++  val = (fp->fop) & 0x7FF;
++  supply_register_by_name (regcache, "fop", &val);
++}
++
++/* Default to SSE.  */
++unsigned long long x86_xcr0 = I386_XSTATE_SSE_MASK;
+--- ./gdb/gdbserver/i387-fp.h	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/i387-fp.h	2010-04-03 21:12:32.000000000 +0200
+@@ -26,6 +26,11 @@ void i387_fsave_to_cache (struct regcach
+ void i387_cache_to_fxsave (struct regcache *regcache, void *buf);
+ void i387_fxsave_to_cache (struct regcache *regcache, const void *buf);
+ 
++void i387_cache_to_xsave (struct regcache *regcache, void *buf);
++void i387_xsave_to_cache (struct regcache *regcache, const void *buf);
++
++extern unsigned long long x86_xcr0;
++
+ extern int num_xmm_registers;
+ 
+ #endif /* I387_FP_H */
+--- ./gdb/gdbserver/linux-arm-low.c	2010-02-01 17:13:16.000000000 +0100
++++ ./gdb/gdbserver/linux-arm-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -354,16 +354,16 @@ arm_arch_setup (void)
+ }
+ 
+ struct regset_info target_regsets[] = {
+-  { PTRACE_GETREGS, PTRACE_SETREGS, 18 * 4,
++  { PTRACE_GETREGS, PTRACE_SETREGS, 0, 18 * 4,
+     GENERAL_REGS,
+     arm_fill_gregset, arm_store_gregset },
+-  { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 16 * 8 + 6 * 4,
++  { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 0, 16 * 8 + 6 * 4,
+     EXTENDED_REGS,
+     arm_fill_wmmxregset, arm_store_wmmxregset },
+-  { PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 32 * 8 + 4,
++  { PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 0, 32 * 8 + 4,
+     EXTENDED_REGS,
+     arm_fill_vfpregset, arm_store_vfpregset },
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ struct linux_target_ops the_low_target = {
+--- ./gdb/gdbserver/linux-crisv32-low.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/linux-crisv32-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -365,9 +365,9 @@ cris_store_gregset (const void *buf)
+ typedef unsigned long elf_gregset_t[cris_num_regs];
+ 
+ struct regset_info target_regsets[] = {
+-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
++  { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
+     GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ struct linux_target_ops the_low_target = {
+--- ./gdb/gdbserver/linux-low.c	2010-03-06 01:12:57.000000000 +0100
++++ ./gdb/gdbserver/linux-low.c	2010-04-03 21:19:14.000000000 +0200
+@@ -39,6 +39,7 @@
+ #include <dirent.h>
+ #include <sys/stat.h>
+ #include <sys/vfs.h>
++#include <sys/uio.h>
+ #ifndef ELFMAG0
+ /* Don't include <linux/elf.h> here.  If it got included by gdb_proc_service.h
+    then ELFMAG0 will have been defined.  If it didn't get included by
+@@ -2281,14 +2282,15 @@ regsets_fetch_inferior_registers (struct
+   struct regset_info *regset;
+   int saw_general_regs = 0;
+   int pid;
++  struct iovec iov;
+ 
+   regset = target_regsets;
+ 
+   pid = lwpid_of (get_thread_lwp (current_inferior));
+   while (regset->size >= 0)
+     {
+-      void *buf;
+-      int res;
++      void *buf, *data;
++      int nt_type, res;
+ 
+       if (regset->size == 0 || disabled_regsets[regset - target_regsets])
+ 	{
+@@ -2297,10 +2299,21 @@ regsets_fetch_inferior_registers (struct
+ 	}
+ 
+       buf = xmalloc (regset->size);
++
++      nt_type = regset->nt_type;
++      if (nt_type)
++	{
++	  iov.iov_base = buf;
++	  iov.iov_len = regset->size;
++	  data = (void *) &iov;
++	}
++      else
++	data = buf;
++
+ #ifndef __sparc__
+-      res = ptrace (regset->get_request, pid, 0, buf);
++      res = ptrace (regset->get_request, pid, nt_type, data);
+ #else
+-      res = ptrace (regset->get_request, pid, buf, 0);
++      res = ptrace (regset->get_request, pid, data, nt_type);
+ #endif
+       if (res < 0)
+ 	{
+@@ -2338,14 +2351,15 @@ regsets_store_inferior_registers (struct
+   struct regset_info *regset;
+   int saw_general_regs = 0;
+   int pid;
++  struct iovec iov;
+ 
+   regset = target_regsets;
+ 
+   pid = lwpid_of (get_thread_lwp (current_inferior));
+   while (regset->size >= 0)
+     {
+-      void *buf;
+-      int res;
++      void *buf, *data;
++      int nt_type, res;
+ 
+       if (regset->size == 0 || disabled_regsets[regset - target_regsets])
+ 	{
+@@ -2358,10 +2372,21 @@ regsets_store_inferior_registers (struct
+       /* First fill the buffer with the current register set contents,
+ 	 in case there are any items in the kernel's regset that are
+ 	 not in gdbserver's regcache.  */
++
++      nt_type = regset->nt_type;
++      if (nt_type)
++	{
++	  iov.iov_base = buf;
++	  iov.iov_len = regset->size;
++	  data = (void *) &iov;
++	}
++      else
++	data = buf;
++
+ #ifndef __sparc__
+-      res = ptrace (regset->get_request, pid, 0, buf);
++      res = ptrace (regset->get_request, pid, nt_type, data);
+ #else
+-      res = ptrace (regset->get_request, pid, buf, 0);
++      res = ptrace (regset->get_request, pid, &iov, data);
+ #endif
+ 
+       if (res == 0)
+@@ -2371,9 +2396,9 @@ regsets_store_inferior_registers (struct
+ 
+ 	  /* Only now do we write the register set.  */
+ #ifndef __sparc__
+-	  res = ptrace (regset->set_request, pid, 0, buf);
++	  res = ptrace (regset->set_request, pid, nt_type, data);
+ #else
+-	  res = ptrace (regset->set_request, pid, buf, 0);
++	  res = ptrace (regset->set_request, pid, data, nt_type);
+ #endif
+ 	}
+ 
+@@ -3434,6 +3459,13 @@ linux_core_of_thread (ptid_t ptid)
+   return core;
+ }
+ 
++static void
++linux_process_qsupported (const char *query)
++{
++  if (the_low_target.process_qsupported != NULL)
++    the_low_target.process_qsupported (query);
++}
++
+ static struct target_ops linux_target_ops = {
+   linux_create_inferior,
+   linux_attach,
+@@ -3477,7 +3509,8 @@ static struct target_ops linux_target_op
+ #else
+   NULL,
+ #endif
+-  linux_core_of_thread
++  linux_core_of_thread,
++  linux_process_qsupported
+ };
+ 
+ static void
+--- ./gdb/gdbserver/linux-low.h	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/linux-low.h	2010-04-03 21:12:32.000000000 +0200
+@@ -35,6 +35,9 @@ enum regset_type {
+ struct regset_info
+ {
+   int get_request, set_request;
++  /* If NT_TYPE isn't 0, it will be passed to ptrace as the 3rd
++     argument and the 4th argument should be "const struct iovec *".  */
++  int nt_type;
+   int size;
+   enum regset_type type;
+   regset_fill_func fill_function;
+@@ -111,6 +114,9 @@ struct linux_target_ops
+ 
+   /* Hook to call prior to resuming a thread.  */
+   void (*prepare_to_resume) (struct lwp_info *);
++
++  /* Hook to support target specific qSupported.  */
++  void (*process_qsupported) (const char *);
+ };
+ 
+ extern struct linux_target_ops the_low_target;
+--- ./gdb/gdbserver/linux-m68k-low.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/linux-m68k-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -112,14 +112,14 @@ m68k_store_fpregset (struct regcache *re
+ 
+ struct regset_info target_regsets[] = {
+ #ifdef HAVE_PTRACE_GETREGS
+-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
++  { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
+     GENERAL_REGS,
+     m68k_fill_gregset, m68k_store_gregset },
+-  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
++  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t),
+     FP_REGS,
+     m68k_fill_fpregset, m68k_store_fpregset },
+ #endif /* HAVE_PTRACE_GETREGS */
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ static const unsigned char m68k_breakpoint[] = { 0x4E, 0x4F };
+--- ./gdb/gdbserver/linux-mips-low.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/linux-mips-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -343,12 +343,12 @@ mips_store_fpregset (struct regcache *re
+ 
+ struct regset_info target_regsets[] = {
+ #ifdef HAVE_PTRACE_GETREGS
+-  { PTRACE_GETREGS, PTRACE_SETREGS, 38 * 8, GENERAL_REGS,
++  { PTRACE_GETREGS, PTRACE_SETREGS, 0, 38 * 8, GENERAL_REGS,
+     mips_fill_gregset, mips_store_gregset },
+-  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 33 * 8, FP_REGS,
++  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, 33 * 8, FP_REGS,
+     mips_fill_fpregset, mips_store_fpregset },
+ #endif /* HAVE_PTRACE_GETREGS */
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ struct linux_target_ops the_low_target = {
+--- ./gdb/gdbserver/linux-ppc-low.c	2010-01-21 23:10:18.000000000 +0100
++++ ./gdb/gdbserver/linux-ppc-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -593,14 +593,14 @@ struct regset_info target_regsets[] = {
+      fetch them every time, but still fall back to PTRACE_PEEKUSER for the
+      general registers.  Some kernels support these, but not the newer
+      PPC_PTRACE_GETREGS.  */
+-  { PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, SIZEOF_VSXREGS, EXTENDED_REGS,
++  { PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, 0, SIZEOF_VSXREGS, EXTENDED_REGS,
+   ppc_fill_vsxregset, ppc_store_vsxregset },
+   { PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, EXTENDED_REGS,
+     ppc_fill_vrregset, ppc_store_vrregset },
+-  { PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 32 * 4 + 8 + 4, EXTENDED_REGS,
++  { PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 0, 32 * 4 + 8 + 4, EXTENDED_REGS,
+     ppc_fill_evrregset, ppc_store_evrregset },
+-  { 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL },
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL },
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ struct linux_target_ops the_low_target = {
+--- ./gdb/gdbserver/linux-s390-low.c	2010-01-21 20:26:49.000000000 +0100
++++ ./gdb/gdbserver/linux-s390-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -181,8 +181,8 @@ static void s390_fill_gregset (struct re
+ }
+ 
+ struct regset_info target_regsets[] = {
+-  { 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ 
+--- ./gdb/gdbserver/linux-sh-low.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/linux-sh-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -104,8 +104,8 @@ static void sh_fill_gregset (struct regc
+ }
+ 
+ struct regset_info target_regsets[] = {
+-  { 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL },
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL },
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ struct linux_target_ops the_low_target = {
+--- ./gdb/gdbserver/linux-sparc-low.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/linux-sparc-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -260,13 +260,13 @@ sparc_reinsert_addr (void)
+ 
+ 
+ struct regset_info target_regsets[] = {
+-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
++  { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
+     GENERAL_REGS,
+     sparc_fill_gregset, sparc_store_gregset },
+-  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (fpregset_t),
++  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (fpregset_t),
+     FP_REGS,
+     sparc_fill_fpregset, sparc_store_fpregset },
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ struct linux_target_ops the_low_target = {
+--- ./gdb/gdbserver/linux-x86-low.c	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/gdbserver/linux-x86-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -24,6 +24,8 @@
+ #include "linux-low.h"
+ #include "i387-fp.h"
+ #include "i386-low.h"
++#include "i386-xstate.h"
++#include "elf/common.h"
+ 
+ #include "gdb_proc_service.h"
+ 
+@@ -31,10 +33,35 @@
+ void init_registers_i386_linux (void);
+ /* Defined in auto-generated file amd64-linux.c.  */
+ void init_registers_amd64_linux (void);
++/* Defined in auto-generated file i386-avx-linux.c.  */
++void init_registers_i386_avx_linux (void);
++/* Defined in auto-generated file amd64-avx-linux.c.  */
++void init_registers_amd64_avx_linux (void);
++
++/* Backward compatibility for gdb without XML support.  */
++
++static const char *xmltarget_i386_linux_no_xml = "@<target>\
++<architecture>i386</architecture>\
++<osabi>GNU/Linux</osabi>\
++</target>";
++static const char *xmltarget_amd64_linux_no_xml = "@<target>\
++<architecture>i386:x86-64</architecture>\
++<osabi>GNU/Linux</osabi>\
++</target>";
+ 
+ #include <sys/reg.h>
+ #include <sys/procfs.h>
+ #include <sys/ptrace.h>
++#include <sys/uio.h>
++
++#ifndef PTRACE_GETREGSET
++#define PTRACE_GETREGSET	0x4204
++#endif
++
++#ifndef PTRACE_SETREGSET
++#define PTRACE_SETREGSET	0x4205
++#endif
++
+ 
+ #ifndef PTRACE_GET_THREAD_AREA
+ #define PTRACE_GET_THREAD_AREA 25
+@@ -252,6 +279,18 @@ x86_store_fpxregset (struct regcache *re
+ 
+ #endif
+ 
++static void
++x86_fill_xstateregset (struct regcache *regcache, void *buf)
++{
++  i387_cache_to_xsave (regcache, buf);
++}
++
++static void
++x86_store_xstateregset (struct regcache *regcache, const void *buf)
++{
++  i387_xsave_to_cache (regcache, buf);
++}
++
+ /* ??? The non-biarch i386 case stores all the i387 regs twice.
+    Once in i387_.*fsave.* and once in i387_.*fxsave.*.
+    This is, presumably, to handle the case where PTRACE_[GS]ETFPXREGS
+@@ -264,21 +303,23 @@ x86_store_fpxregset (struct regcache *re
+ struct regset_info target_regsets[] =
+ {
+ #ifdef HAVE_PTRACE_GETREGS
+-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
++  { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
+     GENERAL_REGS,
+     x86_fill_gregset, x86_store_gregset },
++  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_X86_XSTATE, 0,
++    EXTENDED_REGS, x86_fill_xstateregset, x86_store_xstateregset },
+ # ifndef __x86_64__
+ #  ifdef HAVE_PTRACE_GETFPXREGS
+-  { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t),
++  { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, 0, sizeof (elf_fpxregset_t),
+     EXTENDED_REGS,
+     x86_fill_fpxregset, x86_store_fpxregset },
+ #  endif
+ # endif
+-  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
++  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t),
+     FP_REGS,
+     x86_fill_fpregset, x86_store_fpregset },
+ #endif /* HAVE_PTRACE_GETREGS */
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ static CORE_ADDR
+@@ -772,6 +813,121 @@ x86_siginfo_fixup (struct siginfo *nativ
+   return 0;
+ }
+ \f
++static int use_xml;
++
++/* Update gdbserver_xmltarget.  */
++
++static void
++x86_linux_update_xmltarget (void)
++{
++  static unsigned long long xcr0;
++  static int have_ptrace_getregset = -1;
++
++  if (!current_inferior)
++    return;
++
++#ifdef __x86_64__
++  if (num_xmm_registers == 8)
++    init_registers_i386_linux ();
++  else
++    init_registers_amd64_linux ();
++#else
++  init_registers_i386_linux ();
++#endif
++
++  if (!use_xml)
++    {
++      /* Don't use XML.  */
++#ifdef __x86_64__
++      if (num_xmm_registers == 8)
++	gdbserver_xmltarget = xmltarget_i386_linux_no_xml;
++      else
++	gdbserver_xmltarget = xmltarget_amd64_linux_no_xml;
++#else
++      gdbserver_xmltarget = xmltarget_i386_linux_no_xml;
++#endif
++
++      x86_xcr0 = I386_XSTATE_SSE_MASK;
++
++      return;
++    }
++
++  /* Update gdbserver_xmltarget with XML support.  */
++#ifdef __x86_64__
++  if (num_xmm_registers == 8)
++    gdbserver_xmltarget = "i386-linux.xml";
++  else
++    gdbserver_xmltarget = "amd64-linux.xml";
++#else
++  gdbserver_xmltarget = "i386-linux.xml";
++#endif
++
++  /* Check if XSAVE extended state is supported.  */
++  if (have_ptrace_getregset == -1)
++    {
++      int pid = pid_of (get_thread_lwp (current_inferior));
++      unsigned long long xstateregs[I386_XSTATE_SSE_SIZE / sizeof (long long)];
++      struct iovec iov;
++      struct regset_info *regset;
++
++      iov.iov_base = xstateregs;
++      iov.iov_len = sizeof (xstateregs);
++
++      /* Check if PTRACE_GETREGSET works.  */
++      if (ptrace (PTRACE_GETREGSET, pid, (unsigned int) NT_X86_XSTATE,
++		  &iov) < 0)
++	{
++	  have_ptrace_getregset = 0;
++	  return;
++	}
++      else
++	have_ptrace_getregset = 1;
++
++      /* Get XCR0 from XSAVE extended state at byte 464.  */
++      xcr0 = xstateregs[464 / sizeof (long long)];
++
++      /* Use PTRACE_GETREGSET if it is available.  */
++      for (regset = target_regsets;
++	   regset->fill_function != NULL; regset++)
++	if (regset->get_request == PTRACE_GETREGSET)
++	  regset->size = I386_XSTATE_SIZE (xcr0);
++	else if (regset->type != GENERAL_REGS)
++	  regset->size = 0;
++    }
++
++  if (have_ptrace_getregset)
++    {
++      /* AVX is the highest feature we support.  */
++      if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
++	{
++	  x86_xcr0 = xcr0;
++
++#ifdef __x86_64__
++	  /* I386 has 8 xmm regs.  */
++	  if (num_xmm_registers == 8)
++	    init_registers_i386_avx_linux ();
++	  else
++	    init_registers_amd64_avx_linux ();
++#else
++	  init_registers_i386_avx_linux ();
++#endif
++	}
++    }
++}
++
++/* Process qSupported query, "xmlRegisters=".  Update the buffer size for
++   PTRACE_GETREGSET.  */
++
++static void
++x86_linux_process_qsupported (const char *query)
++{
++  /* Return if gdb doesn't support XML.  If gdb sends "xmlRegisters="
++     in qSupported query, it supports x86 XML target descriptions.  */
++  use_xml = query != NULL && strncmp (query, "xmlRegisters=", 13) == 0;
++
++  x86_linux_update_xmltarget ();
++}
++
+ /* Initialize gdbserver for the architecture of the inferior.  */
+ 
+ static void
+@@ -792,8 +948,6 @@ x86_arch_setup (void)
+     }
+   else if (use_64bit)
+     {
+-      init_registers_amd64_linux ();
+-
+       /* Amd64 doesn't have HAVE_LINUX_USRREGS.  */
+       the_low_target.num_regs = -1;
+       the_low_target.regmap = NULL;
+@@ -803,14 +957,13 @@ x86_arch_setup (void)
+       /* Amd64 has 16 xmm regs.  */
+       num_xmm_registers = 16;
+ 
++      x86_linux_update_xmltarget ();
+       return;
+     }
+ #endif
+ 
+   /* Ok we have a 32-bit inferior.  */
+ 
+-  init_registers_i386_linux ();
+-
+   the_low_target.num_regs = I386_NUM_REGS;
+   the_low_target.regmap = i386_regmap;
+   the_low_target.cannot_fetch_register = i386_cannot_fetch_register;
+@@ -818,6 +971,8 @@ x86_arch_setup (void)
+ 
+   /* I386 has 8 xmm regs.  */
+   num_xmm_registers = 8;
++
++  x86_linux_update_xmltarget ();
+ }
+ 
+ /* This is initialized assuming an amd64 target.
+@@ -850,5 +1005,6 @@ struct linux_target_ops the_low_target =
+   x86_siginfo_fixup,
+   x86_linux_new_process,
+   x86_linux_new_thread,
+-  x86_linux_prepare_to_resume
++  x86_linux_prepare_to_resume,
++  x86_linux_process_qsupported 
+ };
+--- ./gdb/gdbserver/linux-xtensa-low.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/linux-xtensa-low.c	2010-04-03 21:12:32.000000000 +0200
+@@ -131,13 +131,13 @@ xtensa_store_xtregset (struct regcache *
+ }
+ 
+ struct regset_info target_regsets[] = {
+-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
++  { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
+     GENERAL_REGS,
+     xtensa_fill_gregset, xtensa_store_gregset },
+-  { PTRACE_GETXTREGS, PTRACE_SETXTREGS, XTENSA_ELF_XTREG_SIZE,
++  { PTRACE_GETXTREGS, PTRACE_SETXTREGS, 0, XTENSA_ELF_XTREG_SIZE,
+     EXTENDED_REGS,
+     xtensa_fill_xtregset, xtensa_store_xtregset },
+-  { 0, 0, -1, -1, NULL, NULL }
++  { 0, 0, 0, -1, -1, NULL, NULL }
+ };
+ 
+ #if XCHAL_HAVE_BE
+--- ./gdb/gdbserver/server.c	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/server.c	2010-04-03 21:12:32.000000000 +0200
+@@ -1236,6 +1236,9 @@ handle_query (char *own_buf, int packet_
+     {
+       char *p = &own_buf[10];
+ 
++      /* Start processing qSupported packet.  */
++      target_process_qsupported (NULL);
++
+       /* Process each feature being provided by GDB.  The first
+ 	 feature will follow a ':', and latter features will follow
+ 	 ';'.  */
+@@ -1251,6 +1254,8 @@ handle_query (char *own_buf, int packet_
+ 		if (target_supports_multi_process ())
+ 		  multi_process = 1;
+ 	      }
++	    else
++	      target_process_qsupported (p);
+ 	  }
+ 
+       sprintf (own_buf, "PacketSize=%x;QPassSignals+", PBUFSIZ - 1);
+--- ./gdb/gdbserver/target.h	2010-01-20 23:55:38.000000000 +0100
++++ ./gdb/gdbserver/target.h	2010-04-03 21:12:32.000000000 +0200
+@@ -286,6 +286,9 @@ struct target_ops
+ 
+   /* Returns the core given a thread, or -1 if not known.  */
+   int (*core_of_thread) (ptid_t);
++
++  /* Target specific qSupported support.  */
++  void (*process_qsupported) (const char *);
+ };
+ 
+ extern struct target_ops *the_target;
+@@ -326,6 +329,10 @@ void set_target_ops (struct target_ops *
+   (the_target->supports_multi_process ? \
+    (*the_target->supports_multi_process) () : 0)
+ 
++#define target_process_qsupported(query) \
++  if (the_target->process_qsupported) \
++    the_target->process_qsupported (query)
++
+ /* Start non-stop mode, returns 0 on success, -1 on failure.   */
+ 
+ int start_non_stop (int nonstop);
+--- ./gdb/i386-linux-nat.c	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/i386-linux-nat.c	2010-04-03 21:12:32.000000000 +0200
+@@ -23,11 +23,14 @@
+ #include "inferior.h"
+ #include "gdbcore.h"
+ #include "regcache.h"
++#include "regset.h"
+ #include "target.h"
+ #include "linux-nat.h"
+ 
+ #include "gdb_assert.h"
+ #include "gdb_string.h"
++#include "elf/common.h"
++#include <sys/uio.h>
+ #include <sys/ptrace.h>
+ #include <sys/user.h>
+ #include <sys/procfs.h>
+@@ -69,6 +72,19 @@
+ 
+ /* Defines ps_err_e, struct ps_prochandle.  */
+ #include "gdb_proc_service.h"
++
++#include "i386-xstate.h"
++
++#ifndef PTRACE_GETREGSET
++#define PTRACE_GETREGSET	0x4204
++#endif
++
++#ifndef PTRACE_SETREGSET
++#define PTRACE_SETREGSET	0x4205
++#endif
++
++/* Does the current host support PTRACE_GETREGSET?  */
++static int have_ptrace_getregset = -1;
+ \f
+ 
+ /* The register sets used in GNU/Linux ELF core-dumps are identical to
+@@ -98,6 +114,8 @@ static int regmap[] = 
+   -1, -1, -1, -1,		/* xmm0, xmm1, xmm2, xmm3 */
+   -1, -1, -1, -1,		/* xmm4, xmm5, xmm6, xmm6 */
+   -1,				/* mxcsr */
++  -1, -1, -1, -1,		/* ymm0h, ymm1h, ymm2h, ymm3h */
++  -1, -1, -1, -1,		/* ymm4h, ymm5h, ymm6h, ymm6h */
+   ORIG_EAX
+ };
+ 
+@@ -110,6 +128,9 @@ static int regmap[] = 
+ #define GETFPXREGS_SUPPLIES(regno) \
+   (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS)
+ 
++#define GETXSTATEREGS_SUPPLIES(regno) \
++  (I386_ST0_REGNUM <= (regno) && (regno) < I386_AVX_NUM_REGS)
++
+ /* Does the current host support the GETREGS request?  */
+ int have_ptrace_getregs =
+ #ifdef HAVE_PTRACE_GETREGS
+@@ -355,6 +376,57 @@ static void store_fpregs (const struct r
+ 
+ /* Transfering floating-point and SSE registers to and from GDB.  */
+ 
++/* Fetch all registers covered by the PTRACE_GETREGSET request from
++   process/thread TID and store their values in GDB's register array.
++   Return non-zero if successful, zero otherwise.  */
++
++static int
++fetch_xstateregs (struct regcache *regcache, int tid)
++{
++  char xstateregs[I386_XSTATE_MAX_SIZE];
++  struct iovec iov;
++
++  if (!have_ptrace_getregset)
++    return 0;
++
++  iov.iov_base = xstateregs;
++  iov.iov_len = sizeof(xstateregs);
++  if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
++	      &iov) < 0)
++    perror_with_name (_("Couldn't read extended state status"));
++
++  i387_supply_xsave (regcache, -1, xstateregs);
++  return 1;
++}
++
++/* Store all valid registers in GDB's register array covered by the
++   PTRACE_SETREGSET request into the process/thread specified by TID.
++   Return non-zero if successful, zero otherwise.  */
++
++static int
++store_xstateregs (const struct regcache *regcache, int tid, int regno)
++{
++  char xstateregs[I386_XSTATE_MAX_SIZE];
++  struct iovec iov;
++
++  if (!have_ptrace_getregset)
++    return 0;
++  
++  iov.iov_base = xstateregs;
++  iov.iov_len = sizeof(xstateregs);
++  if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
++	      &iov) < 0)
++    perror_with_name (_("Couldn't read extended state status"));
++
++  i387_collect_xsave (regcache, regno, xstateregs, 0);
++
++  if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE,
++	      (int) &iov) < 0)
++    perror_with_name (_("Couldn't write extended state status"));
++
++  return 1;
++}
++
+ #ifdef HAVE_PTRACE_GETFPXREGS
+ 
+ /* Fill GDB's register array with the floating-point and SSE register
+@@ -489,6 +561,8 @@ i386_linux_fetch_inferior_registers (str
+ 	  return;
+ 	}
+ 
++      if (fetch_xstateregs (regcache, tid))
++	return;
+       if (fetch_fpxregs (regcache, tid))
+ 	return;
+       fetch_fpregs (regcache, tid);
+@@ -501,6 +575,12 @@ i386_linux_fetch_inferior_registers (str
+       return;
+     }
+ 
++  if (GETXSTATEREGS_SUPPLIES (regno))
++    {
++      if (fetch_xstateregs (regcache, tid))
++	return;
++    }
++
+   if (GETFPXREGS_SUPPLIES (regno))
+     {
+       if (fetch_fpxregs (regcache, tid))
+@@ -553,6 +633,8 @@ i386_linux_store_inferior_registers (str
+   if (regno == -1)
+     {
+       store_regs (regcache, tid, regno);
++      if (store_xstateregs (regcache, tid, regno))
++	return;
+       if (store_fpxregs (regcache, tid, regno))
+ 	return;
+       store_fpregs (regcache, tid, regno);
+@@ -565,6 +647,12 @@ i386_linux_store_inferior_registers (str
+       return;
+     }
+ 
++  if (GETXSTATEREGS_SUPPLIES (regno))
++    {
++      if (store_xstateregs (regcache, tid, regno))
++	return;
++    }
++
+   if (GETFPXREGS_SUPPLIES (regno))
+     {
+       if (store_fpxregs (regcache, tid, regno))
+@@ -873,7 +961,50 @@ i386_linux_child_post_startup_inferior (
+ static const struct target_desc *
+ i386_linux_read_description (struct target_ops *ops)
+ {
+-  return tdesc_i386_linux;
++  static uint64_t xcr0;
++
++  if (have_ptrace_getregset == -1)
++    {
++      int tid;
++      uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))];
++      struct iovec iov;
++      unsigned int xstate_size;
++
++      /* GNU/Linux LWP ID's are process ID's.  */
++      tid = TIDGET (inferior_ptid);
++      if (tid == 0)
++	tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
++
++      iov.iov_base = xstateregs;
++      iov.iov_len = sizeof (xstateregs);
++
++      /* Check if PTRACE_GETREGSET works.  */
++      if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
++		  &iov) < 0)
++	{
++	  have_ptrace_getregset = 0;
++	  xstate_size = 0;
++	}
++      else
++	{
++	  have_ptrace_getregset = 1;
++
++	  /* Get XCR0 from XSAVE extended state.  */
++	  xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
++			     / sizeof (long long))];
++
++	  xstate_size = I386_XSTATE_SIZE (xcr0);
++	}
++
++      i386_linux_update_xstateregset (xstate_size);
++    }
++
++  /* Check the native XCR0 only if PTRACE_GETREGSET is available.  */
++  if (have_ptrace_getregset
++      && (xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
++    return tdesc_i386_avx_linux;
++  else
++    return tdesc_i386_linux;
+ }
+ 
+ void
+--- ./gdb/i386-linux-tdep.c	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/i386-linux-tdep.c	2010-04-03 21:12:32.000000000 +0200
+@@ -23,6 +23,7 @@
+ #include "frame.h"
+ #include "value.h"
+ #include "regcache.h"
++#include "regset.h"
+ #include "inferior.h"
+ #include "osabi.h"
+ #include "reggroups.h"
+@@ -36,9 +37,11 @@
+ #include "solib-svr4.h"
+ #include "symtab.h"
+ #include "arch-utils.h"
+-#include "regset.h"
+ #include "xml-syscall.h"
+ 
++#include "i387-tdep.h"
++#include "i386-xstate.h"
++
+ /* The syscall's XML filename for i386.  */
+ #define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml"
+ 
+@@ -47,6 +50,7 @@
+ #include <stdint.h>
+ 
+ #include "features/i386/i386-linux.c"
++#include "features/i386/i386-avx-linux.c"
+ 
+ /* Supported register note sections.  */
+ static struct core_regset_section i386_linux_regset_sections[] =
+@@ -54,6 +58,7 @@ static struct core_regset_section i386_l
+   { ".reg", 144, "general-purpose" },
+   { ".reg2", 108, "floating-point" },
+   { ".reg-xfp", 512, "extended floating-point" },
++  { ".reg-xstate", 0, "XSAVE extended state" },
+   { NULL, 0 }
+ };
+ 
+@@ -533,6 +538,7 @@ static int i386_linux_gregset_reg_offset
+   -1, -1, -1, -1, -1, -1, -1, -1,
+   -1, -1, -1, -1, -1, -1, -1, -1,
+   -1,
++  -1, -1, -1, -1, -1, -1, -1, -1,
+   11 * 4			/* "orig_eax" */
+ };
+ 
+@@ -560,6 +566,59 @@ static int i386_linux_sc_reg_offset[] =
+   0 * 4				/* %gs */
+ };
+ 
++/* Update XSAVE extended state register note section.  */
++
++void
++i386_linux_update_xstateregset (unsigned int xstate_size)
++{
++  struct core_regset_section *xstate = &i386_linux_regset_sections[3];
++
++  /* Update the XSAVE extended state register note section for "gcore".
++     Disable it if its size is 0.  */
++  gdb_assert (strcmp (xstate->sect_name, ".reg-xstate") == 0);
++  if (xstate_size)
++    xstate->size = xstate_size;
++  else
++    xstate->sect_name = NULL;
++}
++
++/* Get XSAVE extended state xcr0 from core dump.  */
++
++uint64_t
++i386_linux_core_read_xcr0 (struct gdbarch *gdbarch,
++			   struct target_ops *target, bfd *abfd)
++{
++  asection *xstate = bfd_get_section_by_name (abfd, ".reg-xstate");
++  uint64_t xcr0;
++
++  if (xstate)
++    {
++      size_t size = bfd_section_size (abfd, xstate);
++
++      /* Check extended state size.  */
++      if (size < I386_XSTATE_AVX_SIZE)
++	xcr0 = I386_XSTATE_SSE_MASK;
++      else
++	{
++	  char contents[8];
++
++	  if (! bfd_get_section_contents (abfd, xstate, contents,
++					  I386_LINUX_XSAVE_XCR0_OFFSET,
++					  8))
++	    {
++	      warning (_("Couldn't read `xcr0' bytes from `.reg-xstate' section in core file."));
++	      return 0;
++	    }
++
++	  xcr0 = bfd_get_64 (abfd, contents);
++	}
++    }
++  else
++    xcr0 = I386_XSTATE_SSE_MASK;
++
++  return xcr0;
++}
++
+ /* Get Linux/x86 target description from core dump.  */
+ 
+ static const struct target_desc *
+@@ -568,12 +627,17 @@ i386_linux_core_read_description (struct
+ 				  bfd *abfd)
+ {
+   asection *section = bfd_get_section_by_name (abfd, ".reg2");
++  uint64_t xcr0;
+ 
+   if (section == NULL)
+     return NULL;
+ 
+   /* Linux/i386.  */
+-  return tdesc_i386_linux;
++  xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd);
++  if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
++    return tdesc_i386_avx_linux;
++  else
++    return tdesc_i386_linux;
+ }
+ 
+ static void
+@@ -623,6 +687,8 @@ i386_linux_init_abi (struct gdbarch_info
+   tdep->sc_reg_offset = i386_linux_sc_reg_offset;
+   tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset);
+ 
++  tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
++
+   set_gdbarch_process_record (gdbarch, i386_process_record);
+   set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal);
+ 
+@@ -843,4 +909,5 @@ _initialize_i386_linux_tdep (void)
+ 
+   /* Initialize the Linux target description  */
+   initialize_tdesc_i386_linux ();
++  initialize_tdesc_i386_avx_linux ();
+ }
+--- ./gdb/i386-linux-tdep.h	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/i386-linux-tdep.h	2010-04-03 21:12:32.000000000 +0200
+@@ -30,12 +30,41 @@
+ /* Register number for the "orig_eax" pseudo-register.  If this
+    pseudo-register contains a value >= 0 it is interpreted as the
+    system call number that the kernel is supposed to restart.  */
+-#define I386_LINUX_ORIG_EAX_REGNUM I386_SSE_NUM_REGS
++#define I386_LINUX_ORIG_EAX_REGNUM I386_AVX_NUM_REGS
+ 
+ /* Total number of registers for GNU/Linux.  */
+ #define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1)
+ 
++/* Get XSAVE extended state xcr0 from core dump.  */
++extern uint64_t i386_linux_core_read_xcr0
++  (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
++
+ /* Linux target description.  */
+ extern struct target_desc *tdesc_i386_linux;
++extern struct target_desc *tdesc_i386_avx_linux;
++
++/* Update XSAVE extended state register note section.  */
++extern void i386_linux_update_xstateregset (unsigned int xstate_size);
++
++/* Format of XSAVE extended state is:
++ 	struct
++	{
++	  fxsave_bytes[0..463]
++	  sw_usable_bytes[464..511]
++	  xstate_hdr_bytes[512..575]
++	  avx_bytes[576..831]
++	  future_state etc
++	};
++
++  Same memory layout will be used for the coredump NT_X86_XSTATE
++  representing the XSAVE extended state registers.
++
++  The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled
++  extended state mask, which is the same as the extended control register
++  0 (the XFEATURE_ENABLED_MASK register), XCR0.  We can use this mask
++  together with the mask saved in the xstate_hdr_bytes to determine what
++  states the processor/OS supports and what state, used or initialized,
++  the process/thread is in.  */ 
++#define I386_LINUX_XSAVE_XCR0_OFFSET 464
+ 
+ #endif /* i386-linux-tdep.h */
+--- ./gdb/i386-tdep.c	2010-04-03 21:09:29.000000000 +0200
++++ ./gdb/i386-tdep.c	2010-04-03 21:12:32.000000000 +0200
+@@ -51,11 +51,13 @@
+ 
+ #include "i386-tdep.h"
+ #include "i387-tdep.h"
++#include "i386-xstate.h"
+ 
+ #include "record.h"
+ #include <stdint.h>
+ 
+ #include "features/i386/i386.c"
++#include "features/i386/i386-avx.c"
+ 
+ /* Register names.  */
+ 
+@@ -74,6 +76,18 @@ static const char *i386_register_names[]
+   "mxcsr"
+ };
+ 
++static const char *i386_ymm_names[] =
++{
++  "ymm0",  "ymm1",   "ymm2",  "ymm3",
++  "ymm4",  "ymm5",   "ymm6",  "ymm7",
++};
++
++static const char *i386_ymmh_names[] =
++{
++  "ymm0h",  "ymm1h",   "ymm2h",  "ymm3h",
++  "ymm4h",  "ymm5h",   "ymm6h",  "ymm7h",
++};
++
+ /* Register names for MMX pseudo-registers.  */
+ 
+ static const char *i386_mmx_names[] =
+@@ -150,18 +164,47 @@ i386_dword_regnum_p (struct gdbarch *gdb
+   return regnum >= 0 && regnum < tdep->num_dword_regs;
+ }
+ 
++int
++i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum)
++{
++  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++  int ymm0h_regnum = tdep->ymm0h_regnum;
++
++  if (ymm0h_regnum < 0)
++    return 0;
++
++  regnum -= ymm0h_regnum;
++  return regnum >= 0 && regnum < tdep->num_ymm_regs;
++}
++
++/* AVX register?  */
++
++int
++i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum)
++{
++  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++  int ymm0_regnum = tdep->ymm0_regnum;
++
++  if (ymm0_regnum < 0)
++    return 0;
++
++  regnum -= ymm0_regnum;
++  return regnum >= 0 && regnum < tdep->num_ymm_regs;
++}
++
+ /* SSE register?  */
+ 
+-static int
+-i386_sse_regnum_p (struct gdbarch *gdbarch, int regnum)
++int
++i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum)
+ {
+   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++  int num_xmm_regs = I387_NUM_XMM_REGS (tdep);
+ 
+-  if (I387_NUM_XMM_REGS (tdep) == 0)
++  if (num_xmm_regs == 0)
+     return 0;
+ 
+-  return (I387_XMM0_REGNUM (tdep) <= regnum
+-	  && regnum < I387_MXCSR_REGNUM (tdep));
++  regnum -= I387_XMM0_REGNUM (tdep);
++  return regnum >= 0 && regnum < num_xmm_regs;
+ }
+ 
+ static int
+@@ -201,6 +244,19 @@ i386_fpc_regnum_p (struct gdbarch *gdbar
+ 	  && regnum < I387_XMM0_REGNUM (tdep));
+ }
+ 
++/* Return the name of register REGNUM, or the empty string if it is
++   an anonymous register.  */
++
++static const char *
++i386_register_name (struct gdbarch *gdbarch, int regnum)
++{
++  /* Hide the upper YMM registers.  */
++  if (i386_ymmh_regnum_p (gdbarch, regnum))
++    return "";
++
++  return tdesc_register_name (gdbarch, regnum);
++}
++
+ /* Return the name of register REGNUM.  */
+ 
+ const char *
+@@ -209,6 +265,8 @@ i386_pseudo_register_name (struct gdbarc
+   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_ymm_regnum_p (gdbarch, regnum))
++    return i386_ymm_names[regnum - tdep->ymm0_regnum];
+   else if (i386_byte_regnum_p (gdbarch, regnum))
+     return i386_byte_names[regnum - tdep->al_regnum];
+   else if (i386_word_regnum_p (gdbarch, regnum))
+@@ -246,7 +304,13 @@ i386_dbx_reg_to_regnum (struct gdbarch *
+   else if (reg >= 21 && reg <= 28)
+     {
+       /* SSE registers.  */
+-      return reg - 21 + I387_XMM0_REGNUM (tdep);
++      int ymm0_regnum = tdep->ymm0_regnum;
++
++      if (ymm0_regnum >= 0
++	  && i386_xmm_regnum_p (gdbarch, reg))
++	return reg - 21 + ymm0_regnum;
++      else
++	return reg - 21 + I387_XMM0_REGNUM (tdep);
+     }
+   else if (reg >= 29 && reg <= 36)
+     {
+@@ -2184,6 +2248,59 @@ i387_ext_type (struct gdbarch *gdbarch)
+   return tdep->i387_ext_type;
+ }
+ 
++/* Construct vector type for pseudo YMM registers.  We can't use
++   tdesc_find_type since YMM isn't described in target description.  */
++
++static struct type *
++i386_ymm_type (struct gdbarch *gdbarch)
++{
++  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++
++  if (!tdep->i386_ymm_type)
++    {
++      const struct builtin_type *bt = builtin_type (gdbarch);
++
++      /* The type we're building is this: */
++#if 0
++      union __gdb_builtin_type_vec256i
++      {
++        int128_t uint128[2];
++        int64_t v2_int64[4];
++        int32_t v4_int32[8];
++        int16_t v8_int16[16];
++        int8_t v16_int8[32];
++        double v2_double[4];
++        float v4_float[8];
++      };
++#endif
++
++      struct type *t;
++
++      t = arch_composite_type (gdbarch,
++			       "__gdb_builtin_type_vec256i", TYPE_CODE_UNION);
++      append_composite_type_field (t, "v8_float",
++				   init_vector_type (bt->builtin_float, 8));
++      append_composite_type_field (t, "v4_double",
++				   init_vector_type (bt->builtin_double, 4));
++      append_composite_type_field (t, "v32_int8",
++				   init_vector_type (bt->builtin_int8, 32));
++      append_composite_type_field (t, "v16_int16",
++				   init_vector_type (bt->builtin_int16, 16));
++      append_composite_type_field (t, "v8_int32",
++				   init_vector_type (bt->builtin_int32, 8));
++      append_composite_type_field (t, "v4_int64",
++				   init_vector_type (bt->builtin_int64, 4));
++      append_composite_type_field (t, "v2_int128",
++				   init_vector_type (bt->builtin_int128, 2));
++
++      TYPE_VECTOR (t) = 1;
++      TYPE_NAME (t) = "builtin_type_vec128i";
++      tdep->i386_ymm_type = t;
++    }
++
++  return tdep->i386_ymm_type;
++}
++
+ /* Construct vector type for MMX registers.  */
+ static struct type *
+ i386_mmx_type (struct gdbarch *gdbarch)
+@@ -2234,6 +2351,8 @@ i386_pseudo_register_type (struct gdbarc
+ {
+   if (i386_mmx_regnum_p (gdbarch, regnum))
+     return i386_mmx_type (gdbarch);
++  else if (i386_ymm_regnum_p (gdbarch, regnum))
++    return i386_ymm_type (gdbarch);
+   else
+     {
+       const struct builtin_type *bt = builtin_type (gdbarch);
+@@ -2285,7 +2404,22 @@ i386_pseudo_register_read (struct gdbarc
+     {
+       struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ 
+-      if (i386_word_regnum_p (gdbarch, regnum))
++      if (i386_ymm_regnum_p (gdbarch, regnum))
++	{
++	  regnum -= tdep->ymm0_regnum;
++
++	  /* Extract (always little endian).  Read lower 128bits. */
++	  regcache_raw_read (regcache,
++			     I387_XMM0_REGNUM (tdep) + regnum,
++			     raw_buf);
++	  memcpy (buf, raw_buf, 16);
++	  /* Read upper 128bits.  */
++	  regcache_raw_read (regcache,
++			     tdep->ymm0h_regnum + regnum,
++			     raw_buf);
++	  memcpy (buf + 16, raw_buf, 16);
++	}
++      else if (i386_word_regnum_p (gdbarch, regnum))
+ 	{
+ 	  int gpnum = regnum - tdep->ax_regnum;
+ 
+@@ -2334,7 +2468,20 @@ i386_pseudo_register_write (struct gdbar
+     {
+       struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ 
+-      if (i386_word_regnum_p (gdbarch, regnum))
++      if (i386_ymm_regnum_p (gdbarch, regnum))
++	{
++	  regnum -= tdep->ymm0_regnum;
++
++	  /* ... Write lower 128bits.  */
++	  regcache_raw_write (regcache,
++			     I387_XMM0_REGNUM (tdep) + regnum,
++			     buf);
++	  /* ... Write upper 128bits.  */
++	  regcache_raw_write (regcache,
++			     tdep->ymm0h_regnum + regnum,
++			     buf + 16);
++	}
++      else if (i386_word_regnum_p (gdbarch, regnum))
+ 	{
+ 	  int gpnum = regnum - tdep->ax_regnum;
+ 
+@@ -2581,6 +2728,28 @@ i386_collect_fpregset (const struct regs
+   i387_collect_fsave (regcache, regnum, fpregs);
+ }
+ 
++/* Similar to i386_supply_fpregset, but use XSAVE extended state.  */
++
++static void
++i386_supply_xstateregset (const struct regset *regset,
++			  struct regcache *regcache, int regnum,
++			  const void *xstateregs, size_t len)
++{
++  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++  i387_supply_xsave (regcache, regnum, xstateregs);
++}
++
++/* Similar to i386_collect_fpregset , but use XSAVE extended state.  */
++
++static void
++i386_collect_xstateregset (const struct regset *regset,
++			   const struct regcache *regcache,
++			   int regnum, void *xstateregs, size_t len)
++{
++  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
++  i387_collect_xsave (regcache, regnum, xstateregs, 1);
++}
++
+ /* Return the appropriate register set for the core section identified
+    by SECT_NAME and SECT_SIZE.  */
+ 
+@@ -2608,6 +2777,16 @@ i386_regset_from_core_section (struct gd
+       return tdep->fpregset;
+     }
+ 
++  if (strcmp (sect_name, ".reg-xstate") == 0)
++    {
++      if (tdep->xstateregset == NULL)
++	tdep->xstateregset = regset_alloc (gdbarch,
++					   i386_supply_xstateregset,
++					   i386_collect_xstateregset);
++
++      return tdep->xstateregset;
++    }
++
+   return NULL;
+ }
+ \f
+@@ -2801,46 +2980,60 @@ int
+ i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ 			  struct reggroup *group)
+ {
+-  int sse_regnum_p, fp_regnum_p, mmx_regnum_p, byte_regnum_p,
+-      word_regnum_p, dword_regnum_p;
++  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++  int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p,
++      ymm_regnum_p, ymmh_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)
++  if (i386_byte_regnum_p (gdbarch, regnum))
+     return 0;
+ 
+-  word_regnum_p = i386_word_regnum_p (gdbarch, regnum);
+-  if (word_regnum_p)
++  if (i386_word_regnum_p (gdbarch, regnum))
+     return 0;
+ 
+-  dword_regnum_p = i386_dword_regnum_p (gdbarch, regnum);
+-  if (dword_regnum_p)
++  if (i386_dword_regnum_p (gdbarch, regnum))
+     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));
++  xmm_regnum_p = i386_xmm_regnum_p (gdbarch, regnum);
++  mxcsr_regnum_p = i386_mxcsr_regnum_p (gdbarch, regnum);
+   if (group == i386_sse_reggroup)
+-    return sse_regnum_p;
++    return xmm_regnum_p || mxcsr_regnum_p;
++
++  ymm_regnum_p = i386_ymm_regnum_p (gdbarch, regnum);
+   if (group == vector_reggroup)
+-    return mmx_regnum_p || sse_regnum_p;
++    return (mmx_regnum_p
++	    || ymm_regnum_p
++	    || mxcsr_regnum_p
++	    || (xmm_regnum_p
++		&& ((tdep->xcr0 & I386_XSTATE_AVX_MASK)
++		    == I386_XSTATE_SSE_MASK)));
+ 
+   fp_regnum_p = (i386_fp_regnum_p (gdbarch, regnum)
+ 		 || i386_fpc_regnum_p (gdbarch, regnum));
+   if (group == float_reggroup)
+     return fp_regnum_p;
+ 
++  /* For "info reg all", don't include upper YMM registers nor XMM
++     registers when AVX is supported.  */
++  ymmh_regnum_p = i386_ymmh_regnum_p (gdbarch, regnum);
++  if (group == all_reggroup
++      && ((xmm_regnum_p
++	   && (tdep->xcr0 & I386_XSTATE_AVX))
++	  || ymmh_regnum_p))
++    return 0;
++
+   if (group == general_reggroup)
+     return (!fp_regnum_p
+ 	    && !mmx_regnum_p
+-	    && !sse_regnum_p
+-	    && !byte_regnum_p
+-	    && !word_regnum_p
+-	    && !dword_regnum_p);
++	    && !mxcsr_regnum_p
++	    && !xmm_regnum_p
++	    && !ymm_regnum_p
++	    && !ymmh_regnum_p);
+ 
+   return default_register_reggroup_p (gdbarch, regnum, group);
+ }
+@@ -5650,7 +5843,8 @@ i386_validate_tdesc_p (struct gdbarch_td
+ 		       struct tdesc_arch_data *tdesc_data)
+ {
+   const struct target_desc *tdesc = tdep->tdesc;
+-  const struct tdesc_feature *feature_core, *feature_vector;
++  const struct tdesc_feature *feature_core;
++  const struct tdesc_feature *feature_sse, *feature_avx;
+   int i, num_regs, valid_p;
+ 
+   if (! tdesc_has_registers (tdesc))
+@@ -5660,13 +5854,37 @@ i386_validate_tdesc_p (struct gdbarch_td
+   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");
++  feature_sse = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse");
+ 
+-  if (feature_core == NULL || feature_vector == NULL)
++  if (feature_core == NULL || feature_sse == NULL)
+     return 0;
+ 
++  /* Try AVX registers.  */
++  feature_avx = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx");
++
+   valid_p = 1;
+ 
++  /* The XCR0 bits.  */
++  if (feature_avx)
++    {
++      tdep->xcr0 = I386_XSTATE_AVX_MASK;
++
++      /* It may have been set by OSABI initialization function.  */
++      if (tdep->num_ymm_regs == 0)
++	{
++	  tdep->ymmh_register_names = i386_ymmh_names;
++	  tdep->num_ymm_regs = 8;
++	  tdep->ymm0h_regnum = I386_YMM0H_REGNUM;
++	}
++
++      for (i = 0; i < tdep->num_ymm_regs; i++)
++	valid_p &= tdesc_numbered_register (feature_avx, tdesc_data,
++					    tdep->ymm0h_regnum + i,
++					    tdep->ymmh_register_names[i]);
++    }
++  else
++    tdep->xcr0 = I386_XSTATE_SSE_MASK;
++
+   num_regs = tdep->num_core_regs;
+   for (i = 0; i < num_regs; i++)
+     valid_p &= tdesc_numbered_register (feature_core, tdesc_data, i,
+@@ -5675,7 +5893,7 @@ i386_validate_tdesc_p (struct gdbarch_td
+   /* 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,
++    valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i,
+ 					tdep->register_names[i]);
+ 
+   return valid_p;
+@@ -5690,6 +5908,7 @@ i386_gdbarch_init (struct gdbarch_info i
+   struct tdesc_arch_data *tdesc_data;
+   const struct target_desc *tdesc;
+   int mm0_regnum;
++  int ymm0_regnum;
+ 
+   /* If there is already a candidate, use it.  */
+   arches = gdbarch_list_lookup_by_info (arches, &info);
+@@ -5710,6 +5929,8 @@ i386_gdbarch_init (struct gdbarch_info i
+   tdep->fpregset = NULL;
+   tdep->sizeof_fpregset = I387_SIZEOF_FSAVE;
+ 
++  tdep->xstateregset = NULL;
++
+   /* The default settings include the FPU registers, the MMX registers
+      and the SSE registers.  This can be overridden for a specific ABI
+      by adjusting the members `st0_regnum', `mm0_regnum' and
+@@ -5742,6 +5963,8 @@ i386_gdbarch_init (struct gdbarch_info i
+   /* Unwinding stops on i386 automatically.  */
+   tdep->outermost_frame_p = NULL;
+ 
++  tdep->xsave_xcr0_offset = -1;
++
+   tdep->record_regmap = i386_record_regmap;
+ 
+   /* The format used for `long double' on almost all i386 targets is
+@@ -5858,9 +6081,14 @@ i386_gdbarch_init (struct gdbarch_info i
+   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);
++  /* Override the normal target description method to make the AVX
++     upper halves anonymous.  */
++  set_gdbarch_register_name (gdbarch, i386_register_name);
++
++  /* Even though the default ABI only includes general-purpose registers,
++     floating-point registers and the SSE registers, we have to leave a
++     gap for the upper AVX registers.  */
++  set_gdbarch_num_regs (gdbarch, I386_AVX_NUM_REGS);
+ 
+   /* Get the x86 target description from INFO.  */
+   tdesc = info.target_desc;
+@@ -5871,10 +6099,15 @@ i386_gdbarch_init (struct gdbarch_info i
+   tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS;
+   tdep->register_names = i386_register_names;
+ 
++  /* No upper YMM registers.  */
++  tdep->ymmh_register_names = NULL;
++  tdep->ymm0h_regnum = -1;
++
+   tdep->num_byte_regs = 8;
+   tdep->num_word_regs = 8;
+   tdep->num_dword_regs = 0;
+   tdep->num_mmx_regs = 8;
++  tdep->num_ymm_regs = 0;
+ 
+   tdesc_data = tdesc_data_alloc ();
+ 
+@@ -5882,24 +6115,25 @@ i386_gdbarch_init (struct gdbarch_info i
+   info.tdep_info = (void *) tdesc_data;
+   gdbarch_init_osabi (info, gdbarch);
+ 
++  if (!i386_validate_tdesc_p (tdep, tdesc_data))
++    {
++      tdesc_data_cleanup (tdesc_data);
++      xfree (tdep);
++      gdbarch_free (gdbarch);
++      return NULL;
++    }
++
+   /* 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));
++					 + tdep->num_mmx_regs
++					 + tdep->num_ymm_regs));
+ 
+   /* 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.  */
+@@ -5909,16 +6143,26 @@ i386_gdbarch_init (struct gdbarch_info i
+   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;
++  ymm0_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;
++      tdep->eax_regnum = ymm0_regnum;
++      ymm0_regnum += tdep->num_dword_regs;
+     }
+   else
+     tdep->eax_regnum = -1;
+ 
++  mm0_regnum = ymm0_regnum;
++  if (tdep->num_ymm_regs)
++    {
++      /* Support YMM pseudo-registesr if it is available,  */
++      tdep->ymm0_regnum = ymm0_regnum;
++      mm0_regnum += tdep->num_ymm_regs;
++    }
++  else
++    tdep->ymm0_regnum = -1;
++
+   if (tdep->num_mmx_regs != 0)
+     {
+       /* Support MMX pseudo-registesr if MMX hasn't been disabled,  */
+@@ -6001,6 +6245,7 @@ is \"default\"."),
+ 
+   /* Initialize the standard target descriptions.  */
+   initialize_tdesc_i386 ();
++  initialize_tdesc_i386_avx ();
+ 
+   /* Tell remote stub that we support XML target description.  */
+   register_remote_support_xml ("i386");
+--- ./gdb/i386-tdep.h	2010-04-03 21:06:52.000000000 +0200
++++ ./gdb/i386-tdep.h	2010-04-03 21:12:32.000000000 +0200
+@@ -109,6 +109,9 @@ struct gdbarch_tdep
+   struct regset *fpregset;
+   size_t sizeof_fpregset;
+ 
++  /* XSAVE extended state.  */
++  struct regset *xstateregset;
++
+   /* Register number for %st(0).  The register numbers for the other
+      registers follow from this one.  Set this to -1 to indicate the
+      absence of an FPU.  */
+@@ -121,6 +124,13 @@ struct gdbarch_tdep
+      of MMX support.  */
+   int mm0_regnum;
+ 
++  /* Number of pseudo YMM registers.  */
++  int num_ymm_regs;
++
++  /* Register number for %ymm0.  Set this to -1 to indicate the absence
++     of pseudo YMM register support.  */
++  int ymm0_regnum;
++
+   /* Number of byte registers.  */
+   int num_byte_regs;
+ 
+@@ -146,9 +156,24 @@ struct gdbarch_tdep
+   /* Number of SSE registers.  */
+   int num_xmm_regs;
+ 
++  /* Bits of the extended control register 0 (the XFEATURE_ENABLED_MASK
++     register), excluding the x87 bit, which are supported by this GDB.
++   */
++  uint64_t xcr0;
++
++  /* Offset of XCR0 in XSAVE extended state.  */
++  int xsave_xcr0_offset;
++
+   /* Register names.  */
+   const char **register_names;
+ 
++  /* Register number for %ymm0h.  Set this to -1 to indicate the absence
++     of upper YMM register support.  */
++  int ymm0h_regnum;
++
++  /* Upper YMM register names.  Only used for tdesc_numbered_register.  */
++  const char **ymmh_register_names;
++
+   /* Target description.  */
+   const struct target_desc *tdesc;
+ 
+@@ -182,6 +207,7 @@ struct gdbarch_tdep
+ 
+   /* ISA-specific data types.  */
+   struct type *i386_mmx_type;
++  struct type *i386_ymm_type;
+   struct type *i387_ext_type;
+ 
+   /* Process record/replay target.  */
+@@ -231,7 +257,9 @@ enum i386_regnum
+   I386_FS_REGNUM,		/* %fs */
+   I386_GS_REGNUM,		/* %gs */
+   I386_ST0_REGNUM,		/* %st(0) */
+-  I386_MXCSR_REGNUM = 40	/* %mxcsr */ 
++  I386_MXCSR_REGNUM = 40,	/* %mxcsr */ 
++  I386_YMM0H_REGNUM,		/* %ymm0h */
++  I386_YMM7H_REGNUM = I386_YMM0H_REGNUM + 7
+ };
+ 
+ /* Register numbers of RECORD_REGMAP.  */
+@@ -268,6 +296,7 @@ enum record_i386_regnum
+ #define I386_NUM_XREGS  9
+ 
+ #define I386_SSE_NUM_REGS	(I386_MXCSR_REGNUM + 1)
++#define I386_AVX_NUM_REGS	(I386_YMM7H_REGNUM + 1)
+ 
+ /* Size of the largest register.  */
+ #define I386_MAX_REGISTER_SIZE	16
+@@ -279,6 +308,9 @@ extern struct type *i387_ext_type (struc
+ 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 int i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum);
++extern int i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum);
++extern int i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum);
+ 
+ extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch,
+ 					      int regnum);
+--- ./gdb/i387-tdep.c	2010-01-01 08:31:36.000000000 +0100
++++ ./gdb/i387-tdep.c	2010-04-03 21:12:32.000000000 +0200
+@@ -34,6 +34,7 @@
+ 
+ #include "i386-tdep.h"
+ #include "i387-tdep.h"
++#include "i386-xstate.h"
+ 
+ /* Print the floating point number specified by RAW.  */
+ 
+@@ -677,6 +678,518 @@ i387_collect_fxsave (const struct regcac
+ 			  FXSAVE_MXCSR_ADDR (regs));
+ }
+ 
++/* `xstate_bv' is at byte offset 512.  */
++#define XSAVE_XSTATE_BV_ADDR(xsave) (xsave + 512)
++
++/* At xsave_avxh_offset[REGNUM] you'll find the offset to the location in
++   the upper 128bit of AVX register data structure used by the "xsave"
++   instruction where GDB register REGNUM is stored.  */
++
++static int xsave_avxh_offset[] =
++{
++  576 + 0 * 16,		/* Upper 128bit of %ymm0 through ...  */
++  576 + 1 * 16,
++  576 + 2 * 16,
++  576 + 3 * 16,
++  576 + 4 * 16,
++  576 + 5 * 16,
++  576 + 6 * 16,
++  576 + 7 * 16,
++  576 + 8 * 16,
++  576 + 9 * 16,
++  576 + 10 * 16,
++  576 + 11 * 16,
++  576 + 12 * 16,
++  576 + 13 * 16,
++  576 + 14 * 16,
++  576 + 15 * 16		/* Upper 128bit of ... %ymm15 (128 bits each).  */
++};
++
++#define XSAVE_AVXH_ADDR(tdep, xsave, regnum) \
++  (xsave + xsave_avxh_offset[regnum - I387_YMM0H_REGNUM (tdep)])
++
++/* Similar to i387_supply_fxsave, but use XSAVE extended state.  */
++
++void
++i387_supply_xsave (struct regcache *regcache, int regnum,
++		   const void *xsave)
++{
++  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
++  const gdb_byte *regs = xsave;
++  int i;
++  unsigned int clear_bv;
++  const gdb_byte *p;
++  enum
++    {
++      none = 0x0,
++      x87 = 0x1,
++      sse = 0x2,
++      avxh = 0x4,
++      all = x87 | sse | avxh
++    } regclass;
++
++  gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
++  gdb_assert (tdep->num_xmm_regs > 0);
++
++  if (regnum == -1)
++    regclass = all;
++  else if (regnum >= I387_YMM0H_REGNUM (tdep)
++	   && regnum < I387_YMMENDH_REGNUM (tdep))
++    regclass = avxh;
++  else if (regnum >= I387_XMM0_REGNUM(tdep)
++	   && regnum < I387_MXCSR_REGNUM (tdep))
++    regclass = sse;
++  else if (regnum >= I387_ST0_REGNUM (tdep)
++	   && regnum < I387_FCTRL_REGNUM (tdep))
++    regclass = x87;
++  else
++    regclass = none;
++
++  if (regs != NULL && regclass != none)
++    {
++      /* Get `xstat_bv'.  */
++      const gdb_byte *xstate_bv_p = XSAVE_XSTATE_BV_ADDR (regs);
++
++      /* The supported bits in `xstat_bv' are 1 byte.  Clear part in
++	 vector registers if its bit in xstat_bv is zero.  */
++      clear_bv = (~(*xstate_bv_p)) & tdep->xcr0;
++    }
++  else
++    clear_bv = I386_XSTATE_AVX_MASK;
++
++  switch (regclass)
++    {
++    case none:
++      break;
++
++    case avxh:
++      if ((clear_bv & I386_XSTATE_AVX))
++	p = NULL;
++      else
++	p = XSAVE_AVXH_ADDR (tdep, regs, regnum);
++      regcache_raw_supply (regcache, regnum, p);
++      return;
++
++    case sse:
++      if ((clear_bv & I386_XSTATE_SSE))
++	p = NULL;
++      else
++	p = FXSAVE_ADDR (tdep, regs, regnum);
++      regcache_raw_supply (regcache, regnum, p);
++      return;
++
++    case x87:
++      if ((clear_bv & I386_XSTATE_X87))
++	p = NULL;
++      else
++	p = FXSAVE_ADDR (tdep, regs, regnum);
++      regcache_raw_supply (regcache, regnum, p);
++      return;
++
++    case all:
++      /* Hanle the upper YMM registers.  */
++      if ((tdep->xcr0 & I386_XSTATE_AVX))
++	{
++	  if ((clear_bv & I386_XSTATE_AVX))
++	    p = NULL;
++	  else
++	    p = regs;
++
++	  for (i = I387_YMM0H_REGNUM (tdep);
++	       i < I387_YMMENDH_REGNUM (tdep); i++)
++	    {
++	      if (p != NULL)
++		p = XSAVE_AVXH_ADDR (tdep, regs, i);
++	      regcache_raw_supply (regcache, i, p);
++	    }
++	}
++
++      /* Handle the XMM registers.  */
++      if ((tdep->xcr0 & I386_XSTATE_SSE))
++	{
++	  if ((clear_bv & I386_XSTATE_SSE))
++	    p = NULL;
++	  else
++	    p = regs;
++
++	  for (i = I387_XMM0_REGNUM (tdep);
++	       i < I387_MXCSR_REGNUM (tdep); i++)
++	    {
++	      if (p != NULL)
++		p = FXSAVE_ADDR (tdep, regs, i);
++	      regcache_raw_supply (regcache, i, p);
++	    }
++	}
++
++      /* Handle the x87 registers.  */
++      if ((tdep->xcr0 & I386_XSTATE_X87))
++	{
++	  if ((clear_bv & I386_XSTATE_X87))
++	    p = NULL;
++	  else
++	    p = regs;
++
++	  for (i = I387_ST0_REGNUM (tdep);
++	       i < I387_FCTRL_REGNUM (tdep); i++)
++	    {
++	      if (p != NULL)
++		p = FXSAVE_ADDR (tdep, regs, i);
++	      regcache_raw_supply (regcache, i, p);
++	    }
++	}
++      break;
++    }
++
++  /* Only handle x87 control registers.  */
++  for (i = I387_FCTRL_REGNUM (tdep); i < I387_XMM0_REGNUM (tdep); i++)
++    if (regnum == -1 || regnum == i)
++      {
++	if (regs == NULL)
++	  {
++	    regcache_raw_supply (regcache, i, NULL);
++	    continue;
++	  }
++
++	/* Most of the FPU control registers occupy only 16 bits in
++	   the xsave extended state.  Give those a special treatment.  */
++	if (i != I387_FIOFF_REGNUM (tdep)
++	    && i != I387_FOOFF_REGNUM (tdep))
++	  {
++	    gdb_byte val[4];
++
++	    memcpy (val, FXSAVE_ADDR (tdep, regs, i), 2);
++	    val[2] = val[3] = 0;
++	    if (i == I387_FOP_REGNUM (tdep))
++	      val[1] &= ((1 << 3) - 1);
++	    else if (i== I387_FTAG_REGNUM (tdep))
++	      {
++		/* The fxsave area contains a simplified version of
++		   the tag word.  We have to look at the actual 80-bit
++		   FP data to recreate the traditional i387 tag word.  */
++
++		unsigned long ftag = 0;
++		int fpreg;
++		int top;
++
++		top = ((FXSAVE_ADDR (tdep, regs,
++				     I387_FSTAT_REGNUM (tdep)))[1] >> 3);
++		top &= 0x7;
++
++		for (fpreg = 7; fpreg >= 0; fpreg--)
++		  {
++		    int tag;
++
++		    if (val[0] & (1 << fpreg))
++		      {
++			int regnum = (fpreg + 8 - top) % 8 
++				       + I387_ST0_REGNUM (tdep);
++			tag = i387_tag (FXSAVE_ADDR (tdep, regs, regnum));
++		      }
++		    else
++		      tag = 3;		/* Empty */
++
++		    ftag |= tag << (2 * fpreg);
++		  }
++		val[0] = ftag & 0xff;
++		val[1] = (ftag >> 8) & 0xff;
++	      }
++	    regcache_raw_supply (regcache, i, val);
++	  }
++	else 
++	  regcache_raw_supply (regcache, i, FXSAVE_ADDR (tdep, regs, i));
++      }
++
++  if (regnum == I387_MXCSR_REGNUM (tdep) || regnum == -1)
++    {
++      p = regs == NULL ? NULL : FXSAVE_MXCSR_ADDR (regs);
++      regcache_raw_supply (regcache, I387_MXCSR_REGNUM (tdep), p);
++    }
++}
++
++/* Similar to i387_collect_fxsave, but use XSAVE extended state.  */
++
++void
++i387_collect_xsave (const struct regcache *regcache, int regnum,
++		    void *xsave, int gcore)
++{
++  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
++  gdb_byte *regs = xsave;
++  int i;
++  enum
++    {
++      none = 0x0,
++      check = 0x1,
++      x87 = 0x2 | check,
++      sse = 0x4 | check,
++      avxh = 0x8 | check,
++      all = x87 | sse | avxh
++    } regclass;
++
++  gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
++  gdb_assert (tdep->num_xmm_regs > 0);
++
++  if (regnum == -1)
++    regclass = all;
++  else if (regnum >= I387_YMM0H_REGNUM (tdep)
++	   && regnum < I387_YMMENDH_REGNUM (tdep))
++    regclass = avxh;
++  else if (regnum >= I387_XMM0_REGNUM(tdep)
++	   && regnum < I387_MXCSR_REGNUM (tdep))
++    regclass = sse;
++  else if (regnum >= I387_ST0_REGNUM (tdep)
++	   && regnum < I387_FCTRL_REGNUM (tdep))
++    regclass = x87;
++  else
++    regclass = none;
++
++  if (gcore)
++    {
++      /* Update XCR0 and `xstate_bv' with XCR0 for gcore.  */
++      if (tdep->xsave_xcr0_offset != -1)
++	memcpy (regs + tdep->xsave_xcr0_offset, &tdep->xcr0, 8);
++      memcpy (XSAVE_XSTATE_BV_ADDR (regs), &tdep->xcr0, 8);
++
++      switch (regclass)
++	{
++	default:
++	  abort ();
++
++	case all:
++	  /* Handle the upper YMM registers.  */
++	  if ((tdep->xcr0 & I386_XSTATE_AVX))
++	    for (i = I387_YMM0H_REGNUM (tdep);
++		 i < I387_YMMENDH_REGNUM (tdep); i++)
++	      regcache_raw_collect (regcache, i,
++				    XSAVE_AVXH_ADDR (tdep, regs, i));
++
++	  /* Handle the XMM registers.  */
++	  if ((tdep->xcr0 & I386_XSTATE_SSE))
++	    for (i = I387_XMM0_REGNUM (tdep);
++		 i < I387_MXCSR_REGNUM (tdep); i++)
++	      regcache_raw_collect (regcache, i,
++				    FXSAVE_ADDR (tdep, regs, i));
++
++	  /* Handle the x87 registers.  */
++	  if ((tdep->xcr0 & I386_XSTATE_X87))
++	    for (i = I387_ST0_REGNUM (tdep);
++		 i < I387_FCTRL_REGNUM (tdep); i++)
++	      regcache_raw_collect (regcache, i,
++				    FXSAVE_ADDR (tdep, regs, i));
++	  break;
++
++	case x87:
++	  regcache_raw_collect (regcache, regnum,
++				FXSAVE_ADDR (tdep, regs, regnum));
++	  return;
++
++	case sse:
++	  regcache_raw_collect (regcache, regnum,
++				FXSAVE_ADDR (tdep, regs, regnum));
++	  return;
++
++	case avxh:
++	  regcache_raw_collect (regcache, regnum,
++				XSAVE_AVXH_ADDR (tdep, regs, regnum));
++	  return;
++	}
++    }
++  else
++    {
++      if ((regclass & check))
++	{
++	  gdb_byte raw[I386_MAX_REGISTER_SIZE];
++	  gdb_byte *xstate_bv_p = XSAVE_XSTATE_BV_ADDR (regs);
++	  unsigned int xstate_bv = 0;
++	  /* The supported bits in `xstat_bv' are 1 byte. */
++	  unsigned int clear_bv = (~(*xstate_bv_p)) & tdep->xcr0;
++	  gdb_byte *p;
++
++	  /* Clear register set if its bit in xstat_bv is zero.  */
++	  if (clear_bv)
++	    {
++	      if ((clear_bv & I386_XSTATE_AVX))
++		for (i = I387_YMM0H_REGNUM (tdep);
++		     i < I387_YMMENDH_REGNUM (tdep); i++)
++		  memset (XSAVE_AVXH_ADDR (tdep, regs, i), 0, 16);
++
++	      if ((clear_bv & I386_XSTATE_SSE))
++		for (i = I387_XMM0_REGNUM (tdep);
++		     i < I387_MXCSR_REGNUM (tdep); i++)
++		  memset (FXSAVE_ADDR (tdep, regs, i), 0, 16);
++
++	      if ((clear_bv & I386_XSTATE_X87))
++		for (i = I387_ST0_REGNUM (tdep);
++		     i < I387_FCTRL_REGNUM (tdep); i++)
++		  memset (FXSAVE_ADDR (tdep, regs, i), 0, 10);
++	    }
++
++	  if (regclass == all)
++	    {
++	      /* Check if any upper YMM registers are changed.  */
++	      if ((tdep->xcr0 & I386_XSTATE_AVX))
++		for (i = I387_YMM0H_REGNUM (tdep);
++		     i < I387_YMMENDH_REGNUM (tdep); i++)
++		  {
++		    regcache_raw_collect (regcache, i, raw);
++		    p = XSAVE_AVXH_ADDR (tdep, regs, i);
++		    if (memcmp (raw, p, 16))
++		      {
++			xstate_bv |= I386_XSTATE_AVX;
++			memcpy (p, raw, 16);
++		      }
++		  }
++
++	      /* Check if any SSE registers are changed.  */
++	      if ((tdep->xcr0 & I386_XSTATE_SSE))
++		for (i = I387_XMM0_REGNUM (tdep);
++		     i < I387_MXCSR_REGNUM (tdep); i++)
++		  {
++		    regcache_raw_collect (regcache, i, raw);
++		    p = FXSAVE_ADDR (tdep, regs, i);
++		    if (memcmp (raw, p, 16))
++		      {
++			xstate_bv |= I386_XSTATE_SSE;
++			memcpy (p, raw, 16);
++		      }
++		  }
++
++	      /* Check if any X87 registers are changed.  */
++	      if ((tdep->xcr0 & I386_XSTATE_X87))
++		for (i = I387_ST0_REGNUM (tdep);
++		     i < I387_FCTRL_REGNUM (tdep); i++)
++		  {
++		    regcache_raw_collect (regcache, i, raw);
++		    p = FXSAVE_ADDR (tdep, regs, i);
++		    if (memcmp (raw, p, 10))
++		      {
++			xstate_bv |= I386_XSTATE_X87;
++			memcpy (p, raw, 10);
++		      }
++		  }
++	    }
++	  else
++	    {
++	      /* Check if REGNUM is changed.  */
++	      regcache_raw_collect (regcache, regnum, raw);
++
++	      switch (regclass)
++		{
++		default:
++		  abort ();
++
++		case avxh:
++		  /* This is an upper YMM register.  */
++		  p = XSAVE_AVXH_ADDR (tdep, regs, regnum);
++		  if (memcmp (raw, p, 16))
++		    {
++		      xstate_bv |= I386_XSTATE_AVX;
++		      memcpy (p, raw, 16);
++		    }
++		  break;
++
++		case sse:
++		  /* This is an SSE register.  */
++		  p = FXSAVE_ADDR (tdep, regs, regnum);
++		  if (memcmp (raw, p, 16))
++		    {
++		      xstate_bv |= I386_XSTATE_SSE;
++		      memcpy (p, raw, 16);
++		    }
++		  break;
++
++		case x87:
++		  /* This is an x87 register.  */
++		  p = FXSAVE_ADDR (tdep, regs, regnum);
++		  if (memcmp (raw, p, 10))
++		    {
++		      xstate_bv |= I386_XSTATE_X87;
++		      memcpy (p, raw, 10);
++		    }
++		  break;
++		}
++	    }
++
++	  /* Update the corresponding bits in `xstate_bv' if any SSE/AVX
++	     registers are changed.  */
++	  if (xstate_bv)
++	    {
++	      /* The supported bits in `xstat_bv' are 1 byte.  */
++	      *xstate_bv_p |= (gdb_byte) xstate_bv;
++
++	      switch (regclass)
++		{
++		default:
++		  abort ();
++
++		case all:
++		  break;
++
++		case x87:
++		case sse:
++		case avxh:
++		  /* Register REGNUM has been updated.  Return.  */
++		  return;
++		}
++	    }
++	  else
++	    {
++	      /* Return if REGNUM isn't changed.  */
++	      if (regclass != all)
++		return;
++	    }
++	}
++    }
++
++  /* Only handle x87 control registers.  */
++  for (i = I387_FCTRL_REGNUM (tdep); i < I387_XMM0_REGNUM (tdep); i++)
++    if (regnum == -1 || regnum == i)
++      {
++	/* Most of the FPU control registers occupy only 16 bits in
++	   the xsave extended state.  Give those a special treatment.  */
++	if (i != I387_FIOFF_REGNUM (tdep)
++	    && i != I387_FOOFF_REGNUM (tdep))
++	  {
++	    gdb_byte buf[4];
++
++	    regcache_raw_collect (regcache, i, buf);
++
++	    if (i == I387_FOP_REGNUM (tdep))
++	      {
++		/* The opcode occupies only 11 bits.  Make sure we
++                   don't touch the other bits.  */
++		buf[1] &= ((1 << 3) - 1);
++		buf[1] |= ((FXSAVE_ADDR (tdep, regs, i))[1] & ~((1 << 3) - 1));
++	      }
++	    else if (i == I387_FTAG_REGNUM (tdep))
++	      {
++		/* Converting back is much easier.  */
++
++		unsigned short ftag;
++		int fpreg;
++
++		ftag = (buf[1] << 8) | buf[0];
++		buf[0] = 0;
++		buf[1] = 0;
++
++		for (fpreg = 7; fpreg >= 0; fpreg--)
++		  {
++		    int tag = (ftag >> (fpreg * 2)) & 3;
++
++		    if (tag != 3)
++		      buf[0] |= (1 << fpreg);
++		  }
++	      }
++	    memcpy (FXSAVE_ADDR (tdep, regs, i), buf, 2);
++	  }
++	else
++	  regcache_raw_collect (regcache, i, FXSAVE_ADDR (tdep, regs, i));
++      }
++
++  if (regnum == I387_MXCSR_REGNUM (tdep) || regnum == -1)
++    regcache_raw_collect (regcache, I387_MXCSR_REGNUM (tdep),
++			  FXSAVE_MXCSR_ADDR (regs));
++}
++
+ /* Recreate the FTW (tag word) valid bits from the 80-bit FP data in
+    *RAW.  */
+ 
+--- ./gdb/i387-tdep.h	2010-04-03 20:59:52.000000000 +0200
++++ ./gdb/i387-tdep.h	2010-04-03 21:12:32.000000000 +0200
+@@ -33,6 +33,8 @@ struct ui_file;
+ #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)
++#define I387_NUM_YMM_REGS(tdep) ((tdep)->num_ymm_regs)
++#define I387_YMM0H_REGNUM(tdep) ((tdep)->ymm0h_regnum)
+ 
+ #define I387_FCTRL_REGNUM(tdep) (I387_ST0_REGNUM (tdep) + 8)
+ #define I387_FSTAT_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 1)
+@@ -45,6 +47,8 @@ struct ui_file;
+ #define I387_XMM0_REGNUM(tdep) (I387_ST0_REGNUM (tdep) + 16)
+ #define I387_MXCSR_REGNUM(tdep) \
+   (I387_XMM0_REGNUM (tdep) + I387_NUM_XMM_REGS (tdep))
++#define I387_YMMENDH_REGNUM(tdep) \
++  (I387_YMM0H_REGNUM (tdep) + I387_NUM_YMM_REGS (tdep))
+ 
+ /* Print out the i387 floating point state.  */
+ 
+@@ -99,6 +103,11 @@ extern void i387_collect_fsave (const st
+ extern void i387_supply_fxsave (struct regcache *regcache, int regnum,
+ 				const void *fxsave);
+ 
++/* Similar to i387_supply_fxsave, but use XSAVE extended state.  */
++
++extern void i387_supply_xsave (struct regcache *regcache, int regnum,
++			       const void *xsave);
++
+ /* Fill register REGNUM (if it is a floating-point or SSE register) in
+    *FXSAVE with the value from REGCACHE.  If REGNUM is -1, do this for
+    all registers.  This function doesn't touch any of the reserved
+@@ -107,6 +116,11 @@ extern void i387_supply_fxsave (struct r
+ extern void i387_collect_fxsave (const struct regcache *regcache, int regnum,
+ 				 void *fxsave);
+ 
++/* Similar to i387_collect_fxsave, but use XSAVE extended state.  */
++
++extern void i387_collect_xsave (const struct regcache *regcache,
++				int regnum, void *xsave, int gcore);
++
+ /* Prepare the FPU stack in REGCACHE for a function return.  */
+ 
+ extern void i387_return_value (struct gdbarch *gdbarch,
+--- ./gdb/regformats/i386/amd64-avx-linux.dat	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/regformats/i386/amd64-avx-linux.dat	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,78 @@
++# DO NOT EDIT: generated from i386/amd64-avx-linux.xml
++name:amd64_avx_linux
++xmltarget:amd64-avx-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
++128:ymm0h
++128:ymm1h
++128:ymm2h
++128:ymm3h
++128:ymm4h
++128:ymm5h
++128:ymm6h
++128:ymm7h
++128:ymm8h
++128:ymm9h
++128:ymm10h
++128:ymm11h
++128:ymm12h
++128:ymm13h
++128:ymm14h
++128:ymm15h
+--- ./gdb/regformats/i386/amd64-avx.dat	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/regformats/i386/amd64-avx.dat	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,77 @@
++# DO NOT EDIT: generated from i386/amd64-avx.xml
++name:amd64_avx
++xmltarget:amd64-avx.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
++128:ymm0h
++128:ymm1h
++128:ymm2h
++128:ymm3h
++128:ymm4h
++128:ymm5h
++128:ymm6h
++128:ymm7h
++128:ymm8h
++128:ymm9h
++128:ymm10h
++128:ymm11h
++128:ymm12h
++128:ymm13h
++128:ymm14h
++128:ymm15h
+--- ./gdb/regformats/i386/i386-avx-linux.dat	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/regformats/i386/i386-avx-linux.dat	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,54 @@
++# DO NOT EDIT: generated from i386/i386-avx-linux.xml
++name:i386_avx_linux
++xmltarget:i386-avx-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
++128:ymm0h
++128:ymm1h
++128:ymm2h
++128:ymm3h
++128:ymm4h
++128:ymm5h
++128:ymm6h
++128:ymm7h
+--- ./gdb/regformats/i386/i386-avx.dat	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/regformats/i386/i386-avx.dat	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,53 @@
++# DO NOT EDIT: generated from i386/i386-avx.xml
++name:i386_avx
++xmltarget:i386-avx.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
++128:ymm0h
++128:ymm1h
++128:ymm2h
++128:ymm3h
++128:ymm4h
++128:ymm5h
++128:ymm6h
++128:ymm7h
+--- ./gdb/testsuite/ChangeLog.pseudo	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/ChangeLog.pseudo	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,26 @@
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.arch/amd64-dword.exp: New.
++
++	* gdb.arch/amd64-word.exp: Simplified.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.arch/amd64-word.exp: New.
++	* gdb.arch/i386-word.exp: Likewise.
++
++	* gdb.arch/i386-byte.exp (nr_regs): Removed.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.arch/amd64-pseudo.c: New.
++	* gdb.arch/i386-byte.exp: Likewise.
++
++	* gdb.arch/amd64-byte.exp: Updated.
++
++	* gdb.arch/i386-pseudo.c: Make it 32bit only.
++
++2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.arch/amd64-byte.exp: New.
++	* gdb.arch/i386-pseudo.c: Likewise.
+--- ./gdb/testsuite/ChangeLog.xcr	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/ChangeLog.xcr	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,6 @@
++2010-03-28  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.arch/i386-avx.c: New.
++	* gdb.arch/i386-avx.exp: Likewise.
++
++	* gdb.arch/i386-cpuid.h: Updated from gcc 4.4.
+--- ./gdb/testsuite/ChangeLog.xml	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/ChangeLog.xml	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,4 @@
++2010-02-22  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* gdb.xml/tdesc-regs.exp (architecture): New.  Set it for x86.
++	(load_description): Set architecture if defined.
+--- ./gdb/testsuite/gdb.arch/i386-avx.c	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.arch/i386-avx.c	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,128 @@
++/* Test program for AVX 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>
++#include "i386-cpuid.h"
++
++typedef struct {
++  float f[8];
++} v8sf_t;
++
++
++v8sf_t data[] =
++  {
++    { {  0.0,  0.125,  0.25,  0.375,  0.50,  0.625,  0.75,  0.875 } },
++    { {  1.0,  1.125,  1.25,  1.375,  1.50,  1.625,  1.75,  1.875 } },
++    { {  2.0,  2.125,  2.25,  2.375,  2.50,  2.625,  2.75,  2.875 } },
++    { {  3.0,  3.125,  3.25,  3.375,  3.50,  3.625,  3.75,  3.875 } },
++    { {  4.0,  4.125,  4.25,  4.375,  4.50,  4.625,  4.75,  4.875 } },
++    { {  5.0,  5.125,  5.25,  5.375,  5.50,  5.625,  5.75,  5.875 } },
++    { {  6.0,  6.125,  6.25,  6.375,  6.50,  6.625,  6.75,  6.875 } },
++    { {  7.0,  7.125,  7.25,  7.375,  7.50,  7.625,  7.75,  7.875 } },
++#ifdef __x86_64__
++    { {  8.0,  8.125,  8.25,  8.375,  8.50,  8.625,  8.75,  8.875 } },
++    { {  9.0,  9.125,  9.25,  9.375,  9.50,  9.625,  9.75,  9.875 } },
++    { { 10.0, 10.125, 10.25, 10.375, 10.50, 10.625, 10.75, 10.875 } },
++    { { 11.0, 11.125, 11.25, 11.375, 11.50, 11.625, 11.75, 11.875 } },
++    { { 12.0, 12.125, 12.25, 12.375, 12.50, 12.625, 12.75, 12.875 } },
++    { { 13.0, 13.125, 13.25, 13.375, 13.50, 13.625, 13.75, 13.875 } },
++    { { 14.0, 14.125, 14.25, 14.375, 14.50, 14.625, 14.75, 14.875 } },
++    { { 15.0, 15.125, 15.25, 15.375, 15.50, 15.625, 15.75, 15.875 } },
++#endif
++  };
++
++
++int
++have_avx (void)
++{
++  unsigned int eax, ebx, ecx, edx;
++
++  if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
++    return 0;
++
++  if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE))
++    return 1;
++  else
++    return 0;
++}
++
++int
++main (int argc, char **argv)
++{
++  if (have_avx ())
++    {
++      asm ("vmovaps 0(%0), %%ymm0\n\t"
++           "vmovaps 32(%0), %%ymm1\n\t"
++           "vmovaps 64(%0), %%ymm2\n\t"
++           "vmovaps 96(%0), %%ymm3\n\t"
++           "vmovaps 128(%0), %%ymm4\n\t"
++           "vmovaps 160(%0), %%ymm5\n\t"
++           "vmovaps 192(%0), %%ymm6\n\t"
++           "vmovaps 224(%0), %%ymm7\n\t"
++           : /* no output operands */
++           : "r" (data) 
++           : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
++#ifdef __x86_64__
++      asm ("vmovaps 256(%0), %%ymm8\n\t"
++           "vmovaps 288(%0), %%ymm9\n\t"
++           "vmovaps 320(%0), %%ymm10\n\t"
++           "vmovaps 352(%0), %%ymm11\n\t"
++           "vmovaps 384(%0), %%ymm12\n\t"
++           "vmovaps 416(%0), %%ymm13\n\t"
++           "vmovaps 448(%0), %%ymm14\n\t"
++           "vmovaps 480(%0), %%ymm15\n\t"
++           : /* no output operands */
++           : "r" (data) 
++           : "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15");
++#endif
++
++      asm ("nop"); /* first breakpoint here */
++
++      asm (
++           "vmovaps %%ymm0, 0(%0)\n\t"
++           "vmovaps %%ymm1, 32(%0)\n\t"
++           "vmovaps %%ymm2, 64(%0)\n\t"
++           "vmovaps %%ymm3, 96(%0)\n\t"
++           "vmovaps %%ymm4, 128(%0)\n\t"
++           "vmovaps %%ymm5, 160(%0)\n\t"
++           "vmovaps %%ymm6, 192(%0)\n\t"
++           "vmovaps %%ymm7, 224(%0)\n\t"
++           : /* no output operands */
++           : "r" (data) 
++           : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
++#ifdef __x86_64__
++      asm (
++           "vmovaps %%ymm8, 256(%0)\n\t"
++           "vmovaps %%ymm9, 288(%0)\n\t"
++           "vmovaps %%ymm10, 320(%0)\n\t"
++           "vmovaps %%ymm11, 352(%0)\n\t"
++           "vmovaps %%ymm12, 384(%0)\n\t"
++           "vmovaps %%ymm13, 416(%0)\n\t"
++           "vmovaps %%ymm14, 448(%0)\n\t"
++           "vmovaps %%ymm15, 480(%0)\n\t"
++           : /* no output operands */
++           : "r" (data) 
++           : "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15");
++#endif
++
++      puts ("Bye!"); /* second breakpoint here */
++    }
++
++  return 0;
++}
+--- ./gdb/testsuite/gdb.arch/i386-avx.exp	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.arch/i386-avx.exp	2010-04-03 21:12:32.000000000 +0200
+@@ -0,0 +1,110 @@
++# 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@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-*-*] && ![istarget x86_64-*-* ] } {
++    verbose "Skipping x86 AVX tests."
++    return
++}
++
++set testfile "i386-avx"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++if [get_compiler_info ${binfile}] {
++    return -1
++}
++
++set additional_flags ""
++if [test_compiler_info gcc*] {
++    set additional_flags "additional_flags=-mavx"
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
++    unsupported "compiler does not support AVX"
++    return
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++if ![runto_main] then {
++    gdb_suppress_tests
++}
++
++send_gdb "print have_avx ()\r"
++gdb_expect {
++    -re ".. = 1\r\n$gdb_prompt " {
++        pass "check whether processor supports AVX"
++    }
++    -re ".. = 0\r\n$gdb_prompt " {
++        verbose "processor does not support AVX; skipping AVX tests"
++        return
++    }
++    -re ".*$gdb_prompt $" {
++        fail "check whether processor supports AVX"
++    }
++    timeout {
++        fail "check whether processor supports AVX (timeout)"
++    }
++}
++
++gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
++         "Breakpoint .* at .*i386-avx.c.*" \
++         "set first breakpoint in main"
++gdb_continue_to_breakpoint "continue to first breakpoint in main"
++
++if [istarget i?86-*-*] {
++    set nr_regs 8
++} else {
++    set nr_regs 16
++}
++
++for { set r 0 } { $r < $nr_regs } { incr r } {
++    gdb_test "print \$ymm$r.v8_float" \
++        ".. = \\{$r, $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}.*" \
++        "check float contents of %ymm$r"
++    gdb_test "print \$ymm$r.v32_int8" \
++        ".. = \\{(-?\[0-9\]+, ){31}-?\[0-9\]+\\}.*" \
++        "check int8 contents of %ymm$r"
++}
++
++for { set r 0 } { $r < $nr_regs } { incr r } {
++    gdb_test "set var \$ymm$r.v8_float\[0\] = $r + 10" "" "set %ymm$r"
++}
++
++gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
++         "Breakpoint .* at .*i386-avx.c.*" \
++         "set second breakpoint in main"
++gdb_continue_to_breakpoint "continue to second breakpoint in main"
++
++for { set r 0 } { $r < $nr_regs } { incr r } {
++    gdb_test "print data\[$r\]" \
++        ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \
++        "check contents of data\[$r\]"
++}
+--- ./gdb/testsuite/gdb.arch/i386-cpuid.h	2010-01-01 08:32:00.000000000 +0100
++++ ./gdb/testsuite/gdb.arch/i386-cpuid.h	2010-04-03 21:12:32.000000000 +0200
+@@ -1,30 +1,186 @@
+-/* Helper file for i386 platform.  Runtime check for MMX/SSE/SSE2 support.
++/* Helper file for i386 platform.  Runtime check for MMX/SSE/SSE2/AVX
++ * support. Copied from gcc 4.4.
++ *
++ * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
++ *
++ * This file 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, or (at your option) any
++ * later version.
++ * 
++ * This file 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.
++ * 
++ * Under Section 7 of GPL version 3, you are granted additional
++ * permissions described in the GCC Runtime Library Exception, version
++ * 3.1, as published by the Free Software Foundation.
++ * 
++ * You should have received a copy of the GNU General Public License and
++ * a copy of the GCC Runtime Library Exception along with this program;
++ * see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
++ * <http://www.gnu.org/licenses/>.
++ */
++
++/* %ecx */
++#define bit_SSE3	(1 << 0)
++#define bit_PCLMUL	(1 << 1)
++#define bit_SSSE3	(1 << 9)
++#define bit_FMA		(1 << 12)
++#define bit_CMPXCHG16B	(1 << 13)
++#define bit_SSE4_1	(1 << 19)
++#define bit_SSE4_2	(1 << 20)
++#define bit_MOVBE	(1 << 22)
++#define bit_POPCNT	(1 << 23)
++#define bit_AES		(1 << 25)
++#define bit_XSAVE	(1 << 26)
++#define bit_OSXSAVE	(1 << 27)
++#define bit_AVX		(1 << 28)
++
++/* %edx */
++#define bit_CMPXCHG8B	(1 << 8)
++#define bit_CMOV	(1 << 15)
++#define bit_MMX		(1 << 23)
++#define bit_FXSAVE	(1 << 24)
++#define bit_SSE		(1 << 25)
++#define bit_SSE2	(1 << 26)
++
++/* Extended Features */
++/* %ecx */
++#define bit_LAHF_LM	(1 << 0)
++#define bit_ABM		(1 << 5)
++#define bit_SSE4a	(1 << 6)
++#define bit_XOP         (1 << 11)
++#define bit_LWP 	(1 << 15)
++#define bit_FMA4        (1 << 16)
++
++/* %edx */
++#define bit_LM		(1 << 29)
++#define bit_3DNOWP	(1 << 30)
++#define bit_3DNOW	(1 << 31)
++
++
++#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@intel.com>
++
++	* common.h (NT_386_XSTATE): Renamed to ...
++	(NT_X86_XSTATE): This.
++
++2010-01-27  H.J. Lu  <hongjiu.lu@intel.com>
++
++	* common.h (NT_386_XSTATE): New.

diff --git a/gdb-bz589467-pieces-vla-compat.patch b/gdb-bz589467-pieces-vla-compat.patch
new file mode 100644
index 0000000..ca5762d
--- /dev/null
+++ b/gdb-bz589467-pieces-vla-compat.patch
@@ -0,0 +1,59 @@
+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@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),		

diff --git a/gdb-bz589467-pieces01of4.patch b/gdb-bz589467-pieces01of4.patch
new file mode 100644
index 0000000..f077d19
--- /dev/null
+++ b/gdb-bz589467-pieces01of4.patch
@@ -0,0 +1,80 @@
+commit 96c23bfd2863bcca7388653a7bc4c9f8a64a03be
+Author: Ulrich Weigand <uweigand@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;
+     }

diff --git a/gdb-bz589467-pieces02of4.patch b/gdb-bz589467-pieces02of4.patch
new file mode 100644
index 0000000..f9986f0
--- /dev/null
+++ b/gdb-bz589467-pieces02of4.patch
@@ -0,0 +1,68 @@
+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;
+ 

diff --git a/gdb-bz589467-pieces03of4.patch b/gdb-bz589467-pieces03of4.patch
new file mode 100644
index 0000000..8fc73f9
--- /dev/null
+++ b/gdb-bz589467-pieces03of4.patch
@@ -0,0 +1,99 @@
+commit dacd66a53b559be9c26d2c523f168f1ef0261f4d
+Author: Michael Snyder <msnyder@specifix.com>
+Date:   Fri May 14 17:53:11 2010 +0000
+
+    2010-05-14  Michael Snyder  <msnyder@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);
+ }

diff --git a/gdb-bz589467-pieces1of4.patch b/gdb-bz589467-pieces1of4.patch
new file mode 100644
index 0000000..52163c6
--- /dev/null
+++ b/gdb-bz589467-pieces1of4.patch
@@ -0,0 +1,2075 @@
+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@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@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;
++	}
++      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;
++	}
++      else
++	{
++	  dest_offset = 0;
++	  source_offset = offset;
++	}
+ 
+       switch (p->location)
+ 	{
+@@ -363,17 +444,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 = dest_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)
+ 	      {
+ 		put_frame_register_bytes (frame, gdb_regnum, reg_offset, 
+-					  p->size, contents + offset);
++					  this_size, contents + source_offset);
+ 	      }
+ 	    else
+ 	      {
+@@ -383,13 +464,14 @@
+ 	  }
+ 	  break;
+ 	case DWARF_VALUE_MEMORY:
+-	  write_memory (p->v.expr.value, contents + offset, p->size);
++	  write_memory (p->v.expr.value + dest_offset,
++			contents + source_offset, this_size);
+ 	  break;
+ 	default:
+ 	  set_value_optimized_out (to, 1);
+ 	  return;
+ 	}
+-      offset += p->size;
++      offset += this_size;
+     }
+ }
+ 
+--- src/gdb/testsuite/gdb.dwarf2/pieces.S
++++ src/gdb/testsuite/gdb.dwarf2/pieces.S	2010-05-25 20:17:51.988718000 +0000
+@@ -0,0 +1,1655 @@
++/*
++   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 was compiled with a version of gcc modified to emit better
++   debuginfo for SRA'd structures.  See:
++	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43983
++	
++    The original program is "pieces.c", in this directory.
++*/
++
++	.file	"pieces.c"
++	.section	.debug_abbrev,"",@progbits
++.Ldebug_abbrev0:
++	.section	.debug_info,"",@progbits
++.Ldebug_info0:
++	.section	.debug_line,"",@progbits
++.Ldebug_line0:
++	.text
++.Ltext0:
++	.p2align 4,,15
++.globl bar
++	.type	bar, @function
++bar:
++.LFB0:
++	.file 1 "pieces.c"
++	# pieces.c:28
++	.loc 1 28 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
++	popl	%ebp
++.LCFI2:
++	ret
++.LFE0:
++	.size	bar, .-bar
++	.p2align 4,,15
++.globl f1
++	.type	f1, @function
++f1:
++.LFB1:
++	# pieces.c:34
++	.loc 1 34 0
++.LVL1:
++	# basic block 2
++	pushl	%ebp
++.LCFI3:
++	movl	%esp, %ebp
++.LCFI4:
++.LVL2:
++	subl	$12, %esp
++.LCFI5:
++	movl	%esi, -4(%ebp)
++.LCFI6:
++	# pieces.c:37
++	.loc 1 37 0
++	movl	8(%ebp), %esi
++	# pieces.c:34
++	.loc 1 34 0
++	movl	%ebx, -8(%ebp)
++.LCFI7:
++	# pieces.c:36
++	.loc 1 36 0
++	movl	$4, %ebx
++.LVL3:
++	# 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
++	# pieces.c:41
++	.loc 1 41 0
++	movl	-8(%ebp), %ebx
++.LVL5:
++	movl	-4(%ebp), %esi
++.LVL6:
++	movl	%ebp, %esp
++.LCFI8:
++	popl	%ebp
++.LCFI9:
++	ret
++.LFE1:
++	.size	f1, .-f1
++	.p2align 4,,15
++.globl f2
++	.type	f2, @function
++f2:
++.LFB2:
++	# pieces.c:45
++	.loc 1 45 0
++.LVL7:
++	# basic block 2
++	pushl	%ebp
++.LCFI10:
++	movl	%esp, %ebp
++.LCFI11:
++.LVL8:
++	subl	$12, %esp
++.LCFI12:
++	movl	%esi, -4(%ebp)
++.LCFI13:
++	# pieces.c:48
++	.loc 1 48 0
++	movl	8(%ebp), %esi
++	# pieces.c:45
++	.loc 1 45 0
++	movl	%ebx, -8(%ebp)
++.LCFI14:
++	# pieces.c:47
++	.loc 1 47 0
++	movl	$4, %ebx
++.LVL9:
++	# 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
++	# pieces.c:52
++	.loc 1 52 0
++	movl	-8(%ebp), %ebx
++.LVL11:
++	movl	-4(%ebp), %esi
++.LVL12:
++	movl	%ebp, %esp
++.LCFI15:
++	popl	%ebp
++.LCFI16:
++	ret
++.LFE2:
++	.size	f2, .-f2
++	.p2align 4,,15
++.globl f3
++	.type	f3, @function
++f3:
++.LFB3:
++	# pieces.c:56
++	.loc 1 56 0
++.LVL13:
++	# basic block 2
++	pushl	%ebp
++.LCFI17:
++	# pieces.c:58
++	.loc 1 58 0
++	movl	$4, %edx
++	# pieces.c:56
++	.loc 1 56 0
++	movl	%esp, %ebp
++.LCFI18:
++.LVL14:
++	subl	$12, %esp
++.LCFI19:
++	# pieces.c:58
++	.loc 1 58 0
++.LVL15:
++	# pieces.c:56
++	.loc 1 56 0
++	movl	%esi, -4(%ebp)
++.LCFI20:
++	# pieces.c:60
++	.loc 1 60 0
++	movswl	%dx, %esi
++	# pieces.c:56
++	.loc 1 56 0
++	movl	%ebx, -8(%ebp)
++.LCFI21:
++	# pieces.c:60
++	.loc 1 60 0
++	movl	%esi, (%esp)
++	call	bar
++.LVL16:
++	# pieces.c:57
++	.loc 1 57 0
++	movl	8(%ebp), %edx
++	sall	$4, %edx
++	# pieces.c:59
++	.loc 1 59 0
++	addl	$112, %edx
++	sarw	$4, %dx
++	# pieces.c:61
++	.loc 1 61 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
++	movl	-8(%ebp), %ebx
++	movl	-4(%ebp), %esi
++.LVL17:
++	movl	%ebp, %esp
++.LCFI22:
++	popl	%ebp
++.LCFI23:
++	ret
++.LFE3:
++	.size	f3, .-f3
++	.p2align 4,,15
++.globl f4
++	.type	f4, @function
++f4:
++.LFB4:
++	# pieces.c:67
++	.loc 1 67 0
++.LVL18:
++	# basic block 2
++	pushl	%ebp
++.LCFI24:
++	movl	%esp, %ebp
++.LCFI25:
++	subl	$12, %esp
++.LCFI26:
++	movl	%esi, -4(%ebp)
++.LCFI27:
++	movl	8(%ebp), %esi
++.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:
++	# pieces.c:71
++	.loc 1 71 0
++	movl	%ebx, (%esp)
++	call	bar
++	# pieces.c:72
++	.loc 1 72 0
++	movl	%esi, (%esp)
++	call	bar
++	# pieces.c:73
++	.loc 1 73 0
++	leal	(%ebx,%esi), %eax
++	# pieces.c:74
++	.loc 1 74 0
++	movl	-8(%ebp), %ebx
++.LVL21:
++	movl	-4(%ebp), %esi
++.LVL22:
++	movl	%ebp, %esp
++.LCFI29:
++	popl	%ebp
++.LCFI30:
++	ret
++.LFE4:
++	.size	f4, .-f4
++	.p2align 4,,15
++.globl f5
++	.type	f5, @function
++f5:
++.LFB5:
++	# pieces.c:78
++	.loc 1 78 0
++.LVL23:
++	# basic block 2
++	pushl	%ebp
++.LCFI31:
++	movl	%esp, %ebp
++.LCFI32:
++	subl	$12, %esp
++.LCFI33:
++	movl	%esi, -4(%ebp)
++.LCFI34:
++	movl	8(%ebp), %esi
++.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:
++	# pieces.c:82
++	.loc 1 82 0
++	movl	%ebx, (%esp)
++	call	bar
++	# pieces.c:83
++	.loc 1 83 0
++	movl	%esi, (%esp)
++	call	bar
++	# pieces.c:84
++	.loc 1 84 0
++	leal	(%ebx,%esi), %eax
++	# pieces.c:85
++	.loc 1 85 0
++	movl	-8(%ebp), %ebx
++.LVL26:
++	movl	-4(%ebp), %esi
++.LVL27:
++	movl	%ebp, %esp
++.LCFI36:
++	popl	%ebp
++.LCFI37:
++	ret
++.LFE5:
++	.size	f5, .-f5
++	.p2align 4,,15
++.globl main
++	.type	main, @function
++main:
++.LFB6:
++	# pieces.c:89
++	.loc 1 89 0
++	# basic block 2
++	pushl	%ebp
++.LCFI38:
++	movl	%esp, %ebp
++.LCFI39:
++	pushl	%ebx
++.LCFI40:
++	# pieces.c:91
++	.loc 1 91 0
++	movl	$7, %ebx
++	# pieces.c:89
++	.loc 1 89 0
++	subl	$4, %esp
++.LCFI41:
++	# pieces.c:91
++	.loc 1 91 0
++.LVL28:
++	# pieces.c:92
++	.loc 1 92 0
++	movl	%ebx, (%esp)
++	call	f1
++	# pieces.c:93
++	.loc 1 93 0
++	movl	%ebx, (%esp)
++	call	f2
++	# pieces.c:94
++	.loc 1 94 0
++	movl	%ebx, (%esp)
++	call	f3
++	# pieces.c:95
++	.loc 1 95 0
++	movl	%ebx, (%esp)
++	call	f4
++	# pieces.c:96
++	.loc 1 96 0
++	movl	%ebx, (%esp)
++	call	f5
++	# pieces.c:98
++	.loc 1 98 0
++	addl	$4, %esp
++	xorl	%eax, %eax
++	popl	%ebx
++.LCFI42:
++.LVL29:
++	popl	%ebp
++.LCFI43:
++	ret
++.LFE6:
++	.size	main, .-main
++#APP
++	.section	.debug_frame,"",@progbits
++.Lframe0:
++	.long	.LECIE0-.LSCIE0	# Length of Common Information Entry
++.LSCIE0:
++	.long	0xffffffff	# CIE Identifier Tag
++	.byte	0x1	# CIE Version
++	.ascii "\0"	# CIE Augmentation
++	.uleb128 0x1	# CIE Code Alignment Factor
++	.sleb128 -4	# CIE Data Alignment Factor
++	.byte	0x8	# CIE RA Column
++	.byte	0xc	# DW_CFA_def_cfa
++	.uleb128 0x4
++	.uleb128 0x4
++	.byte	0x88	# DW_CFA_offset, column 0x8
++	.uleb128 0x1
++	.align 4
++.LECIE0:
++.LSFDE0:
++	.long	.LEFDE0-.LASFDE0	# FDE Length
++.LASFDE0:
++	.long	.Lframe0	# FDE CIE offset
++	.long	.LFB0	# FDE initial location
++	.long	.LFE0-.LFB0	# FDE address range
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI0-.LFB0
++	.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	.LCFI1-.LCFI0
++	.byte	0xd	# DW_CFA_def_cfa_register
++	.uleb128 0x5
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI2-.LCFI1
++	.byte	0xc5	# DW_CFA_restore, column 0x5
++	.byte	0xc	# DW_CFA_def_cfa
++	.uleb128 0x4
++	.uleb128 0x4
++	.align 4
++.LEFDE0:
++.LSFDE2:
++	.long	.LEFDE2-.LASFDE2	# FDE Length
++.LASFDE2:
++	.long	.Lframe0	# FDE CIE offset
++	.long	.LFB1	# FDE initial location
++	.long	.LFE1-.LFB1	# FDE address range
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI3-.LFB1
++	.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	.LCFI4-.LCFI3
++	.byte	0xd	# DW_CFA_def_cfa_register
++	.uleb128 0x5
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI6-.LCFI4
++	.byte	0x86	# DW_CFA_offset, column 0x6
++	.uleb128 0x3
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI7-.LCFI6
++	.byte	0x83	# DW_CFA_offset, column 0x3
++	.uleb128 0x4
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI8-.LCFI7
++	.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	.LCFI9-.LCFI8
++	.byte	0xc5	# DW_CFA_restore, column 0x5
++	.byte	0xe	# DW_CFA_def_cfa_offset
++	.uleb128 0x4
++	.align 4
++.LEFDE2:
++.LSFDE4:
++	.long	.LEFDE4-.LASFDE4	# FDE Length
++.LASFDE4:
++	.long	.Lframe0	# FDE CIE offset
++	.long	.LFB2	# FDE initial location
++	.long	.LFE2-.LFB2	# FDE address range
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI10-.LFB2
++	.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	.LCFI11-.LCFI10
++	.byte	0xd	# DW_CFA_def_cfa_register
++	.uleb128 0x5
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI13-.LCFI11
++	.byte	0x86	# DW_CFA_offset, column 0x6
++	.uleb128 0x3
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI14-.LCFI13
++	.byte	0x83	# DW_CFA_offset, column 0x3
++	.uleb128 0x4
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI15-.LCFI14
++	.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	.LCFI16-.LCFI15
++	.byte	0xc5	# DW_CFA_restore, column 0x5
++	.byte	0xe	# DW_CFA_def_cfa_offset
++	.uleb128 0x4
++	.align 4
++.LEFDE4:
++.LSFDE6:
++	.long	.LEFDE6-.LASFDE6	# FDE Length
++.LASFDE6:
++	.long	.Lframe0	# FDE CIE offset
++	.long	.LFB3	# FDE initial location
++	.long	.LFE3-.LFB3	# FDE address range
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI17-.LFB3
++	.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	.LCFI18-.LCFI17
++	.byte	0xd	# DW_CFA_def_cfa_register
++	.uleb128 0x5
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI20-.LCFI18
++	.byte	0x86	# DW_CFA_offset, column 0x6
++	.uleb128 0x3
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI21-.LCFI20
++	.byte	0x83	# DW_CFA_offset, column 0x3
++	.uleb128 0x4
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI22-.LCFI21
++	.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	.LCFI23-.LCFI22
++	.byte	0xc5	# DW_CFA_restore, column 0x5
++	.byte	0xe	# DW_CFA_def_cfa_offset
++	.uleb128 0x4
++	.align 4
++.LEFDE6:
++.LSFDE8:
++	.long	.LEFDE8-.LASFDE8	# FDE Length
++.LASFDE8:
++	.long	.Lframe0	# FDE CIE offset
++	.long	.LFB4	# FDE initial location
++	.long	.LFE4-.LFB4	# FDE address range
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI24-.LFB4
++	.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	.LCFI25-.LCFI24
++	.byte	0xd	# DW_CFA_def_cfa_register
++	.uleb128 0x5
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI27-.LCFI25
++	.byte	0x86	# DW_CFA_offset, column 0x6
++	.uleb128 0x3
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI28-.LCFI27
++	.byte	0x83	# DW_CFA_offset, column 0x3
++	.uleb128 0x4
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI29-.LCFI28
++	.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	.LCFI30-.LCFI29
++	.byte	0xc5	# DW_CFA_restore, column 0x5
++	.byte	0xe	# DW_CFA_def_cfa_offset
++	.uleb128 0x4
++	.align 4
++.LEFDE8:
++.LSFDE10:
++	.long	.LEFDE10-.LASFDE10	# FDE Length
++.LASFDE10:
++	.long	.Lframe0	# FDE CIE offset
++	.long	.LFB5	# FDE initial location
++	.long	.LFE5-.LFB5	# FDE address range
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI31-.LFB5
++	.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	.LCFI32-.LCFI31
++	.byte	0xd	# DW_CFA_def_cfa_register
++	.uleb128 0x5
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI34-.LCFI32
++	.byte	0x86	# DW_CFA_offset, column 0x6
++	.uleb128 0x3
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI35-.LCFI34
++	.byte	0x83	# DW_CFA_offset, column 0x3
++	.uleb128 0x4
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI36-.LCFI35
++	.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	.LCFI37-.LCFI36
++	.byte	0xc5	# DW_CFA_restore, column 0x5
++	.byte	0xe	# DW_CFA_def_cfa_offset
++	.uleb128 0x4
++	.align 4
++.LEFDE10:
++.LSFDE12:
++	.long	.LEFDE12-.LASFDE12	# FDE Length
++.LASFDE12:
++	.long	.Lframe0	# FDE CIE offset
++	.long	.LFB6	# FDE initial location
++	.long	.LFE6-.LFB6	# FDE address range
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI38-.LFB6
++	.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	.LCFI39-.LCFI38
++	.byte	0xd	# DW_CFA_def_cfa_register
++	.uleb128 0x5
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI40-.LCFI39
++	.byte	0x83	# DW_CFA_offset, column 0x3
++	.uleb128 0x3
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI42-.LCFI40
++	.byte	0xc3	# DW_CFA_restore, column 0x3
++	.byte	0x4	# DW_CFA_advance_loc4
++	.long	.LCFI43-.LCFI42
++	.byte	0xc5	# DW_CFA_restore, column 0x5
++	.byte	0xc	# DW_CFA_def_cfa
++	.uleb128 0x4
++	.uleb128 0x4
++	.align 4
++.LEFDE12:
++#NO_APP
++	.text
++.Letext0:
++	.section	.debug_loc,"",@progbits
++.Ldebug_loc0:
++.LLST0:
++	.long	.LFB0-.Ltext0	# Location list begin address (*.LLST0)
++	.long	.LCFI0-.Ltext0	# Location list end address (*.LLST0)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	.LCFI0-.Ltext0	# Location list begin address (*.LLST0)
++	.long	.LCFI1-.Ltext0	# Location list end address (*.LLST0)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI1-.Ltext0	# Location list begin address (*.LLST0)
++	.long	.LCFI2-.Ltext0	# Location list end address (*.LLST0)
++	.value	0x2	# Location expression size
++	.byte	0x75	# DW_OP_breg5
++	.sleb128 8
++	.long	.LCFI2-.Ltext0	# Location list begin address (*.LLST0)
++	.long	.LFE0-.Ltext0	# Location list end address (*.LLST0)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	0	# Location list terminator begin (*.LLST0)
++	.long	0	# Location list terminator end (*.LLST0)
++.LLST1:
++	.long	.LFB1-.Ltext0	# Location list begin address (*.LLST1)
++	.long	.LCFI3-.Ltext0	# Location list end address (*.LLST1)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	.LCFI3-.Ltext0	# Location list begin address (*.LLST1)
++	.long	.LCFI4-.Ltext0	# Location list end address (*.LLST1)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI4-.Ltext0	# Location list begin address (*.LLST1)
++	.long	.LCFI8-.Ltext0	# Location list end address (*.LLST1)
++	.value	0x2	# Location expression size
++	.byte	0x75	# DW_OP_breg5
++	.sleb128 8
++	.long	.LCFI8-.Ltext0	# Location list begin address (*.LLST1)
++	.long	.LCFI9-.Ltext0	# Location list end address (*.LLST1)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI9-.Ltext0	# Location list begin address (*.LLST1)
++	.long	.LFE1-.Ltext0	# Location list end address (*.LLST1)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	0	# Location list terminator begin (*.LLST1)
++	.long	0	# Location list terminator end (*.LLST1)
++.LLST2:
++	.long	.LVL1-.Ltext0	# Location list begin address (*.LLST2)
++	.long	.LVL2-.Ltext0	# Location list end address (*.LLST2)
++	.value	0x6	# Location expression size
++	.byte	0x34	# DW_OP_lit4
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	.LVL2-.Ltext0	# Location list begin address (*.LLST2)
++	.long	.LVL3-.Ltext0	# Location list end address (*.LLST2)
++	.value	0xc	# Location expression size
++	.byte	0x34	# DW_OP_lit4
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x6	# DW_OP_deref
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x6
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	.LVL3-.Ltext0	# Location list begin address (*.LLST2)
++	.long	.LVL4-.Ltext0	# Location list end address (*.LLST2)
++	.value	0xb	# Location expression size
++	.byte	0x53	# DW_OP_reg3
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x6	# DW_OP_deref
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x6
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	.LVL4-.Ltext0	# Location list begin address (*.LLST2)
++	.long	.LVL5-.Ltext0	# Location list end address (*.LLST2)
++	.value	0x6	# 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
++	.long	.LVL5-.Ltext0	# Location list begin address (*.LLST2)
++	.long	.LVL6-.Ltext0	# Location list end address (*.LLST2)
++	.value	0x5	# Location expression size
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x56	# DW_OP_reg6
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	0	# Location list terminator begin (*.LLST2)
++	.long	0	# Location list terminator end (*.LLST2)
++.LLST3:
++	.long	.LFB2-.Ltext0	# Location list begin address (*.LLST3)
++	.long	.LCFI10-.Ltext0	# Location list end address (*.LLST3)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	.LCFI10-.Ltext0	# Location list begin address (*.LLST3)
++	.long	.LCFI11-.Ltext0	# Location list end address (*.LLST3)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI11-.Ltext0	# Location list begin address (*.LLST3)
++	.long	.LCFI15-.Ltext0	# Location list end address (*.LLST3)
++	.value	0x2	# Location expression size
++	.byte	0x75	# DW_OP_breg5
++	.sleb128 8
++	.long	.LCFI15-.Ltext0	# Location list begin address (*.LLST3)
++	.long	.LCFI16-.Ltext0	# Location list end address (*.LLST3)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI16-.Ltext0	# Location list begin address (*.LLST3)
++	.long	.LFE2-.Ltext0	# Location list end address (*.LLST3)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	0	# Location list terminator begin (*.LLST3)
++	.long	0	# Location list terminator end (*.LLST3)
++.LLST4:
++	.long	.LVL7-.Ltext0	# Location list begin address (*.LLST4)
++	.long	.LVL8-.Ltext0	# Location list end address (*.LLST4)
++	.value	0x6	# Location expression size
++	.byte	0x34	# DW_OP_lit4
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	.LVL8-.Ltext0	# Location list begin address (*.LLST4)
++	.long	.LVL9-.Ltext0	# Location list end address (*.LLST4)
++	.value	0xc	# Location expression size
++	.byte	0x34	# DW_OP_lit4
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x6	# DW_OP_deref
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x6
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	.LVL9-.Ltext0	# Location list begin address (*.LLST4)
++	.long	.LVL10-.Ltext0	# Location list end address (*.LLST4)
++	.value	0xb	# Location expression size
++	.byte	0x53	# DW_OP_reg3
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x6	# DW_OP_deref
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x6
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	.LVL10-.Ltext0	# Location list begin address (*.LLST4)
++	.long	.LVL11-.Ltext0	# Location list end address (*.LLST4)
++	.value	0x6	# 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
++	.long	.LVL11-.Ltext0	# Location list begin address (*.LLST4)
++	.long	.LVL12-.Ltext0	# Location list end address (*.LLST4)
++	.value	0x5	# Location expression size
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x56	# DW_OP_reg6
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	0	# Location list terminator begin (*.LLST4)
++	.long	0	# Location list terminator end (*.LLST4)
++.LLST5:
++	.long	.LFB3-.Ltext0	# Location list begin address (*.LLST5)
++	.long	.LCFI17-.Ltext0	# Location list end address (*.LLST5)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	.LCFI17-.Ltext0	# Location list begin address (*.LLST5)
++	.long	.LCFI18-.Ltext0	# Location list end address (*.LLST5)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI18-.Ltext0	# Location list begin address (*.LLST5)
++	.long	.LCFI22-.Ltext0	# Location list end address (*.LLST5)
++	.value	0x2	# Location expression size
++	.byte	0x75	# DW_OP_breg5
++	.sleb128 8
++	.long	.LCFI22-.Ltext0	# Location list begin address (*.LLST5)
++	.long	.LCFI23-.Ltext0	# Location list end address (*.LLST5)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI23-.Ltext0	# Location list begin address (*.LLST5)
++	.long	.LFE3-.Ltext0	# Location list end address (*.LLST5)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	0	# Location list terminator begin (*.LLST5)
++	.long	0	# Location list terminator end (*.LLST5)
++.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
++	.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 0
++	.byte	0x34	# DW_OP_lit4
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0xc
++	.uleb128 0
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x94	# DW_OP_deref_size
++	.byte	0x2
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x6
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0xc
++	.uleb128 0
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0x4
++	.uleb128 0
++	.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
++	.byte	0x52	# DW_OP_reg2
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0xc
++	.uleb128 0
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x94	# DW_OP_deref_size
++	.byte	0x2
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x7
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0xc
++	.uleb128 0
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0x4
++	.uleb128 0
++	.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
++	.byte	0x56	# DW_OP_reg6
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0xc
++	.uleb128 0
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x94	# DW_OP_deref_size
++	.byte	0x2
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x7
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0xc
++	.uleb128 0
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0x4
++	.uleb128 0
++	.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	0x91	# DW_OP_fbreg
++	.sleb128 0
++	.byte	0x94	# DW_OP_deref_size
++	.byte	0x2
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x7
++	.byte	0x9f	# DW_OP_stack_value
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0xc
++	.uleb128 0
++	.byte	0x9d	# DW_OP_bit_piece
++	.uleb128 0x4
++	.uleb128 0
++	.long	0	# Location list terminator begin (*.LLST6)
++	.long	0	# Location list terminator end (*.LLST6)
++.LLST7:
++	.long	.LFB4-.Ltext0	# Location list begin address (*.LLST7)
++	.long	.LCFI24-.Ltext0	# Location list end address (*.LLST7)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	.LCFI24-.Ltext0	# Location list begin address (*.LLST7)
++	.long	.LCFI25-.Ltext0	# Location list end address (*.LLST7)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI25-.Ltext0	# Location list begin address (*.LLST7)
++	.long	.LCFI29-.Ltext0	# Location list end address (*.LLST7)
++	.value	0x2	# Location expression size
++	.byte	0x75	# DW_OP_breg5
++	.sleb128 8
++	.long	.LCFI29-.Ltext0	# Location list begin address (*.LLST7)
++	.long	.LCFI30-.Ltext0	# Location list end address (*.LLST7)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI30-.Ltext0	# Location list begin address (*.LLST7)
++	.long	.LFE4-.Ltext0	# Location list end address (*.LLST7)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	0	# Location list terminator begin (*.LLST7)
++	.long	0	# Location list terminator end (*.LLST7)
++.LLST8:
++	.long	.LVL19-.Ltext0	# Location list begin address (*.LLST8)
++	.long	.LVL20-.Ltext0	# Location list end address (*.LLST8)
++	.value	0x8	# 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
++	.long	.LVL20-.Ltext0	# Location list begin address (*.LLST8)
++	.long	.LVL21-.Ltext0	# Location list end address (*.LLST8)
++	.value	0x6	# 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
++	.long	.LVL21-.Ltext0	# Location list begin address (*.LLST8)
++	.long	.LVL22-.Ltext0	# Location list end address (*.LLST8)
++	.value	0x5	# Location expression size
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x56	# DW_OP_reg6
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	0	# Location list terminator begin (*.LLST8)
++	.long	0	# Location list terminator end (*.LLST8)
++.LLST9:
++	.long	.LFB5-.Ltext0	# Location list begin address (*.LLST9)
++	.long	.LCFI31-.Ltext0	# Location list end address (*.LLST9)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	.LCFI31-.Ltext0	# Location list begin address (*.LLST9)
++	.long	.LCFI32-.Ltext0	# Location list end address (*.LLST9)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI32-.Ltext0	# Location list begin address (*.LLST9)
++	.long	.LCFI36-.Ltext0	# Location list end address (*.LLST9)
++	.value	0x2	# Location expression size
++	.byte	0x75	# DW_OP_breg5
++	.sleb128 8
++	.long	.LCFI36-.Ltext0	# Location list begin address (*.LLST9)
++	.long	.LCFI37-.Ltext0	# Location list end address (*.LLST9)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI37-.Ltext0	# Location list begin address (*.LLST9)
++	.long	.LFE5-.Ltext0	# Location list end address (*.LLST9)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	0	# Location list terminator begin (*.LLST9)
++	.long	0	# Location list terminator end (*.LLST9)
++.LLST10:
++	.long	.LVL24-.Ltext0	# Location list begin address (*.LLST10)
++	.long	.LVL25-.Ltext0	# Location list end address (*.LLST10)
++	.value	0x8	# 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
++	.long	.LVL25-.Ltext0	# Location list begin address (*.LLST10)
++	.long	.LVL26-.Ltext0	# Location list end address (*.LLST10)
++	.value	0x6	# 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
++	.long	.LVL26-.Ltext0	# Location list begin address (*.LLST10)
++	.long	.LVL27-.Ltext0	# Location list end address (*.LLST10)
++	.value	0x5	# Location expression size
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.byte	0x56	# DW_OP_reg6
++	.byte	0x93	# DW_OP_piece
++	.uleb128 0x4
++	.long	0	# Location list terminator begin (*.LLST10)
++	.long	0	# Location list terminator end (*.LLST10)
++.LLST11:
++	.long	.LFB6-.Ltext0	# Location list begin address (*.LLST11)
++	.long	.LCFI38-.Ltext0	# Location list end address (*.LLST11)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.long	.LCFI38-.Ltext0	# Location list begin address (*.LLST11)
++	.long	.LCFI39-.Ltext0	# Location list end address (*.LLST11)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 8
++	.long	.LCFI39-.Ltext0	# Location list begin address (*.LLST11)
++	.long	.LCFI43-.Ltext0	# Location list end address (*.LLST11)
++	.value	0x2	# Location expression size
++	.byte	0x75	# DW_OP_breg5
++	.sleb128 8
++	.long	.LCFI43-.Ltext0	# Location list begin address (*.LLST11)
++	.long	.LFE6-.Ltext0	# Location list end address (*.LLST11)
++	.value	0x2	# Location expression size
++	.byte	0x74	# DW_OP_breg4
++	.sleb128 4
++	.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
++	.byte	0x53	# DW_OP_reg3
++	.long	0	# Location list terminator begin (*.LLST12)
++	.long	0	# Location list terminator end (*.LLST12)
++	.section	.debug_info
++	.long	0x1e3	# Length of Compilation Unit Info
++	.value	0x2	# DWARF version number
++	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
++	.byte	0x4	# Pointer Size (in bytes)
++	.uleb128 0x1	# (DIE (0xb) DW_TAG_compile_unit)
++	.long	.LASF1	# DW_AT_producer: "GNU C 4.6.0 20100506 (experimental) [trunk revision 159117]"
++	.byte	0x1	# DW_AT_language
++	.long	.LASF2	# DW_AT_name: "pieces.c"
++	.long	.LASF3	# DW_AT_comp_dir: "/home/tromey/gnu/archer/archer/gdb/testsuite/gdb.dwarf2"
++	.long	.Ltext0	# DW_AT_low_pc
++	.long	.Letext0	# DW_AT_high_pc
++	.long	.Ldebug_line0	# DW_AT_stmt_list
++	.uleb128 0x2	# (DIE (0x25) DW_TAG_structure_type)
++	.ascii "A\0"	# DW_AT_name
++	.byte	0x8	# DW_AT_byte_size
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x17	# DW_AT_decl_line
++	.long	0x48	# DW_AT_sibling
++	.uleb128 0x3	# (DIE (0x2f) DW_TAG_member)
++	.ascii "i\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x17	# 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 (0x3b) DW_TAG_member)
++	.ascii "j\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x17	# DW_AT_decl_line
++	.long	0x48	# DW_AT_type
++	.byte	0x2	# DW_AT_data_member_location
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0x4
++	.byte	0	# end of children of DIE 0x25
++	.uleb128 0x4	# (DIE (0x48) DW_TAG_base_type)
++	.byte	0x4	# DW_AT_byte_size
++	.byte	0x5	# DW_AT_encoding
++	.ascii "int\0"	# DW_AT_name
++	.uleb128 0x2	# (DIE (0x4f) DW_TAG_structure_type)
++	.ascii "B\0"	# DW_AT_name
++	.byte	0x4	# DW_AT_byte_size
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x18	# DW_AT_decl_line
++	.long	0x78	# DW_AT_sibling
++	.uleb128 0x5	# (DIE (0x59) DW_TAG_member)
++	.ascii "i\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x18	# DW_AT_decl_line
++	.long	0x48	# DW_AT_type
++	.byte	0x4	# DW_AT_byte_size
++	.byte	0xc	# DW_AT_bit_size
++	.byte	0x10	# DW_AT_bit_offset
++	.byte	0x2	# DW_AT_data_member_location
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0
++	.uleb128 0x5	# (DIE (0x68) DW_TAG_member)
++	.ascii "j\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x18	# DW_AT_decl_line
++	.long	0x48	# DW_AT_type
++	.byte	0x4	# DW_AT_byte_size
++	.byte	0xc	# DW_AT_bit_size
++	.byte	0x4	# DW_AT_bit_offset
++	.byte	0x2	# DW_AT_data_member_location
++	.byte	0x23	# DW_OP_plus_uconst
++	.uleb128 0
++	.byte	0	# end of children of DIE 0x4f
++	.uleb128 0x6	# (DIE (0x78) 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	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)
++	.ascii "x\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x1b	# 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	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	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)
++	.ascii "k\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x21	# 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)
++	.ascii "a\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x23	# 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	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	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)
++	.ascii "k\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x2c	# 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)
++	.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
++	.long	.LLST4	# DW_AT_location
++	.byte	0	# end of children of DIE 0xd4
++	.uleb128 0xa	# (DIE (0x10a) 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
++	.byte	0x1	# DW_AT_upper_bound
++	.byte	0	# end of children of DIE 0x10a
++	.uleb128 0xc	# (DIE (0x11a) DW_TAG_base_type)
++	.byte	0x4	# DW_AT_byte_size
++	.byte	0x7	# DW_AT_encoding
++	.uleb128 0x8	# (DIE (0x11d) 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	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)
++	.ascii "k\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x37	# 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)
++	.ascii "a\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x39	# 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	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	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)
++	.ascii "k\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x42	# 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)
++	.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
++	.long	.LLST8	# DW_AT_location
++	.byte	0	# end of children of DIE 0x153
++	.uleb128 0x8	# (DIE (0x189) 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	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)
++	.ascii "k\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x4d	# 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)
++	.ascii "a\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x4f	# 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	0x1	# DW_AT_external
++	.long	.LASF0	# DW_AT_name: "main"
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x58	# 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)
++	.ascii "k\0"	# DW_AT_name
++	.byte	0x1	# DW_AT_decl_file (pieces.c)
++	.byte	0x5a	# DW_AT_decl_line
++	.long	0x48	# DW_AT_type
++	.long	.LLST12	# DW_AT_location
++	.byte	0	# end of children of DIE 0x1bf
++	.byte	0	# 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 0x6	# (DW_FORM_data4)
++	.byte	0
++	.byte	0
++	.uleb128 0x2	# (abbrev code)
++	.uleb128 0x13	# (TAG: DW_TAG_structure_type)
++	.byte	0x1	# DW_children_yes
++	.uleb128 0x3	# (DW_AT_name)
++	.uleb128 0x8	# (DW_FORM_string)
++	.uleb128 0xb	# (DW_AT_byte_size)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3a	# (DW_AT_decl_file)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3b	# (DW_AT_decl_line)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x1	# (DW_AT_sibling)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.byte	0
++	.byte	0
++	.uleb128 0x3	# (abbrev code)
++	.uleb128 0xd	# (TAG: DW_TAG_member)
++	.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 0x38	# (DW_AT_data_member_location)
++	.uleb128 0xa	# (DW_FORM_block1)
++	.byte	0
++	.byte	0
++	.uleb128 0x4	# (abbrev code)
++	.uleb128 0x24	# (TAG: DW_TAG_base_type)
++	.byte	0	# 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	0
++	.byte	0
++	.uleb128 0x5	# (abbrev code)
++	.uleb128 0xd	# (TAG: DW_TAG_member)
++	.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 0xb	# (DW_AT_byte_size)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0xd	# (DW_AT_bit_size)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0xc	# (DW_AT_bit_offset)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x38	# (DW_AT_data_member_location)
++	.uleb128 0xa	# (DW_FORM_block1)
++	.byte	0
++	.byte	0
++	.uleb128 0x6	# (abbrev code)
++	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
++	.byte	0x1	# DW_children_yes
++	.uleb128 0x3f	# (DW_AT_external)
++	.uleb128 0xc	# (DW_FORM_flag)
++	.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 0x27	# (DW_AT_prototyped)
++	.uleb128 0xc	# (DW_FORM_flag)
++	.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 0x6	# (DW_FORM_data4)
++	.uleb128 0x1	# (DW_AT_sibling)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.byte	0
++	.byte	0
++	.uleb128 0x7	# (abbrev code)
++	.uleb128 0x5	# (TAG: DW_TAG_formal_parameter)
++	.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 0x2	# (DW_AT_location)
++	.uleb128 0xa	# (DW_FORM_block1)
++	.byte	0
++	.byte	0
++	.uleb128 0x8	# (abbrev code)
++	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
++	.byte	0x1	# DW_children_yes
++	.uleb128 0x3f	# (DW_AT_external)
++	.uleb128 0xc	# (DW_FORM_flag)
++	.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 0x27	# (DW_AT_prototyped)
++	.uleb128 0xc	# (DW_FORM_flag)
++	.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 0x6	# (DW_FORM_data4)
++	.uleb128 0x1	# (DW_AT_sibling)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.byte	0
++	.byte	0
++	.uleb128 0x9	# (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 0x2	# (DW_AT_location)
++	.uleb128 0x6	# (DW_FORM_data4)
++	.byte	0
++	.byte	0
++	.uleb128 0xa	# (abbrev code)
++	.uleb128 0x1	# (TAG: DW_TAG_array_type)
++	.byte	0x1	# DW_children_yes
++	.uleb128 0x49	# (DW_AT_type)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.uleb128 0x1	# (DW_AT_sibling)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.byte	0
++	.byte	0
++	.uleb128 0xb	# (abbrev code)
++	.uleb128 0x21	# (TAG: DW_TAG_subrange_type)
++	.byte	0	# DW_children_no
++	.uleb128 0x49	# (DW_AT_type)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.uleb128 0x2f	# (DW_AT_upper_bound)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.byte	0
++	.byte	0
++	.uleb128 0xc	# (abbrev code)
++	.uleb128 0x24	# (TAG: DW_TAG_base_type)
++	.byte	0	# DW_children_no
++	.uleb128 0xb	# (DW_AT_byte_size)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3e	# (DW_AT_encoding)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.byte	0
++	.byte	0
++	.uleb128 0xd	# (abbrev code)
++	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
++	.byte	0x1	# DW_children_yes
++	.uleb128 0x3f	# (DW_AT_external)
++	.uleb128 0xc	# (DW_FORM_flag)
++	.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 0xc	# (DW_FORM_flag)
++	.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 0x6	# (DW_FORM_data4)
++	.byte	0
++	.byte	0
++	.byte	0
++	.section	.debug_pubnames,"",@progbits
++	.long	0x42	# 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
++	.ascii "bar\0"	# external name
++	.long	0x9e	# DIE offset
++	.ascii "f1\0"	# external name
++	.long	0xd4	# DIE offset
++	.ascii "f2\0"	# external name
++	.long	0x11d	# DIE offset
++	.ascii "f3\0"	# external name
++	.long	0x153	# DIE offset
++	.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,"",@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,"",@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",@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,"",@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

diff --git a/gdb-bz589467-pieces2of4.patch b/gdb-bz589467-pieces2of4.patch
new file mode 100644
index 0000000..4c27039
--- /dev/null
+++ b/gdb-bz589467-pieces2of4.patch
@@ -0,0 +1,53 @@
+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@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@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

diff --git a/gdb-bz589467-pieces3of4.patch b/gdb-bz589467-pieces3of4.patch
new file mode 100644
index 0000000..3d77fcf
--- /dev/null
+++ b/gdb-bz589467-pieces3of4.patch
@@ -0,0 +1,1198 @@
+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@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@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,"",@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,"",@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,"",@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,"",@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

diff --git a/gdb-bz589467-pieces4of4.patch b/gdb-bz589467-pieces4of4.patch
new file mode 100644
index 0000000..42ffb41
--- /dev/null
+++ b/gdb-bz589467-pieces4of4.patch
@@ -0,0 +1,820 @@
+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@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@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

diff --git a/gdb-bz594560-core-vs-process.patch b/gdb-bz594560-core-vs-process.patch
new file mode 100644
index 0000000..5f7b9d4
--- /dev/null
+++ b/gdb-bz594560-core-vs-process.patch
@@ -0,0 +1,164 @@
+--- ./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
+-@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
+-@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;

diff --git a/gdb-bz595475-tui-layout.patch b/gdb-bz595475-tui-layout.patch
new file mode 100644
index 0000000..71742f8
--- /dev/null
+++ b/gdb-bz595475-tui-layout.patch
@@ -0,0 +1,79 @@
+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@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@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"

diff --git a/gdb-bz600746-koenig-crash.patch b/gdb-bz600746-koenig-crash.patch
new file mode 100644
index 0000000..7b6e209
--- /dev/null
+++ b/gdb-bz600746-koenig-crash.patch
@@ -0,0 +1,66 @@
+[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@redhat.com>
++
++	* cp-support.c (make_symbol_overload_list_adl_namespace): Handle
++	anonymous type case.
++
+ 2010-06-02  Pierre Muller  <muller@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@redhat.com>
++
++	* gdb.cp/namespace-koenig.exp: Added new test case.
++	* gdb.cp/namespace-koenig.cc: Ditto.
++
+ 2010-06-01  Michael Snyder  <msnyder@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"

diff --git a/gdb-bz601887-dwarf4-1of2.patch b/gdb-bz601887-dwarf4-1of2.patch
new file mode 100644
index 0000000..22708df
--- /dev/null
+++ b/gdb-bz601887-dwarf4-1of2.patch
@@ -0,0 +1,329 @@
+commit be1f57c90bdf86477b9bc69cc982171d6ad5df56
+Author: Tom Tromey <tromey@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@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@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);
+ }
+ 
+ 

diff --git a/gdb-bz601887-dwarf4-2of2.patch b/gdb-bz601887-dwarf4-2of2.patch
new file mode 100644
index 0000000..97f88b0
--- /dev/null
+++ b/gdb-bz601887-dwarf4-2of2.patch
@@ -0,0 +1,56 @@
+commit 669907bd6d54ae8e85b1278f0f16f8641ce6802d
+Author: Tom Tromey <tromey@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@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@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:

diff --git a/gdb-bz601887-dwarf4-rh-test.patch b/gdb-bz601887-dwarf4-rh-test.patch
new file mode 100644
index 0000000..4774bda
--- /dev/null
+++ b/gdb-bz601887-dwarf4-rh-test.patch
@@ -0,0 +1,240 @@
+--- /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,"",@progbits
++.Ldebug_abbrev0:
++	.section	.debug_info,"",@progbits
++.Ldebug_info0:
++	.section	.debug_line,"",@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,"",@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,"",@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",@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,"",@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\)}

diff --git a/gdb-bz602314-ptype-class-typedef-1of3.patch b/gdb-bz602314-ptype-class-typedef-1of3.patch
new file mode 100644
index 0000000..1d31bf2
--- /dev/null
+++ b/gdb-bz602314-ptype-class-typedef-1of3.patch
@@ -0,0 +1,274 @@
+commit f49f91e9c3eaba847f75f5c46e77e261a76d9a9b
+Author: Jan Kratochvil <jan.kratochvil@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@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@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)

diff --git a/gdb-bz602314-ptype-class-typedef-2of3.patch b/gdb-bz602314-ptype-class-typedef-2of3.patch
new file mode 100644
index 0000000..3f01eb3
--- /dev/null
+++ b/gdb-bz602314-ptype-class-typedef-2of3.patch
@@ -0,0 +1,308 @@
+commit 758a1f7149cb7469c7e6bb30cb572715ee90a6e8
+Author: Jan Kratochvil <jan.kratochvil@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@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@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"

diff --git a/gdb-bz602314-ptype-class-typedef-3of3.patch b/gdb-bz602314-ptype-class-typedef-3of3.patch
new file mode 100644
index 0000000..f0ad50d
--- /dev/null
+++ b/gdb-bz602314-ptype-class-typedef-3of3.patch
@@ -0,0 +1,38 @@
+commit 477c1359b217cdc052a7c9f83cae9c894396894c
+Author: Jan Kratochvil <jan.kratochvil@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@redhat.com>
++
++	* dwarf2read.c (read_structure_type) <fi.typedef_field_list>: Call
++	ALLOCATE_CPLUS_STRUCT_TYPE.
++
+ 2010-06-28  Phil Muldoon  <pmuldoon@redhat.com>
+             Tom Tromey  <tromey@redhat.com>
+             Thiago Jung Bauermann  <bauerman@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@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;

diff --git a/gdb-bz606185-obstack-1of5.patch b/gdb-bz606185-obstack-1of5.patch
new file mode 100644
index 0000000..e2879bb
--- /dev/null
+++ b/gdb-bz606185-obstack-1of5.patch
@@ -0,0 +1,214 @@
+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@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@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.*"
++

diff --git a/gdb-bz606185-obstack-2of5.patch b/gdb-bz606185-obstack-2of5.patch
new file mode 100644
index 0000000..c8b1cb4
--- /dev/null
+++ b/gdb-bz606185-obstack-2of5.patch
@@ -0,0 +1,163 @@
+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@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@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@adacore.com>
+-	    Petr Hluzín <petr.hluzin@gmail.com>
++	    Petr Hluz�n <petr.hluzin@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>}"
++

diff --git a/gdb-bz606185-obstack-3of5.patch b/gdb-bz606185-obstack-3of5.patch
new file mode 100644
index 0000000..4092c00
--- /dev/null
+++ b/gdb-bz606185-obstack-3of5.patch
@@ -0,0 +1,85 @@
+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@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@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;
+ 	    }
+ 	}

diff --git a/gdb-bz606185-obstack-4of5.patch b/gdb-bz606185-obstack-4of5.patch
new file mode 100644
index 0000000..5153a2b
--- /dev/null
+++ b/gdb-bz606185-obstack-4of5.patch
@@ -0,0 +1,42 @@
+commit 744735550d4a4fd6d4be40776069d799dca5ee39
+Author: Ulrich Weigand <uweigand@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@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@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 *));
+ }

diff --git a/gdb-bz606185-obstack-5of5.patch b/gdb-bz606185-obstack-5of5.patch
new file mode 100644
index 0000000..4171e56
--- /dev/null
+++ b/gdb-bz606185-obstack-5of5.patch
@@ -0,0 +1,202 @@
+commit 47c8c764a9be6d023eca450336e6d9de16970fc0
+Author: Jan Kratochvil <jan.kratochvil@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@redhat.com>
++
++	* cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
++	obstack_begin after each obstack_free.
++
+ 2010-06-27  Doug Evans  <dje@google.com>
+ 
+ 	* value.c (value_static_field): Use `switch' instead of `if'.
+## -12,27 +17,27 @@
+ 
+ 2010-06-25  Paul Hilfinger  <hilfinger@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@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@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@redhat.com>
++
++	* gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
++
+ 2010-06-28  Doug Evans  <dje@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"

diff --git a/gdb-bz606660-print-object-nonvirtual.patch b/gdb-bz606660-print-object-nonvirtual.patch
new file mode 100644
index 0000000..9b52038
--- /dev/null
+++ b/gdb-bz606660-print-object-nonvirtual.patch
@@ -0,0 +1,106 @@
+commit bb604f9e70de515b13e2a935d8ad9d2fb0290849
+Author: Jan Kratochvil <jan.kratochvil@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@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@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\}"

diff --git a/gdb-infcall-sp-underflow.patch b/gdb-infcall-sp-underflow.patch
new file mode 100644
index 0000000..d602a4f
--- /dev/null
+++ b/gdb-infcall-sp-underflow.patch
@@ -0,0 +1,81 @@
+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@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@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
++}
+

diff --git a/gdb-moribund-utrace-workaround.patch b/gdb-moribund-utrace-workaround.patch
new file mode 100644
index 0000000..6b50a8e
--- /dev/null
+++ b/gdb-moribund-utrace-workaround.patch
@@ -0,0 +1,16 @@
+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);

diff --git a/gdb-pie-1of6-reprelinked-bin.patch b/gdb-pie-1of6-reprelinked-bin.patch
new file mode 100644
index 0000000..277bc77
--- /dev/null
+++ b/gdb-pie-1of6-reprelinked-bin.patch
@@ -0,0 +1,443 @@
+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@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@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
+ 		    }
+ 		}
+ 	    }
+

diff --git a/gdb-pie-2of6-reprelinked-ld.patch b/gdb-pie-2of6-reprelinked-ld.patch
new file mode 100644
index 0000000..4f054a8
--- /dev/null
+++ b/gdb-pie-2of6-reprelinked-ld.patch
@@ -0,0 +1,87 @@
+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@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@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"
+

diff --git a/gdb-pie-3of6-relocate-once.patch b/gdb-pie-3of6-relocate-once.patch
new file mode 100644
index 0000000..397a5db
--- /dev/null
+++ b/gdb-pie-3of6-relocate-once.patch
@@ -0,0 +1,412 @@
+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@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@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
+

diff --git a/gdb-pie-rerun.patch b/gdb-pie-rerun.patch
new file mode 100644
index 0000000..dd06805
--- /dev/null
+++ b/gdb-pie-rerun.patch
@@ -0,0 +1,127 @@
+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@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@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
+

diff --git a/gdb-readline-6.0-signal.patch b/gdb-readline-6.0-signal.patch
deleted file mode 100644
index 1b8c8c6..0000000
--- a/gdb-readline-6.0-signal.patch
+++ /dev/null
@@ -1,648 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
-Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
-
-Hi Chet,
-
-FSF GDB currently ships bundled with readline-5.2 which works fine.
-But using --with-system-readline and readline-6.0-patchlevel4 has
-a regression:
-
-readline-5.2: Run `gdb -nx -q' and type CTRL-C:
-(gdb) Quit
-(gdb) _
-
-readline-6.0: Run `gdb -nx -q' and type CTRL-C:
-(gdb) _
- = nothing happens (it gets buffered and executed later)
-	(It does also FAIL on gdb.gdb/selftest.exp.)
-
-It is because GDB waits in its own poll() mainloop and readline uses via
-rl_callback_handler_install and rl_callback_handler_remove.  This way the
-readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
-only stored to _rl_caught_signal but not executed.
-
-Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
-_rl_handle_signal is called then the signal is still stored to
-_rl_caught_signal.  In the _rl_interrupt_immediately case it should not be
-stored when it was already processed.
-
-rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
-of its meaning it breaks the nest-counting of other routines which do
-`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
-creating problematic `_rl_interrupt_immediately == -1'.
-
-`_rl_interrupt_immediately' is an internal variable, how it could be accessed
-by a readline application? (OK, maybe it should not be used.)
-
-Attaching a current GDB-side patch but it must access readline internal
-variable _rl_caught_signal and it is generally just a workaround.  Could you
-please include support for signals in this asynchronous mode in readline-6.1?
-I find it would be enough to make RL_CHECK_SIGNALS public?
-
-
-GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
-But this is not a patch intended to be accepted.
-
-
-Thanks,
-Jan
-
-
-gdb/
-2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	* config.in, configure: Regenerate.
-	* configure.ac (for readline_echoing_p): Move inside $LIBS change.
-	(for _rl_caught_signal): New.
-	* event-loop.c: Include readline/readline.h.
-	(gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
-
-gdb/testsuite/
-2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	* gdb.gdb/selftest.exp (backtrace through signal handler): Move before
-	SIGINT pass, drop the timeout case.
-	(send SIGINT signal to child process): Use gdb_test.
-	(backtrace through readline handler): New.
-
-Index: gdb-7.0.50.20100115/gdb/config.in
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/config.in	2010-01-15 12:48:04.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/config.in	2010-01-15 12:48:40.000000000 +0100
-@@ -359,6 +359,9 @@
- /* Define if Python interpreter is being linked in. */
- #undef HAVE_PYTHON
- 
-+/* readline-6.0 workaround of blocked signals. */
-+#undef HAVE_READLINE_CAUGHT_SIGNAL
-+
- /* Define to 1 if you have the `realpath' function. */
- #undef HAVE_REALPATH
- 
-Index: gdb-7.0.50.20100115/gdb/configure.ac
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/configure.ac	2010-01-15 12:48:04.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/configure.ac	2010-01-15 12:48:40.000000000 +0100
-@@ -777,17 +777,25 @@ if test "$with_system_readline" = yes; t
-   # readline-6.0 started to use the name `_rl_echoing_p'.
-   # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- 
--  AC_MSG_CHECKING([for readline_echoing_p])
-   save_LIBS=$LIBS
-   LIBS="$LIBS $READLINE"
-+  AC_MSG_CHECKING([for readline_echoing_p])
-   AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
- 				    return readline_echoing_p;]]),
- 		 [READLINE_ECHOING_P=yes],
- 		 [READLINE_ECHOING_P=no
- 		  AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
- 			    [readline-6.0 started to use different name.])])
--  LIBS="$save_LIBS"
-   AC_MSG_RESULT([$READLINE_ECHOING_P])
-+  AC_MSG_CHECKING([for _rl_caught_signal])
-+  AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
-+				    return _rl_caught_signal;]]),
-+		 [READLINE_CAUGHT_SIGNAL=yes
-+		  AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
-+			    [readline-6.0 workaround of blocked signals.])],
-+		 [READLINE_CAUGHT_SIGNAL=no])
-+  AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
-+  LIBS="$save_LIBS"
- else
-   READLINE='$(READLINE_DIR)/libreadline.a'
-   READLINE_DEPS='$(READLINE)'
-Index: gdb-7.0.50.20100115/gdb/event-loop.c
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/event-loop.c	2010-01-01 08:31:31.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/event-loop.c	2010-01-15 12:48:40.000000000 +0100
-@@ -37,6 +37,7 @@
- #include "exceptions.h"
- #include "gdb_assert.h"
- #include "gdb_select.h"
-+#include "readline/readline.h"
- 
- /* Data point to pass to the event handler.  */
- typedef union event_data
-@@ -411,6 +412,9 @@ gdb_do_one_event (void *data)
-   static int event_source_head = 0;
-   const int number_of_sources = 3;
-   int current = 0;
-+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
-+  extern int volatile _rl_caught_signal;
-+#endif
- 
-   /* Any events already waiting in the queue?  */
-   if (process_event ())
-@@ -455,6 +459,16 @@ gdb_do_one_event (void *data)
-   if (gdb_wait_for_event (1) < 0)
-     return -1;
- 
-+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
-+  if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
-+      && _rl_caught_signal)
-+    {
-+      /* Call RL_CHECK_SIGNALS this way.  */
-+      rl_callback_handler_remove ();
-+      rl_callback_handler_install (NULL, input_handler);
-+    }
-+#endif
-+
-   /* Handle any new events occurred while waiting.  */
-   if (process_event ())
-     return 1;
-Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.gdb/selftest.exp
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.gdb/selftest.exp	2010-01-15 12:48:01.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.gdb/selftest.exp	2010-01-15 12:48:40.000000000 +0100
-@@ -471,31 +471,42 @@ GDB.*Copyright \[0-9\]+ Free Software Fo
- 	    fail "$description (timeout)"
- 	}
-     }
--    
--    set description "send SIGINT signal to child process"
--    send_gdb "signal SIGINT\n"
--    gdb_expect {
--	-re "Continuing with signal SIGINT.*$gdb_prompt $" {
-+
-+    # get a stack trace with the poll function
-+    #
-+    # This fails on some linux systems for unknown reasons.  On the
-+    # systems where it fails, sometimes it works fine when run manually.
-+    # The testsuite failures may not be limited to just aout systems.
-+    setup_xfail "i*86-pc-linuxaout-gnu"
-+    set description "backtrace through signal handler"
-+    gdb_test_multiple "backtrace" $description {
-+	-re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
- 	    pass "$description"
- 	}
- 	-re ".*$gdb_prompt $" {
-+	    # On the alpha, we hit the infamous problem about gdb
-+	    # being unable to get the frame pointer (mentioned in
-+	    # gdb/README).  As it is intermittent, there is no way to
-+	    # XFAIL it which will give us an XPASS if the problem goes
-+	    # away.
-+	    setup_xfail "alpha*-*-osf*"
- 	    fail "$description"
- 	}
--	timeout {
--	    fail "$description (timeout)"
--	}
-     }
-     
--    # get a stack trace
-+    gdb_test "signal SIGINT" "Continuing with signal SIGINT.*" \
-+	     "send SIGINT signal to child process"
-+    
-+    # get a stack trace being redelivered by readline
-     #
-     # This fails on some linux systems for unknown reasons.  On the
-     # systems where it fails, sometimes it works fine when run manually.
-     # The testsuite failures may not be limited to just aout systems.
-+    # Optional system readline may not have symbols to be shown.
-     setup_xfail "i*86-pc-linuxaout-gnu"
--    set description "backtrace through signal handler"
--    send_gdb "backtrace\n"
--    gdb_expect {
--	-re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
-+    set description "backtrace through readline handler"
-+    gdb_test_multiple "backtrace" $description {
-+	-re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
- 	    pass "$description"
- 	}
- 	-re ".*$gdb_prompt $" {
-@@ -507,9 +518,6 @@ GDB.*Copyright \[0-9\]+ Free Software Fo
- 	    setup_xfail "alpha*-*-osf*"
- 	    fail "$description"
- 	}
--	timeout {
--	    fail "$description (timeout)"
--	}
-     }
- 
- 
-Index: gdb-7.0.50.20100115/gdb/configure
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/configure	2010-01-15 12:48:04.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/configure	2010-01-15 12:48:46.000000000 +0100
-@@ -6772,6 +6772,185 @@ else
- fi
- 
- 
-+
-+
-+
-+
-+# Check whether --with-separate-debug-dir was given.
-+if test "${with_separate_debug_dir+set}" = set; then :
-+  withval=$with_separate_debug_dir;
-+    DEBUGDIR=$withval
-+else
-+  DEBUGDIR=${libdir}/debug
-+fi
-+
-+
-+  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-+  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-+  ac_define_dir=`eval echo $DEBUGDIR`
-+  ac_define_dir=`eval echo $ac_define_dir`
-+
-+cat >>confdefs.h <<_ACEOF
-+#define DEBUGDIR "$ac_define_dir"
-+_ACEOF
-+
-+
-+
-+  if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-+     if test "x$prefix" = xNONE; then
-+     	test_prefix=/usr/local
-+     else
-+	test_prefix=$prefix
-+     fi
-+  else
-+     test_prefix=$exec_prefix
-+  fi
-+  value=0
-+  case ${ac_define_dir} in
-+     "${test_prefix}"|"${test_prefix}/"*|\
-+	'${exec_prefix}'|'${exec_prefix}/'*)
-+     value=1
-+     ;;
-+  esac
-+
-+cat >>confdefs.h <<_ACEOF
-+#define DEBUGDIR_RELOCATABLE $value
-+_ACEOF
-+
-+
-+
-+# GDB's datadir relocation
-+
-+
-+
-+# Check whether --with-gdb-datadir was given.
-+if test "${with_gdb_datadir+set}" = set; then :
-+  withval=$with_gdb_datadir;
-+    GDB_DATADIR=$withval
-+else
-+  GDB_DATADIR=${datadir}/gdb
-+fi
-+
-+
-+  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-+  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-+  ac_define_dir=`eval echo $GDB_DATADIR`
-+  ac_define_dir=`eval echo $ac_define_dir`
-+
-+cat >>confdefs.h <<_ACEOF
-+#define GDB_DATADIR "$ac_define_dir"
-+_ACEOF
-+
-+
-+
-+  if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-+     if test "x$prefix" = xNONE; then
-+     	test_prefix=/usr/local
-+     else
-+	test_prefix=$prefix
-+     fi
-+  else
-+     test_prefix=$exec_prefix
-+  fi
-+  value=0
-+  case ${ac_define_dir} in
-+     "${test_prefix}"|"${test_prefix}/"*|\
-+	'${exec_prefix}'|'${exec_prefix}/'*)
-+     value=1
-+     ;;
-+  esac
-+
-+cat >>confdefs.h <<_ACEOF
-+#define GDB_DATADIR_RELOCATABLE $value
-+_ACEOF
-+
-+
-+
-+
-+# Check whether --with-relocated-sources was given.
-+if test "${with_relocated_sources+set}" = set; then :
-+  withval=$with_relocated_sources; reloc_srcdir="${withval}"
-+
-+  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-+  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-+  ac_define_dir=`eval echo $reloc_srcdir`
-+  ac_define_dir=`eval echo $ac_define_dir`
-+
-+cat >>confdefs.h <<_ACEOF
-+#define RELOC_SRCDIR "$ac_define_dir"
-+_ACEOF
-+
-+
-+
-+fi
-+
-+
-+# GDB's datadir relocation
-+
-+gdbdatadir=${datadir}/gdb
-+
-+
-+# Check whether --with-gdb-datadir was given.
-+if test "${with_gdb_datadir+set}" = set; then :
-+  withval=$with_gdb_datadir; gdbdatadir="${withval}"
-+fi
-+
-+
-+
-+  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-+  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-+  ac_define_dir=`eval echo $gdbdatadir`
-+  ac_define_dir=`eval echo $ac_define_dir`
-+
-+cat >>confdefs.h <<_ACEOF
-+#define GDB_DATADIR "$ac_define_dir"
-+_ACEOF
-+
-+
-+
-+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-+  if test "x$prefix" = xNONE; then
-+    test_prefix=/usr/local
-+  else
-+    test_prefix=$prefix
-+  fi
-+else
-+  test_prefix=$exec_prefix
-+fi
-+
-+case ${gdbdatadir} in
-+  "${test_prefix}"|"${test_prefix}/"*|\
-+  '${exec_prefix}'|'${exec_prefix}/'*)
-+
-+$as_echo "#define GDB_DATADIR_RELOCATABLE 1" >>confdefs.h
-+
-+  ;;
-+esac
-+GDB_DATADIR_PATH=${gdbdatadir}
-+
-+
-+
-+# Check whether --with-pythondir was given.
-+if test "${with_pythondir+set}" = set; then :
-+  withval=$with_pythondir; pythondir="${withval}"
-+else
-+  pythondir=no
-+fi
-+
-+
-+# If the user passed in a path, define it.  Otherwise, compute it at
-+# runtime based on the possibly-relocatable datadir.
-+if test "$pythondir" = "no"; then
-+  pythondir='$(GDB_DATADIR_PATH)/python'
-+else
-+
-+cat >>confdefs.h <<_ACEOF
-+#define PYTHONDIR "$pythondir"
-+_ACEOF
-+
-+fi
-+
-+
- # Integration with rpm library to support missing debuginfo suggestions.
- # --without-rpm: Disable any rpm support.
- # --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
-@@ -7255,185 +7434,6 @@ fi
- 
- 
- 
--
--# Check whether --with-separate-debug-dir was given.
--if test "${with_separate_debug_dir+set}" = set; then :
--  withval=$with_separate_debug_dir;
--    DEBUGDIR=$withval
--else
--  DEBUGDIR=${libdir}/debug
--fi
--
--
--  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
--  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
--  ac_define_dir=`eval echo $DEBUGDIR`
--  ac_define_dir=`eval echo $ac_define_dir`
--
--cat >>confdefs.h <<_ACEOF
--#define DEBUGDIR "$ac_define_dir"
--_ACEOF
--
--
--
--  if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
--     if test "x$prefix" = xNONE; then
--     	test_prefix=/usr/local
--     else
--	test_prefix=$prefix
--     fi
--  else
--     test_prefix=$exec_prefix
--  fi
--  value=0
--  case ${ac_define_dir} in
--     "${test_prefix}"|"${test_prefix}/"*|\
--	'${exec_prefix}'|'${exec_prefix}/'*)
--     value=1
--     ;;
--  esac
--
--cat >>confdefs.h <<_ACEOF
--#define DEBUGDIR_RELOCATABLE $value
--_ACEOF
--
--
--
--# GDB's datadir relocation
--
--
--
--# Check whether --with-gdb-datadir was given.
--if test "${with_gdb_datadir+set}" = set; then :
--  withval=$with_gdb_datadir;
--    GDB_DATADIR=$withval
--else
--  GDB_DATADIR=${datadir}/gdb
--fi
--
--
--  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
--  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
--  ac_define_dir=`eval echo $GDB_DATADIR`
--  ac_define_dir=`eval echo $ac_define_dir`
--
--cat >>confdefs.h <<_ACEOF
--#define GDB_DATADIR "$ac_define_dir"
--_ACEOF
--
--
--
--  if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
--     if test "x$prefix" = xNONE; then
--     	test_prefix=/usr/local
--     else
--	test_prefix=$prefix
--     fi
--  else
--     test_prefix=$exec_prefix
--  fi
--  value=0
--  case ${ac_define_dir} in
--     "${test_prefix}"|"${test_prefix}/"*|\
--	'${exec_prefix}'|'${exec_prefix}/'*)
--     value=1
--     ;;
--  esac
--
--cat >>confdefs.h <<_ACEOF
--#define GDB_DATADIR_RELOCATABLE $value
--_ACEOF
--
--
--
--
--# Check whether --with-relocated-sources was given.
--if test "${with_relocated_sources+set}" = set; then :
--  withval=$with_relocated_sources; reloc_srcdir="${withval}"
--
--  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
--  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
--  ac_define_dir=`eval echo $reloc_srcdir`
--  ac_define_dir=`eval echo $ac_define_dir`
--
--cat >>confdefs.h <<_ACEOF
--#define RELOC_SRCDIR "$ac_define_dir"
--_ACEOF
--
--
--
--fi
--
--
--# GDB's datadir relocation
--
--gdbdatadir=${datadir}/gdb
--
--
--# Check whether --with-gdb-datadir was given.
--if test "${with_gdb_datadir+set}" = set; then :
--  withval=$with_gdb_datadir; gdbdatadir="${withval}"
--fi
--
--
--
--  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
--  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
--  ac_define_dir=`eval echo $gdbdatadir`
--  ac_define_dir=`eval echo $ac_define_dir`
--
--cat >>confdefs.h <<_ACEOF
--#define GDB_DATADIR "$ac_define_dir"
--_ACEOF
--
--
--
--if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
--  if test "x$prefix" = xNONE; then
--    test_prefix=/usr/local
--  else
--    test_prefix=$prefix
--  fi
--else
--  test_prefix=$exec_prefix
--fi
--
--case ${gdbdatadir} in
--  "${test_prefix}"|"${test_prefix}/"*|\
--  '${exec_prefix}'|'${exec_prefix}/'*)
--
--$as_echo "#define GDB_DATADIR_RELOCATABLE 1" >>confdefs.h
--
--  ;;
--esac
--GDB_DATADIR_PATH=${gdbdatadir}
--
--
--
--# Check whether --with-pythondir was given.
--if test "${with_pythondir+set}" = set; then :
--  withval=$with_pythondir; pythondir="${withval}"
--else
--  pythondir=no
--fi
--
--
--# If the user passed in a path, define it.  Otherwise, compute it at
--# runtime based on the possibly-relocatable datadir.
--if test "$pythondir" = "no"; then
--  pythondir='$(GDB_DATADIR_PATH)/python'
--else
--
--cat >>confdefs.h <<_ACEOF
--#define PYTHONDIR "$pythondir"
--_ACEOF
--
--fi
--
--
--
--
--
- subdirs="$subdirs doc testsuite"
- 
- 
-@@ -9290,10 +9290,10 @@ if test "$with_system_readline" = yes; t
-   # readline-6.0 started to use the name `_rl_echoing_p'.
-   # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- 
--  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
--$as_echo_n "checking for readline_echoing_p... " >&6; }
-   save_LIBS=$LIBS
-   LIBS="$LIBS $READLINE"
-+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
-+$as_echo_n "checking for readline_echoing_p... " >&6; }
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h.  */
- 
-@@ -9316,9 +9316,35 @@ $as_echo "#define readline_echoing_p _rl
- fi
- rm -f core conftest.err conftest.$ac_objext \
-     conftest$ac_exeext conftest.$ac_ext
--  LIBS="$save_LIBS"
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
- $as_echo "$READLINE_ECHOING_P" >&6; }
-+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
-+$as_echo_n "checking for _rl_caught_signal... " >&6; }
-+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+
-+int
-+main ()
-+{
-+extern int volatile _rl_caught_signal;
-+				    return _rl_caught_signal;
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_link "$LINENO"; then :
-+  READLINE_CAUGHT_SIGNAL=yes
-+
-+$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
-+
-+else
-+  READLINE_CAUGHT_SIGNAL=no
-+fi
-+rm -f core conftest.err conftest.$ac_objext \
-+    conftest$ac_exeext conftest.$ac_ext
-+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
-+$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
-+  LIBS="$save_LIBS"
- else
-   READLINE='$(READLINE_DIR)/libreadline.a'
-   READLINE_DEPS='$(READLINE)'

diff --git a/gdb-rhel5-gcc44.patch b/gdb-rhel5-gcc44.patch
index 15d34df..d761538 100644
--- a/gdb-rhel5-gcc44.patch
+++ b/gdb-rhel5-gcc44.patch
@@ -69,7 +69,7 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp
  }
  
 @@ -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} {

diff --git a/gdb-solib-memory-error-nonfatal.patch b/gdb-solib-memory-error-nonfatal.patch
new file mode 100644
index 0000000..f8d73d8
--- /dev/null
+++ b/gdb-solib-memory-error-nonfatal.patch
@@ -0,0 +1,41 @@
+[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@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@vmware.com>
+ 
+ 	* record.c (record_restore): Rename tmpu8 to rectype.

diff --git a/gdb-stale-related_breakpoint.patch b/gdb-stale-related_breakpoint.patch
deleted file mode 100644
index 65b94c4..0000000
--- a/gdb-stale-related_breakpoint.patch
+++ /dev/null
@@ -1,154 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2009-12/msg00364.html
-Subject: [patch] related_breakpoint stale ref crash fix
-
-Hi,
-
-getting occasional random:
- PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint still triggers
- PASS: gdb.threads/local-watch-wrong-thread.exp: let thread_function0 return
- PASS: gdb.threads/local-watch-wrong-thread.exp: breakpoint on thread_function0's caller
--PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
-+ERROR: Process no longer exists
-+UNRESOLVED: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
-
-It is even reproducible on HEAD using "input" file below and:
-	valgrind ../gdb -nx <input
-
-(gdb) (gdb) Breakpoint 6 at 0x400685: file ./gdb.threads/local-watch-wrong-thread.c, line 47.
-(gdb) ==31759== Invalid write of size 4
-==31759==    at 0x601A11: bpstat_check_breakpoint_conditions (breakpoint.c:3482)
-==31759==    by 0x601C70: bpstat_stop_status (breakpoint.c:3596)
-==31759==    by 0x65D228: handle_inferior_event (infrun.c:3589)
-==31759==    by 0x65A563: wait_for_inferior (infrun.c:2281)
-==31759==    by 0x659AA0: proceed (infrun.c:1883)
-==31759==    by 0x65300B: continue_1 (infcmd.c:668)
-==31759==    by 0x653282: continue_command (infcmd.c:760)
-==31759==    by 0x5C51D8: do_cfunc (cli-decode.c:67)
-==31759==    by 0x5C824F: cmd_func (cli-decode.c:1738)
-==31759==    by 0x48335A: execute_command (top.c:450)
-==31759==    by 0x67273E: command_handler (event-top.c:511)
-==31759==    by 0x672E53: command_line_handler (event-top.c:736)
-==31759==  Address 0xbbdc950 is 240 bytes inside a block of size 336 free'd
-==31759==    at 0x4A04D72: free (vg_replace_malloc.c:325)
-==31759==    by 0x486E4B: xfree (utils.c:1286)
-==31759==    by 0x60BC35: delete_breakpoint (breakpoint.c:8708)
-==31759==    by 0x60BDAF: delete_command (breakpoint.c:8765)
-==31759==    by 0x5C51D8: do_cfunc (cli-decode.c:67)
-==31759==    by 0x5C824F: cmd_func (cli-decode.c:1738)
-==31759==    by 0x48335A: execute_command (top.c:450)
-==31759==    by 0x67273E: command_handler (event-top.c:511)
-==31759==    by 0x672E53: command_line_handler (event-top.c:736)
-==31759==    by 0x672FCF: gdb_readline2 (event-top.c:817)
-==31759==    by 0x6725F7: stdin_event_handler (event-top.c:433)
-==31759==    by 0x670CDE: handle_file_event (event-loop.c:812)
-==31759== 
-
-Watchpoint 4 deleted because the program has left the block in
-which its expression is valid.
-
-
-There is already automatic deletion of RELATED_BREAKPOINT in
-map_breakpoint_numbers but "delete breakpoints" (for all the breakpoints)
-calls delete_breakpoint from delete_command directly without calling
-map_breakpoint_numbers and it does not delete the associated
-bp_watchpoint_scope.
-
-I find the attached patch is right for delete_breakpoint itself as such
-function should not leave stale references in the leftover data structures.
-How well could be other code cleaned up with this patch in place I have not
-targeted by this patch.
-
-
-The existing code expects accessibility of freed memory and discusses the
-current stale references problem:
-
-void
-delete_breakpoint (struct breakpoint *bpt)
-[...]
-  /* Has this bp already been deleted?  This can happen because multiple
-     lists can hold pointers to bp's.  bpstat lists are especial culprits.
-
-     One example of this happening is a watchpoint's scope bp.  When the
-     scope bp triggers, we notice that the watchpoint is out of scope, and
-     delete it.  We also delete its scope bp.  But the scope bp is marked
-     "auto-deleting", and is already on a bpstat.  That bpstat is then
-     checked for auto-deleting bp's, which are deleted.
-
-     A real solution to this problem might involve reference counts in bp's,
-     and/or giving them pointers back to their referencing bpstat's, and
-     teaching delete_breakpoint to only free a bp's storage when no more
-     references were extent.  A cheaper bandaid was chosen.  */
-  if (bpt->type == bp_none)
-    return;
-[...]
-  bpt->type = bp_none;
-
-  xfree (bpt);
-}
-
-
-While fixing this part may be difficult I find the attached patch easy enough
-fixing the IMO currently most common crash due to it.
-
-No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
-
-
-Thanks,
-Jan
-
-
-"input":
-set height 0
-set width 0
-set confirm no
-file ../testsuite/gdb.threads/local-watch-wrong-thread
-set can-use-hw-watchpoints 1
-break main
-run
-break local-watch-wrong-thread.c:36
-continue
-delete breakpoints
-watch *myp
-continue
-delete breakpoints
-echo MAKE watch\n
-watch *myp if trigger != 0
-echo MAKE break\n
-break local-watch-wrong-thread.c:60
-info break
-continue
-echo DELETE five\n
-delete 5
-set trigger=1
-continue
-set *myp=0
-break local-watch-wrong-thread.c:47
-continue
-
-
-
-2009-12-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	* breakpoint.c (delete_breakpoint <bpt->related_breakpoint != NULL>):
-	New.
-
---- a/gdb/breakpoint.c
-+++ b/gdb/breakpoint.c
-@@ -8649,6 +8649,16 @@ delete_breakpoint (struct breakpoint *bpt)
-   if (bpt->type == bp_none)
-     return;
- 
-+  /* At least avoid this stale reference until the reference counting of
-+     breakpoints gets resolved.  */
-+  if (bpt->related_breakpoint != NULL)
-+    {
-+      gdb_assert (bpt->related_breakpoint->related_breakpoint == bpt);
-+      bpt->related_breakpoint->disposition = disp_del_at_next_stop;
-+      bpt->related_breakpoint->related_breakpoint = NULL;
-+      bpt->related_breakpoint = NULL;
-+    }
-+
-   observer_notify_breakpoint_deleted (bpt->number);
- 
-   if (breakpoint_chain == bpt)
-

diff --git a/gdb-unwind-debughook-safe-fail.patch b/gdb-unwind-debughook-safe-fail.patch
new file mode 100644
index 0000000..c416b33
--- /dev/null
+++ b/gdb-unwind-debughook-safe-fail.patch
@@ -0,0 +1,46 @@
+commit 802214c97d1661ad337aad0d011dded44f0b5ddd
+Author: Tom Tromey <tromey@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;
++	}
+     }
+ }
+ 

diff --git a/gdb-unwind-debughook-step-independent.patch b/gdb-unwind-debughook-step-independent.patch
new file mode 100644
index 0000000..07bd2ba
--- /dev/null
+++ b/gdb-unwind-debughook-step-independent.patch
@@ -0,0 +1,235 @@
+commit f8ca03e0097ae49c66cf33a50e3247bccd3a4a33
+Author: Tom Tromey <tromey@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)
+ {

diff --git a/gdb-upstream.patch b/gdb-upstream.patch
new file mode 100644
index 0000000..b643ad6
--- /dev/null
+++ b/gdb-upstream.patch
@@ -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@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@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@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@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@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@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@redhat.com>
++
++	* symfile.c (addr_info_make_relative): Ignore also missing ".dynbss"
++	and ".sdynbss".  Update the comment.
++
+ 2010-03-15  Jie Zhang  <jie@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@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@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@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@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@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
++@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@redhat.com>
++
++	* gdb.base/break-entry.exp: New.
++
+ 2010-04-02  Hui Zhu  <teawater@gmail.com>
+             Michael Snyder <msnyder@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@codesourcery.com>
++	    Paul Pluzhnikov  <ppluzhnikov@google.com>
++	    Jan Kratochvil  <jan.kratochvil@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@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
++@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@redhat.com>
++
++	Fix deadlock on looped list of loaded shared objects.
++	* gdb.base/solib-corrupted.exp: New.
++
+ 2010-04-23  Doug Evans  <dje@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@redhat.com>
+ 
++	* linux-nat.c (linux_nat_core_of_thread_1): Fix crash on invalid
++	CONTENT.
++
++2010-05-28  Jan Kratochvil  <jan.kratochvil@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@redhat.com>
++
++	* linux-low.c (linux_core_of_thread): Fix crash on invalid CONTENT.
++	New comment.
++
+ 2010-05-26  Ozkan Sezer  <sezeroz@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@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@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 ();

diff --git a/gdb-using-directive-leak.patch b/gdb-using-directive-leak.patch
new file mode 100644
index 0000000..21faa91
--- /dev/null
+++ b/gdb-using-directive-leak.patch
@@ -0,0 +1,214 @@
+FSF GDB variant is at:
+http://sourceware.org/ml/gdb-patches/2010-03/msg00789.html
+
+commit 56b45f494f647360f9d6ff84f12f59c08cbe05af
+Author: Sami Wagiaalla <swagiaal@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:

diff --git a/gdb.spec b/gdb.spec
index ef8e93b..95c3e61 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -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.patch
 # 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-crash-test.patch
 # 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-test.patch
 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.patch
 # 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-full-prelinked.patch
 
 # 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-breakpoint-test.patch
 # 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 debug programs written in C, C++,
 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-exp.c gdb/p-exp.c
 
 %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-exp.c gdb/p-exp.c
 %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-exp.c gdb/p-exp.c
 %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-exp.c gdb/p-exp.c
 %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-exp.c gdb/p-exp.c
 %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-exp.c gdb/p-exp.c
 %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-exp.c gdb/p-exp.c
 # 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@redhat.com> - 7.1-28.fc14
+- Rebuild for Fedora 14.
+
+* Wed Jun 30 2010 Jan Kratochvil <jan.kratochvil@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@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@redhat.com> - 7.1-26.fc13
+- Backport DWARF-4 support (BZ 601887, Tom Tromey).
+
+* Wed Jun  9 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-25.fc13
+- Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla).
+
+* Tue Jun  1 2010 Jan Kratochvil <jan.kratochvil@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@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@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@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@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@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@redhat.com> - 7.1-18.fc13
+- Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey).
+
+* Tue Apr 27 2010 Jan Kratochvil <jan.kratochvil@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@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@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@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@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@redhat.com> - 7.1-12.fc13
+- Fix crash on trying to load invalid executable (BZ 581215).
+
+* Thu Apr  8 2010 Jan Kratochvil <jan.kratochvil@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@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@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@redhat.com> - 7.1-8.fc13
+- Fix breakpoint at *_start (BZ 162775, bugreport by John Reiser).
+
+* Sat Apr  3 2010 Jan Kratochvil <jan.kratochvil@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@redhat.com> - 7.1-6.fc13
+- Support AVX registers (BZ 578250).
+
+* Sat Apr  3 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1-5.fc13
+- Fix dangling displays in separate debuginfo (BZ 574483).
+
+* Wed Mar 31 2010 Jan Kratochvil <jan.kratochvil@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@redhat.com> - 7.1-3.fc13
+- [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla).
+
+* Mon Mar 29 2010 Jan Kratochvil <jan.kratochvil@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@redhat.com> - 7.1-1.fc13
+- Update to new FSF GDB release.
+
+* Mon Mar 15 2010 Jan Kratochvil <jan.kratochvil@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@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@redhat.com> - 7.0.90.20100306-22.fc13
+- Another License update.
+
+* Wed Mar 10 2010 Jan Kratochvil <jan.kratochvil@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@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@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@redhat.com> - 7.0.90.20100306-18.fc13
+- archer-jankratochvil-fedora13 commit: 59c35a31f0981a0f0b884b32c91ae6325b2126cd
+
+* Sun Feb 28 2010 Jan Kratochvil <jan.kratochvil@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@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@redhat.com> - 7.0.50.20100203-15.fc13
 - Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
 

diff --git a/sources b/sources
index 85caab6..9e405a8 100644
--- a/sources
+++ b/sources
@@ -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

                 reply	other threads:[~2026-06-27 23:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178260447924.1.14801182983511749382.rpms-gdb-ee681d3b2f9f@fedoraproject.org \
    --to=jkratoch@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox