public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: - iFort compat. - case insensitive DWARF not in lowercase (BZ 645773).
Date: Sat, 27 Jun 2026 23:54:45 GMT	[thread overview]
Message-ID: <178260448518.1.15990111169032872049.rpms-gdb-1bcf9b660433@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : 1bcf9b66043337ff64ba1a7a093256dc5682ff09
Author : Jan Kratochvil <jan.kratochvil@redhat.com>
Date   : 2010-11-16T05:54:18+01:00
Stats  : +6935/-419 in 41 file(s)
URL    : https://src.fedoraproject.org/rpms/gdb/c/1bcf9b66043337ff64ba1a7a093256dc5682ff09?branch=gdb-17.2-rebase-f44

Log:
- iFort compat. - case insensitive DWARF not in lowercase (BZ 645773).

---
diff --git a/.gitignore b/.gitignore
index 4b0e4b4..818b1e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-gdb-7.1.90.20100721.tar.bz2
+gdb-7.2.tar.bz2

diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch
index 100b877..2d99428 100644
--- a/gdb-6.3-gstack-20050411.patch
+++ b/gdb-6.3-gstack-20050411.patch
@@ -4,10 +4,11 @@
 	to install and uninstall.
 	* gstack.sh, gstack.1: New files.
 
-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 
+Index: gdb-7.2/gdb/Makefile.in
+===================================================================
+--- gdb-7.2.orig/gdb/Makefile.in	2010-09-03 09:37:55.000000000 +0200
++++ gdb-7.2/gdb/Makefile.in	2010-09-03 09:38:45.000000000 +0200
+@@ -1010,7 +1010,7 @@ install: all install-only 
  
  # The "install-only" target also installs the syscalls' XML files in
  # the system.
@@ -16,10 +17,11 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
  	transformed_name=`t='$(program_transform_name)'; \
  			  echo gdb | sed -e "$$t"` ; \
  		if test "x$$transformed_name" = x; then \
-@@ -1021,9 +1021,26 @@ install-tui:
- 			$(DESTDIR)$(man1dir) ; \
- 		$(INSTALL_DATA) $(srcdir)/gdb.1 \
- 			$(DESTDIR)$(man1dir)/$$transformed_name.1
+@@ -1046,7 +1046,25 @@ install-tui:
+ install-python:
+ 	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
+ 
+-uninstall: force $(CONFIG_UNINSTALL)
 +GSTACK=gstack
 +.PHONY: install-gstack
 +install-gstack:
@@ -37,14 +39,12 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
 +			$(DESTDIR)$(man1dir) ; \
 +		: $(INSTALL_DATA) $(srcdir)/gstack.1 \
 +			$(DESTDIR)$(man1dir)/$$transformed_name.1
- 
- 
--uninstall: force $(CONFIG_UNINSTALL)
++
 +uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
  	transformed_name=`t='$(program_transform_name)'; \
  			  echo gdb | sed -e $$t` ; \
  		if test "x$$transformed_name" = x; then \
-@@ -1045,6 +1062,17 @@ uninstall-tui:
+@@ -1068,6 +1086,17 @@ uninstall-tui:
  		fi ; \
  		rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
  		      $(DESTDIR)$(man1dir)/$$transformed_name.1
@@ -62,9 +62,10 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
  
  # The C++ name parser can be built standalone for testing.
  test-cp-name-parser.o: cp-name-parser.c
-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
+Index: gdb-7.2/gdb/gstack.sh
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/gstack.sh	2010-09-03 09:38:12.000000000 +0200
 @@ -0,0 +1,48 @@
 +#!/bin/sh
 +
@@ -114,8 +115,10 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
 +    -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
+Index: gdb-7.2/gdb/testsuite/gdb.base/gstack.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.base/gstack.exp	2010-09-03 09:38:12.000000000 +0200
 @@ -0,0 +1,71 @@
 +# Copyright (C) 2010 Free Software Foundation, Inc.
 +
@@ -188,8 +191,10 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
 +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
+Index: gdb-7.2/gdb/testsuite/gdb.base/gstack.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.base/gstack.c	2010-09-03 09:38:12.000000000 +0200
 @@ -0,0 +1,43 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +

diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch
index 0bdf948..7cdc0f7 100644
--- a/gdb-6.3-readnever-20050907.patch
+++ b/gdb-6.3-readnever-20050907.patch
@@ -13,8 +13,8 @@
 
 Index: gdb-7.1.90.20100721/gdb/doc/gdb.texinfo
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/doc/gdb.texinfo	2010-07-22 11:57:09.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/doc/gdb.texinfo	2010-07-22 11:57:34.000000000 +0200
+--- gdb-7.1.90.20100721.orig/gdb/doc/gdb.texinfo	2010-07-23 20:58:52.000000000 +0200
++++ gdb-7.1.90.20100721/gdb/doc/gdb.texinfo	2010-07-23 20:59:15.000000000 +0200
 @@ -998,6 +998,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.
@@ -30,8 +30,8 @@ Index: gdb-7.1.90.20100721/gdb/doc/gdb.texinfo
  @node Mode Options
 Index: gdb-7.1.90.20100721/gdb/main.c
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/main.c	2010-07-22 11:57:10.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/main.c	2010-07-22 11:57:49.000000000 +0200
+--- gdb-7.1.90.20100721.orig/gdb/main.c	2010-07-23 20:58:55.000000000 +0200
++++ gdb-7.1.90.20100721/gdb/main.c	2010-07-23 20:59:15.000000000 +0200
 @@ -391,6 +391,7 @@ captured_main (void *data)
        {"xdb", no_argument, &xdb_commands, 1},
        {"dbx", no_argument, &dbx_commands, 1},
@@ -50,8 +50,8 @@ Index: gdb-7.1.90.20100721/gdb/main.c
    --se=FILE          Use FILE as symbol file and executable file.\n\
 Index: gdb-7.1.90.20100721/gdb/symfile.c
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/symfile.c	2010-07-22 11:57:09.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/symfile.c	2010-07-22 11:57:34.000000000 +0200
+--- gdb-7.1.90.20100721.orig/gdb/symfile.c	2010-07-23 20:58:52.000000000 +0200
++++ gdb-7.1.90.20100721/gdb/symfile.c	2010-07-23 20:59:15.000000000 +0200
 @@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup (
  
  /* Global variables owned by this file */
@@ -62,17 +62,17 @@ Index: gdb-7.1.90.20100721/gdb/symfile.c
  
 Index: gdb-7.1.90.20100721/gdb/dwarf2read.c
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/dwarf2read.c	2010-07-22 11:57:10.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/dwarf2read.c	2010-07-22 11:58:05.000000000 +0200
-@@ -53,6 +53,7 @@
- #include "psympriv.h"
+--- gdb-7.1.90.20100721.orig/gdb/dwarf2read.c	2010-07-23 20:58:53.000000000 +0200
++++ gdb-7.1.90.20100721/gdb/dwarf2read.c	2010-07-23 20:59:26.000000000 +0200
+@@ -54,6 +54,7 @@
  #include "exceptions.h"
  #include "gdb_stat.h"
+ #include "completer.h"
 +#include "top.h"
  
  #include <fcntl.h>
  #include "gdb_string.h"
-@@ -1282,8 +1283,9 @@ dwarf2_has_info (struct objfile *objfile
+@@ -1283,8 +1284,9 @@ dwarf2_has_info (struct objfile *objfile
        bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
        dwarf2_per_objfile->objfile = objfile;
      }
@@ -87,7 +87,7 @@ Index: gdb-7.1.90.20100721/gdb/dwarf2read.c
 Index: gdb-7.1.90.20100721/gdb/top.h
 ===================================================================
 --- gdb-7.1.90.20100721.orig/gdb/top.h	2010-04-07 18:54:39.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/top.h	2010-07-22 11:57:34.000000000 +0200
++++ gdb-7.1.90.20100721/gdb/top.h	2010-07-23 20:59:15.000000000 +0200
 @@ -61,6 +61,7 @@ extern void set_prompt (char *);
  
  /* From random places.  */

diff --git a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
new file mode 100644
index 0000000..5807ace
--- /dev/null
+++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
@@ -0,0 +1,31 @@
+--- ./gdb/elfread.c	2010-10-14 17:07:45.000000000 +0200
++++ ./gdb/elfread.c	2010-10-14 17:06:30.000000000 +0200
+@@ -1382,6 +1382,18 @@ build_id_to_filename (struct build_id *b
+ #include <dlfcn.h>
+ #endif
+ 
++/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
++   librpm must not exit() an application on SIGINT
++
++   Enable or disable a signal handler.  SIGNUM: signal to enable (or disable
++   if negative).  HANDLER: sa_sigaction handler (or NULL to use
++   rpmsqHandler()).  Returns: no. of refs, -1 on error.  */
++int
++rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
++{
++  return 0;
++}
++
+ /* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
+    and avoid their duplicities during a single inferior run.  */
+ 
+--- ./gdb/proc-service.list	2010-05-28 20:50:30.000000000 +0200
++++ ./gdb/proc-service.list	2010-10-14 17:06:30.000000000 +0200
+@@ -37,4 +37,7 @@
+   ps_pstop;
+   ps_ptread;
+   ps_ptwrite;
++
++  /* gdb-6.6-buildid-locate-rpm.patch */
++  rpmsqEnable;
+ };

diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch
index e11fb3c..30832c6 100644
--- a/gdb-6.6-buildid-locate-rpm.patch
+++ b/gdb-6.6-buildid-locate-rpm.patch
@@ -1,7 +1,7 @@
-Index: gdb-7.1.90.20100721/gdb/event-top.c
+Index: gdb-7.2/gdb/event-top.c
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/event-top.c	2010-06-26 08:44:47.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/event-top.c	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/event-top.c	2010-06-26 08:44:47.000000000 +0200
++++ gdb-7.2/gdb/event-top.c	2010-10-06 22:39:32.000000000 +0200
 @@ -33,6 +33,7 @@
  #include "cli/cli-script.h"     /* for reset_command_nest_depth */
  #include "main.h"
@@ -28,10 +28,10 @@ Index: gdb-7.1.90.20100721/gdb/event-top.c
    /* Each interpreter has its own rules on displaying the command
       prompt.  */
    if (!current_interp_display_prompt_p ())
-Index: gdb-7.1.90.20100721/gdb/elfread.c
+Index: gdb-7.2/gdb/elfread.c
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/elfread.c	2010-07-22 11:58:14.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/elfread.c	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/elfread.c	2010-10-06 22:39:32.000000000 +0200
++++ gdb-7.2/gdb/elfread.c	2010-10-06 22:39:52.000000000 +0200
 @@ -42,6 +42,7 @@
  #include "gdbcore.h"
  #include "gdbcmd.h"
@@ -40,7 +40,7 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
  
  extern void _initialize_elfread (void);
  
-@@ -1371,8 +1372,353 @@ build_id_to_filename (struct build_id *b
+@@ -1371,8 +1372,361 @@ build_id_to_filename (struct build_id *b
    return retval;
  }
  
@@ -113,9 +113,17 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
 +# define rpmtsInitIterator_p rpmtsInitIterator
 +#endif	/* !DLOPEN_LIBRPM */
 +
-+  if (filename == NULL)
++  gdb_assert (filename != NULL);
++
++  if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
 +    return 0;
 +
++  if (filename[0] != '/')
++    {
++      warning (_("Ignoring non-absolute filename: <%s>"), filename);
++      return 0;
++    }
++
 +  if (!rpm_init_done)
 +    {
 +      static int init_tried;
@@ -395,7 +403,7 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
     avoidance.  */
  
  struct missing_filepair
-@@ -1426,11 +1772,17 @@ missing_filepair_change (void)
+@@ -1426,11 +1780,17 @@ missing_filepair_change (void)
        /* All their memory came just from missing_filepair_OBSTACK.  */
        missing_filepair_hash = NULL;
      }
@@ -413,7 +421,7 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
    missing_filepair_change ();
  }
  
-@@ -1497,14 +1849,34 @@ debug_print_missing (const char *binary,
+@@ -1497,14 +1857,35 @@ debug_print_missing (const char *binary,
  
    *slot = missing_filepair;
  
@@ -439,7 +447,8 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
 +	}
 +    }
 +  if (missing_exec != MISSING_EXEC_ENLISTED)
-+    if (missing_rpm_enlist (binary) == 0 && missing_rpm_enlist (debug) == 0)
++    if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
++	&& (debug == NULL || missing_rpm_enlist (debug) == 0))
 +#endif	/* HAVE_LIBRPM */
 +      {
 +	/* We do not collect and flush these messages as each such message
@@ -455,22 +464,23 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
  }
  
  static char *
-Index: gdb-7.1.90.20100721/gdb/symfile.h
+Index: gdb-7.2/gdb/symfile.h
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/symfile.h	2010-07-22 11:58:14.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/symfile.h	2010-07-22 11:58:24.000000000 +0200
-@@ -577,6 +577,7 @@ extern struct build_id *build_id_addr_ge
+--- gdb-7.2.orig/gdb/symfile.h	2010-10-06 22:39:32.000000000 +0200
++++ gdb-7.2/gdb/symfile.h	2010-10-06 22:39:52.000000000 +0200
+@@ -577,6 +577,8 @@ extern struct build_id *build_id_addr_ge
  extern char *build_id_to_filename (struct build_id *build_id,
  				   char **link_return, int add_debug_suffix);
  extern void debug_print_missing (const char *binary, const char *debug);
 +extern void debug_flush_missing (void);
++#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
  
  /* From dwarf2read.c */
  
-Index: gdb-7.1.90.20100721/gdb/testsuite/lib/gdb.exp
+Index: gdb-7.2/gdb/testsuite/lib/gdb.exp
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/testsuite/lib/gdb.exp	2010-07-22 11:58:14.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/testsuite/lib/gdb.exp	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/testsuite/lib/gdb.exp	2010-10-06 22:39:32.000000000 +0200
++++ gdb-7.2/gdb/testsuite/lib/gdb.exp	2010-10-06 22:39:32.000000000 +0200
 @@ -1359,7 +1359,7 @@ proc default_gdb_start { } {
  	    warning "Couldn't set the width to 0."
  	}
@@ -480,10 +490,10 @@ Index: gdb-7.1.90.20100721/gdb/testsuite/lib/gdb.exp
      send_gdb "set build-id-verbose 0\n"
      gdb_expect 10 {
  	-re "$gdb_prompt $" {
-Index: gdb-7.1.90.20100721/gdb/testsuite/lib/mi-support.exp
+Index: gdb-7.2/gdb/testsuite/lib/mi-support.exp
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/testsuite/lib/mi-support.exp	2010-07-22 11:58:14.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/testsuite/lib/mi-support.exp	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/testsuite/lib/mi-support.exp	2010-10-06 22:39:32.000000000 +0200
++++ gdb-7.2/gdb/testsuite/lib/mi-support.exp	2010-10-06 22:39:32.000000000 +0200
 @@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
  	    }
      	}
@@ -493,10 +503,10 @@ Index: gdb-7.1.90.20100721/gdb/testsuite/lib/mi-support.exp
      send_gdb "190-gdb-set build-id-verbose 0\n"
      gdb_expect 10 {
  	-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
-Index: gdb-7.1.90.20100721/gdb/tui/tui-interp.c
+Index: gdb-7.2/gdb/tui/tui-interp.c
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/tui/tui-interp.c	2010-05-18 00:21:43.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/tui/tui-interp.c	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/tui/tui-interp.c	2010-05-18 00:21:43.000000000 +0200
++++ gdb-7.2/gdb/tui/tui-interp.c	2010-10-06 22:39:32.000000000 +0200
 @@ -30,6 +30,7 @@
  #include "tui/tui.h"
  #include "tui/tui-io.h"
@@ -514,10 +524,10 @@ Index: gdb-7.1.90.20100721/gdb/tui/tui-interp.c
        /* Tell readline what the prompt to display is and what function
           it will need to call after a whole line is read. This also
           displays the first prompt.  */
-Index: gdb-7.1.90.20100721/gdb/aclocal.m4
+Index: gdb-7.2/gdb/aclocal.m4
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/aclocal.m4	2010-05-23 02:56:59.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/aclocal.m4	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/aclocal.m4	2010-05-23 02:56:59.000000000 +0200
++++ gdb-7.2/gdb/aclocal.m4	2010-10-06 22:39:32.000000000 +0200
 @@ -19,6 +19,162 @@ You have another version of autoconf.  I
  If you have problems, you may need to regenerate the build system entirely.
  To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -681,10 +691,10 @@ Index: gdb-7.1.90.20100721/gdb/aclocal.m4
  # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
  #
  # This file is free software; the Free Software Foundation
-Index: gdb-7.1.90.20100721/gdb/config.in
+Index: gdb-7.2/gdb/config.in
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/config.in	2010-07-22 11:57:09.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/config.in	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/config.in	2010-10-06 22:39:31.000000000 +0200
++++ gdb-7.2/gdb/config.in	2010-10-06 22:39:32.000000000 +0200
 @@ -46,6 +46,9 @@
  /* Define to BFD's default target vector. */
  #undef DEFAULT_BFD_VEC
@@ -705,10 +715,10 @@ Index: gdb-7.1.90.20100721/gdb/config.in
  /* Define if libunwind library is being used. */
  #undef HAVE_LIBUNWIND
  
-Index: gdb-7.1.90.20100721/gdb/configure
+Index: gdb-7.2/gdb/configure
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/configure	2010-07-22 11:57:09.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/configure	2010-07-22 11:59:13.000000000 +0200
+--- gdb-7.2.orig/gdb/configure	2010-10-06 22:39:31.000000000 +0200
++++ gdb-7.2/gdb/configure	2010-10-06 22:39:32.000000000 +0200
 @@ -679,6 +679,9 @@ REPORT_BUGS_TO
  PKGVERSION
  TARGET_OBS
@@ -1242,10 +1252,10 @@ Index: gdb-7.1.90.20100721/gdb/configure
  
  
  
-Index: gdb-7.1.90.20100721/gdb/configure.ac
+Index: gdb-7.2/gdb/configure.ac
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/configure.ac	2010-07-22 11:57:09.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/configure.ac	2010-07-22 11:59:04.000000000 +0200
+--- gdb-7.2.orig/gdb/configure.ac	2010-10-06 22:39:31.000000000 +0200
++++ gdb-7.2/gdb/configure.ac	2010-10-06 22:39:32.000000000 +0200
 @@ -152,6 +152,198 @@ else
  fi
  AC_SUBST(pythondir)
@@ -1445,10 +1455,10 @@ Index: gdb-7.1.90.20100721/gdb/configure.ac
  
  AC_CONFIG_SUBDIRS(doc testsuite)
  
-Index: gdb-7.1.90.20100721/gdb/acinclude.m4
+Index: gdb-7.2/gdb/acinclude.m4
 ===================================================================
---- gdb-7.1.90.20100721.orig/gdb/acinclude.m4	2010-05-27 05:40:45.000000000 +0200
-+++ gdb-7.1.90.20100721/gdb/acinclude.m4	2010-07-22 11:58:24.000000000 +0200
+--- gdb-7.2.orig/gdb/acinclude.m4	2010-05-27 05:40:45.000000000 +0200
++++ gdb-7.2/gdb/acinclude.m4	2010-10-06 22:39:32.000000000 +0200
 @@ -1,3 +1,5 @@
 +# serial 1
 +
@@ -1464,3 +1474,16 @@ Index: gdb-7.1.90.20100721/gdb/acinclude.m4
  # @defmac AC_PROG_CC_STDC
  # @maindex PROG_CC_STDC
  # @ovindex CC
+Index: gdb-7.2/gdb/corelow.c
+===================================================================
+--- gdb-7.2.orig/gdb/corelow.c	2010-10-06 22:39:39.000000000 +0200
++++ gdb-7.2/gdb/corelow.c	2010-10-06 22:39:52.000000000 +0200
+@@ -331,7 +331,7 @@ build_id_locate_exec (int from_tty)
+         symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
+     }
+   else
+-    debug_print_missing (_("the main executable file"), build_id_filename);
++    debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
+ 
+   do_cleanups (back_to);
+ 

diff --git a/gdb-6.8-bz457187-largefile-test.patch b/gdb-6.8-bz457187-largefile-test.patch
old mode 100755
new mode 100644

diff --git a/gdb-archer.patch b/gdb-archer.patch
index 6c8cd56..43fda9e 100644
--- a/gdb-archer.patch
+++ b/gdb-archer.patch
@@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
 http://sourceware.org/gdb/wiki/ArcherBranchManagement
 
 GIT snapshot:
-commit 202f4d0e3af8d8a8d7c0b408d9e0a8cb69f912b6
+commit 74fff58d0076fe97c6c99d65fa58126315266646
 
 branch `archer' - the merge of branches:
 archer-jankratochvil-vla
@@ -15,7 +15,7 @@ archer-tromey-optional-psymtab (cherry-picked from post-7.2 master)
 
 
 diff --git a/gdb/Makefile.in b/gdb/Makefile.in
-index 6dbb284..6133da3 100644
+index f07bc8b..3703dca 100644
 --- a/gdb/Makefile.in
 +++ b/gdb/Makefile.in
 @@ -169,6 +169,12 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
@@ -57,7 +57,7 @@ index 6dbb284..6133da3 100644
  
  # Header files that already have srcdir in them, or which are in objdir.
  
-@@ -1299,6 +1305,12 @@ stamp-h: $(srcdir)/config.in config.status
+@@ -1301,6 +1307,12 @@ stamp-h: $(srcdir)/config.in config.status
  	  CONFIG_LINKS= \
  	  $(SHELL) config.status
  
@@ -70,7 +70,7 @@ index 6dbb284..6133da3 100644
  config.status: $(srcdir)/configure configure.tgt configure.host
  	$(SHELL) config.status --recheck
  
-@@ -2022,6 +2034,10 @@ py-function.o: $(srcdir)/python/py-function.c
+@@ -2024,6 +2036,10 @@ py-function.o: $(srcdir)/python/py-function.c
  	$(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c
  	$(POSTCOMPILE)
  
@@ -81,7 +81,7 @@ index 6dbb284..6133da3 100644
  py-inferior.o: $(srcdir)/python/py-inferior.c
  	$(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-inferior.c
  	$(POSTCOMPILE)
-@@ -2070,6 +2086,36 @@ py-value.o: $(srcdir)/python/py-value.c
+@@ -2072,6 +2088,36 @@ py-value.o: $(srcdir)/python/py-value.c
  	$(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-value.c
  	$(POSTCOMPILE)
  
@@ -289,7 +289,7 @@ index 0348bf4..f01d0ee 100644
  
  /* Return the innermost stack frame executing inside of BLOCK,
 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
-index 4affe0a..584c68e 100644
+index 6a6864c..5df336d 100644
 --- a/gdb/breakpoint.c
 +++ b/gdb/breakpoint.c
 @@ -62,6 +62,7 @@
@@ -1349,7 +1349,7 @@ index 1fc457d..f4c846a 100644
  #undef PYTHON_PATH_RELOCATABLE
  
 diff --git a/gdb/configure b/gdb/configure
-index 94eb9b9..e49da08 100755
+index 041ffc1..8243abb 100755
 --- a/gdb/configure
 +++ b/gdb/configure
 @@ -679,6 +679,8 @@ REPORT_BUGS_TO
@@ -1454,17 +1454,16 @@ index 94eb9b9..e49da08 100755
  
  
  subdirs="$subdirs doc testsuite"
-@@ -10881,6 +10955,8 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h
-   CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
+@@ -10919,6 +10993,7 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h
    CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
    CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
-+  CONFIG_INSTALL="$CONFIG_INSTALL install-python"
+   CONFIG_INSTALL="$CONFIG_INSTALL install-python"
 +  CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python"
    ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
  
    # Flags needed to compile Python code (taken from python-config --cflags).
 diff --git a/gdb/configure.ac b/gdb/configure.ac
-index 9300544..380473a 100644
+index b69c3b6..4e89558 100644
 --- a/gdb/configure.ac
 +++ b/gdb/configure.ac
 @@ -108,6 +108,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat
@@ -1519,31 +1518,16 @@ index 9300544..380473a 100644
  AC_CONFIG_SUBDIRS(doc testsuite)
  
  # Check whether to support alternative target configurations
-@@ -828,6 +873,8 @@ if test "${have_libpython}" != no; then
-   CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
+@@ -833,6 +878,7 @@ if test "${have_libpython}" != no; then
    CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
    CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
-+  CONFIG_INSTALL="$CONFIG_INSTALL install-python"
+   CONFIG_INSTALL="$CONFIG_INSTALL install-python"
 +  CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python"
    ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
  
    # Flags needed to compile Python code (taken from python-config --cflags).
-diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
-index 04f1683..a2a6e30 100644
---- a/gdb/doc/ChangeLog
-+++ b/gdb/doc/ChangeLog
-@@ -1,5 +1,9 @@
- 2010-07-13  Tom Tromey  <tromey@redhat.com>
- 
-+	* gdb.texinfo (Index Files): New node.
-+
-+2010-07-13  Tom Tromey  <tromey@redhat.com>
-+
- 	* gdb.texinfo (GDB/MI Variable Objects): Remove extra 'for'.
- 
- 2010-07-01  Pedro Alves  <pedro@codesourcery.com>
 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
-index 1297175..c030b65 100644
+index 65d4899..96767b0 100644
 --- a/gdb/doc/gdb.texinfo
 +++ b/gdb/doc/gdb.texinfo
 @@ -1162,6 +1162,16 @@ for remote debugging.
@@ -1563,7 +1547,7 @@ index 1297175..c030b65 100644
  @c resolve the situation of these eventually
  @item -tui
  @cindex @code{--tui}
-@@ -14282,6 +14292,7 @@ program.  To debug a core dump of a previous run, you must also tell
+@@ -14308,6 +14318,7 @@ program.  To debug a core dump of a previous run, you must also tell
  @menu
  * Files::                       Commands to specify files
  * Separate Debug Files::        Debugging information in separate files
@@ -1571,7 +1555,7 @@ index 1297175..c030b65 100644
  * Symbol Errors::               Errors reading symbol files
  * Data Files::                  GDB data files
  @end menu
-@@ -15171,6 +15182,46 @@ gnu_debuglink_crc32 (unsigned long crc,
+@@ -15197,6 +15208,46 @@ gnu_debuglink_crc32 (unsigned long crc,
  This computation does not apply to the ``build ID'' method.
  
  
@@ -1618,7 +1602,7 @@ index 1297175..c030b65 100644
  @node Symbol Errors
  @section Errors Reading Symbol Files
  
-@@ -20310,8 +20361,6 @@ containing @code{end}.  For example:
+@@ -20349,8 +20400,6 @@ containing @code{end}.  For example:
  
  @smallexample
  (@value{GDBP}) python
@@ -1627,7 +1611,7 @@ index 1297175..c030b65 100644
  >print 23
  >end
  23
-@@ -20324,6 +20373,14 @@ in a Python script.  This can be controlled using @code{maint set
+@@ -20363,6 +20412,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.
@@ -1642,7 +1626,7 @@ index 1297175..c030b65 100644
  @end table
  
  It is also possible to execute a Python script from the @value{GDBN}
-@@ -20345,6 +20402,14 @@ and thus is always available.
+@@ -20384,6 +20441,14 @@ and thus is always available.
  @cindex python api
  @cindex programming in python
  
@@ -1657,7 +1641,7 @@ index 1297175..c030b65 100644
  @cindex python stdout
  @cindex python pagination
  At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
-@@ -20356,7 +20421,7 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
+@@ -20395,7 +20460,7 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
  @menu
  * Basic Python::                Basic Python Functions.
  * Exception Handling::
@@ -1666,7 +1650,7 @@ index 1297175..c030b65 100644
  * Types In Python::             Python representation of types.
  * Pretty Printing API::         Pretty-printing values.
  * Selecting Pretty-Printers::   How GDB chooses a pretty-printer.
-@@ -20415,6 +20480,12 @@ Return a sequence holding all of @value{GDBN}'s breakpoints.
+@@ -20456,6 +20521,12 @@ Return a sequence holding all of @value{GDBN}'s breakpoints.
  @xref{Breakpoints In Python}, for more information.
  @end defun
  
@@ -1679,7 +1663,7 @@ index 1297175..c030b65 100644
  @findex gdb.parameter
  @defun parameter parameter
  Return the value of a @value{GDBN} parameter.  @var{parameter} is a
-@@ -20431,6 +20502,7 @@ a Python value of the appropriate type, and returned.
+@@ -20472,6 +20543,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.
@@ -1687,7 +1671,7 @@ index 1297175..c030b65 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
-@@ -20455,6 +20527,21 @@ compute values, for example, it is the only way to get the value of a
+@@ -20496,6 +20568,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
  
@@ -1894,7 +1878,7 @@ index 61b8f00..d94c03c 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 2a8e557..be74412 100644
+index f59bc40..7ff0ef9 100644
 --- a/gdb/dwarf2loc.c
 +++ b/gdb/dwarf2loc.c
 @@ -48,6 +48,12 @@ static void
@@ -2172,7 +2156,7 @@ index 2a8e557..be74412 100644
  	    retval = allocate_value (type);
  	    VALUE_LVAL (retval) = lval_memory;
  	    set_value_lazy (retval, 1);
-@@ -2586,11 +2744,51 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
+@@ -2590,11 +2748,51 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
  			 dlbaton->per_cu);
  }
  
@@ -2246,19 +2230,20 @@ index 826bc45..1e7d8dc 100644
  
  #endif /* dwarf2loc.h */
 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
-index 16381de..31a7d83 100644
+index 1e75235..d54e266 100644
 --- a/gdb/dwarf2read.c
 +++ b/gdb/dwarf2read.c
-@@ -51,6 +51,8 @@
+@@ -51,6 +51,9 @@
  #include "typeprint.h"
  #include "jv-lang.h"
  #include "psympriv.h"
 +#include "exceptions.h"
 +#include "gdb_stat.h"
++#include "completer.h"
  
  #include <fcntl.h>
  #include "gdb_string.h"
-@@ -129,6 +131,33 @@ struct dwarf2_section_info
+@@ -129,6 +132,33 @@ struct dwarf2_section_info
    int readin;
  };
  
@@ -2292,7 +2277,7 @@ index 16381de..31a7d83 100644
  struct dwarf2_per_objfile
  {
    struct dwarf2_section_info info;
-@@ -141,6 +170,7 @@ struct dwarf2_per_objfile
+@@ -141,6 +171,7 @@ struct dwarf2_per_objfile
    struct dwarf2_section_info types;
    struct dwarf2_section_info frame;
    struct dwarf2_section_info eh_frame;
@@ -2300,7 +2285,7 @@ index 16381de..31a7d83 100644
  
    /* Back link.  */
    struct objfile *objfile;
-@@ -163,6 +193,12 @@ struct dwarf2_per_objfile
+@@ -163,6 +194,12 @@ struct dwarf2_per_objfile
    /* A flag indicating wether this objfile has a section loaded at a
       VMA of 0.  */
    int has_section_at_zero;
@@ -2313,7 +2298,7 @@ index 16381de..31a7d83 100644
  };
  
  static struct dwarf2_per_objfile *dwarf2_per_objfile;
-@@ -182,6 +218,7 @@ static struct dwarf2_per_objfile *dwarf2_per_objfile;
+@@ -182,6 +219,7 @@ static struct dwarf2_per_objfile *dwarf2_per_objfile;
  #define TYPES_SECTION    "debug_types"
  #define FRAME_SECTION    "debug_frame"
  #define EH_FRAME_SECTION "eh_frame"
@@ -2321,7 +2306,7 @@ index 16381de..31a7d83 100644
  
  /* local data types */
  
-@@ -307,6 +344,32 @@ struct dwarf2_cu
+@@ -307,6 +345,32 @@ struct dwarf2_cu
    unsigned int has_namespace_info : 1;
  };
  
@@ -2354,7 +2339,7 @@ index 16381de..31a7d83 100644
  /* Persistent data held for a compilation unit, even when not
     processing it.  We put a pointer to this structure in the
     read_symtab_private field of the psymtab.  If we encounter
-@@ -347,10 +410,21 @@ struct dwarf2_per_cu_data
+@@ -347,10 +411,21 @@ struct dwarf2_per_cu_data
       it.  */
    htab_t type_hash;
  
@@ -2380,7 +2365,7 @@ index 16381de..31a7d83 100644
  };
  
  /* Entry in the signatured_types hash table.  */
-@@ -1083,6 +1157,9 @@ static int attr_form_is_section_offset (struct attribute *);
+@@ -1083,6 +1158,9 @@ static int attr_form_is_section_offset (struct attribute *);
  
  static int attr_form_is_constant (struct attribute *);
  
@@ -2390,7 +2375,7 @@ index 16381de..31a7d83 100644
  static void dwarf2_symbol_mark_computed (struct attribute *attr,
  					 struct symbol *sym,
  					 struct dwarf2_cu *cu);
-@@ -1113,6 +1190,9 @@ static void age_cached_comp_units (void);
+@@ -1113,6 +1191,9 @@ static void age_cached_comp_units (void);
  
  static void free_one_cached_comp_unit (void *);
  
@@ -2400,7 +2385,7 @@ index 16381de..31a7d83 100644
  static struct type *set_die_type (struct die_info *, struct type *,
  				  struct dwarf2_cu *);
  
-@@ -1132,6 +1212,56 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
+@@ -1132,6 +1213,56 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
  
  static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu);
  
@@ -2457,7 +2442,7 @@ index 16381de..31a7d83 100644
  /* Try to locate the sections we need for DWARF 2 debugging
     information and return true if we have enough to do something.  */
  
-@@ -1230,6 +1360,11 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
+@@ -1230,6 +1361,11 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
        dwarf2_per_objfile->types.asection = sectp;
        dwarf2_per_objfile->types.size = bfd_get_section_size (sectp);
      }
@@ -2469,17 +2454,13 @@ index 16381de..31a7d83 100644
  
    if ((bfd_get_section_flags (abfd, sectp) & SEC_LOAD)
        && bfd_section_vma (abfd, sectp) == 0)
-@@ -1349,91 +1484,944 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
-         }
-     }
+@@ -1353,87 +1489,940 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+   if (pagesize == 0)
+     pagesize = getpagesize ();
  
--#ifdef HAVE_MMAP
--  if (pagesize == 0)
--    pagesize = getpagesize ();
-+#ifdef HAVE_MMAP
-+  if (pagesize == 0)
-+    pagesize = getpagesize ();
-+
+-  /* Only try to mmap sections which are large enough: we don't want to
+-     waste space due to fragmentation.  Also, only try mmap for sections
+-     without relocations.  */
 +  /* Only try to mmap sections which are large enough: we don't want to
 +     waste space due to fragmentation.  Also, only try mmap for sections
 +     without relocations.  */
@@ -3296,13 +3277,10 @@ index 16381de..31a7d83 100644
 +  offset_type iter;
 +  dw2_setup (objfile);
  
--  /* Only try to mmap sections which are large enough: we don't want to
--     waste space due to fragmentation.  Also, only try mmap for sections
--     without relocations.  */
+-  if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0)
 +  if (!dwarf2_per_objfile->index_table)
 +    return;
- 
--  if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0)
++
 +  for (iter = 0;
 +       iter < dwarf2_per_objfile->index_table->index_table_slots;
 +       ++iter)
@@ -3479,7 +3457,15 @@ index 16381de..31a7d83 100644
  /* Build a partial symbol table.  */
  
  void
-@@ -1897,7 +2885,7 @@ process_psymtab_comp_unit (struct objfile *objfile,
+@@ -1699,6 +2688,7 @@ create_debug_types_hash_table (struct objfile *objfile)
+       type_sig->signature = signature;
+       type_sig->offset = offset;
+       type_sig->type_offset = type_offset;
++      type_sig->per_cu.objfile = objfile;
+ 
+       slot = htab_find_slot (types_htab, type_sig, INSERT);
+       gdb_assert (slot != NULL);
+@@ -1897,7 +2887,7 @@ process_psymtab_comp_unit (struct objfile *objfile,
    /* Store the function that reads in the rest of the symbol table */
    pst->read_symtab = dwarf2_psymtab_to_symtab;
  
@@ -3488,7 +3474,7 @@ index 16381de..31a7d83 100644
  
    dwarf2_find_base_address (comp_unit_die, &cu);
  
-@@ -2182,6 +3170,7 @@ create_all_comp_units (struct objfile *objfile)
+@@ -2182,6 +3172,7 @@ create_all_comp_units (struct objfile *objfile)
        memset (this_cu, 0, sizeof (*this_cu));
        this_cu->offset = offset;
        this_cu->length = length + initial_length_size;
@@ -3496,7 +3482,7 @@ index 16381de..31a7d83 100644
  
        if (n_comp_units == n_allocated)
  	{
-@@ -2613,7 +3602,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
+@@ -2613,7 +3604,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
  	      addrmap_set_empty (objfile->psymtabs_addrmap,
  				 pdi->lowpc + baseaddr,
  				 pdi->highpc - 1 + baseaddr,
@@ -3505,7 +3491,7 @@ index 16381de..31a7d83 100644
  	    }
            if (!pdi->is_declaration)
  	    /* Ignore subprogram DIEs that do not have a name, they are
-@@ -2885,7 +3874,6 @@ locate_pdi_sibling (struct partial_die_info *orig_pdi,
+@@ -2885,7 +3876,6 @@ locate_pdi_sibling (struct partial_die_info *orig_pdi,
  static void
  dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
  {
@@ -3513,7 +3499,7 @@ index 16381de..31a7d83 100644
    if (pst != NULL)
      {
        if (pst->readin)
-@@ -2958,7 +3946,9 @@ process_queue (struct objfile *objfile)
+@@ -2958,7 +3948,9 @@ process_queue (struct objfile *objfile)
       may load a new CU, adding it to the end of the queue.  */
    for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
      {
@@ -3524,7 +3510,7 @@ index 16381de..31a7d83 100644
  	process_full_comp_unit (item->per_cu);
  
        item->per_cu->queued = 0;
-@@ -3035,22 +4025,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
+@@ -3035,22 +4027,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
        return;
      }
  
@@ -3548,7 +3534,7 @@ index 16381de..31a7d83 100644
  }
  
  /* Load the DIEs associated with PER_CU into memory.  */
-@@ -3130,9 +4105,8 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu, struct objfile *objfile)
+@@ -3130,9 +4107,8 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu, struct objfile *objfile)
  static void
  process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
  {
@@ -3559,7 +3545,7 @@ index 16381de..31a7d83 100644
    CORE_ADDR lowpc, highpc;
    struct symtab *symtab;
    struct cleanup *back_to;
-@@ -3165,8 +4139,15 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
+@@ -3165,8 +4141,15 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
      {
        symtab->language = cu->language;
      }
@@ -3577,7 +3563,7 @@ index 16381de..31a7d83 100644
  
    do_cleanups (back_to);
  }
-@@ -3559,6 +4540,46 @@ free_cu_line_header (void *arg)
+@@ -3557,6 +4540,46 @@ free_cu_line_header (void *arg)
  }
  
  static void
@@ -3624,7 +3610,7 @@ index 16381de..31a7d83 100644
  read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
  {
    struct objfile *objfile = cu->objfile;
-@@ -3584,35 +4605,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3582,35 +4605,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
    lowpc += baseaddr;
    highpc += baseaddr;
  
@@ -3661,7 +3647,7 @@ index 16381de..31a7d83 100644
  
    attr = dwarf2_attr (die, DW_AT_language, cu);
    if (attr)
-@@ -5531,6 +6524,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5529,6 +6524,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
    new_symbol (die, this_type, cu);
  }
  
@@ -3691,7 +3677,7 @@ index 16381de..31a7d83 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.  */
-@@ -5544,7 +6560,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5542,7 +6560,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;
@@ -3700,7 +3686,7 @@ index 16381de..31a7d83 100644
    struct cleanup *back_to;
    char *name;
  
-@@ -5597,17 +6613,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5595,17 +6613,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)
@@ -3723,7 +3709,7 @@ index 16381de..31a7d83 100644
  
    /* Understand Dwarf2 support for vector types (like they occur on
       the PowerPC w/ AltiVec).  Gcc just adds another attribute to the
-@@ -6061,29 +7071,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -6059,29 +7071,114 @@ 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;
@@ -3852,7 +3838,7 @@ index 16381de..31a7d83 100644
    char_type = language_string_char_type (cu->language_defn, gdbarch);
    type = create_string_type (NULL, char_type, range_type);
  
-@@ -6326,60 +7421,136 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -6324,60 +7421,136 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
    struct type *base_type;
    struct type *range_type;
    struct attribute *attr;
@@ -4023,7 +4009,7 @@ index 16381de..31a7d83 100644
      }
  
    /* Dwarf-2 specifications explicitly allows to create subrange types
-@@ -6421,20 +7592,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -6419,20 +7592,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
  	}
      }
  
@@ -4077,7 +4063,7 @@ index 16381de..31a7d83 100644
  
    name = dwarf2_name (die, cu);
    if (name)
-@@ -8714,10 +9906,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
+@@ -8712,10 +9906,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
@@ -4092,7 +4078,7 @@ index 16381de..31a7d83 100644
  }
  
  /* Given a pointer to a DWARF information entry, figure out if we need
-@@ -8748,6 +9942,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8746,6 +9942,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  					     sizeof (struct symbol));
        OBJSTAT (objfile, n_syms++);
        memset (sym, 0, sizeof (struct symbol));
@@ -4101,7 +4087,7 @@ index 16381de..31a7d83 100644
  
        /* Cache this symbol's name and the name's demangled form (if any).  */
        SYMBOL_LANGUAGE (sym) = cu->language;
-@@ -9379,6 +10575,9 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -9375,6 +10573,9 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
        break;
      }
  
@@ -4111,7 +4097,7 @@ index 16381de..31a7d83 100644
    return this_type;
  }
  
-@@ -11983,67 +13182,102 @@ attr_form_is_constant (struct attribute *attr)
+@@ -11979,67 +13180,102 @@ attr_form_is_constant (struct attribute *attr)
      }
  }
  
@@ -4263,7 +4249,7 @@ index 16381de..31a7d83 100644
      }
  }
  
-@@ -12054,7 +13288,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+@@ -12050,7 +13286,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
  struct objfile *
  dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu)
  {
@@ -4272,7 +4258,7 @@ index 16381de..31a7d83 100644
  
    /* Return the master objfile, so that we can report and look up the
       correct file containing this variable.  */
-@@ -12074,7 +13308,7 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
+@@ -12070,7 +13306,7 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
    else
      {
        /* If the CU is not currently read in, we re-read its header.  */
@@ -4281,7 +4267,7 @@ index 16381de..31a7d83 100644
        struct dwarf2_per_objfile *per_objfile
  	= objfile_data (objfile, dwarf2_objfile_data_key);
        gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
-@@ -12096,7 +13330,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
+@@ -12092,7 +13328,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
    else
      {
        /* If the CU is not currently read in, we re-read its header.  */
@@ -4290,7 +4276,7 @@ index 16381de..31a7d83 100644
        struct dwarf2_per_objfile *per_objfile
  	= objfile_data (objfile, dwarf2_objfile_data_key);
        gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
-@@ -12116,7 +13350,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
+@@ -12112,7 +13348,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
  CORE_ADDR
  dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu)
  {
@@ -4299,7 +4285,7 @@ index 16381de..31a7d83 100644
  
    return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  }
-@@ -12338,6 +13572,30 @@ dwarf2_free_objfile (struct objfile *objfile)
+@@ -12334,6 +13570,30 @@ dwarf2_free_objfile (struct objfile *objfile)
    /* Cached DIE trees use xmalloc and the comp_unit_obstack.  */
    free_cached_comp_units (NULL);
  
@@ -4330,7 +4316,7 @@ index 16381de..31a7d83 100644
    /* Everything else should be on the objfile obstack.  */
  }
  
-@@ -12372,6 +13630,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
+@@ -12368,6 +13628,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
    return ofs_lhs->offset == ofs_rhs->offset;
  }
  
@@ -4362,7 +4348,7 @@ index 16381de..31a7d83 100644
  /* Set the type associated with DIE to TYPE.  Save it in CU's hash
     table if necessary.  For convenience, return TYPE.
  
-@@ -12395,6 +13678,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -12391,6 +13676,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  {
    struct dwarf2_offset_and_type **slot, ofs;
  
@@ -4371,8 +4357,8 @@ index 16381de..31a7d83 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
-@@ -12592,8 +13877,567 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
-   munmap_section_buffer (&data->loc);
+@@ -12591,8 +13878,567 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
+   munmap_section_buffer (&data->types);
    munmap_section_buffer (&data->frame);
    munmap_section_buffer (&data->eh_frame);
 +  munmap_section_buffer (&data->gdb_index);
@@ -4537,8 +4523,8 @@ index 16381de..31a7d83 100644
 +	return &symtab->data[index];
 +      index = (index + step) & (symtab->size - 1);
 +    }
-+}
-+
+ }
+ 
 +/* Expand SYMTAB's hash table.  */
 +static void
 +hash_expand (struct mapped_symtab *symtab)
@@ -4907,7 +4893,7 @@ index 16381de..31a7d83 100644
 +  struct objfile *objfile;
 +
 +  if (!arg || !*arg)
-+    error (_("usage: maintenance save-gdb-index DIRECTORY"));
++    error (_("usage: save gdb-index DIRECTORY"));
 +
 +  ALL_OBJFILES (objfile)
 +  {
@@ -4932,21 +4918,31 @@ index 16381de..31a7d83 100644
 +			     objfile->name);
 +      }
 +  }
- }
- 
++}
++
 +\f
 +
  int dwarf2_always_disassemble;
  
  static void
-@@ -12657,4 +14501,8 @@ The value is the maximum depth to print."),
+@@ -12609,6 +14455,8 @@ void _initialize_dwarf2_read (void);
+ void
+ _initialize_dwarf2_read (void)
+ {
++  struct cmd_list_element *c;
++
+   dwarf2_objfile_data_key
+     = register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free);
+ 
+@@ -12656,4 +14504,9 @@ The value is the maximum depth to print."),
  			    NULL,
  			    NULL,
  			    &setdebuglist, &showdebuglist);
 +
-+  add_cmd ("gdb-index", class_files, save_gdb_index_command,
-+	   _("Save a .gdb-index file"),
-+	   &save_cmdlist);
++  c = add_cmd ("gdb-index", class_files, save_gdb_index_command,
++	       _("Save a .gdb-index file"),
++	       &save_cmdlist);
++  set_cmd_completer (c, filename_completer);
  }
 diff --git a/gdb/elfread.c b/gdb/elfread.c
 index 8c00938..a250c58 100644
@@ -6113,7 +6109,7 @@ index e0ca12c..de6311a 100644
    else
      {
 diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h
-index 6a230c0..d87a813 100644
+index 78151dd..da11686 100644
 --- a/gdb/gdbcmd.h
 +++ b/gdb/gdbcmd.h
 @@ -124,6 +124,10 @@ extern struct cmd_list_element *setchecklist;
@@ -6125,8 +6121,8 @@ index 6a230c0..d87a813 100644
 +extern struct cmd_list_element *save_cmdlist;
 +
  extern void execute_command (char *, int);
+ extern char *execute_command_to_string (char *p, int from_tty);
  
- enum command_control_type execute_control_command (struct command_line *);
 diff --git a/gdb/gdbinit.in b/gdb/gdbinit.in
 index ffb7f53..a2e7e94 100644
 --- a/gdb/gdbinit.in
@@ -7708,7 +7704,7 @@ index 5abec68..e309277 100644
  
  extern void notice_new_inferior (ptid_t, int, int);
 diff --git a/gdb/infrun.c b/gdb/infrun.c
-index 57f2ab8..5762a7f 100644
+index 54b1d9f..58d045a 100644
 --- a/gdb/infrun.c
 +++ b/gdb/infrun.c
 @@ -45,6 +45,8 @@
@@ -8592,7 +8588,7 @@ index bb79ae1..fbbd600 100644
 +
  #endif /* PARSER_DEFS_H */
 diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
-index e8d96f6..8bf097c 100644
+index 18ddee7..652b02a 100644
 --- a/gdb/ppc-linux-nat.c
 +++ b/gdb/ppc-linux-nat.c
 @@ -2010,6 +2010,24 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
@@ -8675,7 +8671,7 @@ index 5ffa099..58d9c79 100644
 +  observer_attach_mark_used (print_types_mark_used);
  }
 diff --git a/gdb/psymtab.c b/gdb/psymtab.c
-index 367cf1e..c120894 100644
+index 97a4eec..fce19c9 100644
 --- a/gdb/psymtab.c
 +++ b/gdb/psymtab.c
 @@ -421,6 +421,14 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
@@ -10341,7 +10337,7 @@ index 2b8d301..0af99c8 100644
  
  extern PyObject *gdbpy_gdberror_exc;
 diff --git a/gdb/python/python.c b/gdb/python/python.c
-index 6680126..2eee31f 100644
+index 7346fba..34708c4 100644
 --- a/gdb/python/python.c
 +++ b/gdb/python/python.c
 @@ -28,6 +28,7 @@
@@ -10370,7 +10366,7 @@ index 6680126..2eee31f 100644
  
  static PyMethodDef GdbMethods[];
  
-@@ -413,6 +421,105 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
+@@ -374,6 +382,105 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
    Py_RETURN_NONE;
  }
  
@@ -10476,7 +10472,7 @@ index 6680126..2eee31f 100644
  /* Parse a string and evaluate it as an expression.  */
  static PyObject *
  gdbpy_parse_and_eval (PyObject *self, PyObject *args)
-@@ -453,6 +560,114 @@ source_python_script (FILE *stream, const char *file)
+@@ -414,6 +521,114 @@ source_python_script (FILE *stream, const char *file)
  
  \f
  
@@ -10591,7 +10587,7 @@ index 6680126..2eee31f 100644
  /* Printing.  */
  
  /* A python function to write a single string using gdb's filtered
-@@ -498,6 +713,53 @@ gdbpy_print_stack (void)
+@@ -459,6 +674,53 @@ gdbpy_print_stack (void)
  
  /* Return the current Progspace.
     There always is one.  */
@@ -10645,7 +10641,7 @@ index 6680126..2eee31f 100644
  
  static PyObject *
  gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
-@@ -759,6 +1021,7 @@ Enables or disables printing of Python stack traces."),
+@@ -720,6 +982,7 @@ Enables or disables printing of Python stack traces."),
    gdbpy_initialize_lazy_string ();
    gdbpy_initialize_thread ();
    gdbpy_initialize_inferior ();
@@ -10653,7 +10649,7 @@ index 6680126..2eee31f 100644
  
    PyRun_SimpleString ("import gdb");
    PyRun_SimpleString ("gdb.pretty_printers = []");
-@@ -826,6 +1089,8 @@ static PyMethodDef GdbMethods[] =
+@@ -787,6 +1050,8 @@ static PyMethodDef GdbMethods[] =
      "Get a value from history" },
    { "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS,
      "Execute a gdb command" },
@@ -10662,13 +10658,13 @@ index 6680126..2eee31f 100644
    { "parameter", gdbpy_parameter, METH_VARARGS,
      "Return a gdb parameter's value" },
  
-@@ -864,11 +1129,21 @@ a boolean indicating if name is a field of the current implied argument\n\
+@@ -825,11 +1090,21 @@ a boolean indicating if name is a field of the current implied argument\n\
  `this' (when the current language is object-oriented)." },
    { "block_for_pc", gdbpy_block_for_pc, METH_VARARGS,
      "Return the block containing the given pc value, or None." },
-+  { "solib_address (Long) -> String.\n\
++  { "solib_address", gdbpy_solib_address, METH_VARARGS,
++    "solib_address (Long) -> String.\n\
 +Return the name of the shared library holding a given address, or None." },
-+
 +  { "decode_line", gdbpy_decode_line, METH_VARARGS,
 +    "Decode a string argument the way that 'break' or 'edit' does.\n\
 +Return a tuple holding the file name (or None) and line number (or None).\n\
@@ -10712,7 +10708,7 @@ index 1f135d4..489838d 100644
  
  /* Given an executable's ABFD and target, compute the entry-point
 diff --git a/gdb/symfile.c b/gdb/symfile.c
-index ab51fa4..babe9cf 100644
+index 42f7ae3..371db0d 100644
 --- a/gdb/symfile.c
 +++ b/gdb/symfile.c
 @@ -1059,6 +1059,9 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
@@ -10734,7 +10730,7 @@ index ab51fa4..babe9cf 100644
      {
        if (from_tty || info_verbose)
  	{
-@@ -1535,7 +1538,7 @@ symbol_file_command (char *args, int from_tty)
+@@ -1533,7 +1536,7 @@ symbol_file_command (char *args, int from_tty)
  void
  set_initial_language (void)
  {
@@ -10743,7 +10739,7 @@ index ab51fa4..babe9cf 100644
    enum language lang = language_unknown;
  
    filename = find_main_filename ();
-@@ -2662,7 +2665,7 @@ init_filename_language_table (void)
+@@ -2660,7 +2663,7 @@ init_filename_language_table (void)
  }
  
  enum language
@@ -10804,7 +10800,7 @@ index 62e6b97..00dc613 100644
  	  ms_type = 'S';
  	  break;
 diff --git a/gdb/symtab.c b/gdb/symtab.c
-index 9472c24..c3b1792 100644
+index 2c4c9e4..28f0450 100644
 --- a/gdb/symtab.c
 +++ b/gdb/symtab.c
 @@ -1295,16 +1295,25 @@ lookup_symbol_aux_symtabs (int block_index, const char *name,
@@ -10973,7 +10969,7 @@ index bedc10a..dc284e4 100644
  /* symtab.c */
  
 diff --git a/gdb/target.c b/gdb/target.c
-index 862df4e..a8f1bdd 100644
+index 4cabcbd..34b3b60 100644
 --- a/gdb/target.c
 +++ b/gdb/target.c
 @@ -123,6 +123,8 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int,
@@ -11003,7 +10999,7 @@ index 862df4e..a8f1bdd 100644
    de_fault (to_stopped_by_watchpoint,
  	    (int (*) (void))
  	    return_zero);
-@@ -3441,6 +3447,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
+@@ -3440,6 +3446,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
    return retval;
  }
  
@@ -11023,7 +11019,7 @@ index 862df4e..a8f1bdd 100644
  static void
  debug_to_terminal_init (void)
  {
-@@ -3688,6 +3707,7 @@ setup_target_debug (void)
+@@ -3687,6 +3706,7 @@ setup_target_debug (void)
    current_target.to_remove_hw_breakpoint = debug_to_remove_hw_breakpoint;
    current_target.to_insert_watchpoint = debug_to_insert_watchpoint;
    current_target.to_remove_watchpoint = debug_to_remove_watchpoint;
@@ -14210,7 +14206,7 @@ index 0000000..226dc5d
 +  call foo (g, h)
 +end
 diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
-index 1aed252..593aa55 100644
+index fc8bccc..e053813 100644
 --- a/gdb/testsuite/gdb.gdb/selftest.exp
 +++ b/gdb/testsuite/gdb.gdb/selftest.exp
 @@ -92,6 +92,10 @@ proc do_steps_and_nexts {} {
@@ -14846,6 +14842,36 @@ index a24bc11..e3043bc 100644
  
  # The following test recompiles the binary to test either C or C++
  # values. 
+diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
+new file mode 100644
+index 0000000..70319ff
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
+@@ -0,0 +1,24 @@
++# Copyright (C) 2008, 2009, 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/>.
++
++# https://bugzilla.redhat.com/show_bug.cgi?id=634108
++
++gdb_exit
++gdb_start
++
++# Skip all tests if Python scripting is not enabled.
++if { [skip_python_tests] } { continue }
++
++gdb_test "python print gdb.solib_address(-1)" "None" "gdb.solib_address exists"
 diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c b/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c
 new file mode 100644
 index 0000000..4dc308b
@@ -15390,7 +15416,7 @@ index 0000000..1dc93ab
 +    test child FOLLOW_CHILD
 +}
 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
-index b5b3362..d916e94 100644
+index 20e2fb7..b27d25c 100644
 --- a/gdb/testsuite/lib/gdb.exp
 +++ b/gdb/testsuite/lib/gdb.exp
 @@ -27,6 +27,7 @@ if {$tool == ""} {
@@ -15496,7 +15522,7 @@ index 0000000..b8e9836
 +    return 0
 +}
 diff --git a/gdb/thread.c b/gdb/thread.c
-index 2fdc7f9..2a5d0f1 100644
+index 0b291ba..ae3e4ff 100644
 --- a/gdb/thread.c
 +++ b/gdb/thread.c
 @@ -90,6 +90,16 @@ delete_step_resume_breakpoint (struct thread_info *tp)
@@ -15530,7 +15556,7 @@ index 2fdc7f9..2a5d0f1 100644
  
    discard_all_intermediate_continuations_thread (tp);
 diff --git a/gdb/top.c b/gdb/top.c
-index 93447fe..d6875a7 100644
+index b29e68d..8edac70 100644
 --- a/gdb/top.c
 +++ b/gdb/top.c
 @@ -337,6 +337,7 @@ void

diff --git a/gdb-bz555076-gcore-small-height.patch b/gdb-bz555076-gcore-small-height.patch
new file mode 100644
index 0000000..acad66b
--- /dev/null
+++ b/gdb-bz555076-gcore-small-height.patch
@@ -0,0 +1,12 @@
+--- a/gdb/gdb_gcore.sh
++++ b/gdb/gdb_gcore.sh
+@@ -64,6 +64,9 @@ for pid in $*
+ do
+ 	# Write gdb script for pid $pid.  
+ 	cat >>$tmpfile <<EOF
++set pagination off
++set width 0
++set height 0
+ attach $pid
+ gcore $name.$pid
+ detach

diff --git a/gdb-bz568248-oom-is-error.patch b/gdb-bz568248-oom-is-error.patch
new file mode 100644
index 0000000..2aaf522
--- /dev/null
+++ b/gdb-bz568248-oom-is-error.patch
@@ -0,0 +1,69 @@
+http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
+Subject: [rfc patch] nomem: internal_error -> error
+
+Hi,
+
+unfortunately I see this problem reproducible only with the
+archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
+OTOH this branch I hopefully submit in some form for FSF GDB later.
+
+In this case (a general problem but tested for example on Fedora 13 i686):
+
+int
+main (int argc, char **argv)
+{
+  char a[argc];
+  return a[0];
+}
+
+(gdb) start
+(gdb) print a
+../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
+
+It is apparently because boundary for the variable `a' is not initialized
+there.  Users notice it due to Eclipse-CDT trying to automatically display all
+the local variables on each step.
+
+
+Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
+But is anone aware of the reasons to use internal_error there?
+I find simple error as a perfectly reasonable there.
+(history only tracks it since the initial import)
+
+IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
+
+I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
+sure if it can happen only due to the VLA variables.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-06-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	    Tom Tromey  <tromey@redhat.com>
+
+	* utils.c (nomem): Change internal_error to error.
+
+--- a/gdb/utils.c
++++ b/gdb/utils.c
+@@ -1265,15 +1265,9 @@ void
+ nomem (long size)
+ {
+   if (size > 0)
+-    {
+-      internal_error (__FILE__, __LINE__,
+-		      _("virtual memory exhausted: can't allocate %ld bytes."),
+-		      size);
+-    }
++    error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
+   else
+-    {
+-      internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
+-    }
++    error (_("virtual memory exhausted."));
+ }
+ 
+ /* The xmalloc() (libiberty.h) family of memory management routines.
+

diff --git a/gdb-bz592031-siginfo-lost-1of5.patch b/gdb-bz592031-siginfo-lost-1of5.patch
new file mode 100644
index 0000000..16c789f
--- /dev/null
+++ b/gdb-bz592031-siginfo-lost-1of5.patch
@@ -0,0 +1,87 @@
+http://sourceware.org/ml/gdb-patches/2010-08/msg00559.html
+http://sourceware.org/ml/gdb-cvs/2010-08/msg00199.html
+
+### src/gdb/ChangeLog	2010/08/31 18:08:42	1.12129
+### src/gdb/ChangeLog	2010/08/31 18:11:48	1.12130
+## -1,5 +1,14 @@
+ 2010-08-31  Jan Kratochvil  <jan.kratochvil@redhat.com>
+ 
++	Make linux_get_siginfo_type `type *' unique.
++	* linux-tdep.c (linux_gdbarch_data_handle, struct linux_gdbarch_data)
++	(init_linux_gdbarch_data, get_linux_gdbarch_data): New.
++	(linux_get_siginfo_type): New variable linux_gdbarch_data.  Initialize
++	it.  Use linux_gdbarch_data->siginfo_type as a persistent storage.
++	(_initialize_linux_tdep): New.
++
++2010-08-31  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
+ 	Code cleanup.
+ 	* defs.h (find_memory_region_ftype): New typedef.
+ 	(exec_set_find_memory_regions): Use it.
+Index: gdb-7.2/gdb/linux-tdep.c
+===================================================================
+--- gdb-7.2.orig/gdb/linux-tdep.c	2010-09-25 15:30:50.000000000 +0200
++++ gdb-7.2/gdb/linux-tdep.c	2010-09-25 15:31:54.000000000 +0200
+@@ -26,18 +26,42 @@
+ #include "value.h"
+ #include "infcall.h"
+ 
++static struct gdbarch_data *linux_gdbarch_data_handle;
++
++struct linux_gdbarch_data
++  {
++    struct type *siginfo_type;
++  };
++
++static void *
++init_linux_gdbarch_data (struct gdbarch *gdbarch)
++{
++  return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct linux_gdbarch_data);
++}
++
++static struct linux_gdbarch_data *
++get_linux_gdbarch_data (struct gdbarch *gdbarch)
++{
++  return gdbarch_data (gdbarch, linux_gdbarch_data_handle);
++}
++
+ /* This function is suitable for architectures that don't
+    extend/override the standard siginfo structure.  */
+ 
+ struct type *
+ linux_get_siginfo_type (struct gdbarch *gdbarch)
+ {
++  struct linux_gdbarch_data *linux_gdbarch_data;
+   struct type *int_type, *uint_type, *long_type, *void_ptr_type;
+   struct type *uid_type, *pid_type;
+   struct type *sigval_type, *clock_type;
+   struct type *siginfo_type, *sifields_type;
+   struct type *type;
+ 
++  linux_gdbarch_data = get_linux_gdbarch_data (gdbarch);
++  if (linux_gdbarch_data->siginfo_type != NULL)
++    return linux_gdbarch_data->siginfo_type;
++
+   int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+ 			 	0, "int");
+   uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+@@ -137,6 +161,8 @@ linux_get_siginfo_type (struct gdbarch *
+ 				       "_sifields", sifields_type,
+ 				       TYPE_LENGTH (long_type));
+ 
++  linux_gdbarch_data->siginfo_type = siginfo_type;
++
+   return siginfo_type;
+ }
+ 
+@@ -154,3 +180,10 @@ linux_has_shared_address_space (void)
+ 
+   return target_is_uclinux;
+ }
++
++void
++_initialize_linux_tdep (void)
++{
++  linux_gdbarch_data_handle =
++    gdbarch_data_register_post_init (init_linux_gdbarch_data);
++}

diff --git a/gdb-bz592031-siginfo-lost-2of5.patch b/gdb-bz592031-siginfo-lost-2of5.patch
new file mode 100644
index 0000000..c5184e0
--- /dev/null
+++ b/gdb-bz592031-siginfo-lost-2of5.patch
@@ -0,0 +1,139 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00430.html
+http://sourceware.org/ml/gdb-cvs/2010-09/msg00152.html
+
+### src/gdb/ChangeLog	2010/09/24 11:15:51	1.12199
+### src/gdb/ChangeLog	2010/09/24 13:41:42	1.12200
+## -1,5 +1,12 @@
+ 2010-09-24  Pedro Alves  <pedro@codesourcery.com>
+ 
++	* amd64-linux-nat.c (compat_siginfo_from_siginfo)
++	(siginfo_from_compat_siginfo): Also copy si_pid and si_uid when
++	si_code is < 0.  Check for si_code == SI_TIMER before checking for
++	si_code < 0.
++
++2010-09-24  Pedro Alves  <pedro@codesourcery.com>
++
+ 	* objfiles.h (ALL_OBJSECTIONS): Handle breaks in the inner loop.
+ 
+ 2010-09-22  Joel Brobecker  <brobecker@adacore.com>
+--- src/gdb/amd64-linux-nat.c	2010/04/22 20:02:55	1.32
++++ src/gdb/amd64-linux-nat.c	2010/09/24 13:41:43	1.33
+@@ -574,8 +574,10 @@
+   to->si_errno = from->si_errno;
+   to->si_code = from->si_code;
+ 
+-  if (to->si_code < 0)
++  if (to->si_code == SI_TIMER)
+     {
++      to->cpt_si_timerid = from->si_timerid;
++      to->cpt_si_overrun = from->si_overrun;
+       to->cpt_si_ptr = (intptr_t) from->si_ptr;
+     }
+   else if (to->si_code == SI_USER)
+@@ -583,10 +585,10 @@
+       to->cpt_si_pid = from->si_pid;
+       to->cpt_si_uid = from->si_uid;
+     }
+-  else if (to->si_code == SI_TIMER)
++  else if (to->si_code < 0)
+     {
+-      to->cpt_si_timerid = from->si_timerid;
+-      to->cpt_si_overrun = from->si_overrun;
++      to->cpt_si_pid = from->si_pid;
++      to->cpt_si_uid = from->si_uid;
+       to->cpt_si_ptr = (intptr_t) from->si_ptr;
+     }
+   else
+@@ -628,8 +630,10 @@
+   to->si_errno = from->si_errno;
+   to->si_code = from->si_code;
+ 
+-  if (to->si_code < 0)
++  if (to->si_code == SI_TIMER)
+     {
++      to->si_timerid = from->cpt_si_timerid;
++      to->si_overrun = from->cpt_si_overrun;
+       to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
+     }
+   else if (to->si_code == SI_USER)
+@@ -637,10 +641,10 @@
+       to->si_pid = from->cpt_si_pid;
+       to->si_uid = from->cpt_si_uid;
+     }
+-  else if (to->si_code == SI_TIMER)
++  if (to->si_code < 0)
+     {
+-      to->si_timerid = from->cpt_si_timerid;
+-      to->si_overrun = from->cpt_si_overrun;
++      to->si_pid = from->cpt_si_pid;
++      to->si_uid = from->cpt_si_uid;
+       to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
+     }
+   else
+### src/gdb/gdbserver/ChangeLog	2010/09/13 19:11:03	1.431
+### src/gdb/gdbserver/ChangeLog	2010/09/24 13:41:43	1.432
+## -1,3 +1,10 @@
++2010-09-24  Pedro Alves  <pedro@codesourcery.com>
++
++	* linux-x86-low.c (compat_siginfo_from_siginfo)
++	(siginfo_from_compat_siginfo): Also copy si_pid and si_uid when
++	si_code is < 0.  Check for si_code == SI_TIMER before checking for
++	si_code < 0.
++
+ 2010-09-13  Joel Brobecker  <brobecker@adacore.com>
+ 
+ 	* lynx-i386-low.c: New file.
+--- src/gdb/gdbserver/linux-x86-low.c	2010/08/27 00:16:48	1.23
++++ src/gdb/gdbserver/linux-x86-low.c	2010/09/24 13:41:43	1.24
+@@ -792,8 +792,10 @@
+   to->si_errno = from->si_errno;
+   to->si_code = from->si_code;
+ 
+-  if (to->si_code < 0)
++  if (to->si_code == SI_TIMER)
+     {
++      to->cpt_si_timerid = from->si_timerid;
++      to->cpt_si_overrun = from->si_overrun;
+       to->cpt_si_ptr = (intptr_t) from->si_ptr;
+     }
+   else if (to->si_code == SI_USER)
+@@ -801,10 +803,10 @@
+       to->cpt_si_pid = from->si_pid;
+       to->cpt_si_uid = from->si_uid;
+     }
+-  else if (to->si_code == SI_TIMER)
++  else if (to->si_code < 0)
+     {
+-      to->cpt_si_timerid = from->si_timerid;
+-      to->cpt_si_overrun = from->si_overrun;
++      to->cpt_si_pid = from->si_pid;
++      to->cpt_si_uid = from->si_uid;
+       to->cpt_si_ptr = (intptr_t) from->si_ptr;
+     }
+   else
+@@ -846,8 +848,10 @@
+   to->si_errno = from->si_errno;
+   to->si_code = from->si_code;
+ 
+-  if (to->si_code < 0)
++  if (to->si_code == SI_TIMER)
+     {
++      to->si_timerid = from->cpt_si_timerid;
++      to->si_overrun = from->cpt_si_overrun;
+       to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
+     }
+   else if (to->si_code == SI_USER)
+@@ -855,10 +859,10 @@
+       to->si_pid = from->cpt_si_pid;
+       to->si_uid = from->cpt_si_uid;
+     }
+-  else if (to->si_code == SI_TIMER)
++  else if (to->si_code < 0)
+     {
+-      to->si_timerid = from->cpt_si_timerid;
+-      to->si_overrun = from->cpt_si_overrun;
++      to->si_pid = from->cpt_si_pid;
++      to->si_uid = from->cpt_si_uid;
+       to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
+     }
+   else

diff --git a/gdb-bz592031-siginfo-lost-3of5.patch b/gdb-bz592031-siginfo-lost-3of5.patch
new file mode 100644
index 0000000..e45c83d
--- /dev/null
+++ b/gdb-bz592031-siginfo-lost-3of5.patch
@@ -0,0 +1,259 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00438.html
+http://sourceware.org/ml/gdb-cvs/2010-09/msg00156.html
+
+### src/gdb/ChangeLog	2010/09/24 16:11:44	1.12203
+### src/gdb/ChangeLog	2010/09/24 18:35:20	1.12204
+## -1,3 +1,16 @@
++2010-09-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	Fix lost siginfo_t for inferior calls.
++	* infrun.c
++	(struct inferior_thread_state) <siginfo_gdbarch, siginfo_data>: New.
++	(save_inferior_thread_state): New variables regcache, gdbarch and
++	siginfo_data.  Initialize SIGINFO_DATA if gdbarch_get_siginfo_type_p.
++	Move INF_STATE allocation later, pre-clear it.  Initialize REGISTERS
++	using REGCACHE.
++	(restore_inferior_thread_state): New variables regcache and gdbarch.
++	Restore SIGINFO_DATA for matching GDBARCH.  Restore REGISTERS using
++	REGCACHE.  Free also SIGINFO_DATA.
++
+ 2010-09-24  Tom Tromey  <tromey@redhat.com>
+ 
+ 	* dwarf2read.c (dw2_expand_symtabs_matching): Add missing
+--- src/gdb/infrun.c	2010/09/06 14:22:07	1.450
++++ src/gdb/infrun.c	2010/09/24 18:35:27	1.451
+@@ -6037,18 +6037,57 @@
+   enum target_signal stop_signal;
+   CORE_ADDR stop_pc;
+   struct regcache *registers;
++
++  /* Format of SIGINFO or NULL if it is not present.  */
++  struct gdbarch *siginfo_gdbarch;
++
++  /* The inferior format depends on SIGINFO_GDBARCH and it has a length of
++     TYPE_LENGTH (gdbarch_get_siginfo_type ()).  For different gdbarch the
++     content would be invalid.  */
++  gdb_byte *siginfo_data;
+ };
+ 
+ struct inferior_thread_state *
+ save_inferior_thread_state (void)
+ {
+-  struct inferior_thread_state *inf_state = XMALLOC (struct inferior_thread_state);
++  struct inferior_thread_state *inf_state;
+   struct thread_info *tp = inferior_thread ();
++  struct regcache *regcache = get_current_regcache ();
++  struct gdbarch *gdbarch = get_regcache_arch (regcache);
++  gdb_byte *siginfo_data = NULL;
++
++  if (gdbarch_get_siginfo_type_p (gdbarch))
++    {
++      struct type *type = gdbarch_get_siginfo_type (gdbarch);
++      size_t len = TYPE_LENGTH (type);
++      struct cleanup *back_to;
++
++      siginfo_data = xmalloc (len);
++      back_to = make_cleanup (xfree, siginfo_data);
++
++      if (target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
++		       siginfo_data, 0, len) == len)
++	discard_cleanups (back_to);
++      else
++	{
++	  /* Errors ignored.  */
++	  do_cleanups (back_to);
++	  siginfo_data = NULL;
++	}
++    }
++
++  inf_state = XZALLOC (struct inferior_thread_state);
++
++  if (siginfo_data)
++    {
++      inf_state->siginfo_gdbarch = gdbarch;
++      inf_state->siginfo_data = siginfo_data;
++    }
+ 
+   inf_state->stop_signal = tp->stop_signal;
+   inf_state->stop_pc = stop_pc;
+ 
+-  inf_state->registers = regcache_dup (get_current_regcache ());
++  inf_state->registers = regcache_dup (regcache);
+ 
+   return inf_state;
+ }
+@@ -6059,16 +6098,29 @@
+ restore_inferior_thread_state (struct inferior_thread_state *inf_state)
+ {
+   struct thread_info *tp = inferior_thread ();
++  struct regcache *regcache = get_current_regcache ();
++  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ 
+   tp->stop_signal = inf_state->stop_signal;
+   stop_pc = inf_state->stop_pc;
+ 
++  if (inf_state->siginfo_gdbarch == gdbarch)
++    {
++      struct type *type = gdbarch_get_siginfo_type (gdbarch);
++      size_t len = TYPE_LENGTH (type);
++
++      /* Errors ignored.  */
++      target_write (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
++		    inf_state->siginfo_data, 0, len);
++    }
++
+   /* The inferior can be gone if the user types "print exit(0)"
+      (and perhaps other times).  */
+   if (target_has_execution)
+     /* NB: The register write goes through to the target.  */
+-    regcache_cpy (get_current_regcache (), inf_state->registers);
++    regcache_cpy (regcache, inf_state->registers);
+   regcache_xfree (inf_state->registers);
++  xfree (inf_state->siginfo_data);
+   xfree (inf_state);
+ }
+ 
+### src/gdb/testsuite/ChangeLog	2010/09/22 20:08:04	1.2456
+### src/gdb/testsuite/ChangeLog	2010/09/24 18:35:28	1.2457
+## -1,3 +1,9 @@
++2010-09-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	Fix lost siginfo_t for inferior calls.
++	* gdb.base/siginfo-infcall.exp: New file.
++	* gdb.base/siginfo-infcall.c: New file.
++
+ 2010-09-22  Joel Brobecker  <brobecker@adacore.com>
+ 
+ 	* gdb.dwarf2/dw2-const.S: Minor (space) reformatting.
+--- src/gdb/testsuite/gdb.base/siginfo-infcall.c
++++ src/gdb/testsuite/gdb.base/siginfo-infcall.c	2010-09-25 13:25:25.007169000 +0000
+@@ -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/>.  */
++
++#include <signal.h>
++#include <assert.h>
++#include <string.h>
++#include <unistd.h>
++
++#ifndef SA_SIGINFO
++# error "SA_SIGINFO is required for this test"
++#endif
++
++static int
++callme (void)
++{
++  return 42;
++}
++
++static int
++pass (void)
++{
++  return 1;
++}
++
++static int
++fail (void)
++{
++  return 1;
++}
++
++static void
++handler (int sig, siginfo_t *siginfo, void *context)
++{
++  assert (sig == SIGUSR1);
++  assert (siginfo->si_signo == SIGUSR1);
++  if (siginfo->si_pid == getpid ())
++    pass ();
++  else
++    fail ();
++}
++
++int
++main (void)
++{
++  struct sigaction sa;
++  int i;
++
++  callme ();
++
++  memset (&sa, 0, sizeof (sa));
++  sa.sa_sigaction = handler;
++  sa.sa_flags = SA_SIGINFO;
++
++  i = sigemptyset (&sa.sa_mask);
++  assert (i == 0);
++
++  i = sigaction (SIGUSR1, &sa, NULL);
++  assert (i == 0);
++
++  i = raise (SIGUSR1);
++  assert (i == 0);
++
++  sleep (600);
++  return 0;
++}
+--- src/gdb/testsuite/gdb.base/siginfo-infcall.exp
++++ src/gdb/testsuite/gdb.base/siginfo-infcall.exp	2010-09-25 13:25:25.357724000 +0000
+@@ -0,0 +1,47 @@
++# 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 [target_info exists gdb,nosignals] {
++    verbose "Skipping siginfo-infcall.exp because of nosignals."
++    continue
++}
++
++set testfile siginfo-infcall
++set srcfile ${testfile}.c
++set executable ${testfile}
++if { [prepare_for_testing ${testfile}.exp $executable] } {
++    return -1
++}
++
++if ![runto_main] {
++    return -1
++}
++
++gdb_breakpoint "pass"
++gdb_breakpoint "fail"
++
++gdb_test "continue" "Program received signal SIGUSR1, .*" "continue to SIGUSR1"
++
++gdb_test "p callme ()" " = 42"
++
++set test "continue to the handler"
++gdb_test_multiple "continue" $test {
++    -re "Breakpoint \[0-9\]+,\[^\r\n\]* pass .*\r\n$gdb_prompt $" {
++	pass $test
++    }
++    -re "Breakpoint \[0-9\]+,\[^\r\n\]* fail .*\r\n$gdb_prompt $" {
++	fail $test
++    }
++}

diff --git a/gdb-bz592031-siginfo-lost-4of5.patch b/gdb-bz592031-siginfo-lost-4of5.patch
new file mode 100644
index 0000000..a73ab33
--- /dev/null
+++ b/gdb-bz592031-siginfo-lost-4of5.patch
@@ -0,0 +1,992 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00360.html
+Subject: [patch 3/4]#3 linux-nat: Do not respawn signals
+
+Hi,
+
+linux-nat.c is fixed to never respawn signals; possibly keeping SIGSTOP
+pending, as is done in current in FSF gdbserver and as suggested by Pedro:
+	http://sourceware.org/ml/gdb-patches/2010-08/msg00544.html
+
+The last linux-nat.c removed patch chunk comes from the initial implementation
+by Mark Kettenis:
+	[PATCH] New Linux threads support
+	http://sourceware.org/ml/gdb-patches/2000-09/msg00020.html
+	92280a75e017683bf8e4f339f4f85640b0700509
+It gets in part reimplemented into the new stop_wait_callback <if (lp->step)>
+part and partially just not needed as currently GDB never drops the signals as
+it does not PTRACE_CONT the thread; signal is kept for processing:
+	"RC: Not resuming sibling %s (has pending)\n"
+
+In stop_wait_callback I believe breakpoints cancellation is not needed here,
+it would be done later.
+
+
+The testcase sigstep-threads.exp was written to catch a regression-like
+appearance then the new <if (lp->step)> part of stop_wait_callback gets
+removed.  Still the tecase fails even with FSF HEAD:
+
+32        var++;                /* step-1 */
+(gdb) step
+Program received signal SIGUSR1, User defined signal 1.
+Program received signal SIGUSR1, User defined signal 1.
+31      {                       /* step-0 */
+
+There is no reason why it shouldn't stop on line 33, between line 32 and line
+33 no signal would occur.  Stepping of the current thread should not be
+affected by whatever happens in the other threads as select_event_lwp has:
+  /* Give preference to any LWP that is being single-stepped.  */
+
+There is a problem that with FSF HEAD GDB does PTRACE_SINGLESTEP for thread A,
+PTRACE_CONT for thread B (because of set scheduler-locking off), thread B hits
+SIGUSR1, so GDB tkills thread A with SIGSTOP and it can receive SIGSTOP for
+thread A before the SIGTRAP for completed PTRACE_SINGLESTEP.  At that moment
+select_event_lwp. forgets it was stepping thread A because there is no pending
+SIGTRAP event.  currently_stepping still remembers thread A was stepping so it
+will later stop but as thread A was PTRACE_CONT-ed in the meantime it is too
+late.
+
+There is the new <if (lp->step)> part of stop_wait_callback to always track
+thread A is stepping.  Due to different scheduling without this part the
+changed GDB would very rarely stop in this testcase otherwise, making it look
+as a regression.
+
+I have some another patch I may post separately as if multiple signals happen
+besides SIGTRAP GDB still may switch from thread A away (as not considering it
+stepping) to thread B for SIGUSR and accidentally PTRACE_CONT thread A.
+But I do not find this as a prerequisite for this patchset.
+
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* linux-nat.c (stop_wait_callback): New gdb_assert.  Remove signals
+	respawning; keep TP with SIGNALLED.  New debugging message "SWC:
+	Delayed SIGSTOP caught for %s.".  Catch next signal if SIGSTOP has
+	been caught and LP->STEP is set.
+	(linux_nat_wait_1) <lp && lp->signalled>: Remove.
+
+gdb/testsuite/
+2010-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.threads/siginfo-threads.exp: New file.
+	* gdb.threads/siginfo-threads.c: New file.
+	* gdb.threads/sigstep-threads.exp: New file.
+	* gdb.threads/sigstep-threads.c: New file.
+
+Index: gdb-7.2/gdb/linux-nat.c
+===================================================================
+--- gdb-7.2.orig/gdb/linux-nat.c	2010-09-25 15:30:54.000000000 +0200
++++ gdb-7.2/gdb/linux-nat.c	2010-09-25 15:37:23.000000000 +0200
+@@ -2702,6 +2702,8 @@ stop_wait_callback (struct lwp_info *lp,
+     {
+       int status;
+ 
++      gdb_assert (lp->resumed);
++
+       status = wait_lwp (lp);
+       if (status == 0)
+ 	return 0;
+@@ -2726,110 +2728,61 @@ stop_wait_callback (struct lwp_info *lp,
+ 
+       if (WSTOPSIG (status) != SIGSTOP)
+ 	{
+-	  if (WSTOPSIG (status) == SIGTRAP)
+-	    {
+-	      /* If a LWP other than the LWP that we're reporting an
+-	         event for has hit a GDB breakpoint (as opposed to
+-	         some random trap signal), then just arrange for it to
+-	         hit it again later.  We don't keep the SIGTRAP status
+-	         and don't forward the SIGTRAP signal to the LWP.  We
+-	         will handle the current event, eventually we will
+-	         resume all LWPs, and this one will get its breakpoint
+-	         trap again.
+-
+-	         If we do not do this, then we run the risk that the
+-	         user will delete or disable the breakpoint, but the
+-	         thread will have already tripped on it.  */
+-
+-	      /* Save the trap's siginfo in case we need it later.  */
+-	      save_siginfo (lp);
+-
+-	      save_sigtrap (lp);
+-
+-	      /* Now resume this LWP and get the SIGSTOP event. */
+-	      errno = 0;
+-	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+-	      if (debug_linux_nat)
+-		{
+-		  fprintf_unfiltered (gdb_stdlog,
+-				      "PTRACE_CONT %s, 0, 0 (%s)\n",
+-				      target_pid_to_str (lp->ptid),
+-				      errno ? safe_strerror (errno) : "OK");
+-
+-		  fprintf_unfiltered (gdb_stdlog,
+-				      "SWC: Candidate SIGTRAP event in %s\n",
+-				      target_pid_to_str (lp->ptid));
+-		}
+-	      /* Hold this event/waitstatus while we check to see if
+-		 there are any more (we still want to get that SIGSTOP). */
+-	      stop_wait_callback (lp, NULL);
++	  /* The thread was stopped with a signal other than SIGSTOP.  */
+ 
+-	      /* Hold the SIGTRAP for handling by linux_nat_wait.  If
+-		 there's another event, throw it back into the
+-		 queue. */
+-	      if (lp->status)
+-		{
+-		  if (debug_linux_nat)
+-		    fprintf_unfiltered (gdb_stdlog,
+-					"SWC: kill %s, %s\n",
+-					target_pid_to_str (lp->ptid),
+-					status_to_str ((int) status));
+-		  kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
+-		}
++	  /* Save the trap's siginfo in case we need it later.  */
++	  save_siginfo (lp);
+ 
+-	      /* Save the sigtrap event. */
+-	      lp->status = status;
+-	      return 0;
+-	    }
+-	  else
+-	    {
+-	      /* The thread was stopped with a signal other than
+-	         SIGSTOP, and didn't accidentally trip a breakpoint. */
++	  save_sigtrap (lp);
+ 
+-	      if (debug_linux_nat)
+-		{
+-		  fprintf_unfiltered (gdb_stdlog,
+-				      "SWC: Pending event %s in %s\n",
+-				      status_to_str ((int) status),
+-				      target_pid_to_str (lp->ptid));
+-		}
+-	      /* Now resume this LWP and get the SIGSTOP event. */
+-	      errno = 0;
+-	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+-	      if (debug_linux_nat)
+-		fprintf_unfiltered (gdb_stdlog,
+-				    "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
+-				    target_pid_to_str (lp->ptid),
+-				    errno ? safe_strerror (errno) : "OK");
+-
+-	      /* Hold this event/waitstatus while we check to see if
+-	         there are any more (we still want to get that SIGSTOP). */
+-	      stop_wait_callback (lp, NULL);
++	  if (debug_linux_nat)
++	    fprintf_unfiltered (gdb_stdlog,
++				"SWC: Pending event %s in %s\n",
++				status_to_str ((int) status),
++				target_pid_to_str (lp->ptid));
+ 
+-	      /* If the lp->status field is still empty, use it to
+-		 hold this event.  If not, then this event must be
+-		 returned to the event queue of the LWP.  */
+-	      if (lp->status)
+-		{
+-		  if (debug_linux_nat)
+-		    {
+-		      fprintf_unfiltered (gdb_stdlog,
+-					  "SWC: kill %s, %s\n",
+-					  target_pid_to_str (lp->ptid),
+-					  status_to_str ((int) status));
+-		    }
+-		  kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
+-		}
+-	      else
+-		lp->status = status;
+-	      return 0;
+-	    }
++	  /* Save the sigtrap event. */
++	  lp->status = status;
++	  gdb_assert (! lp->stopped);
++	  gdb_assert (lp->signalled);
++	  lp->stopped = 1;
+ 	}
+       else
+ 	{
+ 	  /* We caught the SIGSTOP that we intended to catch, so
+ 	     there's no SIGSTOP pending.  */
+-	  lp->stopped = 1;
++
++	  if (debug_linux_nat)
++	    fprintf_unfiltered (gdb_stdlog,
++				"SWC: Delayed SIGSTOP caught for %s.\n",
++				target_pid_to_str (lp->ptid));
++
++	  if (lp->step)
++	    {
++	      /* LP->STATUS is 0 here.  That means SIGTRAP from
++		 PTRACE_SINGLESTEP still has to be delivered for this inferior
++		 stop.  Catching the SIGTRAP event is important to prevent
++		 starvation in select_event_lwp.  */
++
++	      registers_changed ();
++	      linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
++				    1, TARGET_SIGNAL_0);
++	      if (debug_linux_nat)
++		fprintf_unfiltered (gdb_stdlog,
++				    "SWC: %s %s, 0, 0 (discard SIGSTOP)\n",
++				    "PTRACE_SINGLESTEP",
++				    target_pid_to_str (lp->ptid));
++
++	      lp->stopped = 0;
++	      gdb_assert (lp->resumed);
++	      stop_wait_callback (lp, NULL);
++	      gdb_assert (lp->stopped);
++	    }
++	  else
++	    lp->stopped = 1;
++
++	  /* Reset SIGNALLED only after the stop_wait_callback call above as
++	     it does gdb_assert on SIGNALLED.  */
+ 	  lp->signalled = 0;
+ 	}
+     }
+@@ -3416,52 +3369,6 @@ retry:
+ 	lp = NULL;
+     }
+ 
+-  if (lp && lp->signalled)
+-    {
+-      /* A pending SIGSTOP may interfere with the normal stream of
+-         events.  In a typical case where interference is a problem,
+-         we have a SIGSTOP signal pending for LWP A while
+-         single-stepping it, encounter an event in LWP B, and take the
+-         pending SIGSTOP while trying to stop LWP A.  After processing
+-         the event in LWP B, LWP A is continued, and we'll never see
+-         the SIGTRAP associated with the last time we were
+-         single-stepping LWP A.  */
+-
+-      /* Resume the thread.  It should halt immediately returning the
+-         pending SIGSTOP.  */
+-      registers_changed ();
+-      linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
+-			    lp->step, TARGET_SIGNAL_0);
+-      if (debug_linux_nat)
+-	fprintf_unfiltered (gdb_stdlog,
+-			    "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
+-			    lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+-			    target_pid_to_str (lp->ptid));
+-      lp->stopped = 0;
+-      gdb_assert (lp->resumed);
+-
+-      /* Catch the pending SIGSTOP.  */
+-      status = lp->status;
+-      lp->status = 0;
+-
+-      stop_wait_callback (lp, NULL);
+-
+-      /* If the lp->status field isn't empty, we caught another signal
+-	 while flushing the SIGSTOP.  Return it back to the event
+-	 queue of the LWP, as we already have an event to handle.  */
+-      if (lp->status)
+-	{
+-	  if (debug_linux_nat)
+-	    fprintf_unfiltered (gdb_stdlog,
+-				"LLW: kill %s, %s\n",
+-				target_pid_to_str (lp->ptid),
+-				status_to_str (lp->status));
+-	  kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
+-	}
+-
+-      lp->status = status;
+-    }
+-
+   if (!target_can_async_p ())
+     {
+       /* Causes SIGINT to be passed on to the attached process.  */
+Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.c	2010-09-25 15:32:32.000000000 +0200
+@@ -0,0 +1,447 @@
++/* 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/>.  */
++
++#define _GNU_SOURCE
++#include <pthread.h>
++#include <stdio.h>
++#include <limits.h>
++#include <errno.h>
++#include <stdlib.h>
++#include <string.h>
++#include <assert.h>
++#include <sys/types.h>
++#include <signal.h>
++#include <unistd.h>
++#include <asm/unistd.h>
++
++#define gettid() syscall (__NR_gettid)
++#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, tgid, tid, sig)
++
++/* Terminate always in the main task, it can lock up with SIGSTOPped GDB
++   otherwise.  */
++#define TIMEOUT (gettid () == getpid() ? 10 : 15)
++
++static pid_t thread1_tid;
++static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER;
++static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
++static int thread1_sigusr1_hit;
++static int thread1_sigusr2_hit;
++
++static pid_t thread2_tid;
++static pthread_cond_t thread2_tid_cond = PTHREAD_COND_INITIALIZER;
++static pthread_mutex_t thread2_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
++static int thread2_sigusr1_hit;
++static int thread2_sigusr2_hit;
++
++static pthread_mutex_t terminate_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
++
++/* Do not use alarm as it would create a ptrace event which would hang up us if
++   we are being traced by GDB which we stopped ourselves.  */
++
++static void timed_mutex_lock (pthread_mutex_t *mutex)
++{
++  int i;
++  struct timespec start, now;
++
++  i = clock_gettime (CLOCK_MONOTONIC, &start);
++  assert (i == 0);
++
++  do
++    {
++      i = pthread_mutex_trylock (mutex);
++      if (i == 0)
++	return;
++      assert (i == EBUSY);
++
++      i = clock_gettime (CLOCK_MONOTONIC, &now);
++      assert (i == 0);
++      assert (now.tv_sec >= start.tv_sec);
++    }
++  while (now.tv_sec - start.tv_sec < TIMEOUT);
++
++  fprintf (stderr, "Timed out waiting for internal lock!\n");
++  exit (EXIT_FAILURE);
++}
++
++static void
++handler (int signo, siginfo_t *siginfo, void *exception)
++{
++  int *varp;
++
++  assert (siginfo->si_signo == signo);
++  assert (siginfo->si_code == SI_TKILL);
++  assert (siginfo->si_pid == getpid ());
++
++  if (gettid () == thread1_tid)
++    {
++      if (signo == SIGUSR1)
++	varp = &thread1_sigusr1_hit;
++      else if (signo == SIGUSR2)
++	varp = &thread1_sigusr2_hit;
++      else
++	assert (0);
++    }
++  else if (gettid () == thread2_tid)
++    {
++      if (signo == SIGUSR1)
++	varp = &thread2_sigusr1_hit;
++      else if (signo == SIGUSR2)
++	varp = &thread2_sigusr2_hit;
++      else
++	assert (0);
++    }
++  else
++    assert (0);
++
++  if (*varp)
++    {
++      fprintf (stderr, "Signal %d for TID %lu has been already hit!\n", signo,
++	       (unsigned long) gettid ());
++      exit (EXIT_FAILURE);
++    }
++  *varp = 1;
++}
++
++static void *
++thread1_func (void *unused)
++{
++  int i;
++
++  timed_mutex_lock (&thread1_tid_mutex);
++
++  /* THREAD1_TID_MUTEX must be already locked to avoid race.  */
++  thread1_tid = gettid ();
++
++  i = pthread_cond_signal (&thread1_tid_cond);
++  assert (i == 0);
++  i = pthread_mutex_unlock (&thread1_tid_mutex);
++  assert (i == 0);
++
++  /* 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);
++
++  if (! thread1_sigusr1_hit)
++    {
++      fprintf (stderr, "Thread 1 signal SIGUSR1 not hit!\n");
++      exit (EXIT_FAILURE);
++    }
++  if (! thread1_sigusr2_hit)
++    {
++      fprintf (stderr, "Thread 1 signal SIGUSR2 not hit!\n");
++      exit (EXIT_FAILURE);
++    }
++
++  return NULL;
++}
++
++static void *
++thread2_func (void *unused)
++{
++  int i;
++
++  timed_mutex_lock (&thread2_tid_mutex);
++
++  /* THREAD2_TID_MUTEX must be already locked to avoid race.  */
++  thread2_tid = gettid ();
++
++  i = pthread_cond_signal (&thread2_tid_cond);
++  assert (i == 0);
++  i = pthread_mutex_unlock (&thread2_tid_mutex);
++  assert (i == 0);
++
++  /* 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);
++
++  if (! thread2_sigusr1_hit)
++    {
++      fprintf (stderr, "Thread 2 signal SIGUSR1 not hit!\n");
++      exit (EXIT_FAILURE);
++    }
++  if (! thread2_sigusr2_hit)
++    {
++      fprintf (stderr, "Thread 2 signal SIGUSR2 not hit!\n");
++      exit (EXIT_FAILURE);
++    }
++
++  return NULL;
++}
++
++static const char *
++proc_string (const char *filename, const char *line)
++{
++  FILE *f;
++  static char buf[LINE_MAX];
++  size_t line_len = strlen (line);
++
++  f = fopen (filename, "r");
++  if (f == NULL)
++    {
++      fprintf (stderr, "fopen (\"%s\") for \"%s\": %s\n", filename, line,
++	       strerror (errno));
++      exit (EXIT_FAILURE);
++    }
++  while (errno = 0, fgets (buf, sizeof (buf), f))
++    {
++      char *s;
++
++      s = strchr (buf, '\n');
++      assert (s != NULL);
++      *s = 0;
++
++      if (strncmp (buf, line, line_len) != 0)
++	continue;
++
++      if (fclose (f))
++	{
++	  fprintf (stderr, "fclose (\"%s\") for \"%s\": %s\n", filename, line,
++		   strerror (errno));
++	  exit (EXIT_FAILURE);
++	}
++
++      return &buf[line_len];
++    }
++  if (errno != 0)
++    {
++      fprintf (stderr, "fgets (\"%s\": %s\n", filename, strerror (errno));
++      exit (EXIT_FAILURE);
++    }
++  fprintf (stderr, "\"%s\": No line \"%s\" found.\n", filename, line);
++  exit (EXIT_FAILURE);
++}
++
++static unsigned long
++proc_ulong (const char *filename, const char *line)
++{
++  const char *s = proc_string (filename, line);
++  long retval;
++  char *end;
++
++  errno = 0;
++  retval = strtol (s, &end, 10);
++  if (retval < 0 || retval >= LONG_MAX || (end && *end))
++    {
++      fprintf (stderr, "\"%s\":\"%s\": %ld, %s\n", filename, line, retval,
++	       strerror (errno));
++      exit (EXIT_FAILURE);
++    }
++  return retval;
++}
++
++static void
++state_wait (pid_t process, const char *wanted)
++{
++  char *filename;
++  int i;
++  struct timespec start, now;
++  const char *state;
++
++  i = asprintf (&filename, "/proc/%lu/status", (unsigned long) process);
++  assert (i > 0);
++
++  i = clock_gettime (CLOCK_MONOTONIC, &start);
++  assert (i == 0);
++
++  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);
++	  return;
++	}
++
++      if (sched_yield ())
++	{
++	  perror ("sched_yield()");
++	  exit (EXIT_FAILURE);
++	}
++
++      i = clock_gettime (CLOCK_MONOTONIC, &now);
++      assert (i == 0);
++      assert (now.tv_sec >= start.tv_sec);
++    }
++  while (now.tv_sec - start.tv_sec < TIMEOUT);
++
++  fprintf (stderr, "Timed out waiting for PID %lu \"%s\" (now it is \"%s\")!\n",
++	   (unsigned long) process, wanted, state);
++  exit (EXIT_FAILURE);
++}
++
++static volatile pid_t tracer = 0;
++static pthread_t thread1, thread2;
++
++static void
++cleanup (void)
++{
++  printf ("Resuming GDB PID %lu.\n", (unsigned long) tracer);
++
++  if (tracer)
++    {
++      int i;
++      int tracer_save = tracer;
++
++      tracer = 0;
++
++      i = kill (tracer_save, SIGCONT);
++      assert (i == 0);
++    }
++}
++
++int
++main (int argc, char **argv)
++{
++  int i;
++  int standalone = 0;
++  struct sigaction act;
++
++  if (argc == 2 && strcmp (argv[1], "-s") == 0)
++    standalone = 1;
++  else
++    assert (argc == 1);
++
++  setbuf (stdout, NULL);
++
++  timed_mutex_lock (&thread1_tid_mutex);
++  timed_mutex_lock (&thread2_tid_mutex);
++
++  timed_mutex_lock (&terminate_mutex);
++
++  errno = 0;
++  memset (&act, 0, sizeof (act));
++  act.sa_sigaction = handler;
++  act.sa_flags = SA_RESTART | SA_SIGINFO;
++  i = sigemptyset (&act.sa_mask);
++  assert_perror (errno);
++  assert (i == 0);
++  i = sigaction (SIGUSR1, &act, NULL);
++  assert_perror (errno);
++  assert (i == 0);
++  i = sigaction (SIGUSR2, &act, NULL);
++  assert_perror (errno);
++  assert (i == 0);
++
++  i = pthread_create (&thread1, NULL, thread1_func, NULL);
++  assert (i == 0);
++
++  i = pthread_create (&thread2, NULL, thread2_func, NULL);
++  assert (i == 0);
++
++  if (!standalone)
++    {
++      tracer = proc_ulong ("/proc/self/status", "TracerPid:\t");
++      if (tracer == 0)
++	{
++	  fprintf (stderr, "The testcase must be run by GDB!\n");
++	  exit (EXIT_FAILURE);
++	}
++      if (tracer != getppid ())
++	{
++	  fprintf (stderr, "The testcase parent must be our GDB tracer!\n");
++	  exit (EXIT_FAILURE);
++	}
++    }
++
++  /* SIGCONT our debugger in the case of our crash as we would deadlock
++     otherwise.  */
++
++  atexit (cleanup);
++
++  printf ("Stopping GDB PID %lu.\n", (unsigned long) tracer);
++
++  if (tracer)
++    {
++      i = kill (tracer, SIGSTOP);
++      assert (i == 0);
++      state_wait (tracer, "T (stopped)");
++    }
++
++  /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so
++     they could not trigger the signals before GDB gets unstopped later.
++     Threads get resumed at pthread_cond_wait below.  Use `while' loops for
++     protection against spurious pthread_cond_wait wakeups.  */
++
++  printf ("Waiting till the threads initialize their TIDs.\n");
++
++  while (thread1_tid == 0)
++    {
++      i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
++      assert (i == 0);
++    }
++
++  while (thread2_tid == 0)
++    {
++      i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
++      assert (i == 0);
++    }
++
++  printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n",
++	  (unsigned long) thread1_tid, (unsigned long) thread2_tid,
++	  (unsigned long) getpid ());
++
++  errno = 0;
++  i = tgkill (getpid (), thread1_tid, SIGUSR1);
++  assert_perror (errno);
++  assert (i == 0);
++  i = tgkill (getpid (), thread1_tid, SIGUSR2);
++  assert_perror (errno);
++  assert (i == 0);
++  i = tgkill (getpid (), thread2_tid, SIGUSR1);
++  assert_perror (errno);
++  assert (i == 0);
++  i = tgkill (getpid (), thread2_tid, SIGUSR2);
++  assert_perror (errno);
++  assert (i == 0);
++
++  printf ("Waiting till the threads get trapped by the signals.\n");
++
++  if (tracer)
++    {
++      /* s390x-unknown-linux-gnu will fail with "R (running)".  */
++
++      state_wait (thread1_tid, "t (tracing stop)");
++
++      state_wait (thread2_tid, "t (tracing stop)");
++    }
++
++  cleanup ();
++
++  printf ("Joining the threads.\n");
++
++  i = pthread_mutex_unlock (&terminate_mutex);
++  assert (i == 0);
++
++  i = pthread_join (thread1, NULL);
++  assert (i == 0);
++
++  i = pthread_join (thread2, NULL);
++  assert (i == 0);
++
++  printf ("Exiting.\n");	/* break-at-exit */
++
++  return EXIT_SUCCESS;
++}
+Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.exp	2010-09-25 15:32:32.000000000 +0200
+@@ -0,0 +1,94 @@
++# 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 "siginfo-threads"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } {
++    return -1
++}
++
++clean_restart $testfile
++
++if ![runto_main] {
++    return -1
++}
++
++# `nostop noprint pass' could in some cases report false PASS due to the
++# (preempt 'handle') code path.
++
++gdb_test "handle SIGUSR1 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
++gdb_test "handle SIGUSR2 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
++
++gdb_breakpoint [gdb_get_line_number "break-at-exit"]
++
++set test "get pid"
++gdb_test_multiple "p getpid ()" $test {
++    -re " = (\[0-9\]+)\r\n$gdb_prompt $" {
++	set pid $expect_out(1,string)
++	pass $test
++    }
++}
++
++for {set sigcount 0} {$sigcount < 4} {incr sigcount} {
++    set test "catch signal $sigcount"
++    set sigusr ""
++    gdb_test_multiple "continue" $test {
++	-re "Program received signal SIGUSR(\[12\]), User defined signal \[12\]\\.\r\n.*\r\n$gdb_prompt $" {
++	    set sigusr $expect_out(1,string)
++	    pass $test
++	}
++    }
++    if {$sigusr == ""} {
++	return -1
++    }
++
++    set test "signal $sigcount si_signo"
++    if {$sigusr == 1} {
++	set signo 10
++    } else {
++	set signo 12
++    }
++    gdb_test_multiple {p $_siginfo.si_signo} $test {
++	-re " = $signo\r\n$gdb_prompt $" {
++	    pass $test
++	}
++	-re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
++	    unsupported $test
++	}
++    }
++
++    set test "signal $sigcount si_code is SI_TKILL"
++    gdb_test_multiple {p $_siginfo.si_code} $test {
++	-re " = -6\r\n$gdb_prompt $" {
++	    pass $test
++	}
++	-re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
++	    unsupported $test
++	}
++    }
++
++    set test "signal $sigcount si_pid"
++    gdb_test_multiple {p $_siginfo._sifields._kill.si_pid} $test {
++	-re " = $pid\r\n$gdb_prompt $" {
++	    pass $test
++	}
++	-re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
++	    unsupported $test
++	}
++    }
++}
++
++gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*"
+Index: gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.c	2010-09-25 15:32:32.000000000 +0200
+@@ -0,0 +1,54 @@
++/* 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 <pthread.h>
++#include <assert.h>
++#include <signal.h>
++
++#include <asm/unistd.h>
++#include <unistd.h>
++#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, (tgid), (tid), (sig))
++#define gettid() syscall (__NR_gettid)
++
++static volatile int var;
++
++static void
++handler (int signo)	/* step-0 */
++{			/* step-0 */
++  var++;		/* step-1 */
++  tgkill (getpid (), gettid (), SIGUSR1);	/* step-2 */
++}
++
++static void *
++start (void *arg)
++{
++  signal (SIGUSR1, handler);
++  tgkill (getpid (), gettid (), SIGUSR1);
++  assert (0);
++
++  return NULL;
++}
++
++int
++main (void)
++{
++  pthread_t thread;
++
++  pthread_create (&thread, NULL, start, NULL);
++  start (NULL);	/* main-start */
++  return 0;
++}
+Index: gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.exp	2010-09-25 15:32:32.000000000 +0200
+@@ -0,0 +1,74 @@
++# 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 sigstep-threads
++set srcfile ${testfile}.c
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/${executable}
++
++if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++    untested ${testfile}.exp
++    return -1
++}
++
++clean_restart $executable
++
++if ![runto_main] {
++    return -1;
++}
++
++# `noprint' would not test the full logic of GDB.
++gdb_test "handle SIGUSR1 nostop print pass" "\r\nSIGUSR1\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
++
++gdb_test_no_output "set scheduler-locking off"
++
++gdb_breakpoint [gdb_get_line_number "step-1"]
++gdb_test_no_output {set $step1=$bpnum}
++gdb_continue_to_breakpoint "step-1" ".* step-1 .*"
++gdb_test_no_output {disable $step1}
++
++# 1 as we are now stopped at the `step-1' label.
++set step_at 1
++for {set i 0} {$i < 100} {incr i} {
++    set test "step $i"
++    # Presume this step failed - as in the case of a timeout.
++    set failed 1
++    gdb_test_multiple "step" $test {
++	-re "\r\nProgram received signal SIGUSR1, User defined signal 1.\r\n" {
++	    exp_continue -continue_timer
++	}
++	-re "step-(\[012\]).*\r\n$gdb_prompt $" {
++	    set now $expect_out(1,string)
++	    if {$step_at == 2 && $now == 1} {
++		set failed 0
++	    } elseif {$step_at == 1 && $now == 2} {
++		set failed 0
++		# Continue over the re-signalling back to the handle entry.
++		gdb_test_no_output {enable $step1} ""
++		gdb_test "continue" " step-1 .*" ""
++		set now 1
++		gdb_test_no_output {disable $step1} ""
++	    } else  {
++		fail $test
++	    }
++	    set step_at $now
++	}
++    }
++    if $failed {
++	return
++    }
++}
++# We can never reliably say the racy problematic case has been tested.
++pass "step"

diff --git a/gdb-bz592031-siginfo-lost-5of5.patch b/gdb-bz592031-siginfo-lost-5of5.patch
new file mode 100644
index 0000000..6bf93ef
--- /dev/null
+++ b/gdb-bz592031-siginfo-lost-5of5.patch
@@ -0,0 +1,141 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html
+Subject: [patch 4/4]#3 Remove redundant lp->siginfo
+
+Hi,
+
+this is a simplification which should not affect GDB behavior.  As linux-nat
+now stops on each received signal without any reordering of them then
+PTRACE_GETSIGINFO is enough to access siginfo, without any need to copy it in
+advance.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* linux-nat.c (resume_callback) <lp->stopped && lp->status == 0>
+	(linux_nat_resume): Remove LP->SIGINFO clearing.
+	(save_siginfo): Remove.
+	(stop_wait_callback) <WSTOPSIG (status) != SIGSTOP>
+	(linux_nat_filter_event) <linux_nat_status_is_event (status)>: Remove
+	the save_siginfo call.
+	(resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing.
+	(linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
+	* linux-nat.h (struct lwp_info) <siginfo>: Remove.
+
+Index: gdb-7.2/gdb/linux-nat.c
+===================================================================
+--- gdb-7.2.orig/gdb/linux-nat.c	2010-09-25 15:37:23.000000000 +0200
++++ gdb-7.2/gdb/linux-nat.c	2010-09-25 15:38:18.000000000 +0200
+@@ -1851,7 +1851,6 @@ resume_callback (struct lwp_info *lp, vo
+ 			    target_pid_to_str (lp->ptid));
+       lp->stopped = 0;
+       lp->step = 0;
+-      memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+       lp->stopped_by_watchpoint = 0;
+     }
+   else if (lp->stopped && debug_linux_nat)
+@@ -1993,7 +1992,6 @@ linux_nat_resume (struct target_ops *ops
+   ptid = pid_to_ptid (GET_LWP (lp->ptid));
+ 
+   linux_ops->to_resume (linux_ops, ptid, step, signo);
+-  memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+   lp->stopped_by_watchpoint = 0;
+ 
+   if (debug_linux_nat)
+@@ -2483,22 +2481,6 @@ wait_lwp (struct lwp_info *lp)
+   return status;
+ }
+ 
+-/* Save the most recent siginfo for LP.  This is currently only called
+-   for SIGTRAP; some ports use the si_addr field for
+-   target_stopped_data_address.  In the future, it may also be used to
+-   restore the siginfo of requeued signals.  */
+-
+-static void
+-save_siginfo (struct lwp_info *lp)
+-{
+-  errno = 0;
+-  ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
+-	  (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
+-
+-  if (errno != 0)
+-    memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+-}
+-
+ /* Send a SIGSTOP to LP.  */
+ 
+ static int
+@@ -2730,9 +2712,6 @@ stop_wait_callback (struct lwp_info *lp,
+ 	{
+ 	  /* The thread was stopped with a signal other than SIGSTOP.  */
+ 
+-	  /* Save the trap's siginfo in case we need it later.  */
+-	  save_siginfo (lp);
+-
+ 	  save_sigtrap (lp);
+ 
+ 	  if (debug_linux_nat)
+@@ -3102,12 +3081,7 @@ linux_nat_filter_event (int lwpid, int s
+     }
+ 
+   if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
+-    {
+-      /* Save the trap's siginfo in case we need it later.  */
+-      save_siginfo (lp);
+-
+-      save_sigtrap (lp);
+-    }
++    save_sigtrap (lp);
+ 
+   /* Check if the thread has exited.  */
+   if ((WIFEXITED (status) || WIFSIGNALED (status))
+@@ -3706,7 +3680,6 @@ resume_stopped_resumed_lwps (struct lwp_
+       linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
+ 			    lp->step, TARGET_SIGNAL_0);
+       lp->stopped = 0;
+-      memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+       lp->stopped_by_watchpoint = 0;
+     }
+ 
+@@ -5878,11 +5851,19 @@ linux_nat_set_siginfo_fixup (struct targ
+ struct siginfo *
+ linux_nat_get_siginfo (ptid_t ptid)
+ {
+-  struct lwp_info *lp = find_lwp_pid (ptid);
++  static struct siginfo siginfo;
++  int pid;
+ 
+-  gdb_assert (lp != NULL);
++  pid = GET_LWP (ptid);
++  if (pid == 0)
++    pid = GET_PID (ptid);
++
++  errno = 0;
++  ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
++  if (errno != 0)
++    memset (&siginfo, 0, sizeof (siginfo));
+ 
+-  return &lp->siginfo;
++  return &siginfo;
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.2/gdb/linux-nat.h
+===================================================================
+--- gdb-7.2.orig/gdb/linux-nat.h	2010-09-25 15:30:50.000000000 +0200
++++ gdb-7.2/gdb/linux-nat.h	2010-09-25 15:37:57.000000000 +0200
+@@ -58,10 +58,6 @@ struct lwp_info
+   /* The kind of stepping of this LWP.  */
+   enum resume_step step;
+ 
+-  /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
+-     be the address of a hardware watchpoint.  */
+-  struct siginfo siginfo;
+-
+   /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
+      watchpoint trap.  */
+   int stopped_by_watchpoint;

diff --git a/gdb-bz623749-gcore-relro.patch b/gdb-bz623749-gcore-relro.patch
new file mode 100644
index 0000000..4015a7a
--- /dev/null
+++ b/gdb-bz623749-gcore-relro.patch
@@ -0,0 +1,169 @@
+gdb:
+https://bugzilla.redhat.com/show_bug.cgi?id=623749
+kernel:
+https://bugzilla.redhat.com/show_bug.cgi?id=636937
+
+http://sourceware.org/ml/gdb-patches/2010-09/msg00395.html
+Subject: Re: [patch] Fix gcore writer for -Wl,-z,relro (PR corefiles/11804)
+
+gdb/testsuite/
+2010-09-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix gcore writer for -Wl,-z,relro.
+	* gdb.base/gcore-relro.exp: New file.
+	* gdb.base/gcore-relro-main.c: New file.
+	* gdb.base/gcore-relro-lib.c: New file.
+
+--- ./gdb/gcore.c	2010-09-23 20:14:56.000000000 +0200
++++ ./gdb/gcore.c	2010-09-23 20:37:56.000000000 +0200
+@@ -401,6 +401,7 @@ gcore_create_callback (CORE_ADDR vaddr, 
+ 
+   if (write == 0 && !solib_keep_data_in_core (vaddr, size))
+     {
++#if 0 /* https://bugzilla.redhat.com/show_bug.cgi?id=636937  */
+       /* See if this region of memory lies inside a known file on disk.
+ 	 If so, we can avoid copying its contents by clearing SEC_LOAD.  */
+       struct objfile *objfile;
+@@ -433,6 +434,7 @@ gcore_create_callback (CORE_ADDR vaddr, 
+ 	}
+ 
+     keep:
++#endif
+       flags |= SEC_READONLY;
+     }
+ 
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro-lib.c
+@@ -0,0 +1,21 @@
++/* 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/>.  */
++
++void
++lib (void)
++{
++}
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro-main.c
+@@ -0,0 +1,25 @@
++/* 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/>.  */
++
++extern void lib (void);
++
++int
++main (void)
++{
++  lib ();
++  return 0;
++}
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro.exp
+@@ -0,0 +1,80 @@
++# 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_shlib_tests]} {
++    return 0
++}
++
++set testfile "gcore-relro"
++set srcmainfile ${testfile}-main.c
++set srclibfile ${testfile}-lib.c
++set libfile ${objdir}/${subdir}/${testfile}-lib.so
++set objfile ${objdir}/${subdir}/${testfile}-main.o
++set executable ${testfile}-main
++set binfile ${objdir}/${subdir}/${executable}
++set gcorefile ${objdir}/${subdir}/${executable}.gcore
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} {debug}] != ""
++     || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
++     untested ${testfile}.exp
++     return -1
++}
++set opts [list debug shlib=${libfile} additional_flags=-Wl,-z,relro]
++if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
++     unsupported "-Wl,-z,relro compilation failed"
++     return -1
++}
++
++clean_restart $executable
++gdb_load_shlibs $libfile
++
++# Does this gdb support gcore?
++set test "help gcore"
++gdb_test_multiple $test $test {
++    -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
++	# gcore command not supported -- nothing to test here.
++	unsupported "gdb does not support gcore on this target"
++	return -1;
++    }
++    -re "Save a core file .*\r\n$gdb_prompt $" {
++	pass $test
++    }
++}
++
++if { ![runto lib] } then {
++    return -1
++}
++
++set escapedfilename [string_to_regexp ${gcorefile}]
++
++set test "save a corefile"
++gdb_test_multiple "gcore ${gcorefile}" $test {
++    -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
++	pass $test
++    }
++    -re "Can't create a corefile\r\n$gdb_prompt $" {
++	unsupported $test
++	return -1
++    }
++}
++
++# Now restart gdb and load the corefile.
++
++clean_restart $executable
++gdb_load_shlibs $libfile
++
++gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
++
++gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"

diff --git a/gdb-bz627432-loop-static-self-class.patch b/gdb-bz627432-loop-static-self-class.patch
new file mode 100644
index 0000000..7a03f17
--- /dev/null
+++ b/gdb-bz627432-loop-static-self-class.patch
@@ -0,0 +1,280 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00440.html
+Subject: [patch] Fix infinite loop crash on self-referencing class
+
+Hi,
+
+class C { static C s; }; is a problem for GDB as it references itself and it
+can crash.  Downstream Bug:
+	https://bugzilla.redhat.com/show_bug.cgi?id=627432
+
+#3  0x00000000005b2cc5 in gnuv3_pass_by_reference (type=0x1044d3c8) at ../../gdb/gnu-v3-abi.c:840
+#4  0x00000000005b2cc5 in gnuv3_pass_by_reference (type=0x1044d3c8) at ../../gdb/gnu-v3-abi.c:840
+[...]
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
+
+FYI the .cc file is not reproducible on - and only on - Fedora 14 GCC, filed:
+	https://bugzilla.redhat.com/show_bug.cgi?id=637315
+
+I would even check it in in some time.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-09-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix GDB crash on inferior calls with self-referencing classes.
+	* gnu-v3-abi.c (gnuv3_pass_by_reference): Do not call itself on static
+	member fields.
+
+gdb/testsuite/
+2010-09-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix GDB crash on inferior calls with self-referencing classes.
+	* gdb.dwarf2/dw2-cp-infcall-ref-static.exp: New file.
+	* gdb.dwarf2/dw2-cp-infcall-ref-static-main.c: New file.
+	* gdb.dwarf2/dw2-cp-infcall-ref-static.S: New file.
+
+--- a/gdb/gnu-v3-abi.c
++++ b/gdb/gnu-v3-abi.c
+@@ -835,9 +835,10 @@ gnuv3_pass_by_reference (struct type *type)
+      by reference, so does this class.  Similarly for members, which
+      are constructed whenever this class is.  We do not need to worry
+      about recursive loops here, since we are only looking at members
+-     of complete class type.  */
++     of complete class type.  Also ignore any static members.  */
+   for (fieldnum = 0; fieldnum < TYPE_NFIELDS (type); fieldnum++)
+-    if (gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum)))
++    if (TYPE_FIELD_LOC_KIND (type, fieldnum) == FIELD_LOC_KIND_BITPOS
++        && gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum)))
+       return 1;
+ 
+   return 0;
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c
+@@ -0,0 +1,51 @@
++/* 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 C
++     {
++     public:
++       static C s;
++     };
++   C C::s;
++   C f()
++   {
++     return C::s;
++   }  */
++
++asm (".globl cu_text_start");
++asm ("cu_text_start:");
++
++asm (".globl f_start");
++asm ("f_start:");
++
++void
++f (void)
++{
++}
++
++asm (".globl f_end");
++asm ("f_end:");
++
++int
++main (void)
++{
++  f ();
++  return 0;
++}
++
++asm (".globl cu_text_end");
++asm ("cu_text_end:");
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S
+@@ -0,0 +1,115 @@
++/* 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 */
++
++	.section .debug_info
++.Lcu1_begin:
++	/* CU header */
++	.4byte	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
++.Lcu1_start:
++	.2byte	2				/* DWARF Version */
++	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
++	.byte	4				/* Pointer size */
++
++	/* CU die */
++	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
++	.4byte	cu_text_start			/* DW_AT_low_pc */
++	.4byte	cu_text_end			/* DW_AT_high_pc */
++	.ascii	"file1.txt\0"			/* DW_AT_name */
++	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
++	.byte	4				/* DW_AT_language (DW_LANG_C_plus_plus) */
++
++.Ltype_class:
++	.uleb128	3			/* Abbrev: DW_TAG_class_type */
++	.ascii		"C\0"			/* DW_AT_name */
++
++	.uleb128	4			/* Abbrev: DW_TAG_member */
++	.ascii		"s\0"			/* DW_AT_name */
++	.4byte		.Ltype_class-.Lcu1_begin /* DW_AT_type */
++	.byte		1			/* DW_AT_declaration */
++	.byte		1			/* DW_AT_external */
++
++	.byte		0			/* End of children of DW_TAG_class_type */
++
++	.uleb128	5			/* Abbrev: DW_TAG_subprogram */
++	.ascii		"f\0"			/* DW_AT_name */
++	.4byte		.Ltype_class-.Lcu1_begin /* DW_AT_type */
++	.4byte		f_start			/* DW_AT_low_pc */
++	.4byte		f_end			/* DW_AT_high_pc */
++
++	.byte		0			/* End of children of CU */
++
++.Lcu1_end:
++
++/* Abbrev table */
++	.section .debug_abbrev
++.Labbrev1_begin:
++	.uleb128	1			/* Abbrev code */
++	.uleb128	0x11			/* DW_TAG_compile_unit */
++	.byte		1			/* has_children */
++	.uleb128	0x11			/* DW_AT_low_pc */
++	.uleb128	0x1			/* DW_FORM_addr */
++	.uleb128	0x12			/* DW_AT_high_pc */
++	.uleb128	0x1			/* DW_FORM_addr */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x25			/* DW_AT_producer */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x13			/* DW_AT_language */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	3			/* Abbrev code */
++	.uleb128	0x2			/* DW_TAG_class_type */
++	.byte		1			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	4			/* Abbrev code */
++	.uleb128	0xd			/* DW_TAG_member */
++	.byte		0			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x49			/* DW_AT_type */
++	.uleb128	0x13			/* DW_FORM_ref4 */
++	.uleb128	0x3c			/* DW_AT_declaration */
++	.uleb128	0xc			/* DW_FORM_flag */
++	.uleb128	0x3f			/* DW_AT_external */
++	.uleb128	0xc			/* DW_FORM_flag */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	5			/* Abbrev code */
++	.uleb128	0x2e			/* DW_TAG_subprogram */
++	.byte		0			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.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			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
+@@ -0,0 +1,49 @@
++# 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/>.
++
++# Check that GDB can call C++ functions whose parameters or return values have
++# type containing a static member of the same type.
++
++# Still no C++ compiler is used.
++if { [skip_cplus_tests] } { continue }
++
++# 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-cp-infcall-ref-static"
++if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}-main.c ${testfile}.S] {}] } {
++    return -1
++}
++
++if ![runto_main] then {
++    return -1
++}
++
++# main is not provided by DWARF.
++gdb_test_no_output "set language c++"
++
++# There are no mangled names in DWARF to suggest the v3 ABI.
++gdb_test_no_output "set cp-abi gnu-v3"
++
++# GDB could crash.  There is no DW_AT_location so it is <optimized out>.
++gdb_test "p f()" { = {static s = <optimized out>}}
+

diff --git a/gdb-bz631158-cxx-this-lookup.patch b/gdb-bz631158-cxx-this-lookup.patch
new file mode 100644
index 0000000..0d7ae05
--- /dev/null
+++ b/gdb-bz631158-cxx-this-lookup.patch
@@ -0,0 +1,14 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=631158
+http://sourceware.org/ml/gdb-patches/2010-09/msg00229.html
+Subject: [patch] PR 11992 "Regression: C++ this scope sometimes does not work"
+
+--- gdb-7.2/gdb/c-exp.y.orig	2010-08-19 17:50:00.000000000 +0200
++++ gdb-7.2/gdb/c-exp.y	2010-09-11 20:30:15.000000000 +0200
+@@ -2422,6 +2422,7 @@ classify_name (struct block *block)
+ 
+   if (sym == NULL
+       && parse_language->la_language == language_cplus
++      && !is_a_field_of_this
+       && !lookup_minimal_symbol (copy, NULL, NULL))
+     return UNKNOWN_CPP_NAME;
+ 

diff --git a/gdb-bz631575-gdb-index-nobits.patch b/gdb-bz631575-gdb-index-nobits.patch
new file mode 100644
index 0000000..707a613
--- /dev/null
+++ b/gdb-bz631575-gdb-index-nobits.patch
@@ -0,0 +1,61 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00183.html
+Subject: [patch] .gdb_index: Do not crash on NOBITS
+
+Hi,
+
+elfutils-0.148 still do not contain patch of its GIT
+804e9ca4d644e64a6125307cbf0a0b89477d7611 where the .gdb_index section has been
+also split into the separate debug info file.
+
+Due to it binaries split using elfutils-0.148 contain
+  [38] .gdb_index        NOBITS           0000000000000000  0000338c
+instead of expected
+  [28] .gdb_index        PROGBITS         0000000000000000  0000211c
+
+and due to it GDB while reading the file can error() by:
+Reading symbols from x.debug...Dwarf Error: Can't read DWARF data from 'x.debug'
+
+which should not be fatal but due to some other bugs therein it can crash GDB.
+
+The wrong separate debug info file is for example:
+http://kojipkgs.fedoraproject.org/packages/glibc/2.12.90/10/x86_64/glibc-debuginfo-2.12.90-10.x86_64.rpm
+/usr/lib/debug/lib64/libutil-2.12.90.so.debug
+
+OK to check-in?
+
+It does not attempt to use .gdb_index from the main binary, it will just
+disable .gdb_index usage on these binaries.
+
+
+Thanks,
+Jan
+
+
+http://sourceware.org/ml/gdb-cvs/2010-09/msg00062.html
+
+### src/gdb/ChangeLog	2010/09/08 19:09:42	1.12162
+### src/gdb/ChangeLog	2010/09/08 19:49:28	1.12163
+## -1,3 +1,7 @@
++2010-09-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	* dwarf2read.c (dwarf2_read_index): Return on no SEC_HAS_CONTENTS.
++
+ 2010-09-08  Daniel Jacobowitz  <dan@codesourcery.com>
+ 
+ 	* dwarf2read.c (read_structure_type): Move processing of
+--- src/gdb/dwarf2read.c	2010/09/08 19:09:42	1.452
++++ src/gdb/dwarf2read.c	2010/09/08 19:49:28	1.453
+@@ -1904,6 +1904,13 @@
+   if (dwarf2_per_objfile->gdb_index.asection == NULL
+       || dwarf2_per_objfile->gdb_index.size == 0)
+     return 0;
++
++  /* Older elfutils strip versions could keep the section in the main
++     executable while splitting it for the separate debug info file.  */
++  if ((bfd_get_file_flags (dwarf2_per_objfile->gdb_index.asection)
++       & SEC_HAS_CONTENTS) == 0)
++    return 0;
++
+   dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index);
+ 
+   addr = dwarf2_per_objfile->gdb_index.buffer;

diff --git a/gdb-bz634660-gdbpy-load-on-attach.patch b/gdb-bz634660-gdbpy-load-on-attach.patch
new file mode 100644
index 0000000..2223776
--- /dev/null
+++ b/gdb-bz634660-gdbpy-load-on-attach.patch
@@ -0,0 +1,61 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00365.html
+Subject: [patch] python: load *-gdb.py for shlibs during attach
+
+Hi,
+
+currently if you attach to or load a core file for executable, its -gdb.py
+script is loaded.  But none -gdb.py for the shared libraries.
+
+Spawned or with the fix (libstdc++-gdb.py):
+#1  0x00000000004007b5 in f (s="a") at 1.C:4
+                             ^ is std::string
+
+Attached/core without the fix:
+#1  0x00000000004007b5 in f (s=...) at 1.C:4
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
+
+Mostly obvious, I will check it in later.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-09-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* main.c: Include objfiles.h.
+	(captured_main): New variable objfile.  Call
+	load_auto_scripts_for_objfile for ALL_OBJFILES.
+
+--- ./gdb/main.c	2010-09-22 10:51:32.000000000 +0200
++++ ./gdb/main.c	2010-09-22 10:50:44.000000000 +0200
+@@ -43,6 +43,7 @@
+ #include "source.h"
+ #include "cli/cli-cmds.h"
+ #include "python/python.h"
++#include "objfiles.h"
+ 
+ /* The selected interpreter.  This will be used as a set command
+    variable, so it should always be malloc'ed - since
+@@ -323,6 +324,7 @@ captured_main (void *data)
+ 
+   int i;
+   int save_auto_load;
++  struct objfile *objfile;
+ 
+   struct cleanup *pre_stat_chain = make_command_stats_cleanup (0);
+ 
+@@ -957,8 +959,8 @@ Can't attach to process and specify a co
+      We wait until now because it is common to add to the source search
+      path in local_gdbinit.  */
+   gdbpy_global_auto_load = save_auto_load;
+-  if (symfile_objfile != NULL)
+-    load_auto_scripts_for_objfile (symfile_objfile);
++  ALL_OBJFILES (objfile)
++    load_auto_scripts_for_objfile (objfile);
+ 
+   for (i = 0; i < ncmd; i++)
+     {
+

diff --git a/gdb-bz637770-ifunc-watchpoint-delete.patch b/gdb-bz637770-ifunc-watchpoint-delete.patch
new file mode 100644
index 0000000..17015dd
--- /dev/null
+++ b/gdb-bz637770-ifunc-watchpoint-delete.patch
@@ -0,0 +1,111 @@
+commit 30fedadf224a8c119575fcc8a6ced51f0d4aee9f
+Author: Jan Kratochvil <jan.kratochvil@redhat.com>
+Date:   Wed Sep 29 01:25:39 2010 +0200
+
+    Fix the crash.
+
+commit d101ce597f2d6143e9f023a4444352bceffb2679
+Author: Jan Kratochvil <jan.kratochvil@redhat.com>
+Date:   Wed Sep 29 00:42:37 2010 +0200
+
+    New testcase for: https://bugzilla.redhat.com/show_bug.cgi?id=637770
+
+diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
+index de51231..18b7868 100644
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -10560,6 +10560,11 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *,
+ 		    /* FUNCTION can be also delete_breakpoint.  */
+ 		    next_related_b = related_breakpoint->related_breakpoint;
+ 		    function (related_breakpoint, data);
++
++		    /* For delete_breakpoint of the last entry of the ring we
++		       were traversing we would never get back to B.  */
++		    if (next_related_b == related_breakpoint)
++		      break;
+ 		    related_breakpoint = next_related_b;
+ 		  }
+ 		while (related_breakpoint != b);
+diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.c b/gdb/testsuite/gdb.base/watchpoint-delete.c
+new file mode 100644
+index 0000000..031ef92
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-delete.c
+@@ -0,0 +1,33 @@
++/* 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/>.  */
++
++void
++func (void)
++{
++  volatile int x = 0;
++
++  x++;	/* break-here */
++  x++;
++}
++
++int
++main (void)
++{
++  func ();
++
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.exp b/gdb/testsuite/gdb.base/watchpoint-delete.exp
+new file mode 100644
+index 0000000..45bc650
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-delete.exp
+@@ -0,0 +1,38 @@
++# 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 "watchpoint-delete"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
++    untested ${testfile}.exp
++    return -1
++}
++
++# It is more compatible this way.
++gdb_test_no_output "set can-use-hw-watchpoints 0"
++
++if ![runto_main] {
++    return -1
++}
++
++# Ensure there is a parent frame to create related bp_watchpoint_scope.
++gdb_breakpoint [gdb_get_line_number "break-here"]
++gdb_continue_to_breakpoint "break-here" ".* break-here .*"
++
++gdb_test "watch x" {Watchpoint [0-9]+: x}
++
++gdb_test_no_output {delete $bpnum}

diff --git a/gdb-bz642879-elfread-sigint-stale.patch b/gdb-bz642879-elfread-sigint-stale.patch
new file mode 100644
index 0000000..5a079ef
--- /dev/null
+++ b/gdb-bz642879-elfread-sigint-stale.patch
@@ -0,0 +1,85 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00192.html
+Subject: [patch] Fix ELF stale reference  [Re: [patch] .gdb_index: Do not crash on NOBITS]
+
+On Wed, 08 Sep 2010 21:40:12 +0200, Tom Tromey wrote:
+> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
+> 
+> Jan> which should not be fatal but due to some other bugs therein it can
+> Jan> crash GDB.
+> 
+> I am curious about these other bugs.
+
++      /* Memory gets permanently referenced from ABFD after
++	 bfd_get_synthetic_symtab so it must not get freed before ABFD gets.
++	 It happens only in the case when elf_slurp_reloc_table sees
++	 asection->relocation NULL.  Determining which section is asection is
++	 done by _bfd_elf_get_synthetic_symtab which is all a bfd
++	 implementation detail, though.  */
+
+That is from:
+
+#0  in elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count=1170, relents, symbols, dynamic=1) at elfcode.h:1482
+#1  in bfd_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic=1) at elfcode.h:1563
+#2  in _bfd_elf_get_synthetic_symtab (abfd, symcount=0, syms, dynsymcount=1792, dynsyms, ret) at elf.c:9269
+#3  in elf_symfile_read (objfile, symfile_flags=6) at elfread.c:809
+
+Where
+	  elfcode.h:elf_slurp_reloc_table_from_section
+contains
+          ps = symbols + ELF_R_SYM (rela.r_info) - 1;
+          relent->sym_ptr_ptr = ps;
+
+`symbols' here is elf_symfile_read's `dyn_symbol_table'.  `dyn_symbol_table'
+got immediately xfree'd but the freed memory remained referenced by
+asect->relocation (containing the RELENT memory above, stored there by
+elf_slurp_reloc_table).
+
+asect->relocation probably does not get used if ABFD is not being read-in the
+second time, which happens only if OBJFILE is being created the second time,
+which happens due to the error call in the previous mail.
+
+
+I was curious there elf_symfile_read uses 0 for COPY_NAMES in a similar case:
+      elf_symtab_read (objfile, ST_REGULAR, symcount, symbol_table, 0);
+where SYMBOL_TABLE is also immediately xfreed.  But that seems to be correct as
+elf_slurp_symbol_table uses 
+      symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
+for the content where later elfread.c's SYMBOL_TABLE points to.  Only the
+pointers get xfreed which is OK.
+
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-09-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix stale memory references.
+	* elfread.c: Include libbfd.h.
+	(elf_symfile_read): Replace xmalloc by bfd_alloc, drop xfree, new
+	comment.
+
+--- a/gdb/elfread.c
++++ b/gdb/elfread.c
+@@ -792,8 +793,14 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
+ 
+   if (storage_needed > 0)
+     {
+-      dyn_symbol_table = (asymbol **) xmalloc (storage_needed);
+-      make_cleanup (xfree, dyn_symbol_table);
++      /* Memory gets permanently referenced from ABFD after
++	 bfd_get_synthetic_symtab so it must not get freed before ABFD gets.
++	 It happens only in the case when elf_slurp_reloc_table sees
++	 asection->relocation NULL.  Determining which section is asection is
++	 done by _bfd_elf_get_synthetic_symtab which is all a bfd
++	 implementation detail, though.  */
++
++      dyn_symbol_table = bfd_alloc (abfd, storage_needed);
+       dynsymcount = bfd_canonicalize_dynamic_symtab (objfile->obfd,
+ 						     dyn_symbol_table);
+ 
+

diff --git a/gdb-bz645773-ifort-case-1of3.patch b/gdb-bz645773-ifort-case-1of3.patch
new file mode 100644
index 0000000..ec9f88d
--- /dev/null
+++ b/gdb-bz645773-ifort-case-1of3.patch
@@ -0,0 +1,313 @@
+http://sourceware.org/ml/gdb-patches/2010-11/msg00084.html
+Subject: [new testcase] Regression 7.1->7.2 for iFort  [Re: [RFA-v2] dwarf debug format: Support DW_AT_variable_parameter attribute]
+
+On Fri, 21 May 2010 22:45:35 +0200, Pierre Muller wrote:
+>   Thanks, I committed the patch.
+
+commit 570d5d01de35effada277a69552c0903a4928241
+Author: Pierre Muller <muller@ics.u-strasbg.fr>
+Date:   Fri May 21 20:45:18 2010 +0000
+
+	* dwarf2read.c (new_symbol): Handle DW_AT_variable_parameter
+	attribute.
+
+
+Please revert this patch.
+
+>From the DWARF-4 description of DW_AT_variable_parameter I do not think it
+changes the data structures meaning in any way.  It just states which data can
+be modified by whom.  I do not think this is useful for GDB in any way.
+
+
+> > I think it would be improved by a test case, but that is up to you.
+> 
+>   This test would be pascal specific anyhow,
+
+I believe the Pascal compiler should generate different debug info.  For the
+`var' keyword you can either (a) use DW_TAG_reference_type and point
+DW_AT_location at the pointer or (b) use DW_OP_deref (as iFort does) on the
+passed pointer and point DW_AT_location at the value itself.
+DW_AT_variable_parameter would be true only for the (a) choice.
+
+1	  subroutine f (i)
+2	  integer i
+3	  i = 2
+4	  end
+5	  program varparam
+6	  integer m
+7	  m = 1
+8	  call f (m)
+9	  write(*,*) m
+10	  end
+
+for iFort 11.1 20100806 it regressed this code, GDB-7.1 displayed:
+
+Breakpoint 1, f (i=1) at varparam.f90:3
+3	  i = 2
+(gdb) p i
+$1 = 1
+
+while GDB-7.2 displays:
+
+Breakpoint 2, f (i=@0x1) at varparam.f90:3
+3	  i = 2
+(gdb) p i
+$1 = (REF TO -> ( INTEGER(4) )) @0x1: <error reading variable>
+
+(note that `0x1' GDB considers as an address here)
+
+
+
+A new testcase for the iFort usage case is attached.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
+
+I will then check-in the testcase or you can or so.
+
+
+Regards,
+Jan
+
+
+gdb/
+2010-11-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Revert:
+	2010-05-21  Pierre Muller  <muller@ics.u-strasbg.fr>
+	* dwarf2read.c (new_symbol): Handle DW_AT_variable_parameter
+	attribute.
+
+gdb/testsuite/
+2010-11-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* dw2-ifort-parameter-debug.S: New file.
+	* dw2-ifort-parameter.c: New file.
+	* dw2-ifort-parameter.exp: New file.
+
+Index: gdb-7.2/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.2.orig/gdb/dwarf2read.c	2010-11-07 05:24:01.000000000 +0100
++++ gdb-7.2/gdb/dwarf2read.c	2010-11-07 05:36:34.000000000 +0100
+@@ -10474,14 +10474,6 @@ new_symbol (struct die_info *die, struct
+ 	    {
+ 	      dwarf2_const_value (attr, sym, cu);
+ 	    }
+-	  attr = dwarf2_attr (die, DW_AT_variable_parameter, cu);
+-	  if (attr && DW_UNSND (attr))
+-	    {
+-	      struct type *ref_type;
+-
+-	      ref_type = lookup_reference_type (SYMBOL_TYPE (sym));
+-	      SYMBOL_TYPE (sym) = ref_type;
+-	    }
+ 
+ 	  add_symbol_to_list (sym, cu->list_in_scope);
+ 	  break;
+Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S	2010-11-07 05:36:18.000000000 +0100
+@@ -0,0 +1,122 @@
++/* 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 .debug_info
++.Lcu1_begin:
++	/* CU header */
++	.4byte	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
++.Lcu1_start:
++	.2byte	2				/* DWARF Version */
++	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
++	.byte	4				/* Pointer size */
++
++	/* CU die */
++	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
++	.ascii	"file1.txt\0"			/* DW_AT_name */
++	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
++	.byte	1				/* DW_AT_language (C) */
++	.4byte	func				/* DW_AT_low_pc */
++	.4byte	main				/* DW_AT_high_pc */
++
++	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
++	.byte		1			/* DW_AT_external */
++	.ascii		"func\0"		/* DW_AT_name */
++	.4byte		func			/* DW_AT_low_pc */
++	.4byte		main			/* DW_AT_high_pc */
++
++	.uleb128	3			/* Abbrev: DW_TAG_formal_parameter */
++	.ascii		"param\0"		/* DW_AT_name */
++	.byte		1			/* DW_AT_variable_parameter */
++	.4byte		.Ltype_int - .Lcu1_begin	/* DW_AT_type */
++	.byte		2f - 1f			/* DW_AT_location */
++1:	.byte		3			/*   DW_OP_addr */
++	.4byte		ptr			/*   <addr> */
++	.byte		0x6			/*   DW_OP_deref */
++2:
++
++	.byte		0			/* End of children of func */
++
++.Ltype_int:
++	.uleb128	4			/* Abbrev: DW_TAG_base_type */
++	.ascii		"int\0"			/* DW_AT_name */
++	.byte		4			/* DW_AT_byte_size */
++	.byte		5			/* DW_AT_encoding */
++
++	.byte		0			/* End of children of CU */
++.Lcu1_end:
++
++/* Abbrev table */
++	.section .debug_abbrev
++.Labbrev1_begin:
++	.uleb128	1			/* Abbrev code */
++	.uleb128	0x11			/* DW_TAG_compile_unit */
++	.byte		1			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x25			/* DW_AT_producer */
++	.uleb128	0x8			/* DW_FORM_string */
++	.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	0x1			/* DW_FORM_addr */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	2			/* Abbrev code */
++	.uleb128	0x2e			/* DW_TAG_subprogram */
++	.byte		1			/* has_children */
++	.uleb128	0x3f			/* DW_AT_external */
++	.uleb128	0xc			/* DW_FORM_flag */
++	.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 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	3			/* Abbrev code */
++	.uleb128	0x05			/* DW_TAG_formal_parameter */
++	.byte		0			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x4b			/* DW_AT_variable_parameter */
++	.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		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	4			/* Abbrev code */
++	.uleb128	0x24			/* DW_TAG_base_type */
++	.byte		0			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.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 */
++
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
+Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c	2010-11-07 05:36:18.000000000 +0100
+@@ -0,0 +1,31 @@
++/* 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 value = 0xdeadf00d;
++int *ptr = &value;
++
++void
++func (void)
++{
++}
++
++int
++main (void)
++{
++  func ();
++  return 0;
++}
+Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp	2010-11-07 05:36:18.000000000 +0100
+@@ -0,0 +1,40 @@
++# 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/>.
++
++# Verify DW_AT_variable_parameter does not modify the data structures meaning
++# for GDB, as being used by iFort.
++
++# 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-ifort-parameter"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
++    return -1
++}
++
++if ![runto func] {
++    return -1
++}
++
++gdb_test "p/x param" " = 0xdeadf00d"

diff --git a/gdb-bz645773-ifort-case-2of3.patch b/gdb-bz645773-ifort-case-2of3.patch
new file mode 100644
index 0000000..b871a70
--- /dev/null
+++ b/gdb-bz645773-ifort-case-2of3.patch
@@ -0,0 +1,204 @@
+http://sourceware.org/ml/gdb-patches/2010-11/msg00107.html
+Subject: [patch 1/2] Code cleanup: New init_one_comp_unit
+
+Hi,
+
+unify some code into a function, to be extended in the next patch.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-11-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Code cleanup.
+	* dwarf2read.c (alloc_one_comp_unit): Rename prototype to ...
+	(init_one_comp_unit): ... this one.
+	(prepare_one_comp_unit): New prototype.
+	(dw2_require_line_header, process_psymtab_comp_unit): Use
+	init_one_comp_unit.
+	(process_psymtab_comp_unit): Use prepare_one_comp_unit.
+	(load_partial_comp_unit): Remove variable attr.  Use
+	init_one_comp_unit with xmalloc.  Use prepare_one_comp_unit.
+	(load_full_comp_unit): Use init_one_comp_unit with xmalloc.  Use
+	prepare_one_comp_unit.
+	(read_signatured_type): Remove variable attr.  Use init_one_comp_unit.
+	Use prepare_one_comp_unit.
+	(alloc_one_comp_unit): Rename to ...
+	(init_one_comp_unit): ... here and remove there calloc, new parameter
+	cu.
+	(prepare_one_comp_unit): New function.
+
+Index: gdb-7.2/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.2.orig/gdb/dwarf2read.c	2010-11-07 05:36:34.000000000 +0100
++++ gdb-7.2/gdb/dwarf2read.c	2010-11-07 05:38:21.000000000 +0100
+@@ -1214,7 +1214,11 @@ static struct dwarf2_per_cu_data *dwarf2
+ static struct dwarf2_per_cu_data *dwarf2_find_comp_unit
+   (unsigned int offset, struct objfile *objfile);
+ 
+-static struct dwarf2_cu *alloc_one_comp_unit (struct objfile *objfile);
++static void init_one_comp_unit (struct dwarf2_cu *cu,
++				struct objfile *objfile);
++
++static void prepare_one_comp_unit (struct dwarf2_cu *cu,
++				   struct die_info *comp_unit_die);
+ 
+ static void free_one_comp_unit (void *);
+ 
+@@ -1980,10 +1984,7 @@ dw2_require_line_header (struct objfile 
+     return;
+   this_cu->v.quick->read_lines = 1;
+ 
+-  memset (&cu, 0, sizeof (cu));
+-  cu.objfile = objfile;
+-  obstack_init (&cu.comp_unit_obstack);
+-
++  init_one_comp_unit (&cu, objfile);
+   cleanups = make_cleanup (free_stack_comp_unit, &cu);
+ 
+   dwarf2_read_section (objfile, &dwarf2_per_objfile->info);
+@@ -2978,10 +2979,7 @@ process_psymtab_comp_unit (struct objfil
+   CORE_ADDR best_lowpc = 0, best_highpc = 0;
+   struct die_reader_specs reader_specs;
+ 
+-  memset (&cu, 0, sizeof (cu));
+-  cu.objfile = objfile;
+-  obstack_init (&cu.comp_unit_obstack);
+-
++  init_one_comp_unit (&cu, objfile);
+   back_to_inner = make_cleanup (free_stack_comp_unit, &cu);
+ 
+   info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr,
+@@ -3035,12 +3033,7 @@ process_psymtab_comp_unit (struct objfil
+       return info_ptr;
+     }
+ 
+-  /* Set the language we're debugging.  */
+-  attr = dwarf2_attr (comp_unit_die, DW_AT_language, &cu);
+-  if (attr)
+-    set_cu_language (DW_UNSND (attr), &cu);
+-  else
+-    set_cu_language (language_minimal, &cu);
++  prepare_one_comp_unit (&cu, comp_unit_die);
+ 
+   /* Allocate a new partial symbol table structure.  */
+   attr = dwarf2_attr (comp_unit_die, DW_AT_name, &cu);
+@@ -3263,7 +3256,8 @@ load_partial_comp_unit (struct dwarf2_pe
+   info_ptr = dwarf2_per_objfile->info.buffer + this_cu->offset;
+   beg_of_comp_unit = info_ptr;
+ 
+-  cu = alloc_one_comp_unit (objfile);
++  cu = xmalloc (sizeof (*cu));
++  init_one_comp_unit (cu, objfile);
+ 
+   /* ??? Missing cleanup for CU?  */
+ 
+@@ -3290,12 +3284,7 @@ load_partial_comp_unit (struct dwarf2_pe
+   info_ptr = read_full_die (&reader_specs, &comp_unit_die, info_ptr,
+ 			    &has_children);
+ 
+-  /* Set the language we're debugging.  */
+-  attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu);
+-  if (attr)
+-    set_cu_language (DW_UNSND (attr), cu);
+-  else
+-    set_cu_language (language_minimal, cu);
++  prepare_one_comp_unit (cu, comp_unit_die);
+ 
+   /* Check if comp unit has_children.
+      If so, read the rest of the partial symbols from this comp unit.
+@@ -4227,7 +4216,8 @@ load_full_comp_unit (struct dwarf2_per_c
+   info_ptr = dwarf2_per_objfile->info.buffer + offset;
+   beg_of_comp_unit = info_ptr;
+ 
+-  cu = alloc_one_comp_unit (objfile);
++  cu = xmalloc (sizeof (*cu));
++  init_one_comp_unit (cu, objfile);
+ 
+   /* If an error occurs while loading, release our storage.  */
+   free_cu_cleanup = make_cleanup (free_one_comp_unit, cu);
+@@ -4254,11 +4244,7 @@ load_full_comp_unit (struct dwarf2_per_c
+      all objfiles needed for references have been loaded yet, and symbol
+      table processing isn't initialized.  But we have to set the CU language,
+      or we won't be able to build types correctly.  */
+-  attr = dwarf2_attr (cu->dies, DW_AT_language, cu);
+-  if (attr)
+-    set_cu_language (DW_UNSND (attr), cu);
+-  else
+-    set_cu_language (language_minimal, cu);
++  prepare_one_comp_unit (cu, cu->dies);
+ 
+   /* Similarly, if we do not read the producer, we can not apply
+      producer-specific interpretation.  */
+@@ -12617,17 +12603,15 @@ read_signatured_type (struct objfile *ob
+   struct dwarf2_cu *cu;
+   ULONGEST signature;
+   struct cleanup *back_to, *free_cu_cleanup;
+-  struct attribute *attr;
+ 
+   dwarf2_read_section (objfile, &dwarf2_per_objfile->types);
+   types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset;
+ 
+   gdb_assert (type_sig->per_cu.cu == NULL);
+ 
+-  cu = xmalloc (sizeof (struct dwarf2_cu));
+-  memset (cu, 0, sizeof (struct dwarf2_cu));
+-  obstack_init (&cu->comp_unit_obstack);
+-  cu->objfile = objfile;
++  cu = xmalloc (sizeof (*cu));
++  init_one_comp_unit (cu, objfile);
++
+   type_sig->per_cu.cu = cu;
+   cu->per_cu = &type_sig->per_cu;
+ 
+@@ -12659,11 +12643,7 @@ read_signatured_type (struct objfile *ob
+      all objfiles needed for references have been loaded yet, and symbol
+      table processing isn't initialized.  But we have to set the CU language,
+      or we won't be able to build types correctly.  */
+-  attr = dwarf2_attr (cu->dies, DW_AT_language, cu);
+-  if (attr)
+-    set_cu_language (DW_UNSND (attr), cu);
+-  else
+-    set_cu_language (language_minimal, cu);
++  prepare_one_comp_unit (cu, cu->dies);
+ 
+   do_cleanups (back_to);
+ 
+@@ -13755,15 +13735,29 @@ dwarf2_find_comp_unit (unsigned int offs
+   return this_cu;
+ }
+ 
+-/* Malloc space for a dwarf2_cu for OBJFILE and initialize it.  */
++/* Initialize dwarf2_cu CU for OBJFILE in a pre-allocated space.  */
+ 
+-static struct dwarf2_cu *
+-alloc_one_comp_unit (struct objfile *objfile)
++static void
++init_one_comp_unit (struct dwarf2_cu *cu, struct objfile *objfile)
+ {
+-  struct dwarf2_cu *cu = xcalloc (1, sizeof (struct dwarf2_cu));
++  memset (cu, 0, sizeof (*cu));
+   cu->objfile = objfile;
+   obstack_init (&cu->comp_unit_obstack);
+-  return cu;
++}
++
++/* Initiailize basic fields of dwarf_cu CU according to DIE COMP_UNIT_DIE.  */
++
++static void
++prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die)
++{
++  struct attribute *attr;
++
++  /* Set the language we're debugging.  */
++  attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu);
++  if (attr)
++    set_cu_language (DW_UNSND (attr), cu);
++  else
++    set_cu_language (language_minimal, cu);
+ }
+ 
+ /* Release one cached compilation unit, CU.  We unlink it from the tree

diff --git a/gdb-bz645773-ifort-case-3of3.patch b/gdb-bz645773-ifort-case-3of3.patch
new file mode 100644
index 0000000..084f9d2
--- /dev/null
+++ b/gdb-bz645773-ifort-case-3of3.patch
@@ -0,0 +1,448 @@
+http://sourceware.org/ml/gdb-patches/2010-11/msg00108.html
+Subject: [patch 2/2] iFort compat.: case insensitive symbols (PR 11313)
+
+Hi,
+
+iFort (Intel Fortran compiler) produces DIEs like:
+
+ <1><1dc>: Abbrev Number: 6 (DW_TAG_module)
+    <1e0>   DW_AT_name        : MOD1    
+
+But Fortran is case insensitive, therefore GDB lowercases any user input
+first.  Symbols cannot match.  gfortran always produces lowercased DIE names.
+
+I was told by Jakub Jelinek GCC frontend will never be properly case
+preserving - to output "Mod1" if user stated it in such case in the sources.
+
+Therefore GDB will now lowercase any case insensitive symbol names on their
+read-in from DWARF.
+
+ELF symbol tables are currently not touched - their matching to their CU (and
+thus to their DW_AT_identifier_case / DW_AT_language) is expensive and it does
+not seem to me to be needed for iFort as only the module names are uppercased
+there.
+
+For the iFort compatibility there is also needed:
+	[new testcase] Regression 7.1->7.2 for iFort [Re: [RFA-v2] dwarf debug format: Support DW_AT_variable_parameter attribute]
+	http://sourceware.org/ml/gdb-patches/2010-11/msg00084.html
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	PR 11313 - case insensitive identifiers in DWARF not in lowercase.
+	* dwarf2read.c: Include ctype.h.
+	(struct dwarf2_cu) <case_sensitivity>: New.
+	(struct attribute) <string_is_canonical>: Update the comment.
+	(canonical_case): New declaration.
+	(read_partial_die): Call canonical_case.
+	(canonical_case): New function.
+	(dwarf2_canonicalize_name): Update the function comment.  Call
+	canonical_case, adjust the obstack allocation.
+	(dwarf2_name): Call canonical_case, set DW_STRING_IS_CANONICAL.
+	(init_one_comp_unit, prepare_one_comp_unit): Set cu->case_sensitivity.
+
+gdb/testsuite/
+2010-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	PR 11313 - case insensitive identifiers in DWARF not in lowercase.
+	* gdb.dwarf2/dw2-case-insensitive-debug.S: New.
+	* gdb.dwarf2/dw2-case-insensitive.c: New.
+	* gdb.dwarf2/dw2-case-insensitive.exp: New.
+	* gdb.mi/mi-var-child-f.exp (mi_runto): Use lowercase main__.
+
+Index: gdb-7.2/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.2.orig/gdb/dwarf2read.c	2010-11-07 05:38:21.000000000 +0100
++++ gdb-7.2/gdb/dwarf2read.c	2010-11-07 05:38:47.000000000 +0100
+@@ -55,6 +55,7 @@
+ #include "gdb_stat.h"
+ #include "completer.h"
+ #include "top.h"
++#include <ctype.h>
+ 
+ #include <fcntl.h>
+ #include "gdb_string.h"
+@@ -376,6 +377,10 @@ struct dwarf2_cu
+      DIEs for namespaces, we don't need to try to infer them
+      from mangled names.  */
+   unsigned int has_namespace_info : 1;
++
++  /* Are identifiers in this CU case sensitive or should they be lowercased
++     before storing them into GDB symbol tables?  */
++  enum case_sensitivity case_sensitivity;
+ };
+ 
+ /* When using the index (and thus not using psymtabs), each CU has an
+@@ -621,9 +626,10 @@ struct attribute
+     ENUM_BITFIELD(dwarf_attribute) name : 16;
+     ENUM_BITFIELD(dwarf_form) form : 15;
+ 
+-    /* Has DW_STRING already been updated by dwarf2_canonicalize_name?  This
+-       field should be in u.str (existing only for DW_STRING) but it is kept
+-       here for better struct attribute alignment.  */
++    /* Has DW_STRING already been updated by dwarf2_canonicalize_name or
++       canonical_case?  This field should be in u.str (existing only for
++       DW_STRING) but it is kept here for better struct attribute alignment.
++       */
+     unsigned int string_is_canonical : 1;
+ 
+     union
+@@ -1109,6 +1115,9 @@ static gdb_byte *read_full_die (const st
+ 
+ static void process_die (struct die_info *, struct dwarf2_cu *);
+ 
++static char *canonical_case (char *name, struct dwarf2_cu *cu,
++			     struct obstack *obstack);
++
+ static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *,
+ 				       struct obstack *);
+ 
+@@ -8589,7 +8598,8 @@ read_partial_die (struct partial_die_inf
+ 	    case DW_TAG_enumerator:
+ 	      /* These tags always have simple identifiers already; no need
+ 		 to canonicalize them.  */
+-	      part_die->name = DW_STRING (&attr);
++	      part_die->name = canonical_case (DW_STRING (&attr), cu,
++					       &cu->objfile->objfile_obstack);
+ 	      break;
+ 	    default:
+ 	      part_die->name
+@@ -11043,7 +11053,36 @@ sibling_die (struct die_info *die)
+   return die->sibling;
+ }
+ 
+-/* Get name of a die, return NULL if not found.  */
++/* Convert NAME to the lower case if CU is case_sensitive_off.  Allocate
++   memory on OBSTACK if needed, otherwise return the NAME pointer.  */
++
++static char *
++canonical_case (char *name, struct dwarf2_cu *cu,
++		struct obstack *obstack)
++{
++  char *retval;
++  int i;
++
++  if (cu->case_sensitivity == case_sensitive_on)
++    return name;
++
++  for (i = 0; name[i] != 0; i++)
++    if (tolower (name[i]) != name[i])
++      break;
++  if (name[i] == 0)
++    return name;
++
++  retval = obstack_alloc (obstack, strlen (name) + 1);
++
++  for (i = 0; name[i] != 0; i++)
++    retval[i] = tolower (name[i]);
++  retval[i] = 0;
++
++  return retval;
++}
++
++/* Get name of a die, return NULL if not found.  canonical_case is always
++   already called for the returned string.  */
+ 
+ static char *
+ dwarf2_canonicalize_name (char *name, struct dwarf2_cu *cu,
+@@ -11055,14 +11094,26 @@ dwarf2_canonicalize_name (char *name, st
+ 
+       if (canon_name != NULL)
+ 	{
+-	  if (strcmp (canon_name, name) != 0)
+-	    name = obsavestring (canon_name, strlen (canon_name),
++	  char *cased_name;
++
++	  cased_name = canonical_case (canon_name, cu, obstack);
++
++	  /* Push CASED_NAME on OBSTACK only if it isn't already pushed there
++	     by canonical_case and if it was allocated using xmalloc by
++	     cp_canonicalize_string.  */
++	  if (strcmp (canon_name, cased_name) == 0
++	      && strcmp (canon_name, name) != 0)
++	    name = obsavestring (cased_name, strlen (cased_name),
+ 				 obstack);
++	  else
++	    name = cased_name;
+ 	  xfree (canon_name);
++
++	  return name;
+ 	}
+     }
+ 
+-  return name;
++  return canonical_case (name, cu, obstack);
+ }
+ 
+ /* Get name of a die, return NULL if not found.  */
+@@ -11088,7 +11139,13 @@ dwarf2_name (struct die_info *die, struc
+     case DW_TAG_enumeration_type:
+     case DW_TAG_enumerator:
+       /* These tags always have simple identifiers already; no need
+-	 to canonicalize them.  */
++	 to call dwarf2_canonicalize_name for them.  */
++      if (!DW_STRING_IS_CANONICAL (attr))
++	{
++	  DW_STRING (attr) = canonical_case (DW_STRING (attr), cu,
++					     &cu->objfile->objfile_obstack);
++	  DW_STRING_IS_CANONICAL (attr) = 1;
++	}
+       return DW_STRING (attr);
+ 
+     case DW_TAG_subprogram:
+@@ -13743,6 +13800,7 @@ init_one_comp_unit (struct dwarf2_cu *cu
+   memset (cu, 0, sizeof (*cu));
+   cu->objfile = objfile;
+   obstack_init (&cu->comp_unit_obstack);
++  cu->case_sensitivity = case_sensitive_on;
+ }
+ 
+ /* Initiailize basic fields of dwarf_cu CU according to DIE COMP_UNIT_DIE.  */
+@@ -13758,6 +13816,13 @@ prepare_one_comp_unit (struct dwarf2_cu 
+     set_cu_language (DW_UNSND (attr), cu);
+   else
+     set_cu_language (language_minimal, cu);
++
++  attr = dwarf2_attr (comp_unit_die, DW_AT_identifier_case, cu);
++  if (attr)
++    cu->case_sensitivity = (DW_UNSND (attr) == DW_ID_case_sensitive
++			    ? case_sensitive_on : case_sensitive_off);
++  else
++    cu->case_sensitivity = cu->language_defn->la_case_sensitivity;
+ }
+ 
+ /* Release one cached compilation unit, CU.  We unlink it from the tree
+Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S	2010-11-07 05:38:35.000000000 +0100
+@@ -0,0 +1,122 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2004, 2007, 2008, 2009, 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
++.Lcu1_begin:
++	/* CU header */
++	.4byte	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
++.Lcu1_start:
++	.2byte	2				/* DWARF Version */
++	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
++	.byte	4				/* Pointer size */
++
++	/* CU die */
++	.uleb128 2				/* Abbrev: DW_TAG_compile_unit */
++	.ascii	"file1.txt\0"			/* DW_AT_name */
++	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
++	.byte	2				/* DW_AT_language (DW_LANG_C) */
++	.byte	3				/* DW_AT_identifier_case (DW_ID_case_insensitive) */
++	.4byte		FUNC_attr		/* DW_AT_low_pc */
++	.4byte		FUNC_lang 		/* DW_AT_high_pc */
++
++	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
++	.byte		1			/* DW_AT_external */
++	.ascii		"FUNC_attr\0"		/* DW_AT_name */
++	.4byte		FUNC_attr		/* DW_AT_low_pc */
++	.4byte		FUNC_lang 		/* DW_AT_high_pc */
++
++	.byte		0			/* End of children of CU */
++.Lcu1_end:
++
++.Lcu2_begin:
++	/* CU header */
++	.4byte	.Lcu2_end - .Lcu2_start		/* Length of Compilation Unit */
++.Lcu2_start:
++	.2byte	2				/* DWARF Version */
++	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
++	.byte	4				/* Pointer size */
++
++	/* CU die */
++	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
++	.ascii	"file1.txt\0"			/* DW_AT_name */
++	.ascii	"GNU C 3.3.3\0"			/* DW_AT_producer */
++	.byte	8				/* DW_AT_language (DW_LANG_Fortran90) */
++	.4byte		FUNC_lang		/* DW_AT_low_pc */
++	.4byte		main			/* DW_AT_high_pc */
++
++	.uleb128	3			/* Abbrev: DW_TAG_subprogram */
++	.byte		1			/* DW_AT_external */
++	.ascii		"FUNC_lang\0"		/* DW_AT_name */
++	.4byte		FUNC_lang		/* DW_AT_low_pc */
++	.4byte		main			/* DW_AT_high_pc */
++
++	.byte		0			/* End of children of CU */
++.Lcu2_end:
++
++/* Abbrev table */
++	.section .debug_abbrev
++.Labbrev1_begin:
++	.uleb128	1			/* Abbrev code */
++	.uleb128	0x11			/* DW_TAG_compile_unit */
++	.byte		1			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x25			/* DW_AT_producer */
++	.uleb128	0x8			/* DW_FORM_string */
++	.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	0x1			/* DW_FORM_addr */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	2			/* Abbrev code */
++	.uleb128	0x11			/* DW_TAG_compile_unit */
++	.byte		1			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x25			/* DW_AT_producer */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x13			/* DW_AT_language */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.uleb128	0x42			/* DW_AT_identifier_case */
++	.uleb128	0xb			/* DW_FORM_data1 */
++	.uleb128	0x11			/* DW_AT_low_pc */
++	.uleb128	0x1			/* DW_FORM_addr */
++	.uleb128	0x12			/* DW_AT_high_pc */
++	.uleb128	0x1			/* DW_FORM_addr */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	3			/* Abbrev code */
++	.uleb128	0x2e			/* DW_TAG_subprogram */
++	.byte		0			/* has_children */
++	.uleb128	0x3f			/* DW_AT_external */
++	.uleb128	0xc			/* DW_FORM_flag */
++	.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 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
+Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c	2010-11-07 05:38:35.000000000 +0100
+@@ -0,0 +1,36 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2004, 2007, 2008, 2009, 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 one is DW_LANG_C but it uses DW_ID_case_insensitive.  */
++
++void
++FUNC_attr (void)
++{
++}
++
++/* This one has no DW_AT_identifier_case but it is DW_LANG_Fortran90.  */
++
++void
++FUNC_lang (void)
++{
++}
++
++int
++main()
++{
++  return 0;
++}
+Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp	2010-11-07 05:38:35.000000000 +0100
+@@ -0,0 +1,41 @@
++# 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-case-insensitive"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
++    return -1
++}
++
++gdb_test_no_output "set language fortran"
++
++if {[gdb_breakpoint "fuNC_attr"] == 1} {
++    pass "setting breakpoint at fuNC_attr"
++}
++
++if {[gdb_breakpoint "fuNC_lang"] == 1} {
++    pass "setting breakpoint at fuNC_lang"
++}
+Index: gdb-7.2/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+===================================================================
+--- gdb-7.2.orig/gdb/testsuite/gdb.mi/mi-var-child-f.exp	2010-01-01 08:32:03.000000000 +0100
++++ gdb-7.2/gdb/testsuite/gdb.mi/mi-var-child-f.exp	2010-11-07 05:38:35.000000000 +0100
+@@ -36,7 +36,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
+ 
+-mi_runto MAIN__
++mi_runto main__
+ 
+ mi_gdb_test "-var-create array * array" \
+     "\\^done,name=\"array\",numchild=\"3\",value=\".*\",type=\"integer \\(2,-1:1\\)\"" \

diff --git a/gdb-exec-pie-amd64.patch b/gdb-exec-pie-amd64.patch
new file mode 100644
index 0000000..e8403ad
--- /dev/null
+++ b/gdb-exec-pie-amd64.patch
@@ -0,0 +1,418 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00519.html
+Subject: [patch] Fix inferior execl of new PIE x86_64
+
+Hi,
+
+gcc -o 1 1.c -Wall -g -fPIE -pie; gdb -nx ./1 -ex 'b main' -ex r -ex c 
+
+Starting program: .../gdb/1 
+Breakpoint 1, main (argc=1, argv=0x7fffffffdff8) at 1.c:7
+7	  setbuf (stdout, NULL);
+Continuing.
+re-exec
+process 28056 is executing new program: .../gdb/1
+Error in re-setting breakpoint 1: Cannot access memory at address 0x80c
+exit
+Program exited normally.
+(gdb) _
+
+while it should be:
+
+re-exec
+process 28095 is executing new program: .../gdb/1
+Breakpoint 1, main (argc=2, argv=0x7fffffffe008) at 1.c:7
+7	  setbuf (stdout, NULL);
+(gdb) _
+
+The error comes from:
+
+throw_error <- memory_error <- read_memory <- read_memory_unsigned_integer <-
+amd64_analyze_prologue <- amd64_skip_prologue <- gdbarch_skip_prologue <-
+skip_prologue_sal <- find_function_start_sal <- symbol_found <- decode_variable
+<- decode_line_1 <- breakpoint_re_set_one <- catch_errors <- breakpoint_re_set
+<- clear_symtab_users <- new_symfile_objfile <-
+symbol_file_add_with_addrs_or_offsets <- symbol_file_add_from_bfd <-
+symbol_file_add <- symbol_file_add_main_1 <- symbol_file_add_main <-
+follow_exec
+
+
+I understand this hack is not nice, the correct way would be to unify more
+follow_exec with post_create_inferior.  But I could break it for non-GNU/Linux
+targets a lot.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+for the demo above:
+------------------------------------------------------------------------------
+#include <unistd.h>
+#include <assert.h>
+#include <stdio.h>
+int
+main (int argc, char **argv)
+{
+  setbuf (stdout, NULL);
+  if (argc == 1)
+    {
+      puts ("re-exec");
+      execl ("/proc/self/exe", argv[0], "foo", NULL);
+      assert (0);
+    }
+  puts ("exit");
+  return 0;
+}
+------------------------------------------------------------------------------
+
+
+gdb/
+2010-09-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* infrun.c (follow_exec): Replace symbol_file_add_main by
+	symbol_file_add with SYMFILE_DEFER_BP_RESET, set_initial_language and
+	breakpoint_re_set.
+	* m32r-rom.c (m32r_load, m32r_upload_command): Use parameter 0 for
+	clear_symtab_users.
+	* objfiles.c (free_all_objfiles): Likewise.
+	* remote-m32r-sdi.c (m32r_load): Likewise.
+	* solib-som.c (som_solib_create_inferior_hook): Likewise.
+	* symfile.c (new_symfile_objfile): New comment for add_flags.  Call
+	clear_symtab_users with ADD_FLAGS.
+	(reread_symbols): Use parameter 0 for clear_symtab_users.
+	(clear_symtab_users): New parameter add_flags.  Do not call
+	breakpoint_re_set if SYMFILE_DEFER_BP_RESET.
+	(clear_symtab_users_cleanup): Use parameter 0 for clear_symtab_users.
+	* symtab.h (clear_symtab_users): New parameter add_flags.
+
+gdb/testsuite/
+2010-09-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/pie-execl.exp: New file.
+	* gdb.base/pie-execl.c: New file.
+
+Index: gdb-7.2/gdb/infrun.c
+===================================================================
+--- gdb-7.2.orig/gdb/infrun.c	2010-10-12 18:27:58.000000000 +0200
++++ gdb-7.2/gdb/infrun.c	2010-10-12 18:29:24.000000000 +0200
+@@ -840,8 +840,15 @@ follow_exec (ptid_t pid, char *execd_pat
+   /* That a.out is now the one to use. */
+   exec_file_attach (execd_pathname, 0);
+ 
+-  /* Load the main file's symbols.  */
+-  symbol_file_add_main (execd_pathname, 0);
++  /* SYMFILE_DEFER_BP_RESET is used as the proper displacement for PIE
++     (Position Independent Executable) main symbol file will get applied by
++     solib_create_inferior_hook below.  breakpoint_re_set would fail to insert
++     the breakpoints with the zero displacement.  */
++
++  symbol_file_add (execd_pathname, SYMFILE_MAINLINE | SYMFILE_DEFER_BP_RESET,
++		   NULL, 0);
++
++  set_initial_language ();
+ 
+ #ifdef SOLIB_CREATE_INFERIOR_HOOK
+   SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+@@ -851,6 +858,8 @@ follow_exec (ptid_t pid, char *execd_pat
+ 
+   jit_inferior_created_hook ();
+ 
++  breakpoint_re_set ();
++
+   /* Reinsert all breakpoints.  (Those which were symbolic have
+      been reset to the proper address in the new a.out, thanks
+      to symbol_file_command...) */
+Index: gdb-7.2/gdb/m32r-rom.c
+===================================================================
+--- gdb-7.2.orig/gdb/m32r-rom.c	2010-01-01 08:31:37.000000000 +0100
++++ gdb-7.2/gdb/m32r-rom.c	2010-10-12 18:29:24.000000000 +0200
+@@ -188,7 +188,7 @@ m32r_load (char *filename, int from_tty)
+      the stack may not be valid, and things would get horribly
+      confused... */
+ 
+-  clear_symtab_users ();
++  clear_symtab_users (0);
+ }
+ 
+ static void
+@@ -551,7 +551,7 @@ m32r_upload_command (char *args, int fro
+      the stack may not be valid, and things would get horribly
+      confused... */
+ 
+-  clear_symtab_users ();
++  clear_symtab_users (0);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.2/gdb/objfiles.c
+===================================================================
+--- gdb-7.2.orig/gdb/objfiles.c	2010-10-12 18:27:56.000000000 +0200
++++ gdb-7.2/gdb/objfiles.c	2010-10-12 18:29:39.000000000 +0200
+@@ -699,7 +699,7 @@ free_all_objfiles (void)
+   {
+     free_objfile (objfile);
+   }
+-  clear_symtab_users ();
++  clear_symtab_users (0);
+ }
+ \f
+ /* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
+Index: gdb-7.2/gdb/remote-m32r-sdi.c
+===================================================================
+--- gdb-7.2.orig/gdb/remote-m32r-sdi.c	2010-07-07 18:15:16.000000000 +0200
++++ gdb-7.2/gdb/remote-m32r-sdi.c	2010-10-12 18:29:24.000000000 +0200
+@@ -1377,7 +1377,7 @@ m32r_load (char *args, int from_tty)
+      might be to call normal_stop, except that the stack may not be valid,
+      and things would get horribly confused... */
+ 
+-  clear_symtab_users ();
++  clear_symtab_users (0);
+ 
+   if (!nostart)
+     {
+Index: gdb-7.2/gdb/solib-som.c
+===================================================================
+--- gdb-7.2.orig/gdb/solib-som.c	2010-05-17 01:49:58.000000000 +0200
++++ gdb-7.2/gdb/solib-som.c	2010-10-12 18:29:24.000000000 +0200
+@@ -354,7 +354,7 @@ keep_going:
+   /* Make the breakpoint at "_start" a shared library event breakpoint.  */
+   create_solib_event_breakpoint (target_gdbarch, anaddr);
+ 
+-  clear_symtab_users ();
++  clear_symtab_users (0);
+ }
+ 
+ static void
+Index: gdb-7.2/gdb/symfile.c
+===================================================================
+--- gdb-7.2.orig/gdb/symfile.c	2010-10-12 18:27:57.000000000 +0200
++++ gdb-7.2/gdb/symfile.c	2010-10-12 18:29:24.000000000 +0200
+@@ -1036,7 +1036,7 @@ syms_from_objfile (struct objfile *objfi
+ 
+ /* Perform required actions after either reading in the initial
+    symbols for a new objfile, or mapping in the symbols from a reusable
+-   objfile. */
++   objfile.  ADD_FLAGS is a bitmask of enum symfile_add_flags.  */
+ 
+ void
+ new_symfile_objfile (struct objfile *objfile, int add_flags)
+@@ -1049,7 +1049,7 @@ new_symfile_objfile (struct objfile *obj
+       /* OK, make it the "real" symbol file.  */
+       symfile_objfile = objfile;
+ 
+-      clear_symtab_users ();
++      clear_symtab_users (add_flags);
+     }
+   else if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
+     {
+@@ -2527,7 +2527,7 @@ reread_symbols (void)
+       /* Notify objfiles that we've modified objfile sections.  */
+       objfiles_changed ();
+ 
+-      clear_symtab_users ();
++      clear_symtab_users (0);
+       /* At least one objfile has changed, so we can consider that
+          the executable we're debugging has changed too.  */
+       observer_notify_executable_changed ();
+@@ -2745,10 +2745,10 @@ allocate_symtab (char *filename, struct 
+ \f
+ 
+ /* Reset all data structures in gdb which may contain references to symbol
+-   table data.  */
++   table data.  ADD_FLAGS is a bitmask of enum symfile_add_flags.  */
+ 
+ void
+-clear_symtab_users (void)
++clear_symtab_users (int add_flags)
+ {
+   /* Someday, we should do better than this, by only blowing away
+      the things that really need to be blown.  */
+@@ -2758,7 +2758,8 @@ clear_symtab_users (void)
+   clear_current_source_symtab_and_line ();
+ 
+   clear_displays ();
+-  breakpoint_re_set ();
++  if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
++    breakpoint_re_set ();
+   set_default_breakpoint (0, NULL, 0, 0, 0);
+   clear_pc_function_cache ();
+   observer_notify_new_objfile (NULL);
+@@ -2777,7 +2778,7 @@ clear_symtab_users (void)
+ static void
+ clear_symtab_users_cleanup (void *ignore)
+ {
+-  clear_symtab_users ();
++  clear_symtab_users (0);
+ }
+ \f
+ /* OVERLAYS:
+Index: gdb-7.2/gdb/symtab.h
+===================================================================
+--- gdb-7.2.orig/gdb/symtab.h	2010-10-12 18:27:56.000000000 +0200
++++ gdb-7.2/gdb/symtab.h	2010-10-12 18:29:24.000000000 +0200
+@@ -1170,7 +1170,7 @@ extern void skip_prologue_sal (struct sy
+ 
+ /* symfile.c */
+ 
+-extern void clear_symtab_users (void);
++extern void clear_symtab_users (int add_flags);
+ 
+ extern enum language deduce_language_from_filename (const char *);
+ 
+Index: gdb-7.2/gdb/testsuite/gdb.base/pie-execl.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.base/pie-execl.c	2010-10-12 18:29:24.000000000 +0200
+@@ -0,0 +1,51 @@
++/* 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>
++#include <assert.h>
++
++static void pie_execl_marker (void);
++
++int
++main (int argc, char **argv)
++{
++  setbuf (stdout, NULL);
++
++#if BIN == 1
++  if (argc == 2)
++    {
++      printf ("pie-execl: re-exec: %s\n", argv[1]);
++      execl (argv[1], argv[1], NULL);
++      assert (0);
++    }
++#endif
++
++  pie_execl_marker ();
++
++  return 0;
++}
++
++/* pie_execl_marker must be on a different address than in `pie-execl2.c'.  */
++
++volatile int v;
++
++static void
++pie_execl_marker (void)
++{
++  v = 1;
++}
+Index: gdb-7.2/gdb/testsuite/gdb.base/pie-execl.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.base/pie-execl.exp	2010-10-12 18:29:24.000000000 +0200
+@@ -0,0 +1,94 @@
++# 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/>.
++
++# The problem was due to amd64_skip_prologue attempting to access inferior
++# memory before the PIE (Position Independent Executable) gets relocated.
++
++if { ![istarget *-linux*]} {
++    continue
++}
++
++set testfile "pie-execl"
++set srcfile ${testfile}.c
++set executable1 ${testfile}1
++set executable2 ${testfile}2
++set binfile1 ${objdir}/${subdir}/${executable1}
++set binfile2 ${objdir}/${subdir}/${executable2}
++
++# Use conditional compilation according to `BIN' as GDB remembers the source
++# file name of the breakpoint.
++
++set opts [list debug {additional_flags=-fPIE -pie}]
++if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {additional_flags=-DBIN=1}]] == ""
++    || [build_executable ${testfile}.exp $executable2 $srcfile [concat $opts {additional_flags=-DBIN=2}]] == ""} {
++    return -1
++}
++
++clean_restart ${executable1}
++
++gdb_test_no_output "set args ${binfile2}"
++
++if ![runto_main] {
++    return -1
++}
++
++# Do not stop on `main' after re-exec.
++delete_breakpoints
++
++gdb_breakpoint "pie_execl_marker"
++gdb_test "info breakpoints" ".*" ""
++
++set addr1 ""
++set test "pie_execl_marker address first"
++gdb_test_multiple "p/x &pie_execl_marker" $test {
++    -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
++	set addr1 $expect_out(1,string)
++	pass $test
++    }
++}
++verbose -log "addr1 is $addr1"
++
++set test "continue"
++gdb_test_multiple $test $test {
++    -re "Error in re-setting breakpoint" {
++	fail $test
++    }
++    -re "Cannot access memory" {
++	fail $test
++    }
++    -re "pie-execl: re-exec.*executing new program.*\r\nBreakpoint \[0-9\]+,\[^\r\n\]* pie_execl_marker .*\r\n$gdb_prompt $" {
++	pass $test
++    }
++}
++
++gdb_test "info breakpoints" ".*" ""
++
++set addr2 ""
++set test "pie_execl_marker address second"
++gdb_test_multiple "p/x &pie_execl_marker" $test {
++    -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
++	set addr2 $expect_out(1,string)
++	pass $test
++    }
++}
++verbose -log "addr2 is $addr2"
++
++# Ensure we cannot get a false PASS and the inferior has really changed.
++set test "pie_execl_marker address has changed"
++if [string equal $addr1 $addr2] {
++    fail $test
++} else {
++    pass $test
++}

diff --git a/gdb-false-gcc-warning.patch b/gdb-false-gcc-warning.patch
new file mode 100644
index 0000000..22ad08c
--- /dev/null
+++ b/gdb-false-gcc-warning.patch
@@ -0,0 +1,11 @@
+--- gdb-7.1.90.20100806/gdb/infcall.c.orig	2010-08-10 00:34:10.000000000 +0200
++++ gdb-7.1.90.20100806/gdb/infcall.c	2010-08-10 00:36:03.000000000 +0200
+@@ -284,7 +284,7 @@ find_function_addr (struct value *functi
+   struct type *ftype = check_typedef (value_type (function));
+   struct gdbarch *gdbarch = get_type_arch (ftype);
+   struct type *value_type = NULL;
+-  CORE_ADDR funaddr;
++  CORE_ADDR funaddr = 0;	/* GCC false -fprofile-use warning.  */
+ 
+   /* If it's a member function, just look at the function
+      part of it.  */

diff --git a/gdb-gdb-add-index-script.patch b/gdb-gdb-add-index-script.patch
index da149ec..c770a77 100644
--- a/gdb-gdb-add-index-script.patch
+++ b/gdb-gdb-add-index-script.patch
@@ -109,7 +109,7 @@ index 0000000..c9a03b0
 +dir="${file%/*}"
 +
 +# We don't care if gdb gives an error.
-+gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir"
++gdb -nx --batch-silent -ex "file $file" -ex "save gdb-index $dir"
 +
 +if test -f "${file}.gdb-index"; then
 +   objcopy --add-section .gdb_index="${file}.gdb-index" --set-section-flags .gdb_index=readonly "$file" "$file"

diff --git a/gdb-gdbindex-ada-regression.patch b/gdb-gdbindex-ada-regression.patch
new file mode 100644
index 0000000..9d67d58
--- /dev/null
+++ b/gdb-gdbindex-ada-regression.patch
@@ -0,0 +1,50 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00273.html
+Subject: [patch] .gdb_index: Fix Ada regression
+
+Hi,
+
+on a system with libraries using .gdb_index all the Ada testcases FAIL:
+
+Running ./gdb.ada/print_pc.exp ...
+FAIL: gdb.ada/print_pc.exp: start inferior (GDB internal error)
+FAIL: gdb.ada/print_pc.exp: p /x $pc
+
+dwarf2read.c:2374: internal-error: map_ada_symtabs called via index method
+
+FAIl is on Fedora 14 snapshot using gcc-debuginfo-4.5.1-3.fc14.x86_64 file:
+	/usr/lib/debug/lib64/libgcc_s-4.5.1-20100907.so.1.debug
+
+The regressions get fixed on x86_64-fedora14snapshot-linux-gnu by the attached
+patch.  No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
+
+During my tests with `set language ada' I could not lookup non-Ada symbols
+anyway so I believe the patch is OK but sure it needs an Ada-wise review.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-09-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* dwarf2read.c (dw2_map_ada_symtabs): Remove the internal_error.
+	Update the comment.
+
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -2369,10 +2369,9 @@ dw2_map_ada_symtabs (struct objfile *objfile,
+ 		     domain_enum namespace, int wild,
+ 		     void *data)
+ {
+-  /* For now, we don't support Ada, so this function can't be
+-     reached.  */
+-  internal_error (__FILE__, __LINE__,
+-		  _("map_ada_symtabs called via index method"));
++  /* For now, we don't support Ada.  Still the function can be called if the
++     current language is Ada for a non-Ada objfile using GNU index.  As Ada
++     does not look for non-Ada symbols this function should just return.  */
+ }
+ 
+ static void
+

diff --git a/gdb-gdbindex-bigendian.patch b/gdb-gdbindex-bigendian.patch
new file mode 100644
index 0000000..edd4f4f
--- /dev/null
+++ b/gdb-gdbindex-bigendian.patch
@@ -0,0 +1,96 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00434.html
+http://sourceware.org/ml/gdb-cvs/2010-09/msg00155.html
+
+### src/gdb/ChangeLog	2010/09/24 14:47:52	1.12202
+### src/gdb/ChangeLog	2010/09/24 16:11:44	1.12203
+## -1,3 +1,9 @@
++2010-09-24  Tom Tromey  <tromey@redhat.com>
++
++	* dwarf2read.c (dw2_expand_symtabs_matching): Add missing
++	MAYBE_SWAPs.
++	(dw2_map_symbol_names): Likewise.
++
+ 2010-09-24  Sami Wagiaalla  <swagiaal@redhat.com>
+ 
+ 	* valops.c (find_oload_champ_namespace_loop): replace incorrect
+--- src/gdb/dwarf2read.c	2010/09/22 19:22:44	1.460
++++ src/gdb/dwarf2read.c	2010/09/24 16:11:46	1.461
+@@ -2382,10 +2382,12 @@
+ {
+   int i;
+   offset_type iter;
++  struct mapped_index *index;
+ 
+   dw2_setup (objfile);
+   if (!dwarf2_per_objfile->index_table)
+     return;
++  index = dwarf2_per_objfile->index_table;
+ 
+   for (i = 0; i < (dwarf2_per_objfile->n_comp_units
+ 		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+@@ -2411,28 +2413,24 @@
+ 	}
+     }
+ 
+-  for (iter = 0;
+-       iter < dwarf2_per_objfile->index_table->index_table_slots;
+-       ++iter)
++  for (iter = 0; iter < index->index_table_slots; ++iter)
+     {
+       offset_type idx = 2 * iter;
+       const char *name;
+       offset_type *vec, vec_len, vec_idx;
+ 
+-      if (dwarf2_per_objfile->index_table->index_table[idx] == 0
+-	  && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0)
++      if (index->index_table[idx] == 0 && index->index_table[idx + 1] == 0)
+ 	continue;
+ 
+-      name = (dwarf2_per_objfile->index_table->constant_pool
+-	      + dwarf2_per_objfile->index_table->index_table[idx]);
++      name = index->constant_pool + MAYBE_SWAP (index->index_table[idx]);
+ 
+       if (! (*name_matcher) (name, data))
+ 	continue;
+ 
+       /* The name was matched, now expand corresponding CUs that were
+ 	 marked.  */
+-      vec = (offset_type *) (dwarf2_per_objfile->index_table->constant_pool
+-			     + dwarf2_per_objfile->index_table->index_table[idx + 1]);
++      vec = (offset_type *) (index->constant_pool
++			     + MAYBE_SWAP (index->index_table[idx + 1]));
+       vec_len = MAYBE_SWAP (vec[0]);
+       for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
+ 	{
+@@ -2476,25 +2474,24 @@
+ 		      void *data)
+ {
+   offset_type iter;
++  struct mapped_index *index;
++
+   dw2_setup (objfile);
+ 
+   if (!dwarf2_per_objfile->index_table)
+     return;
++  index = dwarf2_per_objfile->index_table;
+ 
+-  for (iter = 0;
+-       iter < dwarf2_per_objfile->index_table->index_table_slots;
+-       ++iter)
++  for (iter = 0; iter < index->index_table_slots; ++iter)
+     {
+       offset_type idx = 2 * iter;
+       const char *name;
+       offset_type *vec, vec_len, vec_idx;
+ 
+-      if (dwarf2_per_objfile->index_table->index_table[idx] == 0
+-	  && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0)
++      if (index->index_table[idx] == 0 && index->index_table[idx + 1] == 0)
+ 	continue;
+ 
+-      name = (dwarf2_per_objfile->index_table->constant_pool
+-	      + dwarf2_per_objfile->index_table->index_table[idx]);
++      name = (index->constant_pool + MAYBE_SWAP (index->index_table[idx]));
+ 
+       (*fun) (name, data);
+     }

diff --git a/gdb-gdbindex-v1-to-v2.patch b/gdb-gdbindex-v1-to-v2.patch
new file mode 100644
index 0000000..2a7b9b7
--- /dev/null
+++ b/gdb-gdbindex-v1-to-v2.patch
@@ -0,0 +1,689 @@
+http://sourceware.org/ml/gdb-cvs/2010-07/msg00139.html
+
+### src/gdb/ChangeLog	2010/07/23 21:10:54	1.12013
+### src/gdb/ChangeLog	2010/07/23 22:15:13	1.12014
+## -1,3 +1,31 @@
++2010-07-23  Tom Tromey  <tromey@redhat.com>
++
++	* dwarf2read.c (struct dwarf2_per_objfile) <n_type_comp_units,
++	type_comp_units>: New fields.
++	(dw2_get_cu): New function.
++	(create_cus_from_index): Remove unused argument.
++	(create_signatured_type_hash_from_index): New function.
++	(create_addrmap_from_index): Update.
++	(dwarf2_read_index): Handle version 2.
++	(dw2_find_last_source_symtab, dw2_forget_cached_source_info)
++	(dw2_lookup_symtab, dw2_do_expand_symtabs_matching)
++	(dw2_print_stats, dw2_expand_all_symtabs)
++	(dw2_expand_symtabs_with_filename, dw2_find_symbol_file)
++	(dw2_expand_symtabs_matching, dw2_map_symbol_filenames): Update.
++	(dwarf2_initialize_objfile): Call create_debug_types_hash_table.
++	(allocate_signatured_type_hash_table): New function.
++	(add_signatured_type_cu_to_list): Likewise.
++	(create_debug_types_hash_table): Use them.  Set type_comp_units.
++	(read_signatured_type): Ensure section data is available.
++	(add_address_entry): Don't record empty ranges.
++	(struct signatured_type_index_data): New.
++	(write_one_signatured_type): New function.
++	(write_psymtabs_to_index): Write type CUs.
++	(save_gdb_index_command): Update comment.
++	(process_type_comp_unit): Move inititalization of
++	from_debug_types...
++	(create_debug_types_hash_table): ... here.
++
+ 2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
+ 
+ 	* gdb_gcore.sh (tmpfile): Remove the variable, its initialization,
+Index: gdb-7.2/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.2.orig/gdb/dwarf2read.c	2010-10-12 18:10:47.000000000 +0200
++++ gdb-7.2/gdb/dwarf2read.c	2010-10-12 18:11:16.000000000 +0200
+@@ -184,6 +184,12 @@ struct dwarf2_per_objfile
+   /* The number of compilation units in ALL_COMP_UNITS.  */
+   int n_comp_units;
+ 
++  /* The number of .debug_types-related CUs.  */
++  int n_type_comp_units;
++
++  /* The .debug_types-related CUs.  */
++  struct dwarf2_per_cu_data **type_comp_units;
++
+   /* A chain of compilation units that are currently read in, so that
+      they can be freed later.  */
+   struct dwarf2_per_cu_data *read_in_chain;
+@@ -1226,6 +1232,8 @@ static struct type *set_die_type (struct
+ 
+ static void create_all_comp_units (struct objfile *);
+ 
++static int create_debug_types_hash_table (struct objfile *objfile);
++
+ static void load_full_comp_unit (struct dwarf2_per_cu_data *,
+ 				 struct objfile *);
+ 
+@@ -1269,6 +1277,8 @@ static void init_cu_die_reader (struct d
+ static const char *dwarf2_physname (char *name, struct die_info *die,
+ 				    struct dwarf2_cu *cu);
+ 
++static htab_t allocate_signatured_type_hash_table (struct objfile *objfile);
++
+ #if WORDS_BIGENDIAN
+ 
+ /* Convert VALUE between big- and little-endian.  */
+@@ -1646,6 +1656,18 @@ dw2_instantiate_symtab (struct objfile *
+   return per_cu->v.quick->symtab;
+ }
+ 
++/* Return the CU given its index.  */
++static struct dwarf2_per_cu_data *
++dw2_get_cu (int index)
++{
++  if (index >= dwarf2_per_objfile->n_comp_units)
++    {
++      index -= dwarf2_per_objfile->n_comp_units;
++      return dwarf2_per_objfile->type_comp_units[index];
++    }
++  return dwarf2_per_objfile->all_comp_units[index];
++}
++
+ /* A helper function that knows how to read a 64-bit value in a way
+    that doesn't make gdb die.  Returns 1 if the conversion went ok, 0
+    otherwise.  */
+@@ -1672,11 +1694,10 @@ extract_cu_value (const char *bytes, ULO
+    the CU objects for this objfile.  Return 0 if something went wrong,
+    1 if everything went ok.  */
+ static int
+-create_cus_from_index (struct objfile *objfile, struct mapped_index *index,
+-		       const gdb_byte *cu_list, offset_type cu_list_elements)
++create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list,
++		       offset_type cu_list_elements)
+ {
+   offset_type i;
+-  const char *entry;
+ 
+   dwarf2_per_objfile->n_comp_units = cu_list_elements / 2;
+   dwarf2_per_objfile->all_comp_units
+@@ -1707,6 +1728,58 @@ create_cus_from_index (struct objfile *o
+   return 1;
+ }
+ 
++/* Create the signatured type hash table from the index.  */
++static int
++create_signatured_type_hash_from_index (struct objfile *objfile,
++					const gdb_byte *bytes,
++					offset_type elements)
++{
++  offset_type i;
++  htab_t type_hash;
++
++  dwarf2_per_objfile->n_type_comp_units = elements / 3;
++  dwarf2_per_objfile->type_comp_units
++    = obstack_alloc (&objfile->objfile_obstack,
++		     dwarf2_per_objfile->n_type_comp_units
++		     * sizeof (struct dwarf2_per_cu_data *));
++
++  type_hash = allocate_signatured_type_hash_table (objfile);
++
++  for (i = 0; i < elements; i += 3)
++    {
++      struct signatured_type *type_sig;
++      ULONGEST offset, type_offset, signature;
++      void **slot;
++
++      if (!extract_cu_value (bytes, &offset)
++	  || !extract_cu_value (bytes + 8, &type_offset))
++	return 0;
++      signature = extract_unsigned_integer (bytes + 16, 8, BFD_ENDIAN_LITTLE);
++      bytes += 3 * 8;
++
++      type_sig = OBSTACK_ZALLOC (&objfile->objfile_obstack,
++				 struct signatured_type);
++      type_sig->signature = signature;
++      type_sig->offset = offset;
++      type_sig->type_offset = type_offset;
++      type_sig->per_cu.from_debug_types = 1;
++      type_sig->per_cu.offset = offset;
++      type_sig->per_cu.objfile = objfile;
++      type_sig->per_cu.v.quick
++	= OBSTACK_ZALLOC (&objfile->objfile_obstack,
++			  struct dwarf2_per_cu_quick_data);
++
++      slot = htab_find_slot (type_hash, type_sig, INSERT);
++      *slot = type_sig;
++
++      dwarf2_per_objfile->type_comp_units[i / 3] = &type_sig->per_cu;
++    }
++
++  dwarf2_per_objfile->signatured_types = type_hash;
++
++  return 1;
++}
++
+ /* Read the address map data from the mapped index, and use it to
+    populate the objfile's psymtabs_addrmap.  */
+ static void
+@@ -1738,7 +1811,7 @@ create_addrmap_from_index (struct objfil
+       iter += 4;
+       
+       addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
+-			 dwarf2_per_objfile->all_comp_units[cu_index]);
++			 dw2_get_cu (cu_index));
+     }
+ 
+   objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map,
+@@ -1805,8 +1878,9 @@ dwarf2_read_index (struct objfile *objfi
+   char *addr;
+   struct mapped_index *map;
+   offset_type *metadata;
+-  const gdb_byte *cu_list;
+-  offset_type cu_list_elements;
++  const gdb_byte *cu_list, *types_list;
++  offset_type version, cu_list_elements, types_list_elements;
++  int i;
+ 
+   if (dwarf2_per_objfile->gdb_index.asection == NULL
+       || dwarf2_per_objfile->gdb_index.size == 0)
+@@ -1822,26 +1896,58 @@ dwarf2_read_index (struct objfile *objfi
+ 
+   addr = dwarf2_per_objfile->gdb_index.buffer;
+   /* Version check.  */
+-  if (MAYBE_SWAP (*(offset_type *) addr) != 1)
++  version = MAYBE_SWAP (*(offset_type *) addr);
++  if (version == 1)
++    {
++      /* Index version 1 neglected to account for .debug_types.  So,
++	 if we see .debug_types, we cannot use this index.  */
++      if (dwarf2_per_objfile->types.asection != NULL
++	  && dwarf2_per_objfile->types.size != 0)
++	return 0;
++    }
++  else if (version != 2)
+     return 0;
+ 
+   map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
+   map->total_size = dwarf2_per_objfile->gdb_index.size;
+ 
+   metadata = (offset_type *) (addr + sizeof (offset_type));
+-  cu_list = addr + MAYBE_SWAP (metadata[0]);
+-  cu_list_elements = ((MAYBE_SWAP (metadata[1]) - MAYBE_SWAP (metadata[0]))
++
++  i = 0;
++  cu_list = addr + MAYBE_SWAP (metadata[i]);
++  cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i]))
+ 		      / 8);
+-  map->address_table = addr + MAYBE_SWAP (metadata[1]);
+-  map->address_table_size = (MAYBE_SWAP (metadata[2])
+-			     - MAYBE_SWAP (metadata[1]));
+-  map->index_table = (offset_type *) (addr + MAYBE_SWAP (metadata[2]));
+-  map->index_table_slots = ((MAYBE_SWAP (metadata[3])
+-			     - MAYBE_SWAP (metadata[2]))
++  ++i;
++
++  if (version == 2)
++    {
++      types_list = addr + MAYBE_SWAP (metadata[i]);
++      types_list_elements = ((MAYBE_SWAP (metadata[i + 1])
++			      - MAYBE_SWAP (metadata[i]))
++			     / 8);
++      ++i;
++    }
++
++  map->address_table = addr + MAYBE_SWAP (metadata[i]);
++  map->address_table_size = (MAYBE_SWAP (metadata[i + 1])
++			     - MAYBE_SWAP (metadata[i]));
++  ++i;
++
++  map->index_table = (offset_type *) (addr + MAYBE_SWAP (metadata[i]));
++  map->index_table_slots = ((MAYBE_SWAP (metadata[i + 1])
++			     - MAYBE_SWAP (metadata[i]))
+ 			    / (2 * sizeof (offset_type)));
+-  map->constant_pool = addr + MAYBE_SWAP (metadata[3]);
++  ++i;
+ 
+-  if (!create_cus_from_index (objfile, map, cu_list, cu_list_elements))
++  map->constant_pool = addr + MAYBE_SWAP (metadata[i]);
++
++  if (!create_cus_from_index (objfile, cu_list, cu_list_elements))
++    return 0;
++
++  if (version == 2
++      && types_list_elements
++      && !create_signatured_type_hash_from_index (objfile, types_list,
++						  types_list_elements))
+     return 0;
+ 
+   create_addrmap_from_index (objfile, map);
+@@ -1968,8 +2074,7 @@ dw2_find_last_source_symtab (struct objf
+   int index;
+   dw2_setup (objfile);
+   index = dwarf2_per_objfile->n_comp_units - 1;
+-  return dw2_instantiate_symtab (objfile,
+-				 dwarf2_per_objfile->all_comp_units[index]);
++  return dw2_instantiate_symtab (objfile, dw2_get_cu (index));
+ }
+ 
+ static void
+@@ -1978,9 +2083,10 @@ dw2_forget_cached_source_info (struct ob
+   int i;
+ 
+   dw2_setup (objfile);
+-  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+     {
+-      struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++      struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+       if (cu->v.quick->full_names)
+ 	{
+@@ -2002,10 +2108,11 @@ dw2_lookup_symtab (struct objfile *objfi
+   struct dwarf2_per_cu_data *base_cu = NULL;
+ 
+   dw2_setup (objfile);
+-  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+     {
+       int j;
+-      struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++      struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+       if (cu->v.quick->symtab)
+ 	continue;
+@@ -2097,8 +2204,8 @@ dw2_do_expand_symtabs_matching (struct o
+ 	  for (i = 0; i < len; ++i)
+ 	    {
+ 	      offset_type cu_index = MAYBE_SWAP (vec[i + 1]);
+-	      struct dwarf2_per_cu_data *cu;
+-	      cu = dwarf2_per_objfile->all_comp_units[cu_index];
++	      struct dwarf2_per_cu_data *cu = dw2_get_cu (cu_index);
++
+ 	      dw2_instantiate_symtab (objfile, cu);
+ 	    }
+ 	}
+@@ -2120,9 +2227,10 @@ dw2_print_stats (struct objfile *objfile
+ 
+   dw2_setup (objfile);
+   count = 0;
+-  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+     {
+-      struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++      struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+       if (!cu->v.quick->symtab)
+ 	++count;
+@@ -2156,9 +2264,11 @@ dw2_expand_all_symtabs (struct objfile *
+   int i;
+ 
+   dw2_setup (objfile);
+-  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++
++  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+     {
+-      struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++      struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+       dw2_instantiate_symtab (objfile, cu);
+     }
+@@ -2171,10 +2281,11 @@ dw2_expand_symtabs_with_filename (struct
+   int i;
+ 
+   dw2_setup (objfile);
+-  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+     {
+       int j;
+-      struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++      struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+       if (cu->v.quick->symtab)
+ 	continue;
+@@ -2215,7 +2326,7 @@ dw2_find_symbol_file (struct objfile *ob
+      should be rewritten so that it doesn't require a custom hook.  It
+      could just use the ordinary symbol tables.  */
+   /* vec[0] is the length, which must always be >0.  */
+-  cu = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[1])];
++  cu = dw2_get_cu (MAYBE_SWAP (vec[1]));
+ 
+   dw2_require_line_header (objfile, cu);
+   if (!cu->v.quick->lines)
+@@ -2253,10 +2364,11 @@ dw2_expand_symtabs_matching (struct objf
+   if (!dwarf2_per_objfile->index_table)
+     return;
+ 
+-  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+     {
+       int j;
+-      struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++      struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+       cu->v.quick->mark = 0;
+       if (cu->v.quick->symtab)
+@@ -2301,8 +2413,9 @@ dw2_expand_symtabs_matching (struct objf
+       vec_len = MAYBE_SWAP (vec[0]);
+       for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
+ 	{
+-	  struct dwarf2_per_cu_data *cu
+-	    = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[vec_idx + 1])];
++	  struct dwarf2_per_cu_data *cu;
++
++	  cu = dw2_get_cu (MAYBE_SWAP (vec[vec_idx + 1]));
+ 	  if (cu->v.quick->mark)
+ 	    dw2_instantiate_symtab (objfile, cu);
+ 	}
+@@ -2372,10 +2485,11 @@ dw2_map_symbol_filenames (struct objfile
+   int i;
+ 
+   dw2_setup (objfile);
+-  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+     {
+       int j;
+-      struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++      struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+       if (cu->v.quick->symtab)
+ 	continue;
+@@ -2436,10 +2550,12 @@ dwarf2_initialize_objfile (struct objfil
+ 
+       dwarf2_per_objfile->using_index = 1;
+       create_all_comp_units (objfile);
++      create_debug_types_hash_table (objfile);
+ 
+-      for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
++      for (i = 0; i < (dwarf2_per_objfile->n_comp_units
++		       + dwarf2_per_objfile->n_type_comp_units); ++i)
+ 	{
+-	  struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
++	  struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
+ 
+ 	  cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack,
+ 					struct dwarf2_per_cu_quick_data);
+@@ -2653,6 +2769,34 @@ eq_type_signature (const void *item_lhs,
+   return lhs->signature == rhs->signature;
+ }
+ 
++/* Allocate a hash table for signatured types.  */
++
++static htab_t
++allocate_signatured_type_hash_table (struct objfile *objfile)
++{
++  return htab_create_alloc_ex (41,
++			       hash_type_signature,
++			       eq_type_signature,
++			       NULL,
++			       &objfile->objfile_obstack,
++			       hashtab_obstack_allocate,
++			       dummy_obstack_deallocate);
++}
++
++/* A helper function to add a signatured type CU to a list.  */
++
++static int
++add_signatured_type_cu_to_list (void **slot, void *datum)
++{
++  struct signatured_type *sigt = *slot;
++  struct dwarf2_per_cu_data ***datap = datum;
++
++  **datap = &sigt->per_cu;
++  ++*datap;
++
++  return 1;
++}
++
+ /* Create the hash table of all entries in the .debug_types section.
+    The result is zero if there is an error (e.g. missing .debug_types section),
+    otherwise non-zero.	*/
+@@ -2662,6 +2806,7 @@ create_debug_types_hash_table (struct ob
+ {
+   gdb_byte *info_ptr;
+   htab_t types_htab;
++  struct dwarf2_per_cu_data **iter;
+ 
+   dwarf2_read_section (objfile, &dwarf2_per_objfile->types);
+   info_ptr = dwarf2_per_objfile->types.buffer;
+@@ -2672,13 +2817,7 @@ create_debug_types_hash_table (struct ob
+       return 0;
+     }
+ 
+-  types_htab = htab_create_alloc_ex (41,
+-				     hash_type_signature,
+-				     eq_type_signature,
+-				     NULL,
+-				     &objfile->objfile_obstack,
+-				     hashtab_obstack_allocate,
+-				     dummy_obstack_deallocate);
++  types_htab = allocate_signatured_type_hash_table (objfile);
+ 
+   if (dwarf2_die_debug)
+     fprintf_unfiltered (gdb_stdlog, "Signatured types:\n");
+@@ -2726,6 +2865,7 @@ create_debug_types_hash_table (struct ob
+       type_sig->offset = offset;
+       type_sig->type_offset = type_offset;
+       type_sig->per_cu.objfile = objfile;
++      type_sig->per_cu.from_debug_types = 1;
+ 
+       slot = htab_find_slot (types_htab, type_sig, INSERT);
+       gdb_assert (slot != NULL);
+@@ -2740,6 +2880,16 @@ create_debug_types_hash_table (struct ob
+ 
+   dwarf2_per_objfile->signatured_types = types_htab;
+ 
++  dwarf2_per_objfile->n_type_comp_units = htab_elements (types_htab);
++  dwarf2_per_objfile->type_comp_units
++    = obstack_alloc (&objfile->objfile_obstack,
++		     dwarf2_per_objfile->n_type_comp_units
++		     * sizeof (struct dwarf2_per_cu_data *));
++  iter = &dwarf2_per_objfile->type_comp_units[0];
++  htab_traverse_noresize (types_htab, add_signatured_type_cu_to_list, &iter);
++  gdb_assert (iter - &dwarf2_per_objfile->type_comp_units[0]
++	      == dwarf2_per_objfile->n_type_comp_units);
++
+   return 1;
+ }
+ 
+@@ -3008,7 +3158,6 @@ process_type_comp_unit (void **slot, voi
+   struct dwarf2_per_cu_data *this_cu;
+ 
+   this_cu = &entry->per_cu;
+-  this_cu->from_debug_types = 1;
+ 
+   gdb_assert (dwarf2_per_objfile->types.readin);
+   process_psymtab_comp_unit (objfile, this_cu,
+@@ -12483,13 +12632,16 @@ static void
+ read_signatured_type (struct objfile *objfile,
+ 		      struct signatured_type *type_sig)
+ {
+-  gdb_byte *types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset;
++  gdb_byte *types_ptr;
+   struct die_reader_specs reader_specs;
+   struct dwarf2_cu *cu;
+   ULONGEST signature;
+   struct cleanup *back_to, *free_cu_cleanup;
+   struct attribute *attr;
+ 
++  dwarf2_read_section (objfile, &dwarf2_per_objfile->types);
++  types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset;
++
+   gdb_assert (type_sig->per_cu.cu == NULL);
+ 
+   cu = xmalloc (sizeof (struct dwarf2_cu));
+@@ -14402,6 +14554,10 @@ add_address_entry (struct objfile *objfi
+   char addr[8];
+   CORE_ADDR baseaddr;
+ 
++  /* Don't bother recording empty ranges.  */
++  if (pst->textlow == pst->texthigh)
++    return;
++
+   baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+ 
+   store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, pst->textlow - baseaddr);
+@@ -14447,13 +14603,53 @@ unlink_if_set (void *p)
+     unlink (*filename);
+ }
+ 
++/* A helper struct used when iterating over debug_types.  */
++struct signatured_type_index_data
++{
++  struct objfile *objfile;
++  struct mapped_symtab *symtab;
++  struct obstack *types_list;
++  int cu_index;
++};
++
++/* A helper function that writes a single signatured_type to an
++   obstack.  */
++static int
++write_one_signatured_type (void **slot, void *d)
++{
++  struct signatured_type_index_data *info = d;
++  struct signatured_type *entry = (struct signatured_type *) *slot;
++  struct dwarf2_per_cu_data *cu = &entry->per_cu;
++  struct partial_symtab *psymtab = cu->v.psymtab;
++  gdb_byte val[8];
++
++  write_psymbols (info->symtab,
++		  info->objfile->global_psymbols.list + psymtab->globals_offset,
++		  psymtab->n_global_syms, info->cu_index);
++  write_psymbols (info->symtab,
++		  info->objfile->static_psymbols.list + psymtab->statics_offset,
++		  psymtab->n_static_syms, info->cu_index);
++
++  store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->offset);
++  obstack_grow (info->types_list, val, 8);
++  store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->type_offset);
++  obstack_grow (info->types_list, val, 8);
++  store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->signature);
++  obstack_grow (info->types_list, val, 8);
++
++  ++info->cu_index;
++
++  return 1;
++}
++
+ /* Create an index file for OBJFILE in the directory DIR.  */
+ static void
+ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
+ {
+   struct cleanup *cleanup;
+   char *filename, *cleanup_filename;
+-  struct obstack contents, addr_obstack, constant_pool, symtab_obstack, cu_list;
++  struct obstack contents, addr_obstack, constant_pool, symtab_obstack;
++  struct obstack cu_list, types_cu_list;
+   int i;
+   FILE *out_file;
+   struct mapped_symtab *symtab;
+@@ -14489,6 +14685,12 @@ write_psymtabs_to_index (struct objfile 
+   obstack_init (&cu_list);
+   make_cleanup_obstack_free (&cu_list);
+ 
++  obstack_init (&types_cu_list);
++  make_cleanup_obstack_free (&types_cu_list);
++
++  /* The list is already sorted, so we don't need to do additional
++     work here.  Also, the debug_types entries do not appear in
++     all_comp_units, but only in their own hash table.  */
+   for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
+     {
+       struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
+@@ -14510,6 +14712,19 @@ write_psymtabs_to_index (struct objfile 
+       obstack_grow (&cu_list, val, 8);
+     }
+ 
++  /* Write out the .debug_type entries, if any.  */
++  if (dwarf2_per_objfile->signatured_types)
++    {
++      struct signatured_type_index_data sig_data;
++
++      sig_data.objfile = objfile;
++      sig_data.symtab = symtab;
++      sig_data.types_list = &types_cu_list;
++      sig_data.cu_index = dwarf2_per_objfile->n_comp_units;
++      htab_traverse_noresize (dwarf2_per_objfile->signatured_types,
++			      write_one_signatured_type, &sig_data);
++    }
++
+   obstack_init (&constant_pool);
+   make_cleanup_obstack_free (&constant_pool);
+   obstack_init (&symtab_obstack);
+@@ -14518,11 +14733,11 @@ write_psymtabs_to_index (struct objfile 
+ 
+   obstack_init (&contents);
+   make_cleanup_obstack_free (&contents);
+-  size_of_contents = 5 * sizeof (offset_type);
++  size_of_contents = 6 * sizeof (offset_type);
+   total_len = size_of_contents;
+ 
+   /* The version number.  */
+-  val = MAYBE_SWAP (1);
++  val = MAYBE_SWAP (2);
+   obstack_grow (&contents, &val, sizeof (val));
+ 
+   /* The offset of the CU list from the start of the file.  */
+@@ -14530,6 +14745,11 @@ write_psymtabs_to_index (struct objfile 
+   obstack_grow (&contents, &val, sizeof (val));
+   total_len += obstack_object_size (&cu_list);
+ 
++  /* The offset of the types CU list from the start of the file.  */
++  val = MAYBE_SWAP (total_len);
++  obstack_grow (&contents, &val, sizeof (val));
++  total_len += obstack_object_size (&types_cu_list);
++
+   /* The offset of the address table from the start of the file.  */
+   val = MAYBE_SWAP (total_len);
+   obstack_grow (&contents, &val, sizeof (val));
+@@ -14549,6 +14769,7 @@ write_psymtabs_to_index (struct objfile 
+ 
+   write_obstack (out_file, &contents);
+   write_obstack (out_file, &cu_list);
++  write_obstack (out_file, &types_cu_list);
+   write_obstack (out_file, &addr_obstack);
+   write_obstack (out_file, &symtab_obstack);
+   write_obstack (out_file, &constant_pool);
+@@ -14573,18 +14794,33 @@ write_psymtabs_to_index (struct objfile 
+ 
+    1. The file header.  This is a sequence of values, of offset_type
+    unless otherwise noted:
+-   [0] The version number.  Currently 1.
++   [0] The version number.  Currently 1 or 2.  The differences are
++   noted below.  Version 1 did not account for .debug_types sections;
++   the presence of a .debug_types section invalidates any version 1
++   index that may exist.
+    [1] The offset, from the start of the file, of the CU list.
++   [1.5] In version 2, the offset, from the start of the file, of the
++   types CU list.  This offset does not appear in version 1.  Note
++   that this can be empty, in which case this offset will be equal to
++   the next offset.
+    [2] The offset, from the start of the file, of the address section.
+    [3] The offset, from the start of the file, of the symbol table.
+    [4] The offset, from the start of the file, of the constant pool.
+ 
+    2. The CU list.  This is a sequence of pairs of 64-bit
+-   little-endian values.  The first element in each pair is the offset
+-   of a CU in the .debug_info section.  The second element in each
+-   pair is the length of that CU.  References to a CU elsewhere in the
+-   map are done using a CU index, which is just the 0-based index into
+-   this table.
++   little-endian values, sorted by the CU offset.  The first element
++   in each pair is the offset of a CU in the .debug_info section.  The
++   second element in each pair is the length of that CU.  References
++   to a CU elsewhere in the map are done using a CU index, which is
++   just the 0-based index into this table.  Note that if there are
++   type CUs, then conceptually CUs and type CUs form a single list for
++   the purposes of CU indices.
++
++   2.5 The types CU list.  This does not appear in a version 1 index.
++   This is a sequence of triplets of 64-bit little-endian values.  In
++   a triplet, the first value is the CU offset, the second value is
++   the type offset in the CU, and the third value is the type
++   signature.  The types CU list is not sorted.
+ 
+    3. The address section.  The address section consists of a sequence
+    of address entries.  Each address entry has three elements.

diff --git a/gdb-gdbindex-v2-to-v3.patch b/gdb-gdbindex-v2-to-v3.patch
new file mode 100644
index 0000000..bbd7045
--- /dev/null
+++ b/gdb-gdbindex-v2-to-v3.patch
@@ -0,0 +1,278 @@
+FYI: index pre-expansion fix
+http://sourceware.org/ml/gdb-patches/2010-09/msg00452.html
+http://sourceware.org/ml/gdb-cvs/2010-09/msg00165.html
+
+### src/gdb/ChangeLog	2010/09/27 17:41:35	1.12206
+### src/gdb/ChangeLog	2010/09/27 18:42:35	1.12207
+## -1,5 +1,17 @@
+ 2010-09-27  Tom Tromey  <tromey@redhat.com>
+ 
++	* dwarf2read.c (dwarf2_read_index): Only allow version 3.
++	(write_psymbols): Add 'psyms_seen' and 'is_static' arguments.
++	Only emit a given psymbol once.
++	(struct signatured_type_index_data) <psyms_seen>: New field.
++	(write_one_signatured_type): Update.
++	(cleanup_htab): New function.
++	(write_psymtabs_to_index): Update.  Create psyms_seen hash.  Bump
++	version to 3.
++	(save_gdb_index_command): Update index documentation.
++
++2010-09-27  Tom Tromey  <tromey@redhat.com>
++
+ 	* bcache.c (expand_hash_table): Use hash_function, not hash.
+ 
+ 2010-09-27  Tom Tromey  <tromey@redhat.com>
+Index: gdb-7.2/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.2.orig/gdb/dwarf2read.c	2010-10-12 18:11:27.000000000 +0200
++++ gdb-7.2/gdb/dwarf2read.c	2010-10-12 18:12:03.000000000 +0200
+@@ -1897,15 +1897,10 @@ dwarf2_read_index (struct objfile *objfi
+   addr = dwarf2_per_objfile->gdb_index.buffer;
+   /* Version check.  */
+   version = MAYBE_SWAP (*(offset_type *) addr);
+-  if (version == 1)
+-    {
+-      /* Index version 1 neglected to account for .debug_types.  So,
+-	 if we see .debug_types, we cannot use this index.  */
+-      if (dwarf2_per_objfile->types.asection != NULL
+-	  && dwarf2_per_objfile->types.size != 0)
+-	return 0;
+-    }
+-  else if (version != 2)
++  /* Versions earlier than 3 emitted every copy of a psymbol.  This
++     causes the index to behave very poorly for certain requests.  So,
++     it seems better to just ignore such indices.  */
++  if (version < 3)
+     return 0;
+ 
+   map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
+@@ -1919,14 +1914,11 @@ dwarf2_read_index (struct objfile *objfi
+ 		      / 8);
+   ++i;
+ 
+-  if (version == 2)
+-    {
+-      types_list = addr + MAYBE_SWAP (metadata[i]);
+-      types_list_elements = ((MAYBE_SWAP (metadata[i + 1])
+-			      - MAYBE_SWAP (metadata[i]))
+-			     / 8);
+-      ++i;
+-    }
++  types_list = addr + MAYBE_SWAP (metadata[i]);
++  types_list_elements = ((MAYBE_SWAP (metadata[i + 1])
++			  - MAYBE_SWAP (metadata[i]))
++			 / 8);
++  ++i;
+ 
+   map->address_table = addr + MAYBE_SWAP (metadata[i]);
+   map->address_table_size = (MAYBE_SWAP (metadata[i + 1])
+@@ -1944,8 +1936,7 @@ dwarf2_read_index (struct objfile *objfi
+   if (!create_cus_from_index (objfile, cu_list, cu_list_elements))
+     return 0;
+ 
+-  if (version == 2
+-      && types_list_elements
++  if (types_list_elements
+       && !create_signatured_type_hash_from_index (objfile, types_list,
+ 						  types_list_elements))
+     return 0;
+@@ -14568,15 +14559,38 @@ add_address_entry (struct objfile *objfi
+ /* Add a list of partial symbols to SYMTAB.  */
+ static void
+ write_psymbols (struct mapped_symtab *symtab,
++		htab_t psyms_seen,
+ 		struct partial_symbol **psymp,
+ 		int count,
+-		offset_type cu_index)
++		offset_type cu_index,
++		int is_static)
+ {
+   for (; count-- > 0; ++psymp)
+     {
++      void **slot, *lookup;
++
+       if (SYMBOL_LANGUAGE (*psymp) == language_ada)
+ 	error (_("Ada is not currently supported by the index"));
+-      add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index);
++
++      /* We only want to add a given psymbol once.  However, we also
++	 want to account for whether it is global or static.  So, we
++	 may add it twice, using slightly different values.  */
++      if (is_static)
++	{
++	  uintptr_t val = 1 | (uintptr_t) *psymp;
++
++	  lookup = (void *) val;
++	}
++      else
++	lookup = *psymp;
++
++      /* Only add a given psymbol once.  */
++      slot = htab_find_slot (psyms_seen, lookup, INSERT);
++      if (!*slot)
++	{
++	  *slot = lookup;
++	  add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index);
++	}
+     }
+ }
+ 
+@@ -14606,6 +14620,7 @@ struct signatured_type_index_data
+   struct objfile *objfile;
+   struct mapped_symtab *symtab;
+   struct obstack *types_list;
++  htab_t psyms_seen;
+   int cu_index;
+ };
+ 
+@@ -14621,11 +14636,15 @@ write_one_signatured_type (void **slot, 
+   gdb_byte val[8];
+ 
+   write_psymbols (info->symtab,
++		  info->psyms_seen,
+ 		  info->objfile->global_psymbols.list + psymtab->globals_offset,
+-		  psymtab->n_global_syms, info->cu_index);
++		  psymtab->n_global_syms, info->cu_index,
++		  0);
+   write_psymbols (info->symtab,
++		  info->psyms_seen,
+ 		  info->objfile->static_psymbols.list + psymtab->statics_offset,
+-		  psymtab->n_static_syms, info->cu_index);
++		  psymtab->n_static_syms, info->cu_index,
++		  1);
+ 
+   store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->offset);
+   obstack_grow (info->types_list, val, 8);
+@@ -14639,6 +14658,14 @@ write_one_signatured_type (void **slot, 
+   return 1;
+ }
+ 
++/* A cleanup function for an htab_t.  */
++
++static void
++cleanup_htab (void *arg)
++{
++  htab_delete (arg);
++}
++
+ /* Create an index file for OBJFILE in the directory DIR.  */
+ static void
+ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
+@@ -14653,6 +14680,7 @@ write_psymtabs_to_index (struct objfile 
+   offset_type val, size_of_contents, total_len;
+   struct stat st;
+   char buf[8];
++  htab_t psyms_seen;
+ 
+   if (!objfile->psymtabs)
+     return;
+@@ -14685,6 +14713,10 @@ write_psymtabs_to_index (struct objfile 
+   obstack_init (&types_cu_list);
+   make_cleanup_obstack_free (&types_cu_list);
+ 
++  psyms_seen = htab_create_alloc (100, htab_hash_pointer, htab_eq_pointer,
++				  NULL, xcalloc, xfree);
++  make_cleanup (cleanup_htab, psyms_seen);
++
+   /* The list is already sorted, so we don't need to do additional
+      work here.  Also, the debug_types entries do not appear in
+      all_comp_units, but only in their own hash table.  */
+@@ -14695,11 +14727,15 @@ write_psymtabs_to_index (struct objfile 
+       gdb_byte val[8];
+ 
+       write_psymbols (symtab,
++		      psyms_seen,
+ 		      objfile->global_psymbols.list + psymtab->globals_offset,
+-		      psymtab->n_global_syms, i);
++		      psymtab->n_global_syms, i,
++		      0);
+       write_psymbols (symtab,
++		      psyms_seen,
+ 		      objfile->static_psymbols.list + psymtab->statics_offset,
+-		      psymtab->n_static_syms, i);
++		      psymtab->n_static_syms, i,
++		      1);
+ 
+       add_address_entry (objfile, &addr_obstack, psymtab, i);
+ 
+@@ -14717,6 +14753,7 @@ write_psymtabs_to_index (struct objfile 
+       sig_data.objfile = objfile;
+       sig_data.symtab = symtab;
+       sig_data.types_list = &types_cu_list;
++      sig_data.psyms_seen = psyms_seen;
+       sig_data.cu_index = dwarf2_per_objfile->n_comp_units;
+       htab_traverse_noresize (dwarf2_per_objfile->signatured_types,
+ 			      write_one_signatured_type, &sig_data);
+@@ -14734,7 +14771,7 @@ write_psymtabs_to_index (struct objfile 
+   total_len = size_of_contents;
+ 
+   /* The version number.  */
+-  val = MAYBE_SWAP (2);
++  val = MAYBE_SWAP (3);
+   obstack_grow (&contents, &val, sizeof (val));
+ 
+   /* The offset of the CU list from the start of the file.  */
+@@ -14791,18 +14828,16 @@ write_psymtabs_to_index (struct objfile 
+ 
+    1. The file header.  This is a sequence of values, of offset_type
+    unless otherwise noted:
+-   [0] The version number.  Currently 1 or 2.  The differences are
+-   noted below.  Version 1 did not account for .debug_types sections;
+-   the presence of a .debug_types section invalidates any version 1
+-   index that may exist.
++
++   [0] The version number, currently 3.  Versions 1 and 2 are
++   obsolete.
+    [1] The offset, from the start of the file, of the CU list.
+-   [1.5] In version 2, the offset, from the start of the file, of the
+-   types CU list.  This offset does not appear in version 1.  Note
+-   that this can be empty, in which case this offset will be equal to
+-   the next offset.
+-   [2] The offset, from the start of the file, of the address section.
+-   [3] The offset, from the start of the file, of the symbol table.
+-   [4] The offset, from the start of the file, of the constant pool.
++   [2] The offset, from the start of the file, of the types CU list.
++   Note that this section can be empty, in which case this offset will
++   be equal to the next offset.
++   [3] The offset, from the start of the file, of the address section.
++   [4] The offset, from the start of the file, of the symbol table.
++   [5] The offset, from the start of the file, of the constant pool.
+ 
+    2. The CU list.  This is a sequence of pairs of 64-bit
+    little-endian values, sorted by the CU offset.  The first element
+@@ -14813,19 +14848,19 @@ write_psymtabs_to_index (struct objfile 
+    type CUs, then conceptually CUs and type CUs form a single list for
+    the purposes of CU indices.
+ 
+-   2.5 The types CU list.  This does not appear in a version 1 index.
+-   This is a sequence of triplets of 64-bit little-endian values.  In
+-   a triplet, the first value is the CU offset, the second value is
+-   the type offset in the CU, and the third value is the type
+-   signature.  The types CU list is not sorted.
++   3. The types CU list.  This is a sequence of triplets of 64-bit
++   little-endian values.  In a triplet, the first value is the CU
++   offset, the second value is the type offset in the CU, and the
++   third value is the type signature.  The types CU list is not
++   sorted.
+ 
+-   3. The address section.  The address section consists of a sequence
++   4. The address section.  The address section consists of a sequence
+    of address entries.  Each address entry has three elements.
+    [0] The low address.  This is a 64-bit little-endian value.
+    [1] The high address.  This is a 64-bit little-endian value.
+    [2] The CU index.  This is an offset_type value.
+ 
+-   4. The symbol table.  This is a hash table.  The size of the hash
++   5. The symbol table.  This is a hash table.  The size of the hash
+    table is always a power of 2.  The initial hash and the step are
+    currently defined by the `find_slot' function.
+ 
+@@ -14847,7 +14882,7 @@ write_psymtabs_to_index (struct objfile 
+    element in the hash table is used to indicate which CUs define the
+    symbol.
+ 
+-   5. The constant pool.  This is simply a bunch of bytes.  It is
++   6. The constant pool.  This is simply a bunch of bytes.  It is
+    organized so that alignment is correct: CU vectors are stored
+    first, followed by strings.  */
+ static void

diff --git a/gdb-pr12028-double-free.patch b/gdb-pr12028-double-free.patch
new file mode 100644
index 0000000..deb2115
--- /dev/null
+++ b/gdb-pr12028-double-free.patch
@@ -0,0 +1,99 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00321.html
+Subject: [patch] PR 12028 "GDB crashes on a double free during overload resolution"
+
+old_cleanups was being set twice making the later call to 
+discard_cleanups ignore the first 'make_cleanup' request.
+
+The patch is proposed for both head and the 7.2 branch.
+
+This has been regression tested on x8664 with gcc-4.4.4-10.fc13
+
+
+Fix PR 12028: "GDB crashes on a double free during overload resolution "
+
+2010-09-16  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	PR C++/12028
+	* valops.c (find_oload_champ_namespace_loop): removed incorrect
+	'old_cleanups' reassignment.
+
+2010-09-16  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* gdb.cp/pr12028.cc: New.
+	* gdb.cp/pr12028.exp: New.
+
+diff --git a/gdb/testsuite/gdb.cp/pr12028.cc b/gdb/testsuite/gdb.cp/pr12028.cc
+new file mode 100644
+index 0000000..0fcab6b
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/pr12028.cc
+@@ -0,0 +1,21 @@
++class A{};
++class B{};
++class C: public B {};
++
++namespace D{
++  int foo (A) { return 11; }
++  int foo (C) { return 12; }
++}
++
++int main()
++{
++  A a;
++  B b;
++  C c;
++
++  D::foo (a);
++  //  D::foo (b);
++  D::foo (c);
++
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp
+new file mode 100644
+index 0000000..746c6b5
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/pr12028.exp
+@@ -0,0 +1,29 @@
++# 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/>.
++
++set testfile pr12028
++set srcfile ${testfile}.cc
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } {
++    return -1
++}
++
++############################################
++
++if ![runto_main] then {
++    perror "couldn't run to breakpoint main"
++    continue
++}
++
++gdb_test "p D::foo(b)" "Cannot resolve function foo to any overloaded instance"
+diff --git a/gdb/valops.c b/gdb/valops.c
+index 7fbad10..4e83a04 100644
+--- a/gdb/valops.c
++++ b/gdb/valops.c
+@@ -2715,7 +2715,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
+      function symbol to start off with.)  */
+ 
+   old_cleanups = make_cleanup (xfree, *oload_syms);
+-  old_cleanups = make_cleanup (xfree, *oload_champ_bv);
++  make_cleanup (xfree, *oload_champ_bv);
+   new_namespace = alloca (namespace_len + 1);
+   strncpy (new_namespace, qualified_name, namespace_len);
+   new_namespace[namespace_len] = '\0';

diff --git a/gdb-python-error-state.patch b/gdb-python-error-state.patch
new file mode 100644
index 0000000..d3df518
--- /dev/null
+++ b/gdb-python-error-state.patch
@@ -0,0 +1,592 @@
+http://sourceware.org/ml/gdb-patches/2010-10/msg00175.html
+Subject: Re: [patch] python: save/restore/fix error state
+
+On Fri, 08 Oct 2010 22:08:27 +0200, Doug Evans wrote:
+> The comment above this code says:
+> 
+>   /* Note: If an exception occurs python will print the traceback and
+>      clear the error indicator.  */
+> 
+> ISTM that either this comment is wrong or the above patch is wrong, or
+> some combination thereof.
+
+This comment is right, Python has no bug there, other gdb/python/ code has
+bugs.  That is some gdb/python/ code returned success value while still
+leaving the python exception set.  Such case is undefined and unchecked by
+Python.  Python error state does not follow the errno POSIX semantics
+	The setting of errno after a successful call to a function is
+	unspecified [...].
+as Python requires instead:
+	The Python error state after a successful call to a function must be
+	cleared.
+
+I have checked callers of these functions, as a closure on the callers of the
+top py-utils.c functions.  That does not mean this Python error state handling
+verification is complete:
+	python_string_to_unicode unicode_to_encoded_string
+	unicode_to_encoded_python_string unicode_to_target_string
+	unicode_to_target_python_string python_string_to_target_string
+	python_string_to_target_python_string python_string_to_host_string
+	target_string_to_unicode gdbpy_obj_to_string gdbpy_exception_to_string
+	get_addr_from_python convert_value_from_python frapy_read_var
+	gdbpy_get_display_hint valpy_getitem FIXME set_parameter_value
+	compute_enum_values infpy_read_memory infpy_write_memory
+	infpy_search_memory valpy_new valpy_call valpy_binop valpy_richcompare
+	pretty_print_one_value set_attr parmpy_init
+
+Therefore I have removed the check after PyRun_SimpleFile.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* python/py-breakpoint.c (bppy_set_condition): New comment.
+	* python/py-cmd.c (cmdpy_function): Call also gdbpy_print_stack for
+	failed PyUnicode_Decode.
+	(cmdpy_completer): Skip element for failed
+	python_string_to_host_string.
+	(cmdpy_init): Return -1 on failed python_string_to_host_string.
+	* python/py-frame.c (frapy_read_var): Extend the function comment.
+	* python/py-function.c (fnpy_init): Return -1 on failed
+	python_string_to_host_string.
+	* python/py-inferior.c (infpy_read_memory, infpy_write_memory): Extend
+	the function comment.
+	(infpy_search_memory): Extend the function comment.  Remove the
+	PyErr_SetString call on already set error state.
+	* python/py-param.c (set_parameter_value): Extend the function
+	comment.  Return -1 on failed python_string_to_host_string, twice.
+	(set_attr): Extend the function comment.
+	(compute_enum_values): Extend the function comment.  New variable
+	back_to.  Protect self->enumeration by BACK_TO cleanups.  Return 0 on
+	failed python_string_to_host_string.
+	(get_doc_string): Call gdbpy_print_stack on failed
+	python_string_to_host_string.
+	(parmpy_init): Extend the function comment.
+	* python/py-prettyprint.c (pretty_print_one_value): Likewise.
+	(gdbpy_get_display_hint, print_children): Call gdbpy_print_stack on
+	failed python_string_to_host_string.
+	* python/py-value.c (valpy_new, valpy_getitem, valpy_call)
+	(valpy_binop, valpy_richcompare): Extend the function comment.
+	* python/python.c
+	(struct python_env) <error_type, error_value, error_traceback>: New
+	fields.
+	(restore_python_env): Handle PyErr_Occurred.  Call PyErr_Restore.
+	(ensure_python_env): Call PyErr_Fetch.
+	* varobj.c (update_dynamic_varobj_children): Call gdbpy_print_stack on
+	failed convert_value_from_python.
+	(value_get_print_value): Call gdbpy_print_stack on failed
+	python_string_to_target_python_string.
+
+gdb/testsuite/
+2010-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.python/py-error.exp: New file.
+	* gdb.python/py-error.py: New file.
+
+Index: gdb-7.2/gdb/python/py-breakpoint.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-breakpoint.c	2010-10-12 18:27:54.000000000 +0200
++++ gdb-7.2/gdb/python/py-breakpoint.c	2010-10-12 18:28:58.000000000 +0200
+@@ -420,6 +420,9 @@ bppy_get_condition (PyObject *self, void
+   return PyString_Decode (str, strlen (str), host_charset (), NULL);
+ }
+ 
++/* Returns 0 on success.  Returns -1 on error, with a python exception set.
++   */
++
+ static int
+ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
+ {
+Index: gdb-7.2/gdb/python/py-cmd.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-cmd.c	2010-10-12 18:27:54.000000000 +0200
++++ gdb-7.2/gdb/python/py-cmd.c	2010-10-12 18:28:58.000000000 +0200
+@@ -138,7 +138,10 @@ cmdpy_function (struct cmd_list_element 
+     args = "";
+   argobj = PyUnicode_Decode (args, strlen (args), host_charset (), NULL);
+   if (! argobj)
+-    error (_("Could not convert arguments to Python string."));
++    {
++      gdbpy_print_stack ();
++      error (_("Could not convert arguments to Python string."));
++    }
+ 
+   ttyobj = from_tty ? Py_True : Py_False;
+   Py_INCREF (ttyobj);
+@@ -255,6 +258,12 @@ cmdpy_completer (struct cmd_list_element
+ 	      continue;
+ 	    }
+ 	  result[out] = python_string_to_host_string (elt);
++	  if (result[out] == NULL)
++	    {
++	      /* Skip problem elements.  */
++	      PyErr_Clear ();
++	      continue;
++	    }
+ 	  ++out;
+ 	}
+       result[out] = NULL;
+@@ -465,7 +474,15 @@ cmdpy_init (PyObject *self, PyObject *ar
+       PyObject *ds_obj = PyObject_GetAttr (self, gdbpy_doc_cst);
+ 
+       if (ds_obj && gdbpy_is_string (ds_obj))
+-	docstring = python_string_to_host_string (ds_obj);
++	{
++	  docstring = python_string_to_host_string (ds_obj);
++	  if (docstring == NULL)
++	    {
++	      xfree (cmd_name);
++	      xfree (pfx_name);
++	      return -1;
++	    }
++	}
+     }
+   if (! docstring)
+     docstring = xstrdup (_("This command is not documented."));
+Index: gdb-7.2/gdb/python/py-frame.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-frame.c	2010-06-28 23:16:03.000000000 +0200
++++ gdb-7.2/gdb/python/py-frame.c	2010-10-12 18:28:58.000000000 +0200
+@@ -385,7 +385,8 @@ frapy_find_sal (PyObject *self, PyObject
+    start the search from that block, otherwise search from the frame's
+    current block (determined by examining the resume address of the
+    frame).  The variable argument must be a string or an instance of a
+-   gdb.Symbol.  The block argument must be an instance of gdb.Block.  */
++   gdb.Symbol.  The block argument must be an instance of gdb.Block.  Returns
++   NULL on error, with a python exception set.  */
+ static PyObject *
+ frapy_read_var (PyObject *self, PyObject *args)
+ {
+Index: gdb-7.2/gdb/python/py-function.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-function.c	2010-05-17 23:23:25.000000000 +0200
++++ gdb-7.2/gdb/python/py-function.c	2010-10-12 18:28:58.000000000 +0200
+@@ -113,7 +113,14 @@ fnpy_init (PyObject *self, PyObject *arg
+     {
+       PyObject *ds_obj = PyObject_GetAttrString (self, "__doc__");
+       if (ds_obj && gdbpy_is_string (ds_obj))
+-	docstring = python_string_to_host_string (ds_obj);
++	{
++	  docstring = python_string_to_host_string (ds_obj);
++	  if (docstring == NULL)
++	    {
++	      Py_DECREF (self);
++	      return -1;
++	    }
++	}
+     }
+   if (! docstring)
+     docstring = xstrdup (_("This function is not documented."));
+Index: gdb-7.2/gdb/python/py-inferior.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-inferior.c	2010-06-28 23:16:03.000000000 +0200
++++ gdb-7.2/gdb/python/py-inferior.c	2010-10-12 18:28:58.000000000 +0200
+@@ -293,7 +293,8 @@ gdbpy_inferiors (PyObject *unused, PyObj
+ 
+ /* Implementation of gdb.read_memory (address, length).
+    Returns a Python buffer object with LENGTH bytes of the inferior's
+-   memory at ADDRESS.  Both arguments are integers.  */
++   memory at ADDRESS.  Both arguments are integers.  Returns NULL on error,
++   with a python exception set.  */
+ static PyObject *
+ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
+ {
+@@ -361,7 +362,8 @@ infpy_read_memory (PyObject *self, PyObj
+    Writes the contents of BUFFER (a Python object supporting the read
+    buffer protocol) at ADDRESS in the inferior's memory.  Write LENGTH
+    bytes from BUFFER, or its entire contents if the argument is not
+-   provided.  The function returns nothing.  */
++   provided.  The function returns nothing.  Returns NULL on error, with
++   a python exception set.  */
+ static PyObject *
+ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
+ {
+@@ -473,7 +475,8 @@ get_char_buffer (PyObject *self, Py_ssiz
+    search from ADDRESS.  PATTERN is the pattern to search for (and
+    must be a Python object supporting the buffer protocol).
+    Returns a Python Long object holding the address where the pattern
+-   was located, or if the pattern was not found, returns None.  */
++   was located, or if the pattern was not found, returns None.  Returns NULL
++   on error, with a python exception set.  */
+ static PyObject *
+ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
+ {
+@@ -511,12 +514,7 @@ infpy_search_memory (PyObject *self, PyO
+ 	}
+     }
+   else
+-    {
+-      PyErr_SetString (PyExc_RuntimeError,
+-		       _("Cannot get search address/range from Python."));
+-
+-      return NULL;
+-    }
++    return NULL;
+ 
+   if (!PyObject_CheckReadBuffer (pattern))
+     {
+Index: gdb-7.2/gdb/python/py-param.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-param.c	2010-05-17 23:23:25.000000000 +0200
++++ gdb-7.2/gdb/python/py-param.c	2010-10-12 18:28:58.000000000 +0200
+@@ -110,8 +110,8 @@ get_attr (PyObject *obj, PyObject *attr_
+   return PyObject_GenericGetAttr (obj, attr_name);
+ }
+ 
+-/* Set a parameter value from a Python value.  Return 0 on success, -1
+-   on failure.  */
++/* Set a parameter value from a Python value.  Return 0 on success.  Returns
++   -1 on error, with a python exception set.  */
+ static int
+ set_parameter_value (parmpy_object *self, PyObject *value)
+ {
+@@ -142,7 +142,11 @@ set_parameter_value (parmpy_object *self
+ 	    self->value.stringval = NULL;
+ 	}
+       else
+-	self->value.stringval = python_string_to_host_string (value);
++	{
++	  self->value.stringval = python_string_to_host_string (value);
++	  if (self->value.stringval == NULL)
++	    return -1;
++	}
+       break;
+ 
+     case var_enum:
+@@ -158,6 +162,8 @@ set_parameter_value (parmpy_object *self
+ 	  }
+ 
+ 	str = python_string_to_host_string (value);
++	if (str == NULL)
++	  return -1;
+ 	for (i = 0; self->enumeration[i]; ++i)
+ 	  if (! strcmp (self->enumeration[i], str))
+ 	    break;
+@@ -258,7 +264,7 @@ set_parameter_value (parmpy_object *self
+   return 0;
+ }
+ 
+-/* Set an attribute.  */
++/* Set an attribute.  Returns -1 on error, with a python exception set.  */
+ static int
+ set_attr (PyObject *obj, PyObject *attr_name, PyObject *val)
+ {
+@@ -358,12 +364,13 @@ add_setshow_generic (int parmclass, enum
+     }
+ }
+ 
+-/* A helper which computes enum values.  Returns 1 on success, 0 on
+-   error.  */
++/* A helper which computes enum values.  Returns 1 on success.  Returns 0 on
++   error, with a python exception set.  */
+ static int
+ compute_enum_values (parmpy_object *self, PyObject *enum_values)
+ {
+   Py_ssize_t size, i;
++  struct cleanup *back_to;
+ 
+   if (! enum_values)
+     {
+@@ -390,6 +397,7 @@ compute_enum_values (parmpy_object *self
+     }
+ 
+   self->enumeration = xmalloc ((size + 1) * sizeof (char *));
++  back_to = make_cleanup (free_current_contents, &self->enumeration);
+   memset (self->enumeration, 0, (size + 1) * sizeof (char *));
+ 
+   for (i = 0; i < size; ++i)
+@@ -397,16 +405,27 @@ compute_enum_values (parmpy_object *self
+       PyObject *item = PySequence_GetItem (enum_values, i);
+ 
+       if (! item)
+-	return 0;
++	{
++	  do_cleanups (back_to);
++	  return 0;
++	}
+       if (! gdbpy_is_string (item))
+ 	{
++	  do_cleanups (back_to);
+ 	  PyErr_SetString (PyExc_RuntimeError, 
+ 			   _("The enumeration item not a string."));
+ 	  return 0;
+ 	}
+       self->enumeration[i] = python_string_to_host_string (item);
++      if (self->enumeration[i] == NULL)
++	{
++	  do_cleanups (back_to);
++	  return 0;
++	}
++      make_cleanup (xfree, (char *) self->enumeration[i]);
+     }
+ 
++  discard_cleanups (back_to);
+   return 1;
+ }
+ 
+@@ -422,7 +441,11 @@ get_doc_string (PyObject *object, PyObje
+       PyObject *ds_obj = PyObject_GetAttr (object, attr);
+ 
+       if (ds_obj && gdbpy_is_string (ds_obj))
+-	result = python_string_to_host_string (ds_obj);
++	{
++	  result = python_string_to_host_string (ds_obj);
++	  if (result == NULL)
++	    gdbpy_print_stack ();
++	}
+     }
+   if (! result)
+     result = xstrdup (_("This command is not documented."));
+@@ -449,8 +472,9 @@ get_doc_string (PyObject *object, PyObje
+ 
+    The documentation for the parameter is taken from the doc string
+    for the python class.
+-   
+-*/
++
++   Returns -1 on error, with a python exception set.  */
++
+ static int
+ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
+ {
+Index: gdb-7.2/gdb/python/py-prettyprint.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-prettyprint.c	2010-10-12 18:27:57.000000000 +0200
++++ gdb-7.2/gdb/python/py-prettyprint.c	2010-10-12 18:28:58.000000000 +0200
+@@ -185,8 +185,8 @@ find_pretty_printer (PyObject *value)
+    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.  */
++   is returned.  On error, *OUT_VALUE is set to NULL, NULL is
++   returned, with a python exception set.  */
+ 
+ static PyObject *
+ pretty_print_one_value (PyObject *printer, struct value **out_value)
+@@ -232,7 +232,11 @@ gdbpy_get_display_hint (PyObject *printe
+   if (hint)
+     {
+       if (gdbpy_is_string (hint))
+-	result = python_string_to_host_string (hint);
++	{
++	  result = python_string_to_host_string (hint);
++	  if (result == NULL)
++	    gdbpy_print_stack ();
++	}
+       Py_DECREF (hint);
+     }
+   else
+@@ -574,7 +578,10 @@ print_children (PyObject *printer, const
+ 	  else
+ 	    {
+ 	      output = python_string_to_host_string (py_v);
+-	      fputs_filtered (output, stream);
++	      if (!output)
++		gdbpy_print_stack ();
++	      else
++		fputs_filtered (output, stream);
+ 	      xfree (output);
+ 	    }
+ 	}
+Index: gdb-7.2/gdb/python/py-value.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/py-value.c	2010-10-12 18:27:54.000000000 +0200
++++ gdb-7.2/gdb/python/py-value.c	2010-10-12 18:28:58.000000000 +0200
+@@ -114,7 +114,8 @@ note_value (value_object *value_obj)
+   values_in_python = value_obj;
+ }
+ 
+-/* Called when a new gdb.Value object needs to be allocated.  */
++/* Called when a new gdb.Value object needs to be allocated.  Returns NULL on
++   error, with a python exception set.  */
+ static PyObject *
+ valpy_new (PyTypeObject *subtype, PyObject *args, PyObject *keywords)
+ {
+@@ -334,7 +335,7 @@ valpy_length (PyObject *self)
+ }
+ 
+ /* Given string name of an element inside structure, return its value
+-   object.  */
++   object.  Returns NULL on error, with a python exception set.  */
+ static PyObject *
+ valpy_getitem (PyObject *self, PyObject *key)
+ {
+@@ -468,7 +469,8 @@ enum valpy_opcode
+   ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
+ 
+ /* Returns a value object which is the result of applying the operation
+-   specified by OPCODE to the given arguments.  */
++   specified by OPCODE to the given arguments.  Returns NULL on error, with
++   a python exception set.  */
+ static PyObject *
+ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
+ {
+@@ -723,7 +725,8 @@ valpy_xor (PyObject *self, PyObject *oth
+   return valpy_binop (VALPY_BITXOR, self, other);
+ }
+ 
+-/* Implements comparison operations for value objects.  */
++/* Implements comparison operations for value objects.  Returns NULL on error,
++   with a python exception set.  */
+ static PyObject *
+ valpy_richcompare (PyObject *self, PyObject *other, int op)
+ {
+Index: gdb-7.2/gdb/python/python.c
+===================================================================
+--- gdb-7.2.orig/gdb/python/python.c	2010-10-12 18:27:54.000000000 +0200
++++ gdb-7.2/gdb/python/python.c	2010-10-12 18:28:58.000000000 +0200
+@@ -82,6 +82,7 @@ struct python_env
+   PyGILState_STATE state;
+   struct gdbarch *gdbarch;
+   const struct language_defn *language;
++  PyObject *error_type, *error_value, *error_traceback;
+ };
+ 
+ static void
+@@ -89,6 +90,16 @@ restore_python_env (void *p)
+ {
+   struct python_env *env = (struct python_env *)p;
+ 
++  /* Leftover Python error is forbidden by Python Exception Handling.  */
++  if (PyErr_Occurred ())
++    {
++      /* This order is similar to the one calling error afterwards. */
++      gdbpy_print_stack ();
++      warning (_("internal error: Unhandled Python exception"));
++    }
++
++  PyErr_Restore (env->error_type, env->error_value, env->error_traceback);
++
+   PyGILState_Release (env->state);
+   python_gdbarch = env->gdbarch;
+   python_language = env->language;
+@@ -111,6 +122,9 @@ ensure_python_env (struct gdbarch *gdbar
+   python_gdbarch = gdbarch;
+   python_language = language;
+ 
++  /* Save it and ensure ! PyErr_Occurred () afterwards.  */
++  PyErr_Fetch (&env->error_type, &env->error_value, &env->error_traceback);
++  
+   return make_cleanup (restore_python_env, env);
+ }
+ 
+Index: gdb-7.2/gdb/testsuite/gdb.python/py-error.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.python/py-error.exp	2010-10-12 18:28:58.000000000 +0200
+@@ -0,0 +1,56 @@
++# 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 error while loading *-gdb.py.  IBM1047 is chosen as possibly supported
++# by glibc but unsupported by Python
++
++set testfile "py-error"
++
++load_lib gdb-python.exp
++
++# Start with a fresh gdb.
++gdb_exit
++gdb_start
++
++# Skip all tests if Python scripting is not enabled.
++if { [skip_python_tests] } { continue }
++
++set charset "IBM1047"
++
++set test2 "main reached"
++
++set test "set host-charset $charset"
++set test_regex [string_to_regexp $test]
++gdb_test_multiple $test $test {
++    -re "^$test_regex\r\n$gdb_prompt $" {
++	pass $test
++    }
++    -re "^$test_regex\r\nUndefined item: \"$charset\"\\.\r\n$gdb_prompt $" {
++	xfail $test
++	untested $test2
++	set test2 ""
++    }
++}
++
++if {$test2 == ""} {
++    return 0
++}
++
++set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
++
++# argc=LookupError: unknown encoding: IBM1047
++gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2
++
++gdb_test "p 1" " = 1" "no delayed error"
+Index: gdb-7.2/gdb/testsuite/gdb.python/py-error.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2/gdb/testsuite/gdb.python/py-error.py	2010-10-12 18:28:58.000000000 +0200
+@@ -0,0 +1,25 @@
++# 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/>.
++
++import gdb
++
++class ClassName(gdb.Command):
++    'a'
++    def __init__(self):
++        gdb.Command.__init__ (self, "ClassName", gdb.COMMAND_DATA, prefix=True)
++    def invoke(self, args, from_tty):
++        print
++
++ClassName()
+Index: gdb-7.2/gdb/varobj.c
+===================================================================
+--- gdb-7.2.orig/gdb/varobj.c	2010-10-12 18:27:54.000000000 +0200
++++ gdb-7.2/gdb/varobj.c	2010-10-12 18:28:58.000000000 +0200
+@@ -1054,6 +1054,8 @@ update_dynamic_varobj_children (struct v
+ 	    error (_("Invalid item from the child list"));
+ 
+ 	  v = convert_value_from_python (py_v);
++	  if (v == NULL)
++	    gdbpy_print_stack ();
+ 	  install_dynamic_child (var, can_mention ? changed : NULL,
+ 				 can_mention ? new : NULL,
+ 				 can_mention ? unchanged : NULL,
+@@ -2542,6 +2544,8 @@ value_get_print_value (struct value *val
+ 			type = builtin_type (gdbarch)->builtin_char;
+ 			Py_DECREF (py_str);
+ 		      }
++		    else
++		      gdbpy_print_stack ();
+ 		  }
+ 		Py_DECREF (output);
+ 	      }

diff --git a/gdb-testsuite-lib-python.patch b/gdb-testsuite-lib-python.patch
new file mode 100644
index 0000000..5a4a560
--- /dev/null
+++ b/gdb-testsuite-lib-python.patch
@@ -0,0 +1,75 @@
+ad20e5eb15d037a31e3b484e9f57542dc927c0a9
+http://sourceware.org/ml/gdb-cvs/2010-10/msg00005.html
+
+### src/gdb/testsuite/ChangeLog	2010/09/30 18:58:07	1.2462
+### src/gdb/testsuite/ChangeLog	2010/10/01 17:03:49	1.2463
+## -1,3 +1,19 @@
++2010-10-01  Doug Evans  <dje@google.com>
++
++	* lib/gdb-python.exp: New file.
++	* gdb.python/py-block.exp: Use it.
++	* gdb.python/py-breakpoint.exp: Ditto.
++	* gdb.python/py-frame.exp: Ditto.
++	* gdb.python/py-inferior.exp: Ditto.
++	* gdb.python/py-param.exp: Ditto.
++	* gdb.python/py-prettyprint.exp: Ditto.
++	* gdb.python/py-shared.exp: Ditto.
++	* gdb.python/py-symbol.exp: Ditto.
++	* gdb.python/py-symtab.exp: Ditto.
++	* gdb.python/py-type.exp: Ditto.
++	* gdb.python/py-value.exp: Ditto.
++	* gdb.python/python.exp: Ditto.
++
+ 2010-09-30  Tom Tromey  <tromey@redhat.com>
+ 
+ 	* gdb.base/anon.exp: New file.
+--- src/gdb/testsuite/lib/gdb-python.exp
++++ src/gdb/testsuite/lib/gdb-python.exp	2010-10-12 17:58:35.904468000 +0000
+@@ -0,0 +1,47 @@
++# 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/>.
++
++# Utilities for python-scripting related tests.
++
++# Run a command in GDB, and report a failure if a Python exception is thrown.
++# If report_pass is true, report a pass if no exception is thrown.
++
++proc gdb_py_test_silent_cmd { cmd name report_pass } {
++    global gdb_prompt
++
++    gdb_test_multiple $cmd $name {
++	-re "Traceback.*$gdb_prompt $" { fail $name }
++	-re "$gdb_prompt $"            { if $report_pass { pass $name } }
++    }
++}
++
++# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}...
++# Run a test named NAME, consisting of multiple lines of input.
++# After each input line INPUT, search for result line RESULT.
++# Succeed if all results are seen; fail otherwise.
++
++proc gdb_py_test_multiple { name args } {
++    global gdb_prompt
++    foreach {input result} $args {
++	if {[gdb_test_multiple $input "$name - $input" {
++	    -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" {
++		pass "$name - $input"
++	    }
++	}]} {
++	    return 1
++	}
++    }
++    return 0
++}

diff --git a/gdb-upstream.patch b/gdb-upstream.patch
new file mode 100644
index 0000000..ad3d10c
--- /dev/null
+++ b/gdb-upstream.patch
@@ -0,0 +1,467 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=610986
+http://sourceware.org/ml/gdb-cvs/2010-08/msg00112.html
+
+### src/gdb/ChangeLog	2010/08/18 22:57:45	1.12097
+### src/gdb/ChangeLog	2010/08/19 07:34:26	1.12098
+## -1,3 +1,9 @@
++2010-08-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	* varobj.c (varobj_create): Replace variable old_fi with old_id,
++	initialize it by null_frame_id, wrap its usage by get_frame_id,
++	frame_id_p and frame_find_by_id.
++
+ 2010-08-18  Tom Tromey  <tromey@redhat.com>
+ 
+ 	PR python/11900:
+--- src/gdb/varobj.c	2010/08/06 14:17:56	1.159
++++ src/gdb/varobj.c	2010/08/19 07:34:27	1.160
+@@ -524,7 +524,7 @@ varobj_create (char *objname,
+ {
+   struct varobj *var;
+   struct frame_info *fi;
+-  struct frame_info *old_fi = NULL;
++  struct frame_id old_id = null_frame_id;
+   struct block *block;
+   struct cleanup *old_chain;
+ 
+@@ -611,7 +611,7 @@
+ 
+ 	  var->root->frame = get_frame_id (fi);
+ 	  var->root->thread_id = pid_to_thread_id (inferior_ptid);
+-	  old_fi = get_selected_frame (NULL);
++	  old_id = get_frame_id (get_selected_frame (NULL));
+ 	  select_frame (fi);	 
+ 	}
+ 
+@@ -639,8 +639,8 @@
+       var->root->rootvar = var;
+ 
+       /* Reset the selected frame */
+-      if (old_fi != NULL)
+-	select_frame (old_fi);
++      if (frame_id_p (old_id))
++	select_frame (frame_find_by_id (old_id));
+     }
+ 
+   /* If the variable object name is null, that means this
+
+
+
+https://bugzilla.redhat.com/show_bug.cgi?id=627506
+Re: [patch] Fix nesting of ui_out_redirect
+http://sourceware.org/ml/gdb-patches/2010-09/msg00122.html
+http://sourceware.org/ml/gdb-cvs/2010-09/msg00031.html
+
+### src/gdb/ChangeLog	2010/09/03 01:29:09	1.12149
+### src/gdb/ChangeLog	2010/09/03 15:41:59	1.12150
+## -1,3 +1,27 @@
++2010-09-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	* breakpoint.c (save_breakpoints): Use RETURN_MASK_ALL.
++	* cli-out.c: Include vec.h.
++	(cli_field_fmt, cli_spaces, cli_text, cli_message, cli_flush): New
++	variable stream, initialize it, use it.
++	(cli_redirect): New function comment.  Replace the stream and
++	original_stream fields by the new streams field.  Remove the
++	original_stream != NULL conditional, assert error on NULL instead.
++	(out_field_fmt, field_separator): New variable stream, initialize it, use it.
++	(cli_out_data_ctor): Assert non-NULL stream.  Replace the stream and
++	original_stream fields by the new streams field.
++	(cli_out_set_stream): Replace the stream field by the new streams
++	field.
++	* cli-out.h: Include vec.h.
++	(ui_filep): New typedef, call DEF_VEC_P for it.
++	(struct cli_ui_out_data): Replace the stream and original_stream
++	fields by the new streams field.
++	* cli/cli-logging.c (set_logging_redirect): Call ui_out_redirect with
++	NULL first.  Extend the comment.
++	(handle_redirections): Call ui_out_redirect with output.
++	* python/py-breakpoint.c (bppy_get_commands): Move ui_out_redirect
++	calls outside of the TRY_CATCH block.
++
+
+[ cli/cli-logging.c removed.  ]
+
+--- src/gdb/breakpoint.c	2010/08/30 09:49:12	1.511
++++ src/gdb/breakpoint.c	2010/09/03 15:42:02	1.512
+@@ -11487,7 +11487,7 @@
+ 	fprintf_unfiltered (fp, "  commands\n");
+ 	
+ 	ui_out_redirect (uiout, fp);
+-	TRY_CATCH (ex, RETURN_MASK_ERROR)
++	TRY_CATCH (ex, RETURN_MASK_ALL)
+ 	  {
+ 	    print_command_lines (uiout, tp->commands->commands, 2);
+ 	  }
+--- src/gdb/cli-out.c	2010/05/13 23:53:32	1.30
++++ src/gdb/cli-out.c	2010/09/03 15:42:02	1.31
+@@ -26,6 +26,7 @@
+ #include "cli-out.h"
+ #include "gdb_string.h"
+ #include "gdb_assert.h"
++#include "vec.h"
+ 
+ typedef struct cli_ui_out_data cli_out_data;
+ 
+@@ -224,11 +225,13 @@
+ 	       va_list args)
+ {
+   cli_out_data *data = ui_out_data (uiout);
++  struct ui_file *stream;
+ 
+   if (data->suppress_output)
+     return;
+ 
+-  vfprintf_filtered (data->stream, format, args);
++  stream = VEC_last (ui_filep, data->streams);
++  vfprintf_filtered (stream, format, args);
+ 
+   if (align != ui_noalign)
+     field_separator ();
+@@ -238,20 +241,26 @@
+ cli_spaces (struct ui_out *uiout, int numspaces)
+ {
+   cli_out_data *data = ui_out_data (uiout);
++  struct ui_file *stream;
+ 
+   if (data->suppress_output)
+     return;
+-  print_spaces_filtered (numspaces, data->stream);
++
++  stream = VEC_last (ui_filep, data->streams);
++  print_spaces_filtered (numspaces, stream);
+ }
+ 
+ static void
+ cli_text (struct ui_out *uiout, const char *string)
+ {
+   cli_out_data *data = ui_out_data (uiout);
++  struct ui_file *stream;
+ 
+   if (data->suppress_output)
+     return;
+-  fputs_filtered (string, data->stream);
++
++  stream = VEC_last (ui_filep, data->streams);
++  fputs_filtered (string, stream);
+ }
+ 
+ static void ATTRIBUTE_PRINTF (3, 0)
+@@ -262,8 +271,13 @@
+ 
+   if (data->suppress_output)
+     return;
++
+   if (ui_out_get_verblvl (uiout) >= verbosity)
+-    vfprintf_unfiltered (data->stream, format, args);
++    {
++      struct ui_file *stream = VEC_last (ui_filep, data->streams);
++
++      vfprintf_unfiltered (stream, format, args);
++    }
+ }
+ 
+ static void
+@@ -280,25 +294,24 @@
+ cli_flush (struct ui_out *uiout)
+ {
+   cli_out_data *data = ui_out_data (uiout);
++  struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ 
+-  gdb_flush (data->stream);
++  gdb_flush (stream);
+ }
+ 
++/* OUTSTREAM as non-NULL will push OUTSTREAM on the stack of output streams
++   and make it therefore active.  OUTSTREAM as NULL will pop the last pushed
++   output stream; it is an internal error if it does not exist.  */
++
+ static int
+ cli_redirect (struct ui_out *uiout, struct ui_file *outstream)
+ {
+   cli_out_data *data = ui_out_data (uiout);
+ 
+   if (outstream != NULL)
+-    {
+-      data->original_stream = data->stream;
+-      data->stream = outstream;
+-    }
+-  else if (data->original_stream != NULL)
+-    {
+-      data->stream = data->original_stream;
+-      data->original_stream = NULL;
+-    }
++    VEC_safe_push (ui_filep, data->streams, outstream);
++  else
++    VEC_pop (ui_filep, data->streams);
+ 
+   return 0;
+ }
+@@ -315,10 +328,11 @@
+ 	       const char *format,...)
+ {
+   cli_out_data *data = ui_out_data (uiout);
++  struct ui_file *stream = VEC_last (ui_filep, data->streams);
+   va_list args;
+ 
+   va_start (args, format);
+-  vfprintf_filtered (data->stream, format, args);
++  vfprintf_filtered (stream, format, args);
+ 
+   va_end (args);
+ }
+@@ -329,8 +343,9 @@
+ field_separator (void)
+ {
+   cli_out_data *data = ui_out_data (uiout);
++  struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ 
+-  fputc_filtered (' ', data->stream);
++  fputc_filtered (' ', stream);
+ }
+ 
+ /* This is the CLI ui-out implementation functions vector */
+@@ -364,8 +379,11 @@
+ void
+ cli_out_data_ctor (cli_out_data *self, struct ui_file *stream)
+ {
+-  self->stream = stream;
+-  self->original_stream = NULL;
++  gdb_assert (stream != NULL);
++
++  self->streams = NULL;
++  VEC_safe_push (ui_filep, self->streams, stream);
++
+   self->suppress_output = 0;
+ }
+ 
+@@ -385,8 +403,10 @@
+ cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
+ {
+   cli_out_data *data = ui_out_data (uiout);
+-  struct ui_file *old = data->stream;
++  struct ui_file *old;
++  
++  old = VEC_pop (ui_filep, data->streams);
++  VEC_quick_push (ui_filep, data->streams, stream);
+ 
+-  data->stream = stream;
+   return old;
+ }
+--- src/gdb/cli-out.h	2010/04/18 00:11:55	1.11
++++ src/gdb/cli-out.h	2010/09/03 15:42:02	1.12
+@@ -22,14 +22,19 @@
+ #define CLI_OUT_H
+ 
+ #include "ui-out.h"
++#include "vec.h"
++
++/* Used for cli_ui_out_data->streams.  */
++
++typedef struct ui_file *ui_filep;
++DEF_VEC_P (ui_filep);
+ 
+ /* These are exported so that they can be extended by other `ui_out'
+    implementations, like TUI's.  */
+ 
+ struct cli_ui_out_data
+   {
+-    struct ui_file *stream;
+-    struct ui_file *original_stream;
++    VEC (ui_filep) *streams;
+     int suppress_output;
+   };
+ 
+--- src/gdb/python/py-breakpoint.c	2010/07/01 10:36:12	1.4
++++ src/gdb/python/py-breakpoint.c	2010/09/03 15:42:03	1.5
+@@ -474,12 +474,12 @@
+   string_file = mem_fileopen ();
+   chain = make_cleanup_ui_file_delete (string_file);
+ 
++  ui_out_redirect (uiout, string_file);
+   TRY_CATCH (except, RETURN_MASK_ALL)
+     {
+-      ui_out_redirect (uiout, string_file);
+       print_command_lines (uiout, breakpoint_commands (bp), 0);
+-      ui_out_redirect (uiout, NULL);
+     }
++  ui_out_redirect (uiout, NULL);
+   cmdstr = ui_file_xstrdup (string_file, &length);
+   GDB_PY_HANDLE_EXCEPTION (except);
+ 
+### src/gdb/testsuite/ChangeLog	2010/09/02 15:19:56	1.2435
+### src/gdb/testsuite/ChangeLog	2010/09/03 15:42:04	1.2436
+## -1,3 +1,7 @@
++2010-09-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	* gdb.base/ui-redirect.exp: New file.
++
+ 2010-09-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
+             Joel Brobecker  <brobecker@adacore.com>
+ 
+--- src/gdb/testsuite/gdb.base/ui-redirect.exp
++++ src/gdb/testsuite/gdb.base/ui-redirect.exp	2010-09-11 18:42:40.040910000 +0000
+@@ -0,0 +1,41 @@
++# 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/>.
++
++if { [prepare_for_testing ui-redirect.exp ui-redirect start.c] } {
++    return -1
++}
++
++gdb_breakpoint main
++
++set test "commands"
++gdb_test_multiple $test $test {
++    -re "End with a line saying just \"end\"\\.\r\n>$" {
++	pass $test
++    }
++}
++
++set test "print 1"
++gdb_test_multiple $test $test {
++    -re "\r\n>$" {
++	pass $test
++    }
++}
++gdb_test_no_output "end"
++
++gdb_test_no_output "set logging file /dev/null"
++gdb_test "set logging on" "Copying output to /dev/null\\."
++gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\."
++gdb_test "set logging off" "Done logging to /dev/null\\."
++gdb_test "help" "List of classes of commands:.*"
+
+
+
+https://bugzilla.redhat.com/show_bug.cgi?id=627506
+Re: [patch] Fix uiout for execute_command_to_string
+http://sourceware.org/ml/gdb-patches/2010-09/msg00235.html
+http://sourceware.org/ml/gdb-cvs/2010-09/msg00080.html
+
+### src/gdb/ChangeLog	2010/09/10 16:17:11	1.12170
+### src/gdb/ChangeLog	2010/09/11 16:00:20	1.12171
+## -1,3 +1,21 @@
++2010-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
++	    Paul Bolle  <pebolle@tiscali.nl>
++
++	Redirect also uiout and stdtarg{,err} in execute_command_to_string.
++	* cli-logging.c (struct saved_output_files) <targerr>: New.
++	(set_logging_redirect, pop_output_files, handle_redirections):
++	Redirect also gdb_stdtargerr.
++	* defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New
++	declarations.
++	* event-top.c (gdb_setup_readline, gdb_disable_readline): Redirect
++	also gdb_stdtargerr.
++	* top.c (execute_command_to_string): Move make_cleanup_ui_file_delete
++	to the top.  Redirect also gdb_stdlog, gdb_stdtarg and gdb_stdtargerr.
++	Use ui_out_redirect, register make_cleanup_ui_out_redirect_pop.
++	* tui/tui-io.c (tui_setup_io): Redirect also gdb_stdtargerr.
++	* utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop):
++	New functions.
++
+
+### src/gdb/testsuite/ChangeLog	2010/09/10 20:29:25	1.2444
+### src/gdb/testsuite/ChangeLog	2010/09/11 16:00:26	1.2445
+## -1,3 +1,8 @@
++2010-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	* gdb.python/python.exp (set height 0, collect help from uiout)
++	(verify help to uiout): New tests.
++
+
+[ gdb_stdtargerr handling dropped.  ]
+
+--- src/gdb/defs.h	2010/08/31 18:08:43	1.278
++++ src/gdb/defs.h	2010/09/11 16:00:25	1.279
+@@ -337,6 +337,10 @@
+ struct ui_file;
+ extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *);
+ 
++struct ui_out;
++extern struct cleanup *
++  make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);
++
+ struct section_addr_info;
+ extern struct cleanup *(make_cleanup_free_section_addr_info 
+                         (struct section_addr_info *));
+--- src/gdb/top.c	2010/08/07 15:00:37	1.183
++++ src/gdb/top.c	2010/09/11 16:00:25	1.184
+@@ -475,12 +475,23 @@
+ 
+   str_file = mem_fileopen ();
+ 
++  make_cleanup_ui_file_delete (str_file);
+   make_cleanup_restore_ui_file (&gdb_stdout);
+   make_cleanup_restore_ui_file (&gdb_stderr);
+-  make_cleanup_ui_file_delete (str_file);
++  make_cleanup_restore_ui_file (&gdb_stdlog);
++  make_cleanup_restore_ui_file (&gdb_stdtarg);
++  make_cleanup_restore_ui_file (&gdb_stdtargerr);
++
++  if (ui_out_redirect (uiout, str_file) < 0)
++    warning (_("Current output protocol does not support redirection"));
++  else
++    make_cleanup_ui_out_redirect_pop (uiout);
+ 
+   gdb_stdout = str_file;
+   gdb_stderr = str_file;
++  gdb_stdlog = str_file;
++  gdb_stdtarg = str_file;
++  gdb_stdtargerr = str_file;
+ 
+   execute_command (p, from_tty);
+ 
+--- src/gdb/utils.c	2010/08/07 15:00:37	1.239
++++ src/gdb/utils.c	2010/09/11 16:00:25	1.240
+@@ -311,6 +311,26 @@
+   return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg);
+ }
+ 
++/* Helper function for make_cleanup_ui_out_redirect_pop.  */
++
++static void
++do_ui_out_redirect_pop (void *arg)
++{
++  struct ui_out *uiout = arg;
++
++  if (ui_out_redirect (uiout, NULL) < 0)
++    warning (_("Cannot restore redirection of the current output protocol"));
++}
++
++/* Return a new cleanup that pops the last redirection by ui_out_redirect
++   with NULL parameter.  */
++
++struct cleanup *
++make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
++{
++  return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout);
++}
++
+ static void
+ do_free_section_addr_info (void *arg)
+ {
+--- gdb-7.2/gdb/testsuite/gdb.python/python.exp-orig	2010-08-09 21:23:00.000000000 +0200
++++ gdb-7.2/gdb/testsuite/gdb.python/python.exp	2010-09-11 20:49:22.000000000 +0200
+@@ -110,3 +110,9 @@ gdb_test_multiple "python print \"\\n\" 
+     }
+ }
+ gdb_test "q" "Quit" "verify pagination afterwards: q"
++
++gdb_test_no_output "set height 0"
++
++gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect help from uiout"
++
++gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout"

diff --git a/gdb.spec b/gdb.spec
index 3604c32..a709120 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -3,6 +3,8 @@
 # --with debug: Build without optimizations and without splitting the debuginfo.
 # --with upstream: No Fedora specific patches get applied.
 # --without python: No python support.
+# --with profile: gcc -fprofile-generate / -fprofile-use: Before better
+#                 workload gets run it decreases the general performance now.
 
 # RHEL-5 was the last not providing `/etc/rpm/macros.dist'.
 %if 0%{!?dist:1}
@@ -12,17 +14,6 @@
 %endif
 # RHEL-5 Brew does not set %{el5}.
 %if "%{dist}" == ".el5"
-# RHEL-5 ppc* python .so files are shipped only as ppc but gdb is ppc64 there.
-# Brew builds it fine as its ppc64 buildroot has full ppc64 package set.
-# Make this conditional so that Brew-built GDB has no python on any arch but
-# GDB rebuilt on native non-ppc64 host does have it.
-%if 0%{!?el5:1}
-%define _without_python 1
-%else
-%ifarch ppc64
-%define _without_python 1
-%endif
-%endif
 %define el5 1
 %endif
 
@@ -32,11 +23,11 @@ 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.1.90.20100721
+Version: 7.2
 
 # 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: 6%{?_with_upstream:.upstream}%{dist}
+Release: 25%{?_with_upstream:.upstream}%{dist}
 
 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
@@ -72,354 +63,578 @@ Provides: pstack = 1.2-7.2.2.1
 %endif # 0%{!?_with_upstream:1}
 %endif # 0%{!?el5:1}
 
+# eu-strip: -g recognizes .gdb_index as a debugging section. (#631997)
+Conflicts: elfutils < 0.149
+
 # GDB patches have the format `gdb-<version>-bz<red-hat-bz-#>-<desc>.patch'.
 # They should be created using patch level 1: diff -up ./gdb (or gdb-6.3/gdb).
 
+#=
+#push=Should be pushed upstream.
+#maybepush=Should be pushed upstream unless it got obsoleted there.
+#fedora=Should stay as a Fedora patch.
+#ia64=Drop after RHEL-5 rebases and rebuilds are no longer meaningful.
+#fedoratest=Keep it in Fedora only as a regression test safety.
+#+ppc=Specific for ppc32/ppc64/ppc*
+#+work=Requires some nontrivial work.
+
 # Cleanup any leftover testsuite processes as it may stuck mock(1) builds.
+#=push
 Source2: gdb-orphanripper.c
 
 # Man page for gstack(1).
+#=push
 Source3: gdb-gstack.man
 
 # Work around out-of-date dejagnu that does not have KFAIL
+#=drop: That dejagnu is too old to be supported.
 Patch1: gdb-6.3-rh-dummykfail-20041202.patch
 
 # Match the Fedora's version info.
+#=fedora
 Patch2: gdb-6.3-rh-testversion-20041202.patch
 
 # Check that libunwind works - new test then fix
+#=ia64
 Patch3: gdb-6.3-rh-testlibunwind-20041202.patch
 
 # Use convert_from_func_ptr_addr on the solib breakpoint address;
 # simplifies and makes more consistent the logic.
+#=maybepush+ppc: Write new testcase.
 Patch104: gdb-6.3-ppcdotsolib-20041022.patch
 
 # Better parse 64-bit PPC system call prologues.
+#=maybepush+ppc: Write new testcase.
 Patch105: gdb-6.3-ppc64syscall-20040622.patch
 
 # Stop a backtrace when a zero PC is encountered.
+#=maybepush: Write new testcase.
 Patch106: gdb-6.3-framepczero-20040927.patch
 
 # Include the pc's section when doing a symbol lookup so that the
 # correct symbol is found.
+#=maybepush: Write new testcase.
 Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch
 
 # Fix upstream `set scheduler-locking step' vs. upstream PPC atomic seqs.
+#=maybepush+work: It is a bit difficult patch, a part is ppc specific.
 Patch112: gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
 # Make upstream `set scheduler-locking step' as default.
+#=maybepush+work: How much is scheduler-locking relevant after non-stop?
 Patch260: gdb-6.6-scheduler_locking-step-is-default.patch
 
 # Add a wrapper script to GDB that implements pstack using the
 # --readnever option.
+#=push+work: with gdbindex maybe --readnever should no longer be used.
 Patch118: gdb-6.3-gstack-20050411.patch
 
 # VSYSCALL and PIE
+#=fedoratest
 Patch122: gdb-6.3-test-pie-20050107.patch
+#=maybepush: May get obsoleted by Tom's unrelocated objfiles patch.
 Patch389: gdb-archer-pie-addons.patch
+#=push+work: Breakpoints disabling matching should not be based on address.
 Patch394: gdb-archer-pie-addons-keep-disabled.patch
 
 # Get selftest working with sep-debug-info
+#=maybepush
 Patch125: gdb-6.3-test-self-20050110.patch
 
 # Test support of multiple destructors just like multiple constructors
+#=fedoratest
 Patch133: gdb-6.3-test-dtorfix-20050121.patch
 
 # Fix to support executable moving
+#=fedoratest
 Patch136: gdb-6.3-test-movedir-20050125.patch
 
-# Fix to support unwinding syscalls in ia64 corefiles
-# Patch138: gdb-6.3-ia64-corefile-fix-20050127.patch
-
 # Fix gcore for threads
+#=ia64
 Patch140: gdb-6.3-gcore-thread-20050204.patch
 
 # Stop while intentionally stepping and the thread exit is met.
+#=push
 Patch141: gdb-6.6-step-thread-exit.patch
+#=push
 Patch259: gdb-6.3-step-thread-exit-20050211-test.patch
 
 # Prevent gdb from being pushed into background
+#=maybepush
 Patch142: gdb-6.3-terminal-fix-20050214.patch
 
 # Test sibling threads to set threaded watchpoints for x86 and x86-64
+#=fedoratest
 Patch145: gdb-6.3-threaded-watchpoints2-20050225.patch
 
 # Fix printing of inherited members
+#=maybepush
 Patch148: gdb-6.3-inheritance-20050324.patch
 
 # Do not issue warning message about first page of storage for ia64 gcore
+#=ia64
 Patch153: gdb-6.3-ia64-gcore-page0-20050421.patch
 
 # Security errata for untrusted .gdbinit
+#=push
 Patch157: gdb-6.3-security-errata-20050610.patch
 
 # IA64 sigtramp prev register patch
+#=ia64
 Patch158: gdb-6.3-ia64-sigtramp-frame-20050708.patch
 
 # IA64 gcore speed-up patch
+#=ia64
 Patch160: gdb-6.3-ia64-gcore-speedup-20050714.patch
 
 # Notify observers that the inferior has been created
+#=fedoratest
 Patch161: gdb-6.3-inferior-notification-20050721.patch
 
 # Fix ia64 info frame bug
+#=ia64
 Patch162: gdb-6.3-ia64-info-frame-fix-20050725.patch
 
 # Verify printing of inherited members test
+#=fedoratest
 Patch163: gdb-6.3-inheritancetest-20050726.patch
 
 # Add readnever option
+#=push
 Patch164: gdb-6.3-readnever-20050907.patch
 
 # Fix ia64 gdb problem with user-specified SIGILL handling
+#=ia64
 Patch169: gdb-6.3-ia64-sigill-20051115.patch
 
 # Allow option to continue backtracing past a zero pc value
+#=maybepush
 Patch170: gdb-6.3-bt-past-zero-20051201.patch
 
 # Use bigger numbers than int.
+#=push
 Patch176: gdb-6.3-large-core-20051206.patch
 
 # Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
+#=push+work: There was some mail thread about it, this patch may be a hack.
 Patch188: gdb-6.5-bz203661-emit-relocs.patch
 
 # Security patch: avoid stack overflows in dwarf expression computation.
 # CVE-2006-4146
+#=push
 Patch190: gdb-6.5-dwarf-stack-overflow.patch
 
 # Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
+#=push+work: It should be replaced by existing uncommitted Roland's glibc patch for TLS without libpthreads.
 Patch194: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
 
 # Fix TLS symbols resolving for shared libraries with a relative pathname.
 # The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
+#=fedoratest+work: One should recheck if it is really fixed upstream.
 Patch196: gdb-6.5-sharedlibrary-path.patch
 
 # Suggest fixing your target architecture for gdbserver(1) (BZ 190810).
 # FIXME: It could be autodetected.
+#=push+work: There are more such error cases that can happen.
 Patch199: gdb-6.5-bz190810-gdbserver-arch-advice.patch
 
 # Testcase for deadlocking on last address space byte; for corrupted backtraces.
+#=fedoratest
 Patch211: gdb-6.5-last-address-space-byte-test.patch
 
 # Improved testsuite results by the testsuite provided by the courtesy of BEA.
+#=fedoratest+work: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
 Patch208: gdb-6.5-BEA-testsuite.patch
 
 # Fix readline segfault on excessively long hand-typed lines.
+#=drop: After upstream's readline rebase it will be obsolete.
 Patch209: gdb-6.5-readline-long-line-crash.patch
+#=fedoratest
 Patch213: gdb-6.5-readline-long-line-crash-test.patch
 
 # Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
+#=fedoratest
 Patch214: gdb-6.5-bz216711-clone-is-outermost.patch
 
 # Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
+#=fedoratest
 Patch216: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
 
 # Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
+#=push
 Patch217: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
 
 # Find symbols properly at their original (included) file (BZ 109921).
+#=fedoratest
 Patch225: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
 
 # Update PPC unwinding patches to their upstream variants (BZ 140532).
+#=fedoratest+ppc
 Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch
 
 # Testcase for exec() from threaded program (BZ 202689).
+#=fedoratest
 Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
 
 # Backported fixups post the source tarball.
-#Patch232: gdb-upstream.patch
+#=drop: Just backports.
+Patch232: gdb-upstream.patch
 
 # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
+#=fedoratest+ppc
 Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
 
 # Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832)
+#=push+work: Upstream should have backward compat. API: libc-alpha: <20070127104539.GA9444@.*>
 Patch235: gdb-6.3-bz231832-obstack-2gb.patch
 
 # Fix debugging GDB itself - the compiled in source files paths (BZ 225783).
+#=push
 Patch241: gdb-6.6-bz225783-gdb-debuginfo-paths.patch
 
 # Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
+#=fedoratest: Drop the obsoleted gdb_gcore.sh change.
 Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch
 
 # Notify user of a child forked process being detached (BZ 235197).
+#=push: This is more about discussion if/what should be printed.
 Patch247: gdb-6.6-bz235197-fork-detach-info.patch
 
 # Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
+#=push
 Patch254: gdb-6.6-testsuite-timeouts.patch
 
 # Support for stepping over PPC atomic instruction sequences (BZ 237572).
+#=fedoratest
 Patch258: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
 
 # Link with libreadline provided by the operating system.
+#=push
 Patch261: gdb-6.6-readline-system.patch
 
 # Test kernel VDSO decoding while attaching to an i386 process.
+#=fedoratest
 Patch263: gdb-6.3-attach-see-vdso-test.patch
 
 # Do not hang on exit of a thread group leader (BZ 247354).
+#=push
 Patch265: gdb-6.6-bz247354-leader-exit-fix.patch
+#=push
 Patch266: gdb-6.6-bz247354-leader-exit-test.patch
 
 # Test leftover zombie process (BZ 243845).
+#=fedoratest
 Patch271: gdb-6.5-bz243845-stale-testing-zombie-test.patch
 
 # New locating of the matching binaries from the pure core file (build-id).
+#=push
 Patch274: gdb-6.6-buildid-locate.patch
+#=push
 Patch353: gdb-6.6-buildid-locate-rpm.patch
+#=push
 Patch415: gdb-6.6-buildid-locate-core-as-arg.patch
+# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
+#=push
+Patch519: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
 
 # Fix displaying of numeric char arrays as strings (BZ 224128).
+#=fedoratest: But it is failing anyway, one should check the behavior more.
 Patch282: gdb-6.7-charsign-test.patch
 
 # Test PPC hiding of call-volatile parameter register.
+#=fedoratest+ppc
 Patch284: gdb-6.7-ppc-clobbered-registers-O2-test.patch
 
 # Testsuite fixes for more stable/comparable results.
+#=push
 Patch287: gdb-6.7-testsuite-stable-results.patch
 
 # Test ia64 memory leaks of the code using libunwind.
+#=fedoratest
 Patch289: gdb-6.5-ia64-libunwind-leak-test.patch
 
 # Test hiding unexpected breakpoints on intentional step commands.
+#=fedoratest
 Patch290: gdb-6.5-missed-trap-on-step-test.patch
 
 # Support DW_TAG_interface_type the same way as DW_TAG_class_type (BZ 426600).
+#=maybepush
 Patch293: gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch
+#=fedoratest
 Patch294: gdb-6.7-bz426600-DW_TAG_interface_type-test.patch
 
 # Test gcore memory and time requirements for large inferiors.
+#=fedoratest
 Patch296: gdb-6.5-gcore-buffer-limit-test.patch
 
 # Test debugging statically linked threaded inferiors (BZ 239652).
 #  - It requires recent glibc to work in this case properly.
+#=fedoratest
 Patch298: gdb-6.6-threads-static-test.patch
 
 # Fix #include <asm/ptrace.h> on kernel-headers-2.6.25-0.40.rc1.git2.fc9.x86_64.
+#=push
 Patch304: gdb-6.7-kernel-headers-compat.patch
 
 # Test GCORE for shmid 0 shared memory mappings.
+#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
 Patch309: gdb-6.3-mapping-zero-inode-test.patch
 
 # Test a crash on `focus cmd', `focus prev' commands.
+#=fedoratest
 Patch311: gdb-6.3-focus-cmd-prev-test.patch
 
 # Test various forms of threads tracking across exec() (BZ 442765).
+#=fedoratest
 Patch315: gdb-6.8-bz442765-threaded-exec-test.patch
 
 # Silence memcpy check which returns false positive (sparc64)
+#=push: But it is just a GCC workaround, look up the existing GCC PR for it.
 Patch317: gdb-6.8-sparc64-silence-memcpy-check.patch
 
 # Fix memory trashing on binaries from GCC Ada (workaround GCC PR 35998).
+#=push
 Patch318: gdb-6.8-gcc35998-ada-memory-trash.patch
 
 # Test a crash on libraries missing the .text section.
+#=fedoratest
 Patch320: gdb-6.5-section-num-fixup-test.patch
 
 # Fix compatibility with recent glibc headers.
+#=push
 Patch324: gdb-6.8-glibc-headers-compat.patch
 
 # Create a single binary `gdb' autodetecting --tui by its argv[0].
+#=push+work: IIRC Tom told argv[0] should not be used by GNU programs, also drop libgdb.a.
 Patch326: gdb-6.8-tui-singlebinary.patch
 
 # Fix PRPSINFO in the core files dumped by gcore (BZ 254229).
+#=push
 Patch329: gdb-6.8-bz254229-gcore-prpsinfo.patch
 
 # Fix register assignments with no GDB stack frames (BZ 436037).
+#=push+work: This fix is incorrect.
 Patch330: gdb-6.8-bz436037-reg-no-longer-active.patch
 
 # Make the GDB quit processing non-abortable to cleanup everything properly.
+#=push: Useful only after gdb-6.8-attach-signalled-detach-stopped.patch .
 Patch331: gdb-6.8-quit-never-aborts.patch
 
 # Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs.
+#=push
 Patch332: gdb-6.8-fortran-tag-constant.patch
 
 # Fix attaching to stopped processes and/or pending signals.
+#=push+work
 Patch337: gdb-6.8-attach-signalled-detach-stopped.patch
 
 # Test the watchpoints conditionals works.
+#=fedoratest
 Patch343: gdb-6.8-watchpoint-conditionals-test.patch
 
 # Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
+#=fedoratest
 Patch348: gdb-6.8-bz466901-backtrace-full-prelinked.patch
 
 # The merged branch `archer' of: http://sourceware.org/gdb/wiki/ProjectArcher
+#=push
+#archer-jankratochvil-vla
+#=push
+#archer-jankratochvil-watchpoint3
+#=push
+#archer-jankratochvil-ifunc
+#=push
+#archer-pmuldoon-next-over-throw2
+#=maybepush
+#archer-tromey-python
+#=maybepush
+#archer-tromey-optional-psymtab
 Patch349: gdb-archer.patch
+#=maybepush
 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.
+#=fedoratest
 Patch360: gdb-6.8-bz457187-largefile-test.patch
 
 # New test for step-resume breakpoint placed in multiple threads at once.
+#=fedoratest
 Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch
 
 # Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
+#=push+work: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*>
 Patch382: gdb-core-open-vdso-warning.patch
 
 # Fix syscall restarts for amd64->i386 biarch.
+#=push
 Patch391: gdb-x86_64-i386-syscall-restart.patch
 
 # Fix stepping with OMP parallel Fortran sections (BZ 533176).
+#=push+work: It requires some better DWARF annotations.
 Patch392: gdb-bz533176-fortran-omp-step.patch
 
 # Use gfortran44 when running the testsuite on RHEL-5.
+#=fedoratest
 Patch393: gdb-rhel5-gcc44.patch
 
 # Disable warning messages new for gdb-6.8+ for RHEL-5 backward compatibility.
 # Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595).
+#=fedoratest
 Patch335: gdb-rhel5-compat.patch
 
 # Fix regression by python on ia64 due to stale current frame.
+#=push
 Patch397: gdb-follow-child-stale-parent.patch
 
 # Workaround ccache making lineno non-zero for command-line definitions.
+#=drop: ccache is rarely used and it is even fixed now.
 Patch403: gdb-ccache-workaround.patch
 
 # Implement `info common' for Fortran.
+#=push
 Patch404: gdb-fortran-common-reduce.patch
+#=push
 Patch405: gdb-fortran-common.patch
 
 # Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
+#=fedoratest
 Patch407: gdb-lineno-makeup-test.patch
 
 # Test power7 ppc disassembly.
+#=fedoratest+ppc
 Patch408: gdb-ppc-power7-test.patch
 
 # Revert: Add -Wunused-function to compile flags.
+#=drop
 Patch412: gdb-unused-revert.patch
 
 # Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
+#=push+work: It should be fixed properly instead.
 Patch417: gdb-bz541866-rwatch-before-run.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.
+#=maybepush: Not sure if all the parts are upstream.
 Patch451: gdb-bz575292-delayed-physname.patch
 
 # Fix crash when using GNU IFUNC call from breakpoint condition.
+#=drop: After archer-jankratochvil-ifunc gets in this one gets obsoleted.
 Patch454: gdb-bz539590-gnu-ifunc-fix-cond.patch
 
 # Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623).
+#=push+work: Currently it is still not fully safe.
 Patch459: gdb-moribund-utrace-workaround.patch
 
 # Remove core file when starting a process (BZ 594560).
+#=maybepush
 Patch461: gdb-bz594560-core-vs-process.patch
 
 # Fix follow-exec for C++ programs (bugreported by Martin Stransky).
+#=fedoratest
 Patch470: gdb-archer-next-over-throw-cxx-exec.patch
 
 # Backport DWARF-4 support (BZ 601887, Tom Tromey).
+#=fedoratest
 Patch475: gdb-bz601887-dwarf4-rh-test.patch
 
 # Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller).
+#=push+work: There are some outstanding issues, check the mails.
 Patch486: gdb-bz562763-pretty-print-2d-vectors.patch
+#=push+work: There are some outstanding issues, check the mails.
 Patch487: gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
 
 # Fix prelinked executables with sepdebug and copy relocations (BZ 614659).
+#=drop: Upstreamed.
 Patch489: gdb-bz614659-prelink-dynbss.patch
 
 # Provide /usr/bin/gdb-add-index for rpm-build (Tom Tromey).
+#=drop: Re-check against the upstream version.
 Patch491: gdb-gdb-add-index-script.patch
 
+# Fix gcore from very small terminal windows (BZ 555076).
+#=drop: Upstreamed.
+Patch493: gdb-bz555076-gcore-small-height.patch
+
+# Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248).
+#=drop+work: Inferior objects should be read in parts, then this patch gets obsoleted.
+Patch496: gdb-bz568248-oom-is-error.patch
+
+# Workaround false GCC warning(s).
+#=push
+Patch497: gdb-false-gcc-warning.patch
+
+# Do not crash on broken separate debuginfo due to old elfutils (BZ 631575).
+#=drop: Upstreamed.
+Patch499: gdb-bz631575-gdb-index-nobits.patch
+
+# Fix symbol lookup misses methods of current class (BZ 631158, Sami Wagiaalla).
+#=maybepush
+Patch500: gdb-bz631158-cxx-this-lookup.patch
+
+# Fix Ada regression when any .gdb_index library is present.
+#=drop: Upstreamed.
+Patch501: gdb-gdbindex-ada-regression.patch
+
+# python: load *-gdb.py for shlibs during attach (BZ 634660).
+#=drop: Upstreamed.
+Patch502: gdb-bz634660-gdbpy-load-on-attach.patch
+
+# Fix double free crash during overload resolution (PR 12028, Sami Wagiaalla).
+#=drop: Upstreamed.
+Patch503: gdb-pr12028-double-free.patch
+
+# Fix gcore writer for -Wl,-z,relro (PR corefiles/11804).
+#=push: There is different patch on gdb-patches, waiting now for resolution in kernel.
+Patch504: gdb-bz623749-gcore-relro.patch
+
+# Fix infinite loop crash on self-referencing class (BZ 627432).
+#=drop: Upstreamed.
+Patch506: gdb-bz627432-loop-static-self-class.patch
+
+# Fix lost siginfo_t in linux-nat (BZ 592031).
+#=drop: Upstreamed.
+Patch507: gdb-bz592031-siginfo-lost-1of5.patch
+#=drop: Upstreamed.
+Patch508: gdb-bz592031-siginfo-lost-2of5.patch
+#=drop: Upstreamed.
+Patch509: gdb-bz592031-siginfo-lost-3of5.patch
+#=push
+Patch510: gdb-bz592031-siginfo-lost-4of5.patch
+#=push
+Patch511: gdb-bz592031-siginfo-lost-5of5.patch
+
+# Fix .gdb_index for big-endian hosts (Tom Tromey).
+#=drop: Upstreamed.
+Patch514: gdb-gdbindex-v1-to-v2.patch
+#=drop: Upstreamed.
+Patch512: gdb-gdbindex-bigendian.patch
+#=drop: Upstreamed.
+Patch515: gdb-gdbindex-v2-to-v3.patch
+
+# [ifunc] Fix crash on deleting watchpoint of an autovariable (BZ 637770).
+#=drop: A part of archer-jankratochvil-ifunc work.
+Patch513: gdb-bz637770-ifunc-watchpoint-delete.patch
+
+# Fix python stale error state, also fix its save/restore (BZ 639089).
+#=drop: Just a backport.
+Patch518: gdb-testsuite-lib-python.patch
+#=drop: Upstreamed.
+Patch516: gdb-python-error-state.patch
+
+# Fix inferior exec of new PIE x86_64 (BZ 638979).
+#=drop: Upstreamed.
+Patch517: gdb-exec-pie-amd64.patch
+
+# Fix crash on CTRL-C while reading an ELF symbol file (BZ 642879).
+#=push
+Patch520: gdb-bz642879-elfread-sigint-stale.patch
+
+# iFort compat. - case insensitive DWARF not in lowercase (BZ 645773).
+Patch522: gdb-bz645773-ifort-case-1of3.patch
+Patch523: gdb-bz645773-ifort-case-2of3.patch
+Patch524: gdb-bz645773-ifort-case-3of3.patch
+
 BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
 Requires: readline%{?_isa}
 BuildRequires: readline-devel%{?_isa}
@@ -434,13 +649,11 @@ BuildRequires: zlib-devel%{?_isa}
 %if 0%{!?el5:1}
 Requires: python-libs%{?_isa}
 %else
-Requires: python%{?_isa}
+# This RHEL-5.6 python version got split out python-libs for ppc64.
+# RHEL-5 rpm does not support .%{_arch} dependencies.
+Requires: python-libs-%{_arch} >= 2.4.3-32.el5
 %endif
 BuildRequires: python-devel%{?_isa}
-# Temporarily before python files get moved to libstdc++.rpm
-# libstdc++%{bits_other} is not present in Koji, the .spec script generating
-# gdb/python/libstdcxx/ also does not depend on the %{bits_other} files.
-BuildRequires: libstdc++%{?_isa}
 %endif # 0%{!?_without_python:1}
 
 %if 0%{?_with_testsuite:1}
@@ -556,7 +769,7 @@ 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
 %patch420 -p1
 %patch1 -p1
@@ -669,8 +882,35 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 # This patch should be applied to gcc-4.5+.src.rpm:
 #patch487 -p1
 %patch415 -p1
+%patch519 -p1
 %patch489 -p1
 %patch491 -p1
+%patch493 -p1
+%patch496 -p1
+%patch497 -p1
+%patch499 -p1
+%patch500 -p1
+%patch501 -p1
+%patch502 -p1
+%patch503 -p1
+%patch504 -p1
+%patch506 -p1
+%patch507 -p1
+%patch508 -p1
+%patch509 -p1
+%patch510 -p1
+%patch511 -p1
+%patch514 -p1
+%patch512 -p1
+%patch515 -p1
+%patch513 -p1
+%patch516 -p1
+%patch517 -p1
+%patch518 -p1
+%patch520 -p1
+%patch522 -p1
+%patch523 -p1
+%patch524 -p1
 
 %patch393 -p1
 %patch335 -p1
@@ -707,9 +947,11 @@ rm -f gdb/doc/*.info-*
 # built.
 # Initially we're in the %{gdb_src} directory.
 
-rm -fr %{gdb_build}
-mkdir %{gdb_build}
-cd %{gdb_build}
+for fprofile in %{?_with_profile:-fprofile} ""
+do
+
+mkdir %{gdb_build}$fprofile
+cd %{gdb_build}$fprofile
 
 # g77 executable is no longer present in Fedora gcc-4.x+.
 g77="`which gfortran 2>/dev/null || true`"
@@ -776,7 +1018,56 @@ $(: RHEL-5 librpm has incompatible API. )			\
 	%{_target_platform}
 %endif
 
-make %{?_smp_mflags}
+if [ -z "%{!?_with_profile:no}" ]
+then
+  # Run all the configure tests being incompatible with $FPROFILE_CFLAGS.
+  make %{?_smp_mflags} configure-host configure-target
+  make %{?_smp_mflags} clean
+
+  # Workaround -fprofile-use:
+  # linux-x86-low.c:2225: Error: symbol `start_i386_goto' is already defined
+  make %{?_smp_mflags} -C gdb/gdbserver linux-x86-low.o
+fi
+
+# Global CFLAGS would fail on:
+# conftest.c:1:1: error: coverage mismatch for function 'main' while reading counter 'arcs'
+if [ "$fprofile" = "-fprofile" ]
+then
+  FPROFILE_CFLAGS='-fprofile-generate'
+elif [ -z "%{!?_with_profile:no}" ]
+then
+  FPROFILE_CFLAGS='-fprofile-use'
+  # We cannot use -fprofile-dir as the bare filenames clash.
+  (cd ../%{gdb_build}-fprofile;
+   # It was 333 on x86_64.
+   test $(find -name "*.gcda"|wc -l) -gt 300
+   find -name "*.gcda" | while read -r i
+   do
+     ln $i ../%{gdb_build}/$i
+   done
+  )
+else
+  FPROFILE_CFLAGS=""
+fi
+
+make %{?_smp_mflags} CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$FPROFILE_CFLAGS"
+
+if [ "$fprofile" = "-fprofile" ]
+then
+  cd gdb
+  cp -p gdb gdb-withindex
+  PATH="$PWD:$PATH" sh ../../gdb/gdb-add-index $PWD/gdb-withindex
+  ./gdb -nx -ex q ./gdb-withindex
+  ./gdb -nx -readnow -ex q ./gdb-withindex
+  cd ..
+fi
+
+cd ..
+
+done	# fprofile
+
+cd %{gdb_build}
+
 make %{?_smp_mflags} info
 
 grep '#define HAVE_ZLIB_H 1' gdb/config.h
@@ -890,22 +1181,11 @@ ln -sf gdb $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui
 cmp $RPM_BUILD_ROOT%{_mandir}/*/gdb.1 $RPM_BUILD_ROOT%{_mandir}/*/gdbtui.1
 ln -sf gdb.1 $RPM_BUILD_ROOT%{_mandir}/*/gdbtui.1
 
-# Disabled now for F-14 before rebase.
-#%if 0%{!?_without_python:1}
-## Temporarily now:
-#for LIB in lib lib64;do
-#  LIBPATH="$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_prefix}/$LIB"
-#  mkdir -p $LIBPATH
-#  # basename is being run only for the native (non-biarch) file.
-#  sed -e 's,@pythondir@,%{_datadir}/gdb/python,'		\
-#      -e 's,@toolexeclibdir@,%{_prefix}/'"$LIB,"		\
-#      < $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/hook.in	\
-#      > $LIBPATH/$(basename %{_prefix}/%{_lib}/libstdc++.so.6.*)-gdb.py
-#done
-#test ! -e $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx
-#cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/libstdcxx	\
-#      $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx
-#%endif # 0%{!?_without_python:1}
+for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"`
+do
+  # Files could be also patched getting the current time.
+  touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i
+done
 
 # Remove the files that are part of a gdb build but that are owned and
 # provided by other packages.
@@ -995,10 +1275,114 @@ fi
 %endif
 %{_bindir}/gdbserver
 %{_mandir}/*/gdbserver.1*
+%ifnarch s390 s390x %{sparc}
 %{_libdir}/libinproctrace.so
 %endif
+%endif
 
 %changelog
+* Sun Nov  7 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-25.fc14
+- iFort compat. - case insensitive DWARF not in lowercase (BZ 645773).
+
+* Thu Oct 14 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-24.fc14
+- Add gdb.spec comments on the *.patch files upstream merge status.
+
+* Thu Oct 14 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-23.fc14
+- Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
+- Fix crash on CTRL-C while reading an ELF symbol file (BZ 642879).
+
+* Tue Oct 12 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-22.fc14
+- testsuite: Provide missing lib/gdb-python.exp (for BZ 639089).
+
+* Tue Oct 12 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-21.fc14
+- Fix python stale error state, also fix its save/restore (BZ 639089).
+- Fix inferior exec of new PIE x86_64 (BZ 638979).
+
+* Tue Oct 12 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-20.fc14
+- Fixup Release for 20.fc14.
+
+* Tue Oct 12 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-19.fc14
+- Use .gdb_index v3 to fix excessive resources rqmnts (BZ 640634, Tom Tromey).
+
+* Wed Oct  6 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-18.fc14
+- Fix false warning: non-absolute filename: <the main exec. file> (BZ 640648).
+
+* Thu Sep 30 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-17.fc14
+- New Conflicts: elfutils < 0.149 due to the .gdb_index .debug support.
+
+* Wed Sep 29 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-16.fc14
+- [ifunc] Fix crash on deleting watchpoint of an autovariable (BZ 637770).
+
+* Mon Sep 27 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-15.fc14
+- Revert the -O0 switch formerly to workaround GCC BZ 634757 (cmove bug).
+- Remove no longer used BuildRequires: libstdc++.
+- Remove commented out python libstdc++ .spec code.
+
+* Sat Sep 25 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-14.fc14
+- Fixup %{_datadir}/gdb/python/gdb timestamps for multilib conflicts.
+
+* Sat Sep 25 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-13.fc14
+- Fix .gdb_index for big-endian hosts (Tom Tromey).
+
+* Sat Sep 25 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-12.fc14
+- Fix lost siginfo_t in linux-nat (BZ 592031).
+
+* Sat Sep 25 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-11.fc14
+- Fix infinite loop crash on self-referencing class (BZ 627432).
+
+* Thu Sep 23 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-10.fc14
+- gcore/-Wl,-z,relro: Always write out all the pages until kernel gets a fix.
+
+* Wed Sep 22 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-9.fc14
+- Fix gcore writer for -Wl,-z,relro (PR corefiles/11804).
+
+* Wed Sep 22 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-8.fc14
+- Enable python by default even in Brew and on all the arches (BZ 609157).
+
+* Wed Sep 22 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-7.fc14
+- python: load *-gdb.py for shlibs during attach (BZ 634660).
+- Fix double free crash during overload resolution (PR 12028, Sami Wagiaalla).
+
+* Sat Sep 18 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-6.fc14
+- Fix python gdb.solib_address (BZ 634108, fix by Phil Muldoon).
+- Temporarily build with -O0 to workaround GCC BZ 634757 (cmove bug).
+
+* Tue Sep 14 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-5.fc14
+- Fix Ada regression when any .gdb_index library is present.
+
+* Sat Sep 11 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-4.fc14
+- Fix symbol lookup misses methods of current class (BZ 631158, Sami Wagiaalla).
+- Fix python gdb.execute-to_string redirection (BZ 627506, with Paul Bolle).
+
+* Wed Sep  8 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-3.fc14
+- Do not crash on broken separate debuginfo due to old elfutils (BZ 631575).
+
+* Sat Sep 04 2010 Dennis Gilmore <dennis@ausil.us> - 7.2-2.fc14
+- libinproctrace doesnt exist on sparc arches
+
+* Fri Sep  3 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-1.fc14
+- Formal update to the final FSF GDB release.
+
+* Tue Aug 24 2010 Dan Horák <dan[at]danny.cz> - 7.1.90.20100806-12.fc14
+- libinproctrace doesn't exist on s390(x)
+
+* Thu Aug 19 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1.90.20100806-11.fc14
+- Fix crash on MI variable calling inferior function (BZ 610986).
+
+* Tue Aug 10 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1.90.20100806-10.fc14
+- Fix /usr/bin/gdb-add-index missing -nx for gdb.
+- New option --with profile (disabled by default - missing workload, BZ 615603).
+
+* Sat Aug  7 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1.90.20100806-9.fc14
+- Fix python gdb.execute to_string pagination (BZ 620930).
+
+* Fri Aug  6 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1.90.20100806-8.fc14
+- Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248).
+
+* Fri Aug  6 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.1.90.20100806-7.fc14
+- Fix gcore from very small terminal windows (BZ 555076).
+- Fix false `filesystem' debuginfo rpm request (BZ 599598).
+
 * Wed Jul 28 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 7.1.90.20100721-6.fc14
 - Rebuild against python 2.7
 

diff --git a/gdb2fail.sh b/gdb2fail.sh
deleted file mode 100755
index 939c1e7..0000000
--- a/gdb2fail.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-if test "$#" -eq 0
-then
-    echo >&2 "Usage: $0 [ /mnt/brew/packages/gdb/VERSION/DIST/data/logs/ARCH/build.log ]"
-    echo >&2 "       [ /mnt/brew/scratch/USERNAME/task_TASKID/logs/ARCH/build.log ]"
-    echo >&2 "       [ /mnt/brew/work/tasks/TASKID/build.log ] ..."
-    exit 1
-fi
-
-if [ -d tests ];then
-	if [ ! -f tests/.v2 ];then
-		echo >&2 "Directory will be deleted!: tests"
-		exit 1
-	fi
-	rm -rf tests
-fi
-mkdir tests
-touch tests/.v2	# Marker for this temporary directory type
-
-find "$@" -path '*/build.log' -print | while read f
-do
-    echo "$f" >&2
-    ver=`echo "$f" | sed -n -e 's,^.*gdb/\([-0-9\.]*\)/\([^/]*\)/data/logs/\([^/]*\)/.*$,-\1,p'`
-    rel=`echo "$f" | sed -n -e 's,^.*gdb/\([-0-9\.]*\)/\([^/]*\)/data/logs/\([^/]*\)/.*$,-\2,p'`
-    isa=`echo "$f" | sed -n -e 's,^.*gdb/\([-0-9\.]*\)/\([^/]*\)/data/logs/\([^/]*\)/.*$,.\3,p'`
-    if test -z "$ver" ; then
-    ver=`echo "$f" | sed -n -e 's,^.*/scratch/.*/task_\([0-9]*\)/logs/\([^/]*\)/.*$,-\1,p'`
-    fi
-    if test -z "$ver" ; then
-    ver=`echo "$f" | sed -n -e 's,^.*/build-\([0-9]*\)/.*$,-\1,p'`
-    fi
-    if test -z "$isa" ; then
-    isa=`echo "$f" | sed -n -e 's,^.*/scratch/.*/task_\([0-9]*\)/logs/\([^/]*\)/.*$,-\2,p'`
-    fi
-    if test -z "$ver" ; then
-    ver=`echo "$f" | sed -n -e 's,^.*/work/tasks/\([0-9]*\)/.*$,-\1,p'`
-    fi
-    # begin 644 gdb-i386-redhat-linux-gnu.tar.bz2
-    for t in sum log ; do
-	if test -z "$isa" ; then
-		isa=`uudecode < "$f" -o /dev/stdout | bunzip2 \
-		| tar -t -f - "gdb-*-redhat-linux-gnu.$t" 2>&1 \
-		| sed -n 's/^gdb-\(.*\)-redhat-linux-gnu[.].*$/-\1/p' \
-		`
-	fi
-	line="gdb${ver}${rel}${isa}"
-	uudecode < "$f" -o /dev/stdout | bunzip2 \
-	    | tar -xpvvO -f - "gdb-*-redhat-linux-gnu.$t" \
-	    > "tests/$line.$t"
-    done
-done
-
-( cd tests && /home/cygnus/cagney/bin/do-analize-tests *.sum )
-
-echo "$PWD/tests/*.html"
-ls -1 tests/*.html 1>&2

diff --git a/gdb2patch.sh b/gdb2patch.sh
deleted file mode 100755
index af888e3..0000000
--- a/gdb2patch.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-# Generate a patch that brings the most recent snapshot up-to-date
-
-#branch=HEAD
-date='-D 2004-06-07-gmt'
-dir=`echo "cvs${branch}${date}" | tr ' ' '-'`
-patch=gdb-`sed -n -e 's/^Version:[	 ]*\(.*\)$/\1/p' gdb.spec`
-
-if test ! -d ${dir}/src
-then
-  ( mkdir -p ${dir} && cd ${dir} && cvs \
-	-d :pserver:anoncvs@sources.redhat.com:/cvs/src \
-	checkout ${branch} ${date} gdb )
-fi
-
-( cd ${dir}/src && cvs diff -Nu -r BASE -D `date -u +"%Y-%m-%d-gmt"` ./gdb ) | sed -e '
-/^Index: .*\/version\.in$/,/^Index/ d
-/^Index:/d
-/^====/d
-/^RCS/d
-/^retrieving/d
-/^diff/d
-/^--- /N
-/^---.* \/dev\/null/ {
-  p
-  d
-}
-/^--- \.\// {
-  s/^--- \([-a-zA-Z\/\.0-9\+]*\)/--- \1.1/
-  p
-  d
-}
-' | tee $patch-sync-`date -u +%Y%m%d`
-
-exit
-
-# s/^--- \([-a-zA-Z\/\.0-9\+]*\)/--- \1.1/
-# s/^[\+][\+][\+] \([-a-zA-Z\/\.0-9\+]*\)/+++ \1/
-

diff --git a/gdbcompare b/gdbcompare
deleted file mode 100755
index aba4493..0000000
--- a/gdbcompare
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /usr/bin/perl
-# $Id: gdbcompare,v 1.5 2008/03/01 08:01:57 jkratoch Exp $
-
-
-use strict;
-use warnings;
-use Data::Dumper;
-
-my $reverse=shift @ARGV if ($ARGV[0]||"") eq "-r";
-my $suffix=shift @ARGV if ($ARGV[0]||"")=~/^(?:sum|log)$/;
-$suffix||="sum";
-
-local *DIR;
-opendir DIR,"tests" or die "opendir: $!";
-my %arch;
-for my $name (sort readdir(DIR)) {
-	# next if $name!~/^gdb-.*[-.]([^-.]+)[.]$suffix$/o;
-	next if $name!~/^\d+-(.*)[.]$suffix$/o;
-	push @{$arch{$1}},$name;
-}
-closedir DIR or die "closedir: $!";
-
-for (values(%arch)) {
-	next if 2==@$_;
-	warn "Single element: ".${$_}[0]."\n" if 1==@$_;
-	die "Not 2 elements:\n".Dumper($_) if 1!=@$_;
-}
-
-system("rm -f tests/gdbcompare-*.diff") and die;
-
-for my $arch (sort keys(%arch)) {
-	next if 2!=@{$arch{$arch}};
-	# sub trans { return {"."=>0,"-"=>1}->{($_[0]=~/([-.])[^-.]+[.]\w+$/)[0]}.$_[0]; };
-	sub trans { return $_[0]; };
-	my @sorted=sort { my $a1=trans $a; my $b1=trans $b; ($b1 cmp $a1) * ($reverse ? -1 : +1); } @{$arch{$arch}};
-	do { system $_ and die $_; } for "diff -u tests/'".$sorted[1]."' tests/'".$sorted[0]."' >tests/gdbcompare-'$arch'.'$suffix'.diff;true";
-}
-
-system("vim tests/gdbcompare-*.'$suffix'.diff");
-
-__END__;
-
--rw-rw-r--  1 jkratoch jkratoch 2820599 Dec 11 16:23 gdb-450894-i386.log
--rw-rw-r--  1 jkratoch jkratoch  661657 Dec 11 16:23 gdb-450894-i386.sum
--rw-rw-r--  1 jkratoch jkratoch 3238088 Dec 11 16:23 gdb-450894-ia64.log
--rw-rw-r--  1 jkratoch jkratoch  662796 Dec 11 16:23 gdb-450894-ia64.sum
--rw-rw-r--  1 jkratoch jkratoch 2959339 Dec 11 16:23 gdb-450894-ppc.log
--rw-rw-r--  1 jkratoch jkratoch  678114 Dec 11 16:23 gdb-450894-ppc.sum
--rw-rw-r--  1 jkratoch jkratoch 2932760 Dec 11 16:23 gdb-450894-ppc64.log
--rw-rw-r--  1 jkratoch jkratoch  674048 Dec 11 16:23 gdb-450894-ppc64.sum
--rw-rw-r--  1 jkratoch jkratoch 2855270 Dec 11 16:23 gdb-450894-s390.log
--rw-rw-r--  1 jkratoch jkratoch  666079 Dec 11 16:23 gdb-450894-s390.sum
--rw-rw-r--  1 jkratoch jkratoch 2883027 Dec 11 16:23 gdb-450894-s390x.log
--rw-rw-r--  1 jkratoch jkratoch  668279 Dec 11 16:23 gdb-450894-s390x.sum
--rw-rw-r--  1 jkratoch jkratoch 2911138 Dec 11 16:23 gdb-450894-x86_64.log
--rw-rw-r--  1 jkratoch jkratoch  666999 Dec 11 16:23 gdb-450894-x86_64.sum
--rw-rw-r--  1 jkratoch jkratoch 2882257 Dec 11 16:23 gdb-6.5-13.fc6.i386.log
--rw-rw-r--  1 jkratoch jkratoch  667929 Dec 11 16:23 gdb-6.5-13.fc6.i386.sum
--rw-rw-r--  1 jkratoch jkratoch 3311427 Dec 11 16:23 gdb-6.5-13.fc6.ia64.log
--rw-rw-r--  1 jkratoch jkratoch  669221 Dec 11 16:23 gdb-6.5-13.fc6.ia64.sum
--rw-rw-r--  1 jkratoch jkratoch 3025126 Dec 11 16:23 gdb-6.5-13.fc6.ppc.log
--rw-rw-r--  1 jkratoch jkratoch  684577 Dec 11 16:23 gdb-6.5-13.fc6.ppc.sum
--rw-rw-r--  1 jkratoch jkratoch 3267611 Dec 11 16:23 gdb-6.5-13.fc6.ppc64.log
--rw-rw-r--  1 jkratoch jkratoch  682348 Dec 11 16:23 gdb-6.5-13.fc6.ppc64.sum
--rw-rw-r--  1 jkratoch jkratoch 2912963 Dec 11 16:23 gdb-6.5-13.fc6.s390.log
--rw-rw-r--  1 jkratoch jkratoch  672505 Dec 11 16:23 gdb-6.5-13.fc6.s390.sum
--rw-rw-r--  1 jkratoch jkratoch 2942297 Dec 11 16:23 gdb-6.5-13.fc6.s390x.log
--rw-rw-r--  1 jkratoch jkratoch  674676 Dec 11 16:23 gdb-6.5-13.fc6.s390x.sum
--rw-rw-r--  1 jkratoch jkratoch 2974880 Dec 11 16:23 gdb-6.5-13.fc6.x86_64.log
--rw-rw-r--  1 jkratoch jkratoch  673396 Dec 11 16:23 gdb-6.5-13.fc6.x86_64.sum
-

diff --git a/gdbpatchno b/gdbpatchno
deleted file mode 100755
index b355618..0000000
--- a/gdbpatchno
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh
-# $Id: gdbpatchno,v 1.1 2006/12/29 20:35:43 jkratoch Exp $
-# Print the first unused patch number across all the current package's branches.
-
-echo $[1+$(cat ../*/*.spec|sed -n 's/^[# %]*patch\([0-9]*\).*$/\1/p'|sort -rnu|head -n1)]

diff --git a/sources b/sources
index 82ced62..6c2d734 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-26c6432521efa296bf8bdcae465c048b  gdb-7.1.90.20100721.tar.bz2
+64260e6c56979ee750a01055f16091a5  gdb-7.2.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=178260448518.1.15990111169032872049.rpms-gdb-1bcf9b660433@fedoraproject.org \
    --to=jan.kratochvil@redhat.com \
    --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