diff --git a/baselibs.conf b/baselibs.conf
new file mode 100644
index 0000000..99bee94
--- /dev/null
+++ b/baselibs.conf
@@ -0,0 +1,11 @@
+gdb
+  +/usr/bin/gdb -> /usr/bin/gdb<extension>
+  # kill package for i586 32bit
+  targetarch x86_64 block!
+  prereq -glibc-x86
+gdbserver
+  +/usr/bin/gdbserver -> /usr/bin/gdbserver<extension>
+  provides "gdb-<targettype>:/usr/bin/gdbserver<extension>"
+  # kill package for i586 32bit
+  targetarch x86_64 block!
+  prereq -glibc-x86
diff --git a/gdb-6.3-ia64-info-frame-fix-20050725.patch b/gdb-6.3-ia64-info-frame-fix-20050725.patch
index d764af2..62db2a7 100644
--- a/gdb-6.3-ia64-info-frame-fix-20050725.patch
+++ b/gdb-6.3-ia64-info-frame-fix-20050725.patch
@@ -41,7 +41,7 @@ testsuite:
 +
 --- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix	2005-07-25 16:42:50.000000000 -0400
 +++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp	2005-07-25 16:42:01.000000000 -0400
-@@ -0,0 +1,66 @@
+@@ -0,0 +1,73 @@
 +#   Copyright 2005 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
@@ -90,7 +90,10 @@ testsuite:
 +}
 +
 +gdb_exit
++set match_max_old [match_max]
++match_max -d 1000000
 +gdb_start
++match_max -d $match_max_old
 +gdb_reinitialize_dir $srcdir/$subdir
 +gdb_load ${binfile}
 +
@@ -106,5 +109,9 @@ testsuite:
 +gdb_test "continue" "Breakpoint.*x.*" "continue to x"
 +
 +gdb_test "f 1" ".*signal handler called.*" "frame 1"
-+gdb_test "info frame" "Stack level 1.*p63 at .*" "info sigtramp frame"
-+ 
++
++# gdb-7.0+ no longer prints the pseudo registers as they are computed.
++# frame_info says: /* For moment, only display registers that were saved on the
++#                     stack.  */
++gdb_test "set debug frame 1"
++gdb_test "info frame" "Stack level 1, .*frame_unwind_register_value \\(frame=1,regnum=750\\(p63\\),\[^\r\n\]*\r\n\[^\r\n\]*-> computed bytes=.*" "info sigtramp frame"
diff --git a/gdb-6.3-ia64-sigtramp-frame-20050708.patch b/gdb-6.3-ia64-sigtramp-frame-20050708.patch
index 6127ff9..e22e460 100644
--- a/gdb-6.3-ia64-sigtramp-frame-20050708.patch
+++ b/gdb-6.3-ia64-sigtramp-frame-20050708.patch
@@ -13,11 +13,11 @@
 	Port to gdb-6.8.50.20081128, follow the upstream change:
 	http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ia64-tdep.c.diff?cvsroot=src&r1=1.176&r2=1.177
 
-Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c
+Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
 ===================================================================
---- gdb-6.8.50.20090818.orig/gdb/ia64-tdep.c	2009-07-30 18:29:53.000000000 +0200
-+++ gdb-6.8.50.20090818/gdb/ia64-tdep.c	2009-08-24 17:03:11.000000000 +0200
-@@ -2153,6 +2153,94 @@ ia64_sigtramp_frame_prev_register (struc
+--- gdb-6.8.50.20081128.orig/gdb/ia64-tdep.c	2008-11-26 06:27:48.000000000 +0100
++++ gdb-6.8.50.20081128/gdb/ia64-tdep.c	2008-12-02 19:04:32.000000000 +0100
+@@ -2107,6 +2107,94 @@ ia64_sigtramp_frame_prev_register (struc
        return frame_unwind_got_constant (this_frame, regnum, pc);
      }
  
@@ -29,7 +29,7 @@ Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c
 +      ULONGEST unatN_val;
 +      ULONGEST unat;
 +      read_memory (cache->saved_regs[IA64_UNAT_REGNUM], (char *) &unat,
-+		   register_size (gdbarch, IA64_UNAT_REGNUM));
++		   register_size (target_gdbarch, IA64_UNAT_REGNUM));
 +      unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
 +      return frame_unwind_got_constant (this_frame, regnum, unatN_val);
 +    }
@@ -45,9 +45,9 @@ Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c
 +      CORE_ADDR gr_addr = 0, nat_addr = 0;
 +
 +      read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
-+		   register_size (gdbarch, IA64_BSP_REGNUM));
++		   register_size (target_gdbarch, IA64_BSP_REGNUM));
 +      read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
-+		   register_size (gdbarch, IA64_CFM_REGNUM));
++		   register_size (target_gdbarch, IA64_CFM_REGNUM));
 +
 +      /* The bsp points at the end of the register frame so we
 +	 subtract the size of frame from it to get start of register frame.  */
@@ -71,10 +71,10 @@ Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c
 +	      nat_addr = cache->saved_regs[IA64_RNAT_REGNUM];
 +	      if (nat_addr != 0)
 +		read_memory (nat_addr, (char *) &nat_collection,
-+			     register_size (gdbarch, IA64_RNAT_REGNUM));
++			     register_size (target_gdbarch, IA64_RNAT_REGNUM));
 +	    }
 +	  else
-+	    nat_collection = read_memory_integer (nat_addr, 8, byte_order);
++	    nat_collection = read_memory_integer (nat_addr, 8, BFD_ENDIAN_LITTLE);
 +	  if (nat_addr != 0)
 +	    {
 +	      nat_bit = (gr_addr >> 3) & 0x3f;
@@ -97,9 +97,9 @@ Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c
 +      ULONGEST bof;
 +
 +      read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
-+		   register_size (gdbarch, IA64_BSP_REGNUM));
++		   register_size (target_gdbarch, IA64_BSP_REGNUM));
 +      read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
-+		   register_size (gdbarch, IA64_CFM_REGNUM));
++		   register_size (target_gdbarch, IA64_CFM_REGNUM));
 +
 +      /* The bsp points at the end of the register frame so we
 +	 subtract the size of frame from it to get beginning of frame.  */
@@ -112,7 +112,7 @@ Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c
    else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM)
             || (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
      {
-@@ -2167,7 +2255,42 @@ ia64_sigtramp_frame_prev_register (struc
+@@ -2121,7 +2209,42 @@ ia64_sigtramp_frame_prev_register (struc
        return frame_unwind_got_constant (this_frame, regnum, 0);
      }
  
@@ -133,9 +133,9 @@ Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c
 +	  ULONGEST cfm;
 +	  ULONGEST prN_val;
 +	  read_memory (pr_addr, (char *) &pr,
-+		       register_size (gdbarch, IA64_PR_REGNUM));
++		       register_size (target_gdbarch, IA64_PR_REGNUM));
 +	  read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
-+		       register_size (gdbarch, IA64_CFM_REGNUM));
++		       register_size (target_gdbarch, IA64_CFM_REGNUM));
 +
 +	  /* Get the register rename base for this frame and adjust the
 +	   * register name to take rotation into account. */
diff --git a/gdb-6.3-nonthreaded-wp-20050117.patch b/gdb-6.3-nonthreaded-wp-20050117.patch
deleted file mode 100644
index 83a5df7..0000000
--- a/gdb-6.3-nonthreaded-wp-20050117.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-[base]
-
-2007-10-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	* linux-nat.c (iterate_over_lwps): Fixed missing LWP initialization for
-	current INFERIOR_PTID.
-
-2007-10-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	* gdb.base/follow-child.exp, gdb.base/follow-child.c: New files.
-
-2007-10-16  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Port to GDB-6.7.
-
-2008-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Port to GDB-6.8pre.
-
-2008-08-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Remove the fix as causing an assertion failure for
-	gdb.base/checkpoint.exp and it is no longer needed for
-	gdb.base/follow-child.exp .
-
-Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c	2008-02-22 08:14:04.000000000 +0100
-@@ -0,0 +1,29 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2007 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 2 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, write to the Free Software
-+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+   Please email any bugs, comments, and/or additions to this file to:
-+   bug-gdb@prep.ai.mit.edu  */
-+
-+#include <unistd.h>
-+
-+int main()
-+{
-+  fork ();
-+  sleep (60);
-+  return 0;
-+}
-Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp	2008-02-22 08:14:17.000000000 +0100
-@@ -0,0 +1,55 @@
-+# Copyright 2007 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 2 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, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+if $tracelevel then {
-+    strace $tracelevel
-+}
-+
-+set prms_id 0
-+set bug_id 0
-+
-+set testfile follow-child
-+set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${testfile}
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-+    untested "Couldn't compile test program"
-+    return -1
-+}
-+
-+# Get things started.
-+
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+
-+# For C programs, "start" should stop in main().
-+
-+gdb_test "set follow-fork-mode child" ""
-+set test "started"
-+# GDB_RUN_CMD already checks for `Starting program:'.
-+gdb_run_cmd
-+sleep 5
-+send_gdb "\003"
-+set test "break"
-+gdb_test_multiple "" $test {
-+    -re "Program received signal SIGINT.*$gdb_prompt $" {
-+	pass $test
-+    }
-+    -re "\\\[New process \[0-9\]+\\\]" {
-+	fail $test
-+    }
-+}
diff --git a/gdb-6.3-pie-20050110.patch b/gdb-6.3-pie-20050110.patch
deleted file mode 100644
index 00a1c9c..0000000
--- a/gdb-6.3-pie-20050110.patch
+++ /dev/null
@@ -1,1350 +0,0 @@
-2007-11-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Port to GDB-6.7.1.
-
-2007-11-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Port to post-GDB-6.7.1 multi-PC breakpoints.
-
-2007-11-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	* solib-svr4.c (svr4_current_sos): Fix segfault on NULL EXEC_BFD.
-
-2008-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Port to GDB-6.8pre.
-
-2008-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Port to gdb-6.7.50.20080227.
-
-2008-06-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Fix crash on a watchpoint update on an inferior stop.
-
-2008-09-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Fix scan_dyntag() for binaries provided by valgrind (BZ 460319).
-
-Index: gdb-6.8.91.20090925/gdb/amd64-tdep.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/amd64-tdep.c	2009-09-25 10:25:39.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/amd64-tdep.c	2009-09-25 10:25:45.000000000 +0200
-@@ -36,6 +36,7 @@
- #include "regcache.h"
- #include "regset.h"
- #include "symfile.h"
-+#include "exceptions.h"
- 
- #include "gdb_assert.h"
- 
-@@ -1591,18 +1592,31 @@ amd64_analyze_stack_align (CORE_ADDR pc,
-    Any function that doesn't start with this sequence will be assumed
-    to have no prologue and thus no valid frame pointer in %rbp.  */
- 
--static CORE_ADDR
--amd64_analyze_prologue (struct gdbarch *gdbarch,
--			CORE_ADDR pc, CORE_ADDR current_pc,
--			struct amd64_frame_cache *cache)
-+struct amd64_analyze_prologue_data
-+  {
-+    struct gdbarch *gdbarch;
-+    CORE_ADDR pc, current_pc;
-+    struct amd64_frame_cache *cache;
-+    CORE_ADDR retval;
-+  };
-+
-+static int
-+amd64_analyze_prologue_1 (void *data_pointer)
- {
-+  struct amd64_analyze_prologue_data *data = data_pointer;
-+  struct gdbarch *gdbarch = data->gdbarch;
-+  CORE_ADDR pc = data->pc, current_pc = data->current_pc;
-+  struct amd64_frame_cache *cache = data->cache;
-   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-   static gdb_byte proto[3] = { 0x48, 0x89, 0xe5 }; /* movq %rsp, %rbp */
-   gdb_byte buf[3];
-   gdb_byte op;
- 
-   if (current_pc <= pc)
--    return current_pc;
-+    {
-+      data->retval = current_pc;
-+      return 1;
-+    }
- 
-   pc = amd64_analyze_stack_align (pc, current_pc, cache);
- 
-@@ -1617,18 +1631,59 @@ amd64_analyze_prologue (struct gdbarch *
- 
-       /* If that's all, return now.  */
-       if (current_pc <= pc + 1)
--        return current_pc;
-+        {
-+	  data->retval = current_pc;
-+	  return 1;
-+        }
- 
-       /* Check for `movq %rsp, %rbp'.  */
-       read_memory (pc + 1, buf, 3);
-       if (memcmp (buf, proto, 3) != 0)
--	return pc + 1;
-+	{
-+	  data->retval = pc + 1;
-+	  return 1;
-+	}
- 
-       /* OK, we actually have a frame.  */
-       cache->frameless_p = 0;
--      return pc + 4;
-+      data->retval = pc + 4;
-+      return 1;
-     }
- 
-+  data->retval = pc;
-+  return 1;
-+}
-+
-+/* Catch memory read errors and return just PC in such case.
-+   It occurs very early on enable_break->new_symfile_objfile->
-+   ->breakpoint_re_set->decode_line_1->decode_variable_1->
-+   ->find_function_start_sal  */
-+
-+static CORE_ADDR
-+amd64_analyze_prologue (struct gdbarch *gdbarch,
-+			CORE_ADDR pc, CORE_ADDR current_pc,
-+			struct amd64_frame_cache *cache)
-+{
-+  int status;
-+  struct amd64_analyze_prologue_data data;
-+  struct ui_file *saved_gdb_stderr;
-+
-+  /* Suppress error messages.  */
-+  saved_gdb_stderr = gdb_stderr;
-+  gdb_stderr = ui_file_new ();
-+
-+  data.gdbarch = gdbarch;
-+  data.pc = pc;
-+  data.current_pc = current_pc;
-+  data.cache = cache;
-+  status = catch_errors (amd64_analyze_prologue_1, &data, "", RETURN_MASK_ALL);
-+
-+  /* Stop suppressing error messages.  */
-+  ui_file_delete (gdb_stderr);
-+  gdb_stderr = saved_gdb_stderr;
-+
-+  if (status)
-+    return data.retval;
-   return pc;
- }
- 
-Index: gdb-6.8.91.20090925/gdb/auxv.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/auxv.c	2009-07-02 19:25:52.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/auxv.c	2009-09-25 10:25:45.000000000 +0200
-@@ -78,7 +78,7 @@ procfs_xfer_auxv (struct target_ops *ops
-    Return 1 if an entry was read into *TYPEP and *VALP.  */
- static int
- default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
--		   gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
-+		   gdb_byte *endptr, ULONGEST *typep, CORE_ADDR *valp)
- {
-   const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch)
- 				/ TARGET_CHAR_BIT;
-@@ -106,7 +106,7 @@ default_auxv_parse (struct target_ops *o
-    Return 1 if an entry was read into *TYPEP and *VALP.  */
- int
- target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
--                  gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
-+                  gdb_byte *endptr, ULONGEST *typep, CORE_ADDR *valp)
- {
-   struct target_ops *t;
-   for (t = ops; t != NULL; t = t->beneath)
-@@ -121,9 +121,10 @@ target_auxv_parse (struct target_ops *op
-    an error getting the information.  On success, return 1 after
-    storing the entry's value field in *VALP.  */
- int
--target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
-+target_auxv_search (struct target_ops *ops, ULONGEST match, CORE_ADDR *valp)
- {
--  CORE_ADDR type, val;
-+  CORE_ADDR val;
-+  ULONGEST at_type;
-   gdb_byte *data;
-   LONGEST n = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL, &data);
-   gdb_byte *ptr = data;
-@@ -133,10 +134,10 @@ target_auxv_search (struct target_ops *o
-     return n;
- 
-   while (1)
--    switch (target_auxv_parse (ops, &ptr, data + n, &type, &val))
-+    switch (target_auxv_parse (ops, &ptr, data + n, &at_type, &val))
-       {
-       case 1:			/* Here's an entry, check it.  */
--	if (type == match)
-+	if (at_type == match)
- 	  {
- 	    xfree (data);
- 	    *valp = val;
-@@ -159,7 +160,8 @@ target_auxv_search (struct target_ops *o
- int
- fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
- {
--  CORE_ADDR type, val;
-+  CORE_ADDR val;
-+  ULONGEST at_type;
-   gdb_byte *data;
-   LONGEST len = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL,
- 				   &data);
-@@ -169,13 +171,13 @@ fprint_target_auxv (struct ui_file *file
-   if (len <= 0)
-     return len;
- 
--  while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0)
-+  while (target_auxv_parse (ops, &ptr, data + len, &at_type, &val) > 0)
-     {
-       const char *name = "???";
-       const char *description = "";
-       enum { dec, hex, str } flavor = hex;
- 
--      switch (type)
-+      switch (at_type)
- 	{
- #define TAG(tag, text, kind) \
- 	case tag: name = #tag; description = text; flavor = kind; break
-@@ -231,7 +233,7 @@ fprint_target_auxv (struct ui_file *file
- 	}
- 
-       fprintf_filtered (file, "%-4s %-20s %-30s ",
--			plongest (type), name, description);
-+			plongest (at_type), name, description);
-       switch (flavor)
- 	{
- 	case dec:
-@@ -253,7 +255,7 @@ fprint_target_auxv (struct ui_file *file
- 	  break;
- 	}
-       ++ents;
--      if (type == AT_NULL)
-+      if (at_type == AT_NULL)
- 	break;
-     }
- 
-Index: gdb-6.8.91.20090925/gdb/auxv.h
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/auxv.h	2009-06-07 21:07:08.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/auxv.h	2009-09-25 10:25:45.000000000 +0200
-@@ -31,14 +31,14 @@
-    Return 1 if an entry was read into *TYPEP and *VALP.  */
- extern int target_auxv_parse (struct target_ops *ops,
- 			      gdb_byte **readptr, gdb_byte *endptr,
--			      CORE_ADDR *typep, CORE_ADDR *valp);
-+			      ULONGEST *typep, CORE_ADDR *valp);
- 
- /* Extract the auxiliary vector entry with a_type matching MATCH.
-    Return zero if no such entry was found, or -1 if there was
-    an error getting the information.  On success, return 1 after
-    storing the entry's value field in *VALP.  */
- extern int target_auxv_search (struct target_ops *ops,
--			       CORE_ADDR match, CORE_ADDR *valp);
-+			       ULONGEST match, CORE_ADDR *valp);
- 
- /* Print the contents of the target's AUXV on the specified file. */
- extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
-Index: gdb-6.8.91.20090925/gdb/dwarf2read.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/dwarf2read.c	2009-09-25 10:25:39.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/dwarf2read.c	2009-09-25 10:25:45.000000000 +0200
-@@ -1717,7 +1717,7 @@ dwarf2_build_psymtabs (struct objfile *o
-   dwarf2_read_section (objfile, &dwarf2_per_objfile->eh_frame);
-   dwarf2_read_section (objfile, &dwarf2_per_objfile->frame);
- 
--  if (mainline
-+  if ((mainline == 1)
-       || (objfile->global_psymbols.size == 0
- 	  && objfile->static_psymbols.size == 0))
-     {
-Index: gdb-6.8.91.20090925/gdb/elfread.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/elfread.c	2009-09-25 10:25:38.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/elfread.c	2009-09-25 10:25:45.000000000 +0200
-@@ -681,7 +681,7 @@ elf_symfile_read (struct objfile *objfil
-   /* If we are reinitializing, or if we have never loaded syms yet,
-      set table to empty.  MAINLINE is cleared so that *_read_psymtab
-      functions do not all also re-initialize the psymbol table. */
--  if (mainline)
-+  if (mainline == 1)
-     {
-       init_psymbol_list (objfile, 0);
-       mainline = 0;
-Index: gdb-6.8.91.20090925/gdb/infrun.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/infrun.c	2009-09-25 10:25:39.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/infrun.c	2009-09-25 10:25:45.000000000 +0200
-@@ -3659,6 +3659,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
- #endif
- 	  target_terminal_inferior ();
- 
-+	  /* For PIE executables, we dont really know where the
-+	     breakpoints are going to be until we start up the inferior.  */
-+	  enable_breakpoints_after_startup ();
-+
- 	  /* If requested, stop when the dynamic linker notifies
- 	     gdb of events.  This allows the user to get control
- 	     and place breakpoints in initializer routines for
-Index: gdb-6.8.91.20090925/gdb/objfiles.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/objfiles.c	2009-09-25 10:25:38.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/objfiles.c	2009-09-25 10:25:45.000000000 +0200
-@@ -53,6 +53,9 @@
- #include "observer.h"
- #include "complaints.h"
- 
-+#include "auxv.h"
-+#include "elf/common.h"
-+
- /* Prototypes for local functions */
- 
- static void objfile_alloc_data (struct objfile *objfile);
-@@ -280,9 +283,17 @@ init_entry_point_info (struct objfile *o
- CORE_ADDR
- entry_point_address (void)
- {
-+  int ret;
-+
-   struct gdbarch *gdbarch;
-   CORE_ADDR entry_point;
- 
-+  /* Find the address of the entry point of the program from the
-+     auxv vector.  */
-+  ret = target_auxv_search (&current_target, AT_ENTRY, &entry_point);
-+  if (ret == 1)
-+     return entry_point;                                                                              
-+
-   if (symfile_objfile == NULL)
-     return 0;
- 
-Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c	2009-09-25 10:25:39.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/solib-svr4.c	2009-09-25 10:28:07.000000000 +0200
-@@ -47,6 +47,7 @@
- #include "exec.h"
- #include "auxv.h"
- #include "exceptions.h"
-+#include "command.h"
- 
- static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
- static int svr4_have_link_map_offsets (void);
-@@ -359,7 +360,9 @@ solib_svr4_inferior_exit (int pid)
- 
- /* Local function prototypes */
- 
-+#if 0
- static int match_main (char *);
-+#endif
- 
- static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
- 
-@@ -600,10 +603,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
-   int arch_size, step, sect_size;
-   long dyn_tag;
-   CORE_ADDR dyn_ptr, dyn_addr;
-+  CORE_ADDR reloc_addr = 0;
-   gdb_byte *bufend, *bufstart, *buf;
-   Elf32_External_Dyn *x_dynp_32;
-   Elf64_External_Dyn *x_dynp_64;
-   struct bfd_section *sect;
-+  int ret;
- 
-   if (abfd == NULL)
-     return 0;
-@@ -615,19 +620,81 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
-   if (arch_size == -1)
-     return 0;
- 
-+  /* The auxv vector based relocatable files reading is limited to the main
-+     executable.  */
-+  gdb_assert (abfd == exec_bfd || ptr == NULL);
-+
-+  if (ptr != NULL)
-+    {
-+      CORE_ADDR entry_addr;
-+
-+      /* Find the address of the entry point of the program from the
-+	 auxv vector.  */
-+      ret = target_auxv_search (&current_target, AT_ENTRY, &entry_addr);
-+
-+      if (ret == 0 || ret == -1)
-+	{
-+	  /* No auxv info, maybe an older kernel. Fake our way through.  */
-+	  entry_addr = bfd_get_start_address (exec_bfd); 
-+
-+	  if (debug_solib)
-+	    fprintf_unfiltered (gdb_stdlog,
-+				"elf_locate_base: program entry address not found. Using bfd's %s for %s\n",
-+				paddress (target_gdbarch, entry_addr), exec_bfd->filename);
-+	}
-+      else
-+	{
-+	  if (debug_solib)
-+	    fprintf_unfiltered (gdb_stdlog,
-+				"elf_locate_base: found program entry address %s for %s\n",
-+				paddress (target_gdbarch, entry_addr), exec_bfd->filename);
-+	}
-+      reloc_addr = entry_addr - bfd_get_start_address (exec_bfd);
-+      if (debug_solib)
-+	fprintf_unfiltered (gdb_stdlog,
-+			    "elf_locate_base: expected relocation offset %s for %s\n",
-+			    paddress (target_gdbarch, reloc_addr), exec_bfd->filename);
-+    }
-+
-   /* Find the start address of the .dynamic section.  */
-   sect = bfd_get_section_by_name (abfd, ".dynamic");
-   if (sect == NULL)
--    return 0;
-+    { 
-+      if (debug_solib)
-+	fprintf_unfiltered (gdb_stdlog,
-+			    "elf_locate_base: .dynamic section not found in %s -- return now\n",
-+			    exec_bfd->filename);
-+      return 0;
-+    }
-+  else
-+    { 
-+      if (debug_solib)
-+	fprintf_unfiltered (gdb_stdlog,
-+			    "elf_locate_base: .dynamic section found in %s\n",
-+			    exec_bfd->filename);
-+    }
-+
-   dyn_addr = bfd_section_vma (abfd, sect);
-+  if (debug_solib)
-+    fprintf_unfiltered (gdb_stdlog,
-+			"elf_locate_base: .dynamic addr %s\n",
-+			paddress (target_gdbarch, dyn_addr));
- 
-   /* Read in .dynamic from the BFD.  We will get the actual value
-      from memory later.  */
-   sect_size = bfd_section_size (abfd, sect);
-   buf = bufstart = alloca (sect_size);
-+  if (debug_solib) 
-+    fprintf_unfiltered (gdb_stdlog, 
-+                        "elf_locate_base: read in .dynamic section\n");
-   if (!bfd_get_section_contents (abfd, sect,
- 				 buf, 0, sect_size))
--    return 0;
-+    { 
-+      if (debug_solib)
-+	fprintf_unfiltered (gdb_stdlog,
-+			    "elf_locate_base: couldn't read .dynamic section -- return now\n");
-+      return 0;
-+    }
- 
-   /* Iterate over BUF and scan for DYNTAG.  If found, set PTR and return.  */
-   step = (arch_size == 32) ? sizeof (Elf32_External_Dyn)
-@@ -648,26 +715,105 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
- 	dyn_tag = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_tag);
- 	dyn_ptr = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_un.d_ptr);
-       }
--     if (dyn_tag == DT_NULL)
-+
-+    /* Verify RELOC_ADDR makes sense - it does not have to for valgrind which
-+       supplies us a specially crafted executable in /proc/PID/fd/X while
-+       /proc/PID/auxv corresponds to a different executable (.../memcheck).  */
-+    if (reloc_addr)
-+      {
-+	gdb_byte tag_buf[8];
-+	CORE_ADDR tag_addr;
-+
-+	tag_addr = dyn_addr + (buf - bufstart) + reloc_addr;
-+	if (target_read_memory (tag_addr, tag_buf, arch_size / 8) == 0)
-+	  {
-+	    if (memcmp (tag_buf, buf, arch_size / 8) != 0)
-+	      {
-+		if (debug_solib)
-+		  fprintf_unfiltered (gdb_stdlog,
-+				      "elf_locate_base: tag at offset 0x%lx does not match,"
-+				      " dropping relocation offset %s\n",
-+				      (unsigned long) (buf - bufstart), paddress (target_gdbarch, reloc_addr));
-+		reloc_addr = 0;
-+	      }
-+	  }
-+	else
-+	  {
-+	    if (debug_solib)
-+	      fprintf_unfiltered (gdb_stdlog,
-+				  "elf_locate_base: tag at offset 0x%lx is not readable,"
-+				  " dropping relocation offset %s\n",
-+				  (unsigned long) (buf - bufstart), paddress (target_gdbarch, reloc_addr));
-+	    reloc_addr = 0;
-+	  }
-+      }
-+
-+    if (dyn_tag == DT_NULL)
-        return 0;
--     if (dyn_tag == dyntag)
--       {
--	 /* If requested, try to read the runtime value of this .dynamic
--	    entry.  */
--	 if (ptr)
--	   {
--	     struct type *ptr_type;
--	     gdb_byte ptr_buf[8];
--	     CORE_ADDR ptr_addr;
--
--	     ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
--	     ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
--	     if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
--	       dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
--	     *ptr = dyn_ptr;
--	   }
--	 return 1;
--       }
-+    if (dyn_tag == dyntag)
-+      {
-+	/* If requested, try to read the runtime value of this .dynamic
-+	   entry.  */
-+	if (ptr)
-+	  {
-+	    gdb_byte ptr_buf[8];
-+	    CORE_ADDR ptr_addr;
-+	    int got;
-+
-+	    ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
-+	    if (ptr != NULL)
-+	      {
-+		if (debug_solib)
-+		  fprintf_unfiltered (gdb_stdlog,
-+				      "elf_locate_base: unrelocated ptr addr %s\n",
-+				      paddress (target_gdbarch, ptr_addr));
-+		ptr_addr += reloc_addr;
-+		if (debug_solib) 
-+		  fprintf_unfiltered (gdb_stdlog, 
-+				      "elf_locate_base: relocated ptr addr %s"
-+				      " (relocation offset %s) for %s\n",
-+				      paddress (target_gdbarch, ptr_addr), paddress (target_gdbarch, reloc_addr),
-+				      exec_bfd->filename);
-+	      }
-+	    got = target_read_memory (ptr_addr, ptr_buf, arch_size / 8);
-+	    if (got != 0 && reloc_addr)
-+	      {
-+		ptr_addr -= reloc_addr;
-+		if (debug_solib) 
-+		  fprintf_unfiltered (gdb_stdlog, 
-+				      "elf_locate_base: unrelocated back to ptr addr %s"
-+				      " as the memory was unreable for %s\n",
-+				      paddress (target_gdbarch, ptr_addr), exec_bfd->filename);
-+		got = target_read_memory (ptr_addr, ptr_buf, arch_size / 8);
-+	      }
-+
-+	    if (got == 0)
-+	      {
-+		struct type *ptr_type;
-+
-+		ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
-+		dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
-+		if (ptr != NULL)
-+		  {
-+		    if (debug_solib)
-+		      fprintf_unfiltered (gdb_stdlog,
-+					  "elf_locate_base: Tag entry has value %s -- return now\n",
-+					  paddress (target_gdbarch, dyn_ptr));
-+		  }
-+	      }
-+	    else
-+	      {
-+		if (ptr != NULL)
-+		  {
-+		    if (debug_solib)
-+		      fprintf_unfiltered (gdb_stdlog,
-+					  "elf_locate_base: Couldn't read tag entry value -- return now\n");
-+		  }
-+	      }
-+	    *ptr = dyn_ptr;
-+	  }
-+	return 1;
-+      }
-   }
- 
-   return 0;
-@@ -1040,6 +1186,11 @@ svr4_current_sos (void)
-   CORE_ADDR ldsomap = 0;
-   struct inferior *inf;
-   struct svr4_info *info;
-+  const char *filename = exec_bfd ? exec_bfd->filename : "<none>";
-+
-+  if (debug_solib)
-+    fprintf_unfiltered (gdb_stdlog, 
-+                        "svr4_current_sos: exec_bfd %s\n", filename);
- 
-   if (ptid_equal (inferior_ptid, null_ptid))
-     return NULL;
-@@ -1054,7 +1205,13 @@ svr4_current_sos (void)
-   /* If we can't find the dynamic linker's base structure, this
-      must not be a dynamically linked executable.  Hmm.  */
-   if (! info->debug_base)
--    return svr4_default_sos ();
-+    {
-+      if (debug_solib)
-+	fprintf_unfiltered (gdb_stdlog, 
-+			    "svr4_current_sos: no DT_DEBUG found in %s -- return now\n",
-+			    filename);
-+      return svr4_default_sos ();
-+    }
- 
-   /* Walk the inferior's link map list, and build our list of
-      `struct so_list' nodes.  */
-@@ -1074,26 +1231,104 @@ svr4_current_sos (void)
-       new->lm_info->lm = xzalloc (lmo->link_map_size);
-       make_cleanup (xfree, new->lm_info->lm);
- 
-+      if (debug_solib)
-+        fprintf_unfiltered (gdb_stdlog, 
-+                            "svr4_current_sos: read lm at %s\n", paddress (target_gdbarch, lm));
-       read_memory (lm, new->lm_info->lm, lmo->link_map_size);
- 
-       lm = LM_NEXT (new);
- 
-+      if (debug_solib)
-+        fprintf_unfiltered (gdb_stdlog,
-+                            "svr4_current_sos: is first link entry? %d\n",
-+                            IGNORE_FIRST_LINK_MAP_ENTRY (new));
-+
-       /* For SVR4 versions, the first entry in the link map is for the
-          inferior executable, so we must ignore it.  For some versions of
-          SVR4, it has no name.  For others (Solaris 2.3 for example), it
-          does have a name, so we can no longer use a missing name to
-          decide when to ignore it. */
--      if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
-+      if (exec_bfd != NULL && IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
- 	{
--	  info->main_lm_addr = new->lm_info->lm_addr;
--	  free_so (new);
--	}
-+          /* It is the first link map entry, i.e. it is the main executable.  */
-+
-+	  if (bfd_get_start_address (exec_bfd) == entry_point_address ())
-+	    {
-+	      /* Non-pie case, main executable has not been relocated.  */
-+	      info->main_lm_addr = new->lm_info->lm_addr;
-+	      free_so (new);
-+	    }
-+	  else
-+	    {
-+              /* Pie case, main executable has been relocated.  */
-+	      struct so_list *gdb_solib;
-+
-+	      if (debug_solib)
-+		fprintf_unfiltered (gdb_stdlog,
-+				    "svr4_current_sos: Processing first link map entry\n");
-+	      strncpy (new->so_name, exec_bfd->filename,
-+		       SO_NAME_MAX_PATH_SIZE - 1);
-+	      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-+	      strcpy (new->so_original_name, new->so_name);
-+	      /*new->main = 1;*/
-+	      new->main_relocated = 0;
-+            
-+	      if (debug_solib)
-+		{ 
-+		  fprintf_unfiltered (gdb_stdlog,
-+				      "svr4_current_sos: Processing nameless DSO\n");
-+		  fprintf_unfiltered (gdb_stdlog,
-+				      "svr4_current_sos: adding name %s\n",
-+				      new->so_name);
-+		}
-+
-+	      for (gdb_solib = master_so_list ();
-+                   gdb_solib;
-+                   gdb_solib = gdb_solib->next)
-+		{
-+		  if (debug_solib)
-+		    fprintf_unfiltered (gdb_stdlog,
-+					"svr4_current_sos: compare gdb %s and new %s\n",
-+					gdb_solib->so_name, new->so_name);
-+		  if (strcmp (gdb_solib->so_name, new->so_name) == 0)
-+		    if (gdb_solib->main_relocated)
-+		      { 
-+			if (debug_solib)
-+			  fprintf_unfiltered (gdb_stdlog,
-+					      "svr4_current_sos: found main relocated\n");
-+			break;
-+		      }
-+		}
-+
-+	      if ((gdb_solib && !gdb_solib->main_relocated) || (!gdb_solib))
-+		{
-+		  add_to_target_sections (0 /*from_tty*/, &current_target, new);
-+		  new->main = 1;
-+		}
-+
-+	      /* We need this in the list of shared libs we return because
-+		 solib_add_stub will loop through it and add the symbol file.  */
-+	      new->next = 0;
-+	      *link_ptr = new;
-+	      link_ptr = &new->next; 
-+	    }
-+	} /* End of IGNORE_FIRST_LINK_MAP_ENTRY  */
-       else
- 	{
-+          /* This is not the first link map entry, i.e. is not the main
-+             executable.  Note however that it could be the DSO supplied on
-+             certain systems (i.e. Linux 2.6) containing information about
-+             the vsyscall page.  We must ignore such entry. This entry is 
-+             nameless (just like the one for the main executable, sigh).  */
-+
- 	  int errcode;
- 	  char *buffer;
- 
- 	  /* Extract this shared object's name.  */
-+	  if (debug_solib)
-+	    fprintf_unfiltered (gdb_stdlog, 
-+                                "svr4_current_sos: read LM_NAME\n");
-+
- 	  target_read_string (LM_NAME (new), &buffer,
- 			      SO_NAME_MAX_PATH_SIZE - 1, &errcode);
- 	  if (errcode != 0)
-@@ -1101,63 +1336,76 @@ svr4_current_sos (void)
- 	    }
- 	  else
- 	    {
--	      struct build_id *build_id;
--
--	      strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
--	      new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
--	      /* May get overwritten below.  */
--	      strcpy (new->so_name, new->so_original_name);
--
--	      build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
--	      if (build_id != NULL)
-+	      if (debug_solib)
-+		fprintf_unfiltered (gdb_stdlog, 
-+				    "svr4_current_sos: LM_NAME is <%s>\n",
-+				    buffer);
-+	      /* The name could be empty, in which case it is the
-+		 system supplied DSO.  */
-+	      if (strcmp (buffer, "") == 0)
-+		free_so (new);
-+	      else
- 		{
--		  char *name, *build_id_filename;
-+		  struct build_id *build_id;
-+
-+		  strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
-+		  new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-+		  /* May get overwritten below.  */
-+		  strcpy (new->so_name, new->so_original_name);
- 
--		  /* Missing the build-id matching separate debug info file
--		     would be handled while SO_NAME gets loaded.  */
--		  name = build_id_to_filename (build_id, &build_id_filename, 0);
--		  if (name != NULL)
-+		  build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
-+		  if (build_id != NULL)
- 		    {
--		      strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
--		      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
--		      xfree (name);
-+		      char *name, *build_id_filename;
-+
-+		      /* Missing the build-id matching separate debug info file
-+			 would be handled while SO_NAME gets loaded.  */
-+		      name = build_id_to_filename (build_id, &build_id_filename, 0);
-+		      if (name != NULL)
-+			{
-+			  strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
-+			  new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
-+			  xfree (name);
-+			}
-+		      else
-+			{
-+			  debug_print_missing (new->so_name, build_id_filename);
-+
-+			  /* In the case the main executable was found according to
-+			     its build-id (from a core file) prevent loading
-+			     a different build of a library with accidentally the
-+			     same SO_NAME.
-+
-+			     It suppresses bogus backtraces (and prints "??" there
-+			     instead) if the on-disk files no longer match the
-+			     running program version.  */
-+
-+			  if (symfile_objfile != NULL
-+			      && (symfile_objfile->flags
-+				  & OBJF_BUILD_ID_CORE_LOADED) != 0)
-+			    new->so_name[0] = 0;
-+			}
-+
-+		      xfree (build_id_filename);
-+		      xfree (build_id);
- 		    }
--		  else
--		    {
--		      debug_print_missing (new->so_name, build_id_filename);
- 
--		      /* In the case the main executable was found according to
--			 its build-id (from a core file) prevent loading
--			 a different build of a library with accidentally the
--			 same SO_NAME.
--
--			 It suppresses bogus backtraces (and prints "??" there
--			 instead) if the on-disk files no longer match the
--			 running program version.  */
--
--		      if (symfile_objfile != NULL
--			  && (symfile_objfile->flags
--			      & OBJF_BUILD_ID_CORE_LOADED) != 0)
--			new->so_name[0] = 0;
-+		  if (debug_solib)
-+		    {
-+		      fprintf_unfiltered (gdb_stdlog, 
-+					  "svr4_current_sos: Processing DSO: %s\n",
-+					  new->so_name);
-+		      fprintf_unfiltered (gdb_stdlog,
-+					  "svr4_current_sos: first link entry %d\n",
-+					  IGNORE_FIRST_LINK_MAP_ENTRY (new));
- 		    }
- 
--		  xfree (build_id_filename);
--		  xfree (build_id);
-+		  new->next = 0;
-+		  *link_ptr = new;
-+		  link_ptr = &new->next;
- 		}
- 	    }
--	  xfree (buffer);
--
--	  /* If this entry has no name, or its name matches the name
--	     for the main executable, don't include it in the list.  */
--	  if (! new->so_name[0]
--	      || match_main (new->so_name))
--	    free_so (new);
--	  else
--	    {
--	      new->next = 0;
--	      *link_ptr = new;
--	      link_ptr = &new->next;
--	    }
-+          xfree (buffer);
- 	}
- 
-       /* On Solaris, the dynamic linker is not in the normal list of
-@@ -1173,6 +1421,9 @@ svr4_current_sos (void)
-   if (head == NULL)
-     return svr4_default_sos ();
- 
-+  if (debug_solib)
-+    fprintf_unfiltered (gdb_stdlog, "svr4_current_sos: ENDS %s\n", filename);
-+
-   return head;
- }
- 
-@@ -1205,7 +1456,7 @@ svr4_fetch_objfile_link_map (struct objf
- /* On some systems, the only way to recognize the link map entry for
-    the main executable file is by looking at its name.  Return
-    non-zero iff SONAME matches one of the known main executable names.  */
--
-+#if 0
- static int
- match_main (char *soname)
- {
-@@ -1219,6 +1470,7 @@ match_main (char *soname)
- 
-   return (0);
- }
-+#endif
- 
- /* Return 1 if PC lies in the dynamic symbol resolution code of the
-    SVR4 run time loader.  */
-@@ -1370,15 +1622,29 @@ enable_break (struct svr4_info *info)
-   /* Find the program interpreter; if not found, warn the user and drop
-      into the old breakpoint at symbol code.  */
-   interp_name = find_program_interpreter ();
-+
-+  if (debug_solib)
-+     fprintf_unfiltered (gdb_stdlog,
-+                         "enable_break: search for .interp in %s\n",
-+                         exec_bfd->filename);
-   if (interp_name)
-     {
-       CORE_ADDR load_addr = 0;
-+      CORE_ADDR load_addr_mask = -1L;
-       int load_addr_found = 0;
-       int loader_found_in_list = 0;
-       struct so_list *so;
-       bfd *tmp_bfd = NULL;
-       struct target_ops *tmp_bfd_target;
-       volatile struct gdb_exception ex;
-+      int arch_size;
-+
-+      /* For 32bit inferiors with 64bit GDB we may get LOAD_ADDR at 0xff......
-+	 and thus overflowing its addition to the address while CORE_ADDR is
-+	 64bit producing 0x1........ address invalid across GDB.  */
-+      arch_size = bfd_get_arch_size (exec_bfd);
-+      if (arch_size > 0 && arch_size < sizeof (1UL) * 8)
-+        load_addr_mask = (1UL << arch_size) - 1;
- 
-       sym_addr = 0;
- 
-@@ -1395,6 +1661,9 @@ enable_break (struct svr4_info *info)
-         {
- 	  tmp_bfd = solib_bfd_open (interp_name);
- 	}
-+      if (debug_solib)
-+	 fprintf_unfiltered (gdb_stdlog,
-+			    "enable_break: opening %s\n", interp_name);
-       if (tmp_bfd == NULL)
- 	goto bkpt_at_symbol;
- 
-@@ -1452,16 +1721,16 @@ enable_break (struct svr4_info *info)
-       interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
-       if (interp_sect)
- 	{
--	  interp_text_sect_low =
--	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
-+	  interp_text_sect_low = (bfd_section_vma (tmp_bfd, interp_sect)
-+				  + load_addr) & load_addr_mask;
- 	  interp_text_sect_high =
- 	    interp_text_sect_low + bfd_section_size (tmp_bfd, interp_sect);
- 	}
-       interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
-       if (interp_sect)
- 	{
--	  interp_plt_sect_low =
--	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
-+	  interp_plt_sect_low = (bfd_section_vma (tmp_bfd, interp_sect)
-+				 + load_addr) & load_addr_mask;
- 	  interp_plt_sect_high =
- 	    interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
- 	}
-@@ -1496,7 +1765,7 @@ enable_break (struct svr4_info *info)
- 
-       if (sym_addr != 0)
- 	{
--	  create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr);
-+	  create_solib_event_breakpoint (target_gdbarch, (load_addr + sym_addr) & load_addr_mask);
- 	  xfree (interp_name);
- 	  return 1;
- 	}
-@@ -1769,6 +2038,9 @@ svr4_solib_create_inferior_hook (void)
-   while (tp->stop_signal != TARGET_SIGNAL_TRAP);
-   inf->stop_soon = NO_STOP_QUIETLY;
- #endif /* defined(_SCO_DS) */
-+
-+  if (bfd_get_start_address (exec_bfd) != entry_point_address ())
-+    disable_breakpoints_before_startup ();
- }
- 
- static void
-@@ -1945,6 +2217,76 @@ svr4_lp64_fetch_link_map_offsets (void)
- 
-   return lmp;
- }
-+void
-+info_linkmap_command (char *cmd, int from_tty)
-+{
-+  CORE_ADDR lm;
-+  struct svr4_info *info = get_svr4_info (PIDGET (inferior_ptid));
-+                                                                                
-+  /* Make sure we've looked up the inferior's dynamic linker's base
-+     structure.  */
-+  if (! info->debug_base)
-+    {
-+      info->debug_base = locate_base (info);
-+                                                                                
-+      /* If we can't find the dynamic linker's base structure, this
-+         must not be a dynamically linked executable.  Hmm.  */
-+      if (! info->debug_base)
-+        {
-+          if (debug_solib)
-+            fprintf_unfiltered (gdb_stdlog,
-+                                "svr4_print_linkmap: no DT_DEBUG found in %s -- return now\n",
-+                                exec_bfd->filename);
-+          return;
-+        }
-+    }
-+                                                                                
-+  /* Walk the inferior's link map list, and print the info.  */
-+ 
-+  lm = solib_svr4_r_map (info);
-+  while (lm)
-+    {
-+      int errcode;
-+      char *buffer;
-+      CORE_ADDR load_addr;
-+
-+      struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
-+      struct so_list *new
-+        = (struct so_list *) xmalloc (sizeof (struct so_list));
-+      struct cleanup *old_chain = make_cleanup (xfree, new);
-+
-+      memset (new, 0, sizeof (*new));
-+
-+      new->lm_info = xmalloc (sizeof (struct lm_info));
-+      make_cleanup (xfree, new->lm_info);
-+
-+      new->lm_info->lm = xmalloc (lmo->link_map_size);
-+      make_cleanup (xfree, new->lm_info->lm);
-+      memset (new->lm_info->lm, 0, lmo->link_map_size);
-+
-+      if (debug_solib)
-+        fprintf_unfiltered (gdb_stdlog,
-+                            "svr4_print_linkmap: read lm at %s\n", paddress (target_gdbarch, lm));
-+      read_memory (lm, new->lm_info->lm, lmo->link_map_size);
-+
-+      lm = LM_NEXT (new);
-+
-+      /* Load address.  */
-+      load_addr = LM_ADDR_CHECK (new, NULL);
-+      /* Shared object's name.  */
-+      target_read_string (LM_NAME (new), &buffer,
-+			  SO_NAME_MAX_PATH_SIZE - 1, &errcode);
-+      make_cleanup (xfree, buffer);
-+      if (errcode != 0)
-+	{
-+	  warning ("svr4_print_linkmap: Can't read pathname for load map: %s\n",
-+		   safe_strerror (errcode));
-+	}
-+      fprintf_filtered (gdb_stdout, "%-8s %-30s\n", paddress (target_gdbarch, load_addr), buffer);
-+      do_cleanups (old_chain);
-+    }
-+}                                                                                
-+
- 
- 
- struct target_so_ops svr4_so_ops;
-@@ -1985,4 +2327,7 @@ _initialize_svr4_solib (void)
-   svr4_so_ops.same = svr4_same;
- 
-   observer_attach_inferior_exit (solib_svr4_inferior_exit);
-+
-+  add_info ("linkmap", info_linkmap_command,
-+	    "Display the inferior's linkmap.");
- }
-Index: gdb-6.8.91.20090925/gdb/solib.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/solib.c	2009-09-25 10:25:38.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/solib.c	2009-09-25 10:25:45.000000000 +0200
-@@ -82,6 +82,8 @@ set_solib_ops (struct gdbarch *gdbarch, 
- 
- /* external data declarations */
- 
-+int debug_solib;
-+
- /* FIXME: gdbarch needs to control this variable, or else every
-    configuration needs to call set_solib_ops.  */
- struct target_so_ops *current_target_so_ops;
-@@ -105,6 +107,8 @@ The search path for loading non-absolute
- 		    value);
- }
- 
-+void add_to_target_sections (int, struct target_ops *, struct so_list *);
-+
- /*
- 
-    GLOBAL FUNCTION
-@@ -449,14 +453,38 @@ symbol_add_stub (struct so_list *so, int
-   /* Have we already loaded this shared object?  */
-   ALL_OBJFILES (so->objfile)
-     {
--      if (strcmp (so->objfile->name, so->so_name) == 0)
-+      /* Found an already loaded shared library.  */
-+      if (strcmp (so->objfile->name, so->so_name) == 0
-+	  && !so->main)
-+	return;
-+      /* Found an already loaded main executable.  This could happen in
-+	 two circumstances.
-+	 First case: the main file has already been read in
-+	 as the first thing that gdb does at startup, and the file
-+	 hasn't been relocated properly yet. Therefor we need to read
-+	 it in with the proper section info.
-+	 Second case: it has been read in with the correct relocation,
-+	 and therefore we need to skip it.  */
-+      if (strcmp (so->objfile->name, so->so_name) == 0
-+	  && so->main
-+	  && so->main_relocated)
- 	return;
-     }
- 
-   sap = build_section_addr_info_from_section_table (so->sections,
-                                                     so->sections_end);
- 
--  so->objfile = symbol_file_add_from_bfd (so->abfd, flags, sap, OBJF_SHARED);
-+  if (so->main)
-+    {
-+      if (debug_solib)
-+        fprintf_unfiltered (gdb_stdlog,
-+			    "symbol_add_stub: adding symbols for main\n");
-+      so->objfile = symbol_file_add_from_bfd (so->abfd, (flags & ~SYMFILE_VERBOSE) | SYMFILE_MAINLINE, sap, 0);
-+      so->main_relocated = 1;
-+    }
-+  else
-+    so->objfile = symbol_file_add_from_bfd (so->abfd, flags, sap, OBJF_SHARED);
-+
-   free_section_addr_info (sap);
- 
-   return;
-@@ -596,6 +624,10 @@ update_solib_list (int from_tty, struct 
- 	    }
- 	  else
- 	    {
-+	      if (debug_solib)
-+		fprintf_unfiltered (gdb_stdlog,
-+				    "update_solib_list: compare gdb:%s and inferior:%s\n",
-+				    gdb->so_original_name, i->so_original_name);
- 	      if (! strcmp (gdb->so_original_name, i->so_original_name))
- 		break;	      
- 	    }
-@@ -650,18 +682,7 @@ update_solib_list (int from_tty, struct 
-       /* Fill in the rest of each of the `struct so_list' nodes.  */
-       for (i = inferior; i; i = i->next)
- 	{
--	  i->from_tty = from_tty;
--
--	  /* Fill in the rest of the `struct so_list' node.  */
--	  catch_errors (solib_map_sections, i,
--			"Error while mapping shared library sections:\n",
--			RETURN_MASK_ALL);
--
--	  /* Add the shared object's sections to the current set of
--	     file section tables.  Do this immediately after mapping
--	     the object so that later nodes in the list can query this
--	     object, as is needed in solib-osf.c.  */
--	  add_target_sections (i->sections, i->sections_end);
-+	  add_to_target_sections (from_tty, target, i);
- 
- 	  /* Notify any observer that the shared object has been
-              loaded now that we've added it to GDB's tables.  */
-@@ -771,6 +792,32 @@ solib_add (char *pattern, int from_tty, 
-   }
- }
- 
-+void
-+add_to_target_sections (int from_tty, struct target_ops *target, struct so_list *solib)
-+{
-+  /* If this is set, then the sections have been already added to the
-+     target list.  */
-+  if (solib->main)
-+    return;
-+
-+  solib->from_tty = from_tty;
-+
-+  /* Fill in the rest of the `struct so_list' node.  */
-+  catch_errors (solib_map_sections, solib,
-+	       "Error while mapping shared library sections:\n",
-+	       RETURN_MASK_ALL);
-+
-+  if (debug_solib)
-+     fprintf_unfiltered (gdb_stdlog,
-+			 "add_to_target_sections: add %s to to_sections\n",
-+			 solib->so_original_name);
-+
-+  /* Add the shared object's sections to the current set of
-+     file section tables.  Do this immediately after mapping
-+     the object so that later nodes in the list can query this
-+     object, as is needed in solib-osf.c.  */
-+  add_target_sections (solib->sections, solib->sections_end);
-+}
- 
- /*
- 
-@@ -1189,4 +1236,12 @@ This takes precedence over the environme
- 				     reload_shared_libraries,
- 				     show_solib_search_path,
- 				     &setlist, &showlist);
-+
-+  add_setshow_boolean_cmd ("solib", no_class, &debug_solib,
-+			   _("\
-+Set debugging of GNU/Linux shlib module.\n"), _("\
-+Show debugging status of GNU/Linux shlib module.\n"), _("\
-+Enables printf debugging output of GNU/Linux shlib module.\n"),
-+			   NULL, NULL,
-+			   &setdebuglist, &showdebuglist);
- }
-Index: gdb-6.8.91.20090925/gdb/solist.h
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/solist.h	2009-09-25 10:25:38.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/solist.h	2009-09-25 10:25:45.000000000 +0200
-@@ -61,6 +61,8 @@ struct so_list
-     bfd *abfd;
-     char symbols_loaded;	/* flag: symbols read in yet? */
-     char from_tty;		/* flag: print msgs? */
-+    char main;                  /* flag: is this the main executable? */
-+    char main_relocated;        /* flag: has it been relocated yet? */
-     struct objfile *objfile;	/* objfile for loaded lib */
-     struct target_section *sections;
-     struct target_section *sections_end;
-@@ -147,4 +149,10 @@ struct symbol *solib_global_lookup (cons
- 				    const char *name,
- 				    const domain_enum domain);
- 
-+/* Add the list of sections in so_list to the target to_sections.  */
-+extern void add_to_target_sections (int, struct target_ops *, struct so_list *);
-+
-+/* Controls the printing of debugging output.  */
-+extern int debug_solib;
-+
- #endif
-Index: gdb-6.8.91.20090925/gdb/symfile-mem.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/symfile-mem.c	2009-09-25 10:25:38.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/symfile-mem.c	2009-09-25 10:25:45.000000000 +0200
-@@ -115,7 +115,7 @@ symbol_file_add_from_memory (struct bfd 
- 	++i;
-       }
- 
--  objf = symbol_file_add_from_bfd (nbfd, from_tty ? SYMFILE_VERBOSE : 0,
-+  objf = symbol_file_add_from_bfd (nbfd, (from_tty ? SYMFILE_VERBOSE : 0) | SYMFILE_MAINLINE2_BOTH,
-                                    sai, OBJF_SHARED);
- 
-   /* This might change our ideas about frames already looked at.  */
-Index: gdb-6.8.91.20090925/gdb/symfile.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/symfile.c	2009-09-25 10:25:39.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/symfile.c	2009-09-25 10:25:45.000000000 +0200
-@@ -49,6 +49,7 @@
- #include "readline/readline.h"
- #include "gdb_assert.h"
- #include "block.h"
-+#include "varobj.h"
- #include "observer.h"
- #include "exec.h"
- #include "parser-defs.h"
-@@ -779,7 +780,7 @@ syms_from_objfile (struct objfile *objfi
- 
-   /* Now either addrs or offsets is non-zero.  */
- 
--  if (mainline)
-+  if ((add_flags & SYMFILE_MAINLINE) && !(add_flags & SYMFILE_MAINLINE2_ONLY))
-     {
-       /* We will modify the main symbol table, make sure that all its users
-          will be cleaned up if an error occurs during symbol reading.  */
-@@ -807,7 +808,7 @@ syms_from_objfile (struct objfile *objfi
- 
-      We no longer warn if the lowest section is not a text segment (as
-      happens for the PA64 port.  */
--  if (!mainline && addrs && addrs->other[0].name)
-+  if (/*!mainline &&*/ addrs && addrs->other[0].name)
-     {
-       asection *lower_sect;
-       asection *sect;
-@@ -890,7 +891,7 @@ syms_from_objfile (struct objfile *objfi
-       init_objfile_sect_indices (objfile);
-     }
- 
--  (*objfile->sf->sym_read) (objfile, mainline);
-+  (*objfile->sf->sym_read) (objfile, add_flags & SYMFILE_MAINLINE2_ONLY ? 2 : (add_flags & SYMFILE_MAINLINE ? 1 : 0));
- 
-   /* Discard cleanups as symbol reading was successful.  */
- 
-@@ -909,17 +910,22 @@ new_symfile_objfile (struct objfile *obj
-   /* If this is the main symbol file we have to clean up all users of the
-      old main symbol file. Otherwise it is sufficient to fixup all the
-      breakpoints that may have been redefined by this symbol file.  */
--  if (add_flags & SYMFILE_MAINLINE)
-+  if (add_flags & SYMFILE_MAINLINE && !(add_flags & SYMFILE_MAINLINE2_ONLY))
-     {
-       /* OK, make it the "real" symbol file.  */
-       symfile_objfile = objfile;
- 
-       clear_symtab_users ();
-     }
--  else if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
-+  else if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0
-+           && (add_flags & SYMFILE_MAINLINE2_BOTH) == 0)
-     {
-       breakpoint_re_set ();
-     }
-+  else
-+    {
-+      /* Don't reset breakpoints or it will screw up PIE.  */
-+    }
- 
-   /* We're done reading the symbol file; finish off complaints.  */
-   clear_complaints (&symfile_complaints, 0, add_flags & SYMFILE_VERBOSE);
-@@ -973,7 +979,7 @@ symbol_file_add_with_addrs_or_offsets (b
-   /* Give user a chance to burp if we'd be
-      interactively wiping out any existing symbols.  */
- 
--  if ((add_flags & SYMFILE_MAINLINE)
-+  if ((add_flags & SYMFILE_MAINLINE) && !(add_flags & SYMFILE_MAINLINE2_ONLY)
-       && (have_full_symbols () || have_partial_symbols ())
-       && from_tty
-       && (have_full_symbols () || have_partial_symbols ())
-@@ -1163,6 +1169,9 @@ symbol_file_clear (int from_tty)
- 		    symfile_objfile->name)
- 	  : !query (_("Discard symbol table? "))))
-     error (_("Not confirmed."));
-+#ifdef CLEAR_SOLIB
-+      CLEAR_SOLIB ();
-+#endif
- 
-   free_all_objfiles ();
- 
-@@ -3367,6 +3376,8 @@ reread_symbols (void)
- 	      /* Discard cleanups as symbol reading was successful.  */
- 	      discard_cleanups (old_cleanups);
- 
-+	      init_entry_point_info (objfile);
-+
- 	      /* If the mtime has changed between the time we set new_modtime
- 	         and now, we *want* this to be out of date, so don't call stat
- 	         again now.  */
-Index: gdb-6.8.91.20090925/gdb/target.h
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/target.h	2009-09-25 10:25:38.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/target.h	2009-09-25 10:25:45.000000000 +0200
-@@ -545,7 +545,7 @@ struct target_ops
-        Return -1 if there is insufficient buffer for a whole entry.
-        Return 1 if an entry was read into *TYPEP and *VALP.  */
-     int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr,
--                         gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp);
-+                         gdb_byte *endptr, ULONGEST *typep, CORE_ADDR *valp);
- 
-     /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
-        sequence of bytes in PATTERN with length PATTERN_LEN.
-Index: gdb-6.8.91.20090925/gdb/symfile.h
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/symfile.h	2009-09-25 10:25:39.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/symfile.h	2009-09-25 10:25:45.000000000 +0200
-@@ -229,7 +229,13 @@ enum symfile_add_flags
-     SYMFILE_MAINLINE = 1 << 2,
- 
-     /* Do not call breakpoint_re_set when adding this symbol file.  */
--    SYMFILE_DEFER_BP_RESET = 1 << 3
-+    SYMFILE_DEFER_BP_RESET = 1 << 3,
-+
-+    /* Red Hat PIE patch: Like SYMFILE_MAINLINE but for mainline == 2.
-+       Former code was checking `if (mainline)' being satisfied both by
-+       standard 1 and rare 2, simulate it here.  */
-+    SYMFILE_MAINLINE2_ONLY = 1 << 4,
-+    SYMFILE_MAINLINE2_BOTH = SYMFILE_MAINLINE2_ONLY | SYMFILE_MAINLINE
-   };
- 
- extern void syms_from_objfile (struct objfile *,
-Index: gdb-6.8.91.20090925/gdb/infcmd.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/infcmd.c	2009-09-25 10:25:39.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/infcmd.c	2009-09-25 10:25:45.000000000 +0200
-@@ -2308,6 +2308,9 @@ attach_command_post_wait (char *args, in
- 
-   post_create_inferior (&current_target, from_tty);
- 
-+  /* Undo the disable from post_create_inferior.  */
-+  enable_breakpoints_after_startup ();
-+
-   /* Install inferior's terminal modes.  */
-   target_terminal_inferior ();
- 
-Index: gdb-6.8.91.20090925/gdb/linux-tdep.c
-===================================================================
---- gdb-6.8.91.20090925.orig/gdb/linux-tdep.c	2009-08-04 22:41:13.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/linux-tdep.c	2009-09-25 10:25:45.000000000 +0200
-@@ -163,5 +163,7 @@ in this session.\n"));
- void
- _initialize_linux_tdep (void)
- {
-+#if 0 /* gdb-6.3-pie-20050110.patch */
-   observer_attach_executable_changed (check_is_pie_binary);
-+#endif
- }
diff --git a/gdb-6.3-rh-testversion-20041202.patch b/gdb-6.3-rh-testversion-20041202.patch
index 0205f0f..1e739db 100644
--- a/gdb-6.3-rh-testversion-20041202.patch
+++ b/gdb-6.3-rh-testversion-20041202.patch
@@ -11,8 +11,8 @@ Index: gdb-6.8/gdb/testsuite/gdb.gdb/selftest.exp
  	-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
  	    pass "printed version with cast"
  	}
-+	-re ".\[0-9\]+ = .Fedora \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
-+	    pass "printed version Fedora only"
++	-re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
++	    pass "printed version Fedora or Red Hat Enterprise Linux only"
 +	}
  	-re ".*$gdb_prompt $"	{ fail "printed version" }
  	timeout		{ fail "(timeout) printed version" }
diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch
index cccf89b..182a733 100644
--- a/gdb-6.3-test-dtorfix-20050121.patch
+++ b/gdb-6.3-test-dtorfix-20050121.patch
@@ -129,7 +129,7 @@ Index: gdb/testsuite/ChangeLog
 +}
 --- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix	Fri Jan 21 17:07:02 2005
 +++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp	Fri Jan 21 17:05:29 2005
-@@ -0,0 +1,131 @@
+@@ -0,0 +1,137 @@
 +# This testcase is part of GDB, the GNU debugger.
 +
 +# Copyright 2005, 2007 Free Software Foundation, Inc.
@@ -179,8 +179,9 @@ Index: gdb/testsuite/ChangeLog
 +    gdb_suppress_tests
 +}
 +
-+# Break on the various forms of the A::A constructor
-+gdb_test "break A\:\:A" "Breakpoint 2 at .* \\(2 locations\\)" "breaking on A::A"
++# Break on the various forms of the A::A constructor.
++# " (2 locations)" is displayed depending on G++ version.
++gdb_test "break A\:\:A" "Breakpoint 2 at .*" "breaking on A::A"
 +        
 +# Verify that we break for the A constructor two times
 +# Once for new A and once for new B
@@ -206,7 +207,8 @@ Index: gdb/testsuite/ChangeLog
 +gdb_test "break 'A::A()'" "" "break in constructor A 2"
 +gdb_continue_to_breakpoint "First line A"
 +set second_line [gdb_get_line_number "Second line A"]
-+gdb_test "break $second_line" "Breakpoint .*, line $second_line. \\(2 locations\\)" "break by line in constructor"
++# " (2 locations)" is displayed depending on G++ version.
++gdb_test "break $second_line" "Breakpoint .*, line $second_line\\..*" "break by line in constructor"
 +gdb_continue_to_breakpoint "Second line A"
 +gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
 +gdb_continue_to_breakpoint "Second line A"
@@ -217,7 +219,8 @@ Index: gdb/testsuite/ChangeLog
 +gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
 +gdb_continue_to_breakpoint "First line ~A"
 +set second_line_dtor [gdb_get_line_number "Second line ~A"]
-+gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor. \\(2 locations\\)" "break by line in destructor"
++# " (2 locations)" is displayed depending on G++ version.
++gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor\\..*" "break by line in destructor"
 +gdb_continue_to_breakpoint "Second line ~A"
 +gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
 +# FIXME: Analyse this case better.
@@ -232,8 +235,11 @@ Index: gdb/testsuite/ChangeLog
 +gdb_load ${binfile}
 +runto_main
 +
++set first_line_dtor [gdb_get_line_number "First line ~C"]
++set define_line_dtor [gdb_get_line_number "Destructor C"]
 +# Break on the various forms of the C::~C destructor
-+gdb_test "break C\:\:~C" "Breakpoint .* \\(3 locations\\)" "breaking on C::~C"
++# " ([23] locations)" is displayed depending on G++ version.
++gdb_test "break C\:\:~C" "Breakpoint .*, line ($define_line_dtor|$define_line_dtor)\\..*" "breaking on C::~C"
 +gdb_continue_to_breakpoint "First line ~C"
 +
 +# Verify that we can break by line number in a destructor and find
@@ -242,8 +248,8 @@ Index: gdb/testsuite/ChangeLog
 +gdb_load ${binfile}
 +delete_breakpoints
 +
-+set first_line_dtor [gdb_get_line_number "First line ~C"]
-+gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor. \\(3 locations\\)" "break by line in destructor"
++# " (3 locations)" is displayed depending on G++ version.
++gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor\\..*" "break by line in destructor"
 +
 +# Run to `main' where we begin our tests.
 +# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.
diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch
index ff270bb..cb01866 100644
--- a/gdb-6.3-test-pie-20050107.patch
+++ b/gdb-6.3-test-pie-20050107.patch
@@ -436,7 +436,7 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp	2009-09-09 19:06:01.000000000 +0200
-@@ -0,0 +1,432 @@
+@@ -0,0 +1,433 @@
 +#   Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
@@ -817,7 +817,8 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
 +      -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" {
 +         fail "attach call, read register 3 error"
 +     }
-+     -re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" {
++     -re "Attaching to.*process $testpid.*$gdb_prompt $" {
++         # libc is relocated, not relocated, therefore not printed.
 +         pass "attach call"
 +     }
 +      -re "$gdb_prompt $" {fail "attach call"}
diff --git a/gdb-6.3-watchpoint-cond-gone-test.patch b/gdb-6.3-watchpoint-cond-gone-test.patch
deleted file mode 100644
index f2334ad..0000000
--- a/gdb-6.3-watchpoint-cond-gone-test.patch
+++ /dev/null
@@ -1,128 +0,0 @@
---- /dev/null	2008-04-03 00:39:30.714021604 +0200
-+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c	2008-04-05 20:26:29.000000000 +0200
-@@ -0,0 +1,23 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   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 2 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, write to the Free Software
-+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-+
-+void
-+jumper (void (*jumpto) (void))
-+{
-+  (*jumpto) ();
-+}
---- /dev/null	2008-04-03 00:39:30.714021604 +0200
-+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.c	2008-04-05 20:26:48.000000000 +0200
-@@ -0,0 +1,37 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   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 2 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, write to the Free Software
-+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-+
-+extern void jumper (void (*jumpto) (void));
-+
-+void
-+func ()
-+{
-+	int a, b, c;
-+
-+	a = b = c = 5;
-+	a = b = c = 10;	/* watchpoint-here */
-+	c = a + b;
-+}
-+
-+int
-+main ()
-+{
-+	jumper (func);
-+
-+	return 0;
-+}
---- /dev/null	2008-04-03 00:39:30.714021604 +0200
-+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp	2008-04-05 20:33:19.000000000 +0200
-@@ -0,0 +1,59 @@
-+# 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 2 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, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+if $tracelevel then {
-+    strace $tracelevel
-+}
-+
-+set testfile "watchpoint-cond-gone"
-+set srcfile ${testfile}.c
-+set srcfilestripped ${testfile}-stripped.c
-+set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
-+set binfile ${objdir}/${subdir}/${testfile}
-+
-+# We need to generate a function without DWARF to crash older GDB.
-+# Stepping into a dynamic function trampoline or stepping out of MAIN may work
-+# but it is not a reliable FAIL case.
-+
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != "" } {
-+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-+}
-+
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
-+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-+}
-+
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+
-+# Problem does not occur otherwise.
-+gdb_test "set can-use-hw-watchpoints 0"
-+
-+runto_main
-+gdb_breakpoint [gdb_get_line_number "watchpoint-here"]
-+gdb_continue_to_breakpoint "Place to set the watchpoint"
-+
-+# The condition `c == 30' is the tested culprit.
-+gdb_test "watch c if c == 30" "" "Place the watchpoint"
-+
-+# No functionality, just to check the state.
-+gdb_test "backtrace"
-+
-+gdb_test "finish" \
-+         "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \
-+         "Catch the no longer valid watchpoint"
diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch
index 1554f7b..c10acbd 100644
--- a/gdb-6.5-bz216711-clone-is-outermost.patch
+++ b/gdb-6.5-bz216711-clone-is-outermost.patch
@@ -162,6 +162,155 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c
  };
  
  /* Floating-point registers.  */
+--- a/gdb/ia64-tdep.c
++++ b/gdb/ia64-tdep.c
+@@ -2122,6 +2122,138 @@ static const struct frame_unwind ia64_frame_unwind =
+   default_frame_sniffer
+ };
+ 
++/* Detect the outermost frame; during unwind of
++   	#6  0x2000000000347100 in __clone2 () from /lib/libc.so.6.1
++   avoid the additional bogus frame
++   	#7  0x0000000000000000 in ?? ()  */
++
++static char linux_clone2_code[] =
++{
++/* libc/sysdeps/unix/sysv/linux/ia64/clone2.S */
++  0x09, 0x00, 0x20, 0x12, 0x90, 0x11, 0x00, 0x40,
++  0x28, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
++/*         st4 [r9]=r8 */
++/*         st4 [r10]=r8 */
++/*         ;; */
++/* #endif */
++  0x02, 0x50, 0x21, 0x40, 0x18, 0x14, 0x90, 0x02,
++  0x90, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
++/* 1:      ld8 out1=[in0],8        |* Retrieve code pointer.       *| */
++/*         mov out0=in4            |* Pass proper argument to fn *| */
++/*         ;; */
++  0x11, 0x08, 0x00, 0x40, 0x18, 0x10, 0x60, 0x50,
++  0x05, 0x80, 0x03, 0x00, 0x68, 0x00, 0x80, 0x12,
++/*         ld8 gp=[in0]            |* Load function gp.            *| */
++/*         mov b6=out1 */
++/*         br.call.dptk.many rp=b6 |* Call fn(arg) in the child    *| */
++/*         ;; */
++  0x10, 0x48, 0x01, 0x10, 0x00, 0x21, 0x10, 0x00,
++  0xa0, 0x00, 0x42, 0x00, 0x98, 0xdf, 0xf7, 0x5b,
++/*         mov out0=r8             |* Argument to _exit            *| */
++/*         mov gp=loc0 */
++/*         .globl HIDDEN_JUMPTARGET(_exit) */
++/*         br.call.dpnt.many rp=HIDDEN_JUMPTARGET(_exit) */
++/*                                 |* call _exit with result from fn.      *| */
++  0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
++  0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x84, 0x00
++/*         ret                     |* Not reached.         *| */
++};
++
++#define LINUX_CLONE_PRE_SLOTS 3	/* Number of slots before PC.  */
++#define LINUX_CLONE_LEN (sizeof linux_clone2_code)
++
++static int
++ia64_linux_clone2_running (struct frame_info *this_frame)
++{
++  CORE_ADDR pc = get_frame_pc (this_frame);
++  char buf[LINUX_CLONE_LEN];
++  struct minimal_symbol *minsym;
++  long long instr;
++
++  if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_PRE_SLOTS * 16,
++				 buf, LINUX_CLONE_LEN))
++    return 0;
++
++  if (memcmp (buf, linux_clone2_code, LINUX_CLONE_PRE_SLOTS * 16) != 0)
++    return 0;
++
++  /* Adjust the expected "_exit" address.  */
++  minsym = lookup_minimal_symbol_text ("_exit", NULL);
++  if (minsym == NULL)
++    return 0;
++
++  instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
++  instr &= ~(((1L << 20) - 1) << 13);
++  /* Address is relative to the jump instruction slot, not the next one.  */
++  instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
++	    & ((1L << 20) - 1)) << 13;
++  replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
++			  2);
++
++  if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
++              &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],
++	      LINUX_CLONE_LEN - (LINUX_CLONE_PRE_SLOTS * 16)) != 0)
++    return 0;
++
++  return 1;
++}
++
++static int
++ia64_outermost_frame (struct frame_info *this_frame)
++{
++  CORE_ADDR pc = get_frame_pc (this_frame);
++  char *name;
++
++  find_pc_partial_function (pc, &name, NULL, NULL);
++
++  /* If we have NAME, we can optimize the search.
++     `clone' NAME still needs to have the code checked as its name may be
++     present in the user code.
++     `__clone' NAME should not be present in the user code but in the initial
++     parts of the `__clone' implementation the unwind still makes sense.
++     More detailed unwinding decision would be too much sensitive to possible
++     subtle changes in specific glibc revisions.  */
++  if (name == NULL || strcmp (name, "clone2") == 0
++      || strcmp ("__clone2", name) == 0)
++    return (ia64_linux_clone2_running (this_frame) != 0);
++
++  return 0;
++}
++
++static void
++ia64_clone2_frame_this_id (struct frame_info *this_frame, void **this_cache,
++			   struct frame_id *this_id)
++{
++  /* Leave the default outermost frame at *THIS_ID.  */
++}
++
++static struct value *
++ia64_clone2_frame_prev_register (struct frame_info *this_frame,
++				 void **this_cache, int regnum)
++{
++  return frame_unwind_got_register (this_frame, regnum, regnum);
++}
++
++static int
++ia64_clone2_frame_sniffer (const struct frame_unwind *self,
++			   struct frame_info *this_frame,
++			   void **this_prologue_cache)
++{
++  if (ia64_outermost_frame (this_frame))
++    return 1;
++
++  return 0;
++}
++
++static const struct frame_unwind ia64_clone2_frame_unwind =
++{
++  NORMAL_FRAME,
++  &ia64_clone2_frame_this_id,
++  &ia64_clone2_frame_prev_register,
++  NULL,
++  &ia64_clone2_frame_sniffer
++};
++
+ /* Signal trampolines.  */
+ 
+ static void
+@@ -3824,6 +3955,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+   set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
+ 
+   set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
++  frame_unwind_append_unwinder (gdbarch, &ia64_clone2_frame_unwind);
+ #ifdef HAVE_LIBUNWIND_IA64_H
+   frame_unwind_append_unwinder (gdbarch,
+                                 &ia64_libunwind_sigtramp_frame_unwind);
 Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
diff --git a/gdb-6.6-buildid-locate-rpm-suse.patch b/gdb-6.6-buildid-locate-rpm-suse.patch
index 146f33e..6c0a693 100644
--- a/gdb-6.6-buildid-locate-rpm-suse.patch
+++ b/gdb-6.6-buildid-locate-rpm-suse.patch
@@ -1,13 +1,14 @@
-Index: gdb-6.8.50.20090803/gdb/symfile.c
+Index: gdb-7.0.1/gdb/symfile.c
 ===================================================================
---- gdb-6.8.50.20090803.orig/gdb/symfile.c	2009-08-06 12:20:16.000000000 +0200
-+++ gdb-6.8.50.20090803/gdb/symfile.c	2009-08-06 12:20:16.000000000 +0200
-@@ -2203,8 +2203,12 @@ debug_print_missing (const char *binary,
+--- gdb-7.0.1.orig/gdb/symfile.c	2010-03-11 15:49:51.000000000 +0100
++++ gdb-7.0.1/gdb/symfile.c	2010-03-11 15:51:47.000000000 +0100
+@@ -2308,9 +2308,12 @@ debug_print_missing (const char *binary,
  	fprintf_unfiltered (gdb_stdlog,
  			    _("Missing separate debuginfo for %s\n"), binary);
          if (debug != NULL)
 -	  fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
--			      "yum --enablerepo='*-debuginfo' install", debug);
+-			      "yum --disablerepo='*' --enablerepo='*-debuginfo'"
+-			      " install", debug);
 +	  {
 +	    const char *p = strrchr (debug, '/');
 +	    fprintf_unfiltered (gdb_stdlog, _("Try: %s%.2s%.38s\"\n"),
@@ -17,4 +18,3 @@ Index: gdb-6.8.50.20090803/gdb/symfile.c
        }
  }
  
-
diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch
index 2344406..0c06185 100644
--- a/gdb-6.6-buildid-locate-rpm.patch
+++ b/gdb-6.6-buildid-locate-rpm.patch
@@ -48,7 +48,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
  
  
  int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
-@@ -1673,8 +1675,352 @@ build_id_to_filename (struct build_id *b
+@@ -1673,8 +1675,353 @@ build_id_to_filename (struct build_id *b
    return retval;
  }
  
@@ -258,7 +258,8 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
 +
 +	  /* Base package name for `debuginfo-install'.  We do not use the
 +	     `yum' command directly as the line
-+		 yum --enablerepo='*-debuginfo' install NAME-debuginfo.ARCH
++		 yum --disablerepo='*' --enablerepo='*-debuginfo' \
++		     install NAME-debuginfo.ARCH
 +	     would be more complicated than just:
 +		 debuginfo-install NAME-VERSION-RELEASE.ARCH
 +	     Do not supply the rpm base name (derived from .src.rpm name) as
@@ -398,7 +399,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
 +
  /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
 -     Try to install the hash file ...
-+     yum --enablerepo='*-debuginfo' install ...
++     yum --disablerepo='*' --enablerepo='*-debuginfo' install ...
     avoidance.  */
  
  struct missing_filepair
@@ -420,7 +421,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
    missing_filepair_change ();
  }
  
-@@ -1799,14 +2151,33 @@ debug_print_missing (const char *binary,
+@@ -1799,14 +2151,34 @@ debug_print_missing (const char *binary,
  
    *slot = missing_filepair;
  
@@ -456,7 +457,8 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
 +			    _("Missing separate debuginfo for %s\n"), binary);
 +        if (debug != NULL)
 +	  fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
-+			      "yum --enablerepo='*-debuginfo' install", debug);
++			      "yum --disablerepo='*' --enablerepo='*-debuginfo'"
++			      " install", debug);
 +      }
  }
  
diff --git a/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch
index 85a242e..4d3c3da 100644
--- a/gdb-6.7-testsuite-stable-results.patch
+++ b/gdb-6.7-testsuite-stable-results.patch
@@ -102,3 +102,154 @@ frames-invalid can happen asynchronously.
  
  set timeout $oldtimeout
  return 0
+
+
+
+http://sourceware.org/ml/gdb-patches/2009-12/msg00234.html
+Subject: [patch] testsuite: Fix a race by me - watchthreads-reorder.exp
+
+Hi,
+
+there is a bug explainable by man pthread_cond_signal:
+	The [...] pthread_cond_signal() functions shall have no effect if
+	there are no threads currently blocked on cond.
+
+meaning a race for the testcase.
+	+FAIL: gdb.threads/watchthreads-reorder.exp: reorder1: continue a (timeout)
+
+One can reproduce the race on CVS HEAD by:
+#	--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.c
+#	+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
+#	@@ -89,6 +89,7 @@ thread1_func (void *unused)
+#	   int i;
+#	   volatile int rwatch_store;
+#	 
+#	+sleep(1);
+#	   thread1_tid = gettid ();
+#	   i = pthread_cond_signal (&thread1_tid_cond);
+#	   assert (i == 0);
+#	@@ -317,6 +318,7 @@ main (int argc, char **argv)
+#	 
+#	   if (thread1_tid == 0)
+#	     {
+#	+sleep(2);
+#	       i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
+#	       assert (i == 0);
+#	 
+
+Fixed; gdbstop_mutex got removed as it became redundant there.
+
+Going to check it in as obvious in several days (code is by me + it is just
+a testcase).
+
+
+Sorry,
+Jan
+
+
+gdb/testsuite/
+2009-12-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.threads/watchthreads-reorder.c (gdbstop_mutex): Remove.
+	(thread1_func): Protect thread1_tid_cond by thread1_tid_mutex.  Remove
+	gdbstop_mutex handling.
+	(thread2_func): Protect thread2_tid_cond by thread2_tid_mutex.  Remove
+	gdbstop_mutex handling.
+	(main): Move thread1_tid_mutex and thread2_tid_mutex locks before
+	pthread_create.  Remove gdbstop_mutex handling.  New comment.  Remove
+	pthread_cond_wait conditionalizations.
+
+--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.c
++++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
+@@ -34,8 +34,6 @@
+    otherwise.  */
+ #define TIMEOUT (gettid () == getpid() ? 10 : 15)
+ 
+-static pthread_mutex_t gdbstop_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+-
+ 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;
+@@ -90,12 +88,11 @@ thread1_func (void *unused)
+   volatile int rwatch_store;
+ 
+   thread1_tid = gettid ();
++
++  timed_mutex_lock (&thread1_tid_mutex);
+   i = pthread_cond_signal (&thread1_tid_cond);
+   assert (i == 0);
+-
+-  /* Be sure GDB is already stopped before continuing.  */
+-  timed_mutex_lock (&gdbstop_mutex);
+-  i = pthread_mutex_unlock (&gdbstop_mutex);
++  i = pthread_mutex_unlock (&thread1_tid_mutex);
+   assert (i == 0);
+ 
+   rwatch_store = thread1_rwatch;
+@@ -115,12 +112,11 @@ thread2_func (void *unused)
+   volatile int rwatch_store;
+ 
+   thread2_tid = gettid ();
++
++  timed_mutex_lock (&thread2_tid_mutex);
+   i = pthread_cond_signal (&thread2_tid_cond);
+   assert (i == 0);
+-
+-  /* Be sure GDB is already stopped before continuing.  */
+-  timed_mutex_lock (&gdbstop_mutex);
+-  i = pthread_mutex_unlock (&gdbstop_mutex);
++  i = pthread_mutex_unlock (&thread2_tid_mutex);
+   assert (i == 0);
+ 
+   rwatch_store = thread2_rwatch;
+@@ -267,7 +263,8 @@ main (int argc, char **argv)
+ 
+   setbuf (stdout, NULL);
+ 
+-  timed_mutex_lock (&gdbstop_mutex);
++  timed_mutex_lock (&thread1_tid_mutex);
++  timed_mutex_lock (&thread2_tid_mutex);
+ 
+   timed_mutex_lock (&terminate_mutex);
+ 
+@@ -306,30 +303,21 @@ main (int argc, char **argv)
+       state_wait (tracer, "T (stopped)");
+     }
+ 
+-  timed_mutex_lock (&thread1_tid_mutex);
+-  timed_mutex_lock (&thread2_tid_mutex);
+-
+-  /* Let the threads start.  */
+-  i = pthread_mutex_unlock (&gdbstop_mutex);
+-  assert (i == 0);
++  /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so
++     they could not trigger the watchpoints before GDB gets unstopped later.
++     Threads get resumed at pthread_cond_wait below.  */
+ 
+   printf ("Waiting till the threads initialize their TIDs.\n");
+ 
+-  if (thread1_tid == 0)
+-    {
+-      i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
+-      assert (i == 0);
++  i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
++  assert (i == 0);
+ 
+-      assert (thread1_tid > 0);
+-    }
++  assert (thread1_tid > 0);
+ 
+-  if (thread2_tid == 0)
+-    {
+-      i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
+-      assert (i == 0);
++  i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
++  assert (i == 0);
+ 
+-      assert (thread2_tid > 0);
+-    }
++  assert (thread2_tid > 0);
+ 
+   printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n",
+ 	  (unsigned long) thread1_tid, (unsigned long) thread2_tid,
+
diff --git a/gdb-6.8-inlining-addon.patch b/gdb-6.8-inlining-addon.patch
index d6c5170..e3be953 100644
--- a/gdb-6.8-inlining-addon.patch
+++ b/gdb-6.8-inlining-addon.patch
@@ -236,19 +236,19 @@ Index: gdb-6.8.91.20090917/gdb/breakpoint.c
      {
        int value_is_zero = 0;
        
-@@ -3383,6 +3398,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
- 	    bs->print = 0;
- 	  }
- 	bs->commands = copy_command_lines (bs->commands);
+@@ -3399,6 +3399,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
+ 		  bs->print = 0;
+ 		}
+ 	      bs->commands = copy_command_lines (bs->commands);
 +
-+	/* Display the innermost inlined frame at a breakpont as it gives to
-+	   most of the available information.  */
-+	if (b->type != bp_until && b->type != bp_finish)
-+	  while (inline_skipped_frames (ptid))
-+	    step_into_inline_frame (ptid);
-       }
++	      /* Display the innermost inlined frame at a breakpont as it gives to
++		 most of the available information.  */
++	      if (b->type != bp_until && b->type != bp_finish)
++		while (inline_skipped_frames (ptid))
++		  step_into_inline_frame (ptid);
+ 	    }
  
-     /* Print nothing for this entry if we dont stop or if we dont print.  */
+ 	  /* Print nothing for this entry if we dont stop or if we dont print.  */
 @@ -5572,9 +5593,9 @@ set_momentary_breakpoint (struct gdbarch
  {
    struct breakpoint *b;
diff --git a/gdb-7.0-upstream.patch b/gdb-7.0-upstream.patch
new file mode 100644
index 0000000..c593a0d
--- /dev/null
+++ b/gdb-7.0-upstream.patch
@@ -0,0 +1,229 @@
+
+
+
+http://sourceware.org/ml/gdb-patches/2009-11/msg00388.html
+http://sourceware.org/ml/gdb-cvs/2009-11/msg00156.html
+Subject: [patch] Fix crash on reading stabs
+
+Hi,
+
+there is a crash on reading stabs fpc binary:
+	https://bugzilla.redhat.com/show_bug.cgi?id=537837
+
+Program received signal SIGSEGV, Segmentation fault.
+0x000000000069db3d in read_dbx_symtab (objfile=0x1daf5f0) at dbxread.c:1369
+1369              if ((namestring[0] == '-' && namestring[1] == 'l')
+
+(gdb) p/x nlist.n_strx
+$7 = 0xfffffff8
+(gdb) p sizeof(nlist.n_strx)
+$10 = 8
+
+Below the patch context is:
+    namestring = (nlist->n_strx + file_string_table_offset
+                  + DBX_STRINGTAB (objfile));
+
+so IMO the `(unsigned)' cast is excessive as it does not match the expression
+below.  Such cast is there since the GDB "Initial revision" (1999).
+
+`n_strx' type:
+struct internal_nlist
+{
+  unsigned long n_strx;                 /* Index into string table of name.  */
+...
+};
+
+Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu which does not
+mean anything with the default DWARF debug info.  It was hanging for stabs so
+tried just a large part of gdb.base/*.exp on x86_64-m32 - `unix/-gstabs+/-m32'.
+
+If it isn't obviously approved please feel free to drop it as one should not
+use STABS in the first place.
+
+
+Regards,
+Jan
+
+
+gdb/
+2009-11-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* dbxread.c (set_namestring): Remove cast to unsigned.  Check N_STRX
+	overflow.
+
+--- a/gdb/dbxread.c
++++ b/gdb/dbxread.c
+@@ -965,8 +965,9 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
+ {
+   char *namestring;
+ 
+-  if (((unsigned) nlist->n_strx + file_string_table_offset)
+-      >= DBX_STRINGTAB_SIZE (objfile))
++  if (nlist->n_strx + file_string_table_offset
++      >= DBX_STRINGTAB_SIZE (objfile)
++      || nlist->n_strx + file_string_table_offset < nlist->n_strx)
+     {
+       complaint (&symfile_complaints, _("bad string table offset in symbol %d"),
+ 		 symnum);
+
+
+
+Re: [RFA] Fix "show convenience" test
+http://sourceware.org/ml/gdb-patches/2009-09/msg00565.html
+http://sourceware.org/ml/gdb-cvs/2009-09/msg00099.html
+
+### src/gdb/testsuite/ChangeLog	2009/09/15 18:51:25	1.1960
+### src/gdb/testsuite/ChangeLog	2009/09/17 17:49:46	1.1961
+## -1,3 +1,7 @@
++2009-09-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
++
++	* gdb.base/default.exp: Fix "show convenience".
++
+ 2009-09-15  Tom Tromey  <tromey@redhat.com>
+ 
+ 	* lib/mi-support.exp (mi_create_varobj): Update.
+--- src/gdb/testsuite/gdb.base/default.exp	2009/08/13 14:58:27	1.31
++++ src/gdb/testsuite/gdb.base/default.exp	2009/09/17 17:49:46	1.32
+@@ -598,7 +598,7 @@
+ #test show confirm
+ gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm"
+ #test show convenience
+-gdb_test "show convenience" "No debugger convenience variables now defined.(\[^\r\n\]*\[\r\n\])+Convenience variables have names starting with \".\";(\[^\r\n\]*\[\r\n\])+use \"set\" as in \"set .foo = 5\" to define them." "show convenience"
++gdb_test "show convenience" "\\\$_siginfo = void" "show convenience"
+ #test show directories
+ gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd" "show directories"
+ #test show editing
+### src/gdb/doc/ChangeLog	2009/09/15 18:51:24	1.953
+### src/gdb/doc/ChangeLog	2009/09/17 17:49:46	1.954
+## -1,3 +1,8 @@
++2009-09-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
++
++	* gdb.texinfo (convenince variables): Mention
++	$_siginfo could be empty.
++	
+ 2009-09-15  Tom Tromey  <tromey@redhat.com>
+ 
+ 	* gdb.texinfo (GDB/MI Variable Objects): Document
+--- src/gdb/doc/gdb.texinfo	2009/09/15 18:51:25	1.624
++++ src/gdb/doc/gdb.texinfo	2009/09/17 17:49:46	1.625
+@@ -7819,8 +7819,10 @@
+ 
+ @item $_siginfo
+ @vindex $_siginfo@r{, convenience variable}
+-The variable @code{$_siginfo} is bound to extra signal information
+-inspection (@pxref{extra signal information}).
++The variable @code{$_siginfo} contains extra signal information
++(@pxref{extra signal information}).  Note that @code{$_siginfo}
++could be empty, if the application has not yet received any signals.
++For example, it will be empty before you execute the @code{run} command.
+ @end table
+ 
+ On HP-UX systems, if you refer to a function or variable name that
+
+
+
+http://sourceware.org/ml/gdb-cvs/2009-12/msg00128.html
+
+### src/gdb/testsuite/ChangeLog	2009/12/23 23:18:08	1.2054
+### src/gdb/testsuite/ChangeLog	2009/12/24 21:57:06	1.2055
+## -1,3 +1,10 @@
++2009-12-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	Fix compatibility with G++-4.5.
++	* gdb.cp/expand-sals.cc (main): Remove the "exit-line" comment.
++	* gdb.cp/expand-sals.exp: Remove breakpoint on "exit-line".
++	(uncaught return): Remove.
++
+ 2009-12-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
+ 	    Phil Muldoon  <pmuldoon@redhat.com>
+ 
+--- src/gdb/testsuite/gdb.cp/expand-sals.cc	2009/05/11 15:05:56	1.1
++++ src/gdb/testsuite/gdb.cp/expand-sals.cc	2009/12/24 21:57:06	1.2
+@@ -49,5 +49,5 @@
+   A a;
+   B b;
+ 
+-  return 0;	/* exit-line */
++  return 0;
+ }
+--- src/gdb/testsuite/gdb.cp/expand-sals.exp	2009/05/11 15:05:56	1.1
++++ src/gdb/testsuite/gdb.cp/expand-sals.exp	2009/12/24 21:57:06	1.2
+@@ -23,8 +23,6 @@
+     return -1
+ }
+ 
+-gdb_breakpoint [gdb_get_line_number "exit-line"]
+-
+ gdb_breakpoint [gdb_get_line_number "func-line"]
+ gdb_continue_to_breakpoint "func" ".*func-line.*"
+ 
+@@ -52,7 +50,3 @@
+ 	 "bt from A"
+ 
+ gdb_continue_to_breakpoint "next caller func" ".*func-line.*"
+-
+-# Verify GDB really could not catch any other breakpoint location.
+-
+-gdb_continue_to_breakpoint "uncaught return" ".*exit-line.*"
+
+
+
+http://sourceware.org/ml/gdb-cvs/2009-11/msg00213.html
+
+[ cut ]
+
+--- src/gdb/testsuite/gdb.base/condbreak.exp	2009/01/03 05:58:03	1.13
++++ src/gdb/testsuite/gdb.base/condbreak.exp	2009/11/25 20:43:29	1.14
+@@ -207,10 +207,10 @@
+ setup_xfail hppa2.0w-*-* 11512CLLbs
+ send_gdb "continue\n"
+ gdb_expect {
+-    -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
++    -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
+ 	pass "run until breakpoint at marker2"
+     }
+-    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
++    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
+ 	xfail "run until breakpoint at marker2"
+     }
+     -re "$gdb_prompt $" {
+
+
+
+Fix for gfortran-4.1:
+  -PASS: gdb.mi/mi-var-child-f.exp: mi runto MAIN__
+  +FAIL: gdb.mi/mi-var-child-f.exp: mi runto MAIN__ (unknown output after running)
+
+RFC: Move language-changed message to verbose
+http://sourceware.org/ml/gdb-patches/2009-11/msg00031.html
+http://sourceware.org/ml/gdb-cvs/2009-11/msg00034.html
+
+### src/gdb/ChangeLog	2009/11/05 19:53:03	1.11030
+### src/gdb/ChangeLog	2009/11/05 20:43:52	1.11031
+## -1,3 +1,8 @@
++2009-11-05  Daniel Jacobowitz  <dan@codesourcery.com>
++
++	* top.c (execute_command): Select a frame before checking the current
++	language.  Only output a message if verbose.
++
+ 2009-11-05  Tom Tromey  <tromey@redhat.com>
+ 
+ 	* symtab.h (SYMBOL_SET_LINKAGE_NAME): Update comment.
+--- src/gdb/top.c	2009/10/19 09:51:42	1.172
++++ src/gdb/top.c	2009/11/05 20:43:52	1.173
+@@ -457,10 +457,13 @@
+ 
+     }
+ 
+-  /* Tell the user if the language has changed (except first time).  */
++  /* Tell the user if the language has changed (except first time).
++     First make sure that a new frame has been selected, in case this
++     command or the hooks changed the program state.  */
++  deprecated_safe_get_selected_frame ();
+   if (current_language != expected_language)
+     {
+-      if (language_mode == language_mode_auto)
++      if (language_mode == language_mode_auto && info_verbose)
+ 	{
+ 	  language_info (1);	/* Print what changed.  */
+ 	}
diff --git a/gdb-7.0.1.tar.bz2 b/gdb-7.0.1.tar.bz2
new file mode 100644
index 0000000..5326d14
--- /dev/null
+++ b/gdb-7.0.1.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:560c3fd0053ade6549e71bd045f70282feb88db73b35e401bbad601a311e3c1b
+size 17614682
diff --git a/gdb-7.0.tar.bz2 b/gdb-7.0.tar.bz2
deleted file mode 100644
index 0d44e48..0000000
--- a/gdb-7.0.tar.bz2
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c750c695c8029da60688fc6584207fd1ea741a6b9e79e4ad03715bfbc2113ecd
-size 17604459
diff --git a/gdb-archer-ada.patch b/gdb-archer-ada.patch
new file mode 100644
index 0000000..bb4926b
--- /dev/null
+++ b/gdb-archer-ada.patch
@@ -0,0 +1,32 @@
+From: Keith Seitz <keiths@redhat.com>
+Message-ID: <4B7F207A.7020102@redhat.com>
+
+--- gdb-7.0.1-orig/gdb/dwarf2read.c	2010-02-20 01:06:44.000000000 +0100
++++ gdb-7.0.1/gdb/dwarf2read.c	2010-02-20 01:08:28.000000000 +0100
+@@ -7362,6 +7362,10 @@ read_partial_die (struct partial_die_inf
+ 	      break;
+ 	    }
+ 	  break;
++	case DW_AT_MIPS_linkage_name:
++	  if (cu->language == language_ada)
++	    part_die->name = DW_STRING (&attr);
++	  break;
+ 	case DW_AT_comp_dir:
+ 	  if (part_die->dirname == NULL)
+ 	    part_die->dirname = DW_STRING (&attr);
+@@ -9924,9 +9928,13 @@ dwarf2_canonicalize_name (char *name, st
+ static char *
+ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
+ {
+-  struct attribute *attr;
++  struct attribute *attr = NULL;
++
++  if (cu->language == language_ada)
++    attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+ 
+-  attr = dwarf2_attr (die, DW_AT_name, cu);
++  if (!attr)
++    attr = dwarf2_attr (die, DW_AT_name, cu);
+   if (!attr || !DW_STRING (attr))
+     return NULL;
+ 
diff --git a/gdb-archer-excessive-files.patch b/gdb-archer-excessive-files.patch
new file mode 100644
index 0000000..16be926
--- /dev/null
+++ b/gdb-archer-excessive-files.patch
@@ -0,0 +1,639 @@
+Remove some files accidentally created (and not used) by gdb-archer.patch.
+
+diff -up -ruNp gdb-7.0.1-orig/gdb/config/i386/nm-i386.h gdb-7.0.1/gdb/config/i386/nm-i386.h
+--- gdb-7.0.1-orig/gdb/config/i386/nm-i386.h	2010-02-09 11:22:39.000000000 +0100
++++ gdb-7.0.1/gdb/config/i386/nm-i386.h	1970-01-01 01:00:00.000000000 +0100
+@@ -1,125 +0,0 @@
+-/* Native macro definitions for GDB on an Intel i[3456]86.
+-   Copyright 2001, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+-
+-   This file is part of GDB.
+-
+-   This program is free software; you can redistribute it and/or modify
+-   it under the terms of the GNU General Public License as published by
+-   the Free Software Foundation; either version 3 of the License, or
+-   (at your option) any later version.
+-
+-   This program is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-   GNU General Public License for more details.
+-
+-   You should have received a copy of the GNU General Public License
+-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+-
+-#ifndef NM_I386_H
+-#define NM_I386_H 1
+-
+-/* Hardware-assisted breakpoints and watchpoints.  */
+-
+-/* Targets should define this to use the generic x86 watchpoint support.  */
+-#ifdef I386_USE_GENERIC_WATCHPOINTS
+-
+-/* Add watchpoint methods to the provided target_ops.  Targets which call
+-   this should also define I386_WATCHPOINTS_IN_TARGET_VECTOR.  */
+-struct target_ops;
+-void i386_use_watchpoints (struct target_ops *);
+-
+-/* Clear the reference counts and forget everything we knew about DRi.  */
+-extern void i386_cleanup_dregs (void);
+-
+-/* Insert a watchpoint to watch a memory region which starts at
+-   address ADDR and whose length is LEN bytes.  Watch memory accesses
+-   of the type TYPE.  Return 0 on success, -1 on failure.  */
+-extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
+-
+-/* Remove a watchpoint that watched the memory region which starts at
+-   address ADDR, whose length is LEN bytes, and for accesses of the
+-   type TYPE.  Return 0 on success, -1 on failure.  */
+-extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
+-
+-/* Return non-zero if we can watch a memory region that starts at
+-   address ADDR and whose length is LEN bytes.  */
+-extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
+-
+-/* Return non-zero if the inferior has some break/watchpoint that
+-   triggered.  */
+-extern int i386_stopped_by_hwbp (void);
+-
+-/* If the inferior has some break/watchpoint that triggered, set
+-   the address associated with that break/watchpoint and return
+-   true.  Otherwise, return false.  */
+-extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);
+-
+-/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
+-   Return 0 on success, EBUSY on failure.  */
+-struct bp_target_info;
+-extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
+-
+-/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
+-   Return 0 on success, -1 on failure.  */
+-extern int  i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
+-
+-extern int i386_stopped_by_watchpoint (void);
+-
+-#ifndef I386_WATCHPOINTS_IN_TARGET_VECTOR
+-
+-/* Returns the number of hardware watchpoints of type TYPE that we can
+-   set.  Value is positive if we can set CNT watchpoints, zero if
+-   setting watchpoints of type TYPE is not supported, and negative if
+-   CNT is more than the maximum number of watchpoints of type TYPE
+-   that we can support.  TYPE is one of bp_hardware_watchpoint,
+-   bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
+-   CNT is the number of such watchpoints used so far (including this
+-   one).  OTHERTYPE is non-zero if other types of watchpoints are
+-   currently enabled.
+-
+-   We always return 1 here because we don't have enough information
+-   about possible overlap of addresses that they want to watch.  As an
+-   extreme example, consider the case where all the watchpoints watch
+-   the same address and the same region length: then we can handle a
+-   virtually unlimited number of watchpoints, due to debug register
+-   sharing implemented via reference counts in i386-nat.c.  */
+-
+-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
+-
+-/* Returns non-zero if we can use hardware watchpoints to watch a
+-   region whose address is ADDR and whose length is LEN.  */
+-
+-#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
+-  i386_region_ok_for_watchpoint (addr, len)
+-
+-/* After a watchpoint trap, the PC points to the instruction after the
+-   one that caused the trap.  Therefore we don't need to step over it.
+-   But we do need to reset the status register to avoid another trap.  */
+-
+-#define HAVE_CONTINUABLE_WATCHPOINT 1
+-
+-#define STOPPED_BY_WATCHPOINT(W)       (i386_stopped_by_watchpoint () != 0)
+-
+-#define target_stopped_data_address(target, x) \
+-  i386_stopped_data_address(target, x)
+-
+-/* Use these macros for watchpoint insertion/removal.  */
+-
+-#define target_insert_watchpoint(addr, len, type) \
+-  i386_insert_watchpoint (addr, len, type)
+-
+-#define target_remove_watchpoint(addr, len, type) \
+-  i386_remove_watchpoint (addr, len, type)
+-
+-#define target_insert_hw_breakpoint(bp_tgt) \
+-  i386_insert_hw_breakpoint (bp_tgt)
+-
+-#define target_remove_hw_breakpoint(bp_tgt) \
+-  i386_remove_hw_breakpoint (bp_tgt)
+-
+-#endif /* I386_WATCHPOINTS_IN_TARGET_VECTOR */
+-
+-#endif /* I386_USE_GENERIC_WATCHPOINTS */
+-
+-#endif /* NM_I386_H */
+diff -up -ruNp gdb-7.0.1-orig/gdb/config/i386/nm-linux64.h gdb-7.0.1/gdb/config/i386/nm-linux64.h
+--- gdb-7.0.1-orig/gdb/config/i386/nm-linux64.h	2010-02-09 11:22:39.000000000 +0100
++++ gdb-7.0.1/gdb/config/i386/nm-linux64.h	1970-01-01 01:00:00.000000000 +0100
+@@ -1,54 +0,0 @@
+-/* Native support for GNU/Linux x86-64.
+-
+-   Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+-   Free Software Foundation, Inc.
+-
+-   Contributed by Jiri Smid, SuSE Labs.
+-
+-   This file is part of GDB.
+-
+-   This program is free software; you can redistribute it and/or modify
+-   it under the terms of the GNU General Public License as published by
+-   the Free Software Foundation; either version 3 of the License, or
+-   (at your option) any later version.
+-
+-   This program is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-   GNU General Public License for more details.
+-
+-   You should have received a copy of the GNU General Public License
+-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+-
+-#ifndef NM_LINUX64_H
+-#define NM_LINUX64_H
+-
+-/* GNU/Linux supports the i386 hardware debugging registers.  */
+-#define I386_USE_GENERIC_WATCHPOINTS
+-#define I386_WATCHPOINTS_IN_TARGET_VECTOR
+-
+-#include "i386/nm-i386.h"
+-#include "config/nm-linux.h"
+-
+-/* Support for 8-byte wide hardware watchpoints.  */
+-#define TARGET_HAS_DR_LEN_8 1
+-
+-/* Provide access to the i386 hardware debugging registers.  */
+-
+-extern void amd64_linux_dr_set_control (unsigned long control);
+-#define I386_DR_LOW_SET_CONTROL(control) \
+-  amd64_linux_dr_set_control (control)
+-
+-extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr);
+-#define I386_DR_LOW_SET_ADDR(regnum, addr) \
+-  amd64_linux_dr_set_addr (regnum, addr)
+-
+-extern void amd64_linux_dr_reset_addr (int regnum);
+-#define I386_DR_LOW_RESET_ADDR(regnum) \
+-  amd64_linux_dr_reset_addr (regnum)
+-
+-extern unsigned long amd64_linux_dr_get_status (void);
+-#define I386_DR_LOW_GET_STATUS() \
+-  amd64_linux_dr_get_status ()
+-
+-#endif /* nm-linux64.h */
+diff -up -ruNp gdb-7.0.1-orig/gdb/config/mips/nm-irix5.h gdb-7.0.1/gdb/config/mips/nm-irix5.h
+--- gdb-7.0.1-orig/gdb/config/mips/nm-irix5.h	2010-02-09 11:22:39.000000000 +0100
++++ gdb-7.0.1/gdb/config/mips/nm-irix5.h	1970-01-01 01:00:00.000000000 +0100
+@@ -1,44 +0,0 @@
+-/* Definitions for native support of irix5.
+-
+-   Copyright 1993, 1996, 1998, 1999, 2000, 2007, 2008, 2009
+-   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/>.  */
+-
+-#define TARGET_HAS_HARDWARE_WATCHPOINTS
+-
+-/* TARGET_CAN_USE_HARDWARE_WATCHPOINT is now defined to go through
+-   the target vector.  For Irix5, procfs_can_use_hw_watchpoint()
+-   should be invoked.  */
+-
+-/* When a hardware watchpoint fires off the PC will be left at the
+-   instruction which caused the watchpoint.  It will be necessary for
+-   GDB to step over the watchpoint. */
+-
+-#define STOPPED_BY_WATCHPOINT(W) \
+-     procfs_stopped_by_watchpoint(inferior_ptid)
+-extern int procfs_stopped_by_watchpoint (ptid_t);
+-
+-/* Use these macros for watchpoint insertion/deletion.  */
+-/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
+-#define target_insert_watchpoint(ADDR, LEN, TYPE) \
+-     procfs_set_watchpoint (inferior_ptid, ADDR, LEN, TYPE, 0)
+-#define target_remove_watchpoint(ADDR, LEN, TYPE) \
+-     procfs_set_watchpoint (inferior_ptid, ADDR, 0, 0, 0)
+-extern int procfs_set_watchpoint (ptid_t, CORE_ADDR, int, int, int);
+-
+-#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1
+-
+diff -up -ruNp gdb-7.0.1-orig/gdb/gdbserver/linux-i386-low.c gdb-7.0.1/gdb/gdbserver/linux-i386-low.c
+--- gdb-7.0.1-orig/gdb/gdbserver/linux-i386-low.c	2010-02-09 11:22:39.000000000 +0100
++++ gdb-7.0.1/gdb/gdbserver/linux-i386-low.c	1970-01-01 01:00:00.000000000 +0100
+@@ -1,210 +0,0 @@
+-/* GNU/Linux/i386 specific low level interface, for the remote server for GDB.
+-   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
+-   2007, 2008, 2009 Free Software Foundation, Inc.
+-
+-   This file is part of GDB.
+-
+-   This program is free software; you can redistribute it and/or modify
+-   it under the terms of the GNU General Public License as published by
+-   the Free Software Foundation; either version 3 of the License, or
+-   (at your option) any later version.
+-
+-   This program is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-   GNU General Public License for more details.
+-
+-   You should have received a copy of the GNU General Public License
+-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+-
+-#include "server.h"
+-#include "linux-low.h"
+-#include "i387-fp.h"
+-
+-#include "gdb_proc_service.h"
+-
+-#include <sys/ptrace.h>
+-
+-#ifdef HAVE_SYS_REG_H
+-#include <sys/reg.h>
+-#endif
+-
+-#ifndef PTRACE_GET_THREAD_AREA
+-#define PTRACE_GET_THREAD_AREA 25
+-#endif
+-
+-/* Defined in auto-generated file reg-i386-linux.c.  */
+-void init_registers_i386_linux (void);
+-
+-
+-/* This module only supports access to the general purpose registers.  */
+-
+-#define i386_num_regs 16
+-
+-/* This stuff comes from i386-linux-nat.c.  */
+-
+-/* Mapping between the general-purpose registers in `struct user'
+-   format and GDB's register array layout.  */
+-static int i386_regmap[] = 
+-{
+-  EAX * 4, ECX * 4, EDX * 4, EBX * 4,
+-  UESP * 4, EBP * 4, ESI * 4, EDI * 4,
+-  EIP * 4, EFL * 4, CS * 4, SS * 4,
+-  DS * 4, ES * 4, FS * 4, GS * 4
+-};
+-
+-/* Called by libthread_db.  */
+-
+-ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph, 
+-		    lwpid_t lwpid, int idx, void **base)
+-{
+-  unsigned int desc[4];
+-
+-  if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
+-	      (void *) idx, (unsigned long) &desc) < 0)
+-    return PS_ERR;
+-
+-  *(int *)base = desc[1];
+-  return PS_OK;
+-}
+-
+-static int
+-i386_cannot_store_register (int regno)
+-{
+-  return (regno >= i386_num_regs);
+-}
+-
+-static int
+-i386_cannot_fetch_register (int regno)
+-{
+-  return (regno >= i386_num_regs);
+-}
+-
+-
+-#ifdef HAVE_PTRACE_GETREGS
+-#include <sys/procfs.h>
+-#include <sys/ptrace.h>
+-
+-static void
+-i386_fill_gregset (void *buf)
+-{
+-  int i;
+-
+-  for (i = 0; i < i386_num_regs; i++)
+-    collect_register (i, ((char *) buf) + i386_regmap[i]);
+-
+-  collect_register_by_name ("orig_eax", ((char *) buf) + ORIG_EAX * 4);
+-}
+-
+-static void
+-i386_store_gregset (const void *buf)
+-{
+-  int i;
+-
+-  for (i = 0; i < i386_num_regs; i++)
+-    supply_register (i, ((char *) buf) + i386_regmap[i]);
+-
+-  supply_register_by_name ("orig_eax", ((char *) buf) + ORIG_EAX * 4);
+-}
+-
+-static void
+-i386_fill_fpregset (void *buf)
+-{
+-  i387_cache_to_fsave (buf);
+-}
+-
+-static void
+-i386_store_fpregset (const void *buf)
+-{
+-  i387_fsave_to_cache (buf);
+-}
+-
+-static void
+-i386_fill_fpxregset (void *buf)
+-{
+-  i387_cache_to_fxsave (buf);
+-}
+-
+-static void
+-i386_store_fpxregset (const void *buf)
+-{
+-  i387_fxsave_to_cache (buf);
+-}
+-
+-#endif /* HAVE_PTRACE_GETREGS */
+-
+-struct regset_info target_regsets[] = {
+-#ifdef HAVE_PTRACE_GETREGS
+-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
+-    GENERAL_REGS,
+-    i386_fill_gregset, i386_store_gregset },
+-# ifdef HAVE_PTRACE_GETFPXREGS
+-  { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t),
+-    EXTENDED_REGS,
+-    i386_fill_fpxregset, i386_store_fpxregset },
+-# endif
+-  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
+-    FP_REGS,
+-    i386_fill_fpregset, i386_store_fpregset },
+-#endif /* HAVE_PTRACE_GETREGS */
+-  { 0, 0, -1, -1, NULL, NULL }
+-};
+-
+-static const unsigned char i386_breakpoint[] = { 0xCC };
+-#define i386_breakpoint_len 1
+-
+-extern int debug_threads;
+-
+-static CORE_ADDR
+-i386_get_pc ()
+-{
+-  unsigned long pc;
+-
+-  collect_register_by_name ("eip", &pc);
+-
+-  if (debug_threads)
+-    fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc);
+-  return pc;
+-}
+-
+-static void
+-i386_set_pc (CORE_ADDR newpc)
+-{
+-  if (debug_threads)
+-    fprintf (stderr, "set pc to %08lx\n", (long) newpc);
+-  supply_register_by_name ("eip", &newpc);
+-}
+-
+-static int
+-i386_breakpoint_at (CORE_ADDR pc)
+-{
+-  unsigned char c;
+-
+-  read_inferior_memory (pc, &c, 1);
+-  if (c == 0xCC)
+-    return 1;
+-
+-  return 0;
+-}
+-
+-struct linux_target_ops the_low_target = {
+-  init_registers_i386_linux,
+-  i386_num_regs,
+-  i386_regmap,
+-  i386_cannot_fetch_register,
+-  i386_cannot_store_register,
+-  i386_get_pc,
+-  i386_set_pc,
+-  i386_breakpoint,
+-  i386_breakpoint_len,
+-  NULL,
+-  1,
+-  i386_breakpoint_at,
+-  NULL,
+-  NULL,
+-  NULL,
+-  NULL,
+-  NULL,
+-  NULL,
+-};
+diff -up -ruNp gdb-7.0.1-orig/gdb/gdbserver/linux-x86-64-low.c gdb-7.0.1/gdb/gdbserver/linux-x86-64-low.c
+--- gdb-7.0.1-orig/gdb/gdbserver/linux-x86-64-low.c	2010-02-09 11:22:39.000000000 +0100
++++ gdb-7.0.1/gdb/gdbserver/linux-x86-64-low.c	1970-01-01 01:00:00.000000000 +0100
+@@ -1,184 +0,0 @@
+-/* GNU/Linux/x86-64 specific low level interface, for the remote server
+-   for GDB.
+-   Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009
+-   Free Software Foundation, Inc.
+-
+-   This file is part of GDB.
+-
+-   This program is free software; you can redistribute it and/or modify
+-   it under the terms of the GNU General Public License as published by
+-   the Free Software Foundation; either version 3 of the License, or
+-   (at your option) any later version.
+-
+-   This program is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-   GNU General Public License for more details.
+-
+-   You should have received a copy of the GNU General Public License
+-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+-
+-#include "server.h"
+-#include "linux-low.h"
+-#include "i387-fp.h"
+-
+-#include "gdb_proc_service.h"
+-
+-/* Defined in auto-generated file reg-x86-64-linux.c.  */
+-void init_registers_x86_64_linux (void);
+-
+-#include <sys/reg.h>
+-#include <sys/procfs.h>
+-#include <sys/ptrace.h>
+-
+-/* This definition comes from prctl.h, but some kernels may not have it.  */
+-#ifndef PTRACE_ARCH_PRCTL
+-#define PTRACE_ARCH_PRCTL      30
+-#endif
+-
+-/* The following definitions come from prctl.h, but may be absent
+-   for certain configurations.  */
+-#ifndef ARCH_GET_FS
+-#define ARCH_SET_GS 0x1001
+-#define ARCH_SET_FS 0x1002
+-#define ARCH_GET_FS 0x1003
+-#define ARCH_GET_GS 0x1004
+-#endif
+-
+-static int x86_64_regmap[] = {
+-  RAX * 8, RBX * 8, RCX * 8, RDX * 8,
+-  RSI * 8, RDI * 8, RBP * 8, RSP * 8,
+-  R8 * 8, R9 * 8, R10 * 8, R11 * 8,
+-  R12 * 8, R13 * 8, R14 * 8, R15 * 8,
+-  RIP * 8, EFLAGS * 8, CS * 8, SS * 8, 
+-  DS * 8, ES * 8, FS * 8, GS * 8,
+-  -1, -1, -1, -1, -1, -1, -1, -1,
+-  -1, -1, -1, -1, -1, -1, -1, -1,
+-  -1, -1, -1, -1, -1, -1, -1, -1,
+-  -1, -1, -1, -1, -1, -1, -1, -1, -1,
+-  ORIG_RAX * 8
+-};
+-
+-#define X86_64_NUM_GREGS (sizeof(x86_64_regmap)/sizeof(int))
+-
+-/* Called by libthread_db.  */
+-
+-ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
+-                    lwpid_t lwpid, int idx, void **base)
+-{
+-  switch (idx)
+-    {
+-    case FS:
+-      if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
+-	return PS_OK;
+-      break;
+-    case GS:
+-      if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
+-	return PS_OK;
+-      break;
+-    default:
+-      return PS_BADADDR;
+-    }
+-  return PS_ERR;
+-}
+-
+-static void
+-x86_64_fill_gregset (void *buf)
+-{
+-  int i;
+-
+-  for (i = 0; i < X86_64_NUM_GREGS; i++)
+-    if (x86_64_regmap[i] != -1)
+-      collect_register (i, ((char *) buf) + x86_64_regmap[i]);
+-}
+-
+-static void
+-x86_64_store_gregset (const void *buf)
+-{
+-  int i;
+-
+-  for (i = 0; i < X86_64_NUM_GREGS; i++)
+-    if (x86_64_regmap[i] != -1)
+-      supply_register (i, ((char *) buf) + x86_64_regmap[i]);
+-}
+-
+-static void
+-x86_64_fill_fpregset (void *buf)
+-{
+-  i387_cache_to_fxsave (buf);
+-}
+-
+-static void
+-x86_64_store_fpregset (const void *buf)
+-{
+-  i387_fxsave_to_cache (buf);
+-}
+-
+-struct regset_info target_regsets[] = {
+-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
+-    GENERAL_REGS,
+-    x86_64_fill_gregset, x86_64_store_gregset },
+-  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
+-    FP_REGS,
+-    x86_64_fill_fpregset, x86_64_store_fpregset },
+-  { 0, 0, -1, -1, NULL, NULL }
+-};
+-
+-static const unsigned char x86_64_breakpoint[] = { 0xCC };
+-#define x86_64_breakpoint_len 1
+-                
+-extern int debug_threads;
+-
+-static CORE_ADDR
+-x86_64_get_pc ()
+-{
+-  unsigned long pc;
+-
+-  collect_register_by_name ("rip", &pc);
+-
+-  if (debug_threads)
+-    fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc);
+-  return pc;
+-}
+-
+-static void
+-x86_64_set_pc (CORE_ADDR newpc)
+-{
+-  if (debug_threads)
+-    fprintf (stderr, "set pc to %08lx\n", (long) newpc);
+-  supply_register_by_name ("rip", &newpc);
+-}
+-
+-static int
+-x86_64_breakpoint_at (CORE_ADDR pc)
+-{
+-  unsigned char c;
+-
+-  read_inferior_memory (pc, &c, 1);
+-  if (c == 0xCC)
+-    return 1;
+-
+-  return 0;
+-}
+-
+-struct linux_target_ops the_low_target = {
+-  init_registers_x86_64_linux,
+-  -1,
+-  NULL,
+-  NULL,
+-  NULL,
+-  x86_64_get_pc,
+-  x86_64_set_pc,
+-  x86_64_breakpoint,  
+-  x86_64_breakpoint_len,
+-  NULL,                                 
+-  1,
+-  x86_64_breakpoint_at,
+-  NULL,
+-  NULL,
+-  NULL,
+-  NULL,
+-  NULL,
+-  NULL,
+-};
diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch
new file mode 100644
index 0000000..c5fe375
--- /dev/null
+++ b/gdb-archer-pie-addons-keep-disabled.patch
@@ -0,0 +1,122 @@
+--- ./gdb/breakpoint.c	2009-12-18 00:13:49.000000000 +0100
++++ ./gdb/breakpoint.c	2009-12-18 00:13:16.000000000 +0100
+@@ -8563,6 +8563,49 @@ update_breakpoint_locations (struct brea
+   update_global_location_list (1);
+ }
+ 
++void
++breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
++{
++  struct bp_location *bl, **blp_tmp;
++  int changed = 0;
++
++  gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
++
++  ALL_BP_LOCATIONS (bl, blp_tmp)
++    {
++      struct obj_section *osect;
++
++      /* BL->SECTION can be correctly NULL for breakpoints with multiple
++         locations expanded through symtab.  */
++
++      ALL_OBJFILE_OSECTIONS (objfile, osect)
++	{
++	  CORE_ADDR relocated_address;
++	  CORE_ADDR delta_offset;
++
++	  delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
++	  if (delta_offset == 0)
++	    continue;
++	  relocated_address = bl->address + delta_offset;
++
++	  if (obj_section_addr (osect) <= relocated_address
++	      && relocated_address < obj_section_endaddr (osect))
++	    {
++	      if (bl->inserted)
++		remove_breakpoint (bl, mark_uninserted);
++
++	      bl->address += delta_offset;
++	      bl->requested_address += delta_offset;
++
++	      changed = 1;
++	    }
++	}
++    }
++
++  if (changed)
++    qsort (bp_location, bp_location_count, sizeof (*bp_location),
++	   bp_location_compare_for_qsort);
++}
+ 
+ /* Reset a breakpoint given it's struct breakpoint * BINT.
+    The value we return ends up being the return value from catch_errors.
+--- ./gdb/breakpoint.h	2009-12-18 00:13:48.000000000 +0100
++++ ./gdb/breakpoint.h	2009-12-17 22:11:10.000000000 +0100
+@@ -970,4 +970,7 @@ extern struct breakpoint *get_tracepoint
+    is newly allocated; the caller should free when done with it.  */
+ extern VEC(breakpoint_p) *all_tracepoints (void);
+ 
++extern void breakpoints_relocate (struct objfile *objfile,
++				  struct section_offsets *delta);
++
+ #endif /* !defined (BREAKPOINT_H) */
+--- ./gdb/objfiles.c	2009-12-18 00:13:48.000000000 +0100
++++ ./gdb/objfiles.c	2009-12-17 23:19:22.000000000 +0100
+@@ -546,7 +546,7 @@ free_all_objfiles (void)
+ /* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
+    entries in new_offsets.  SEPARATE_DEBUG_OBJFILE is not touched here.  */
+ 
+-static void
++static int
+ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
+ {
+   struct obj_section *s;
+@@ -565,7 +565,7 @@ objfile_relocate1 (struct objfile *objfi
+ 	  something_changed = 1;
+       }
+     if (!something_changed)
+-      return;
++      return 0;
+   }
+ 
+   /* OK, get all the symtabs.  */
+@@ -706,6 +706,13 @@ objfile_relocate1 (struct objfile *objfi
+       exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
+ 				obj_section_addr (s));
+     }
++
++  /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
++     their addresses match.  */
++  if (objfile->separate_debug_objfile_backlink == NULL)
++    breakpoints_relocate (objfile, delta);
++
++  return 1;
+ }
+ 
+ /* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
+@@ -720,7 +727,9 @@ objfile_relocate1 (struct objfile *objfi
+ void
+ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+ {
+-  objfile_relocate1 (objfile, new_offsets);
++  int changed = 0;
++
++  changed |= objfile_relocate1 (objfile, new_offsets);
+ 
+   if (objfile->separate_debug_objfile != NULL)
+     {
+@@ -747,11 +756,12 @@ objfile_relocate (struct objfile *objfil
+ 					     objfile_addrs);
+       do_cleanups (my_cleanups);
+ 
+-      objfile_relocate1 (debug_objfile, new_debug_offsets);
++      changed |= objfile_relocate1 (debug_objfile, new_debug_offsets);
+     }
+ 
+   /* Relocate breakpoints as necessary, after things are relocated. */
+-  breakpoint_re_set ();
++  if (changed)
++    breakpoint_re_set ();
+ }
+ 
+ /* Return non-zero if OBJFILE has partial symbols.  */
diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch
new file mode 100644
index 0000000..b0a68c7
--- /dev/null
+++ b/gdb-archer-pie-addons.patch
@@ -0,0 +1,312 @@
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -5754,7 +5754,12 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+ {
+   struct attribute *attr;
+   struct symbol *sym;
+-  CORE_ADDR base = (CORE_ADDR) 0;
++  struct objfile *objfile = cu->objfile;
++  CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
++				 SECT_OFF_TEXT (objfile));
++  /* This is used only for DW_AT_data_member_location entries.  */
++  CORE_ADDR base = 0;
++  int base_p = 0;
+ 
+   attr = dwarf2_attr (die, DW_AT_location, cu);
+   if (attr)
+@@ -5763,6 +5768,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+       if (attr_form_is_block (attr))
+ 	{
+ 	  base = decode_locdesc (DW_BLOCK (attr), cu);
++	  base_p = 1;
+ 	}
+       else if (attr_form_is_section_offset (attr))
+ 	{
+@@ -5824,12 +5830,15 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+ 	      else
+ 		dwarf2_complex_location_expr_complaint ();
+ 
+-	      SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
++	      if (!base_p)
++		dwarf2_invalid_attrib_class_complaint
++		  ("DW_AT_data_member_location", "common block member");
++	      SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset + baseaddr;
+ 	      add_symbol_to_list (sym, &global_symbols);
+ 	    }
+ 
+ 	  if (SYMBOL_CLASS (sym) == LOC_STATIC)
+-	    SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym));
++	    SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym) - baseaddr);
+ 	  else
+ 	    SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
+ 	  FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
+@@ -5843,7 +5852,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+ 
+       sym = new_symbol (die, type, cu);
+       /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static.  */
+-      SYMBOL_VALUE_ADDRESS (sym) = base;
++      SYMBOL_VALUE_ADDRESS (sym) = base + baseaddr;
+ 
+       set_die_type (die, type, cu);
+     }
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -32,6 +32,7 @@
+ #include "exec.h"
+ #include "observer.h"
+ #include "arch-utils.h"
++#include "solib.h"
+ 
+ #include <fcntl.h>
+ #include "readline/readline.h"
+@@ -220,6 +221,10 @@ exec_file_attach (char *filename, int from_tty)
+       char *scratch_pathname;
+       int scratch_chan;
+       struct target_section *sections = NULL, *sections_end = NULL;
++      struct target_section *p;
++      int addr_bit;
++      CORE_ADDR mask = CORE_ADDR_MAX;
++      CORE_ADDR displacement;
+ 
+       scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
+ 		   write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
+@@ -288,12 +293,23 @@ exec_file_attach (char *filename, int from_tty)
+ 		 scratch_pathname, bfd_errmsg (bfd_get_error ()));
+ 	}
+ 
++      set_gdbarch_from_file (exec_bfd);
++
++      addr_bit = gdbarch_addr_bit (target_gdbarch);
++      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
++	mask = ((CORE_ADDR) 1 << addr_bit) - 1;
++
++      displacement = solib_exec_displacement ();
++      for (p = sections; p < sections_end; p++)
++	{
++	  p->addr = (p->addr + displacement) & mask;
++	  p->endaddr = (p->endaddr + displacement) & mask;
++	}
++
+       exec_bfd_mtime = bfd_get_mtime (exec_bfd);
+ 
+       validate_files ();
+ 
+-      set_gdbarch_from_file (exec_bfd);
+-
+       /* Add the executable's sections to the current address spaces'
+ 	 list of sections.  */
+       add_target_sections (sections, sections_end);
+--- a/gdb/gdbtypes.h
++++ b/gdb/gdbtypes.h
+@@ -966,6 +966,7 @@ extern void allocate_cplus_struct_type (struct type *);
+ #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
+ #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
+ #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
++/* This address is unrelocated by the objfile's ANOFFSET.  */
+ #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
+ #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
+ #define SET_FIELD_BITPOS(thisfld, bitpos)			\
+@@ -974,6 +975,7 @@ extern void allocate_cplus_struct_type (struct type *);
+ #define SET_FIELD_PHYSNAME(thisfld, name)			\
+   (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME,		\
+    FIELD_STATIC_PHYSNAME (thisfld) = (name))
++/* This address is unrelocated by the objfile's ANOFFSET.  */
+ #define SET_FIELD_PHYSADDR(thisfld, addr)			\
+   (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR,		\
+    FIELD_STATIC_PHYSADDR (thisfld) = (addr))
+@@ -989,6 +991,7 @@ extern void allocate_cplus_struct_type (struct type *);
+ #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
++/* This address is unrelocated by the objfile's ANOFFSET.  */
+ #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
+--- a/gdb/jv-lang.c
++++ b/gdb/jv-lang.c
+@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gdbarch,
+ 
+   fields = NULL;
+   nfields--;			/* First set up dummy "class" field. */
+-  SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
++  SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas)
++    - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+   TYPE_FIELD_NAME (type, nfields) = "class";
+   TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
+   SET_TYPE_FIELD_PRIVATE (type, nfields);
+@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gdbarch,
+ 	  SET_TYPE_FIELD_PROTECTED (type, i);
+ 	}
+       if (accflags & 0x0008)	/* ACC_STATIC */
+-	SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
++	SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset
++	  - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+       else
+ 	TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
+       if (accflags & 0x8000)	/* FIELD_UNRESOLVED_FLAG */
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -1672,15 +1672,20 @@ static CORE_ADDR
+ svr4_exec_displacement (void)
+ {
+   int found;
++  /* ENTRY_POINT is a possible function descriptor - before
++     a call to gdbarch_convert_from_func_ptr_addr.  */
+   CORE_ADDR entry_point;
+ 
+   if (exec_bfd == NULL)
+     return 0;
+ 
+   if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
+-    return entry_point - exec_entry_point (exec_bfd, &current_target);
++    return entry_point - bfd_get_start_address (exec_bfd);
+ 
+-  return svr4_static_exec_displacement ();
++  if (!ptid_equal (inferior_ptid, null_ptid))
++    return svr4_static_exec_displacement ();
++
++  return 0;
+ }
+ 
+ /* Relocate the main executable.  This function should be called upon
+@@ -1632,7 +1635,7 @@ svr4_exec_displacement (void)
+ static void
+ svr4_relocate_main_executable (void)
+ {
+-  CORE_ADDR displacement = svr4_exec_displacement ();
++  CORE_ADDR displacement = solib_exec_displacement ();
+ 
+   /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
+      difference of in-memory vs. in-file addresses and we could already
+@@ -1975,6 +1978,7 @@ _initialize_svr4_solib (void)
+   svr4_so_ops.free_so = svr4_free_so;
+   svr4_so_ops.clear_solib = svr4_clear_solib;
+   svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
++  svr4_so_ops.exec_displacement = svr4_exec_displacement;
+   svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
+   svr4_so_ops.current_sos = svr4_current_sos;
+   svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
+--- a/gdb/solib.c
++++ b/gdb/solib.c
+@@ -1014,6 +1014,19 @@ solib_create_inferior_hook (int from_tty)
+   ops->solib_create_inferior_hook (from_tty);
+ }
+ 
++/* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs.  */
++
++CORE_ADDR
++solib_exec_displacement (void)
++{
++  struct target_so_ops *ops = solib_ops (target_gdbarch);
++
++  if (ops->exec_displacement != NULL)
++    return (*ops->exec_displacement) ();
++  else
++    return 0;
++}
++
+ /* GLOBAL FUNCTION
+ 
+    in_solib_dynsym_resolve_code -- check to see if an address is in
+--- a/gdb/solib.h
++++ b/gdb/solib.h
+@@ -43,6 +43,8 @@ extern int solib_read_symbols (struct so_list *, int);
+ 
+ extern void solib_create_inferior_hook (int from_tty);
+ 
++extern CORE_ADDR solib_exec_displacement (void);
++
+ /* If ADDR lies in a shared library, return its name.  */
+ 
+ extern char *solib_name_from_address (CORE_ADDR);
+--- a/gdb/solist.h
++++ b/gdb/solist.h
+@@ -89,6 +89,9 @@ struct target_so_ops
+     /* Target dependent code to run after child process fork.  */
+     void (*solib_create_inferior_hook) (int from_tty);
+ 
++    /* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs.  */
++    CORE_ADDR (*exec_displacement) (void);
++
+     /* Do additional symbol handling, lookup, etc. after symbols
+        for a shared object have been loaded.  */
+     void (*special_symbol_handling) (void);
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -873,15 +873,36 @@ syms_from_objfile (struct objfile *objfile,
+      if an error occurs during symbol reading.  */
+   old_chain = make_cleanup_free_objfile (objfile);
+ 
+-  /* If ADDRS and OFFSETS are both NULL, put together a dummy address
+-     list.  We now establish the convention that an addr of zero means
+-     no load address was specified. */
++  /* If ADDRS and OFFSETS are both NULL, put together a dummy offset list.  */
++
+   if (! addrs && ! offsets)
+     {
+-      local_addr
+-	= alloc_section_addr_info (bfd_count_sections (objfile->obfd));
+-      make_cleanup (xfree, local_addr);
+-      addrs = local_addr;
++      /* Relocateble files have an exception in default_symfile_offsets which
++	 applies only for ADDRS.  But calling solib_exec_displacement is more
++	 suitable for OFFSETS.  Fortunately we never need the both
++	 functionalities simultaneously and in other cases zeroed ADDRS and
++	 zeroed OFFSETS are equivalent.  */
++
++      if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
++	{
++	  local_addr
++		 = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
++	  make_cleanup (xfree, local_addr);
++	  addrs = local_addr;
++	}
++      else
++	{
++	  CORE_ADDR displacement = 0;
++	  int i;
++
++	  if (mainline)
++	    displacement = solib_exec_displacement ();
++
++	  num_offsets = bfd_count_sections (objfile->obfd);
++	  offsets = alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets));
++	  for (i = 0; i < num_offsets; i++)
++	    offsets->offsets[i] = displacement;
++	}
+     }
+ 
+   /* Now either addrs or offsets is non-zero.  */
+--- a/gdb/value.c
++++ b/gdb/value.c
+@@ -1890,7 +1890,8 @@ value_static_field (struct type *type, int fieldno)
+   if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
+     {
+       retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
+-			 TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
++			 TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
++			   + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+     }
+   else
+     {
+@@ -1920,7 +1921,8 @@ value_static_field (struct type *type, int fieldno)
+  	}
+       if (retval && VALUE_LVAL (retval) == lval_memory)
+ 	SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
+-			    value_address (retval));
++			    value_address (retval)
++			      - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+     }
+   return retval;
+ }
+--- gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp-orig	2009-12-21 16:50:42.000000000 +0100
++++ gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp	2009-12-21 16:51:24.000000000 +0100
+@@ -67,6 +67,8 @@ gdb_test_multiple "" $test {
+     }
+ }
+ 
++gdb_test "" "" "eat first prompt"
++
+ # Initialization from default_gdb_start.
+ gdb_test "set height 0"
+ gdb_test "set width 0"
diff --git a/gdb-archer-pie.patch b/gdb-archer-pie.patch
new file mode 100644
index 0000000..1855b48
--- /dev/null
+++ b/gdb-archer-pie.patch
@@ -0,0 +1,2647 @@
+http://sourceware.org/gdb/wiki/ProjectArcher
+http://sourceware.org/gdb/wiki/ArcherBranchManagement
+
+archer-jankratochvil-pie-fedora12
+GIT snapshot:
+commit 2ae60b5156d43aabfe5757940eaf7b4370fb05d2
+
+
+diff --git a/gdb/auxv.c b/gdb/auxv.c
+index 7b4ecbe..7df8eb5 100644
+--- a/gdb/auxv.c
++++ b/gdb/auxv.c
+@@ -25,6 +25,7 @@
+ #include "inferior.h"
+ #include "valprint.h"
+ #include "gdb_assert.h"
++#include "gdbcore.h"
+ 
+ #include "auxv.h"
+ #include "elf/common.h"
+@@ -33,15 +34,11 @@
+ #include <fcntl.h>
+ 
+ 
+-/* This function is called like a to_xfer_partial hook, but must be
+-   called with TARGET_OBJECT_AUXV.  It handles access via
+-   /proc/PID/auxv, which is a common method for native targets.  */
++/* This function handles access via /proc/PID/auxv, which is a common method
++   for native targets.  */
+ 
+-LONGEST
+-procfs_xfer_auxv (struct target_ops *ops,
+-		  enum target_object object,
+-		  const char *annex,
+-		  gdb_byte *readbuf,
++static LONGEST
++procfs_xfer_auxv (gdb_byte *readbuf,
+ 		  const gdb_byte *writebuf,
+ 		  ULONGEST offset,
+ 		  LONGEST len)
+@@ -50,9 +47,6 @@ procfs_xfer_auxv (struct target_ops *ops,
+   int fd;
+   LONGEST n;
+ 
+-  gdb_assert (object == TARGET_OBJECT_AUXV);
+-  gdb_assert (readbuf || writebuf);
+-
+   pathname = xstrprintf ("/proc/%d/auxv", PIDGET (inferior_ptid));
+   fd = open (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY);
+   xfree (pathname);
+@@ -72,6 +66,152 @@ procfs_xfer_auxv (struct target_ops *ops,
+   return n;
+ }
+ 
++/* This function handles access via ld.so's symbol `_dl_auxv'.  */
++
++static LONGEST
++ld_so_xfer_auxv (gdb_byte *readbuf,
++		 const gdb_byte *writebuf,
++		 ULONGEST offset,
++		 LONGEST len)
++{
++  struct minimal_symbol *msym;
++  CORE_ADDR data_address, pointer_address;
++  struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
++  size_t ptr_size = TYPE_LENGTH (ptr_type);
++  size_t auxv_pair_size = 2 * ptr_size;
++  gdb_byte *ptr_buf = alloca (ptr_size);
++  LONGEST retval;
++  size_t block;
++
++  msym = lookup_minimal_symbol ("_dl_auxv", NULL, NULL);
++  if (msym == NULL)
++    return -1;
++
++  if (MSYMBOL_SIZE (msym) != ptr_size)
++    return -1;
++
++  /* POINTER_ADDRESS is a location where the `_dl_auxv' variable resides.
++     DATA_ADDRESS is the inferior value present in `_dl_auxv', therefore the
++     real inferior AUXV address.  */
++
++  pointer_address = SYMBOL_VALUE_ADDRESS (msym);
++
++  data_address = read_memory_typed_address (pointer_address, ptr_type);
++
++  /* Possibly still not initialized such as during an inferior startup.  */
++  if (data_address == 0)
++    return -1;
++
++  data_address += offset;
++
++  if (writebuf != NULL)
++    {
++      if (target_write_memory (data_address, writebuf, len) == 0)
++	return len;
++      else
++	return -1;
++    }
++
++  /* Stop if trying to read past the existing AUXV block.  The final AT_NULL
++     was already returned before.  */
++
++  if (offset >= auxv_pair_size)
++    {
++      if (target_read_memory (data_address - auxv_pair_size, ptr_buf,
++			      ptr_size) != 0)
++	return -1;
++
++      if (extract_typed_address (ptr_buf, ptr_type) == AT_NULL)
++	return 0;
++    }
++
++  retval = 0;
++  block = 0x400;
++  gdb_assert (block % auxv_pair_size == 0);
++
++  while (len > 0)
++    {
++      if (block > len)
++	block = len;
++
++      /* Reading sizes smaller than AUXV_PAIR_SIZE is not supported.  Tails
++	 unaligned to AUXV_PAIR_SIZE will not be read during a call (they
++	 should be completed during next read with new/extended buffer).  */
++
++      block &= -auxv_pair_size;
++      if (block == 0)
++	return retval;
++
++      if (target_read_memory (data_address, readbuf, block) != 0)
++	{
++	  if (block <= auxv_pair_size)
++	    return retval;
++
++	  block = auxv_pair_size;
++	  continue;
++	}
++
++      data_address += block;
++      len -= block;
++
++      /* Check terminal AT_NULL.  This function is being called indefinitely
++         being extended its READBUF until it returns EOF (0).  */
++
++      while (block >= auxv_pair_size)
++	{
++	  retval += auxv_pair_size;
++
++	  if (extract_typed_address (readbuf, ptr_type) == AT_NULL)
++	    return retval;
++
++	  readbuf += auxv_pair_size;
++	  block -= auxv_pair_size;
++	}
++    }
++
++  return retval;
++}
++
++/* This function is called like a to_xfer_partial hook, but must be
++   called with TARGET_OBJECT_AUXV.  It handles access to AUXV.  */
++
++LONGEST
++memory_xfer_auxv (struct target_ops *ops,
++		  enum target_object object,
++		  const char *annex,
++		  gdb_byte *readbuf,
++		  const gdb_byte *writebuf,
++		  ULONGEST offset,
++		  LONGEST len)
++{
++  /* Workaround gdb-7.0 bug where linux_nat_xfer_partial() does
++       inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
++     and current_inferior() assertion fails not finding the LWP->PID.
++     It got fixed post-gdb-7.0 by:
++       Add base multi-executable/process support to GDB.
++       40ff0a289e6165aa930af284df5c52162cb0cd5f
++     by introducing `current_inferior_'.  */
++  struct inferior *inf = find_inferior_pid (ptid_get_pid (inferior_ptid));
++
++  gdb_assert (object == TARGET_OBJECT_AUXV);
++  gdb_assert (readbuf || writebuf);
++
++   /* ld_so_xfer_auxv is the only function safe for virtual executables being
++      executed by valgrind's memcheck.  As using ld_so_xfer_auxv is problematic
++      during inferior startup GDB does call it only for attached processes.  */
++
++  if (inf == NULL || inf->attach_flag != 0)
++    {
++      LONGEST retval;
++
++      retval = ld_so_xfer_auxv (readbuf, writebuf, offset, len);
++      if (retval != -1)
++	return retval;
++    }
++
++  return procfs_xfer_auxv (readbuf, writebuf, offset, len);
++}
++
+ /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
+    Return 0 if *READPTR is already at the end of the buffer.
+    Return -1 if there is insufficient buffer for a whole entry.
+diff --git a/gdb/auxv.h b/gdb/auxv.h
+index 71e6562..87c24ae 100644
+--- a/gdb/auxv.h
++++ b/gdb/auxv.h
+@@ -43,11 +43,7 @@ extern int target_auxv_search (struct target_ops *ops,
+ /* Print the contents of the target's AUXV on the specified file. */
+ extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
+ 
+-/* This function is called like a to_xfer_partial hook, but must be
+-   called with TARGET_OBJECT_AUXV.  It handles access via
+-   /proc/PID/auxv, which is a common method for native targets.  */
+-
+-extern LONGEST procfs_xfer_auxv (struct target_ops *ops,
++extern LONGEST memory_xfer_auxv (struct target_ops *ops,
+ 				 enum target_object object,
+ 				 const char *annex,
+ 				 gdb_byte *readbuf,
+diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
+index 0f35101..bffc5a6 100644
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -4805,7 +4805,8 @@ disable_breakpoints_in_shlibs (void)
+        to insert those breakpoints and fail.  */
+     if (((b->type == bp_breakpoint)
+ 	 || (b->type == bp_hardware_breakpoint)
+-	 || (b->type == bp_tracepoint))
++	 || (b->type == bp_tracepoint)
++	 || b->type == bp_shlib_event)
+ 	&& !loc->shlib_disabled
+ #ifdef PC_SOLIB
+ 	&& PC_SOLIB (loc->address)
+diff --git a/gdb/defs.h b/gdb/defs.h
+index 94674dc..57aaae2 100644
+--- a/gdb/defs.h
++++ b/gdb/defs.h
+@@ -98,7 +98,20 @@
+ /* A byte from the program being debugged.  */
+ typedef bfd_byte gdb_byte;
+ 
+-/* An address in the program being debugged.  Host byte order.  */
++/* An address in the program being debugged.  Host byte order.
++
++   Its width is the maximum width of all the supported targets.  That means
++   32-bit target will run on such GDB using 64-bit CORE_ADDR cluttering the
++   bits 32...63 with random data from internal GDB calculations.  GDB currently
++   in general truncates the address width only when it is being presented/used
++   externally (such as by the paddress function).
++
++   FIXME: This is still not right as any GDB internal comparisons (such as >=)
++   of CORE_ADDR do not use the properly truncated width.  As converting all the
++   CORE_ADDR operations to width-aware functions is not feasible the way out
++   could be a width-aware C++ class CORE_ADDR referencing gdbarch as its
++   constructor parameter.  */
++
+ typedef bfd_vma CORE_ADDR;
+ 
+ /* The largest CORE_ADDR value.  */
+diff --git a/gdb/exec.c b/gdb/exec.c
+index 455151e..67f40d9 100644
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -656,8 +656,33 @@ print_section_info (struct target_section_table *t, bfd *abfd)
+   wrap_here ("        ");
+   printf_filtered (_("file type %s.\n"), bfd_get_target (abfd));
+   if (abfd == exec_bfd)
+-    printf_filtered (_("\tEntry point: %s\n"),
+-                     paddress (gdbarch, bfd_get_start_address (abfd)));
++    {
++      bfd_vma displacement = 0;
++
++      for (p = t->sections; p < t->sections_end; p++)
++	{
++	  asection *asect = p->the_bfd_section;
++
++	  if ((bfd_get_section_flags (abfd, asect) & (SEC_ALLOC | SEC_LOAD))
++	      != (SEC_ALLOC | SEC_LOAD))
++	    continue;
++
++	  if (bfd_get_section_vma (abfd, asect) <= abfd->start_address
++	      && abfd->start_address < bfd_get_section_vma (abfd, asect)
++				       + bfd_get_section_size (asect))
++	    {
++	      displacement = p->addr - bfd_get_section_vma (abfd, asect);
++	      break;
++	    }
++	}
++      if (p == t->sections_end)
++	warning (_("Cannot find section for the entry point of %s.\n"),
++		 bfd_get_filename (abfd));
++
++      printf_filtered (_("\tEntry point: %s\n"),
++		       paddress (gdbarch, bfd_get_start_address (abfd)
++					  + displacement));
++    }
+   for (p = t->sections; p < t->sections_end; p++)
+     {
+       printf_filtered ("\t%s", hex_string_custom (p->addr, wid));
+diff --git a/gdb/infcmd.c b/gdb/infcmd.c
+index fab1892..fc0f05d 100644
+--- a/gdb/infcmd.c
++++ b/gdb/infcmd.c
+@@ -395,22 +395,6 @@ post_create_inferior (struct target_ops *target, int from_tty)
+   /* Now that we know the register layout, retrieve current PC.  */
+   stop_pc = regcache_read_pc (get_current_regcache ());
+ 
+-  /* If the solist is global across processes, there's no need to
+-     refetch it here.  */
+-  if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch))
+-    {
+-      /* Sometimes the platform-specific hook loads initial shared
+-	 libraries, and sometimes it doesn't.  Try to do so first, so
+-	 that we can add them with the correct value for FROM_TTY.
+-	 If we made all the inferior hook methods consistent,
+-	 this call could be removed.  */
+-#ifdef SOLIB_ADD
+-      SOLIB_ADD (NULL, from_tty, target, auto_solib_add);
+-#else
+-      solib_add (NULL, from_tty, target, auto_solib_add);
+-#endif
+-    }
+-
+   if (exec_bfd)
+     {
+       /* Create the hooks to handle shared library load and unload
+@@ -418,7 +402,25 @@ post_create_inferior (struct target_ops *target, int from_tty)
+ #ifdef SOLIB_CREATE_INFERIOR_HOOK
+       SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+ #else
+-      solib_create_inferior_hook ();
++      solib_create_inferior_hook (from_tty);
++#endif
++    }
++
++  /* If the solist is global across processes, there's no need to
++     refetch it here.  */
++  if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch))
++    {
++      /* Sometimes the platform-specific hook loads initial shared
++	 libraries, and sometimes it doesn't.  If it doesn't FROM_TTY will be
++	 incorrectly 0 but such solib targets should be fixed anyway.  If we
++	 made all the inferior hook methods consistent, this call could be
++	 removed.  Call it only after the solib target has been initialized by
++	 solib_create_inferior_hook.  */
++
++#ifdef SOLIB_ADD
++      SOLIB_ADD (NULL, 0, target, auto_solib_add);
++#else
++      solib_add (NULL, 0, target, auto_solib_add);
+ #endif
+     }
+ 
+diff --git a/gdb/infrun.c b/gdb/infrun.c
+index 9d29b15..ed451d5 100644
+--- a/gdb/infrun.c
++++ b/gdb/infrun.c
+@@ -544,7 +544,7 @@ follow_exec (ptid_t pid, char *execd_pathname)
+ #ifdef SOLIB_CREATE_INFERIOR_HOOK
+   SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+ #else
+-  solib_create_inferior_hook ();
++  solib_create_inferior_hook (0);
+ #endif
+ 
+   jit_inferior_created_hook ();
+diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
+index 0907f03..1c18782 100644
+--- a/gdb/linux-nat.c
++++ b/gdb/linux-nat.c
+@@ -4674,7 +4674,7 @@ linux_xfer_partial (struct target_ops *ops, enum target_object object,
+   LONGEST xfer;
+ 
+   if (object == TARGET_OBJECT_AUXV)
+-    return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
++    return memory_xfer_auxv (ops, object, annex, readbuf, writebuf,
+ 			     offset, len);
+ 
+   if (object == TARGET_OBJECT_OSDATA)
+diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
+index 6634703..37770f5 100644
+--- a/gdb/linux-tdep.c
++++ b/gdb/linux-tdep.c
+@@ -18,12 +18,8 @@
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+ 
+ #include "defs.h"
+-#include "gdbcore.h"
+ #include "gdbtypes.h"
+ #include "linux-tdep.h"
+-#include "observer.h"
+-
+-#include "elf-bfd.h"
+ 
+ /* This function is suitable for architectures that don't
+    extend/override the standard siginfo structure.  */
+@@ -138,30 +134,3 @@ linux_get_siginfo_type (struct gdbarch *gdbarch)
+ 
+   return siginfo_type;
+ }
+-
+-/* Observer for the executable_changed event, to check whether the new
+-   exec binary is a PIE (Position Independent Executable) specimen, which
+-   is currently unsupported.  */
+-
+-static void
+-check_is_pie_binary (void)
+-{
+-  Elf_Internal_Ehdr *elf_hdr;
+-
+-  if (!exec_bfd)
+-    return;
+-  else if (bfd_get_flavour (exec_bfd) != bfd_target_elf_flavour)
+-    return;
+-
+-  if (elf_tdata (exec_bfd)->elf_header->e_type == ET_DYN)
+-    warning (_("\
+-The current binary is a PIE (Position Independent Executable), which\n\
+-GDB does NOT currently support.  Most debugger features will fail if used\n\
+-in this session.\n"));
+-}
+-
+-void
+-_initialize_linux_tdep (void)
+-{
+-  observer_attach_executable_changed (check_is_pie_binary);
+-}
+diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
+index 0adb045..ea89331 100644
+--- a/gdb/nto-procfs.c
++++ b/gdb/nto-procfs.c
+@@ -652,7 +652,7 @@ static void
+ procfs_post_attach (pid_t pid)
+ {
+   if (exec_bfd)
+-    solib_create_inferior_hook ();
++    solib_create_inferior_hook (0);
+ }
+ 
+ static ptid_t
+@@ -1212,7 +1212,7 @@ procfs_create_inferior (struct target_ops *ops, char *exec_file,
+ 
+   if (exec_bfd != NULL
+       || (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
+-    solib_create_inferior_hook ();
++    solib_create_inferior_hook (0);
+ }
+ 
+ static void
+diff --git a/gdb/objfiles.c b/gdb/objfiles.c
+index e5442ca..fb0cea9 100644
+--- a/gdb/objfiles.c
++++ b/gdb/objfiles.c
+@@ -544,9 +544,10 @@ free_all_objfiles (void)
+ }
+ 
+ /* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
+-   entries in new_offsets.  */
+-void
+-objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
++   entries in new_offsets.  SEPARATE_DEBUG_OBJFILE is not touched here.  */
++
++static void
++objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
+ {
+   struct obj_section *s;
+   struct section_offsets *delta =
+@@ -624,6 +625,10 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+     }
+   }
+ 
++  if (objfile->psymtabs_addrmap)
++    addrmap_relocate (objfile->psymtabs_addrmap,
++		      ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
++
+   {
+     struct partial_symtab *p;
+ 
+@@ -701,6 +706,49 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+       exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
+ 				obj_section_addr (s));
+     }
++}
++
++/* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
++   entries in new_offsets.  Process also OBJFILE's SEPARATE_DEBUG_OBJFILE.
++
++   The number and ordering of sections does differ between the two objfiles.
++   Only their names match.  Also the file offsets will differ (objfile being
++   possibly prelinked but separate_debug_objfile is probably not prelinked) but
++   the in-memory absolute address as specified by NEW_OFFSETS must match both
++   files.  */
++
++void
++objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
++{
++  objfile_relocate1 (objfile, new_offsets);
++
++  if (objfile->separate_debug_objfile != NULL)
++    {
++      struct objfile *debug_objfile = objfile->separate_debug_objfile;
++      struct section_addr_info *objfile_addrs;
++      struct section_offsets *new_debug_offsets;
++      int new_debug_num_sections;
++      struct cleanup *my_cleanups;
++
++      objfile_addrs = build_section_addr_info_from_objfile (objfile);
++      my_cleanups = make_cleanup (xfree, objfile_addrs);
++
++      /* Here OBJFILE_ADDRS contain the correct absolute addresses, the
++	 relative ones must be already created according to debug_objfile.  */
++
++      addr_info_make_relative (objfile_addrs, debug_objfile->obfd);
++
++      gdb_assert (debug_objfile->num_sections
++		  == bfd_count_sections (debug_objfile->obfd));
++      new_debug_offsets = alloca (SIZEOF_N_SECTION_OFFSETS
++						 (debug_objfile->num_sections));
++      relative_addr_info_to_section_offsets (new_debug_offsets,
++					     debug_objfile->num_sections,
++					     objfile_addrs);
++      do_cleanups (my_cleanups);
++
++      objfile_relocate1 (debug_objfile, new_debug_offsets);
++    }
+ 
+   /* Relocate breakpoints as necessary, after things are relocated. */
+   breakpoint_re_set ();
+diff --git a/gdb/procfs.c b/gdb/procfs.c
+index b569bac..15829c2 100644
+--- a/gdb/procfs.c
++++ b/gdb/procfs.c
+@@ -4376,7 +4376,7 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
+ 
+ #ifdef NEW_PROC_API
+     case TARGET_OBJECT_AUXV:
+-      return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
++      return memory_xfer_auxv (ops, object, annex, readbuf, writebuf,
+ 			       offset, len);
+ #endif
+ 
+diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
+index 9428d92..3591168 100644
+--- a/gdb/solib-darwin.c
++++ b/gdb/solib-darwin.c
+@@ -277,7 +277,7 @@ darwin_special_symbol_handling (void)
+ 
+ /* Shared library startup support.  See documentation in solib-svr4.c  */
+ static void
+-darwin_solib_create_inferior_hook (void)
++darwin_solib_create_inferior_hook (int from_tty)
+ {
+   struct minimal_symbol *msymbol;
+   char **bkpt_namep;
+diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
+index b8d5528..002c589 100644
+--- a/gdb/solib-frv.c
++++ b/gdb/solib-frv.c
+@@ -971,7 +971,7 @@ frv_relocate_main_executable (void)
+  */
+ 
+ static void
+-frv_solib_create_inferior_hook (void)
++frv_solib_create_inferior_hook (int from_tty)
+ {
+   /* Relocate main executable.  */
+   frv_relocate_main_executable ();
+diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
+index a0c1cd2..f94f7dc 100644
+--- a/gdb/solib-irix.c
++++ b/gdb/solib-irix.c
+@@ -386,7 +386,7 @@ enable_break (void)
+ 
+    SYNOPSIS
+ 
+-   void solib_create_inferior_hook ()
++   void solib_create_inferior_hook (int from_tty)
+ 
+    DESCRIPTION
+ 
+@@ -431,7 +431,7 @@ enable_break (void)
+  */
+ 
+ static void
+-irix_solib_create_inferior_hook (void)
++irix_solib_create_inferior_hook (int from_tty)
+ {
+   struct inferior *inf;
+   struct thread_info *tp;
+diff --git a/gdb/solib-null.c b/gdb/solib-null.c
+index b39ccdb..87f7848 100644
+--- a/gdb/solib-null.c
++++ b/gdb/solib-null.c
+@@ -32,7 +32,7 @@ null_special_symbol_handling (void)
+ }
+ 
+ static void
+-null_solib_create_inferior_hook (void)
++null_solib_create_inferior_hook (int from_tty)
+ {
+ }
+ 
+diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c
+index c295335..0acc7fb 100644
+--- a/gdb/solib-osf.c
++++ b/gdb/solib-osf.c
+@@ -306,7 +306,7 @@ osf_clear_solib (void)
+    Also, what if child has exit()ed?  Must exit loop somehow.  */
+ 
+ static void
+-osf_solib_create_inferior_hook (void)
++osf_solib_create_inferior_hook (int from_tty)
+ {
+   struct inferior *inf;
+   struct thread_info *tp;
+diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
+index 637fc1a..16d4010 100644
+--- a/gdb/solib-pa64.c
++++ b/gdb/solib-pa64.c
+@@ -329,7 +329,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
+    with shared libraries mapped shareable.  */
+ 
+ static void
+-pa64_solib_create_inferior_hook (void)
++pa64_solib_create_inferior_hook (int from_tty)
+ {
+   struct minimal_symbol *msymbol;
+   unsigned int dld_flags, status;
+diff --git a/gdb/solib-som.c b/gdb/solib-som.c
+index 16f00a3..37ac8cd 100644
+--- a/gdb/solib-som.c
++++ b/gdb/solib-som.c
+@@ -182,7 +182,7 @@ struct {
+    means running until the "_start" is called.  */
+ 
+ static void
+-som_solib_create_inferior_hook (void)
++som_solib_create_inferior_hook (int from_tty)
+ {
+   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+   struct minimal_symbol *msymbol;
+diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
+index 9f06fa9..45e7e69 100644
+--- a/gdb/solib-spu.c
++++ b/gdb/solib-spu.c
+@@ -52,25 +52,19 @@
+ static void
+ spu_relocate_main_executable (int spufs_fd)
+ {
+-  struct objfile *objfile;
+-  struct cleanup *old_chain;
+   struct section_offsets *new_offsets;
+   int i;
+ 
+-  for (objfile = symfile_objfile;
+-       objfile;
+-       objfile = objfile->separate_debug_objfile)
+-    {
+-      new_offsets = xcalloc (objfile->num_sections,
+-			     sizeof (struct section_offsets));
+-      old_chain = make_cleanup (xfree, new_offsets);
++  if (symfile_objfile == NULL)
++    return;
+ 
+-      for (i = 0; i < objfile->num_sections; i++)
+-        new_offsets->offsets[i] = SPUADDR (spufs_fd, 0);
++  new_offsets = alloca (symfile_objfile->num_sections
++			* sizeof (struct section_offsets));
+ 
+-      objfile_relocate (objfile, new_offsets);
+-      do_cleanups (old_chain);
+-    }
++  for (i = 0; i < symfile_objfile->num_sections; i++)
++    new_offsets->offsets[i] = SPUADDR (spufs_fd, 0);
++
++  objfile_relocate (symfile_objfile, new_offsets);
+ }
+ 
+ /* When running a stand-alone SPE executable, we may need to skip one more
+@@ -370,7 +364,7 @@ spu_enable_break (struct objfile *objfile)
+ 
+ /* Create inferior hook.  */
+ static void
+-spu_solib_create_inferior_hook (void)
++spu_solib_create_inferior_hook (int from_tty)
+ {
+   /* Remove all previously installed solib breakpoints.  Both the SVR4
+      code and us will re-install all required breakpoints.  */
+@@ -401,7 +395,7 @@ spu_solib_create_inferior_hook (void)
+     }
+ 
+   /* Call SVR4 hook -- this will re-insert the SVR4 solib breakpoints.  */
+-  svr4_so_ops.solib_create_inferior_hook ();
++  svr4_so_ops.solib_create_inferior_hook (from_tty);
+ 
+   /* If the inferior is statically linked against libspe, we need to install
+      our own solib breakpoint right now.  Otherwise, it will be installed by
+diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
+index 9b2a470..b2a147d 100644
+--- a/gdb/solib-sunos.c
++++ b/gdb/solib-sunos.c
+@@ -740,7 +740,7 @@ sunos_special_symbol_handling (void)
+  */
+ 
+ static void
+-sunos_solib_create_inferior_hook (void)
++sunos_solib_create_inferior_hook (int from_tty)
+ {
+   struct thread_info *tp;
+   struct inferior *inf;
+diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+index 68aadc0..efbe717 100644
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -50,6 +50,7 @@
+ 
+ static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
+ static int svr4_have_link_map_offsets (void);
++static void svr4_relocate_main_executable (void);
+ 
+ /* Link map info to include in an allocated so_list entry */
+ 
+@@ -599,11 +600,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+ {
+   int arch_size, step, sect_size;
+   long dyn_tag;
+-  CORE_ADDR dyn_ptr, dyn_addr;
++  CORE_ADDR dyn_ptr;
+   gdb_byte *bufend, *bufstart, *buf;
+   Elf32_External_Dyn *x_dynp_32;
+   Elf64_External_Dyn *x_dynp_64;
+   struct bfd_section *sect;
++  struct target_section *target_section;
+ 
+   if (abfd == NULL)
+     return 0;
+@@ -619,7 +621,13 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+   sect = bfd_get_section_by_name (abfd, ".dynamic");
+   if (sect == NULL)
+     return 0;
+-  dyn_addr = bfd_section_vma (abfd, sect);
++
++  for (target_section = target_get_section_table (&exec_ops)->sections;
++       target_section < target_get_section_table (&exec_ops)->sections_end;
++       target_section++)
++    if (sect == target_section->the_bfd_section)
++      break;
++  gdb_assert (target_section < target_get_section_table (&exec_ops)->sections_end);
+ 
+   /* Read in .dynamic from the BFD.  We will get the actual value
+      from memory later.  */
+@@ -661,7 +669,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+ 	     CORE_ADDR ptr_addr;
+ 
+ 	     ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+-	     ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
++	     ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8;
+ 	     if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
+ 	       dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
+ 	     *ptr = dyn_ptr;
+@@ -1258,7 +1266,7 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
+  */
+ 
+ static int
+-enable_break (struct svr4_info *info)
++enable_break (struct svr4_info *info, int from_tty)
+ {
+   struct minimal_symbol *msymbol;
+   char **bkpt_namep;
+@@ -1279,7 +1287,7 @@ enable_break (struct svr4_info *info)
+      mean r_brk has already been relocated.  Assume the dynamic linker
+      is the object containing r_brk.  */
+ 
+-  solib_add (NULL, 0, &current_target, auto_solib_add);
++  solib_add (NULL, from_tty, &current_target, auto_solib_add);
+   sym_addr = 0;
+   if (info->debug_base && solib_svr4_r_map (info) != 0)
+     sym_addr = solib_svr4_r_brk (info);
+@@ -1339,6 +1347,11 @@ enable_break (struct svr4_info *info)
+       bfd *tmp_bfd = NULL;
+       struct target_ops *tmp_bfd_target;
+       volatile struct gdb_exception ex;
++      int addr_bit = gdbarch_addr_bit (target_gdbarch);
++      CORE_ADDR mask = CORE_ADDR_MAX;
++
++      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
++	mask = ((CORE_ADDR) 1 << addr_bit) - 1;
+ 
+       sym_addr = 0;
+ 
+@@ -1404,7 +1417,7 @@ enable_break (struct svr4_info *info)
+ 	  info->debug_loader_name = xstrdup (interp_name);
+ 	  info->debug_loader_offset_p = 1;
+ 	  info->debug_loader_offset = load_addr;
+-	  solib_add (NULL, 0, &current_target, auto_solib_add);
++	  solib_add (NULL, from_tty, &current_target, auto_solib_add);
+ 	}
+ 
+       /* Record the relocated start and end address of the dynamic linker
+@@ -1414,16 +1427,20 @@ enable_break (struct svr4_info *info)
+ 	{
+ 	  interp_text_sect_low =
+ 	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
++	  interp_text_sect_low &= mask;
+ 	  interp_text_sect_high =
+ 	    interp_text_sect_low + bfd_section_size (tmp_bfd, interp_sect);
++	  interp_text_sect_high &= mask;
+ 	}
+       interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
+       if (interp_sect)
+ 	{
+ 	  interp_plt_sect_low =
+ 	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
++	  interp_text_sect_low &= mask;
+ 	  interp_plt_sect_high =
+ 	    interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
++	  interp_text_sect_high &= mask;
+ 	}
+ 
+       /* Now try to set a breakpoint in the dynamic linker.  */
+@@ -1448,7 +1465,7 @@ enable_break (struct svr4_info *info)
+ 
+       if (sym_addr != 0)
+ 	{
+-	  create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr);
++	  create_solib_event_breakpoint (target_gdbarch, (load_addr + sym_addr) & mask);
+ 	  xfree (interp_name);
+ 	  return 1;
+ 	}
+@@ -1517,113 +1534,131 @@ enable_break (struct svr4_info *info)
+ static void
+ svr4_special_symbol_handling (void)
+ {
++  svr4_relocate_main_executable ();
+ }
+ 
+-/* Relocate the main executable.  This function should be called upon
+-   stopping the inferior process at the entry point to the program. 
+-   The entry point from BFD is compared to the PC and if they are
+-   different, the main executable is relocated by the proper amount. 
++/* Decide if the objfile needs to be relocated.  As indicated above,
++   we will only be here when execution is stopped at the beginning
++   of the program.  Relocation is necessary if the address at which
++   we are presently stopped differs from the start address stored in
++   the executable AND there's no interpreter section.  The condition
++   regarding the interpreter section is very important because if
++   there *is* an interpreter section, execution will begin there
++   instead.  When there is an interpreter section, the start address
++   is (presumably) used by the interpreter at some point to start
++   execution of the program.
++
++   If there is an interpreter, it is normal for it to be set to an
++   arbitrary address at the outset.  The job of finding it is
++   handled in enable_break().
++
++   So, to summarize, relocations are necessary when there is no
++   interpreter section and the start address obtained from the
++   executable is different from the address at which GDB is
++   currently stopped.
+    
+-   As written it will only attempt to relocate executables which
+-   lack interpreter sections.  It seems likely that only dynamic
+-   linker executables will get relocated, though it should work
+-   properly for a position-independent static executable as well.  */
++   [ The astute reader will note that we also test to make sure that
++     the executable in question has the DYNAMIC flag set.  It is my
++     opinion that this test is unnecessary (undesirable even).  It
++     was added to avoid inadvertent relocation of an executable
++     whose e_type member in the ELF header is not ET_DYN.  There may
++     be a time in the future when it is desirable to do relocations
++     on other types of files as well in which case this condition
++     should either be removed or modified to accomodate the new file
++     type.  (E.g, an ET_EXEC executable which has been built to be
++     position-independent could safely be relocated by the OS if
++     desired.  It is true that this violates the ABI, but the ABI
++     has been known to be bent from time to time.)  - Kevin, Nov 2000. ]
++   */
+ 
+-static void
+-svr4_relocate_main_executable (void)
++static CORE_ADDR
++svr4_static_exec_displacement (void)
+ {
+   asection *interp_sect;
+   struct regcache *regcache
+     = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+   CORE_ADDR pc = regcache_read_pc (regcache);
+ 
+-  /* Decide if the objfile needs to be relocated.  As indicated above,
+-     we will only be here when execution is stopped at the beginning
+-     of the program.  Relocation is necessary if the address at which
+-     we are presently stopped differs from the start address stored in
+-     the executable AND there's no interpreter section.  The condition
+-     regarding the interpreter section is very important because if
+-     there *is* an interpreter section, execution will begin there
+-     instead.  When there is an interpreter section, the start address
+-     is (presumably) used by the interpreter at some point to start
+-     execution of the program.
+-
+-     If there is an interpreter, it is normal for it to be set to an
+-     arbitrary address at the outset.  The job of finding it is
+-     handled in enable_break().
+-
+-     So, to summarize, relocations are necessary when there is no
+-     interpreter section and the start address obtained from the
+-     executable is different from the address at which GDB is
+-     currently stopped.
+-     
+-     [ The astute reader will note that we also test to make sure that
+-       the executable in question has the DYNAMIC flag set.  It is my
+-       opinion that this test is unnecessary (undesirable even).  It
+-       was added to avoid inadvertent relocation of an executable
+-       whose e_type member in the ELF header is not ET_DYN.  There may
+-       be a time in the future when it is desirable to do relocations
+-       on other types of files as well in which case this condition
+-       should either be removed or modified to accomodate the new file
+-       type.  (E.g, an ET_EXEC executable which has been built to be
+-       position-independent could safely be relocated by the OS if
+-       desired.  It is true that this violates the ABI, but the ABI
+-       has been known to be bent from time to time.)  - Kevin, Nov 2000. ]
+-     */
+-
+   interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
+   if (interp_sect == NULL 
+       && (bfd_get_file_flags (exec_bfd) & DYNAMIC) != 0
+       && (exec_entry_point (exec_bfd, &exec_ops) != pc))
++    return pc - exec_entry_point (exec_bfd, &exec_ops);
++
++  return 0;
++}
++
++/* We relocate all of the sections by the same amount.  This
++   behavior is mandated by recent editions of the System V ABI. 
++   According to the System V Application Binary Interface,
++   Edition 4.1, page 5-5:
++
++     ...  Though the system chooses virtual addresses for
++     individual processes, it maintains the segments' relative
++     positions.  Because position-independent code uses relative
++     addressesing between segments, the difference between
++     virtual addresses in memory must match the difference
++     between virtual addresses in the file.  The difference
++     between the virtual address of any segment in memory and
++     the corresponding virtual address in the file is thus a
++     single constant value for any one executable or shared
++     object in a given process.  This difference is the base
++     address.  One use of the base address is to relocate the
++     memory image of the program during dynamic linking.
++
++   The same language also appears in Edition 4.0 of the System V
++   ABI and is left unspecified in some of the earlier editions.  */
++
++static CORE_ADDR
++svr4_exec_displacement (void)
++{
++  int found;
++  CORE_ADDR entry_point;
++
++  if (exec_bfd == NULL)
++    return 0;
++
++  if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
++    return entry_point - exec_entry_point (exec_bfd, &current_target);
++
++  return svr4_static_exec_displacement ();
++}
++
++/* Relocate the main executable.  This function should be called upon
++   stopping the inferior process at the entry point to the program. 
++   The entry point from BFD is compared to the AT_ENTRY of AUXV and if they are
++   different, the main executable is relocated by the proper amount.  */
++
++static void
++svr4_relocate_main_executable (void)
++{
++  CORE_ADDR displacement = svr4_exec_displacement ();
++
++  /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
++     difference of in-memory vs. in-file addresses and we could already
++     relocate the executable at this function to improper address before.  */
++
++  if (symfile_objfile)
+     {
+-      struct cleanup *old_chain;
+       struct section_offsets *new_offsets;
+-      int i, changed;
+-      CORE_ADDR displacement;
+-      
+-      /* It is necessary to relocate the objfile.  The amount to
+-	 relocate by is simply the address at which we are stopped
+-	 minus the starting address from the executable.
+-
+-	 We relocate all of the sections by the same amount.  This
+-	 behavior is mandated by recent editions of the System V ABI. 
+-	 According to the System V Application Binary Interface,
+-	 Edition 4.1, page 5-5:
+-
+-	   ...  Though the system chooses virtual addresses for
+-	   individual processes, it maintains the segments' relative
+-	   positions.  Because position-independent code uses relative
+-	   addressesing between segments, the difference between
+-	   virtual addresses in memory must match the difference
+-	   between virtual addresses in the file.  The difference
+-	   between the virtual address of any segment in memory and
+-	   the corresponding virtual address in the file is thus a
+-	   single constant value for any one executable or shared
+-	   object in a given process.  This difference is the base
+-	   address.  One use of the base address is to relocate the
+-	   memory image of the program during dynamic linking.
+-
+-	 The same language also appears in Edition 4.0 of the System V
+-	 ABI and is left unspecified in some of the earlier editions.  */
+-
+-      displacement = pc - exec_entry_point (exec_bfd, &exec_ops);
+-      changed = 0;
+-
+-      new_offsets = xcalloc (symfile_objfile->num_sections,
+-			     sizeof (struct section_offsets));
+-      old_chain = make_cleanup (xfree, new_offsets);
++      int i;
++
++      new_offsets = alloca (symfile_objfile->num_sections
++			    * sizeof (*new_offsets));
+ 
+       for (i = 0; i < symfile_objfile->num_sections; i++)
+-	{
+-	  if (displacement != ANOFFSET (symfile_objfile->section_offsets, i))
+-	    changed = 1;
+-	  new_offsets->offsets[i] = displacement;
+-	}
++	new_offsets->offsets[i] = displacement;
+ 
+-      if (changed)
+-	objfile_relocate (symfile_objfile, new_offsets);
++      objfile_relocate (symfile_objfile, new_offsets);
++    }
++  else if (exec_bfd)
++    {
++      asection *asect;
+ 
+-      do_cleanups (old_chain);
++      for (asect = exec_bfd->sections; asect != NULL; asect = asect->next)
++	exec_set_section_address (bfd_get_filename (exec_bfd), asect->index,
++				  bfd_section_vma (exec_bfd, asect)
++				  + displacement);
+     }
+ }
+ 
+@@ -1635,7 +1670,7 @@ svr4_relocate_main_executable (void)
+ 
+    SYNOPSIS
+ 
+-   void svr4_solib_create_inferior_hook ()
++   void svr4_solib_create_inferior_hook (int from_tty)
+ 
+    DESCRIPTION
+ 
+@@ -1680,7 +1715,7 @@ svr4_relocate_main_executable (void)
+  */
+ 
+ static void
+-svr4_solib_create_inferior_hook (void)
++svr4_solib_create_inferior_hook (int from_tty)
+ {
+   struct inferior *inf;
+   struct thread_info *tp;
+@@ -1689,12 +1724,13 @@ svr4_solib_create_inferior_hook (void)
+   info = get_svr4_info (PIDGET (inferior_ptid));
+ 
+   /* Relocate the main executable if necessary.  */
+-  svr4_relocate_main_executable ();
++  if (current_inferior ()->attach_flag == 0)
++    svr4_relocate_main_executable ();
+ 
+   if (!svr4_have_link_map_offsets ())
+     return;
+ 
+-  if (!enable_break (info))
++  if (!enable_break (info, from_tty))
+     return;
+ 
+ #if defined(_SCO_DS)
+@@ -1910,8 +1946,19 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
+ 		       const char *name,
+ 		       const domain_enum domain)
+ {
+-  if (objfile->obfd == NULL
+-     || scan_dyntag (DT_SYMBOLIC, objfile->obfd, NULL) != 1)
++  bfd *abfd;
++
++  if (objfile == symfile_objfile)
++    abfd = exec_bfd;
++  else
++    {
++      /* OBJFILE should have been passed as the non-debug one.  */
++      gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
++
++      abfd = objfile->obfd;
++    }
++
++  if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1)
+     return NULL;
+ 
+   return lookup_global_symbol_from_objfile (objfile, name, domain);
+diff --git a/gdb/solib-target.c b/gdb/solib-target.c
+index 07415e4..d160a70 100644
+--- a/gdb/solib-target.c
++++ b/gdb/solib-target.c
+@@ -306,7 +306,7 @@ solib_target_special_symbol_handling (void)
+ }
+ 
+ static void
+-solib_target_solib_create_inferior_hook (void)
++solib_target_solib_create_inferior_hook (int from_tty)
+ {
+   /* Nothing needed.  */
+ }
+diff --git a/gdb/solib.c b/gdb/solib.c
+index 3574e62..7ea3663 100644
+--- a/gdb/solib.c
++++ b/gdb/solib.c
+@@ -998,7 +998,7 @@ clear_solib (void)
+ 
+    SYNOPSIS
+ 
+-   void solib_create_inferior_hook ()
++   void solib_create_inferior_hook (int from_tty)
+ 
+    DESCRIPTION
+ 
+@@ -1008,10 +1008,10 @@ clear_solib (void)
+    SOLIB_CREATE_INFERIOR_HOOK.  */
+ 
+ void
+-solib_create_inferior_hook (void)
++solib_create_inferior_hook (int from_tty)
+ {
+   struct target_so_ops *ops = solib_ops (target_gdbarch);
+-  ops->solib_create_inferior_hook();
++  ops->solib_create_inferior_hook (from_tty);
+ }
+ 
+ /* GLOBAL FUNCTION
+@@ -1087,7 +1087,6 @@ reload_shared_libraries (char *ignored, int from_tty,
+ 			 struct cmd_list_element *e)
+ {
+   no_shared_libraries (NULL, from_tty);
+-  solib_add (NULL, from_tty, NULL, auto_solib_add);
+   /* Creating inferior hooks here has two purposes. First, if we reload 
+      shared libraries then the address of solib breakpoint we've computed
+      previously might be no longer valid.  For example, if we forgot to set
+@@ -1102,9 +1101,19 @@ reload_shared_libraries (char *ignored, int from_tty,
+ #ifdef SOLIB_CREATE_INFERIOR_HOOK
+       SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+ #else
+-      solib_create_inferior_hook ();
++      solib_create_inferior_hook (from_tty);
+ #endif
+     }
++
++  /* Sometimes the platform-specific hook loads initial shared
++     libraries, and sometimes it doesn't.  If it doesn't FROM_TTY will be
++     incorrectly 0 but such solib targets should be fixed anyway.  If we
++     made all the inferior hook methods consistent, this call could be
++     removed.  Call it only after the solib target has been initialized by
++     solib_create_inferior_hook.  */
++
++  solib_add (NULL, 0, NULL, auto_solib_add);
++
+   /* We have unloaded and then reloaded debug info for all shared libraries.
+      However, frames may still reference them, for example a frame's 
+      unwinder might still point of DWARF FDE structures that are now freed.
+diff --git a/gdb/solib.h b/gdb/solib.h
+index ccc5b63..abe5e19 100644
+--- a/gdb/solib.h
++++ b/gdb/solib.h
+@@ -41,7 +41,7 @@ extern int solib_read_symbols (struct so_list *, int);
+    addresses to which they are linked, and sufficient information to
+    read in their symbols at a later time.  */
+ 
+-extern void solib_create_inferior_hook (void);
++extern void solib_create_inferior_hook (int from_tty);
+ 
+ /* If ADDR lies in a shared library, return its name.  */
+ 
+diff --git a/gdb/solist.h b/gdb/solist.h
+index 005e8f7..9724fe7 100644
+--- a/gdb/solist.h
++++ b/gdb/solist.h
+@@ -87,7 +87,7 @@ struct target_so_ops
+     void (*clear_solib) (void);
+ 
+     /* Target dependent code to run after child process fork.  */
+-    void (*solib_create_inferior_hook) (void);
++    void (*solib_create_inferior_hook) (int from_tty);
+ 
+     /* Do additional symbol handling, lookup, etc. after symbols
+        for a shared object have been loaded.  */
+diff --git a/gdb/symfile.c b/gdb/symfile.c
+index c31b72a..6d7fa10 100644
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -536,40 +536,151 @@ place_section (bfd *abfd, asection *sect, void *obj)
+   arg->lowest = start_addr + bfd_get_section_size (sect);
+ }
+ 
+-/* Parse the user's idea of an offset for dynamic linking, into our idea
+-   of how to represent it for fast symbol reading.  This is the default
+-   version of the sym_fns.sym_offsets function for symbol readers that
+-   don't need to do anything special.  It allocates a section_offsets table
+-   for the objectfile OBJFILE and stuffs ADDR into all of the offsets.  */
++/* Build (allocate and populate) struct section_addr_info with absolute
++   addresses from OBJFILE->OBFD and OBJFILE->SECTION_OFFSETS.  */
++
++struct section_addr_info *
++build_section_addr_info_from_objfile (struct objfile *objfile)
++{
++  struct target_section *sections = NULL, *sections_end;
++  struct target_section *p;
++  int addr_bit = gdbarch_addr_bit (objfile->gdbarch);
++  CORE_ADDR mask = CORE_ADDR_MAX;
++  struct section_addr_info *retval;
++  struct cleanup *my_cleanups;
++
++  if (build_section_table (objfile->obfd, &sections, &sections_end))
++    error (_("Can't find the file sections in `%s': %s"),
++	   bfd_get_filename (objfile->obfd), bfd_errmsg (bfd_get_error ()));
++  my_cleanups = make_cleanup (xfree, sections);
++
++  if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
++    mask = ((CORE_ADDR) 1 << addr_bit) - 1;
++
++  for (p = sections; p < sections_end; p++)
++    {
++      CORE_ADDR baseaddr;
++
++      gdb_assert (p->the_bfd_section->index < objfile->num_sections);
++      baseaddr = ANOFFSET (objfile->section_offsets,
++			   p->the_bfd_section->index);
++
++      p->addr = (p->addr + baseaddr) & mask;
++      p->endaddr = (p->endaddr + baseaddr) & mask;
++    }
++
++  retval = build_section_addr_info_from_section_table (sections, sections_end);
++
++  do_cleanups (my_cleanups);
++
++  return retval;
++}
++
++/* Store struct section_addr_info as prepared (made relative and with SECTINDEX
++   filled-in) by addr_info_make_relative into SECTION_OFFSETS of NUM_SECTIONS
++   entries.  */
+ 
+ void
+-default_symfile_offsets (struct objfile *objfile,
+-			 struct section_addr_info *addrs)
++relative_addr_info_to_section_offsets (struct section_offsets *section_offsets,
++				       int num_sections,
++				       struct section_addr_info *addrs)
+ {
+   int i;
+ 
+-  objfile->num_sections = bfd_count_sections (objfile->obfd);
+-  objfile->section_offsets = (struct section_offsets *)
+-    obstack_alloc (&objfile->objfile_obstack,
+-		   SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
+-  memset (objfile->section_offsets, 0,
+-	  SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
++  memset (section_offsets, 0, SIZEOF_N_SECTION_OFFSETS (num_sections));
+ 
+-  /* Now calculate offsets for section that were specified by the
+-     caller. */
++  /* Now calculate offsets for section that were specified by the caller. */
+   for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+     {
+-      struct other_sections *osp ;
++      struct other_sections *osp;
+ 
+-      osp = &addrs->other[i] ;
++      osp = &addrs->other[i];
+       if (osp->addr == 0)
+   	continue;
+ 
+       /* Record all sections in offsets */
+       /* The section_offsets in the objfile are here filled in using
+          the BFD index. */
+-      (objfile->section_offsets)->offsets[osp->sectindex] = osp->addr;
++      section_offsets->offsets[osp->sectindex] = osp->addr;
++    }
++}
++
++/* Relativize absolute addresses in ADDRS into offsets based on ABFD.  Fill-in
++   also SECTINDEXes there.  */
++
++void
++addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
++{
++  asection *lower_sect;
++  asection *sect;
++  CORE_ADDR lower_offset;
++  int i;
++
++  /* Find lowest loadable section to be used as starting point for
++     continguous sections. FIXME!! won't work without call to find
++     .text first, but this assumes text is lowest section. */
++  lower_sect = bfd_get_section_by_name (abfd, ".text");
++  if (lower_sect == NULL)
++    bfd_map_over_sections (abfd, find_lowest_section, &lower_sect);
++  if (lower_sect == NULL)
++    {
++      warning (_("no loadable sections found in added symbol-file %s"),
++	       bfd_get_filename (abfd));
++      lower_offset = 0;
++    }
++  else
++    lower_offset = bfd_section_vma (bfd_get_filename (abfd), lower_sect);
++
++  /* Calculate offsets for the loadable sections.
++     FIXME! Sections must be in order of increasing loadable section
++     so that contiguous sections can use the lower-offset!!!
++
++     Adjust offsets if the segments are not contiguous.
++     If the section is contiguous, its offset should be set to
++     the offset of the highest loadable section lower than it
++     (the loadable section directly below it in memory).
++     this_offset = lower_offset = lower_addr - lower_orig_addr */
++
++  for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
++    {
++      if (addrs->other[i].addr != 0)
++	{
++	  sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
++	  if (sect)
++	    {
++	      addrs->other[i].addr -= bfd_section_vma (abfd, sect);
++	      lower_offset = addrs->other[i].addr;
++	      /* This is the index used by BFD. */
++	      addrs->other[i].sectindex = sect->index;
++	    }
++	  else
++	    {
++	      warning (_("section %s not found in %s"), addrs->other[i].name,
++		       bfd_get_filename (abfd));
++	      addrs->other[i].addr = 0;
++	    }
++	}
++      else
++	addrs->other[i].addr = lower_offset;
+     }
++}
++
++/* Parse the user's idea of an offset for dynamic linking, into our idea
++   of how to represent it for fast symbol reading.  This is the default
++   version of the sym_fns.sym_offsets function for symbol readers that
++   don't need to do anything special.  It allocates a section_offsets table
++   for the objectfile OBJFILE and stuffs ADDR into all of the offsets.  */
++
++void
++default_symfile_offsets (struct objfile *objfile,
++			 struct section_addr_info *addrs)
++{
++  objfile->num_sections = bfd_count_sections (objfile->obfd);
++  objfile->section_offsets = (struct section_offsets *)
++    obstack_alloc (&objfile->objfile_obstack,
++		   SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
++  relative_addr_info_to_section_offsets (objfile->section_offsets,
++					 objfile->num_sections, addrs);
+ 
+   /* For relocatable files, all loadable sections will start at zero.
+      The zero is meaningless, so try to pick arbitrary addresses such
+@@ -803,65 +914,8 @@ syms_from_objfile (struct objfile *objfile,
+ 
+      We no longer warn if the lowest section is not a text segment (as
+      happens for the PA64 port.  */
+-  if (!mainline && addrs && addrs->other[0].name)
+-    {
+-      asection *lower_sect;
+-      asection *sect;
+-      CORE_ADDR lower_offset;
+-      int i;
+-
+-      /* Find lowest loadable section to be used as starting point for
+-         continguous sections. FIXME!! won't work without call to find
+-	 .text first, but this assumes text is lowest section. */
+-      lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
+-      if (lower_sect == NULL)
+-	bfd_map_over_sections (objfile->obfd, find_lowest_section,
+-			       &lower_sect);
+-      if (lower_sect == NULL)
+-	{
+-	  warning (_("no loadable sections found in added symbol-file %s"),
+-		   objfile->name);
+-	  lower_offset = 0;
+-	}
+-      else
+-	lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
+-
+-      /* Calculate offsets for the loadable sections.
+- 	 FIXME! Sections must be in order of increasing loadable section
+- 	 so that contiguous sections can use the lower-offset!!!
+-
+-         Adjust offsets if the segments are not contiguous.
+-         If the section is contiguous, its offset should be set to
+- 	 the offset of the highest loadable section lower than it
+- 	 (the loadable section directly below it in memory).
+- 	 this_offset = lower_offset = lower_addr - lower_orig_addr */
+-
+-        for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+-          {
+-            if (addrs->other[i].addr != 0)
+-              {
+-                sect = bfd_get_section_by_name (objfile->obfd,
+-                                                addrs->other[i].name);
+-                if (sect)
+-                  {
+-                    addrs->other[i].addr
+-                      -= bfd_section_vma (objfile->obfd, sect);
+-                    lower_offset = addrs->other[i].addr;
+-                    /* This is the index used by BFD. */
+-                    addrs->other[i].sectindex = sect->index ;
+-                  }
+-                else
+-                  {
+-                    warning (_("section %s not found in %s"),
+-                             addrs->other[i].name,
+-                             objfile->name);
+-                    addrs->other[i].addr = 0;
+-                  }
+-              }
+-            else
+-              addrs->other[i].addr = lower_offset;
+-          }
+-    }
++  if (addrs && addrs->other[0].name)
++    addr_info_make_relative (addrs, objfile->obfd);
+ 
+   /* Initialize symbol reading routines for this objfile, allow complaints to
+      appear for this new file, and record how verbose to be, then do the
+@@ -959,7 +1013,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+   struct objfile *objfile;
+   struct partial_symtab *psymtab;
+   char *debugfile = NULL;
+-  struct section_addr_info *orig_addrs = NULL;
+   struct cleanup *my_cleanups;
+   const char *name = bfd_get_filename (abfd);
+   const int from_tty = add_flags & SYMFILE_VERBOSE;
+@@ -981,12 +1034,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+     objfile->flags |= OBJF_MAIN;
+   discard_cleanups (my_cleanups);
+ 
+-  if (addrs)
+-    {
+-      orig_addrs = copy_section_addr_info (addrs);
+-      make_cleanup_free_section_addr_info (orig_addrs);
+-    }
+-
+   /* We either created a new mapped symbol table, mapped an existing
+      symbol table file which has not had initial symbol reading
+      performed, or need to read an unmapped symbol table. */
+@@ -1033,18 +1080,17 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+      `.gnu_debuglink' may no longer be present with `.note.gnu.build-id'.  */
+   if (!has_any_debug_symbols (objfile))
+     debugfile = find_separate_debug_file (objfile);
++
+   if (debugfile)
+     {
+-      if (addrs != NULL)
+-	{
+-	  objfile->separate_debug_objfile
+-            = symbol_file_add (debugfile, add_flags, orig_addrs, flags);
+-	}
+-      else
+-	{
+-	  objfile->separate_debug_objfile
+-            = symbol_file_add (debugfile, add_flags, NULL, flags);
+-	}
++      struct section_addr_info *objfile_addrs;
++
++      objfile_addrs = build_section_addr_info_from_objfile (objfile);
++      make_cleanup (xfree, objfile_addrs);
++
++      objfile->separate_debug_objfile = symbol_file_add (debugfile, add_flags,
++							 objfile_addrs, flags);
++
+       objfile->separate_debug_objfile->separate_debug_objfile_backlink
+         = objfile;
+ 
+diff --git a/gdb/symfile.h b/gdb/symfile.h
+index bf9d9e7..bff6bd8 100644
+--- a/gdb/symfile.h
++++ b/gdb/symfile.h
+@@ -181,6 +181,16 @@ struct sym_fns
+ 
+ };
+ 
++extern struct section_addr_info *
++		 build_section_addr_info_from_objfile (struct objfile *objfile);
++
++extern void relative_addr_info_to_section_offsets
++  (struct section_offsets *section_offsets, int num_sections,
++   struct section_addr_info *addrs);
++
++extern void addr_info_make_relative (struct section_addr_info *addrs,
++				     bfd *abfd);
++
+ /* The default version of sym_fns.sym_offsets for readers that don't
+    do anything special.  */
+ 
+diff --git a/gdb/symtab.c b/gdb/symtab.c
+index 82e0163..01117e3 100644
+--- a/gdb/symtab.c
++++ b/gdb/symtab.c
+@@ -1449,7 +1449,12 @@ lookup_objfile_from_block (const struct block *block)
+   /* Go through SYMTABS.  */
+   ALL_SYMTABS (obj, s)
+     if (block == BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK))
+-      return obj;
++      {
++	if (obj->separate_debug_objfile_backlink)
++	  obj = obj->separate_debug_objfile_backlink;
++
++	return obj;
++      }
+ 
+   return NULL;
+ }
+diff --git a/gdb/testsuite/gdb.base/break-interp-lib.c b/gdb/testsuite/gdb.base/break-interp-lib.c
+new file mode 100644
+index 0000000..9ca943e
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/break-interp-lib.c
+@@ -0,0 +1,40 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <signal.h>
++#include <unistd.h>
++#include <assert.h>
++#include <stdio.h>
++
++void
++libfunc (const char *action)
++{
++  assert (action != NULL);
++
++  if (strcmp (action, "segv") == 0)
++    raise (SIGSEGV);
++
++  if (strcmp (action, "sleep") == 0)
++    {
++      puts ("sleeping");
++      fflush (stdout);
++
++      sleep (60);
++    }
++
++  assert (0);
++}
+diff --git a/gdb/testsuite/gdb.base/break-interp-main.c b/gdb/testsuite/gdb.base/break-interp-main.c
+new file mode 100644
+index 0000000..e12ec2b
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/break-interp-main.c
+@@ -0,0 +1,30 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <assert.h>
++
++extern void libfunc (const char *action);
++
++int
++main (int argc, char **argv)
++{
++  assert (argc == 2);
++
++  libfunc (argv[1]);
++
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
+new file mode 100644
+index 0000000..52f460c
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/break-interp.exp
+@@ -0,0 +1,545 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# This test only works on GNU/Linux.
++if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} {
++    continue
++}
++
++set test "break-interp"
++set binprefix ${objdir}/${subdir}/${test}
++# Only to get the $interp_system name.
++set srcfile_test "start.c"
++set binfile_test ${test}-test
++set binfile_lib ${objdir}/${subdir}/${test}.so
++set srcfile "${test}-main.c"
++set srcfile_lib "${test}-lib.c"
++
++if [get_compiler_info ${binfile_lib}] {
++    return -1
++}
++
++# Use -soname so that it is listed with " => " by ldd and this testcase makes
++# a copy of ${binfile_lib} for each prelink variant.
++
++if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} {
++    return -1
++}
++
++if {[build_executable ${test}.exp $binfile_test ${srcfile_test} {}] == -1} {
++    return -1
++}
++
++# Return the interpreter filename string.
++# Return "" if no interpreter was found.
++proc section_get {exec section} {
++    global objdir
++    global subdir
++    set tmp "${objdir}/${subdir}/break-interp.interp"
++    set objcopy_program [transform objcopy]
++
++    set command "exec $objcopy_program -O binary --set-section-flags $section=A --change-section-address $section=0 -j $section $exec $tmp"
++    verbose -log "command is $command"
++    set result [catch $command output]
++    verbose -log "result is $result"
++    verbose -log "output is $output"
++    if {$result == 1} {
++	return ""
++    }
++    set fi [open $tmp]
++    fconfigure $fi -translation binary
++    set data [read $fi]
++    close $fi
++    #file delete $tmp
++    # .interp has size $len + 1 but .gnu_debuglink contains garbage after \000.
++    set len [string first \000 $data]
++    if {$len < 0} {
++	verbose -log "section $section not found"
++	return ""
++    }
++    set retval [string range $data 0 [expr $len - 1]]
++    verbose -log "section $section is <$retval>"
++    return $retval
++}
++
++# Note: The separate debug info file content build-id/crc32 are not verified
++# contrary to the GDB search algorithm skipping non-matching ones.
++proc system_debug_get {exec} {
++    global debug_root
++
++    set exec_build_id_debug [build_id_debug_filename_get $exec]
++    set debug_base "[file tail $exec].debug"
++    set exec_dir [file dirname $exec]
++
++    # isfile returns 1 even for symlinks to files.
++    set retval $debug_root/$exec_build_id_debug
++    if [file isfile $retval] {
++	return $retval
++    }
++    set retval $exec_dir/$debug_base
++    if [file isfile $retval] {
++	return $retval
++    }
++    set retval $exec_dir/.debug/$debug_base
++    if [file isfile $retval] {
++	return $retval
++    }
++    set retval $debug_root/$exec_dir/$debug_base
++    if [file isfile $retval] {
++	return $retval
++    }
++    return ""
++}
++
++gdb_exit
++gdb_start
++set debug_root ""
++set test "show debug-file-directory"
++gdb_test_multiple $test $test {
++    -re "The directory where separate debug symbols are searched for is \"(.*)\".\r\n$gdb_prompt $" {
++	set debug_root $expect_out(1,string)
++    }
++}
++
++set interp_system [section_get ${objdir}/${subdir}/$binfile_test .interp]
++set interp_system_debug [system_debug_get $interp_system]
++verbose -log "$interp_system has debug $interp_system_debug"
++
++proc prelinkNO_run {arg} {
++    set command "exec /usr/sbin/prelink -uN $arg"
++    verbose -log "command is $command"
++    set result [catch $command output]
++    verbose -log "result is $result"
++    verbose -log "output is $output"
++    return [list $result $output]
++}
++
++proc prelinkNO {arg {name {}}} {
++    if {$name == ""} {
++	set name [file tail $arg]
++    }
++    set test "unprelink $name"
++    set run [prelinkNO_run $arg]
++    set result [lindex $run 0]
++    set output [lindex $run 1]
++    if {$result == 0 && $output == ""} {
++	verbose -log "$name has been now unprelinked"
++	set run [prelinkNO_run $arg]
++	set result [lindex $run 0]
++	set output [lindex $run 1]
++    }
++    # Last line does miss the trailing \n.
++    if {$result == 1 && [regexp {^(/usr/sbin/prelink: [^ ]* does not have .gnu.prelink_undo section\n?)*$} $output]} {
++	pass $test
++	return 1
++    } else {
++	fail $test
++	return 0
++    }
++}
++
++proc prelinkYES {arg {name ""}} {
++    if {$name == ""} {
++	set name [file tail $arg]
++    }
++    set test "prelink $name"
++    set command "exec /usr/sbin/prelink -qNR --no-exec-shield $arg"
++    verbose -log "command is $command"
++    set result [catch $command output]
++    verbose -log "result is $result"
++    verbose -log "output is $output"
++    if {$result == 0 && $output == ""} {
++	pass $test
++	return 1
++    } else {
++	fail $test
++	return 0
++    }
++}
++
++# Resolve symlinks.
++proc symlink_resolve {file} {
++    set loop 0
++    while {[file type $file] == "link"} {
++	set target [file readlink $file]
++	if {[file pathtype $target] == "relative"} {
++	    set src2 [file dirname $file]/$target
++	} else {
++	    set src2 $target
++	}
++	verbose -log "Resolved symlink $file targetting $target as $src2"
++	set file $src2
++
++	set loop [expr $loop + 1]
++	if {$loop > 30} {
++	    fail "Looping symlink resolution for $file"
++	    return ""
++	}
++    }
++    return $file
++}
++
++proc copy {src dest} {
++    set src [symlink_resolve $src]
++    # Test name would contain build-id hash for symlink-unresolved $src.
++    set test "copy [file tail $src] to [file tail $dest]"
++    set command "file copy -force $src $dest"
++    verbose -log "command is $command"
++    if [catch $command] {
++	fail $test
++	return 0
++    } else {
++    	pass $test
++	return 1
++    }
++}
++
++proc strip_debug {dest} {
++    set test "strip [file tail $dest]"
++    set strip_program [transform strip]
++    set command "exec $strip_program --strip-debug $dest"
++    verbose -log "command is $command"
++    if [catch $command] {
++	fail $test
++	return 0
++    } else {
++    	pass $test
++	return 1
++    }
++}
++
++# `runto' does not check we stopped really at the function we specified.
++proc reach {func command} {
++    global gdb_prompt
++
++    if [gdb_breakpoint $func allow-pending] {
++	set test "reach $func"
++	gdb_test_multiple $command $test {
++	    -re "Breakpoint \[0-9\]+, $func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
++		pass $test
++	    }
++	    -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" { 
++		pass $test
++	    }
++	}
++    }
++}
++
++proc test_core {file} {
++    global srcdir subdir gdb_prompt
++
++    set corefile [core_find $file {} "segv"]
++    if {$corefile == ""} {
++	return
++    }
++
++    gdb_exit
++    gdb_start
++    # Clear it to never find any separate debug infos in $debug_root.
++    gdb_test "set debug-file-directory" "" "set debug-file-directory for core"
++    gdb_reinitialize_dir $srcdir/$subdir
++    gdb_load $file
++
++    # Do not check the binary filename as it may be truncated.
++    gdb_test "core-file $corefile" "Core was generated by .*\r\n#0 .*" "core loaded"
++
++    # Check there is no "argc=can't compute CFA for this frame".
++    gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "core main bt"
++}
++
++proc test_attach {file} {
++    global board_info
++
++    gdb_exit
++
++    set test "sleep function started"
++
++    set command "${file} sleep"
++    set res [remote_spawn host $command];
++    if { $res < 0 || $res == "" } {
++	perror "Spawning $command failed."
++	fail $test
++	return
++    }
++    set pid [exp_pid -i $res]
++    gdb_expect {
++	-re "sleeping\r\n" {
++	    pass $test
++	}
++	eof {
++	    fail "$test (eof)"
++	    return
++	}
++	timeout {
++	    fail "$test (timeout)"
++	    return
++	}
++    }
++
++    gdb_exit
++    gdb_start
++    gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach"
++    # Check there is no "argc=can't compute CFA for this frame".
++    gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "attach main bt"
++    gdb_exit
++
++    remote_exec host "kill -9 $pid"
++}
++
++proc test_ld {file ifmain trynosym} {
++    global srcdir subdir gdb_prompt
++
++    # First test normal `file'-command loaded $FILE with symbols.
++
++    gdb_exit
++    gdb_start
++    # Clear it to never find any separate debug infos in $debug_root.
++    gdb_test "set debug-file-directory"
++    gdb_reinitialize_dir $srcdir/$subdir
++    gdb_load $file
++
++    reach "dl_main" "run segv"
++
++    gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
++
++    if $ifmain {
++	reach "main" continue
++
++	reach "libfunc" continue
++
++	# Check there is no "argc=can't compute CFA for this frame".
++	gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "main bt"
++
++	test_core $file
++
++	test_attach $file
++    }
++
++    if !$trynosym {
++	return
++    }
++
++    global pf_prefix
++    set old_ldprefix $pf_prefix
++    lappend pf_prefix "symbol-less:"
++
++    # Test also `exec-file'-command loaded $FILE - therefore without symbols.
++    # SYMBOL_OBJFILE is not available and only EXEC_BFD must be used.
++
++    gdb_exit
++    gdb_start
++    # Clear it to never find any separate debug infos in $debug_root.
++    gdb_test "set debug-file-directory"
++    gdb_reinitialize_dir $srcdir/$subdir
++
++    # Test no (error) message has been printed by `exec-file'.
++    set escapedfile [string_to_regexp $file]
++    gdb_test "exec-file $file" "exec-file $escapedfile" "load"
++
++    if $ifmain {
++	reach "dl_main" run
++
++	set test "info files"
++	set entrynohex ""
++	gdb_test_multiple $test $test {
++	    -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n.*$gdb_prompt $" {
++		set entrynohex $expect_out(1,string) 
++		pass $test
++	    }
++	}
++	if {$entrynohex != ""} {
++	    gdb_test "break *0x$entrynohex" "" "break at entry point"
++	    gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
++	}
++    } else {
++	# There is no symbol to break at ld.so.  Moreover it can exit with an
++	# error code.
++	gdb_test "run" "Program exited (normally|with code \[0-9\]+)\\." "ld.so exit"
++    }
++
++    set pf_prefix $old_ldprefix
++}
++
++# Create separate binaries for each testcase - to make the possible reported
++# problem reproducible after the whole test run finishes.
++
++set old_ldprefix $pf_prefix
++foreach ldprelink {NO YES} {
++    foreach ldsepdebug {NO IN SEP} {
++	# Skip running the ldsepdebug test if we do not have system separate
++	# debug info available.
++	if {$interp_system_debug == "" && $ldsepdebug == "SEP"} {
++	    continue
++	}
++
++	set ldname "LDprelink${ldprelink}debug${ldsepdebug}"
++	set interp $binprefix-$ldname
++
++	# prelink needs to always prelink all the dependencies to do any file
++	# modifications of its files.  ld.so also needs all the dependencies to
++	# be prelinked to omit the relocation process.  In-memory file offsets
++	# are not dependent whether ld.so went the prelink way or through the
++	# relocation process.
++	#
++	# For GDB we are not interested whether prelink succeeds as it is
++	# transparent to GDB.  GDB is being tested for differences of file
++	# offsets vs. in-memory offsets.  So we have to prelink even ld.so for
++	# the BIN modification to happen but we need to restore the original
++	# possibly unprelinked ld.so to test all the combinations for GDB.
++	set interp_saved ${interp}-saved
++
++	set pf_prefix $old_ldprefix
++	lappend pf_prefix "$ldname:"
++
++	if {$ldsepdebug == "NO"} {
++	    copy $interp_system $interp
++	    # Never call strip-debug before unprelink:
++	    # prelink: ...: Section .note.gnu.build-id created after prelinking
++	    if ![prelinkNO $interp] {
++		continue
++	    }
++	    strip_debug $interp
++	} elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} {
++	    copy $interp_system $interp
++	} elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} {
++	    copy $interp_system $interp
++	    copy $interp_system_debug "${interp}.debug"
++	    # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
++	    if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} {
++		continue
++	    }
++	    set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]"
++	    set command "exec eu-unstrip -o $interp $interp ${interp}.debug"
++	    verbose -log "command is $command"
++	    if [catch $command] {
++		setup_xfail *-*-*
++		fail $test
++		continue
++	    } else {
++		pass $test
++	    }
++	} elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} {
++	    copy $interp_system $interp
++	    # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
++	    if ![prelinkNO $interp] {
++		continue
++	    }
++	    gdb_gnu_strip_debug $interp
++	} elseif {$ldsepdebug == "SEP" && $interp_system_debug != ""} {
++	    copy $interp_system $interp
++	    copy $interp_system_debug "${interp}.debug"
++	}
++
++	if {$ldsepdebug == "SEP"} {
++	    if ![prelinkNO "${interp}.debug"] {
++		continue
++	    }
++	} else {
++	    file delete "${interp}.debug"
++	}
++
++	if ![prelink$ldprelink $interp] {
++	    continue
++	}
++	test_ld $interp 0 [expr {$ldsepdebug == "NO"}]
++
++	if ![copy $interp $interp_saved] {
++	    continue
++	}
++	set old_binprefix $pf_prefix
++	foreach binprelink {NO YES} {
++	    foreach binsepdebug {NO IN SEP} {
++		foreach binpie {NO YES} {
++		    # This combination is not possible, non-PIE (fixed address)
++		    # binary cannot be prelinked to any (other) address.
++		    if {$binprelink == "YES" && $binpie == "NO"} {
++			continue
++		    }
++
++		    set binname "BINprelink${binprelink}debug${binsepdebug}pie${binpie}"
++		    set exec $binprefix-$binname
++		    set dir ${exec}.d
++
++		    set pf_prefix $old_binprefix
++		    lappend pf_prefix "$binname:"
++
++		    set opts "additional_flags=-Wl,--dynamic-linker,$interp,-rpath,$dir"
++		    lappend opts "additional_flags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]"
++		    if {$binsepdebug != "NO"} {
++			lappend opts {debug}
++		    }
++		    if {$binpie == "YES"} {
++			lappend opts {additional_flags=-fPIE -pie}
++		    }
++		    if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
++			continue;
++		    }
++		    if {$binsepdebug == "SEP"} {
++			gdb_gnu_strip_debug $exec
++			# Just a sanity check.  As gdb_gnu_strip_debug uses the
++			# "[file dirname $exec]/.debug/[file tail $exec].debug"
++			# variant delete the higher-priority exec.debug file.
++			file delete "$exec.debug"
++		    }
++
++		    # Supply a self-sufficent directory $dir with the required
++		    # libraries.  To make an executable properly prelinked all
++		    # its dependencies on libraries must be also prelinked.  If
++		    # some of the system libraries is currently not prelinked
++		    # we have no right to prelink (modify it) at its current
++		    # system place.
++
++		    file delete -force $dir
++		    file mkdir $dir
++
++		    set command "ldd $exec"
++		    set result [catch "exec $command" output]
++		    verbose -log "result of $command is $result"
++		    verbose -log "output of $command is $output"
++		    if {$result != 0 || $output == ""} {
++			fail $command
++		    } else {
++			pass $command
++		    }
++
++		    # gdb testsuite will put there also needless -lm.
++		    set test "$command output contains libc"
++		    set libc [regexp -all -inline -line {^.* => (/[^ ]+).*$} $output]
++		    if {[llength $libc] == 0} {
++			fail $test
++		    } else {
++			pass $test
++		    }
++
++		    set dests {}
++		    for {set i 1} {$i < [llength $libc]} {incr i 2} {
++			set abspath [lindex $libc $i]
++			set dest "$dir/[file tail $abspath]"
++			copy $abspath $dest
++			lappend dests $dest
++		    }
++
++		    if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" $exec]
++		        && [copy $interp_saved $interp]} {
++			test_ld $exec 1 [expr {$binsepdebug == "NO"}]
++		    }
++		}
++	    }
++	}
++
++	file delete $interp_saved
++    }
++}
++set pf_prefix $old_ldprefix
+diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
+index a1003e1..547a898 100644
+--- a/gdb/testsuite/gdb.base/corefile.exp
++++ b/gdb/testsuite/gdb.base/corefile.exp
+@@ -42,65 +42,12 @@ if [get_compiler_info ${binfile}] {
+     return -1;
+ }
+ 
+-# Create a core file named "corefile" rather than just "core", to
+-# avoid problems with sys admin types that like to regularly prune all
+-# files named "core" from the system.
+-#
+-# Arbitrarily try setting the core size limit to "unlimited" since
+-# this does not hurt on systems where the command does not work and
+-# allows us to generate a core on systems where it does.
+-#
+-# Some systems append "core" to the name of the program; others append
+-# the name of the program to "core"; still others (like Linux, as of
+-# May 2003) create cores named "core.PID".  In the latter case, we
+-# could have many core files lying around, and it may be difficult to
+-# tell which one is ours, so let's run the program in a subdirectory.
+-set found 0
+-set coredir "${objdir}/${subdir}/coredir.[getpid]"
+-file mkdir $coredir
+-catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
+-#      remote_exec host "${binfile}"
+-foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
+-    if [remote_file build exists $i] {
+-	remote_exec build "mv $i ${objdir}/${subdir}/corefile"
+-	set found 1
+-    }
+-}
+-# Check for "core.PID".
+-if { $found == 0 } {
+-    set names [glob -nocomplain -directory $coredir core.*]
+-    if {[llength $names] == 1} {
+-        set corefile [file join $coredir [lindex $names 0]]
+-        remote_exec build "mv $corefile ${objdir}/${subdir}/corefile"
+-        set found 1
+-    }
+-}
+-if { $found == 0 } {
+-    # The braindamaged HPUX shell quits after the ulimit -c above
+-    # without executing ${binfile}.  So we try again without the
+-    # ulimit here if we didn't find a core file above.
+-    # Oh, I should mention that any "braindamaged" non-Unix system has
+-    # the same problem. I like the cd bit too, it's really neat'n stuff.
+-    catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
+-    foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
+-	if [remote_file build exists $i] {
+-	    remote_exec build "mv $i ${objdir}/${subdir}/corefile"
+-	    set found 1
+-	}
+-    }
++set corefile [core_find $binfile {coremmap.data}]
++if {$corefile == ""} {
++    return 0;
+ }
+ 
+-# Try to clean up after ourselves. 
+-remote_file build delete [file join $coredir coremmap.data]
+-remote_exec build "rmdir $coredir"
+-    
+-if { $found == 0  } {
+-    warning "can't generate a core file - core tests suppressed - check ulimit -c"
+-    return 0
+-}
+-
+-#
+-# Test that we can simply startup with a "-core=corefile" command line arg
++# Test that we can simply startup with a "-core=$corefile" command line arg
+ # and recognize that the core file is a valid, usable core file.
+ # To do this, we must shutdown the currently running gdb and restart
+ # with the -core args.  We can't use gdb_start because it looks for
+@@ -114,27 +61,27 @@ if { $found == 0  } {
+ 
+ gdb_exit
+ if $verbose>1 then {
+-    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile\n"
++    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$corefile\n"
+ }
+ 
+ set oldtimeout $timeout
+ set timeout [expr "$timeout + 60"]
+ verbose "Timeout is now $timeout seconds" 2
+-eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile"
++eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$corefile"
+ expect {
+     -re "Couldn't find .* registers in core file.*$gdb_prompt $" {
+-        fail "args: -core=corefile (couldn't find regs)"
++        fail "args: -core=[file tail $corefile] (couldn't find regs)"
+     }
+     -re "Core was generated by .*coremaker.*\r\n\#0  .*\(\).*\r\n$gdb_prompt $" {
+-	pass "args: -core=corefile"
++	pass "args: -core=[file tail $corefile]"
+     }
+     -re "Core was generated by .*\r\n\#0  .*\(\).*\r\n$gdb_prompt $" {
+-	pass "args: -core=corefile (with bad program name)"
++	pass "args: -core=[file tail $corefile] (with bad program name)"
+     }
+     -re ".*registers from core file: File in wrong format.* $" {
+-	fail "args: -core=corefile (could not read registers from core file)"
++	fail "args: -core=[file tail $corefile] (could not read registers from core file)"
+     }
+-    -re ".*$gdb_prompt $"	{ fail "args: -core=corefile" }
++    -re ".*$gdb_prompt $"	{ fail "args: -core=[file tail $corefile]" }
+     timeout 		{ fail "(timeout) starting with -core" }
+ }
+ 
+@@ -147,22 +94,22 @@ expect {
+ close;
+ 
+ if $verbose>1 then {
+-    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
++    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile\n"
+ }
+ 
+ 
+-eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
++eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile";
+ expect {
+     -re "Core was generated by .*coremaker.*\r\n\#0  .*\(\).*\r\n$gdb_prompt $" {
+-	pass "args: execfile -core=corefile"
++	pass "args: execfile -core=[file tail $corefile]"
+     }
+     -re "Core was generated by .*\r\n\#0  .*\(\).*\r\n$gdb_prompt $"	 {
+-	pass "args: execfile -core=corefile (with bad program name)"
++	pass "args: execfile -core=[file tail $corefile] (with bad program name)"
+     }
+     -re ".*registers from core file: File in wrong format.* $" {
+-	fail "args: execfile -core=corefile (could not read registers from core file)"
++	fail "args: execfile -core=[file tail $corefile] (could not read registers from core file)"
+     }
+-    -re ".*$gdb_prompt $"	{ fail "args: execfile -core=corefile" }
++    -re ".*$gdb_prompt $"	{ fail "args: execfile -core=[file tail $corefile]" }
+     timeout 		{ fail "(timeout) starting with -core" }
+ }
+ set timeout $oldtimeout
+@@ -178,7 +125,7 @@ gdb_load ${binfile}
+ 
+ # Test basic corefile recognition via core-file command.
+ 
+-send_gdb "core-file $objdir/$subdir/corefile\n"
++send_gdb "core-file $corefile\n"
+ gdb_expect {
+     -re ".* program is being debugged already.*y or n. $" {
+ 	# gdb_load may connect us to a gdbserver.
+diff --git a/gdb/testsuite/gdb.base/pie-support.c b/gdb/testsuite/gdb.base/pie-support.c
+deleted file mode 100644
+index 63768b9..0000000
+--- a/gdb/testsuite/gdb.base/pie-support.c
++++ /dev/null
+@@ -1,34 +0,0 @@
+-/* This testcase is part of GDB, the GNU debugger.
+-
+-   Copyright 2009 Free Software Foundation, Inc.
+-
+-   This program is free software; you can redistribute it and/or modify
+-   it under the terms of the GNU General Public License as published by
+-   the Free Software Foundation; either version 3 of the License, or
+-   (at your option) any later version.
+-
+-   This program is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-   GNU General Public License for more details.
+-
+-   You should have received a copy of the GNU General Public License
+-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-
+-*/
+-
+-#include <stdio.h>
+-
+-void
+-f1 (int a)
+-{
+-  printf ("a = %d\n", a);
+-}
+-
+-int
+-main (int argc, char *argv[])
+-{
+-  f1 (1);
+-
+-  return 0;
+-}
+diff --git a/gdb/testsuite/gdb.base/pie-support.exp b/gdb/testsuite/gdb.base/pie-support.exp
+deleted file mode 100644
+index 7d118c0..0000000
+--- a/gdb/testsuite/gdb.base/pie-support.exp
++++ /dev/null
+@@ -1,58 +0,0 @@
+-# Copyright 2009 Free Software Foundation, Inc.
+-
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 3 of the License, or
+-# (at your option) any later version.
+-#
+-# This program is distributed in the hope that it will be useful,
+-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-# GNU General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License
+-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-
+-set testfile pie-support
+-set srcfile ${testfile}.c
+-set objfile ${objdir}/${subdir}/${testfile}.o
+-set binfile ${objdir}/${subdir}/${testfile}
+-
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {quiet debug additional_flags=-fpie}] != "" } {
+-    untested "Couldn't compile test PIE object file."
+-    return -1
+-}
+-if  { [gdb_compile "${objfile}" "${binfile}" executable {quiet debug additional_flags=-pie}] != "" } {
+-    untested "Couldn't compile test PIE binary."
+-    return -1
+-}
+-
+-# Get things started.
+-
+-gdb_exit
+-gdb_start
+-gdb_reinitialize_dir $srcdir/$subdir
+-
+-if [is_remote host] {
+-  set binfile [remote_download host $binfile]
+-    if { $binfile == "" } {
+-      untested "Couldn't download remote test binary."
+-      return -1
+-    }
+-}
+-
+-# The file command used to kill the remote target.  For the benefit
+-# of the testsuite, preserve this behavior.
+-send_gdb "kill\n"
+-gdb_expect 120 {
+-    -re "Kill the program being debugged. .y or n. $" {
+-	send_gdb "y\n"
+-	verbose "\t\tKilling previous program being debugged"
+-	exp_continue
+-    }
+-    -re "$gdb_prompt $" {
+-	# OK.
+-    }
+-}
+-
+-gdb_test "file $binfile" "current binary is a PIE.*" "correctly detected PIE binary"
+diff --git a/gdb/testsuite/gdb.base/valgrind-db-attach.c b/gdb/testsuite/gdb.base/valgrind-db-attach.c
+new file mode 100644
+index 0000000..5faaaac
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/valgrind-db-attach.c
+@@ -0,0 +1,30 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <stdlib.h>
++
++int main()
++{
++  void *p;
++
++  p = malloc (1);
++  if (p == NULL)
++    return 1;
++  free (p);
++  free (p);	/* double-free */
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/valgrind-db-attach.exp b/gdb/testsuite/gdb.base/valgrind-db-attach.exp
+new file mode 100644
+index 0000000..ac06fd3
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/valgrind-db-attach.exp
+@@ -0,0 +1,74 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set test valgrind-db-attach
++set srcfile $test.c
++set executable $test
++set binfile ${objdir}/${subdir}/${executable}
++if {[build_executable $test.exp $executable $srcfile {debug}] == -1} {
++    return -1
++}
++
++gdb_exit
++
++# remote_spawn breaks the command on each whitespace despite possible quoting.
++# Use backslash-escaped whitespace there instead:
++
++set db_command "--db-command=$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts] %f %p"
++regsub -all " " $db_command "\\ " db_command
++
++set test "spawn valgrind"
++set cmd "valgrind --db-attach=yes $db_command $binfile"
++set res [remote_spawn host $cmd];
++if { $res < 0 || $res == "" } {
++    verbose -log "Spawning $cmd failed."
++    setup_xfail *-*-*
++    fail $test
++    return -1
++}
++pass $test
++# Declare GDB now as running.
++set gdb_spawn_id -1
++
++set test "valgrind started"
++# The trailing '.' differs for different memcheck versions.
++gdb_test_multiple "" $test {
++    -re "Memcheck, a memory error detector\\.?\r\n" {
++	pass $test
++    }
++    -re "valgrind: failed to start tool 'memcheck' for platform '.*': No such file or directory" {
++	setup_xfail *-*-*
++	fail $test
++	return -1
++    }
++}
++
++set double_free [gdb_get_line_number "double-free"]
++
++gdb_test_multiple "" $test {
++    -re "Invalid free\\(\\) / delete / delete\\\[\\\]\r\n.*: main \\(${srcfile}:$double_free\\)\r\n.*---- Attach to debugger \\? --- \[^\r\n\]* ---- " {
++	send_gdb "y\r"
++    }
++    -re "---- Attach to debugger \\? --- \[^\r\n\]* ---- " {
++	send_gdb "n\r"
++	exp_continue
++    }
++}
++
++# Initialization from default_gdb_start.
++gdb_test "set height 0"
++gdb_test "set width 0"
++
++gdb_test "bt" "in main \\(.*\\) at .*${srcfile}:$double_free"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
+index 61e1fe4..9109030 100644
+--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
++++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
+@@ -55,6 +55,12 @@ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+ 
++# Test also objfile->psymtabs_addrmap relocations for -fPIE -pie builds below.
++# On some targets it may possibly fail but the program is being started only
++# for the PIE build so try it anyway.
++
++runto_main
++
+ # Correct output:
+ # 	Line 39 of "../.././gdb/testsuite/gdb.dwarf2/dw2-ranges.S" starts at address 0x4 and ends at 0x8.
+ # Wrong output:
+diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
+index d0c3493..fbf9124 100644
+--- a/gdb/testsuite/lib/gdb.exp
++++ b/gdb/testsuite/lib/gdb.exp
+@@ -2778,6 +2778,11 @@ proc gdb_gnu_strip_debug { dest args } {
+       return 1
+     }
+ 
++    # Workaround PR binutils/10802:
++    # Preserve the 'x' bit also for PIEs (Position Independent Executables).
++    set perm [file attributes ${dest} -permissions]
++    file attributes ${stripped_file} -permissions $perm
++
+     # Get rid of everything but the debug info, and store result in debug_file
+     # This will be in the .debug subdirectory, see above.
+     set result [catch "exec $strip_to_file_program --only-keep-debug ${dest} -o ${debug_file}" output]
+@@ -2814,7 +2819,12 @@ proc gdb_gnu_strip_debug { dest args } {
+       return 1
+     }
+ 
+-   return 0
++    # Workaround PR binutils/10802:
++    # Preserve the 'x' bit also for PIEs (Position Independent Executables).
++    set perm [file attributes ${stripped_file} -permissions]
++    file attributes ${dest} -permissions $perm
++
++    return 0
+ }
+ 
+ # Test the output of GDB_COMMAND matches the pattern obtained
+@@ -3043,3 +3053,70 @@ if {[info exists TRANSCRIPT]} {
+     return [uplevel real_send_gdb $args]
+   }
+ }
++
++proc core_find {binfile {deletefiles {}} {arg ""}} {
++    global objdir subdir
++
++    set destcore "$binfile.core"
++    file delete $destcore
++
++    # Create a core file named "$destcore" rather than just "core", to
++    # avoid problems with sys admin types that like to regularly prune all
++    # files named "core" from the system.
++    #
++    # Arbitrarily try setting the core size limit to "unlimited" since
++    # this does not hurt on systems where the command does not work and
++    # allows us to generate a core on systems where it does.
++    #
++    # Some systems append "core" to the name of the program; others append
++    # the name of the program to "core"; still others (like Linux, as of
++    # May 2003) create cores named "core.PID".  In the latter case, we
++    # could have many core files lying around, and it may be difficult to
++    # tell which one is ours, so let's run the program in a subdirectory.
++    set found 0
++    set coredir "${objdir}/${subdir}/coredir.[getpid]"
++    file mkdir $coredir
++    catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile} ${arg}; true) >/dev/null 2>&1\""
++    #      remote_exec host "${binfile}"
++    foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
++	if [remote_file build exists $i] {
++	    remote_exec build "mv $i $destcore"
++	    set found 1
++	}
++    }
++    # Check for "core.PID".
++    if { $found == 0 } {
++	set names [glob -nocomplain -directory $coredir core.*]
++	if {[llength $names] == 1} {
++	    set corefile [file join $coredir [lindex $names 0]]
++	    remote_exec build "mv $corefile $destcore"
++	    set found 1
++	}
++    }
++    if { $found == 0 } {
++	# The braindamaged HPUX shell quits after the ulimit -c above
++	# without executing ${binfile}.  So we try again without the
++	# ulimit here if we didn't find a core file above.
++	# Oh, I should mention that any "braindamaged" non-Unix system has
++	# the same problem. I like the cd bit too, it's really neat'n stuff.
++	catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
++	foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
++	    if [remote_file build exists $i] {
++		remote_exec build "mv $i $destcore"
++		set found 1
++	    }
++	}
++    }
++
++    # Try to clean up after ourselves. 
++    foreach deletefile $deletefiles {
++	remote_file build delete [file join $coredir $deletefile]
++    }
++    remote_exec build "rmdir $coredir"
++	
++    if { $found == 0  } {
++	warning "can't generate a core file - core tests suppressed - check ulimit -c"
++	return ""
++    }
++    return $destcore
++}
diff --git a/gdb-archer.patch b/gdb-archer.patch
index 4257d8f..e4ac399 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 ce4ead356654b951a49ca78d81ebfff95e758bf5
+commit 6e73988f653ba986e8742f208f17ec084292cbd5
 
 branch `archer' - the merge of branches:
 archer-tromey-call-frame-cfa
@@ -463,7 +463,7 @@ index 53e7371..d373f8a 100644
 +
  #endif /* BLOCK_H */
 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
-index 811cdfb..b0bf314 100644
+index 811cdfb..0f35101 100644
 --- a/gdb/breakpoint.c
 +++ b/gdb/breakpoint.c
 @@ -61,6 +61,7 @@
@@ -684,14 +684,14 @@ index 811cdfb..b0bf314 100644
 +
 +  /* Find BC_L which is a leftmost element which may affect BUF content.  It is
 +     safe to report lower value but a failure to report higher one.  */
-+
+ 
+-  ALL_BP_LOCATIONS (b)
 +  bc_l = 0;
 +  bc_r = bp_location_count;
 +  while (bc_l + 1 < bc_r)
 +    {
 +      struct bp_location *b;
- 
--  ALL_BP_LOCATIONS (b)
++
 +      bc = (bc_l + bc_r) / 2;
 +      b = bp_location[bc];
 +
@@ -1553,7 +1553,7 @@ index 811cdfb..b0bf314 100644
  /* If SHOULD_INSERT is false, do not insert any breakpoint locations
     into the inferior, only remove already-inserted locations that no
     longer should be inserted.  Functions that delete a breakpoint or
-@@ -7777,49 +7951,66 @@ static void
+@@ -7777,49 +7951,78 @@ static void
  update_global_location_list (int should_insert)
  {
    struct breakpoint *b;
@@ -1625,11 +1625,11 @@ index 811cdfb..b0bf314 100644
      {
 -      /* Tells if 'loc' is found amoung the new locations.  If not, we
 +      struct bp_location *old_loc = *old_locp;
++      struct bp_location **loc2p;
 +
 +      /* Tells if 'old_loc' is found amoung the new locations.  If not, we
  	 have to free it.  */
--      int found_object = 0;
-+      int found_object;
+       int found_object = 0;
        /* Tells if the location should remain inserted in the target.  */
        int keep_in_target = 0;
        int removed = 0;
@@ -1643,13 +1643,24 @@ index 811cdfb..b0bf314 100644
 +      /* Skip LOCP entries which will definitely never be needed.  Stop either
 +	 at or being the one matching OLD_LOC.  */
 +      while (locp < bp_location + bp_location_count
-+	     && bp_location_compare (*locp, old_loc) < 0)
++	     && (*locp)->address < old_loc->address)
 +	locp++;
-+      found_object = locp < bp_location + bp_location_count && *locp == old_loc;
++
++      for (loc2p = locp;
++	   (loc2p < bp_location + bp_location_count
++	    && (*loc2p)->address == old_loc->address);
++	   loc2p++)
++	{
++	  if (*loc2p == old_loc)
++	    {
++	      found_object = 1;
++	      break;
++	    }
++	}
  
        /* If this location is no longer present, and inserted, look if there's
  	 maybe a new location at the same address.  If so, mark that one 
-@@ -7827,11 +8018,11 @@ update_global_location_list (int should_insert)
+@@ -7827,11 +8030,11 @@ update_global_location_list (int should_insert)
  	 don't have a time window where a breakpoint at certain location is not
  	 inserted.  */
  
@@ -1663,7 +1674,7 @@ index 811cdfb..b0bf314 100644
  	    {
  	      /* The location is still present in the location list, and still
  		 should be inserted.  Don't do anything.  */
-@@ -7842,37 +8033,46 @@ update_global_location_list (int should_insert)
+@@ -7842,37 +8045,46 @@ update_global_location_list (int should_insert)
  	      /* The location is either no longer present, or got disabled.
  		 See if there's another location at the same address, in which 
  		 case we don't need to remove this one from the target.  */
@@ -1685,24 +1696,24 @@ index 811cdfb..b0bf314 100644
 +
 +	      if (breakpoint_address_is_meaningful (old_loc->owner))
 +		{
-+		  struct bp_location **loc2p;
-+
 +		  for (loc2p = locp;
-+		       loc2p < bp_location + bp_location_count
-+		       && (*loc2p)->address == old_loc->address;
++		       (loc2p < bp_location + bp_location_count
++			&& (*loc2p)->address == old_loc->address);
 +		       loc2p++)
 +		    {
 +		      struct bp_location *loc2 = *loc2p;
 +
-+		      /* For the sake of should_be_inserted.
-+			 Duplicates check below will fix up this later.  */
-+		      loc2->duplicate = 0;
-+		      if (loc2 != old_loc && should_be_inserted (loc2))
-+			{		  
-+			  loc2->inserted = 1;
-+			  loc2->target_info = old_loc->target_info;
-+			  keep_in_target = 1;
-+			  break;
++			{
++			  /* For the sake of should_be_inserted.
++			     Duplicates check below will fix up this later.  */
++			  loc2->duplicate = 0;
++			  if (loc2 != old_loc && should_be_inserted (loc2))
++			    {
++			      loc2->inserted = 1;
++			      loc2->target_info = old_loc->target_info;
++			      keep_in_target = 1;
++			      break;
++			    }
 +			}
 +		    }
 +		}
@@ -1728,7 +1739,7 @@ index 811cdfb..b0bf314 100644
  		}
  	      removed = 1;
  	    }
-@@ -7894,19 +8094,59 @@ update_global_location_list (int should_insert)
+@@ -7894,19 +8106,59 @@ update_global_location_list (int should_insert)
  		 longer need to keep this breakpoint.  This is just a
  		 heuristic, but if it's wrong, we'll report unexpected SIGTRAP,
  		 which is usability issue, but not a correctness problem.  */
@@ -1794,7 +1805,7 @@ index 811cdfb..b0bf314 100644
      }
  
    if (breakpoints_always_inserted_mode () && should_insert
-@@ -8083,6 +8323,7 @@ delete_command (char *arg, int from_tty)
+@@ -8083,6 +8335,7 @@ delete_command (char *arg, int from_tty)
  	    && b->type != bp_thread_event
  	    && b->type != bp_overlay_event
  	    && b->type != bp_longjmp_master
@@ -1802,7 +1813,7 @@ index 811cdfb..b0bf314 100644
  	    && b->number >= 0)
  	  {
  	    breaks_to_delete = 1;
-@@ -8102,6 +8343,7 @@ delete_command (char *arg, int from_tty)
+@@ -8102,6 +8355,7 @@ delete_command (char *arg, int from_tty)
  		&& b->type != bp_jit_event
  		&& b->type != bp_overlay_event
  		&& b->type != bp_longjmp_master
@@ -1810,7 +1821,7 @@ index 811cdfb..b0bf314 100644
  		&& b->number >= 0)
  	      delete_breakpoint (b);
  	  }
-@@ -8404,6 +8646,7 @@ breakpoint_re_set_one (void *bint)
+@@ -8404,6 +8658,7 @@ breakpoint_re_set_one (void *bint)
  	 reset later by breakpoint_re_set.  */
      case bp_overlay_event:
      case bp_longjmp_master:
@@ -1818,7 +1829,7 @@ index 811cdfb..b0bf314 100644
        delete_breakpoint (b);
        break;
  
-@@ -8427,6 +8670,8 @@ breakpoint_re_set_one (void *bint)
+@@ -8427,6 +8682,8 @@ breakpoint_re_set_one (void *bint)
      case bp_longjmp:
      case bp_longjmp_resume:
      case bp_jit_event:
@@ -1827,7 +1838,7 @@ index 811cdfb..b0bf314 100644
        break;
      }
  
-@@ -8462,6 +8707,7 @@ breakpoint_re_set (void)
+@@ -8462,6 +8719,7 @@ breakpoint_re_set (void)
    create_longjmp_master_breakpoint ("_longjmp");
    create_longjmp_master_breakpoint ("siglongjmp");
    create_longjmp_master_breakpoint ("_siglongjmp");
@@ -1835,7 +1846,7 @@ index 811cdfb..b0bf314 100644
  }
  
  /* Reset the thread number of this breakpoint:
-@@ -9327,6 +9573,22 @@ all_tracepoints ()
+@@ -9327,6 +9585,22 @@ all_tracepoints ()
    return tp_vec;
  }
  
@@ -1858,7 +1869,7 @@ index 811cdfb..b0bf314 100644
  
  /* This help string is used for the break, hbreak, tbreak and thbreak commands.
     It is defined as a macro to prevent duplication.
-@@ -9850,4 +10112,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
+@@ -9850,4 +10124,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
    automatic_hardware_breakpoints = 1;
  
    observer_attach_about_to_proceed (breakpoint_about_to_proceed);
@@ -3102,7 +3113,7 @@ index 62800b8..97d587b 100644
  			{ $$ = $1.comp;
  			  if ($2) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2); }
 diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
-index d2d8f2e..af0ba28 100644
+index d2d8f2e..db26a01 100644
 --- a/gdb/cp-namespace.c
 +++ b/gdb/cp-namespace.c
 @@ -36,14 +36,17 @@ static struct using_direct *cp_copy_usings (struct using_direct *using,
@@ -3282,7 +3293,7 @@ index d2d8f2e..af0ba28 100644
        if (sym != NULL)
  	return sym;
      }
-@@ -320,25 +377,87 @@ lookup_namespace_scope (const char *name,
+@@ -320,25 +377,98 @@ lookup_namespace_scope (const char *name,
    namespace = alloca (scope_len + 1);
    strncpy (namespace, scope, scope_len);
    namespace[scope_len] = '\0';
@@ -3319,6 +3330,16 @@ index d2d8f2e..af0ba28 100644
 +    }
 +}
 +
++/* Used for cleanups to reset the "searched" flag incase
++   of an error.  */
++
++static void
++reset_directive_searched (void *data)
++{
++  struct using_direct *direct = data;
++  direct->searched = 0;
++}
++
 +/* Search for NAME by applying all import statements belonging
 +   to BLOCK which are applicable in SCOPE. If DECLARATION_ONLY the search
 +   is restricted to using declarations.
@@ -3351,11 +3372,11 @@ index d2d8f2e..af0ba28 100644
 -			    const struct block *block,
 -			    const domain_enum domain)
 +cp_lookup_symbol_imports (const char *scope,
-+                            const char *name,
-+                            const struct block *block,
-+                            const domain_enum domain,
-+                            int declaration_only,
-+                            int search_parents)
++                          const char *name,
++                          const struct block *block,
++                          const domain_enum domain,
++                          int declaration_only,
++                          int search_parents)
  {
 -  const struct using_direct *current;
 -  struct symbol *sym;
@@ -3363,6 +3384,7 @@ index d2d8f2e..af0ba28 100644
 +  struct symbol *sym = NULL;
 +  int directive_match;
 +  int current_line;
++  struct cleanup *searched_cleanup;
 +
 +  if(!declaration_only)
 +    /* First, try to find the symbol in the given namespace.  */
@@ -3382,7 +3404,7 @@ index d2d8f2e..af0ba28 100644
       names to the namespace we're searching in, see if we can find a
       match by applying them.  */
  
-@@ -346,39 +465,74 @@ cp_lookup_symbol_namespace (const char *namespace,
+@@ -346,39 +476,78 @@ cp_lookup_symbol_namespace (const char *namespace,
         current != NULL;
         current = current->next)
      {
@@ -3405,6 +3427,8 @@ index d2d8f2e..af0ba28 100644
 -					    block,
 -					    domain);
 +	  current->searched = 1;
++	  searched_cleanup = make_cleanup (reset_directive_searched, current);
++
 +	  /* If there is an import of a single declaration, compare the imported
 +	     declaration with the sought out name. If there is a match pass
 +	     current->import_src as NAMESPACE to direct the search towards the
@@ -3413,23 +3437,25 @@ index d2d8f2e..af0ba28 100644
 +	    {
 +	    if (strcmp (name, current->declaration) == 0)
 +	      {
-+	        sym = cp_lookup_symbol_in_namespace (current->import_src,
-+	                                          name,
-+	                                          block,
-+	                                          domain);
++	      sym = cp_lookup_symbol_in_namespace (current->import_src,
++	                                           name,
++	                                           block,
++	                                           domain);
 +	      }
++
++	    current->searched = 0;
++	    if (sym)
++	      return sym;
++
++	    continue;
 +	    }
 +	   
 +	  if (declaration_only)
-+            {
-+              current->searched = 0;
-+              if (sym)
-+                {
-+                  return sym;
-+                } else {
-+                  continue;
-+                }
-+            }
++	    {
++	    current->searched = 0;
++	    discard_cleanups (searched_cleanup);
++	    continue;
++	    }
 +
 +	  if (strcmp (name, current->alias) == 0)
 +	    /* If the import is creating an alias and the alias matches the
@@ -3437,26 +3463,25 @@ index d2d8f2e..af0ba28 100644
 +	       search towards the aliased namespace */
 +	    {
 +	    sym = cp_lookup_symbol_in_namespace (scope,
-+	                                      current->import_src,
-+	                                      block,
-+	                                      domain);
++	                                         current->import_src,
++	                                         block,
++	                                         domain);
 +	    } else if (strcmp ("", current->alias) == 0){
 +	    /* If this import statement creates no alias, pass current->inner as
 +	       NAMESPACE to direct the search towards the imported namespace. */
 +	      sym = cp_lookup_symbol_imports (current->import_src,
-+		                                name,
-+		                                block,
-+		                                domain,
-+		                                0,
-+		                                0);
++	                                      name,
++	                                      block,
++	                                      domain,
++	                                      0,
++	                                      0);
 +	    }
 +
 +	  current->searched = 0;
++	  discard_cleanups (searched_cleanup);
++
  	  if (sym != NULL)
--	    return sym;
-+	    {
-+	      return sym;
-+	    }
+ 	    return sym;
  	}
      }
  
@@ -3485,7 +3510,7 @@ index d2d8f2e..af0ba28 100644
  }
  
  /* Look up NAME in BLOCK's static block and in global blocks.  If
-@@ -388,17 +542,15 @@ cp_lookup_symbol_namespace (const char *namespace,
+@@ -388,17 +557,15 @@ cp_lookup_symbol_namespace (const char *namespace,
  
  static struct symbol *
  lookup_symbol_file (const char *name,
@@ -3504,7 +3529,7 @@ index d2d8f2e..af0ba28 100644
    if (anonymous_namespace)
      {
        /* Symbols defined in anonymous namespaces have external linkage
-@@ -408,12 +560,11 @@ lookup_symbol_file (const char *name,
+@@ -408,12 +575,11 @@ lookup_symbol_file (const char *name,
        const struct block *global_block = block_global_block (block);
        
        if (global_block != NULL)
@@ -3519,7 +3544,7 @@ index d2d8f2e..af0ba28 100644
      }
  
    if (sym != NULL)
-@@ -434,6 +585,7 @@ lookup_symbol_file (const char *name,
+@@ -434,6 +600,7 @@ lookup_symbol_file (const char *name,
        sym = lookup_possible_namespace_symbol (name);
        if (sym != NULL)
  	return sym;
@@ -3527,7 +3552,7 @@ index d2d8f2e..af0ba28 100644
      }
  
    return NULL;
-@@ -461,9 +613,8 @@ cp_lookup_nested_type (struct type *parent_type,
+@@ -461,9 +628,8 @@ cp_lookup_nested_type (struct type *parent_type,
  	   lookup_symbol_namespace works when looking them up.  */
  
  	const char *parent_name = TYPE_TAG_NAME (parent_type);
@@ -3538,7 +3563,7 @@ index d2d8f2e..af0ba28 100644
  							 block,
  							 VAR_DOMAIN);
  	if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
-@@ -709,7 +860,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
+@@ -709,7 +875,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
  
    memcpy (name_copy, name, len);
    name_copy[len] = '\0';
@@ -3547,7 +3572,7 @@ index d2d8f2e..af0ba28 100644
  
    if (sym == NULL)
      {
-@@ -749,7 +900,7 @@ lookup_possible_namespace_symbol (const char *name)
+@@ -749,7 +915,7 @@ lookup_possible_namespace_symbol (const char *name)
        struct symbol *sym;
  
        sym = lookup_block_symbol (get_possible_namespace_block (objfile),
@@ -4963,7 +4988,7 @@ index 0bfcfca..01018d6 100644
  
  #endif /* dwarf2loc.h */
 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
-index 4cce36b..c2f5f23 100644
+index 4cce36b..fb0a693 100644
 --- a/gdb/dwarf2read.c
 +++ b/gdb/dwarf2read.c
 @@ -48,6 +48,12 @@
@@ -5701,7 +5726,7 @@ index 4cce36b..c2f5f23 100644
        if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
  				 || cu->language != language_fortran))
  	complaint (&symfile_complaints, _("Tag '%s' has unexpected children"),
-@@ -3310,41 +3583,68 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3310,41 +3583,71 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
  /* Return the fully qualified name of DIE, based on its DW_AT_name.
     If scope qualifiers are appropriate they will be added.  The result
     will be allocated on the objfile_obstack, or NULL if the DIE does
@@ -5776,14 +5801,17 @@ index 4cce36b..c2f5f23 100644
    return name;
  }
  
-+/* read the given die's decl_line number. Return -1 if in case of an error */
-+static const int dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu){
++/* Read the given DIE's DW_AT_decl_line number.  Return -1 if in case of an
++   error.  */
++
++static int
++dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu)
++{
 +  struct attribute *line_attr;
 +
 +  line_attr = dwarf2_attr (die, DW_AT_decl_line, cu);
-+  if (line_attr){
-+    return  DW_UNSND (line_attr);
-+  }
++  if (line_attr)
++    return DW_UNSND (line_attr);
 +
 +  return -1;
 +}
@@ -5791,7 +5819,7 @@ index 4cce36b..c2f5f23 100644
  /* Read the import statement specified by the given die and record it.  */
  
  static void
-@@ -3354,9 +3654,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3354,9 +3657,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
    struct die_info *imported_die;
    const char *imported_name;
    const char *imported_name_prefix;
@@ -5809,7 +5837,7 @@ index 4cce36b..c2f5f23 100644
    import_attr = dwarf2_attr (die, DW_AT_import, cu);
    if (import_attr == NULL)
      {
-@@ -3404,17 +3710,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3404,17 +3713,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
        return;
      }
  
@@ -5843,7 +5871,7 @@ index 4cce36b..c2f5f23 100644
        canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
        strcpy (canonical_name, imported_name_prefix);
        strcat (canonical_name, "::");
-@@ -3425,8 +3741,14 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3425,8 +3744,14 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
        canonical_name = alloca (strlen (imported_name) + 1);
        strcpy (canonical_name, imported_name);
      }
@@ -5860,7 +5888,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  static void
-@@ -3695,6 +4017,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3695,6 +4020,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
    struct attribute *attr;
  
    attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
@@ -5875,7 +5903,7 @@ index 4cce36b..c2f5f23 100644
    if (!attr)
      return;
  
-@@ -3793,6 +4123,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3793,6 +4126,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
    char *name;
    CORE_ADDR baseaddr;
    struct block *block;
@@ -5883,7 +5911,7 @@ index 4cce36b..c2f5f23 100644
    int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
  
    if (inlined_func)
-@@ -3811,13 +4142,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3811,13 +4145,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  
    baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
@@ -5910,7 +5938,7 @@ index 4cce36b..c2f5f23 100644
    lowpc += baseaddr;
    highpc += baseaddr;
  
-@@ -3844,14 +4185,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3844,14 +4188,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  
    cu->list_in_scope = &local_symbols;
  
@@ -5937,7 +5965,7 @@ index 4cce36b..c2f5f23 100644
      }
  
    inherit_abstract_dies (die, cu);
-@@ -3867,6 +4213,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3867,6 +4216,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  			determine_prefix (die, cu),
  			processing_has_namespace_info);
  
@@ -5951,7 +5979,7 @@ index 4cce36b..c2f5f23 100644
    /* If we have address ranges, record them.  */
    dwarf2_record_block_ranges (die, block, baseaddr, cu);
    
-@@ -3903,7 +4256,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3903,7 +4259,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
       as multiple lexical blocks?  Handling children in a sane way would
       be nasty.  Might be easier to properly extend generic blocks to 
       describe ranges.  */
@@ -5960,7 +5988,7 @@ index 4cce36b..c2f5f23 100644
      return;
    lowpc += baseaddr;
    highpc += baseaddr;
-@@ -3920,7 +4273,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3920,7 +4276,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
      }
    new = pop_context ();
  
@@ -5969,7 +5997,7 @@ index 4cce36b..c2f5f23 100644
      {
        struct block *block
          = finish_block (0, &local_symbols, new->old_blocks, new->start_addr,
-@@ -4075,7 +4428,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
+@@ -4075,7 +4431,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
     discontinuous, i.e. derived from DW_AT_ranges information.  */
  static int
  dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
@@ -5979,7 +6007,7 @@ index 4cce36b..c2f5f23 100644
  {
    struct attribute *attr;
    CORE_ADDR low = 0;
-@@ -4103,7 +4457,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
+@@ -4103,7 +4460,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
  	{
  	  /* Value of the DW_AT_ranges attribute is the offset in the
  	     .debug_ranges section.  */
@@ -5988,7 +6016,7 @@ index 4cce36b..c2f5f23 100644
  	    return 0;
  	  /* Found discontinuous range of addresses.  */
  	  ret = -1;
-@@ -4142,7 +4496,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
+@@ -4142,7 +4499,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
    CORE_ADDR low, high;
    struct die_info *child = die->child;
  
@@ -5997,7 +6025,7 @@ index 4cce36b..c2f5f23 100644
      {
        *lowpc = min (*lowpc, low);
        *highpc = max (*highpc, high);
-@@ -4179,7 +4533,7 @@ get_scope_pc_bounds (struct die_info *die,
+@@ -4179,7 +4536,7 @@ get_scope_pc_bounds (struct die_info *die,
    CORE_ADDR best_high = (CORE_ADDR) 0;
    CORE_ADDR current_low, current_high;
  
@@ -6006,7 +6034,7 @@ index 4cce36b..c2f5f23 100644
      {
        best_low = current_low;
        best_high = current_high;
-@@ -4474,7 +4828,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
+@@ -4474,7 +4831,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
  	return;
  
        /* Get physical name.  */
@@ -6015,7 +6043,7 @@ index 4cce36b..c2f5f23 100644
  
        /* The name is already allocated along with this objfile, so we don't
  	 need to duplicate it for the type.  */
-@@ -4617,7 +4971,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4617,7 +4974,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
      return;
  
    /* Get the mangled name.  */
@@ -6024,7 +6052,7 @@ index 4cce36b..c2f5f23 100644
  
    /* Look up member function name in fieldlist.  */
    for (i = 0; i < fip->nfnfields; i++)
-@@ -4661,7 +5015,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4661,7 +5018,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
    /* The name is already allocated along with this objfile, so we don't
       need to duplicate it for the type.  */
    fnp->physname = physname ? physname : "";
@@ -6033,7 +6061,7 @@ index 4cce36b..c2f5f23 100644
    this_type = read_type_die (die, cu);
    if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC)
      {
-@@ -4721,18 +5075,18 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4721,18 +5078,18 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
      {
        /* Support the .debug_loc offsets */
        if (attr_form_is_block (attr))
@@ -6059,7 +6087,7 @@ index 4cce36b..c2f5f23 100644
     }
  }
  
-@@ -4845,7 +5199,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4845,7 +5202,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu)
      return NULL;
  
    domain_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
@@ -6068,7 +6096,7 @@ index 4cce36b..c2f5f23 100644
    smash_to_method_type (type, domain_type, TYPE_TARGET_TYPE (pfn_type),
  			TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type),
  			TYPE_VARARGS (pfn_type));
-@@ -4898,7 +5252,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4898,7 +5255,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
        return set_die_type (die, type, cu);
      }
  
@@ -6077,7 +6105,7 @@ index 4cce36b..c2f5f23 100644
    INIT_CPLUS_SPECIFIC (type);
  
    name = dwarf2_name (die, cu);
-@@ -4907,14 +5261,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4907,14 +5264,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
        if (cu->language == language_cplus
  	  || cu->language == language_java)
  	{
@@ -6099,7 +6127,7 @@ index 4cce36b..c2f5f23 100644
  	}
      }
  
-@@ -5124,7 +5482,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5124,7 +5485,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
        return set_die_type (die, type, cu);
      }
  
@@ -6108,7 +6136,7 @@ index 4cce36b..c2f5f23 100644
  
    TYPE_CODE (type) = TYPE_CODE_ENUM;
    name = dwarf2_full_name (die, cu);
-@@ -5152,51 +5510,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5152,51 +5513,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
    return set_die_type (die, type, cu);
  }
  
@@ -6160,7 +6188,7 @@ index 4cce36b..c2f5f23 100644
  /* Given a pointer to a die which begins an enumeration, process all
     the dies that define the members of the enumeration, and create the
     symbol for the enumeration type.
-@@ -5274,6 +5587,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5274,6 +5590,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
    new_symbol (die, this_type, cu);
  }
  
@@ -6190,7 +6218,7 @@ index 4cce36b..c2f5f23 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.  */
-@@ -5287,7 +5623,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5287,7 +5626,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;
@@ -6199,7 +6227,7 @@ index 4cce36b..c2f5f23 100644
    struct cleanup *back_to;
    char *name;
  
-@@ -5334,16 +5670,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5334,16 +5673,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)
@@ -6221,7 +6249,7 @@ index 4cce36b..c2f5f23 100644
  
    /* Understand Dwarf2 support for vector types (like they occur on
       the PowerPC w/ AltiVec).  Gcc just adds another attribute to the
-@@ -5410,12 +5741,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5410,12 +5744,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu)
    return set_die_type (die, set_type, cu);
  }
  
@@ -6238,7 +6266,7 @@ index 4cce36b..c2f5f23 100644
    struct attribute *attr;
    struct symbol *sym;
    CORE_ADDR base = (CORE_ADDR) 0;
-@@ -5425,25 +5758,55 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5425,25 +5761,55 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
      {
        /* Support the .debug_loc offsets */
        if (attr_form_is_block (attr))
@@ -6301,7 +6329,7 @@ index 4cce36b..c2f5f23 100644
  	  attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
  	  if (attr)
  	    {
-@@ -5461,8 +5824,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5461,8 +5827,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
  	      SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
  	      add_symbol_to_list (sym, &global_symbols);
  	    }
@@ -6327,7 +6355,7 @@ index 4cce36b..c2f5f23 100644
      }
  }
  
-@@ -5530,7 +5910,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5530,7 +5913,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
        if (is_anonymous)
  	{
  	  const char *previous_prefix = determine_prefix (die, cu);
@@ -6336,7 +6364,7 @@ index 4cce36b..c2f5f23 100644
  	}
      }
  
-@@ -5546,20 +5926,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5546,20 +5929,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
      }
  }
  
@@ -6376,18 +6404,18 @@ index 4cce36b..c2f5f23 100644
 +
 +  if (die_is_declaration (die, cu))
 +    return NULL;
- 
--  /* FIXME: Support the separate Fortran module namespaces.  */
++
 +  module_name = dwarf2_name (die, cu);
 +  if (!module_name)
 +    complaint (&symfile_complaints, _("DW_TAG_module has no name, offset 0x%x"),
 +               die->offset);
 +  type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile);
- 
++
 +  /* Create a context for reading the module variables.  */
-+
+ 
+-  /* FIXME: Support the separate Fortran module namespaces.  */
 +  new = push_context (0, 0);
-+
+ 
 +  save_file_symbols = file_symbols;
 +  file_symbols = NULL;
 +  save_global_symbols = global_symbols;
@@ -6495,7 +6523,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Return the name of the namespace represented by DIE.  Set
-@@ -5724,29 +6239,113 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5724,29 +6242,113 @@ 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;
@@ -6623,7 +6651,7 @@ index 4cce36b..c2f5f23 100644
    char_type = language_string_char_type (cu->language_defn, gdbarch);
    type = create_string_type (NULL, char_type, range_type);
  
-@@ -5841,7 +6440,6 @@ static struct type *
+@@ -5841,7 +6443,6 @@ static struct type *
  read_typedef (struct die_info *die, struct dwarf2_cu *cu)
  {
    struct objfile *objfile = cu->objfile;
@@ -6631,7 +6659,7 @@ index 4cce36b..c2f5f23 100644
    const char *name = NULL;
    struct type *this_type;
  
-@@ -5949,8 +6547,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5949,8 +6550,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
    struct type *base_type;
    struct type *range_type;
    struct attribute *attr;
@@ -6641,7 +6669,7 @@ index 4cce36b..c2f5f23 100644
    char *name;
    
    base_type = die_type (die, cu);
-@@ -5963,42 +6560,89 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5963,42 +6563,89 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
  		     0, NULL, cu->objfile);
      }
  
@@ -6760,7 +6788,7 @@ index 4cce36b..c2f5f23 100644
  
    name = dwarf2_name (die, cu);
    if (name)
-@@ -6469,6 +7113,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
+@@ -6469,6 +7116,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
  	  && abbrev->tag != DW_TAG_lexical_block
  	  && abbrev->tag != DW_TAG_variable
  	  && abbrev->tag != DW_TAG_namespace
@@ -6768,7 +6796,7 @@ index 4cce36b..c2f5f23 100644
  	  && abbrev->tag != DW_TAG_member)
  	{
  	  /* Otherwise we skip to the next sibling, if any.  */
-@@ -6689,9 +7334,6 @@ read_partial_die (struct partial_die_info *part_die,
+@@ -6689,9 +7337,6 @@ read_partial_die (struct partial_die_info *part_die,
  	  if (part_die->dirname == NULL)
  	    part_die->dirname = DW_STRING (&attr);
  	  break;
@@ -6778,7 +6806,7 @@ index 4cce36b..c2f5f23 100644
  	case DW_AT_low_pc:
  	  has_low_pc_attr = 1;
  	  part_die->lowpc = DW_ADDR (&attr);
-@@ -6923,7 +7565,8 @@ fixup_partial_die (struct partial_die_info *part_die,
+@@ -6923,7 +7568,8 @@ fixup_partial_die (struct partial_die_info *part_die,
    /* If we found a reference attribute and the DIE has no name, try
       to find a name in the referred to DIE.  */
  
@@ -6788,7 +6816,7 @@ index 4cce36b..c2f5f23 100644
      {
        struct partial_die_info *spec_die;
  
-@@ -8265,10 +8908,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
+@@ -8265,10 +8911,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
@@ -6803,7 +6831,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Given a pointer to a DWARF information entry, figure out if we need
-@@ -8290,21 +8935,30 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8290,21 +8938,30 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  
    baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
@@ -6841,7 +6869,7 @@ index 4cce36b..c2f5f23 100644
  
        /* Default assumptions.
           Use the passed type or decode it from the die.  */
-@@ -8402,9 +9056,28 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8402,9 +9059,28 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  	  if (attr)
  	    {
  	      var_decode_location (attr, sym, cu);
@@ -6871,7 +6899,7 @@ index 4cce36b..c2f5f23 100644
  	      else
  		add_symbol_to_list (sym, cu->list_in_scope);
  	    }
-@@ -8534,7 +9207,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8534,7 +9210,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  	  add_symbol_to_list (sym, cu->list_in_scope);
  	  break;
  	case DW_TAG_enumerator:
@@ -6880,7 +6908,7 @@ index 4cce36b..c2f5f23 100644
  	  attr = dwarf2_attr (die, DW_AT_const_value, cu);
  	  if (attr)
  	    {
-@@ -8558,6 +9231,16 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8558,6 +9234,16 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  	  SYMBOL_CLASS (sym) = LOC_TYPEDEF;
  	  add_symbol_to_list (sym, &global_symbols);
  	  break;
@@ -6897,7 +6925,7 @@ index 4cce36b..c2f5f23 100644
  	default:
  	  /* Not a tag we recognize.  Hopefully we aren't processing
  	     trash data, but since we must specifically ignore things
-@@ -8571,8 +9254,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8571,8 +9257,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
        /* For the benefit of old versions of GCC, check for anonymous
  	 namespaces based on the demangled name.  */
        if (!processing_has_namespace_info
@@ -6907,7 +6935,7 @@ index 4cce36b..c2f5f23 100644
  	cp_scan_for_anonymous_namespaces (sym);
      }
    return (sym);
-@@ -8823,12 +9505,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -8823,12 +9508,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
      case DW_TAG_namespace:
        this_type = read_namespace_type (die, cu);
        break;
@@ -6926,7 +6954,7 @@ index 4cce36b..c2f5f23 100644
    return this_type;
  }
  
-@@ -8910,10 +9598,100 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
+@@ -8910,10 +9601,100 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
  	     So it does not need a prefix.  */
  	  return "";
        default:
@@ -7028,7 +7056,7 @@ index 4cce36b..c2f5f23 100644
  /* Return a newly-allocated string formed by concatenating PREFIX and
     SUFFIX with appropriate separator.  If PREFIX or SUFFIX is NULL or empty, then
     simply copy the SUFFIX or PREFIX, respectively.  If OBS is non-null,
-@@ -8963,17 +9741,111 @@ sibling_die (struct die_info *die)
+@@ -8963,17 +9744,111 @@ sibling_die (struct die_info *die)
    return die->sibling;
  }
  
@@ -7146,7 +7174,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Get name of a die, return NULL if not found.  */
-@@ -10200,11 +11072,11 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
+@@ -10200,11 +11075,11 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
    return 0;
  }
  
@@ -7161,7 +7189,7 @@ index 4cce36b..c2f5f23 100644
  {
    if (attr->form == DW_FORM_sdata)
      return DW_SND (attr);
-@@ -11009,8 +11881,6 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11009,8 +11884,6 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
  {
    gdb_byte *mac_ptr, *mac_end;
    struct macro_source_file *current_file = 0;
@@ -7170,7 +7198,7 @@ index 4cce36b..c2f5f23 100644
  
    if (dwarf2_per_objfile->macinfo.buffer == NULL)
      {
-@@ -11018,29 +11888,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11018,29 +11891,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
        return;
      }
  
@@ -7205,7 +7233,7 @@ index 4cce36b..c2f5f23 100644
          }
  
        macinfo_type = read_1_byte (abfd, mac_ptr);
-@@ -11051,92 +11911,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11051,92 +11914,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
            /* A zero macinfo type indicates the end of the macro
               information.  */
          case 0:
@@ -7299,7 +7327,7 @@ index 4cce36b..c2f5f23 100644
  
          case DW_MACINFO_define:
          case DW_MACINFO_undef:
-@@ -11151,31 +11926,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11151,31 +11929,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
              mac_ptr += bytes_read;
  
              if (! current_file)
@@ -7342,7 +7370,7 @@ index 4cce36b..c2f5f23 100644
            }
            break;
  
-@@ -11189,22 +11952,9 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11189,22 +11955,9 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
              file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
              mac_ptr += bytes_read;
  
@@ -7368,7 +7396,7 @@ index 4cce36b..c2f5f23 100644
            }
            break;
  
-@@ -11258,7 +12008,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11258,7 +12011,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
            }
            break;
          }
@@ -7377,7 +7405,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Check if the attribute's form is a DW_FORM_block*
-@@ -11318,6 +12068,34 @@ attr_form_is_constant (struct attribute *attr)
+@@ -11318,6 +12071,34 @@ attr_form_is_constant (struct attribute *attr)
      }
  }
  
@@ -7412,7 +7440,7 @@ index 4cce36b..c2f5f23 100644
  static void
  dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
  			     struct dwarf2_cu *cu)
-@@ -11347,35 +12125,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+@@ -11347,35 +12128,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
        SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs;
        SYMBOL_LOCATION_BATON (sym) = baton;
      }
@@ -7463,7 +7491,7 @@ index 4cce36b..c2f5f23 100644
      }
  }
  
-@@ -11663,6 +12431,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
+@@ -11663,6 +12434,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
    return ofs_lhs->offset == ofs_rhs->offset;
  }
  
@@ -7495,7 +7523,7 @@ index 4cce36b..c2f5f23 100644
  /* Set the type associated with DIE to TYPE.  Save it in CU's hash
     table if necessary.  For convenience, return TYPE.  */
  
-@@ -11671,6 +12464,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -11671,6 +12467,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  {
    struct dwarf2_offset_and_type **slot, ofs;
  
@@ -7504,7 +7532,7 @@ index 4cce36b..c2f5f23 100644
    if (cu->type_hash == NULL)
      {
        gdb_assert (cu->per_cu != NULL);
-@@ -11813,23 +12608,13 @@ show_dwarf2_cmd (char *args, int from_tty)
+@@ -11813,23 +12611,13 @@ show_dwarf2_cmd (char *args, int from_tty)
    cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
  }
  
@@ -7532,7 +7560,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* munmap debug sections for OBJFILE, if necessary.  */
-@@ -11838,15 +12623,15 @@ static void
+@@ -11838,15 +12626,15 @@ static void
  dwarf2_per_objfile_free (struct objfile *objfile, void *d)
  {
    struct dwarf2_per_objfile *data = d;
@@ -7557,7 +7585,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  void _initialize_dwarf2_read (void);
-@@ -11854,6 +12639,7 @@ void _initialize_dwarf2_read (void);
+@@ -11854,6 +12642,7 @@ void _initialize_dwarf2_read (void);
  void
  _initialize_dwarf2_read (void)
  {
@@ -7598,7 +7626,7 @@ index 6e79d4a..198bae3 100644
    default_symfile_offsets,	/* sym_offsets:  Translate ext. to int. relocation */
    elf_symfile_segments,		/* sym_segments: Get segment information from
 diff --git a/gdb/eval.c b/gdb/eval.c
-index 2926465..4c6de78 100644
+index 2926465..b53f895 100644
 --- a/gdb/eval.c
 +++ b/gdb/eval.c
 @@ -39,8 +39,12 @@
@@ -7739,17 +7767,23 @@ index 2926465..4c6de78 100644
  	}
        else if (op == OP_VAR_VALUE)
  	{
-@@ -1549,7 +1601,10 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1549,6 +1601,8 @@ evaluate_subexp_standard (struct type *expect_type,
  
        /* First determine the type code we are dealing with.  */
        arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
 +      old_chain = make_cleanup (null_cleanup, 0);
 +      object_address_set (value_raw_address (arg1));
        type = check_typedef (value_type (arg1));
-+      do_cleanups (old_chain);
        code = TYPE_CODE (type);
  
-       if (code == TYPE_CODE_PTR)
+@@ -1569,6 +1623,7 @@ evaluate_subexp_standard (struct type *expect_type,
+ 	      code = TYPE_CODE (type);
+ 	    }
+ 	} 
++      do_cleanups (old_chain);
+ 
+       switch (code)
+ 	{
 @@ -1716,6 +1771,37 @@ evaluate_subexp_standard (struct type *expect_type,
  	  error (_("non-pointer-to-member value used in pointer-to-member construct"));
  	}
@@ -7830,7 +7864,10 @@ index 2926465..4c6de78 100644
 -	offset_item = subscript_array[ndimensions - 1];
 +	offset_item = 0;
 +	offset_byte = 0;
-+
+ 
+-	for (i = ndimensions - 1; i > 0; --i)
+-	  offset_item =
+-	    array_size_array[i - 1] * offset_item + subscript_array[i - 1];
 +	for (i = ndimensions - 1; i >= 0; --i)
 +	  {
 +	    offset_item *= array_size_array[i];
@@ -7839,10 +7876,7 @@ index 2926465..4c6de78 100644
 +	    else
 +	      offset_byte += subscript_array[i] * byte_stride_array[i];
 +	  }
- 
--	for (i = ndimensions - 1; i > 0; --i)
--	  offset_item =
--	    array_size_array[i - 1] * offset_item + subscript_array[i - 1];
++
 +	element_size = TYPE_LENGTH (TYPE_TARGET_TYPE (tmp_type));
 +	offset_byte += offset_item * element_size;
  
@@ -7857,7 +7891,74 @@ index 2926465..4c6de78 100644
        }
  
      case BINOP_LOGICAL_AND:
-@@ -2598,7 +2705,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
+@@ -2291,14 +2398,22 @@ evaluate_subexp_standard (struct type *expect_type,
+       if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
+ 	expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
+       arg1 = evaluate_subexp (expect_type, exp, pos, noside);
++      old_chain = make_cleanup (null_cleanup, 0);
++      object_address_set (value_raw_address (arg1));
+       type = check_typedef (value_type (arg1));
+       if (TYPE_CODE (type) == TYPE_CODE_METHODPTR
+ 	  || TYPE_CODE (type) == TYPE_CODE_MEMBERPTR)
+ 	error (_("Attempt to dereference pointer to member without an object"));
+       if (noside == EVAL_SKIP)
+-	goto nosideret;
++	{
++	  do_cleanups (old_chain);
++	  goto nosideret;
++	}
+       if (unop_user_defined_p (op, arg1))
+-	return value_x_unop (arg1, op, noside);
++	{
++	  do_cleanups (old_chain);
++	  return value_x_unop (arg1, op, noside);
++	}
+       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ 	{
+ 	  type = check_typedef (value_type (arg1));
+@@ -2307,12 +2422,18 @@ evaluate_subexp_standard (struct type *expect_type,
+ 	  /* In C you can dereference an array to get the 1st elt.  */
+ 	      || TYPE_CODE (type) == TYPE_CODE_ARRAY
+ 	    )
+-	    return value_zero (TYPE_TARGET_TYPE (type),
+-			       lval_memory);
++	    {
++	      do_cleanups (old_chain);
++	      return value_zero (TYPE_TARGET_TYPE (type),
++				 lval_memory);
++	    }
+ 	  else if (TYPE_CODE (type) == TYPE_CODE_INT)
+-	    /* GDB allows dereferencing an int.  */
+-	    return value_zero (builtin_type (exp->gdbarch)->builtin_int,
+-			       lval_memory);
++	    {
++	      do_cleanups (old_chain);
++	      /* GDB allows dereferencing an int.  */
++	      return value_zero (builtin_type (exp->gdbarch)->builtin_int,
++				 lval_memory);
++	    }
+ 	  else
+ 	    error (_("Attempt to take contents of a non-pointer value."));
+ 	}
+@@ -2322,9 +2443,14 @@ evaluate_subexp_standard (struct type *expect_type,
+ 	 do.  "long long" variables are rare enough that
+ 	 BUILTIN_TYPE_LONGEST would seem to be a mistake.  */
+       if (TYPE_CODE (type) == TYPE_CODE_INT)
+-	return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
+-			      (CORE_ADDR) value_as_address (arg1));
+-      return value_ind (arg1);
++	{
++	  do_cleanups (old_chain);
++	  return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
++				(CORE_ADDR) value_as_address (arg1));
++	}
++      arg1 = value_ind (arg1);
++      do_cleanups (old_chain);
++      return arg1;
+ 
+     case UNOP_ADDR:
+       /* C++: check for and handle pointer to members.  */
+@@ -2598,7 +2724,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
        (*pos) += 5 + BYTES_TO_EXP_ELEM (tem + 1);
        x = value_aggregate_elt (exp->elts[pc + 1].type,
  			       &exp->elts[pc + 3].string,
@@ -7866,7 +7967,7 @@ index 2926465..4c6de78 100644
        if (x == NULL)
  	error (_("There is no field named %s"), &exp->elts[pc + 3].string);
        return x;
-@@ -2643,7 +2750,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -2643,7 +2769,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
  {
    enum exp_opcode op;
    int pc;
@@ -7875,7 +7976,7 @@ index 2926465..4c6de78 100644
    struct symbol *var;
    struct type *type;
  
-@@ -2654,12 +2761,17 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -2654,12 +2780,17 @@ evaluate_subexp_with_coercion (struct expression *exp,
      {
      case OP_VAR_VALUE:
        var = exp->elts[pc + 2].symbol;
@@ -7894,7 +7995,7 @@ index 2926465..4c6de78 100644
  	  return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
  			     val);
  	}
-@@ -2711,9 +2823,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
+@@ -2711,9 +2842,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
  
      case OP_VAR_VALUE:
        (*pos) += 4;
@@ -12217,10 +12318,22 @@ index a84003f..924c1c5 100644
    default_symfile_offsets,	/* sym_offsets: dummy FIXME til implem sym reloc */
    default_symfile_segments,	/* sym_segments: Get segment information from
 diff --git a/gdb/objfiles.c b/gdb/objfiles.c
-index 8dcca70..4b25a5a 100644
+index 8dcca70..e5442ca 100644
 --- a/gdb/objfiles.c
 +++ b/gdb/objfiles.c
-@@ -731,6 +731,20 @@ have_partial_symbols (void)
+@@ -634,6 +634,11 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+     }
+   }
+ 
++  /* Alread QUICK_ADDRMAP tiself assumes all sections have the same offset.  */
++  if (objfile->quick_addrmap)
++    addrmap_relocate (objfile->quick_addrmap,
++		      ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
++
+   {
+     struct partial_symbol **psym;
+ 
+@@ -731,6 +736,20 @@ have_partial_symbols (void)
      if (objfile_has_partial_symbols (ofp))
        return 1;
    }
@@ -20501,6 +20614,590 @@ index 0000000..98b2e79
 +	.long	0xedc07834	/* 194: frsqrtes f14,f15          */
 +	.long	0xedc07835	/* 198: frsqrtes. f14,f15         */
 +	.long	0x7c43271e	/* 19c: isel    r2,r3,r4,28       */
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S
+new file mode 100644
+index 0000000..83faaf6
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S
+@@ -0,0 +1,457 @@
++	.file	"x86_64-vla-pointer.c"
++	.section	.debug_abbrev,"",@progbits
++.Ldebug_abbrev0:
++	.section	.debug_info,"",@progbits
++.Ldebug_info0:
++	.section	.debug_line,"",@progbits
++.Ldebug_line0:
++	.text
++.Ltext0:
++.globl foo
++	.type	foo, @function
++foo:
++.LFB2:
++	.file 1 "x86_64-vla-pointer.c"
++	.loc 1 22 0
++	pushq	%rbp
++.LCFI0:
++	movq	%rsp, %rbp
++.LCFI1:
++	subq	$64, %rsp
++.LCFI2:
++	movl	%edi, -36(%rbp)
++	.loc 1 22 0
++	movq	%rsp, %rax
++	movq	%rax, -48(%rbp)
++	.loc 1 23 0
++	movl	-36(%rbp), %edx
++	movslq	%edx,%rax
++	subq	$1, %rax
++	movq	%rax, -24(%rbp)
++	.loc 1 24 0
++	movslq	%edx,%rax
++	addq	$15, %rax
++	addq	$15, %rax
++	shrq	$4, %rax
++	salq	$4, %rax
++	subq	%rax, %rsp
++	movq	%rsp, -56(%rbp)
++	movq	-56(%rbp), %rax
++	addq	$15, %rax
++	shrq	$4, %rax
++	salq	$4, %rax
++	movq	%rax, -56(%rbp)
++	movq	-56(%rbp), %rax
++	movq	%rax, -16(%rbp)
++	.loc 1 27 0
++	movl	$0, -4(%rbp)
++	jmp	.L2
++.L3:
++	.loc 1 28 0
++	movl	-4(%rbp), %esi
++	movl	-4(%rbp), %eax
++	movl	%eax, %ecx
++	movq	-16(%rbp), %rdx
++	movslq	%esi,%rax
++	movb	%cl, (%rdx,%rax)
++	.loc 1 27 0
++	addl	$1, -4(%rbp)
++.L2:
++	movl	-4(%rbp), %eax
++	cmpl	-36(%rbp), %eax
++	jl	.L3
++	.loc 1 30 0
++	.globl	break_here
++break_here:
++	movq	-16(%rbp), %rax
++	movb	$0, (%rax)
++	movq	-48(%rbp), %rsp
++	.loc 1 31 0
++	leave
++	ret
++.LFE2:
++	.size	foo, .-foo
++	.section	.debug_frame,"",@progbits
++.Lframe0:
++	.long	.LECIE0-.LSCIE0
++.LSCIE0:
++	.long	0xffffffff
++	.byte	0x1
++	.string	""
++	.uleb128 0x1
++	.sleb128 -8
++	.byte	0x10
++	.byte	0xc
++	.uleb128 0x7
++	.uleb128 0x8
++	.byte	0x90
++	.uleb128 0x1
++	.align 8
++.LECIE0:
++.LSFDE0:
++	.long	.LEFDE0-.LASFDE0
++.LASFDE0:
++	.long	.Lframe0
++	.quad	.LFB2
++	.quad	.LFE2-.LFB2
++	.byte	0x4
++	.long	.LCFI0-.LFB2
++	.byte	0xe
++	.uleb128 0x10
++	.byte	0x86
++	.uleb128 0x2
++	.byte	0x4
++	.long	.LCFI1-.LCFI0
++	.byte	0xd
++	.uleb128 0x6
++	.align 8
++.LEFDE0:
++	.section	.eh_frame,"a",@progbits
++.Lframe1:
++	.long	.LECIE1-.LSCIE1
++.LSCIE1:
++	.long	0x0
++	.byte	0x1
++	.string	"zR"
++	.uleb128 0x1
++	.sleb128 -8
++	.byte	0x10
++	.uleb128 0x1
++	.byte	0x3
++	.byte	0xc
++	.uleb128 0x7
++	.uleb128 0x8
++	.byte	0x90
++	.uleb128 0x1
++	.align 8
++.LECIE1:
++.LSFDE1:
++	.long	.LEFDE1-.LASFDE1
++.LASFDE1:
++	.long	.LASFDE1-.Lframe1
++	.long	.LFB2
++	.long	.LFE2-.LFB2
++	.uleb128 0x0
++	.byte	0x4
++	.long	.LCFI0-.LFB2
++	.byte	0xe
++	.uleb128 0x10
++	.byte	0x86
++	.uleb128 0x2
++	.byte	0x4
++	.long	.LCFI1-.LCFI0
++	.byte	0xd
++	.uleb128 0x6
++	.align 8
++.LEFDE1:
++	.text
++.Letext0:
++	.section	.debug_loc,"",@progbits
++.Ldebug_loc0:
++.LLST0:
++	.quad	.LFB2-.Ltext0
++	.quad	.LCFI0-.Ltext0
++	.value	0x2
++	.byte	0x77
++	.sleb128 8
++	.quad	.LCFI0-.Ltext0
++	.quad	.LCFI1-.Ltext0
++	.value	0x2
++	.byte	0x77
++	.sleb128 16
++	.quad	.LCFI1-.Ltext0
++	.quad	.LFE2-.Ltext0
++	.value	0x2
++	.byte	0x76
++	.sleb128 16
++	.quad	0x0
++	.quad	0x0
++	.section	.debug_info
++.Ldebug_relative:
++	.long	.Ldebug_end - .Ldebug_start
++.Ldebug_start:
++	.value	0x2
++	.long	.Ldebug_abbrev0
++	.byte	0x8
++	.uleb128 0x1
++	.long	.LASF2
++	.byte	0x1
++	.long	.LASF3
++	.long	.LASF4
++	.quad	.Ltext0
++	.quad	.Letext0
++	.long	.Ldebug_line0
++	.uleb128 0x2
++	.byte	0x1
++	.string	"foo"
++	.byte	0x1
++	.byte	0x16
++	.byte	0x1
++	.quad	.LFB2
++	.quad	.LFE2
++	.long	.LLST0
++	.long	.Ltype_int - .Ldebug_relative
++	.uleb128 0x3
++	.long	.LASF5
++	.byte	0x1
++	.byte	0x15
++	.long	.Ltype_int - .Ldebug_relative
++	.byte	0x2
++	.byte	0x91
++	.sleb128 -52
++.Ltag_pointer:
++	.uleb128 0x4
++	.byte	0x8	/* DW_AT_byte_size */
++	.long	.Ltag_array_type - .debug_info	/* DW_AT_type */
++	.uleb128 0x5	/* Abbrev Number: 5 (DW_TAG_variable) */
++	.long	.LASF0
++	.byte	0x1
++	.byte	0x18
++#if 1
++	.long	.Ltag_pointer - .debug_info
++#else
++	/* Debugging only: Skip the typedef indirection.  */
++	.long	.Ltag_array_type - .debug_info
++#endif
++	/* DW_AT_location: DW_FORM_block1: start */
++	.byte	0x3
++	.byte	0x91
++	.sleb128 -32
++#if 0
++	.byte	0x6	/* DW_OP_deref */
++#else
++	.byte	0x96	/* DW_OP_nop */
++#endif
++	/* DW_AT_location: DW_FORM_block1: end */
++	.uleb128 0x6
++	.string	"i"
++	.byte	0x1
++	.byte	0x19
++	.long	.Ltype_int - .Ldebug_relative
++	.byte	0x2
++	.byte	0x91
++	.sleb128 -20
++	.byte	0x0
++.Ltype_int:
++	.uleb128 0x7
++	.byte	0x4
++	.byte	0x5
++	.string	"int"
++.Ltag_array_type:
++	.uleb128 0x8	/* Abbrev Number: 8 (DW_TAG_array_type) */
++	.long	.Ltype_char - .Ldebug_relative
++	.long	.Ltype_ulong - .Ldebug_relative	/* DW_AT_sibling: DW_FORM_ref4 */
++1:	/* DW_AT_data_location: DW_FORM_block1: start */
++	.byte	2f - 3f	/* length */
++3:
++	.byte	0x97	/* DW_OP_push_object_address */
++#if 1
++	.byte	0x6	/* DW_OP_deref */
++#else
++	.byte	0x96	/* DW_OP_nop */
++#endif
++2:	/* DW_AT_data_location: DW_FORM_block1: end */
++	.uleb128 0x9
++	.long	.Ltype_char - .Ldebug_relative	/* DW_AT_type: DW_FORM_ref4 */
++	.byte	0x3
++	.byte	0x91
++	.sleb128 -40
++	.byte	0x6
++	.byte	0x0
++.Ltype_ulong:
++	.uleb128 0xa
++	.byte	0x8
++	.byte	0x7
++.Ltype_char:
++	.uleb128 0xb
++	.byte	0x1
++	.byte	0x6
++	.long	.LASF1
++	.byte	0x0
++.Ldebug_end:
++	.section	.debug_abbrev
++	.uleb128 0x1
++	.uleb128 0x11
++	.byte	0x1
++	.uleb128 0x25
++	.uleb128 0xe
++	.uleb128 0x13
++	.uleb128 0xb
++	.uleb128 0x3
++	.uleb128 0xe
++	.uleb128 0x1b
++	.uleb128 0xe
++	.uleb128 0x11
++	.uleb128 0x1
++	.uleb128 0x12
++	.uleb128 0x1
++	.uleb128 0x10
++	.uleb128 0x6
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x2
++	.uleb128 0x2e
++	.byte	0x1
++	.uleb128 0x3f
++	.uleb128 0xc
++	.uleb128 0x3
++	.uleb128 0x8
++	.uleb128 0x3a
++	.uleb128 0xb
++	.uleb128 0x3b
++	.uleb128 0xb
++	.uleb128 0x27
++	.uleb128 0xc
++	.uleb128 0x11
++	.uleb128 0x1
++	.uleb128 0x12
++	.uleb128 0x1
++	.uleb128 0x40
++	.uleb128 0x6
++	.uleb128 0x1
++	.uleb128 0x13
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x3
++	.uleb128 0x5
++	.byte	0x0
++	.uleb128 0x3
++	.uleb128 0xe
++	.uleb128 0x3a
++	.uleb128 0xb
++	.uleb128 0x3b
++	.uleb128 0xb
++	.uleb128 0x49
++	.uleb128 0x13
++	.uleb128 0x2
++	.uleb128 0xa
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x4	/* .Ltag_pointer abbrev */
++	.uleb128 0x0f	/* DW_TAG_pointer_type */
++	.byte	0x0
++	.uleb128 0x0b
++	.uleb128 0xb
++	.uleb128 0x49
++	.uleb128 0x13
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x5
++	.uleb128 0x34
++	.byte	0x0
++	.uleb128 0x3
++	.uleb128 0xe
++	.uleb128 0x3a
++	.uleb128 0xb
++	.uleb128 0x3b
++	.uleb128 0xb
++	.uleb128 0x49
++	.uleb128 0x13
++	.uleb128 0x2
++	.uleb128 0xa
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x6
++	.uleb128 0x34
++	.byte	0x0
++	.uleb128 0x3
++	.uleb128 0x8
++	.uleb128 0x3a
++	.uleb128 0xb
++	.uleb128 0x3b
++	.uleb128 0xb
++	.uleb128 0x49
++	.uleb128 0x13
++	.uleb128 0x2
++	.uleb128 0xa
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x7
++	.uleb128 0x24
++	.byte	0x0
++	.uleb128 0xb
++	.uleb128 0xb
++	.uleb128 0x3e
++	.uleb128 0xb
++	.uleb128 0x3
++	.uleb128 0x8
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x8	/* Abbrev Number: 8 (DW_TAG_array_type) */
++	.uleb128 0x1
++	.byte	0x1
++	.uleb128 0x49	/* DW_AT_type */
++	.uleb128 0x13	/* DW_FORM_ref4 */
++	.uleb128 0x1	/* DW_AT_sibling */
++	.uleb128 0x13	/* DW_FORM_ref4 */
++	.uleb128 0x50	/* DW_AT_data_location */
++	.uleb128 0xa	/* DW_FORM_block1 */
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0x9
++	.uleb128 0x21
++	.byte	0x0
++	.uleb128 0x49	/* DW_AT_type */
++	.uleb128 0x13	/* DW_FORM_ref4 */
++	.uleb128 0x2f
++	.uleb128 0xa
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0xa
++	.uleb128 0x24
++	.byte	0x0
++	.uleb128 0xb
++	.uleb128 0xb
++	.uleb128 0x3e
++	.uleb128 0xb
++	.byte	0x0
++	.byte	0x0
++	.uleb128 0xb
++	.uleb128 0x24
++	.byte	0x0
++	.uleb128 0xb
++	.uleb128 0xb
++	.uleb128 0x3e
++	.uleb128 0xb
++	.uleb128 0x3
++	.uleb128 0xe
++	.byte	0x0
++	.byte	0x0
++	.byte	0x0
++	.section	.debug_pubnames,"",@progbits
++	.long	0x16
++	.value	0x2
++	.long	.Ldebug_info0
++	.long	0xa8
++	.long	0x2d
++	.string	"foo"
++	.long	0x0
++	.section	.debug_aranges,"",@progbits
++	.long	0x2c
++	.value	0x2
++	.long	.Ldebug_info0
++	.byte	0x8
++	.byte	0x0
++	.value	0x0
++	.value	0x0
++	.quad	.Ltext0
++	.quad	.Letext0-.Ltext0
++	.quad	0x0
++	.quad	0x0
++	.section	.debug_str,"MS",@progbits,1
++.LASF0:
++	.string	"array"
++.LASF5:
++	.string	"size"
++.LASF3:
++	.string	"x86_64-vla-pointer.c"
++.LASF6:
++	.string	"array_t"
++.LASF1:
++	.string	"char"
++.LASF4:
++	.string	"gdb.arch"
++.LASF2:
++	.string	"GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
++	.ident	"GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
++	.section	.note.GNU-stack,"",@progbits
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
+new file mode 100644
+index 0000000..fe2c8f7
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
+@@ -0,0 +1,43 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#if 0
++
++void
++foo (int size)
++{
++  typedef char array_t[size];
++  array_t array;
++  int i;
++
++  for (i = 0; i < size; i++)
++    array[i] = i;
++
++  array[0] = 0;	/* break-here */
++}
++
++#else
++
++int
++main (void)
++{
++  foo (26);
++  foo (78);
++  return 0;
++}
++
++#endif
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
+new file mode 100644
+index 0000000..d243cf1
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
+@@ -0,0 +1,66 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if ![istarget "x86_64-*-*"] then {
++    verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64."
++    return
++}
++
++set testfile x86_64-vla-pointer
++set srcasmfile ${testfile}-foo.S
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++set binobjfile ${objdir}/${subdir}/${testfile}-foo.o
++if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++if ![runto_main] {
++    untested x86_64-vla-pointer
++    return -1
++}
++
++gdb_breakpoint "break_here"
++
++gdb_continue_to_breakpoint "break_here"
++
++gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "first: whatis array"
++gdb_test "ptype array" "type = char \\(\\*\\)\\\[26\\\]" "first: ptype array"
++
++gdb_test "whatis *array" "type = char \\\[26\\\]" "first: whatis *array"
++gdb_test "ptype *array" "type = char \\\[26\\\]" "first: ptype *array"
++
++gdb_test "p (*array)\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
++gdb_test "p (*array)\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
++gdb_test "p (*array)\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
++gdb_test "p (*array)\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
++
++gdb_continue_to_breakpoint "break_here"
++
++gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "second: whatis array"
++gdb_test "ptype array" "type = char \\(\\*\\)\\\[78\\\]" "second: ptype array"
++
++gdb_test "whatis *array" "type = char \\\[78\\\]" "second: whatis *array"
++gdb_test "ptype *array" "type = char \\\[78\\\]" "second: ptype *array"
 diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
 new file mode 100644
 index 0000000..66f7a39
@@ -21130,6 +21827,64 @@ index d76cc36..496ff18 100644
  # test help stack
  test_class_help "stack" {
      "Examining the stack\..*\[\r\n\]+"
+diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c
+new file mode 100644
+index 0000000..eeb7b85
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/internal-var-field-address.c
+@@ -0,0 +1,20 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++struct {
++  int field;
++} staticstruct = { 1 };
+diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.exp b/gdb/testsuite/gdb.base/internal-var-field-address.exp
+new file mode 100644
+index 0000000..6d82e73
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/internal-var-field-address.exp
+@@ -0,0 +1,26 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set test internal-var-field-address
++set binfile ${test}.x
++if  { [gdb_compile "${srcdir}/${subdir}/${test}.c" "${objdir}/${subdir}/${binfile}" object {debug}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++
++clean_restart $binfile
++
++gdb_test {set $varstruct = staticstruct}
++gdb_test {p $varstruct.field} " = 1"
 diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
 new file mode 100644
 index 0000000..1a0220e
@@ -23248,6 +24003,162 @@ index 0000000..5543757
 +
 +setup_kfail "gdb/10541" "*-*-*"
 +gdb_test "print G::GF::FE::ex" "= 9999"
+diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
+new file mode 100644
+index 0000000..173e49b
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
+@@ -0,0 +1,93 @@
++int a;
++int b;
++int c;
++int d;
++int e;
++int f;
++int g;
++int h;
++int i;
++int j;
++int k;
++int l;
++int m;
++int n;
++int o;
++int p;
++int q;
++int r;
++int s;
++int t;
++int u;
++int v;
++int w;
++int x;
++int y;
++int z;
++
++namespace A
++{
++  int xyz;
++
++  using ::a;
++  using ::b;
++  using ::c;
++  using ::d;
++  using ::e;
++  using ::f;
++  using ::g;
++  using ::h;
++  using ::i;
++  using ::j;
++  using ::k;
++  using ::l;
++  using ::m;
++  using ::n;
++  using ::o;
++  using ::p;
++  using ::q;
++  using ::r;
++  using ::s;
++  using ::t;
++  using ::u;
++  using ::v;
++  using ::w;
++  using ::x;
++  using ::y;
++  using ::z;
++
++}
++
++using A::a;
++using A::b;
++using A::c;
++using A::d;
++using A::e;
++using A::f;
++using A::g;
++using A::h;
++using A::i;
++using A::j;
++using A::k;
++using A::l;
++using A::m;
++using A::n;
++using A::o;
++using A::p;
++using A::q;
++using A::r;
++using A::s;
++using A::t;
++using A::u;
++using A::v;
++using A::w;
++using A::x;
++using A::y;
++using A::z;
++
++using namespace A;
++
++int main ()
++{
++  return 0;
++}
+\ No newline at end of file
+diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp
+new file mode 100644
+index 0000000..f22a14e
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp
+@@ -0,0 +1,50 @@
++# Copyright 2008 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if $tracelevel then {
++    strace $tracelevel
++}
++
++set prms_id 0
++set bug_id 0
++
++set testfile namespace-stress-declarations
++set srcfile ${testfile}.cc
++set binfile ${objdir}/${subdir}/${testfile}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++
++if [get_compiler_info ${binfile}] {
++    return -1;
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++if ![runto_main] then {
++    perror "couldn't run to breakpoint main"
++    continue
++}
++
++############################################
++# Test that the search can fail efficiently 
++
++gdb_test "print fakex" "No symbol \"fakex\" in current context."
 diff --git a/gdb/testsuite/gdb.cp/namespace-stress.cc b/gdb/testsuite/gdb.cp/namespace-stress.cc
 new file mode 100644
 index 0000000..f34083e
@@ -25443,10 +26354,10 @@ index 495ae45..d08d7a4 100644
  		set command "next"
 diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp
 new file mode 100644
-index 0000000..74d4d58
+index 0000000..e71391e
 --- /dev/null
 +++ b/gdb/testsuite/gdb.java/jnpe.exp
-@@ -0,0 +1,72 @@
+@@ -0,0 +1,77 @@
 +# Copyright 2009 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
@@ -25469,10 +26380,10 @@ index 0000000..74d4d58
 +load_lib "java.exp"
 +
 +set testfile "jnpe"
-+set srcfile ${srcdir}/$subdir/${testfile}.java
++set srcfile ${testfile}.java
 +set binfile ${objdir}/${subdir}/${testfile}
-+if  { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
-+    untested "Couldn't compile ${srcfile}"
++if  { [compile_java_from_source ${srcdir}/$subdir/${srcfile} ${binfile} "-g"] != "" } {
++    untested "Couldn't compile ${srcdir}/$subdir/${srcfile}"
 +    return -1
 +}
 +
@@ -25490,7 +26401,7 @@ index 0000000..74d4d58
 +gdb_test "break $testfile.java:$line" ""
 +
 +gdb_test "run" \
-+  "Current language.*java" \
++  "// break here.*" \
 +  "run java next-over-throw"
 +
 +# See whether we have the needed unwinder hooks.
@@ -25499,9 +26410,10 @@ index 0000000..74d4d58
 +    -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
 +	pass "check for unwinder hook in java"
 +    }
-+    -re "No symbol .* in current context.\r\n$gdb_prompt $" {
++    -re "No symbol .* in current context.?\r\n$gdb_prompt $" {
 +	# Pass the test so we don't get bogus fails in the results.
-+	pass "check for unwinder hook in java"
++	setup_xfail *-*-*
++	fail "check for unwinder hook in java"
 +	set ok 0
 +    }
 +}
@@ -25514,14 +26426,18 @@ index 0000000..74d4d58
 +  "SIGSEGV.*fault" \
 +  "disable SIGSEGV for next-over-NPE"
 +
-+# We sometimes stop at line 37, not line 35.  This seems to be a gcj
-+# oddity -- another next will solve it.
++# The line where we stop differ according to gcj; check just we did not already
++# execute the catch point.
++
 +gdb_test "next" \
-+  "3\[57\].*" \
++  "" \
 +  "next over NPE"
++
++gdb_breakpoint [gdb_get_line_number "catch point"]
++gdb_continue_to_breakpoint "catch point" ".*// catch point.*"
 diff --git a/gdb/testsuite/gdb.java/jnpe.java b/gdb/testsuite/gdb.java/jnpe.java
 new file mode 100644
-index 0000000..ffca3ab
+index 0000000..3524830
 --- /dev/null
 +++ b/gdb/testsuite/gdb.java/jnpe.java
 @@ -0,0 +1,38 @@
@@ -25559,7 +26475,7 @@ index 0000000..ffca3ab
 +      }
 +    catch (NullPointerException n)
 +      {
-+	System.out.println ("success");
++	System.out.println ("success"); // catch point
 +      }
 +  }
 +}
@@ -28297,7 +29213,7 @@ index cbb5d94..f9634ea 100644
  	  ++reps;
  	  ++rep1;
 diff --git a/gdb/value.c b/gdb/value.c
-index 589e03b..66013b7 100644
+index 589e03b..62003fa 100644
 --- a/gdb/value.c
 +++ b/gdb/value.c
 @@ -37,8 +37,10 @@
@@ -28381,18 +29297,20 @@ index 589e03b..66013b7 100644
    if (VALUE_LVAL (whole) == lval_computed)
      {
        struct lval_funcs *funcs = whole->location.computed.funcs;
-@@ -776,6 +799,10 @@ set_value_component_location (struct value *component, struct value *whole)
+@@ -776,6 +799,12 @@ set_value_component_location (struct value *component, struct value *whole)
        if (funcs->copy_closure)
          component->location.computed.closure = funcs->copy_closure (whole);
      }
 +
 +  addr = value_raw_address (component);
 +  object_address_get_data (value_type (whole), &addr);
-+  set_value_address (component, addr);
++  if (component->lval != lval_internalvar
++      && component->lval != lval_internalvar_component)
++    set_value_address (component, addr);
  }
  
  
-@@ -906,6 +933,29 @@ show_values (char *num_exp, int from_tty)
+@@ -906,6 +935,29 @@ show_values (char *num_exp, int from_tty)
        num_exp[1] = '\0';
      }
  }
@@ -28422,7 +29340,7 @@ index 589e03b..66013b7 100644
  
  /* Internal variables.  These are variables within the debugger
     that hold values assigned by debugger commands.
-@@ -1381,6 +1431,40 @@ call_internal_function (struct gdbarch *gdbarch,
+@@ -1381,6 +1433,40 @@ call_internal_function (struct gdbarch *gdbarch,
    return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv);
  }
  
@@ -28463,7 +29381,7 @@ index 589e03b..66013b7 100644
  /* The 'function' command.  This does nothing -- it is just a
     placeholder to let "help function NAME" work.  This is also used as
     the implementation of the sub-command that is created when
-@@ -1428,11 +1512,10 @@ preserve_one_value (struct value *value, struct objfile *objfile,
+@@ -1428,11 +1514,10 @@ preserve_one_value (struct value *value, struct objfile *objfile,
  		    htab_t copied_types)
  {
    if (TYPE_OBJFILE (value->type) == objfile)
@@ -28477,7 +29395,7 @@ index 589e03b..66013b7 100644
  						 copied_types);
  }
  
-@@ -1447,13 +1530,13 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile,
+@@ -1447,13 +1532,13 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile,
      case INTERNALVAR_INTEGER:
        if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile)
  	var->u.integer.type
@@ -28493,7 +29411,7 @@ index 589e03b..66013b7 100644
        break;
  
      case INTERNALVAR_VALUE:
-@@ -1855,6 +1938,8 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type)
+@@ -1855,6 +1940,8 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type)
      val->contents =
        (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type));
  
@@ -28502,7 +29420,7 @@ index 589e03b..66013b7 100644
    val->enclosing_type = new_encl_type;
    return val;
  }
-@@ -1919,6 +2004,8 @@ value_primitive_field (struct value *arg1, int offset,
+@@ -1919,6 +2006,8 @@ value_primitive_field (struct value *arg1, int offset,
  	  memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
  		  TYPE_LENGTH (value_enclosing_type (arg1)));
  	}
@@ -28511,7 +29429,7 @@ index 589e03b..66013b7 100644
        v->type = type;
        v->offset = value_offset (arg1);
        v->embedded_offset = (offset + value_embedded_offset (arg1)
-@@ -2177,6 +2264,42 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
+@@ -2177,6 +2266,42 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
  }
  
  
@@ -28554,7 +29472,7 @@ index 589e03b..66013b7 100644
  /* Convert C numbers into newly allocated values.  */
  
  struct value *
-@@ -2190,6 +2313,19 @@ value_from_longest (struct type *type, LONGEST num)
+@@ -2190,6 +2315,19 @@ value_from_longest (struct type *type, LONGEST num)
  }
  
  
@@ -28574,7 +29492,7 @@ index 589e03b..66013b7 100644
  /* Create a value representing a pointer of type TYPE to the address
     ADDR.  */
  struct value *
-@@ -2348,4 +2484,8 @@ VARIABLE is already initialized."));
+@@ -2348,4 +2486,8 @@ VARIABLE is already initialized."));
    add_prefix_cmd ("function", no_class, function_command, _("\
  Placeholder command for showing help on convenience functions."),
  		  &functionlist, "function ", 0, &cmdlist);
diff --git a/gdb-bitfield-check_typedef.patch b/gdb-bitfield-check_typedef.patch
new file mode 100644
index 0000000..1ba20b1
--- /dev/null
+++ b/gdb-bitfield-check_typedef.patch
@@ -0,0 +1,101 @@
+http://sourceware.org/ml/gdb-patches/2010-01/msg00030.html
+Subject: [patch] Re: Regression: field type preservation: 7.0 -> 7.0.1+HEAD
+
+On Friday 01 January 2010 21:45:05 Jan Kratochvil wrote:
+> -PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+> +FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+> -PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+> +FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+> -PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
+> +FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
+> 
+> due to:
+> Re: RFA: unbreak typedefed bitfield
+> http://sourceware.org/ml/gdb-patches/2009-12/msg00295.html
+> commit fc85da4ee2a7c32afc53b1b334a4f84e2e9bd84e
+> http://sourceware.org/ml/gdb-cvs/2009-12/msg00100.html
+
+attached a fix on top of existing HEAD.
+
+Original PR gdb/10884 was a regression 6.8 -> 7.0 due to:
+RFC: Lazy bitfields
+http://sourceware.org/ml/gdb-patches/2009-07/msg00437.html
+http://sourceware.org/ml/gdb-cvs/2009-07/msg00143.html
+07491b3409f6ace0b7a9a707775a56ce10fece1c
+
+No regressions for HEAD on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.  Plus:
+-FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
++PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+-FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
++PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+-FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
++PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
+
+Going to check it in also for gdb_7_0-branch after an approval.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-01-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* value.c (value_primitive_field): Remove one check_typedef call.
+	Move bitpos and container_bitsize initialization after
+	allocate_value_lazy.  New comment before accessing TYPE_LENGTH.
+
+gdb/testsuite/
+2010-01-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.mi/var-cmd.c (do_bitfield_tests): Change "V.sharable" type to
+	"uint_for_mi_testing".
+
+--- a/gdb/testsuite/gdb.mi/var-cmd.c
++++ b/gdb/testsuite/gdb.mi/var-cmd.c
+@@ -494,7 +494,7 @@ void do_bitfield_tests ()
+     mi_create_varobj V d "create varobj for Data"
+     mi_list_varobj_children "V" {
+         {"V.alloc" "alloc" "0" "int"}
+-        {"V.sharable" "sharable" "0" "unsigned int"}
++        {"V.sharable" "sharable" "0" "uint_for_mi_testing"}
+     } "list children of Data"
+     mi_check_varobj_value V.sharable 3 "access bitfield"
+     :*/
+--- a/gdb/value.c
++++ b/gdb/value.c
+@@ -1873,7 +1873,6 @@ value_primitive_field (struct value *arg1, int offset,
+ 
+   CHECK_TYPEDEF (arg_type);
+   type = TYPE_FIELD_TYPE (arg_type, fieldno);
+-  type = check_typedef (type);
+ 
+   /* Handle packed fields */
+ 
+@@ -1885,10 +1884,14 @@ value_primitive_field (struct value *arg1, int offset,
+ 	 Otherwise, adjust offset to the byte containing the first
+ 	 bit.  Assume that the address, offset, and embedded offset
+ 	 are sufficiently aligned.  */
+-      int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+-      int container_bitsize = TYPE_LENGTH (type) * 8;
++      int bitpos, container_bitsize;
+ 
+       v = allocate_value_lazy (type);
++
++      /* TYPE_LENGTH of TYPE gets initialized by allocate_value_lazy.  */
++      bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
++      container_bitsize = TYPE_LENGTH (type) * 8;
++
+       v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
+       if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize
+ 	  && TYPE_LENGTH (type) <= (int) sizeof (LONGEST))
+@@ -1939,6 +1942,8 @@ value_primitive_field (struct value *arg1, int offset,
+       else
+ 	{
+ 	  v = allocate_value (type);
++
++	  /* TYPE_LENGTH of TYPE gets initialized by allocate_value.  */
+ 	  memcpy (value_contents_raw (v),
+ 		  value_contents_raw (arg1) + offset,
+ 		  TYPE_LENGTH (type));
+
diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch
new file mode 100644
index 0000000..5c0db43
--- /dev/null
+++ b/gdb-bz533176-fortran-omp-step.patch
@@ -0,0 +1,115 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
+
+I find it a bug in DWARF and gdb behaves correctly according to it.  From the
+current DWARF's point of view the is a function call which you skip by "next".
+
+If you hide any /usr/lib/debug such as using:
+gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
+and use "step" command instead of "next" there it will work.
+(You need to hide debuginfo from libgomp as you would step into libgomp sources
+to maintain the threads for execution.)
+
+There should be some DWARF extension for it, currently tried to detect
+substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
+consider such sub-function as a skippable by "next".
+
+Another problem is that with "set scheduler-locking" being "off" (default
+upstream) or "step" (default in F/RHEL) the simultaneous execution of the
+threads is inconvenient.  Setting it to "on" will lockup the debugging as the
+threads need to get synchronized at some point.  This is a more general
+debugging problem of GOMP outside of the scope of this Bug.
+
+
+
+--- ./gdb/infrun.c	2009-12-09 22:03:33.000000000 +0100
++++ ./gdb/infrun.c	2009-12-09 22:29:56.000000000 +0100
+@@ -3994,6 +3994,12 @@ infrun: not switching back to stepped th
+ 
+       if (ecs->event_thread->step_over_calls == STEP_OVER_ALL)
+ 	{
++	  struct symbol *stop_fn = find_pc_function (stop_pc);
++
++	  if (stop_fn == NULL
++	      || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
++{	/* ".omp_fn." */
++
+ 	  /* We're doing a "next".
+ 
+ 	     Normal (forward) execution: set a breakpoint at the
+@@ -4020,6 +4026,7 @@ infrun: not switching back to stepped th
+ 
+ 	  keep_going (ecs);
+ 	  return;
++}	/* ".omp_fn." */
+ 	}
+ 
+       /* If we are in a function call trampoline (a stub between the
+--- ./gdb/testsuite/gdb.fortran/omp-step.exp	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/omp-step.exp	2009-12-09 22:31:04.000000000 +0100
+@@ -0,0 +1,31 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set testfile "omp-step"
++set srcfile ${testfile}.f90
++if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77 additional_flags=-fopenmp}] } {
++    return -1
++}
++
++if ![runto [gdb_get_line_number "start-here"]] {
++    perror "Couldn't run to start-here"
++    return 0
++}
++
++gdb_test "next" {!\$omp parallel} "step closer"
++gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
++
++gdb_breakpoint [gdb_get_line_number "success"]
++gdb_continue_to_breakpoint "success" ".*success.*"
+--- ./gdb/testsuite/gdb.fortran/omp-step.f90	1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/omp-step.f90	2009-12-09 22:25:35.000000000 +0100
+@@ -0,0 +1,32 @@
++! Copyright 2009 Free Software Foundation, Inc.
++
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 3 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++      use omp_lib
++      integer nthreads, i, a(1000)
++      nthreads = omp_get_num_threads()
++      if (nthreads .gt. 1000) call abort
++
++      do i = 1, nthreads
++          a(i) = 0
++      end do
++      print *, "start-here"
++!$omp parallel
++      a(omp_get_thread_num() + 1) = 1
++!$omp end parallel
++      do i = 1, nthreads
++          if (a(i) .ne. 1) call abort
++      end do
++      print *, "success"
++      end
diff --git a/gdb-bz538626-bp_location-accel-bp-cond.patch b/gdb-bz538626-bp_location-accel-bp-cond.patch
new file mode 100644
index 0000000..0606b32
--- /dev/null
+++ b/gdb-bz538626-bp_location-accel-bp-cond.patch
@@ -0,0 +1,317 @@
+http://sourceware.org/ml/gdb-patches/2009-12/msg00180.html
+Subject: [patch] Fix a regression by me on breakpoint-cond-infcall
+
+Hi,
+
+GDB has now a regression since:
+	Re: [patch] Performance optimize large bp_location count
+	http://sourceware.org/ml/gdb-patches/2009-10/msg00632.html
+	=
+	2009-10-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	Performance optimize large bp_location count.
+
+on breakpoints with conditions calling inferior.
+
+Bringing the code back to the state before my acceleration patch.
+
+The code before already assumed no breakpoints or their bp_locations can
+change across the inferior call which should be true - trying to do some:
+	break a if b()
+	break b
+	command 1
+	delete 2
+	end
+or similar cannot work as inside "if b()" evaluation no breakpoints can be
+added or removed.
+
+update_global_location_list also does not removed/add `struct bp_location's
+themselves but only pointers to them in the bp_location array.  As the new
+iteration no longer uses the bp_location array it is no longer a problem.
+
+Original problem was found by and fixed differently by Phil Muldoon.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-12-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* breakpoint.c (bpstat_stop_status): Iterate using ALL_BREAKPOINTS and
+	the B->LOC list.  Remove gdb_assert on B.  Change bp_hardware_watchpoint
+	continue to break.  Remove variable update_locations.  Remove HIT_COUNT
+	increment protection by an ENABLE_STATE check.  Inline the delayed
+	update_global_location_list call.
+
+gdb/testsuite/
+2009-12-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	    Phil Muldoon  <pmuldoon@redhat.com>
+
+	* gdb.base/condbreak.exp: Put breakpoint on marker3 and marker4.
+	(bp_location13, bp_location14, bp_location17, bp_location18)
+	(marker3_proto, marker4_proto): New variables.
+	(breakpoint info): Update output.
+	(run until breakpoint at marker3, run until breakpoint at marker4): New
+	tests.
+
+[ Backported for F-12.  ]
+
+--- ./gdb/breakpoint.c	2009-12-14 00:25:55.000000000 +0100
++++ ./gdb/breakpoint.c	2009-12-14 00:32:32.000000000 +0100
+@@ -3298,93 +3298,93 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
+   /* Pointer to the last thing in the chain currently.  */
+   bpstat bs = root_bs;
+   int ix;
+-  int need_remove_insert, update_locations = 0;
++  int need_remove_insert;
+ 
+-  ALL_BP_LOCATIONS (bl, blp_tmp)
+-  {
+-    bpstat bs_prev = bs;
++  /* ALL_BP_LOCATIONS iteration would break across
++     update_global_location_list possibly executed by
++     bpstat_check_breakpoint_conditions's inferior call.  */
+ 
+-    b = bl->owner;
+-    gdb_assert (b);
+-    if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
+-      continue;
+-
+-    /* For hardware watchpoints, we look only at the first location.
+-       The watchpoint_check function will work on entire expression,
+-       not the individual locations.  For read watchopints, the
+-       watchpoints_triggered function have checked all locations
+-       alrea
+-     */
+-    if (b->type == bp_hardware_watchpoint && bl != b->loc)
+-      continue;
+-
+-    if (!bpstat_check_location (bl, bp_addr))
+-      continue;
+-
+-    /* Come here if it's a watchpoint, or if the break address matches */
+-
+-    bs = bpstat_alloc (bl, bs);	/* Alloc a bpstat to explain stop */
+-    gdb_assert (bs_prev->next == bs);
+-
+-    /* Assume we stop.  Should we find watchpoint that is not actually
+-       triggered, or if condition of breakpoint is false, we'll reset
+-       'stop' to 0.  */
+-    bs->stop = 1;
+-    bs->print = 1;
++  ALL_BREAKPOINTS (b)
++    {
++      if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
++	continue;
+ 
+-    if (!bpstat_check_watchpoint (bs))
+-      {
+-	/* Ensure bpstat_explains_signal stays false if this BL could not be
+-	   the cause of this trap.  */
++      for (bl = b->loc; bl != NULL; bl = bl->next)
++	{
++	  bpstat bs_prev = bs;
++
++	  /* For hardware watchpoints, we look only at the first location.
++	     The watchpoint_check function will work on entire expression,
++	     not the individual locations.  For read watchopints, the
++	     watchpoints_triggered function have checked all locations
++	     alrea
++	   */
++	  if (b->type == bp_hardware_watchpoint && bl != b->loc)
++	    break;
+ 
+-	gdb_assert (bs->print_it == print_it_noop);
+-	gdb_assert (!bs->stop);
+-	xfree (bs);
+-	bs = bs_prev;
+-	bs->next = NULL;
+-	continue;
+-      }
++	  if (!bpstat_check_location (bl, bp_addr))
++	    continue;
+ 
+-    if (b->type == bp_thread_event || b->type == bp_overlay_event
+-	|| b->type == bp_longjmp_master || b->type == bp_exception_master)
+-      /* We do not stop for these.  */
+-      bs->stop = 0;
+-    else
+-      bpstat_check_breakpoint_conditions (bs, ptid);
+-  
+-    if (bs->stop)
+-      {
+-	if (b->enable_state != bp_disabled)
+-	  ++(b->hit_count);
++	  /* Come here if it's a watchpoint, or if the break address matches */
+ 
+-	/* We will stop here */
+-	if (b->disposition == disp_disable)
+-	  {
+-	    if (b->enable_state != bp_permanent)
+-	      b->enable_state = bp_disabled;
+-	    update_locations = 1;
+-	  }
+-	if (b->silent)
+-	  bs->print = 0;
+-	bs->commands = b->commands;
+-	if (bs->commands
+-	    && (strcmp ("silent", bs->commands->line) == 0
+-		|| (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
+-	  {
+-	    bs->commands = bs->commands->next;
+-	    bs->print = 0;
+-	  }
+-	bs->commands = copy_command_lines (bs->commands);
+-      }
++	  bs = bpstat_alloc (bl, bs);	/* Alloc a bpstat to explain stop */
++	  gdb_assert (bs_prev->next == bs);
+ 
+-    /* Print nothing for this entry if we dont stop or if we dont print.  */
+-    if (bs->stop == 0 || bs->print == 0)
+-      bs->print_it = print_it_noop;
+-  }
++	  /* Assume we stop.  Should we find watchpoint that is not actually
++	     triggered, or if condition of breakpoint is false, we'll reset
++	     'stop' to 0.  */
++	  bs->stop = 1;
++	  bs->print = 1;
+ 
+-  /* Delay this call which would break the ALL_BP_LOCATIONS iteration above.  */
+-  if (update_locations)
+-    update_global_location_list (0);
++	  if (!bpstat_check_watchpoint (bs))
++	    {
++	      /* Ensure bpstat_explains_signal stays false if this BL could not be
++		 the cause of this trap.  */
++
++	      gdb_assert (bs->print_it == print_it_noop);
++	      gdb_assert (!bs->stop);
++	      xfree (bs);
++	      bs = bs_prev;
++	      bs->next = NULL;
++	      continue;
++	    }
++
++	  if (b->type == bp_thread_event || b->type == bp_overlay_event
++	      || b->type == bp_longjmp_master || b->type == bp_exception_master)
++	    /* We do not stop for these.  */
++	    bs->stop = 0;
++	  else
++	    bpstat_check_breakpoint_conditions (bs, ptid);
++	
++	  if (bs->stop)
++	    {
++	      ++(b->hit_count);
++
++	      /* We will stop here */
++	      if (b->disposition == disp_disable)
++		{
++		  if (b->enable_state != bp_permanent)
++		    b->enable_state = bp_disabled;
++		  update_global_location_list (0);
++		}
++	      if (b->silent)
++		bs->print = 0;
++	      bs->commands = b->commands;
++	      if (bs->commands
++		  && (strcmp ("silent", bs->commands->line) == 0
++		      || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
++		{
++		  bs->commands = bs->commands->next;
++		  bs->print = 0;
++		}
++	      bs->commands = copy_command_lines (bs->commands);
++	    }
++
++	  /* Print nothing for this entry if we dont stop or if we dont print.  */
++	  if (bs->stop == 0 || bs->print == 0)
++	    bs->print_it = print_it_noop;
++	}
++    }
+ 
+   for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
+     {
+--- ./gdb/testsuite/gdb.base/condbreak.exp	2009-01-03 06:58:03.000000000 +0100
++++ ./gdb/testsuite/gdb.base/condbreak.exp	2009-12-14 00:27:21.000000000 +0100
+@@ -68,8 +68,12 @@ set bp_location1  [gdb_get_line_number "
+ set bp_location6  [gdb_get_line_number "set breakpoint 6 here"]
+ set bp_location8  [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
+ set bp_location9  [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
++set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
++set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
+ set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
+ set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
++set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
++set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
+ 
+ #
+ # test break at function
+@@ -110,15 +114,29 @@ gdb_test "break marker2 if (a==43)" \
+     "Breakpoint.*at.* file .*$srcfile1, line.*"
+ 
+ #
++# Check break involving inferior function call.
++# Ensure there is at least one additional breakpoint with higher VMA.
++#
++gdb_test "break marker3 if (multi_line_if_conditional(1,1,1)==0)" \
++    "Breakpoint.*at.* file .*$srcfile1, line.*"
++gdb_test "break marker4" \
++    "Breakpoint.*at.* file .*$srcfile1, line.*"
++
++#
+ # check to see what breakpoints are set
+ #
+ 
+ if {$hp_aCC_compiler} {
+     set marker1_proto "\\(void\\)"
+     set marker2_proto "\\(int\\)"
++    # Not checked.
++    set marker3_proto "\\(char \\*, char \\*\\)"
++    set marker4_proto "\\(long\\)"
+ } else {
+     set marker1_proto ""
+     set marker2_proto ""
++    set marker3_proto ""
++    set marker4_proto ""
+ }
+ 
+ gdb_test "info break" \
+@@ -129,7 +147,10 @@ gdb_test "info break" \
+ \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$bp_location1.*
+ \[\t \]+stop only if \\(1==1\\).*
+ \[0-9\]+\[\t \]+breakpoint     keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
+-\[\t \]+stop only if \\(a==43\\).*" \
++\[\t \]+stop only if \\(a==43\\).*
++\[0-9\]+\[\t \]+breakpoint     keep y.* in marker3$marker3_proto at .*$srcfile1:($bp_location17|$bp_location18).*
++\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*
++\[0-9\]+\[\t \]+breakpoint     keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*" \
+     "breakpoint info"
+ 
+ 
+@@ -220,3 +241,23 @@ gdb_expect {
+ 	fail "(timeout) run until breakpoint at marker2"
+     }
+ }
++
++set test "run until breakpoint at marker3"
++gdb_test_multiple "continue" $test {
++    -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
++	pass $test
++    }
++    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
++	xfail $test
++    }
++}
++
++set test "run until breakpoint at marker4"
++gdb_test_multiple "continue" $test {
++    -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
++	pass $test
++    }
++    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
++	xfail $test
++    }
++}
diff --git a/gdb-bz539590-gnu-ifunc.patch b/gdb-bz539590-gnu-ifunc.patch
new file mode 100644
index 0000000..67ccce5
--- /dev/null
+++ b/gdb-bz539590-gnu-ifunc.patch
@@ -0,0 +1,974 @@
+http://sourceware.org/gdb/wiki/ProjectArcher
+http://sourceware.org/gdb/wiki/ArcherBranchManagement
+
+GIT snapshot:
+commit 791165df07fd22d381def1318954c389a606f81a
+
+archer-jankratochvil-ifunc
+
+Index: gdb-7.0.1/gdb/alpha-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/alpha-linux-tdep.c	2009-07-02 19:25:52.000000000 +0200
++++ gdb-7.0.1/gdb/alpha-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include "symtab.h"
+ #include "regset.h"
+ #include "regcache.h"
++#include "linux-tdep.h"
+ 
+ #include "alpha-tdep.h"
+ 
+@@ -235,6 +236,9 @@ alpha_linux_init_abi (struct gdbarch_inf
+ 
+   set_gdbarch_regset_from_core_section
+     (gdbarch, alpha_linux_regset_from_core_section);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/amd64-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/amd64-linux-tdep.c	2010-01-21 20:45:22.000000000 +0100
++++ gdb-7.0.1/gdb/amd64-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -1557,6 +1557,9 @@ amd64_linux_init_abi (struct gdbarch_inf
+   amd64_linux_record_tdep.arg6 = AMD64_R9_REGNUM;
+ 
+   tdep->i386_syscall_record = amd64_linux_syscall_record;
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ 
+Index: gdb-7.0.1/gdb/arm-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/arm-linux-tdep.c	2009-07-31 01:05:03.000000000 +0200
++++ gdb-7.0.1/gdb/arm-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -873,6 +873,9 @@ arm_linux_init_abi (struct gdbarch_info 
+   set_gdbarch_displaced_step_free_closure (gdbarch,
+ 					   simple_displaced_step_free_closure);
+   set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/elfread.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/elfread.c	2010-01-21 20:45:21.000000000 +0100
++++ gdb-7.0.1/gdb/elfread.c	2010-01-21 20:46:30.000000000 +0100
+@@ -168,7 +168,8 @@ record_minimal_symbol (char *name, CORE_
+ {
+   struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ 
+-  if (ms_type == mst_text || ms_type == mst_file_text)
++  if (ms_type == mst_text || ms_type == mst_file_text
++      || ms_type == mst_text_gnu_ifunc)
+     address = gdbarch_smash_text_address (gdbarch, address);
+ 
+   return prim_record_minimal_symbol_and_info
+@@ -373,7 +374,10 @@ elf_symtab_read (struct objfile *objfile
+ 	    {
+ 	      if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
+ 		{
+-		  ms_type = mst_text;
++		  if (sym->flags & BSF_GNU_INDIRECT_FUNCTION)
++		    ms_type = mst_text_gnu_ifunc;
++		  else
++		    ms_type = mst_text;
+ 		}
+ 	      else if ((sym->name[0] == '.' && sym->name[1] == 'L')
+ 		       || ((sym->flags & BSF_LOCAL)
+Index: gdb-7.0.1/gdb/frv-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/frv-linux-tdep.c	2009-07-02 19:25:53.000000000 +0200
++++ gdb-7.0.1/gdb/frv-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -31,6 +31,7 @@
+ #include "frame-unwind.h"
+ #include "regset.h"
+ #include "gdb_string.h"
++#include "linux-tdep.h"
+ 
+ /* Define the size (in bytes) of an FR-V instruction.  */
+ static const int frv_instr_size = 4;
+@@ -485,7 +486,21 @@ frv_linux_regset_from_core_section (stru
+   return NULL;
+ }
+ 
+-
++static CORE_ADDR
++frv_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
++				      CORE_ADDR addr,
++				      struct target_ops *targ)
++{
++  CORE_ADDR pc = frv_convert_from_func_ptr_addr (gdbarch, addr, targ);
++  CORE_ADDR resolved;
++
++  resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
++  if (resolved != pc)
++    pc = frv_convert_from_func_ptr_addr (gdbarch, resolved, targ);
++
++  return pc;
++}
++
+ static void
+ frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ {
+@@ -493,6 +508,10 @@ frv_linux_init_abi (struct gdbarch_info 
+   frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind); 
+   set_gdbarch_regset_from_core_section (gdbarch,
+                                         frv_linux_regset_from_core_section);
++
++  if (frv_abi (gdbarch) == FRV_ABI_FDPIC)
++    set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  frv_linux_convert_from_func_ptr_addr);
+ }
+ 
+ static enum gdb_osabi
+Index: gdb-7.0.1/gdb/frv-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/frv-tdep.c	2009-07-02 19:25:53.000000000 +0200
++++ gdb-7.0.1/gdb/frv-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -1169,7 +1169,7 @@ find_func_descr (struct gdbarch *gdbarch
+   return descr;
+ }
+ 
+-static CORE_ADDR
++CORE_ADDR
+ frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+                                 struct target_ops *targ)
+ {
+Index: gdb-7.0.1/gdb/frv-tdep.h
+===================================================================
+--- gdb-7.0.1.orig/gdb/frv-tdep.h	2009-01-03 06:57:51.000000000 +0100
++++ gdb-7.0.1/gdb/frv-tdep.h	2010-01-21 20:45:32.000000000 +0100
+@@ -118,3 +118,6 @@ CORE_ADDR frv_fetch_objfile_link_map (st
+ struct target_so_ops;
+ extern struct target_so_ops frv_so_ops;
+ 
++CORE_ADDR frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
++					  CORE_ADDR addr,
++					  struct target_ops *targ);
+Index: gdb-7.0.1/gdb/gdbtypes.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/gdbtypes.c	2010-01-21 20:45:22.000000000 +0100
++++ gdb-7.0.1/gdb/gdbtypes.c	2010-01-21 20:45:32.000000000 +0100
+@@ -1904,6 +1904,8 @@ init_type (enum type_code code, int leng
+     TYPE_NOTTEXT (type) = 1;
+   if (flags & TYPE_FLAG_FIXED_INSTANCE)
+     TYPE_FIXED_INSTANCE (type) = 1;
++  if (flags & TYPE_FLAG_GNU_IFUNC)
++    TYPE_GNU_IFUNC (type) = 1;
+ 
+   if (name)
+     TYPE_NAME (type) = obsavestring (name, strlen (name),
+@@ -3762,6 +3764,8 @@ gdbtypes_post_init (struct gdbarch *gdba
+     = lookup_pointer_type (builtin_type->builtin_void);
+   builtin_type->builtin_func_ptr
+     = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
++  builtin_type->builtin_func_func
++    = lookup_function_type (builtin_type->builtin_func_ptr);
+ 
+   /* This type represents a GDB internal function.  */
+   builtin_type->internal_fn
+@@ -3878,6 +3882,11 @@ objfile_type (struct objfile *objfile)
+ 		 "<text variable, no debug info>", objfile);
+   TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
+     = objfile_type->builtin_int;
++  objfile_type->nodebug_text_gnu_ifunc_symbol
++    = init_type (TYPE_CODE_FUNC, 1, TYPE_FLAG_GNU_IFUNC,
++		 "<text gnu-ifunc variable, no debug info>", objfile);
++  TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol)
++    = objfile_type->nodebug_text_symbol;
+   objfile_type->nodebug_data_symbol
+     = init_type (TYPE_CODE_INT,
+ 		 gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
+Index: gdb-7.0.1/gdb/gdbtypes.h
+===================================================================
+--- gdb-7.0.1.orig/gdb/gdbtypes.h	2010-01-21 20:45:23.000000000 +0100
++++ gdb-7.0.1/gdb/gdbtypes.h	2010-01-21 20:45:32.000000000 +0100
+@@ -187,6 +187,7 @@ enum type_flag_value
+   TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
+   TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
+   TYPE_FLAG_NOTTEXT = (1 << 17),
++  TYPE_FLAG_GNU_IFUNC = (1 << 18),
+ 
+   /* Used for error-checking.  */
+   TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
+@@ -292,6 +293,12 @@ enum type_instance_flag_value
+ 
+ #define TYPE_NOTTEXT(t)		(TYPE_MAIN_TYPE (t)->flag_nottext)
+ 
++/* Currently used only for TYPE_CODE_FUNC where specifies the real function
++   address is returned by this function call.  TYPE_TARGET_TYPE determines the
++   final returned function type to be presented to user.  */
++
++#define TYPE_GNU_IFUNC(t)	(TYPE_MAIN_TYPE (t)->flag_gnu_ifunc)
++
+ /* Type owner.  If TYPE_OBJFILE_OWNED is true, the type is owned by
+    the objfile retrieved as TYPE_OBJFILE.  Otherweise, the type is
+    owned by an architecture; TYPE_OBJFILE is NULL in this case.  */
+@@ -427,6 +434,7 @@ struct main_type
+   unsigned int flag_vector : 1;
+   unsigned int flag_stub_supported : 1;
+   unsigned int flag_nottext : 1;
++  unsigned int flag_gnu_ifunc : 1;
+   unsigned int flag_fixed_instance : 1;
+   unsigned int flag_objfile_owned : 1;
+   unsigned int flag_discardable : 1;
+@@ -1144,6 +1152,10 @@ struct builtin_type
+      (*) () can server as a generic function pointer.  */
+   struct type *builtin_func_ptr;
+ 
++  /* `function returning pointer to function (returning void)' type.
++     The final void return type is not significant for it.  */
++  struct type *builtin_func_func;
++
+ 
+   /* Special-purpose types.  */
+ 
+@@ -1186,6 +1198,7 @@ struct objfile_type
+ 
+   /* Types used for symbols with no debug information.  */
+   struct type *nodebug_text_symbol;
++  struct type *nodebug_text_gnu_ifunc_symbol;
+   struct type *nodebug_data_symbol;
+   struct type *nodebug_unknown_symbol;
+   struct type *nodebug_tls_symbol;
+Index: gdb-7.0.1/gdb/hppa-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/hppa-linux-tdep.c	2009-07-02 19:25:54.000000000 +0200
++++ gdb-7.0.1/gdb/hppa-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -31,6 +31,7 @@
+ #include "regset.h"
+ #include "regcache.h"
+ #include "hppa-tdep.h"
++#include "linux-tdep.h"
+ 
+ #include "elf/common.h"
+ 
+@@ -512,7 +513,21 @@ hppa_linux_regset_from_core_section (str
+ 
+   return NULL;
+ }
+-
++
++static CORE_ADDR
++hppa32_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
++					 CORE_ADDR addr,
++					 struct target_ops *targ)
++{
++  CORE_ADDR pc = hppa32_convert_from_func_ptr_addr (gdbarch, addr, targ);
++  CORE_ADDR resolved;
++
++  resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
++  if (resolved != pc)
++    pc = hppa32_convert_from_func_ptr_addr (gdbarch, resolved, targ);
++
++  return pc;
++}
+ 
+ /* Forward declarations.  */
+ extern initialize_file_ftype _initialize_hppa_linux_tdep;
+@@ -554,6 +569,10 @@ hppa_linux_init_abi (struct gdbarch_info
+   /* Enable TLS support.  */
+   set_gdbarch_fetch_tls_load_module_address (gdbarch,
+                                              svr4_fetch_objfile_link_map);
++
++  if (tdep->bytes_per_address == 4)
++    set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++				       hppa32_linux_convert_from_func_ptr_addr);
+ }
+ 
+ void
+Index: gdb-7.0.1/gdb/hppa-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/hppa-tdep.c	2009-09-13 18:28:28.000000000 +0200
++++ gdb-7.0.1/gdb/hppa-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -1247,7 +1247,7 @@ hppa64_return_value (struct gdbarch *gdb
+ }
+ 
+ 
+-static CORE_ADDR
++CORE_ADDR
+ hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+ 				   struct target_ops *targ)
+ {
+Index: gdb-7.0.1/gdb/hppa-tdep.h
+===================================================================
+--- gdb-7.0.1.orig/gdb/hppa-tdep.h	2009-07-02 19:25:54.000000000 +0200
++++ gdb-7.0.1/gdb/hppa-tdep.h	2010-01-21 20:45:32.000000000 +0100
+@@ -246,4 +246,8 @@ extern int hppa_in_solib_call_trampoline
+ 					  CORE_ADDR pc, char *name);
+ extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc);
+ 
++extern CORE_ADDR hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
++						    CORE_ADDR addr,
++						    struct target_ops *targ);
++
+ #endif  /* hppa-tdep.h */
+Index: gdb-7.0.1/gdb/i386-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/i386-linux-tdep.c	2009-09-21 08:57:03.000000000 +0200
++++ gdb-7.0.1/gdb/i386-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -798,6 +798,9 @@ i386_linux_init_abi (struct gdbarch_info
+                                   i386_linux_get_syscall_number);
+ 
+   set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/ia64-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/ia64-linux-tdep.c	2009-07-02 19:25:55.000000000 +0200
++++ gdb-7.0.1/gdb/ia64-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -26,6 +26,7 @@
+ #include "osabi.h"
+ #include "solib-svr4.h"
+ #include "symtab.h"
++#include "linux-tdep.h"
+ 
+ /* The sigtramp code is in a non-readable (executable-only) region
+    of memory called the ``gate page''.  The addresses in question
+@@ -139,6 +140,9 @@ ia64_linux_init_abi (struct gdbarch_info
+   /* Enable TLS support.  */
+   set_gdbarch_fetch_tls_load_module_address (gdbarch,
+                                              svr4_fetch_objfile_link_map);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/infcall.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/infcall.c	2010-01-21 20:45:21.000000000 +0100
++++ gdb-7.0.1/gdb/infcall.c	2010-01-21 20:45:32.000000000 +0100
+@@ -252,9 +252,17 @@ find_function_addr (struct value *functi
+       if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
+ 	  || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
+ 	{
+-	  funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
+-							&current_target);
+-	  value_type = TYPE_TARGET_TYPE (ftype);
++	  CORE_ADDR funaddr2;
++
++	  funaddr2 = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
++							 &current_target);
++
++	  /* If TYPE_GNU_IFUNC is currently not resolvable keep its type.  */
++	  if (funaddr2 != funaddr || !TYPE_GNU_IFUNC (ftype))
++	    {
++	      funaddr = funaddr2;
++	      value_type = TYPE_TARGET_TYPE (ftype);
++	    }
+ 	}
+     }
+   else if (code == TYPE_CODE_INT)
+Index: gdb-7.0.1/gdb/linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/linux-tdep.c	2010-01-21 20:45:22.000000000 +0100
++++ gdb-7.0.1/gdb/linux-tdep.c	2010-01-21 20:47:02.000000000 +0100
+@@ -20,6 +20,9 @@
+ #include "defs.h"
+ #include "gdbtypes.h"
+ #include "linux-tdep.h"
++#include "value.h"
++#include "infcall.h"
++#include "target.h"
+ 
+ /* This function is suitable for architectures that don't
+    extend/override the standard siginfo structure.  */
+@@ -134,3 +136,43 @@ linux_get_siginfo_type (struct gdbarch *
+ 
+   return siginfo_type;
+ }
++
++/* Call gnu-ifunc to resolve breakpoint at its returned function.  */
++
++CORE_ADDR
++linux_convert_from_func_and_ptr (struct gdbarch *gdbarch, CORE_ADDR func_ptr,
++                                 CORE_ADDR pc)
++{
++  struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func;
++  struct minimal_symbol *msymbol;
++  struct value *function, *address;
++
++  if (!target_has_execution)
++    return pc;
++
++  msymbol = lookup_minimal_symbol_by_pc (func_ptr);
++  if (msymbol == NULL)
++    return pc;
++  if (MSYMBOL_TYPE (msymbol) != mst_text_gnu_ifunc)
++    return pc;
++
++  /* Not at the gnu-ifunc entry point?  */
++  if (SYMBOL_VALUE_ADDRESS (msymbol) != func_ptr)
++    return pc;
++
++  function = allocate_value (func_func_type);
++  set_value_address (function, pc);
++
++  /* gnu-ifuncs have no arguments.  FUNCTION is the code instruction address
++     while ADDRESS is a function descriptor.  */
++  address = call_function_by_hand (function, 0, NULL);
++
++  return value_as_address (address);
++}
++
++CORE_ADDR
++linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
++				  struct target_ops *targ)
++{
++  return linux_convert_from_func_and_ptr (gdbarch, addr, addr);
++}
+Index: gdb-7.0.1/gdb/linux-tdep.h
+===================================================================
+--- gdb-7.0.1.orig/gdb/linux-tdep.h	2009-02-06 23:59:00.000000000 +0100
++++ gdb-7.0.1/gdb/linux-tdep.h	2010-01-21 20:45:32.000000000 +0100
+@@ -22,4 +22,11 @@
+ 
+ struct type *linux_get_siginfo_type (struct gdbarch *);
+ 
++CORE_ADDR linux_convert_from_func_and_ptr (struct gdbarch *gdbarch,
++					   CORE_ADDR func_ptr, CORE_ADDR pc);
++
++CORE_ADDR linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
++					    CORE_ADDR addr,
++					    struct target_ops *targ);
++
+ #endif /* linux-tdep.h */
+Index: gdb-7.0.1/gdb/m32r-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/m32r-linux-tdep.c	2009-01-03 06:57:52.000000000 +0100
++++ gdb-7.0.1/gdb/m32r-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -30,6 +30,7 @@
+ #include "gdb_string.h"
+ 
+ #include "glibc-tdep.h"
++#include "linux-tdep.h"
+ #include "solib-svr4.h"
+ #include "symtab.h"
+ 
+@@ -422,6 +423,9 @@ m32r_linux_init_abi (struct gdbarch_info
+   /* Enable TLS support.  */
+   set_gdbarch_fetch_tls_load_module_address (gdbarch,
+                                              svr4_fetch_objfile_link_map);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/minsyms.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/minsyms.c	2010-01-21 20:45:22.000000000 +0100
++++ gdb-7.0.1/gdb/minsyms.c	2010-01-21 20:45:32.000000000 +0100
+@@ -331,8 +331,9 @@ lookup_minimal_symbol_text (const char *
+ 	       msymbol = msymbol->hash_next)
+ 	    {
+ 	      if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 &&
+-		  (MSYMBOL_TYPE (msymbol) == mst_text ||
+-		   MSYMBOL_TYPE (msymbol) == mst_file_text))
++		  (MSYMBOL_TYPE (msymbol) == mst_text
++		   || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
++		   || MSYMBOL_TYPE (msymbol) == mst_file_text))
+ 		{
+ 		  switch (MSYMBOL_TYPE (msymbol))
+ 		    {
+@@ -699,6 +700,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR p
+ {
+   return lookup_minimal_symbol_by_pc_section (pc, NULL);
+ }
++
++/* Return non-zero iff PC is in function implementing gnu-ifunc selection.  */
++
++int
++in_gnu_ifunc_stub (CORE_ADDR pc)
++{
++  struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
++
++  return msymbol && MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc;
++}
+ 
+ 
+ /* Return leading symbol character for a BFD. If BFD is NULL,
+@@ -738,6 +749,7 @@ prim_record_minimal_symbol (const char *
+   switch (ms_type)
+     {
+     case mst_text:
++    case mst_text_gnu_ifunc:
+     case mst_file_text:
+     case mst_solib_trampoline:
+       section = SECT_OFF_TEXT (objfile);
+@@ -1184,7 +1196,8 @@ find_solib_trampoline_target (struct fra
+     {
+       ALL_MSYMBOLS (objfile, msymbol)
+       {
+-	if (MSYMBOL_TYPE (msymbol) == mst_text
++	if ((MSYMBOL_TYPE (msymbol) == mst_text
++	    || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc)
+ 	    && strcmp (SYMBOL_LINKAGE_NAME (msymbol),
+ 		       SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
+ 	  return SYMBOL_VALUE_ADDRESS (msymbol);
+Index: gdb-7.0.1/gdb/mips-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/mips-linux-tdep.c	2009-07-02 19:25:55.000000000 +0200
++++ gdb-7.0.1/gdb/mips-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -38,6 +38,7 @@
+ #include "target-descriptions.h"
+ #include "mips-linux-tdep.h"
+ #include "glibc-tdep.h"
++#include "linux-tdep.h"
+ 
+ static struct target_so_ops mips_svr4_so_ops;
+ 
+@@ -1225,6 +1226,9 @@ mips_linux_init_abi (struct gdbarch_info
+ 	tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM,
+ 				 "restart");
+     }
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/mn10300-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/mn10300-linux-tdep.c	2009-02-22 02:02:19.000000000 +0100
++++ gdb-7.0.1/gdb/mn10300-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -32,6 +32,7 @@
+ #include "frame.h"
+ #include "trad-frame.h"
+ #include "tramp-frame.h"
++#include "linux-tdep.h"
+ 
+ #include <stdlib.h>
+ 
+@@ -718,6 +719,9 @@ am33_linux_init_osabi (struct gdbarch_in
+ 
+   tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe);
+   tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/parse.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/parse.c	2010-01-21 20:45:22.000000000 +0100
++++ gdb-7.0.1/gdb/parse.c	2010-01-21 20:45:32.000000000 +0100
+@@ -517,6 +517,11 @@ write_exp_msymbol (struct minimal_symbol
+ 	write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
+       break;
+ 
++    case mst_text_gnu_ifunc:
++      write_exp_elt_type (objfile_type (objfile)
++					       ->nodebug_text_gnu_ifunc_symbol);
++      break;
++
+     case mst_data:
+     case mst_file_data:
+     case mst_bss:
+Index: gdb-7.0.1/gdb/ppc-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/ppc-linux-tdep.c	2009-09-15 05:30:06.000000000 +0200
++++ gdb-7.0.1/gdb/ppc-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -48,6 +48,7 @@
+ #include "arch-utils.h"
+ #include "spu-tdep.h"
+ #include "xml-syscall.h"
++#include "linux-tdep.h"
+ 
+ #include "features/rs6000/powerpc-32l.c"
+ #include "features/rs6000/powerpc-altivec32l.c"
+@@ -672,8 +673,19 @@ ppc64_linux_convert_from_func_ptr_addr (
+       res = bfd_get_section_contents (s->bfd, s->the_bfd_section,
+ 				      &buf, addr - s->addr, 8);
+       if (res != 0)
+-	return extract_unsigned_integer (buf, 8, byte_order)
+-		- bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
++	{
++	  CORE_ADDR pc, resolved;
++	  
++	  pc = extract_unsigned_integer (buf, 8, byte_order)
++	       - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
++
++	  resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
++	  if (resolved != pc)
++	    pc = ppc64_linux_convert_from_func_ptr_addr (gdbarch, resolved,
++							 targ);
++
++	  return pc;
++	}
+    }
+ 
+   return addr;
+Index: gdb-7.0.1/gdb/solib-svr4.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/solib-svr4.c	2010-01-21 20:45:23.000000000 +0100
++++ gdb-7.0.1/gdb/solib-svr4.c	2010-01-21 20:46:04.000000000 +0100
+@@ -1250,7 +1250,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR p
+ {
+   return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
+ 	  || (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
+-	  || in_plt_section (pc, NULL));
++	  || in_plt_section (pc, NULL)
++	  || in_gnu_ifunc_stub (pc));
+ }
+ 
+ /* Given an executable's ABFD and target, compute the entry-point
+Index: gdb-7.0.1/gdb/sparc-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/sparc-linux-tdep.c	2009-07-02 19:25:58.000000000 +0200
++++ gdb-7.0.1/gdb/sparc-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -32,6 +32,7 @@
+ #include "symtab.h"
+ #include "trad-frame.h"
+ #include "tramp-frame.h"
++#include "linux-tdep.h"
+ 
+ #include "sparc-tdep.h"
+ 
+@@ -279,6 +280,9 @@ sparc32_linux_init_abi (struct gdbarch_i
+   dwarf2_append_unwinders (gdbarch);
+ 
+   set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+Index: gdb-7.0.1/gdb/sparc64-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/sparc64-linux-tdep.c	2009-07-02 19:25:58.000000000 +0200
++++ gdb-7.0.1/gdb/sparc64-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -31,6 +31,7 @@
+ #include "symtab.h"
+ #include "trad-frame.h"
+ #include "tramp-frame.h"
++#include "linux-tdep.h"
+ 
+ #include "sparc64-tdep.h"
+ 
+@@ -244,6 +245,9 @@ sparc64_linux_init_abi (struct gdbarch_i
+   tdep->step_trap = sparc64_linux_step_trap;
+ 
+   set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ 
+Index: gdb-7.0.1/gdb/symmisc.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/symmisc.c	2010-01-21 20:45:22.000000000 +0100
++++ gdb-7.0.1/gdb/symmisc.c	2010-01-21 20:45:32.000000000 +0100
+@@ -287,6 +287,9 @@ dump_msymbols (struct objfile *objfile, 
+ 	case mst_text:
+ 	  ms_type = 'T';
+ 	  break;
++	case mst_text_gnu_ifunc:
++	  ms_type = 'i';
++	  break;
+ 	case mst_solib_trampoline:
+ 	  ms_type = 'S';
+ 	  break;
+Index: gdb-7.0.1/gdb/symtab.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/symtab.c	2010-01-21 20:45:22.000000000 +0100
++++ gdb-7.0.1/gdb/symtab.c	2010-01-21 20:45:32.000000000 +0100
+@@ -3160,7 +3160,7 @@ search_symbols (char *regexp, domain_enu
+   {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
+   static enum minimal_symbol_type types4[]
+   =
+-  {mst_file_bss, mst_text, mst_abs, mst_unknown};
++  {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown};
+   enum minimal_symbol_type ourtype;
+   enum minimal_symbol_type ourtype2;
+   enum minimal_symbol_type ourtype3;
+Index: gdb-7.0.1/gdb/symtab.h
+===================================================================
+--- gdb-7.0.1.orig/gdb/symtab.h	2010-01-21 20:45:21.000000000 +0100
++++ gdb-7.0.1/gdb/symtab.h	2010-01-21 20:45:32.000000000 +0100
+@@ -275,6 +275,8 @@ enum minimal_symbol_type
+ {
+   mst_unknown = 0,		/* Unknown type, the default */
+   mst_text,			/* Generally executable instructions */
++  mst_text_gnu_ifunc,		/* Executable code returning address
++				   of executable code */
+   mst_data,			/* Generally initialized data */
+   mst_bss,			/* Generally uninitialized data */
+   mst_abs,			/* Generally absolute (nonrelocatable) */
+@@ -1149,6 +1151,8 @@ extern struct minimal_symbol *lookup_min
+ 
+ extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR);
+ 
++extern int in_gnu_ifunc_stub (CORE_ADDR pc);
++
+ extern struct minimal_symbol
+   *lookup_minimal_symbol_by_pc_section (CORE_ADDR, struct obj_section *);
+ 
+Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc-lib.c	2010-01-21 20:45:32.000000000 +0100
+@@ -0,0 +1,54 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <assert.h>
++
++typedef int (*final_t) (int arg);
++
++static int
++init_stub (int arg)
++{
++  return 0;
++}
++
++static int
++final (int arg)
++{
++  return arg + 1;
++}
++
++static volatile int gnu_ifunc_initialized;
++
++void
++gnu_ifunc_pre (void)
++{
++  assert (!gnu_ifunc_initialized);
++
++  gnu_ifunc_initialized = 1;
++}
++
++final_t gnu_ifuncX (void) asm ("gnu_ifunc");
++asm (".type gnu_ifunc, @gnu_indirect_function");
++
++final_t
++gnu_ifuncX (void)
++{
++  if (!gnu_ifunc_initialized)
++    return init_stub;
++  else
++    return final;
++}
+Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.c	2010-01-21 20:45:32.000000000 +0100
+@@ -0,0 +1,36 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <assert.h>
++
++extern int gnu_ifunc (int arg);
++extern void gnu_ifunc_pre (void);
++
++int
++main (void)
++{
++  int i;
++
++  gnu_ifunc_pre ();
++  
++  i = gnu_ifunc (1);	/* break-at-call */
++  assert (i == 2);
++
++  gnu_ifunc (2);	/* break-at-nextcall */
++
++  return 0;	/* break-at-exit */
++}
+Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.exp	2010-01-21 20:45:32.000000000 +0100
+@@ -0,0 +1,115 @@
++# Copyright (C) 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if {[skip_shlib_tests]} {
++    return 0
++}
++
++set testfile "gnu-ifunc"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++set libfile "${testfile}-lib"
++set libsrc ${libfile}.c
++set lib_so ${objdir}/${subdir}/${libfile}.so
++
++set lib_nodebug_so_base ${libfile}-nodebug.so
++set lib_nodebug_so ${objdir}/${subdir}/${lib_nodebug_so_base}
++
++# {debug} provides DWARF symbol gnu_ifuncX confusing the ELF symbol
++# gnu_ifunc during address->symbol resolution for printing the symbol.
++# Still we need it here for "step"ping into the function.
++set lib_opts [list debug]
++set lib_nodebug_opts [list]
++set exec_opts [list debug shlib=$lib_so]
++
++if [get_compiler_info ${binfile}] {
++    return -1
++}
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_so $lib_opts] != ""
++     || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""} {
++    untested "Could not compile either $libsrc or $srcfile."
++    return -1
++}
++
++# Start with a fresh gdb.
++
++clean_restart $testfile
++gdb_load_shlibs ${lib_so}
++
++if ![runto_main] then {
++    fail "Can't run to main"
++    return 1;
++}
++
++# The "if" condition is artifical to test regression of a format patch.
++gdb_breakpoint "[gdb_get_line_number "break-at-nextcall"] if i && gnu_ifunc (i) != 42"
++
++gdb_breakpoint [gdb_get_line_number "break-at-call"]
++gdb_continue_to_breakpoint "break-at-call" ".*break-at-call.*"
++
++# Test GDB will automatically indirect the call.
++
++gdb_test "p gnu_ifunc (3)" " = 4"
++
++# Test GDB will skip the gnu_ifunc resolver on first call.
++
++gdb_test "step" "\r\nfinal .*"
++
++# Test GDB will not break before the final chosen implementation.
++
++# Also test a format patch regression:
++# Continuing.
++# Error in testing breakpoint condition:
++# Attempt to take address of value not located in memory.
++# 
++# Breakpoint 2, main () at ./gdb.base/gnu-ifunc.c:33
++
++gdb_test "continue" "Continuing.\r\n\r\nBreakpoint .* (at|in) .*break-at-nextcall.*" \
++	 "continue to break-at-nextcall"
++
++gdb_breakpoint "gnu_ifunc"
++
++gdb_continue_to_breakpoint "nextcall gnu_ifunc"
++
++gdb_test "frame" "#0 +(0x\[0-9a-f\]+ in +)?final \\(.*" "nextcall gnu_ifunc skipped"
++
++
++# Compare the two different addresses:
++
++gdb_test "p gnu_ifunc" " = {<text variable, no debug info>} 0x\[0-9a-f\]+ <final>" "p gnu_ifunc executing"
++gdb_test "info sym gnu_ifunc" "final in section .*" "info sym gnu_ifunc executing"
++
++set test "info addr gnu_ifunc"
++gdb_test_multiple $test $test {
++    -re "Symbol \"gnu_ifunc\" is at (0x\[0-9a-f\]+) in .*$gdb_prompt $" {
++	pass $test
++    }
++}
++gdb_test "info sym $expect_out(1,string)" "gnu_ifunc in section .*" "info sym <gnu_ifunc-address>"
++
++# <*gnu_ifunc> would be an incorrect resolution from DW_AT_MIPS_linkage_name.
++# We do not use {debug} build option for this purpose.
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_nodebug_so $lib_nodebug_opts] != ""} {
++    untested "Could not compile either $libsrc."
++    return -1
++}
++
++clean_restart $lib_nodebug_so_base
++
++gdb_test "p gnu_ifunc" " = {<text gnu-ifunc variable, no debug info>} 0x\[0-9a-f\]+ <gnu_ifunc>" "p gnu_ifunc not executing without debug"
++gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc not executing without debug"
+Index: gdb-7.0.1/gdb/xtensa-linux-tdep.c
+===================================================================
+--- gdb-7.0.1.orig/gdb/xtensa-linux-tdep.c	2009-02-22 02:02:20.000000000 +0100
++++ gdb-7.0.1/gdb/xtensa-linux-tdep.c	2010-01-21 20:45:32.000000000 +0100
+@@ -22,6 +22,7 @@
+ 
+ #include "solib-svr4.h"
+ #include "symtab.h"
++#include "linux-tdep.h"
+ 
+ /* OS specific initialization of gdbarch.  */
+ 
+@@ -30,6 +31,9 @@ xtensa_linux_init_abi (struct gdbarch_in
+ {
+   set_solib_svr4_fetch_link_map_offsets
+     (gdbarch, svr4_ilp32_fetch_link_map_offsets);
++
++  set_gdbarch_convert_from_func_ptr_addr (gdbarch,
++					  linux_convert_from_func_ptr_addr);
+ }
+ 
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+--- gdb-7.0.1/gdb/configure.tgt-orig	2009-08-06 12:28:38.000000000 +0200
++++ gdb-7.0.1/gdb/configure.tgt	2010-01-21 21:28:38.000000000 +0100
+@@ -374,7 +374,7 @@ powerpc-*-aix* | rs6000-*-*)
+ 	;;
+ powerpc-*-linux* | powerpc64-*-linux*)
+ 	# Target: PowerPC running Linux
+-	gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o \
++	gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o linux-tdep.o ppc-sysv-tdep.o \
+ 			solib.o solib-svr4.o solib-spu.o spu-multiarch.o \
+ 			corelow.o symfile-mem.o"
+ 	gdb_sim=../sim/ppc/libsim.a
diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch
new file mode 100644
index 0000000..09347ef
--- /dev/null
+++ b/gdb-bz541866-rwatch-before-run.patch
@@ -0,0 +1,194 @@
+[ Rediffed against gdb-7.0.1.  ]
+
+watchpoint-hw-hit-once.c is a part of:
+http://sourceware.org/ml/gdb-patches/2009-11/msg00444.html
+http://sourceware.org/ml/gdb-cvs/2009-11/msg00178.html
+ec27fce19a16df73e763281ce3a6d0cdb718174e
+
+
+--- a/gdb/config/i386/linux64.mh
++++ b/gdb/config/i386/linux64.mh
+@@ -2,7 +2,7 @@
+ NATDEPFILES= inf-ptrace.o fork-child.o \
+ 	i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
+ 	proc-service.o linux-thread-db.o gcore.o  linux-fork.o
+-NAT_FILE= config/nm-linux.h
++NAT_FILE= nm-linux64.h
+ 
+ # The dynamically loaded libthread_db needs access to symbols in the
+ # gdb executable.
+--- a/gdb/config/i386/nm-linux.h
++++ b/gdb/config/i386/nm-linux.h
+@@ -29,4 +29,7 @@
+ #define FILL_FPXREGSET
+ #endif
+ 
++/* Red Hat backward compatibility with gdb-6.8.  */
++#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
++
+ #endif /* nm-linux.h */
+--- /dev/null
++++ b/gdb/config/i386/nm-linux64.h
+@@ -0,0 +1,28 @@
++/* Native support for GNU/Linux amd64.
++
++   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/>.  */
++
++#ifndef NM_LINUX64_H
++#define NM_LINUX64_H
++
++#include "config/nm-linux.h"
++
++/* Red Hat backward compatibility with gdb-6.8.  */
++#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
++
++#endif /* NM_LINUX64_H */
+--- gdb-7.0.1-orig/gdb/config/ia64/linux.mh	2007-04-26 00:17:48.000000000 +0200
++++ gdb-7.0.1/gdb/config/ia64/linux.mh	2010-02-24 01:40:21.000000000 +0100
+@@ -1,6 +1,6 @@
+ # Host: Intel IA-64 running GNU/Linux
+ 
+-NAT_FILE= config/nm-linux.h
++NAT_FILE= nm-linux.h
+ NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
+ 	core-regset.o ia64-linux-nat.o \
+ 	proc-service.o linux-thread-db.o linux-nat.o linux-fork.o
+--- /dev/null
++++ b/gdb/config/ia64/nm-linux.h
+@@ -0,0 +1,28 @@
++/* Native support for GNU/Linux ia64.
++
++   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/>.  */
++
++#ifndef NM_LINUX_H
++#define NM_LINUX_H
++
++#include "config/nm-linux.h"
++
++/* Red Hat backward compatibility with gdb-6.8.  */
++#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
++
++#endif /* NM_LINUX_H */
+--- a/gdb/target.h
++++ b/gdb/target.h
+@@ -1257,8 +1257,10 @@ extern char *normal_pid_to_str (ptid_t ptid);
+    bp_hardware_breakpoint.  CNT is the number of such watchpoints used so far
+    (including this one?).  OTHERTYPE is who knows what...  */
+ 
++#ifndef target_can_use_hardware_watchpoint
+ #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
+  (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
++#endif
+ 
+ #define target_region_ok_for_hw_watchpoint(addr, len) \
+     (*current_target.to_region_ok_for_hw_watchpoint) (addr, len)
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
+@@ -0,0 +1,40 @@
++# Copyright 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/>.
++
++# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
++if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
++     && ![istarget "ia64-*-*"])
++    || [target_info exists gdb,no_hardware_watchpoints]} then {
++    verbose "Skipping watchpoint-hw-before-run test."
++    return
++}
++
++set test watchpoint-hw-before-run
++set srcfile watchpoint-hw-hit-once.c
++if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
++    return -1
++}
++
++gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
++
++# `runto_main' or `runto main' would delete the watchpoint created above.
++
++if { [gdb_start_cmd] < 0 } {
++    untested start
++    return -1
++}
++gdb_test "" "main .* at .*" "start"
++
++gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c
+@@ -0,0 +1,34 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++static int watchee;
++
++int
++main (void)
++{
++  volatile int dummy;
++
++  /* Stub lines are present as no breakpoints/watchpoint gets hit if current PC
++     already stays on the line PC while entering "step"/"continue".  */
++
++  dummy = 0;	/* Stub to catch WATCHEE access after runto_main.  */
++  dummy = watchee;
++  dummy = 1;	/* Stub to catch break-at-exit after WATCHEE has been hit.  */
++  dummy = 2;	/* break-at-exit */
++
++  return 0;
++}
diff --git a/gdb-bz559291-fortran-module-toplevel.patch b/gdb-bz559291-fortran-module-toplevel.patch
new file mode 100644
index 0000000..22d657a
--- /dev/null
+++ b/gdb-bz559291-fortran-module-toplevel.patch
@@ -0,0 +1,108 @@
+http://sourceware.org/ml/archer/2010-q1/msg00047.html
+Subject: [fortran-module] [commit] Fix a regression on setting breakpoint at
+
+[ Backport for F-12.  ]
+
+f5c7672a52316155bc3367cbc2f0e7db22523634
+
+https://bugzilla.redhat.com/show_bug.cgi?id=559291
+
+gdb/
+2010-02-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	    David Moore  <david.moore@intel.com>
+	* f-lang.c (f_lookup_symbol_nonlocal): Always fallback on
+	basic_lookup_symbol_nonlocal.
+
+gdb/testsuite/
+2010-02-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	* gdb.fortran/module.exp (show language, setting breakpoint at module):
+	New.
+	* gdb.fortran/module.f90: New statement program module.
+
+--- ./gdb/f-lang.c	2010-02-03 01:50:07.000000000 +0100
++++ ./gdb/f-lang.c	2010-02-03 01:49:06.000000000 +0100
+@@ -308,33 +308,33 @@ f_lookup_symbol_nonlocal (const char *na
+ 			  const struct block *block,
+ 			  const domain_enum domain)
+ {
+-  struct fortran_using *use;
+-
+-  if (!block)
+-    return NULL;
+-
+-  for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
++  if (block)
+     {
+-      struct symbol *sym;
+-      struct type *type;
+-      struct symbol *retval;
+-
+-      sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
+-
+-      /* Module name lookup should not fail with correct debug info.  */
+-      if (sym == NULL)
+-	continue;
+-
+-      type = SYMBOL_TYPE (sym);
+-      gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
+-      gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
+-
+-      retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
+-      if (retval)
+-	return retval;
++      struct fortran_using *use;
++
++      for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
++	{
++	  struct symbol *sym;
++	  struct type *type;
++	  struct symbol *retval;
++
++	  sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
++
++	  /* Module name lookup should not fail with correct debug info.  */
++	  if (sym == NULL)
++	    continue;
++
++	  type = SYMBOL_TYPE (sym);
++	  gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
++	  gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
++
++	  retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
++	  if (retval)
++	    return retval;
++	}
+     }
+ 
+-  return NULL;
++  return basic_lookup_symbol_nonlocal (name, block, domain);
+ }
+ 
+ /* This is declared in c-lang.h but it is silly to import that file for what
+--- ./gdb/testsuite/gdb.fortran/module.exp	2010-02-03 01:50:13.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/module.exp	2010-02-03 01:47:42.000000000 +0100
+@@ -43,3 +43,13 @@ gdb_test "print var_b" " = 11"
+ gdb_test "print var_c" "No symbol \"var_c\" in current context\\."
+ gdb_test "print var_d" " = 12"
+ gdb_test "print var_i" " = 14" "print var_i value 14"
++
++# Breakpoint would work in language "c".
++gdb_test "show language" {The current source language is "(auto; currently )?fortran".}
++
++# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above
++# works.  But DWARF DW_TAG_subprogram contains the name specified by
++# the "program" Fortran statement.
++if [gdb_breakpoint "module"] {
++    pass "setting breakpoint at module"
++}
+--- ./gdb/testsuite/gdb.fortran/module.f90	2010-02-03 01:50:07.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/module.f90	2010-02-03 01:47:42.000000000 +0100
+@@ -37,6 +37,8 @@ end module modmany
+         var_i = var_i                         ! i-is-2
+         end
+ 
++        program module
++
+         use modmany, only: var_b, var_d => var_c, var_i
+ 
+         call sub1
diff --git a/gdb-bz559414-pie-assert-fix.patch b/gdb-bz559414-pie-assert-fix.patch
new file mode 100644
index 0000000..27ca21b
--- /dev/null
+++ b/gdb-bz559414-pie-assert-fix.patch
@@ -0,0 +1,174 @@
+http://sourceware.org/ml/gdb-patches/2010-01/msg00661.html
+Subject: [patch] Fix failed gdb_assert due to the PIE patchset
+
+[ Backport for F-12/7.0.  ]
+
+Hi,
+
+the PIE patchset brought in an occasionally failing gdb_assert (according to
+Fedora ABRT bugreports).
+solib-svr4.c:600: internal-error: scan_dyntag: Assertion `target_section < current_target_sections->sections_end' failed.
+
+Now I understand it as generally current_target_sections are about target-side
+data while symbols are the GDB side and there is only loose relation of those.
+
+ABFD can be from multiple places acting for multiple purposes as parsed by
+elf_lookup_lib_symbol:
+
+exec_bfd:
+	It cannot be from exec_one - this BFD has no associated objfile to
+	pass to symfile_objfile.  OK.
+symfile_objfile:
+	It gets translated by elf_lookup_lib_symbol into exec_bfd which
+	represents the target data.  OK.
+so_list's objfile's separate_debug_objfile file:
+	gdb_assert-forbidden as input to elf_lookup_lib_symbol.  OK.
+so_list's objfile's main file:
+	update_solib_list must have called add_target_sections.  OK.
+objfile's separate_debug_objfile file:
+	gdb_assert-forbidden as input to elf_lookup_lib_symbol.  OK.
+objfile's main file (if it has no associated so_list):
+	Such ABFD from add_symbol_file_command has no add_target_sections
+	called.  Still it can have current context BLOCK which crashes
+	scan_dyntag.  BUG.
+
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+The patch mostly reverts the PIE part there.
+
+OK to check in?
+
+
+Sorry,
+Jan
+
+
+gdb/
+2010-01-31  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* solib-svr4.c (scan_dyntag): New variable dyn_addr.  Replace gdb_assert
+	by a conditional setting DYN_ADDR.  Use DYN_ADDR.
+	* config/djgpp/fnchange.lst: Add translations for
+	symbol-without-target_section.exp and symbol-without-target_section.c.
+
+gdb/testsuite/
+2010-01-31  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/symbol-without-target_section.exp,
+	gdb.base/symbol-without-target_section.c: New.
+
+--- a/gdb/config/djgpp/fnchange.lst
++++ b/gdb/config/djgpp/fnchange.lst
+@@ -394,6 +394,8 @@
+ @V@/gdb/testsuite/gdb.base/solib-symbol-main.c @V@/gdb/testsuite/gdb.base/so-symmain.c
+ @V@/gdb/testsuite/gdb.base/solib-overlap-lib.c @V@/gdb/testsuite/gdb.base/so-ovrlib.c
+ @V@/gdb/testsuite/gdb.base/solib-overlap-main.c @V@/gdb/testsuite/gdb.base/so-ovrmain.c
++@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.exp @V@/gdb/testsuite/gdb.base/symnosec.exp
++@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.c @V@/gdb/testsuite/gdb.base/symnosec.c
+ @V@/gdb/testsuite/gdb.base/type-opaque-lib.c @V@/gdb/testsuite/gdb.base/ty-opqlib.c
+ @V@/gdb/testsuite/gdb.base/type-opaque-main.c @V@/gdb/testsuite/gdb.base/ty-opqmain.c
+ @V@/gdb/testsuite/gdb.base/watchpoint-hw.c @V@/gdb/testsuite/gdb.base/wp-hw.c
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -570,7 +570,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+ {
+   int arch_size, step, sect_size;
+   long dyn_tag;
+-  CORE_ADDR dyn_ptr;
++  CORE_ADDR dyn_ptr, dyn_addr;
+   gdb_byte *bufend, *bufstart, *buf;
+   Elf32_External_Dyn *x_dynp_32;
+   Elf64_External_Dyn *x_dynp_64;
+@@ -627,7 +627,17 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
+        target_section++)
+     if (sect == target_section->the_bfd_section)
+       break;
+-  gdb_assert (target_section < target_get_section_table (&exec_ops)->sections_end);
++  if (target_section < target_get_section_table (&exec_ops)->sections_end)
++    dyn_addr = target_section->addr;
++  else
++    {
++      /* ABFD may come from OBJFILE acting only as a symbol file without being
++	 loaded into the target (see add_symbol_file_command).  This case is
++	 such fallback to the file VMA address without the possibility of
++	 having the section relocated to its actual in-memory address.  */
++
++      dyn_addr = bfd_section_vma (abfd, sect);
++    }
+ 
+   /* Read in .dynamic from the BFD.  We will get the actual value
+      from memory later.  */
+@@ -639,7 +649,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+ 	     CORE_ADDR ptr_addr;
+ 
+ 	     ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+-	     ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8;
++	     ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
+ 	     if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
+ 	       dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
+ 	     *ptr = dyn_ptr;
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/symbol-without-target_section.c
+@@ -0,0 +1,18 @@
++/* 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 symbol_without_target_section;
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
+@@ -0,0 +1,39 @@
++# Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# Exploit formerly failed assertion in scan_dyntag when it got called for
++# objfile having ".dynamic" section but without having data loaded in target.
++# Such file is ${binmainfile} through add-symbol-file here.  Set context first
++# by "list main" to have some local BLOCK set in lookup_symbol_global.
++
++set testfile symbol-without-target_section
++set srclibfile ${testfile}.c
++set binlibfile ${testfile}.x
++set srcmainfile start.c
++set binmainfile ${testfile}
++if { [gdb_compile "${srcdir}/${subdir}/${srclibfile}" \
++		  "${objdir}/${subdir}/${binlibfile}" object {debug}] != "" } {
++    untested ${testfile}.exp
++    return -1
++}
++if {[build_executable ${testfile}.exp ${binmainfile} ${srcmainfile} {debug}] == -1} {
++    return -1
++}
++clean_restart ${binlibfile}
++
++gdb_test "add-symbol-file ${objdir}/${subdir}/${binmainfile} 0" "" "add-symbol-file" \
++	 "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
++gdb_test "list main"
++gdb_test "print symbol_without_target_section"
+
diff --git a/gdb-bz562517-archer-reread-quick_addrmap.patch b/gdb-bz562517-archer-reread-quick_addrmap.patch
new file mode 100644
index 0000000..2e0df7d
--- /dev/null
+++ b/gdb-bz562517-archer-reread-quick_addrmap.patch
@@ -0,0 +1,31 @@
+Fix was a part of merge of master:
+e421d7b026e77f4dc127de49c01e80d533eb6825
+
+--- ./gdb/symfile.c	2010-02-28 23:22:31.000000000 +0100
++++ ./gdb/symfile.c	2010-02-28 23:29:00.000000000 +0100
+@@ -3448,6 +3448,7 @@ reread_symbols (void)
+ 	      objfile->symtabs = NULL;
+ 	      objfile->psymtabs = NULL;
+ 	      objfile->psymtabs_addrmap = NULL;
++	      objfile->quick_addrmap = NULL;
+ 	      objfile->free_psymtabs = NULL;
+ 	      objfile->cp_namespace_symtab = NULL;
+ 	      objfile->msymbols = NULL;
+@@ -3458,6 +3459,8 @@ reread_symbols (void)
+ 	      memset (&objfile->msymbol_demangled_hash, 0,
+ 		      sizeof (objfile->msymbol_demangled_hash));
+ 
++	      objfile->flags &= ~OBJF_SYMTABS_READ;
++
+ 	      objfile->psymbol_cache = bcache_xmalloc ();
+ 	      objfile->macro_cache = bcache_xmalloc ();
+ 	      /* obstack_init also initializes the obstack so it is
+@@ -3502,8 +3505,6 @@ reread_symbols (void)
+ 		  wrap_here ("");
+ 		}
+ 
+-	      objfile->flags &= ~OBJF_SYMTABS_READ;
+-
+ 	      /* We're done reading the symbol file; finish off complaints.  */
+ 	      clear_complaints (&symfile_complaints, 0, 1);
+ 
diff --git a/gdb-empty-namespace.patch b/gdb-empty-namespace.patch
new file mode 100644
index 0000000..777d01a
--- /dev/null
+++ b/gdb-empty-namespace.patch
@@ -0,0 +1,204 @@
+gdb/
+2009-12-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix compatibility with G++-4.1.
+	* dwarf2read.c (partial_die_parent_scope): New variable PARENT_NAME.
+	Ignore parent namespaces with name "::".
+	(physname_prefix_1): Ignore namespaces with name "::".
+
+gdb/testsuite/
+2009-12-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.dwarf2/dw2-empty-namespace.exp, gdb.dwarf2/dw2-empty-namespace.S:
+	New.
+
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -2355,11 +2355,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
+       || parent->tag == DW_TAG_interface_type
+       || parent->tag == DW_TAG_union_type)
+     {
++      char *parent_name = parent->name;
++
++      /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::".  */
++      if (parent->tag == DW_TAG_namespace && parent_name != NULL
++          && strcmp (parent_name, "::") == 0)
++	parent_name = NULL;
++
+       if (grandparent_scope == NULL)
+-	parent->scope = parent->name;
++	parent->scope = parent_name;
+       else
+ 	parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope,
+-					 parent->name, cu);
++					 parent_name, cu);
+     }
+   else if (parent->tag == DW_TAG_enumeration_type)
+     /* Enumerators should not get the name of the enumeration as a prefix.  */
+@@ -9008,6 +9015,9 @@ physname_prefix_1 (struct ui_file *buf, struct die_info *die,
+ 	  name = dwarf2_name (die, cu);
+ 	  if (name == NULL)
+ 	    name = "(anonymous namespace)";
++	  /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::".  */
++	  else if (strcmp (name, "::") == 0)
++	    name = NULL;
+ 	  break;
+ 
+ 	case DW_TAG_class_type:
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
+@@ -0,0 +1,108 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++/* Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::".  */
++
++	.data
++var:	.4byte	1
++
++	.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	4				/* DW_LANG_C_plus_plus (C++) */
++
++.Ltype_int:
++	.uleb128	2			/* Abbrev: DW_TAG_base_type */
++	.ascii		"int\0"			/* DW_AT_name */
++	.byte		4			/* DW_AT_byte_size */
++	.byte		5			/* DW_AT_encoding */
++
++	.uleb128	3			/* Abbrev: DW_TAG_namespace */
++	.ascii		"::\0"			/* DW_AT_name */
++
++	.uleb128	7			/* Abbrev: DW_TAG_variable (location) */
++	.ascii		"var\0"			/* DW_AT_name */
++	.byte		2f - 1f			/* DW_AT_location */
++1:	.byte		3			/*   DW_OP_addr */
++	.4byte		var			/*   <addr> */
++2:	.4byte		.Ltype_int-.Lcu1_begin	/* DW_AT_type */
++
++	.byte		0			/* End of children of DW_TAG_namespace */
++
++	.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 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	2			/* 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 */
++
++	.uleb128	3			/* Abbrev code */
++	.uleb128	0x39			/* DW_TAG_namespace */
++	.byte		1			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.uleb128	7			/* Abbrev code (location) */
++	.uleb128	0x34			/* DW_TAG_variable */
++	.byte		0			/* has_children */
++	.uleb128	0x3			/* DW_AT_name */
++	.uleb128	0x8			/* DW_FORM_string */
++	.uleb128	0x2			/* DW_AT_location */
++	.uleb128	0xa			/* DW_FORM_block1 */
++	.uleb128	0x49			/* DW_AT_type */
++	.uleb128	0x13			/* DW_FORM_ref4 */
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
++
++	.byte		0x0			/* Terminator */
++	.byte		0x0			/* Terminator */
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp
+@@ -0,0 +1,43 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::".
++
++# 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-empty-namespace"
++set srcfile ${testfile}.S
++set executable ${testfile}.x
++
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
++    return -1
++}
++
++clean_restart $executable
++
++# `p var' below can work without identified DWARF DIE just based on its ELF symbol.
++# Catch it here as `type = <data variable, no debug info>'.
++gdb_test "ptype var" "type = int"
++
++gdb_test "p var" " = 1"
diff --git a/gdb-false-warning-gnu.liblist.patch b/gdb-false-warning-gnu.liblist.patch
new file mode 100644
index 0000000..59d7002
--- /dev/null
+++ b/gdb-false-warning-gnu.liblist.patch
@@ -0,0 +1,114 @@
+http://sourceware.org/ml/gdb-patches/2010-02/msg00713.html
+Subject: Re: [patch] Fix false warning: section .gnu.liblist not found in ...  [rediffed]
+
+Hi,
+
+only a technical rediff.
+
+------------------------------------------------------------------------------
+
+On Sat, 13 Feb 2010 23:49:29 +0100, Jan Kratochvil wrote:
+Hi,
+
+post-7.0 GDB started to print many false warnings on prelink-ed system:
+
+$ ./gdb -nx -ex r echo
+...
+Reading symbols from /bin/echo...Reading symbols from /usr/lib/debug/bin/echo.debug...
+warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
+warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
+done.
+done.
+Starting program: /bin/echo
+warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
+warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
+warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
+warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
+warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
+warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
+
+These sections are from prelink and they are not present in the *.debug files.
+
+It is formally a regression by:
+
+commit 3bfec189bb0fa1a2a44f1645dd68a9572e7a841c
+
+2010-01-07  Tristan Gingold  <gingold@adacore.com>
+
+	* symfile.c (build_section_addr_info_from_objfile): New function.
+	(symbol_file_add_separate): Don't use offsets from objfile but
+	built an addr info.
+
+
+But I think would be unavoidable even for the unification of PIC+PIE handling.
+
+Found no usable section flag differences for .gnu.liblist vs. for example
+.text so used just the section name for the exception.
+
+.gnu.liblist/.gnu.conflict related dumps:
+
+executable:
+Section Headers:
+  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
+  [ 6] .gnu.liblist      GNU_LIBLIST     00000000004006b8 0006b8 000028 14   A 28   0  4
+  [ 7] .gnu.conflict     RELA            00000000004006e0 0006e0 0001c8 18   A  5   0  8
+Program Headers:
+  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
+  LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x005254 0x005254 R E 0x200000
+Dynamic section at offset 0x52c8 contains 24 entries:
+  Tag        Type                         Name/Value
+ 0x000000006ffffef9 (GNU_LIBLIST)        0x4006b8
+ 0x000000006ffffdf7 (GNU_LIBLISTSZ)      40 (bytes)
+ 0x000000006ffffef8 (GNU_CONFLICT)       0x4006e0
+ 0x000000006ffffdf6 (GNU_CONFLICTSZ)     456 (bytes)
+
+library:
+Section Headers:
+  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
+  [74] .gnu.liblist      GNU_LIBLIST     0000000000000000 249940 000014 14     75   0  4
+
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+2010-03-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* symfile.c (addr_info_make_relative): New variable sect_name, use it.
+	Do not warn on ".gnu.liblist" and ".gnu.conflict".
+
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -597,7 +597,8 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
+ 
+   for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+     {
+-      asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
++      const char *sect_name = addrs->other[i].name;
++      asection *sect = bfd_get_section_by_name (abfd, sect_name);
+ 
+       if (sect)
+ 	{
+@@ -614,8 +615,16 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
+ 	}
+       else
+ 	{
+-	  warning (_("section %s not found in %s"), addrs->other[i].name,
+-		   bfd_get_filename (abfd));
++	  /* These two sections are intentionally loaded into memory from
++	     the DYNAMIC segment and so they have both SEC_ALLOC and SEC_LOAD
++	     set in the main executable (not in the library files).  They
++	     are not present in the separate debug info file, though.  */
++
++	  if (!(strcmp (sect_name, ".gnu.liblist") == 0
++		|| strcmp (sect_name, ".gnu.conflict") == 0))
++	    warning (_("section %s not found in %s"), sect_name,
++		     bfd_get_filename (abfd));
++
+ 	  addrs->other[i].addr = 0;
+ 
+ 	  /* SECTINDEX is invalid if ADDR is zero.  */
+
diff --git a/gdb-follow-child-stale-parent.patch b/gdb-follow-child-stale-parent.patch
new file mode 100644
index 0000000..79bb327
--- /dev/null
+++ b/gdb-follow-child-stale-parent.patch
@@ -0,0 +1,27 @@
+Problem occurs with python and its get_current_arch () as it selects
+selected_frame and current_frame while still inferior_ptid is valid for the
+original parent.  But since this place it is already attached and later
+unwinders try to access it, breaking:
+  -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
+  -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
+  -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
+  -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
+  -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
+  +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
+  +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
+  +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
+  +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
+  +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
+
+--- ./gdb/infrun.c	2009-12-21 20:26:30.000000000 +0100
++++ ./gdb/infrun.c	2009-12-21 20:26:11.000000000 +0100
+@@ -375,6 +375,9 @@ follow_fork (void)
+ 	  }
+ 	else
+ 	  {
++	    /* Possibly referenced PARENT is no longer valid.  */
++	    reinit_frame_cache ();
++
+ 	    /* This pending follow fork event is now handled, one way
+ 	       or another.  The previous selected thread may be gone
+ 	       from the lists by now, but if it is still around, need
diff --git a/gdb-ia64-infcall-workaround.patch b/gdb-ia64-infcall-workaround.patch
new file mode 100644
index 0000000..5e43b8a
--- /dev/null
+++ b/gdb-ia64-infcall-workaround.patch
@@ -0,0 +1,117 @@
+There was a regression by:
+
+Re: [rfc, v3] Fix frame_id_inner comparison false positives
+http://sourceware.org/ml/gdb-patches/2008-08/msg00578.html
+http://sourceware.org/ml/gdb-cvs/2008-08/msg00182.html
+916dde5d38b45a659514e47942ece70aec04cd78
+
+the part:
+	* stack.c (return_command): Directly pop the selected frame.
+
+Reproducible on:
+hp-diablo-01.rhts.eng.bos.redhat.com
+RHEL5.5-Server-20100216.nightly
+kernel-2.6.18-187.el5.ia64
+
+Not reproducible on:
+hp-bl860c-03.rhts.eng.bos.redhat.com
+RHEL-4.8
+kernel-2.6.9-89.EL.ia64
+
+To make ia64-tdep.c compilable +/- this stack.c check-in one must apply:
+
+Re: [RFC] Remove addr, endaddr, offset from obj_section
+http://sourceware.org/ml/gdb-patches/2008-09/msg00011.html
+http://sourceware.org/ml/gdb-cvs/2008-09/msg00009.html
+99072369ec3c8f94c9a596e5ce30bf1f1c4bf20e
+
+It is reproducible by:
+	gdb.base/call-signal-resume.exp
+although one must first remove the gdb_assert by:
+	gdb-infcall-sp-underflow.patch
+
+Reproducer:
+	set confirm no
+	set breakpoint pending on
+	set height 0
+	set width 0
+	# testcase from: gdb-6.8-37.el5.src
+	file gdb.base/call-signals
+	break stop_one
+	run
+	call gen_signal ()
+	bt
+	frame 3
+	return
+	p/x $sp
+	break stop_two
+	info break
+	p/x $pc
+	p/x $sp
+	bt
+	set debug infrun 1
+	delete 1
+	continue
+	bt
+	p/x $pc
+	echo Bug is reproduced if sp is now 0:\n
+	p/x $sp
+	kill
+	quit
+
+
+--- ./gdb/frame.c	2010-02-23 21:35:35.000000000 +0100
++++ ./gdb/frame.c	2010-02-23 21:46:34.000000000 +0100
+@@ -517,7 +517,7 @@ frame_id_eq (struct frame_id l, struct f
+    a stack overflow strategy that cause the handler to be run on a
+    different stack.  */
+ 
+-static int
++int
+ frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
+ {
+   int inner;
+--- ./gdb/frame.h	2009-09-13 18:28:28.000000000 +0200
++++ ./gdb/frame.h	2010-02-23 21:46:10.000000000 +0100
+@@ -708,4 +708,7 @@ extern struct frame_info *create_new_fra
+ extern int frame_unwinder_is (struct frame_info *fi,
+ 			      const struct frame_unwind *unwinder);
+ 
++extern int frame_id_inner (struct gdbarch *gdbarch, struct frame_id l,
++			   struct frame_id r);
++
+ #endif /* !defined (FRAME_H)  */
+--- ./gdb/stack.c	2010-02-23 21:35:34.000000000 +0100
++++ ./gdb/stack.c	2010-02-23 21:44:39.000000000 +0100
+@@ -1967,8 +1967,29 @@ If you continue, the return value that y
+ 	error (_("Not confirmed"));
+     }
+ 
+-  /* Discard the selected frame and all frames inner-to it.  */
+-  frame_pop (get_selected_frame (NULL));
++  /* NOTE: cagney/2003-01-18: Is this silly?  Rather than pop each
++     frame in turn, should this code just go straight to the relevant
++     frame and pop that?  */
++
++  /* First discard all frames inner-to the selected frame (making the
++     selected frame current).  */
++  {
++    struct frame_id selected_id = get_frame_id (get_selected_frame (NULL));
++    while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ())))
++      {
++	struct frame_info *frame = get_current_frame ();
++	if (frame_id_inner (get_frame_arch (frame), selected_id,
++			    get_frame_id (frame)))
++	  /* Caught in the safety net, oops!  We've gone way past the
++             selected frame.  */
++	  error (_("Problem while popping stack frames (corrupt stack?)"));
++	frame_pop (get_current_frame ());
++      }
++  }
++
++  /* Second discard the selected frame (which is now also the current
++     frame).  */
++  frame_pop (get_current_frame ());
+ 
+   /* Store RETURN_VALUE in the just-returned register set.  */
+   if (return_value != NULL)
diff --git a/gdb-infcall-sp-underflow.patch b/gdb-infcall-sp-underflow.patch
new file mode 100644
index 0000000..29f2bdf
--- /dev/null
+++ b/gdb-infcall-sp-underflow.patch
@@ -0,0 +1,81 @@
+http://sourceware.org/ml/gdb-patches/2010-02/msg00515.html
+Subject: [patch] infcall: Remove gdb_assert ($sp overflow)
+
+Hi,
+
+set $sp=0
+call something()
+->
+../../gdb/infcall.c:521: internal-error: call_function_by_hand: Assertion
+`(gdbarch_inner_than (gdbarch, 1, 2) && sp <= old_sp) || (gdbarch_inner_than
+(gdbarch, 2, 1) && sp >= old_sp)' failed.
+
+as $sp - frame == 0xffffsmth which is not lower than $sp.
+
+It must not be gdb_assert().  It can be an error() but I left it just to do:
+	(gdb) set $sp=0
+	(gdb) call doubleit (1)
+	Cannot access memory at address 0xffffffffffffff78
+	(gdb) set $sp=-1
+	(gdb) call doubleit (1)
+	Cannot access memory at address 0xffffffffffffff68
+
+Unaware how inconvenient is an intentional crash of the testcase on some
+embedded/non-MMU systems.
+No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-02-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp.
+	New comment.
+
+gdb/testsuite/
+2010-02-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/callfuncs.exp: New tests for $spval 0 and -1.  Remove return.
+
+--- a/gdb/infcall.c
++++ b/gdb/infcall.c
+@@ -518,10 +518,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
+ 	      /* Stack grows up.  */
+ 	      sp = gdbarch_frame_align (gdbarch, old_sp + 1);
+ 	  }
+-	gdb_assert ((gdbarch_inner_than (gdbarch, 1, 2)
+-		    && sp <= old_sp)
+-		    || (gdbarch_inner_than (gdbarch, 2, 1)
+-		       && sp >= old_sp));
++	/* SP may have overflown address zero here from OLD_SP.  Memory access
++	   functions will probably fail in such case but that is a target's
++	   problem.  */
+       }
+     else
+       /* FIXME: cagney/2002-09-18: Hey, you loose!
+--- a/gdb/testsuite/gdb.base/callfuncs.exp
++++ b/gdb/testsuite/gdb.base/callfuncs.exp
+@@ -469,5 +469,18 @@ if {$old_reg_content == $new_reg_content} then {
+     fail "nested call dummies preserve register contents"
+ }
+ 
+-return 0
++# GDB should not crash by internal error on $sp overflow during the inferior
++# call.  It is OK it will stop on some: Cannot access memory at address 0x$hex.
+ 
++foreach spval {0 -1} {
++    set old_ldprefix $pf_prefix
++    lappend pf_prefix "sp=$spval:"
++
++    gdb_test {set $old_sp = $sp}
++    gdb_test "set \$sp = $spval"
++
++    gdb_test "call doubleit (1)"
++
++    gdb_test {set $sp = $old_sp}
++    set pf_prefix $old_ldprefix
++}
+
diff --git a/gdb-orphanripper.c b/gdb-orphanripper.c
index 932f451..3af3d9b 100644
--- a/gdb-orphanripper.c
+++ b/gdb-orphanripper.c
@@ -276,12 +276,16 @@ static int spawn (char **argv, int timeout)
 
   assert (signal_chld_hit != 0);
 
+  /* Do not unset O_NONBLOCK as a stale child (the whole purpose of this
+     program) having open its output pty would block us in read_out.  */
+#if 0
   i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */);
   if (i != 0)
     {
       perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)");
       exit (EXIT_FAILURE);
     }
+#endif
 
   while (read_out (amaster));
 
diff --git a/gdb-ppc-hw-watchpoint-twice.patch b/gdb-ppc-hw-watchpoint-twice.patch
new file mode 100644
index 0000000..18e0074
--- /dev/null
+++ b/gdb-ppc-hw-watchpoint-twice.patch
@@ -0,0 +1,21 @@
+pcc regression from:
+http://sourceware.org/ml/gdb-patches/2008-12/msg00143.html
+
+gdb/
+2009-12-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* breakpoint.c (update_watchpoint): Set B->TYPE to bp_watchpoint before
+	calling hw_watchpoint_used_count.
+
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -1152,6 +1152,9 @@ update_watchpoint (struct breakpoint *b, int reparse)
+ 	  {
+ 	    int i, mem_cnt, other_type_used;
+ 
++	    /* Do not count with B twice below.  */
++	    b->type = bp_watchpoint;
++
+ 	    i = hw_watchpoint_used_count (bp_hardware_watchpoint,
+ 					  &other_type_used);
+ 	    mem_cnt = can_use_hardware_watchpoint (val_chain);
diff --git a/gdb-python-cplus-crash.patch b/gdb-python-cplus-crash.patch
new file mode 100644
index 0000000..9f29d15
--- /dev/null
+++ b/gdb-python-cplus-crash.patch
@@ -0,0 +1,14 @@
+--- gdb-7.0.1/gdb/python/py-type.c-orig	2010-01-14 00:00:29.000000000 +0100
++++ gdb-7.0.1/gdb/python/py-type.c	2010-01-14 00:14:26.000000000 +0100
+@@ -177,7 +177,10 @@ convert_field (struct type *type, int fi
+   if (PyObject_SetAttrString (result, "artificial", arg) < 0)
+     goto failarg;
+ 
+-  arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
++  if (TYPE_CODE (type) == TYPE_CODE_CLASS)
++    arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
++  else
++    arg = Py_False;
+   Py_INCREF (arg);
+   if (PyObject_SetAttrString (result, "is_base_class", arg) < 0)
+     goto failarg;
diff --git a/gdb-readline-6.0-signal.patch b/gdb-readline-6.0-signal.patch
new file mode 100644
index 0000000..c3b6601
--- /dev/null
+++ b/gdb-readline-6.0-signal.patch
@@ -0,0 +1,312 @@
+http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
+Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
+
+Hi Chet,
+
+FSF GDB currently ships bundled with readline-5.2 which works fine.
+But using --with-system-readline and readline-6.0-patchlevel4 has
+a regression:
+
+readline-5.2: Run `gdb -nx -q' and type CTRL-C:
+(gdb) Quit
+(gdb) _
+
+readline-6.0: Run `gdb -nx -q' and type CTRL-C:
+(gdb) _
+ = nothing happens (it gets buffered and executed later)
+	(It does also FAIL on gdb.gdb/selftest.exp.)
+
+It is because GDB waits in its own poll() mainloop and readline uses via
+rl_callback_handler_install and rl_callback_handler_remove.  This way the
+readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
+only stored to _rl_caught_signal but not executed.
+
+Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
+_rl_handle_signal is called then the signal is still stored to
+_rl_caught_signal.  In the _rl_interrupt_immediately case it should not be
+stored when it was already processed.
+
+rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
+of its meaning it breaks the nest-counting of other routines which do
+`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
+creating problematic `_rl_interrupt_immediately == -1'.
+
+`_rl_interrupt_immediately' is an internal variable, how it could be accessed
+by a readline application? (OK, maybe it should not be used.)
+
+Attaching a current GDB-side patch but it must access readline internal
+variable _rl_caught_signal and it is generally just a workaround.  Could you
+please include support for signals in this asynchronous mode in readline-6.1?
+I find it would be enough to make RL_CHECK_SIGNALS public?
+
+
+GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+But this is not a patch intended to be accepted.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* config.in, configure: Regenerate.
+	* configure.ac (for readline_echoing_p): Move inside $LIBS change.
+	(for _rl_caught_signal): New.
+	* event-loop.c: Include readline/readline.h.
+	(gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
+
+gdb/testsuite/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.gdb/selftest.exp (backtrace through signal handler): Move before
+	SIGINT pass, drop the timeout case.
+	(send SIGINT signal to child process): Use gdb_test.
+	(backtrace through readline handler): New.
+
+--- a/gdb/config.in
++++ b/gdb/config.in
+@@ -351,6 +351,9 @@
+ /* Define if Python interpreter is being linked in. */
+ #undef HAVE_PYTHON
+ 
++/* readline-6.0 workaround of blocked signals. */
++#undef HAVE_READLINE_CAUGHT_SIGNAL
++
+ /* Define to 1 if you have the `realpath' function. */
+ #undef HAVE_REALPATH
+ 
+--- a/gdb/configure.ac
++++ b/gdb/configure.ac
+@@ -539,17 +539,25 @@ if test "$with_system_readline" = yes; then
+   # readline-6.0 started to use the name `_rl_echoing_p'.
+   # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
+ 
+-  AC_MSG_CHECKING([for readline_echoing_p])
+   save_LIBS=$LIBS
+   LIBS="$LIBS $READLINE"
++  AC_MSG_CHECKING([for readline_echoing_p])
+   AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
+ 				    return readline_echoing_p;]]),
+ 		 [READLINE_ECHOING_P=yes],
+ 		 [READLINE_ECHOING_P=no
+ 		  AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
+ 			    [readline-6.0 started to use different name.])])
+-  LIBS="$save_LIBS"
+   AC_MSG_RESULT([$READLINE_ECHOING_P])
++  AC_MSG_CHECKING([for _rl_caught_signal])
++  AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
++				    return _rl_caught_signal;]]),
++		 [READLINE_CAUGHT_SIGNAL=yes
++		  AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
++			    [readline-6.0 workaround of blocked signals.])],
++		 [READLINE_CAUGHT_SIGNAL=no])
++  AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
++  LIBS="$save_LIBS"
+ else
+   READLINE='$(READLINE_DIR)/libreadline.a'
+   READLINE_DEPS='$(READLINE)'
+--- a/gdb/event-loop.c
++++ b/gdb/event-loop.c
+@@ -37,6 +37,7 @@
+ #include "exceptions.h"
+ #include "gdb_assert.h"
+ #include "gdb_select.h"
++#include "readline/readline.h"
+ 
+ /* Data point to pass to the event handler.  */
+ typedef union event_data
+@@ -411,6 +412,9 @@ gdb_do_one_event (void *data)
+   static int event_source_head = 0;
+   const int number_of_sources = 3;
+   int current = 0;
++#ifdef HAVE_READLINE_CAUGHT_SIGNAL
++  extern int volatile _rl_caught_signal;
++#endif
+ 
+   /* Any events already waiting in the queue?  */
+   if (process_event ())
+@@ -455,6 +459,16 @@ gdb_do_one_event (void *data)
+   if (gdb_wait_for_event (1) < 0)
+     return -1;
+ 
++#ifdef HAVE_READLINE_CAUGHT_SIGNAL
++  if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
++      && _rl_caught_signal)
++    {
++      /* Call RL_CHECK_SIGNALS this way.  */
++      rl_callback_handler_remove ();
++      rl_callback_handler_install (NULL, input_handler);
++    }
++#endif
++
+   /* Handle any new events occurred while waiting.  */
+   if (process_event ())
+     return 1;
+--- a/gdb/testsuite/gdb.gdb/selftest.exp
++++ b/gdb/testsuite/gdb.gdb/selftest.exp
+@@ -464,31 +464,42 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
+ 	    fail "$description (timeout)"
+ 	}
+     }
+-    
+-    set description "send SIGINT signal to child process"
+-    send_gdb "signal SIGINT\n"
+-    gdb_expect {
+-	-re "Continuing with signal SIGINT.*$gdb_prompt $" {
++
++    # get a stack trace with the poll function
++    #
++    # This fails on some linux systems for unknown reasons.  On the
++    # systems where it fails, sometimes it works fine when run manually.
++    # The testsuite failures may not be limited to just aout systems.
++    setup_xfail "i*86-pc-linuxaout-gnu"
++    set description "backtrace through signal handler"
++    gdb_test_multiple "backtrace" $description {
++	-re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+ 	    pass "$description"
+ 	}
+ 	-re ".*$gdb_prompt $" {
++	    # On the alpha, we hit the infamous problem about gdb
++	    # being unable to get the frame pointer (mentioned in
++	    # gdb/README).  As it is intermittent, there is no way to
++	    # XFAIL it which will give us an XPASS if the problem goes
++	    # away.
++	    setup_xfail "alpha*-*-osf*"
+ 	    fail "$description"
+ 	}
+-	timeout {
+-	    fail "$description (timeout)"
+-	}
+     }
+     
+-    # get a stack trace
++    gdb_test "signal SIGINT" "Continuing with signal SIGINT.*" \
++	     "send SIGINT signal to child process"
++    
++    # get a stack trace being redelivered by readline
+     #
+     # This fails on some linux systems for unknown reasons.  On the
+     # systems where it fails, sometimes it works fine when run manually.
+     # The testsuite failures may not be limited to just aout systems.
++    # Optional system readline may not have symbols to be shown.
+     setup_xfail "i*86-pc-linuxaout-gnu"
+-    set description "backtrace through signal handler"
+-    send_gdb "backtrace\n"
+-    gdb_expect {
+-	-re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
++    set description "backtrace through readline handler"
++    gdb_test_multiple "backtrace" $description {
++	-re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+ 	    pass "$description"
+ 	}
+ 	-re ".*$gdb_prompt $" {
+@@ -500,9 +510,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
+ 	    setup_xfail "alpha*-*-osf*"
+ 	    fail "$description"
+ 	}
+-	timeout {
+-	    fail "$description (timeout)"
+-	}
+     }
+ 
+ 
+--- gdb-7.0/gdb/configure	2009-12-07 18:53:30.000000000 +0100
++++ gdb-7.0-x/gdb/configure	2009-12-07 18:53:14.000000000 +0100
+@@ -9201,15 +9201,11 @@ if test "$with_system_readline" = yes; t
+   # readline-6.0 started to use the name `_rl_echoing_p'.
+   # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
+ 
+-  echo "$as_me:$LINENO: checking for readline_echoing_p" >&5
+-echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6
+   save_LIBS=$LIBS
+   LIBS="$LIBS $READLINE"
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
++$as_echo_n "checking for readline_echoing_p... " >&6; }
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+ int
+@@ -9221,45 +9217,45 @@ extern int readline_echoing_p;
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+-  (eval $ac_link) 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } &&
+-	 { ac_try='test -z "$ac_c_werror_flag"
+-			 || test ! -s conftest.err'
+-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+-  (eval $ac_try) 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; } &&
+-	 { ac_try='test -s conftest$ac_exeext'
+-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+-  (eval $ac_try) 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
++if ac_fn_c_try_link "$LINENO"; then :
+   READLINE_ECHOING_P=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++  READLINE_ECHOING_P=no
+ 
+-READLINE_ECHOING_P=no
++$as_echo "#define readline_echoing_p _rl_echoing_p" >>confdefs.h
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
++$as_echo "$READLINE_ECHOING_P" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
++$as_echo_n "checking for _rl_caught_signal... " >&6; }
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
+ 
+-cat >>confdefs.h <<\_ACEOF
+-#define readline_echoing_p _rl_echoing_p
++int
++main ()
++{
++extern int volatile _rl_caught_signal;
++				    return _rl_caught_signal;
++  ;
++  return 0;
++}
+ _ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  READLINE_CAUGHT_SIGNAL=yes
++
++$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
+ 
++else
++  READLINE_CAUGHT_SIGNAL=no
+ fi
+-rm -f conftest.err conftest.$ac_objext \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
++$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
+   LIBS="$save_LIBS"
+-  echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5
+-echo "${ECHO_T}$READLINE_ECHOING_P" >&6
+ else
+   READLINE='$(READLINE_DIR)/libreadline.a'
+   READLINE_DEPS='$(READLINE)'
diff --git a/gdb-rhel5-compat.patch b/gdb-rhel5-compat.patch
new file mode 100644
index 0000000..5216439
--- /dev/null
+++ b/gdb-rhel5-compat.patch
@@ -0,0 +1,65 @@
+gdb/linux-nat.c:
+- Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595).
+
+--- gdb-6.8/gdb-orig/symfile.c	2008-08-21 00:06:50.000000000 +0200
++++ gdb-6.8/gdb/symfile.c	2008-08-21 22:31:00.000000000 +0200
+@@ -1456,8 +1456,10 @@ find_separate_debug_file (struct objfile
+       /* Prevent looping on a stripped .debug file.  */
+       if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
+         {
++#if 0 /* RHEL-5 backward behavior compatibility.  */
+ 	  warning (_("\"%s\": separate debug info file has no debug info"),
+ 		   build_id_name);
++#endif
+ 	  xfree (build_id_name);
+ 	}
+       else if (build_id_name != NULL)
+--- ./gdb/corelow.c	2010-01-01 16:04:34.000000000 +0100
++++ ./gdb/corelow.c	2010-01-01 16:06:26.000000000 +0100
+@@ -277,7 +277,7 @@ add_to_thread_list (bfd *abfd, asection 
+     inferior_ptid = ptid;			 /* Yes, make it current */
+ }
+ 
+-static int build_id_core_loads = 1;
++static int build_id_core_loads = 0;
+ 
+ static void
+ build_id_locate_exec (int from_tty)
+--- ./gdb/symfile.c	2010-01-01 16:04:35.000000000 +0100
++++ ./gdb/symfile.c	2010-01-01 16:06:12.000000000 +0100
+@@ -1249,7 +1249,7 @@ symbol_file_clear (int from_tty)
+ #define BUILD_ID_VERBOSE_NONE 0
+ #define BUILD_ID_VERBOSE_FILENAMES 1
+ #define BUILD_ID_VERBOSE_BINARY_PARSE 2
+-static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES;
++static int build_id_verbose = BUILD_ID_VERBOSE_NONE;
+ static void
+ show_build_id_verbose (struct ui_file *file, int from_tty,
+ 		       struct cmd_list_element *c, const char *value)
+--- gdb-7.0-orig/gdb/linux-nat.c	2009-12-19 20:53:46.000000000 +0100
++++ gdb-7.0/gdb/linux-nat.c	2009-12-19 20:55:02.000000000 +0100
+@@ -1604,8 +1604,22 @@ GPT: lwp %s had signal %s, but it is in 
+ 	*status = lp->status;
+     }
+ 
+-  if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
+-    *status = W_STOPCODE (SIGSTOP);
++  /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
++     many TIDs are left unstopped).  See RH Bug 496732.  */
++  if (GET_PID (lp->ptid) == pid_was_stopped)
++    {
++      int err;
++
++      errno = 0;
++      err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
++      if (debug_linux_nat)
++	{
++	  fprintf_unfiltered (gdb_stdlog,
++			      "SC:  lwp kill %d %s\n",
++			      err,
++			      errno ? safe_strerror (errno) : "ERRNO-OK");
++	}
++    }
+ 
+   return 0;
+ }
diff --git a/gdb-rhel5-gcc44.patch b/gdb-rhel5-gcc44.patch
new file mode 100644
index 0000000..bd6fc2c
--- /dev/null
+++ b/gdb-rhel5-gcc44.patch
@@ -0,0 +1,405 @@
+Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as
+the default gcc and gfortran binaries are from gcc-4.1.
+
+--- gdb-7.0/gdb/testsuite/gdb.base/vla.exp-orig	2009-12-20 00:38:13.000000000 +0100
++++ gdb-7.0/gdb/testsuite/gdb.base/vla.exp	2009-12-20 00:54:19.000000000 +0100
+@@ -16,7 +16,25 @@
+ set testfile vla
+ set srcfile ${testfile}.c
+ set binfile ${objdir}/${subdir}/${testfile}
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++# Temporarily provide compiler=gcc44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists compiler] {
++    set old_compiler [board_info $board compiler]
++    unset_board_info compiler
++} elseif [info exists old_compiler] {
++    unset old_compiler
++}
++set_board_info compiler gcc44
++
++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug quiet}]
++
++unset_board_info compiler
++if [info exists old_compiler] {
++    set_board_info compiler $old_compiler
++}
++
++if  { $err != "" } {
+     untested "Couldn't compile test program"
+     return -1
+ }
+--- gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp-orig	2009-12-20 00:38:13.000000000 +0100
++++ gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp	2009-12-20 01:11:47.000000000 +0100
+@@ -31,10 +31,30 @@ if [get_compiler_info ${binfile_lib}] {
+     return -1
+ }
+ 
++# Temporarily provide compiler=gcc44 saving the original value around.
++# RHEL-5 workaround of its:
++#   gcc: -soname: linker input file unused because linking not done
++
++set board [target_info name]
++if [board_info $board exists compiler] {
++    set old_compiler [board_info $board compiler]
++    unset_board_info compiler
++} elseif [info exists old_compiler] {
++    unset old_compiler
++}
++set_board_info compiler gcc44
++
+ # Use -soname so that it is listed with " => " by ldd and this testcase makes
+ # a copy of ${binfile_lib} for each prelink variant.
+ 
+-if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} {
++set err [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]]
++
++unset_board_info compiler
++if [info exists old_compiler] {
++    set_board_info compiler $old_compiler
++}
++
++if { $err != "" } {
+     return -1
+ }
+ 
+@@ -483,9 +503,33 @@ foreach ldprelink {NO YES} {
+ 		    if {$binpie == "YES"} {
+ 			lappend opts {additional_flags=-fPIE -pie}
+ 		    }
+-		    if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
+-			continue;
++
++
++		    # Temporarily provide compiler=gcc44 saving the original value around.
++		    # RHEL-5 workaround of its:
++		    #   gcc: -rpath: linker input file unused because linking not done
++		    #   gcc: --dynamic-linker: linker input file unused because linking not done
++
++		    set board [target_info name]
++		    if [board_info $board exists compiler] {
++			set old_compiler [board_info $board compiler]
++			unset_board_info compiler
++		    } elseif [info exists old_compiler] {
++			unset old_compiler
++		    }
++		    set_board_info compiler gcc44
++
++		    set err [build_executable ${test}.exp [file tail $exec] $srcfile $opts]
++
++		    unset_board_info compiler
++		    if [info exists old_compiler] {
++			set_board_info compiler $old_compiler
+ 		    }
++
++		    if { $err == -1 } {
++			continue
++		    }
++
+ 		    if {$binsepdebug == "SEP"} {
+ 			gdb_gnu_strip_debug $exec
+ 			# Just a sanity check.  As gdb_gnu_strip_debug uses the
+--- ./gdb/testsuite/gdb.fortran/common-block.exp	2009-12-15 05:13:56.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/common-block.exp	2009-12-15 05:21:00.000000000 +0100
+@@ -20,7 +20,25 @@ set testfile "common-block"
+ set srcfile ${testfile}.f90
+ set binfile ${objdir}/${subdir}/${testfile}
+ 
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++}
++set_board_info f77compiler gfortran44
++
++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if  { $err != "" } {
+     untested "Couldn't compile ${srcfile}"
+     return -1
+ }
+--- ./gdb/testsuite/gdb.fortran/dwarf-stride.exp	2009-12-15 05:13:56.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/dwarf-stride.exp	2009-12-15 05:20:07.000000000 +0100
+@@ -27,7 +27,25 @@
+ set testfile dwarf-stride
+ set srcfile ${testfile}.f90
+ 
+-if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77}] } {
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler 
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++} 
++set_board_info f77compiler gfortran44
++
++set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if $err {
+     return -1
+ }
+ 
+--- ./gdb/testsuite/gdb.fortran/dynamic.exp	2009-12-15 05:13:56.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/dynamic.exp	2009-12-15 05:17:21.000000000 +0100
+@@ -25,7 +25,25 @@ set testfile "dynamic"
+ set srcfile ${testfile}.f90
+ set binfile ${objdir}/${subdir}/${testfile}
+ 
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++}
++set_board_info f77compiler gfortran44
++
++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if  { $err != "" } {
+     untested "Couldn't compile ${srcfile}"
+     return -1
+ }
+--- ./gdb/testsuite/gdb.fortran/library-module.exp	2009-12-15 05:13:56.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/library-module.exp	2009-12-15 05:22:37.000000000 +0100
+@@ -25,16 +25,34 @@ if [get_compiler_info not-used] {
+    return -1
+ }
+ 
+-if  { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}] != "" } {
+-    untested "Couldn't compile ${srclibfile}"
+-    return -1
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
+ }
++set_board_info f77compiler gfortran44
+ 
+ # prepare_for_testing cannot be used as linking with $libfile cannot be passed
+ # just for the linking phase (and not the source compilation phase).  And any
+ # warnings on ignored $libfile abort the process.
+ 
+-if  { [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}] != "" } {
++set err1 [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}]
++set err2 [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if  { $err1 != "" } {
++    untested "Couldn't compile ${srclibfile}"
++    return -1
++}
++if  { $err2 != "" } {
+     untested "Couldn't compile ${srcfile}"
+     return -1
+ }
+--- ./gdb/testsuite/gdb.fortran/module.exp	2009-12-15 05:13:56.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/module.exp	2009-12-15 05:28:49.000000000 +0100
+@@ -16,7 +16,25 @@
+ set testfile "module"
+ set srcfile ${testfile}.f90
+ 
+-if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } {
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++}
++set_board_info f77compiler gfortran44
++
++set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if $err {
+     return -1
+ }
+ 
+--- ./gdb/testsuite/gdb.fortran/string.exp	2009-12-15 05:13:56.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/string.exp	2009-12-15 05:18:13.000000000 +0100
+@@ -23,7 +23,25 @@ set testfile "string"
+ set srcfile ${testfile}.f90
+ set binfile ${objdir}/${subdir}/${testfile}
+ 
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++}
++set_board_info f77compiler gfortran44
++
++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if { $err != "" } {
+     untested "Couldn't compile ${srcfile}"
+     return -1
+ }
+--- gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp-orig	2009-12-20 09:47:04.000000000 +0100
++++ gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp	2009-12-20 09:50:06.000000000 +0100
+@@ -15,7 +15,26 @@
+ 
+ set testfile "omp-step"
+ set srcfile ${testfile}.f90
+-if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77 additional_flags=-fopenmp}] } {
++
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler 
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++} 
++set_board_info f77compiler gfortran44
++
++set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77 additional_flags=-fopenmp}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if $err {
+     return -1
+ }
+ 
+--- ./gdb/testsuite/gdb.fortran/derived-type.exp	2009-01-07 13:39:13.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/derived-type.exp	2009-12-20 12:37:12.000000000 +0100
+@@ -26,7 +26,25 @@ set testfile "derived-type"
+ set srcfile ${testfile}.f90
+ set binfile ${objdir}/${subdir}/${testfile}
+ 
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++}
++set_board_info f77compiler gfortran44
++
++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if { $err != "" } {
+     untested "Couldn't compile ${srcfile}"
+     return -1
+ }
+--- ./gdb/testsuite/gdb.fortran/subarray.exp	2009-01-07 13:39:13.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/subarray.exp	2009-12-20 12:38:00.000000000 +0100
+@@ -26,7 +26,25 @@ set testfile "subarray"
+ set srcfile ${testfile}.f
+ set binfile ${objdir}/${subdir}/${testfile}
+ 
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
++# Temporarily provide f77compiler=gfortran44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists f77compiler] {
++    set old_f77compiler [board_info $board f77compiler]
++    unset_board_info f77compiler
++} elseif [info exists old_f77compiler] {
++    unset old_f77compiler
++}
++set_board_info f77compiler gfortran44
++
++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
++
++unset_board_info f77compiler
++if [info exists old_f77compiler] {
++    set_board_info f77compiler $old_f77compiler
++}
++
++if { $err != "" } {
+     untested "Couldn't compile ${srcfile}"
+     return -1
+ }
+--- ./gdb/testsuite/gdb.threads/tls-sepdebug.exp	2009-12-20 12:22:18.000000000 +0100
++++ ./gdb/testsuite/gdb.threads/tls-sepdebug.exp	2009-12-20 12:39:53.000000000 +0100
+@@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi
+ 
+ # FIXME: gcc dependency (-Wl,-soname).
+ 
+-if  { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
++# Temporarily provide compiler=gcc44 saving the original value around.
++
++set board [target_info name]
++if [board_info $board exists compiler] {
++    set old_compiler [board_info $board compiler]
++    unset_board_info compiler
++} elseif [info exists old_compiler] {
++    unset old_compiler
++}
++set_board_info compiler gcc44
++
++set err [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]]
++
++unset_board_info compiler
++if [info exists old_compiler] {
++    set_board_info compiler $old_compiler
++}
++
++if { $err != "" } {
+     untested "Couldn't compile test library"
+     return -1
+ }
diff --git a/gdb-stabs-read_args.patch b/gdb-stabs-read_args.patch
new file mode 100644
index 0000000..c755374
--- /dev/null
+++ b/gdb-stabs-read_args.patch
@@ -0,0 +1,70 @@
+http://sourceware.org/ml/gdb-patches/2010-01/msg00142.html
+Subject: [patch] Fix crash reading broken stabs
+
+Hi,
+
+seen this stabs from unknown variant of gcc-4.1.2:
+
+1176586 LSYM   0      154    00000000 16682076 basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep:Tt(0,34)=s12!1,020,(0,35)=xs_Rep_base:;_S_max_size:/2(0,36)=k(0,30):_ZNSs4_Rep11_S_max_sizeE;_S_terminal:/2(0,22):_ZNSs4_Rep11_S_terminalE;_S_empty_rep_storage:/2(0,37)=ar(0,38)=r(0,38);0;037777777777;;0;3;(0,30):_ZNSs4_Rep20_S_empty_rep_storageE;_S_empty_rep::(0,39)=f(0,40)=&(0,34):_ZNSs4_Rep12_S_empty_repEv;2A?;_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);:_ZNKSs4_Rep12_M_is_leakedEv;2B.;_M_is_shared::(0,41):_ZNKSs4_Rep12_M_is_sharedEv;2B.;_M_set_leaked::(0,45)=#(0,34),(0,1),(0,33),(0,1);:_ZNSs4_Rep13_M_set_leakedEv;2A.;_M_set_sharable::(0,45):_ZNSs4_Rep15_M_set_sharableEv;2A.;_M_set_length_and_sharable::(0,46)=#(0,34),(0,1),(0,33),(0,25),(0,1);:_ZNSs4_Rep26_M_set_length_and_sharableEj;2A.;_M_refdata::(0,47)=#(0,34),(0,3),(0,33),(0,1);:_ZNSs4_Rep10_M_refdataEv;2A.;_M_grab::(0,48)=#(0,34),(0,3),(0,33),(0,5),(0,5),(0,1);:_ZNSs4_Rep7_M_grabERKSaIcES2_;2A.;_S_create::(0,49)=f(0,33):_ZNSs4_Rep9_S_createEjjRKSaIcE;2A?;_M_dispose::(0,50)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_disposeERKSaIcE;2A.;_M_destroy::(0,51)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_destroyERKSaIcE;2A.;_M_refcopy::(0,47):_ZNSs4_Rep10_M_refcopyEv;2A.;_M_clone::(0,52)=#(0,34),(0,3),(0,33),(0,5),(0,25),(0,1);:_ZNSs4_Rep8_M_cloneERKSaIcEj;2A.;;
+
+There is a GDB crash at:
+_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);
+                                           ^^
++ [...] Some broken stabs
++	 output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
++	 have been present ";-16,(0,43)" reference instead.  This way the
++	 excessive ";" marker prematurely stops the parameters parsing.  */
+
+Still I was unable to reproduce producing such STABS output.
+
+So this patch does not try to compensate the - presumably - buggy STABS output
+and parses such record incorrectly.  But it no longer crashes.
+
+No regressions on {x86_64-m32,i686}-fedora12-linux-gnu
+using --target_board unix/-gstabs+/-m32.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-01-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* stabsread.c (read_args): Handle zero arguments.
+
+gdb/testsuite/
+2010-01-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.stabs/weird.def (args93): New.
+
+--- a/gdb/stabsread.c
++++ b/gdb/stabsread.c
+@@ -4111,7 +4111,17 @@ read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
+     }
+   (*pp)++;			/* get past `end' (the ':' character) */
+ 
+-  if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
++  if (n == 0)
++    {
++      /* We should read at least the THIS parameter here.  Some broken stabs
++	 output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
++	 have been present ";-16,(0,43)" reference instead.  This way the
++	 excessive ";" marker prematurely stops the parameters parsing.  */
++
++      complaint (&symfile_complaints, _("Invalid (empty) method arguments"));
++      *varargsp = 0;
++    }
++  else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
+     *varargsp = 1;
+   else
+     {
+--- a/gdb/testsuite/gdb.stabs/weird.def
++++ b/gdb/testsuite/gdb.stabs/weird.def
+@@ -880,3 +880,6 @@ var3:
+ .stabs "sym92:\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
+ .stabs "type92:t92=\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
+ .stabs "attr92:G392=@\ !#$%&'()*+,-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~;1",N_GSYM,0,0, 0
++
++# See read_args "Invalid (empty) method arguments" error.
++.stabs "args93:G93=#(0,93),(0,93)=@s8;-16;,(0,93),(0,93);",N_GSYM,0,0,0
diff --git a/gdb-stale-related_breakpoint.patch b/gdb-stale-related_breakpoint.patch
new file mode 100644
index 0000000..496b71e
--- /dev/null
+++ b/gdb-stale-related_breakpoint.patch
@@ -0,0 +1,154 @@
+http://sourceware.org/ml/gdb-patches/2009-12/msg00364.html
+Subject: [patch] related_breakpoint stale ref crash fix
+
+Hi,
+
+getting occasional random:
+ PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint still triggers
+ PASS: gdb.threads/local-watch-wrong-thread.exp: let thread_function0 return
+ PASS: gdb.threads/local-watch-wrong-thread.exp: breakpoint on thread_function0's caller
+-PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
++ERROR: Process no longer exists
++UNRESOLVED: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
+
+It is even reproducible on HEAD using "input" file below and:
+	valgrind ../gdb -nx <input
+
+(gdb) (gdb) Breakpoint 6 at 0x400685: file ./gdb.threads/local-watch-wrong-thread.c, line 47.
+(gdb) ==31759== Invalid write of size 4
+==31759==    at 0x601A11: bpstat_check_breakpoint_conditions (breakpoint.c:3482)
+==31759==    by 0x601C70: bpstat_stop_status (breakpoint.c:3596)
+==31759==    by 0x65D228: handle_inferior_event (infrun.c:3589)
+==31759==    by 0x65A563: wait_for_inferior (infrun.c:2281)
+==31759==    by 0x659AA0: proceed (infrun.c:1883)
+==31759==    by 0x65300B: continue_1 (infcmd.c:668)
+==31759==    by 0x653282: continue_command (infcmd.c:760)
+==31759==    by 0x5C51D8: do_cfunc (cli-decode.c:67)
+==31759==    by 0x5C824F: cmd_func (cli-decode.c:1738)
+==31759==    by 0x48335A: execute_command (top.c:450)
+==31759==    by 0x67273E: command_handler (event-top.c:511)
+==31759==    by 0x672E53: command_line_handler (event-top.c:736)
+==31759==  Address 0xbbdc950 is 240 bytes inside a block of size 336 free'd
+==31759==    at 0x4A04D72: free (vg_replace_malloc.c:325)
+==31759==    by 0x486E4B: xfree (utils.c:1286)
+==31759==    by 0x60BC35: delete_breakpoint (breakpoint.c:8708)
+==31759==    by 0x60BDAF: delete_command (breakpoint.c:8765)
+==31759==    by 0x5C51D8: do_cfunc (cli-decode.c:67)
+==31759==    by 0x5C824F: cmd_func (cli-decode.c:1738)
+==31759==    by 0x48335A: execute_command (top.c:450)
+==31759==    by 0x67273E: command_handler (event-top.c:511)
+==31759==    by 0x672E53: command_line_handler (event-top.c:736)
+==31759==    by 0x672FCF: gdb_readline2 (event-top.c:817)
+==31759==    by 0x6725F7: stdin_event_handler (event-top.c:433)
+==31759==    by 0x670CDE: handle_file_event (event-loop.c:812)
+==31759== 
+
+Watchpoint 4 deleted because the program has left the block in
+which its expression is valid.
+
+
+There is already automatic deletion of RELATED_BREAKPOINT in
+map_breakpoint_numbers but "delete breakpoints" (for all the breakpoints)
+calls delete_breakpoint from delete_command directly without calling
+map_breakpoint_numbers and it does not delete the associated
+bp_watchpoint_scope.
+
+I find the attached patch is right for delete_breakpoint itself as such
+function should not leave stale references in the leftover data structures.
+How well could be other code cleaned up with this patch in place I have not
+targeted by this patch.
+
+
+The existing code expects accessibility of freed memory and discusses the
+current stale references problem:
+
+void
+delete_breakpoint (struct breakpoint *bpt)
+[...]
+  /* Has this bp already been deleted?  This can happen because multiple
+     lists can hold pointers to bp's.  bpstat lists are especial culprits.
+
+     One example of this happening is a watchpoint's scope bp.  When the
+     scope bp triggers, we notice that the watchpoint is out of scope, and
+     delete it.  We also delete its scope bp.  But the scope bp is marked
+     "auto-deleting", and is already on a bpstat.  That bpstat is then
+     checked for auto-deleting bp's, which are deleted.
+
+     A real solution to this problem might involve reference counts in bp's,
+     and/or giving them pointers back to their referencing bpstat's, and
+     teaching delete_breakpoint to only free a bp's storage when no more
+     references were extent.  A cheaper bandaid was chosen.  */
+  if (bpt->type == bp_none)
+    return;
+[...]
+  bpt->type = bp_none;
+
+  xfree (bpt);
+}
+
+
+While fixing this part may be difficult I find the attached patch easy enough
+fixing the IMO currently most common crash due to it.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+"input":
+set height 0
+set width 0
+set confirm no
+file ../testsuite/gdb.threads/local-watch-wrong-thread
+set can-use-hw-watchpoints 1
+break main
+run
+break local-watch-wrong-thread.c:36
+continue
+delete breakpoints
+watch *myp
+continue
+delete breakpoints
+echo MAKE watch\n
+watch *myp if trigger != 0
+echo MAKE break\n
+break local-watch-wrong-thread.c:60
+info break
+continue
+echo DELETE five\n
+delete 5
+set trigger=1
+continue
+set *myp=0
+break local-watch-wrong-thread.c:47
+continue
+
+
+
+2009-12-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* breakpoint.c (delete_breakpoint <bpt->related_breakpoint != NULL>):
+	New.
+
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -8649,6 +8649,16 @@ delete_breakpoint (struct breakpoint *bpt)
+   if (bpt->type == bp_none)
+     return;
+ 
++  /* At least avoid this stale reference until the reference counting of
++     breakpoints gets resolved.  */
++  if (bpt->related_breakpoint != NULL)
++    {
++      gdb_assert (bpt->related_breakpoint->related_breakpoint == bpt);
++      bpt->related_breakpoint->disposition = disp_del_at_next_stop;
++      bpt->related_breakpoint->related_breakpoint = NULL;
++      bpt->related_breakpoint = NULL;
++    }
++
+   observer_notify_breakpoint_deleted (bpt->number);
+ 
+   if (breakpoint_chain == bpt)
+
diff --git a/gdb-stale-sectindex.patch b/gdb-stale-sectindex.patch
new file mode 100644
index 0000000..04be2af
--- /dev/null
+++ b/gdb-stale-sectindex.patch
@@ -0,0 +1,112 @@
+http://sourceware.org/ml/gdb-patches/2010-02/msg00477.html
+Subject: Re: [patch] Fix crash on stale addrinfo->sectindex
+
+On Fri, 19 Feb 2010 04:01:05 +0100, Tom Tromey wrote:
+> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
+> I think you ought to move this comment as well.
+> It appears to just be hanging at the end of a block after the patch.
+
+Yes; forgot.
+
+> This is ok with that change.  Thanks.
+
+Checked-in.
+
+On Fri, 19 Feb 2010 04:10:30 +0100, Tom Tromey wrote:
+> Oh, by the way, I think this is reasonable for 7.1.  It is
+> straightforward and fixes a reported crash.  If Joel agrees, please put
+> it on the branch.  Thanks.
+
+OK for the branch?
+
+
+Thanks,
+Jan
+
+
+http://sourceware.org/ml/gdb-cvs/2010-02/msg00162.html
+
+### src/gdb/ChangeLog	2010/02/19 00:35:53	1.11380
+### src/gdb/ChangeLog	2010/02/19 06:19:44	1.11381
+## -1,3 +1,10 @@
++2010-02-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
++
++	* symfile.c (addr_info_make_relative): Extend comment.  Move SECT to
++	a more inner block.  Initialize ADDR by LOWER_OFFSET only if it was
++	found by bfd_get_section_by_name.
++	* symfile.h (struct section_addr_info) <sectindex>: New comment.
++
+ 2010-02-19  Joel Brobecker  <brobecker@adacore.com>
+ 
+ 	* NEWS: Add new "[...] since 7.1" section.  Rename the "[...] since
+--- src/gdb/symfile.c	2010/02/18 19:17:00	1.272
++++ src/gdb/symfile.c	2010/02/19 06:19:45	1.273
+@@ -562,13 +562,13 @@
+ }
+ 
+ /* Relativize absolute addresses in ADDRS into offsets based on ABFD.  Fill-in
+-   also SECTINDEXes there.  */
++   also SECTINDEXes specific to ABFD there.  This function can be used to
++   rebase ADDRS to start referencing different BFD than before.  */
+ 
+ void
+ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
+ {
+   asection *lower_sect;
+-  asection *sect;
+   CORE_ADDR lower_offset;
+   int i;
+ 
+@@ -597,25 +597,29 @@
+ 
+   for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+     {
+-      if (addrs->other[i].addr != 0)
++      asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
++
++      if (sect)
+ 	{
+-	  sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+-	  if (sect)
++	  /* This is the index used by BFD. */
++	  addrs->other[i].sectindex = sect->index;
++
++	  if (addrs->other[i].addr != 0)
+ 	    {
+ 	      addrs->other[i].addr -= bfd_section_vma (abfd, sect);
+ 	      lower_offset = addrs->other[i].addr;
+-	      /* This is the index used by BFD. */
+-	      addrs->other[i].sectindex = sect->index;
+ 	    }
+ 	  else
+-	    {
+-	      warning (_("section %s not found in %s"), addrs->other[i].name,
+-		       bfd_get_filename (abfd));
+-	      addrs->other[i].addr = 0;
+-	    }
++	    addrs->other[i].addr = lower_offset;
+ 	}
+       else
+-	addrs->other[i].addr = lower_offset;
++	{
++	  warning (_("section %s not found in %s"), addrs->other[i].name,
++		   bfd_get_filename (abfd));
++	  addrs->other[i].addr = 0;
++
++	  /* SECTINDEX is invalid if ADDR is zero.  */
++	}
+     }
+ }
+ 
+--- src/gdb/symfile.h	2010/02/03 14:13:16	1.64
++++ src/gdb/symfile.h	2010/02/19 06:19:45	1.65
+@@ -80,6 +80,8 @@
+   {
+     CORE_ADDR addr;
+     char *name;
++
++    /* SECTINDEX must be valid for associated BFD if ADDR is not zero.  */
+     int sectindex;
+   } other[1];
+ };
+
diff --git a/gdb-test-interrupt.exp-timeout.patch b/gdb-test-interrupt.exp-timeout.patch
new file mode 100644
index 0000000..6874567
--- /dev/null
+++ b/gdb-test-interrupt.exp-timeout.patch
@@ -0,0 +1,17 @@
+commit 03729380c318738d19256b219bcc03d333dc54bf
+Author: Daniel Jacobowitz <dan@debian.org>
+Date:   Mon Feb 1 17:51:18 2010 +0000
+
+[...]
+    	* gdb.base/interrupt.exp: Match unexpected gdb prompt.
+
+--- a/gdb/testsuite/gdb.base/interrupt.exp
++++ b/gdb/testsuite/gdb.base/interrupt.exp
+@@ -167,6 +167,7 @@ if ![file exists $binfile] then {
+         # here.
+ 	gdb_expect {
+ 	    -re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" }
++	    -re "Undefined command.*$gdb_prompt " { fail "echo data" }
+ 	    timeout { fail "echo data (timeout)" }
+ 	    eof { fail "echo data (eof)" }
+ 	}
diff --git a/gdb-testsuite-unknown-output.patch b/gdb-testsuite-unknown-output.patch
new file mode 100644
index 0000000..585192e
--- /dev/null
+++ b/gdb-testsuite-unknown-output.patch
@@ -0,0 +1,69 @@
+http://sourceware.org/ml/gdb-patches/2009-12/msg00473.html
+Subject: [patch] testsuite: false MI "unknown output after running" regression
+
+Hi,
+
+the attached patch will turn the results this way:
+-KFAIL: gdb.mi/mi-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
++KFAIL: gdb.mi/mi-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
+-XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (unknown output after running)
++XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (stopped at wrong place)
+-KFAIL: gdb.mi/mi2-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
++KFAIL: gdb.mi/mi2-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
+-XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (unknown output after running)
++XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (stopped at wrong place)
+
+This is a fix of KFAIL-kind regression due to:
+commit 26d086d741fb1bb0eee9d50e0bafa7c5e388023f
+Re: [RFA] fix *stopped for CLI commands
+http://sourceware.org/ml/gdb-patches/2009-02/msg00278.html
+http://sourceware.org/ml/gdb-cvs/2009-02/msg00084.html
+part:
+gdb/testsuite/
+2009-02-14  Vladimir Prus  <vladimir@codesourcery.com>
+	* lib/mi-support.exp (mi_expect_stop): Adjust the order of fields.
+	(mi_expect_interrupt): Likewise.
+	* gdb.mi/mi-cli.exp: Check that "step" results in proper *stopped
+	response.
+
+re-wdiff-ed for your convenience as:
+    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re"
+	-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}[-$any-]{+thread-id=\"$decimal\",stopped-threads=$any+}\r\n$prompt_re" {
+
+FYI there is: set any "\[^\n\]*"
+
+"stopped at wrong place" is the right kind of KFAIL/XFAIL (tested
+gcc-4.1.2-46.el5_4.1.x86_64 and gcc-4.4.2-20.fc12.x86_64) as discussed
+in PR gdb/2104.
+
+In the last case there is missing comma (,) after the former patch above.
+
+$after_stopped was IMO missing there even before.  It is in use only by
+gdb.mi/mi-simplerun.exp and gdb.mi/mi2-simplerun.exp.  Also fixed below.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/testsuite/
+2009-12-31  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* lib/mi-support.exp (mi_expect_stop <stopped at wrong place>): Insert
+	missing $after_stopped and comma (,) expectation.
+
+--- a/gdb/testsuite/lib/mi-support.exp
++++ b/gdb/testsuite/lib/mi-support.exp
+@@ -1038,7 +1038,7 @@ proc mi_expect_stop { reason func args file line extra test } {
+ 	    pass "$test"
+             return $expect_out(2,string)
+ 	}
+-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
++	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
+             verbose -log "got $expect_out(buffer)"
+ 	    fail "$test (stopped at wrong place)"
+ 	    return -1
+
diff --git a/gdb-watchpoint-cond-gone.patch b/gdb-watchpoint-cond-gone.patch
new file mode 100644
index 0000000..7d6611d
--- /dev/null
+++ b/gdb-watchpoint-cond-gone.patch
@@ -0,0 +1,231 @@
+http://sourceware.org/ml/gdb-patches/2009-12/msg00394.html
+Subject: [patch] Fix watchpoint-at-epilogue 7.0 regression (s390x)
+
+Hi,
+
+attached testcase regressed 6.8->7.0 on some s390x systems.
+
+At the moment PC is at epilogue (after frame pointer got destroyed and PC is
+still in the calleed function) we must not try any unwinding as it can try to
+unwind a garbage.
+
+Correct way would be to implement epilogue unwinder (such as
+amd64_epilogue_frame_unwind or i386_epilogue_frame_unwind ones) but it would
+not be so easy on s390x as it would need full prologue-analyzer: After SP gets
+restored there can be various instructions before the last jump - GDB needs to
+interpret the jump to find the register value where it is going to jump to.
+00000048279aa09c <round_and_return>:
+[...]
+  48279aa1b8: eb 6f f0 d0 00 04 lmg  %r6,%r15,208(%r15)
+  48279aa1be: 50 32 10 00       st   %r3,0(%r2,%r1)	# SP (%r15) is gone hone
+  48279aa1c2: b3 74 00 00       lzer %r0
+  48279aa1c6: 07 f4             br   %r4		# %r4 is the target
+[...]
+
+Just an easy fix is to be more careful and do not try any unwinding if we find
+PC is in the epilogue (previous instruction modifies SP=%r15).
+
+It is even a performance optimization and I see no regression risk there.
+
+The specific s390x error is:
+#0  throw_error (error=MEMORY_ERROR, fmt=0x8042676a "Cannot access memory at address %s") at exceptions.c:415
+#1  in memory_error (status=5, memaddr=0) at corefile.c:220
+#2  in read_memory (memaddr=0, myaddr=0x3ffffc7f7f0 "", len=8) at corefile.c:238
+#3  in read_memory_unsigned_integer (memaddr=0, len=8, byte_order=BFD_ENDIAN_BIG) at corefile.c:321
+#4  in s390_backchain_frame_unwind_cache (this_frame=0x80608958, info=0x80608a08) at s390-tdep.c:1525
+#5  in s390_frame_unwind_cache (this_frame=0x80608958, this_prologue_cache=0x80608970) at s390-tdep.c:1572
+#6  in s390_frame_this_id (this_frame=0x80608958, this_prologue_cache=0x80608970, this_id=0x806089b8) at s390-tdep.c:1583
+#7  in get_frame_id (fi=0x80608958) at frame.c:335
+#8  in frame_find_by_id (id={stack_addr = 4398044824952, code_addr = 2147484952, special_addr = 0, stack_addr_p = 1, code_addr_p = 1, special_addr_p = 0, inline_depth = 0}) at frame.c:587 
+#9  in watchpoint_check (p=0x8095bbc0) at breakpoint.c:3203
+#10 in catch_errors (func=0x801262c0 <watchpoint_check>, func_args=0x8095bbc0, errstring=0x80a26410 "Error evaluating expression for watchpoint 3\n", mask=6) at exceptions.c:510
+#11 in bpstat_check_watchpoint (bs=0x8095bbc0) at breakpoint.c:3404
+#12 in bpstat_stop_status (aspace=0x8061fcb0, bp_addr=2147485040, ptid={pid = 17372, lwp = 17372, tid = 0}) at breakpoint.c:3594
+#13 in handle_inferior_event (ecs=0x3ffffc80520) at infrun.c:3588
+
+I did not analyze why 6.8 did not error out, the GDB code is similar there.
+
+No regressions on:
+{x86_64,x86_64-m32,i686}-fedora12-linux-gnu (CVS HEAD GDB)
+s390x-rhel48-linux-gnu (CVS HEAD GDB)
+s390-rhel48-linux-gnu (CVS HEAD GDB)
+s390x-rhel54-linux-gnu (Fedora 12 GDB)
+s390-rhel54-linux-gnu (Fedora 12 GDB)
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-12-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* breakpoint.c (watchpoint_check): Check the call
+	gdbarch_in_function_epilogue_p before calling frame_find_by_id.
+	Extend the comment.
+
+gdb/testsuite/
+2009-12-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.base/watchpoint-cond-gone.exp, gdb.base/watchpoint-cond-gone.c,
+	gdb.base/watchpoint-cond-gone-stripped.c: New.
+
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -3200,6 +3200,17 @@ watchpoint_check (void *p)
+       struct gdbarch *frame_arch = get_frame_arch (frame);
+       CORE_ADDR frame_pc = get_frame_pc (frame);
+ 
++      /* in_function_epilogue_p() returns a non-zero value if we're still
++	 in the function but the stack frame has already been invalidated.
++	 Since we can't rely on the values of local variables after the
++	 stack has been destroyed, we are treating the watchpoint in that
++	 state as `not changed' without further checking.  Don't mark
++	 watchpoints as changed if the current frame is in an epilogue -
++	 even if they are in some other frame, our view of the stack
++	 is likely to be wrong and frame_find_by_id could error out.  */
++      if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
++	return WP_VALUE_NOT_CHANGED;
++
+       fr = frame_find_by_id (b->watchpoint_frame);
+       within_current_scope = (fr != NULL);
+ 
+@@ -3216,17 +3227,6 @@ watchpoint_check (void *p)
+ 	    within_current_scope = 0;
+ 	}
+ 
+-      /* in_function_epilogue_p() returns a non-zero value if we're still
+-	 in the function but the stack frame has already been invalidated.
+-	 Since we can't rely on the values of local variables after the
+-	 stack has been destroyed, we are treating the watchpoint in that
+-	 state as `not changed' without further checking.  Don't mark
+-	 watchpoints as changed if the current frame is in an epilogue -
+-	 even if they are in some other frame, our view of the stack
+-	 is likely to be wrong.  */
+-      if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
+-	return WP_VALUE_NOT_CHANGED;
+-
+       if (within_current_scope)
+ 	/* If we end up stopping, the current frame will get selected
+ 	   in normal_stop.  So this call to select_frame won't affect
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c
+@@ -0,0 +1,23 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2 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, write to the Free Software
++   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++
++void
++jumper (void (*jumpto) (void))
++{
++  (*jumpto) ();
++}
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.c
+@@ -0,0 +1,37 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2009 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2 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, write to the Free Software
++   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++
++extern void jumper (void (*jumpto) (void));
++
++static void
++func (void)
++{
++  volatile int c;
++
++  c = 5;
++  c = 10;	/* watchpoint-here */
++  c = 20;
++}
++
++int
++main (void)
++{
++  jumper (func);
++
++  return 0;
++}
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp
+@@ -0,0 +1,51 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++set testfile "watchpoint-cond-gone"
++set srcfile ${testfile}.c
++set srcfilestripped ${testfile}-stripped.c
++set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
++set binfile ${objdir}/${subdir}/${testfile}
++
++# We need to generate a function without DWARF to crash older GDB.
++# Stepping into a dynamic function trampoline or stepping out of MAIN may work
++# but it is not a reliable FAIL case.
++
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != ""
++      || [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
++    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++clean_restart ${testfile}
++
++# Problem does not occur otherwise.
++gdb_test "set can-use-hw-watchpoints 0"
++
++if ![runto_main] {
++    return -1
++}
++
++gdb_breakpoint [gdb_get_line_number "watchpoint-here"]
++gdb_continue_to_breakpoint "Place to set the watchpoint"
++
++# The condition `c == 30' is the subject being tested.
++gdb_test "watch c if c == 30" "" "Place the watchpoint"
++
++# We may stay either in the function itself or only at the first instruction of
++# its caller depending on the epilogue unwinder (or valid epilogue CFI) presence.
++gdb_test "finish" \
++	 "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \
++	 "Catch the no longer valid watchpoint"
+
diff --git a/gdb-x86_64-i386-syscall-restart.patch b/gdb-x86_64-i386-syscall-restart.patch
new file mode 100644
index 0000000..3e3474f
--- /dev/null
+++ b/gdb-x86_64-i386-syscall-restart.patch
@@ -0,0 +1,121 @@
+http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
+Subject: [patch] Fix syscall restarts for amd64->i386 biarch
+
+Hi,
+
+tested only on recent Linux kernels, it should apply also on vanilla ones.
+There were various changes of the kernels behavior in the past.
+
+FSF GDB HEAD state:
+kernel debugger inferior state
+x86_64 x86_64   x86_64   PASS
+x86_64 x86_64   i386     FAIL without this patch, PASS with this patch
+x86_64 i386     i386     PASS on recent kernels
+                         (FAIL: kernel-2.6.31.5-127.fc12.x86_64 - Fedora 12)
+                         (PASS: kernel-2.6.32-0.55.rc8.git1.fc13.x86_64)
+i386   i386     i386     PASS
+
+
+Currently gdb.base/interrupt.exp fails on amd64 host running under
+--target_board unix/-m32 with:
+	continue
+	Continuing.
+	Unknown error 512
+
+<linux/errno.h>:
+/*
+ * These should never be seen by user programs.  To return one of ERESTART*
+ * codes, signal_pending() MUST be set.  Note that ptrace can observe these
+ * at syscall exit tracing, but they will never be left for the debugged user
+ * process to see.
+ */
+#define ERESTARTSYS     512
+
+"Unknown error 512" printed above is printed by the inferior itself, not by GDB.
+
+It is because GDB reads it as 0xfffffffffffffe00 but writes it back as
+0xfffffe00.
++      /* Sign-extend %eax as during return from a syscall it is being checked
++	 for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
++	 interrupt.exp.  */
+
+
+Quote of Roland McGrath from IRC:
+
+roland: in the user_regset model, there are 64-bit user_regset flavors and
+32-bit user_regset flavors, so at the kabi level the (kernel) caller can say
+what it means: calls on the 32-bit user_regset flavor will behave as if on
+a 32-bit kernel/userland.  in ptrace, there is no way for x86_64 ptrace calls
+to say "i think of the inferior as being 32 bits, so act accordingly" (tho ppc
+and/or sparc have ptr
+roland: ace requests that do that iirc)
+roland: ergo 64-bit ptrace callers must either save/restore full 64-bits so
+the kernel's sign-extension choices are preserved, or else grok magic ways to
+expand stored 32-bit register contents to 64-bit values to stuff via 64-bit
+ptrace
+[...]
+roland: there is a "32-bit-flavored task", but it's not really true that it
+has 32-bit registers.  there is no 32-bit-only userland condition.  any task
+can always ljmp to the 64-bit code segment and run 64-bit insns including
+a 64-bit syscall
+roland: so a 64-bit debugger should see and be able to fiddle the full
+registers.  it can even change cs via ptrace to force the inferior into
+running 32 or 64 bit code.
+
+
+Saving whole 64bits for i386 targets on x86_64 hosts does not much match the
+GDB architecture as `struct type' for these registers still should be 32bit
+etc.   Therefore provided just this exception.
+
+The problem is reproducible only if one does an inferior call during the
+interruption to do full inferior save/restore from GDB regcache.
+
+Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* amd64-nat.c (amd64_collect_native_gregset): Do not pre-clear %eax.
+	Sign extend it afterwards.
+
+--- a/gdb/amd64-nat.c
++++ b/gdb/amd64-nat.c
+@@ -131,9 +131,9 @@ amd64_collect_native_gregset (const struct regcache *regcache,
+     {
+       num_regs = amd64_native_gregset32_num_regs;
+ 
+-      /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
++      /* Make sure %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
+          %eip get zero-extended to 64 bits.  */
+-      for (i = 0; i <= I386_EIP_REGNUM; i++)
++      for (i = I386_ECX_REGNUM; i <= I386_EIP_REGNUM; i++)
+ 	{
+ 	  if (regnum == -1 || regnum == i)
+ 	    memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8);
+@@ -159,4 +159,20 @@ amd64_collect_native_gregset (const struct regcache *regcache,
+ 	    regcache_raw_collect (regcache, i, regs + offset);
+ 	}
+     }
++
++  if (gdbarch_ptr_bit (gdbarch) == 32)
++    {
++      /* Sign-extend %eax as during return from a syscall it is being checked
++	 for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
++	 interrupt.exp.  */
++
++      int i = I386_EAX_REGNUM;
++
++      if (regnum == -1 || regnum == i)
++	{
++	  void *ptr = regs + amd64_native_gregset_reg_offset (gdbarch, i);
++
++	  *(int64_t *) ptr = *(int32_t *) ptr;
++	}
++    }
+ }
+
diff --git a/gdb.changes b/gdb.changes
index bf6ef40..3ace5b2 100644
--- a/gdb.changes
+++ b/gdb.changes
@@ -1,3 +1,28 @@
+-------------------------------------------------------------------
+Thu Mar 11 15:45:22 CET 2010 - rguenther@novell.com
+
+- Merge from gdb-7.0.1-33.fc12.src.rpm.
+
+-------------------------------------------------------------------
+Thu Feb 11 13:43:11 CET 2010 - kukuk@suse.de
+
+- Re-Add baselibs.conf
+
+-------------------------------------------------------------------
+Fri Jan 15 16:18:42 CET 2010 - rguenther@suse.de
+
+- Drop some more strange RHEL stuff.
+
+-------------------------------------------------------------------
+Mon Jan 11 11:39:20 CET 2010 - rguenther@suse.de
+
+- Merge from gdb-7.0.1-19.fc12.src.rpm.
+
+-------------------------------------------------------------------
+Fri Nov 20 16:16:32 CET 2009 - rguenther@suse.de
+
+- Fix build for SLE10.
+
 -------------------------------------------------------------------
 Mon Oct 26 17:27:34 CET 2009 - rguenther@suse.de
 
diff --git a/gdb.spec b/gdb.spec
index dd8b5e2..f39c032 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -1,7 +1,7 @@
 #
-# spec file for package gdb (Version 7.0)
+# spec file for package gdb (Version 7.0.1)
 #
-# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,259 +19,446 @@
 Summary:        A GNU source-level debugger for C, C++, Java and other languages
 
 Name:           gdb
+
 # Set version to contents of gdb/version.in.
-# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3 
+# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
 # and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
-Version:        7.0
+Version:        7.0.1
 Release:        1
+
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
+
 License:        GPLv3+
 Group:          Development/Debuggers
-Source:         ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2
+# ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2
+# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
+Source:         ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Url:            http://gnu.org/software/gdb/
+
 # For our convenience
 %define gdb_src gdb-%{version}
 %define gdb_build build-%{_target_platform}
+
 %if 0%{?_with_debug:1}
 # Define this if you want to skip the strip step and preserve debug info.
 # Useful for testing.
 %define __debug_install_post : > %{_builddir}/%{?buildsubdir}/debugfiles.list
 %define debug_package %{nil}
 %endif
+
 # Make sure we get rid of the old package gdb64, now that we have unified
 # support for 32-64 bits in one single 64-bit gdb.
 %ifarch ppc64
 Obsoletes:      gdb64 < 5.3.91
 %endif
+
 # 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).
+
 # Cleanup any leftover testsuite processes as it may stuck mock(1) builds.
 Source2:        gdb-orphanripper.c
+
 # Man page for gstack(1).
 Source3:        gdb-gstack.man
+
 # libstdc++ pretty printers from GCC SVN HEAD (4.5 experimental).
 %define libstdcxxpython libstdc++-v3-python-r151798
 Source4:        %{libstdcxxpython}.tar.bz2
+
 # Work around out-of-date dejagnu that does not have KFAIL
 Patch1:         gdb-6.3-rh-dummykfail-20041202.patch
+
 # Match the Fedora's version info.
 Patch2:         gdb-6.3-rh-testversion-20041202.patch
+
 # Check that libunwind works - new test then fix
 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.
 Patch104:       gdb-6.3-ppcdotsolib-20041022.patch
+
 # Better parse 64-bit PPC system call prologues.
 Patch105:       gdb-6.3-ppc64syscall-20040622.patch
+
 # Stop a backtrace when a zero PC is encountered.
 Patch106:       gdb-6.3-framepczero-20040927.patch
+
 # Include the pc's section when doing a symbol lookup so that the
 # correct symbol is found.
 Patch111:       gdb-6.3-ppc64displaysymbol-20041124.patch
+
 # Fix upstream `set scheduler-locking step' vs. upstream PPC atomic seqs.
 Patch112:       gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
 # Make upstream `set scheduler-locking step' as default.
 Patch260:       gdb-6.6-scheduler_locking-step-is-default.patch
+
 # Add a wrapper script to GDB that implements pstack using the
 # --readnever option.
 Patch118:       gdb-6.3-gstack-20050411.patch
+
 # VSYSCALL and PIE
 Patch122:       gdb-6.3-test-pie-20050107.patch
-Patch124:       gdb-6.3-pie-20050110.patch
+Patch124:       gdb-archer-pie.patch
+Patch389:       gdb-archer-pie-addons.patch
+Patch394:       gdb-archer-pie-addons-keep-disabled.patch
+
 # Get selftest working with sep-debug-info
 Patch125:       gdb-6.3-test-self-20050110.patch
-# Fix for non-threaded watchpoints.
-Patch128:       gdb-6.3-nonthreaded-wp-20050117.patch
+
 # Test support of multiple destructors just like multiple constructors
 Patch133:       gdb-6.3-test-dtorfix-20050121.patch
+
 # Fix to support executable moving
 Patch136:       gdb-6.3-test-movedir-20050125.patch
+
 # Fix gcore for threads
 Patch140:       gdb-6.3-gcore-thread-20050204.patch
+
 # Stop while intentionally stepping and the thread exit is met.
 Patch141:       gdb-6.6-step-thread-exit.patch
 Patch259:       gdb-6.3-step-thread-exit-20050211-test.patch
+
 # Prevent gdb from being pushed into background
 Patch142:       gdb-6.3-terminal-fix-20050214.patch
+
 # Test sibling threads to set threaded watchpoints for x86 and x86-64
 Patch145:       gdb-6.3-threaded-watchpoints2-20050225.patch
+
 # Fix printing of inherited members
 Patch148:       gdb-6.3-inheritance-20050324.patch
+
 # Do not issue warning message about first page of storage for ia64 gcore
 Patch153:       gdb-6.3-ia64-gcore-page0-20050421.patch
+
 # Security errata for untrusted .gdbinit
 Patch157:       gdb-6.3-security-errata-20050610.patch
+
 # IA64 sigtramp prev register patch
 Patch158:       gdb-6.3-ia64-sigtramp-frame-20050708.patch
+
 # IA64 gcore speed-up patch
 Patch160:       gdb-6.3-ia64-gcore-speedup-20050714.patch
+
 # Notify observers that the inferior has been created
 Patch161:       gdb-6.3-inferior-notification-20050721.patch
+
 # Fix ia64 info frame bug
 Patch162:       gdb-6.3-ia64-info-frame-fix-20050725.patch
+
 # Verify printing of inherited members test
 Patch163:       gdb-6.3-inheritancetest-20050726.patch
+
 # Add readnever option
 Patch164:       gdb-6.3-readnever-20050907.patch
+
 # Fix ia64 gdb problem with user-specified SIGILL handling
 Patch169:       gdb-6.3-ia64-sigill-20051115.patch
+
 # Allow option to continue backtracing past a zero pc value
 Patch170:       gdb-6.3-bt-past-zero-20051201.patch
+
 # Use bigger numbers than int.
 Patch176:       gdb-6.3-large-core-20051206.patch
+
 # Hard-code executable names in gstack, such that it can run with a
 # corrupted or missing PATH.
 Patch177:       gdb-6.3-gstack-without-path-20060414.patch
+
 # Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
 Patch188:       gdb-6.5-bz203661-emit-relocs.patch
+
 # Security patch: avoid stack overflows in dwarf expression computation.
 # CVE-2006-4146
 Patch190:       gdb-6.5-dwarf-stack-overflow.patch
+
 # Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
 Patch194:       gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
+
 # Fix TLS symbols resolving for objects with separate .debug file (-debuginfo).
 Patch195:       gdb-6.5-tls-of-separate-debuginfo.patch
+
 # Fix TLS symbols resolving for shared libraries with a relative pathname.
 # The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
 Patch196:       gdb-6.5-sharedlibrary-path.patch
+
 # Suggest fixing your target architecture for gdbserver(1) (BZ 190810).
 # FIXME: It could be autodetected.
 Patch199:       gdb-6.5-bz190810-gdbserver-arch-advice.patch
+
 # Fix `gcore' command for 32bit inferiors on 64bit hosts.
 Patch201:       gdb-6.5-gcore-i386-on-amd64.patch
+
 # Testcase for deadlocking on last address space byte; for corrupted backtraces.
 Patch211:       gdb-6.5-last-address-space-byte-test.patch
+
 # Improved testsuite results by the testsuite provided by the courtesy of BEA.
 Patch208:       gdb-6.5-BEA-testsuite.patch
+
 # Fix readline segfault on excessively long hand-typed lines.
 Patch209:       gdb-6.5-readline-long-line-crash.patch
 Patch213:       gdb-6.5-readline-long-line-crash-test.patch
+
 # Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
 Patch214:       gdb-6.5-bz216711-clone-is-outermost.patch
+
 # Try to reduce sideeffects of skipping ppc .so libs trampolines (BZ 218379).
 Patch215:       gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
 Patch216:       gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
+
 # Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
 Patch217:       gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
+
 # Find symbols properly at their original (included) file (BZ 109921).
 Patch225:       gdb-6.5-bz109921-DW_AT_decl_file-test.patch
+
 # Update PPC unwinding patches to their upstream variants (BZ 140532).
 Patch229:       gdb-6.3-bz140532-ppc-unwinding-test.patch
+
 # Testcase for exec() from threaded program (BZ 202689).
 Patch231:       gdb-6.3-bz202689-exec-from-pthread-test.patch
-# Backported post gdb-6.8.50.20090991 snapshot fixups.
-#Patch232: gdb-6.8.50.20090921-upstream.patch
+
+# Backported post gdb-7.0 fixups.
+Patch232:       gdb-7.0-upstream.patch
+
 # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
 Patch234:       gdb-6.6-bz230000-power6-disassembly-test.patch
+
 # Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832)
 Patch235:       gdb-6.3-bz231832-obstack-2gb.patch
+
 # Fix prelink(8) testcase for non-root $PATH missing `/usr/sbin' (BZ 225783).
 Patch240:       gdb-6.6-bz225783-prelink-path.patch
+
 # Fix debugging GDB itself - the compiled in source files paths (BZ 225783).
 Patch241:       gdb-6.6-bz225783-gdb-debuginfo-paths.patch
+
 # Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
 Patch245:       gdb-6.6-bz229517-gcore-without-terminal.patch
+
 # Notify user of a child forked process being detached (BZ 235197).
 Patch247:       gdb-6.6-bz235197-fork-detach-info.patch
+
 # New testcase for gcore of 32bit inferiors on 64bit hosts.
 Patch249:       gdb-6.6-gcore32-test.patch
+
 # Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
 Patch254:       gdb-6.6-testsuite-timeouts.patch
+
 # Support for stepping over PPC atomic instruction sequences (BZ 237572).
 Patch258:       gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
+
 # Link with libreadline provided by the operating system.
 Patch261:       gdb-6.6-readline-system.patch
+
 # Test kernel VDSO decoding while attaching to an i386 process.
 Patch263:       gdb-6.3-attach-see-vdso-test.patch
+
 # Do not hang on exit of a thread group leader (BZ 247354).
 Patch265:       gdb-6.6-bz247354-leader-exit-fix.patch
 Patch266:       gdb-6.6-bz247354-leader-exit-test.patch
+
 # Test leftover zombie process (BZ 243845).
 Patch271:       gdb-6.5-bz243845-stale-testing-zombie-test.patch
+
 # New locating of the matching binaries from the pure core file (build-id).
 Patch274:       gdb-6.6-buildid-locate.patch
 Patch353:       gdb-6.6-buildid-locate-rpm.patch
+
 # Fix displaying of numeric char arrays as strings (BZ 224128).
 Patch282:       gdb-6.7-charsign-test.patch
+
 # Test PPC hiding of call-volatile parameter register.
 Patch284:       gdb-6.7-ppc-clobbered-registers-O2-test.patch
+
 # Testsuite fixes for more stable/comparable results.
 Patch287:       gdb-6.7-testsuite-stable-results.patch
+
 # Test ia64 memory leaks of the code using libunwind.
 Patch289:       gdb-6.5-ia64-libunwind-leak-test.patch
+
 # Test hiding unexpected breakpoints on intentional step commands.
 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).
 Patch293:       gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch
 Patch294:       gdb-6.7-bz426600-DW_TAG_interface_type-test.patch
+
 # Test gcore memory and time requirements for large inferiors.
 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.
 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.
 Patch304:       gdb-6.7-kernel-headers-compat.patch
+
 # Test GCORE for shmid 0 shared memory mappings.
 Patch309:       gdb-6.3-mapping-zero-inode-test.patch
+
 # Test a crash on `focus cmd', `focus prev' commands.
 Patch311:       gdb-6.3-focus-cmd-prev-test.patch
-# Test crash on a sw watchpoint condition getting out of the scope.
-Patch314:       gdb-6.3-watchpoint-cond-gone-test.patch
+
+# Fix error on a sw watchpoint active at function epilogue (hit on s390x).
+Patch314:       gdb-watchpoint-cond-gone.patch
+
 # Test various forms of threads tracking across exec() (BZ 442765).
 Patch315:       gdb-6.8-bz442765-threaded-exec-test.patch
+
 # Silence memcpy check which returns false positive (sparc64)
 Patch317:       gdb-6.8-sparc64-silence-memcpy-check.patch
+
 # Fix memory trashing on binaries from GCC Ada (workaround GCC PR 35998).
 Patch318:       gdb-6.8-gcc35998-ada-memory-trash.patch
+
 # Test a crash on libraries missing the .text section.
 Patch320:       gdb-6.5-section-num-fixup-test.patch
+
 # Refuse creating watchpoints of an address value, suggested by Martin Stransky.
 Patch322:       gdb-6.8-constant-watchpoints.patch
+
 # Fix compatibility with recent glibc headers.
 Patch324:       gdb-6.8-glibc-headers-compat.patch
+
 # Create a single binary `gdb' autodetecting --tui by its argv[0].
 Patch326:       gdb-6.8-tui-singlebinary.patch
+
 # Support transparent debugging of inlined functions for an optimized code.
+# Disable break-by-name on inlined functions due to a regression on parameters
+# of inlined functions falsely <optimized out> (BZ 556975 Comment 8).
+# Disable addon (finish) due to inline-cmds.exp: up from outer_inline2 assert.
 Patch350:       gdb-6.8-inlining-addon.patch
 Patch328:       gdb-6.8-inlining-by-name.patch
+
 # Fix PRPSINFO in the core files dumped by gcore (BZ 254229).
 Patch329:       gdb-6.8-bz254229-gcore-prpsinfo.patch
+
 # Fix register assignments with no GDB stack frames (BZ 436037).
 Patch330:       gdb-6.8-bz436037-reg-no-longer-active.patch
+
 # Make the GDB quit processing non-abortable to cleanup everything properly.
 Patch331:       gdb-6.8-quit-never-aborts.patch
+
 # Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs.
 Patch332:       gdb-6.8-fortran-tag-constant.patch
+
 # Fix attaching to stopped processes and/or pending signals.
 Patch337:       gdb-6.8-attach-signalled-detach-stopped.patch
+
 # Test the watchpoints conditionals works.
 Patch343:       gdb-6.8-watchpoint-conditionals-test.patch
+
 # Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
 Patch348:       gdb-6.8-bz466901-backtrace-full-prelinked.patch
+
 # The merged branch `archer' of: http://sourceware.org/gdb/wiki/ProjectArcher
 Patch349:       gdb-archer.patch
+Patch418:       gdb-archer-excessive-files.patch
+Patch420:       gdb-archer-ada.patch
+
 # Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187).
 # - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE.
 Patch352:       gdb-6.8-bz457187-largefile.patch
 Patch360:       gdb-6.8-bz457187-largefile-test.patch
+
 # Fix compatibility of --with-system-readline and readline-6.0+.
 Patch375:       gdb-readline-6.0.patch
+
 # Fix python pretty printers lookup on x86_64.
 Patch376:       libstdc++-v3-python-common-prefix.patch
+
 # New test for step-resume breakpoint placed in multiple threads at once.
 Patch381:       gdb-simultaneous-step-resume-breakpoint-test.patch
+
 # Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
 Patch382:       gdb-core-open-vdso-warning.patch
+
 # Support multiple directories for `set debug-file-directory' (BZ 528668).
 Patch383:       gdb-bz528668-symfile-sepcrc.patch
 Patch384:       gdb-bz528668-symfile-cleanup.patch
 Patch385:       gdb-bz528668-symfile-multi.patch
+
+# Support GNU IFUNCs - indirect functions (BZ 539590).
+Patch387:       gdb-bz539590-gnu-ifunc.patch
+
+# Fix bp conditionals [bp_location-accel] regression (BZ 538626).
+Patch388:       gdb-bz538626-bp_location-accel-bp-cond.patch
+
+# Fix callback-mode readline-6.0 regression for CTRL-C.
+Patch390:       gdb-readline-6.0-signal.patch
+
+# Fix syscall restarts for amd64->i386 biarch.
+Patch391:       gdb-x86_64-i386-syscall-restart.patch
+
+# Fix stepping with OMP parallel Fortran sections (BZ 533176).
+Patch392:       gdb-bz533176-fortran-omp-step.patch
+
+# Use gfortran44 when running the testsuite on RHEL-5.
+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).
+Patch335:       gdb-rhel5-compat.patch
+
+# Fix backward compatibility with G++ 4.1 namespaces "::".
+Patch395:       gdb-empty-namespace.patch
+
+# Fix regression on re-setting the single ppc watchpoint slot.
+Patch396:       gdb-ppc-hw-watchpoint-twice.patch
+
+# Fix regression by python on ia64 due to stale current frame.
+Patch397:       gdb-follow-child-stale-parent.patch
+
+# testsuite: Fix false MI "unknown output after running" regression.
+Patch398:       gdb-testsuite-unknown-output.patch
+
+# Fix regression of gdb-7.0.1 not preserving typedef of a field.
+Patch399:       gdb-bitfield-check_typedef.patch
+
+# Fix related_breakpoint stale ref crash.
+Patch400:       gdb-stale-related_breakpoint.patch
+
+# Fix crash reading broken stabs (it377671).
+Patch401:       gdb-stabs-read_args.patch
+
+# Fix crash while executing python code.
+Patch402:       gdb-python-cplus-crash.patch
+
+# Fix failed gdb_assert due to the PIE patchset (BZ 559414).
+Patch414:       gdb-bz559414-pie-assert-fix.patch
+
+# Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ 559291).
+Patch416:       gdb-bz559291-fortran-module-toplevel.patch
+
+# Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
+Patch417:       gdb-bz541866-rwatch-before-run.patch
+
+# testsuite: Fix long timeout on arches with failing gdb.base/interrupt.exp.
+Patch419:       gdb-test-interrupt.exp-timeout.patch
+
+# Fix crash on stale addrinfo->sectindex (more sensitive due to the PIE patch).
+Patch421:       gdb-stale-sectindex.patch
+
+# Remove false gdb_assert on $sp underflow.
+Patch422:       gdb-infcall-sp-underflow.patch
+
+# Workaround ia64 inferior calls clearing SP.
+Patch423:       gdb-ia64-infcall-workaround.patch
+
+# [delayed-symfile] Backport fix of reread_symbols (Tom Tromey, BZ 562517).
+Patch424:       gdb-bz562517-archer-reread-quick_addrmap.patch
+
+# Fix false warning: section .gnu.liblist not found in ...
+Patch425:       gdb-false-warning-gnu.liblist.patch
+
 # Fix readline 5.1 warnings
 Patch1000:      readline-5.1-random.patch
 Patch1002:      gdb-6.6-buildid-locate-rpm-suse.patch
 Patch1007:      fix-gdb-backtrace.diff
+
 BuildRequires:  bison flex gettext glibc-devel ncurses-devel texinfo zlib-devel
 %if %{suse_version} < 1020
 BuildRequires:  expat
@@ -279,41 +466,50 @@ BuildRequires:  expat
 BuildRequires:  libexpat-devel
 %endif
 BuildRequires:  readline-devel
-# dlopen() no longer makes rpm-libs a mandatory dependency.
-#Requires: rpm-libs
-BuildRequires:  rpm-devel
+BuildRequires:  zlib-devel
 %if 0%{!?_without_python:1}
 %if 0%{suse_version} > 1000
 Recommends:     python-base
 %endif
 BuildRequires:  python-devel
-# Temporarily before it gets moved to libstdc++.rpm
-BuildRequires:  libstdc++
 %endif	# 0%{!?_without_python:1}
+
 %if 0%{?_with_testsuite:1}
+
+# Ensure the devel libraries are installed for both multilib arches.
+%define bits_local %{?_isa}
+%define bits_other %{?_isa}
+%ifarch s390x
+%define bits_other (%{__isa_name}-31)
+%else #!s390x
+%ifarch ppc
+%define bits_other (%{__isa_name}-64)
+%else #!ppc
+%ifarch sparc64 ppc64 s390x x86_64
+%define bits_other (%{__isa_name}-32)
+%endif #sparc64 ppc64 s390x x86_64
+%endif #!ppc
+%endif #!s390x
+
 BuildRequires:  dejagnu sharutils
 # gcc-objc++ is not covered by the GDB testsuite.
 BuildRequires:  gcc gcc-c++ gcc-gfortran gcc-java gcc-objc
-# Ensure the devel libraries are installed for both multilib arches.
-%define multilib_64_archs sparc64 ppc64 s390x x86_64
-# Copied from gcc-4.1.2-32
+# Copied from gcc-4.1.2-32.
 %ifarch %{ix86} x86_64 ia64 ppc alpha
 BuildRequires:  gcc-ada
-%ifarch %{multilib_64_archs} ppc
-BuildRequires:  %{_exec_prefix}/lib/libgnat-4.4.so %{_exec_prefix}/lib64/libgnat-4.4.so
-%endif
-%endif
-%ifarch %{multilib_64_archs} sparc sparcv9 ppc
-BuildRequires:  %{_exec_prefix}/lib/libc.so %{_exec_prefix}/lib64/libc.so /lib/libc.so.6 /lib64/libc.so.6
-BuildRequires:  /lib/libgcc_s.so.1 /lib64/libgcc_s.so.1
-BuildRequires:  %{_exec_prefix}/lib/libstdc++.so.6 %{_exec_prefix}/lib64/libstdc++.so.6
-BuildRequires:  %{_exec_prefix}/lib/libgcj.so.10 %{_exec_prefix}/lib64/libgcj.so.10
 %endif
+BuildRequires:  glibc-devel-32bit
+%if 0%{suse_version} > 1120
+BuildRequires:  gcc-c++-32bit
 %endif
+
+%endif # 0%{?_with_testsuite:1}
+
 %ifarch ia64
 BuildRequires:  libunwind-devel
 Requires:       libunwind
 %endif
+
 PreReq:         %install_info_prereq
 
 %description
@@ -334,25 +530,38 @@ and printing their data.
 This package provides a program that allows you to run GDB on a different machine than the one which is running the program being debugged.
 
 %prep
+
 # This allows the tarball name to be different from our
 # version-release name.
+
 %setup -q -n %{gdb_src}
+
 # libstdc++ pretty printers.
-bzip2 -dc %{SOURCE4} | tar xf -
+tar xjf %{SOURCE4}
+
 # Files have `# <number> <file>' statements breaking VPATH / find-debuginfo.sh .
 rm -f gdb/ada-exp.c gdb/ada-lex.c gdb/c-exp.c gdb/cp-name-parser.c gdb/f-exp.c
 rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
+
 # Apply patches defined above.
+
 # Match the Fedora's version info.
 %patch2 -p1
+
 %if 0%{!?_with_upstream:1}
-#patch232 -p1
+
+%patch232 -p1
 %patch349 -p1
+%patch418 -p1
+%patch420 -p1
 %patch383 -p1
 %patch384 -p1
 %patch385 -p1
+%patch388 -p1
+%patch124 -p1
 %patch1 -p1
 %patch3 -p1
+
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
@@ -361,7 +570,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch118 -p1
 %patch122 -p1
 %patch125 -p1
-%patch128 -p1
 %patch133 -p1
 %patch136 -p1
 %patch140 -p1
@@ -437,8 +645,8 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch322 -p1
 %patch324 -p1
 %patch326 -p1
-%patch350 -p1
-%patch328 -p1
+###patch350 -p1
+###patch328 -p1
 %patch329 -p1
 %patch330 -p1
 %patch331 -p1
@@ -452,18 +660,59 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch376 -p1
 %patch381 -p1
 %patch382 -p1
-%patch124 -p1
+# Does not work on ia64
+%ifnarch ia64
+%patch387 -p1
+%endif
+%patch389 -p1
+%patch390 -p1
+%patch391 -p1
+%patch392 -p1
+%patch394 -p1
+%patch395 -p1
+%patch396 -p1
+%patch397 -p1
+%patch398 -p1
+%patch399 -p1
+%patch400 -p1
+%patch401 -p1
+%patch402 -p1
+%patch414 -p1
+%patch416 -p1
+%patch417 -p1
+%patch419 -p1
+%patch421 -p1
+%patch422 -p1
+%patch423 -p1
+%patch424 -p1
+%patch425 -p1
+%if 0
+# Always verify their applicability.
+%patch393 -p1
+%patch335 -p1
+%if 0%{!?el5:1}
+%patch393 -p1 -R
+%patch335 -p1 -R
+%endif
+%endif
+
 %patch1000
 %patch1002 -p1
 %patch1007
+
 find -name "*.orig" | xargs rm -f
-! find -name "*.rej"	# Should not happen.
-%endif	# 0%{!?_with_upstream:1}
+! find -name "*.rej" # Should not happen.
+
+%endif # 0%{!?_with_upstream:1}
+
 # Change the version that gets printed at GDB startup, so it is SUSE 
 # specific.
+# Fedora (%{version}-%{release})
+# Red Hat Enterprise Linux (%{version}-%{release})
 cat > gdb/version.in << _FOO
 SUSE (%{version}-%{release})
 _FOO
+
 # Remove the info and other generated files added by the FSF release
 # process.
 rm -f libdecnumber/gstdint.h
@@ -473,80 +722,93 @@ rm -f gdb/doc/*.info
 rm -f gdb/doc/*.info-*
 
 %build
+
 # Identify the build directory with the version of gdb as well as the
 # architecture, to allow for mutliple versions to be installed and
 # built.
 # Initially we're in the %{gdb_src} directory.
+
 rm -fr %{gdb_build}
 mkdir %{gdb_build}
 cd %{gdb_build}
+
 # g77 executable is no longer present in Fedora gcc-4.x+.
 g77="`which gfortran 2>/dev/null || true`"
 test -z "$g77" || ln -s "$g77" ./g77
+
 export CFLAGS="$RPM_OPT_FLAGS"
+
 %if 0%{?_with_debug:1}
 # --enable-werror could conflict with `-Wall -O0' but this is no longer true
 # for recent GCCs.
 CFLAGS="$CFLAGS -O0 -ggdb2"
 %endif
-../configure						\
-	--prefix=%{_prefix}				\
-	--libdir=%{_libdir}				\
-	--sysconfdir=%{_sysconfdir}			\
-	--mandir=%{_mandir}				\
-	--infodir=%{_infodir}				\
-	--with-gdb-datadir=%{_datadir}/gdb		\
-	--with-pythondir=%{_datadir}/gdb/python		\
-	--enable-gdb-build-warnings=,-Wno-unused	\
+
+../configure							\
+	--prefix=%{_prefix}					\
+	--libdir=%{_libdir}					\
+	--sysconfdir=%{_sysconfdir}				\
+	--mandir=%{_mandir}					\
+	--infodir=%{_infodir}					\
+	--with-gdb-datadir=%{_datadir}/gdb			\
+	--with-pythondir=%{_datadir}/gdb/python			\
+	--enable-gdb-build-warnings=,-Wno-unused		\
 %ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64 sparcv9 sparc64
-	--disable-werror				\
-%else 
+	--disable-werror					\
+%else
 %if 0%{?_with_upstream:1}
-	--disable-werror				\
+	--disable-werror					\
 %else
-	--enable-werror					\
+	--enable-werror						\
 %endif
 %endif
-	--with-separate-debug-dir=/usr/lib/debug	\
-	--disable-sim					\
-	--disable-rpath					\
-	--with-system-readline				\
-	--with-expat					\
-	--enable-tui					\
+	--with-separate-debug-dir=/usr/lib/debug		\
+	--disable-sim						\
+	--disable-rpath						\
+	--with-system-readline					\
+	--with-expat						\
+$(: ppc64 host build crashes on ppc variant of libexpat.so )	\
+	--without-libexpat-prefix				\
+	--enable-tui						\
 %if 0%{!?_without_python:1}
-	--with-python					\
+	--with-python						\
 %else
-	--without-python				\
+	--without-python					\
 %endif
-	--without-rpm					\
+	--without-rpm						\
 %ifarch ia64
-	--with-libunwind				\
+	--with-libunwind					\
 %else
-	--without-libunwind				\
+	--without-libunwind					\
 %endif
-	--enable-64-bit-bfd				\
+	--enable-64-bit-bfd					\
 %if 0%{?_with_debug:1}
-	--enable-static --disable-shared --enable-debug	\
+	--enable-static --disable-shared --enable-debug		\
 %endif
 %ifarch sparcv9
 	sparc-%{_vendor}-%{_target_os}%{?_gnu}
 %else
 	%{_target_platform}
 %endif
+
 make %{?_smp_mflags}
 make %{?_smp_mflags} info
+
+grep '#define HAVE_ZLIB_H 1' gdb/config.h
+
 # Copy the <sourcetree>/gdb/NEWS file to the directory above it.
 cp $RPM_BUILD_DIR/%{gdb_src}/gdb/NEWS $RPM_BUILD_DIR/%{gdb_src}
 
 %check
 # Initially we're in the %{gdb_src} directory.
 cd %{gdb_build}
+
 %if 0%{!?_with_testsuite:1}
 echo ====================TESTSUITE DISABLED=========================
 %else
 echo ====================TESTING=========================
 cd gdb
-gcc -o ./orphanripper %{SOURCE2} -Wall -lutil
+gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2
 # Need to use a single --ignore option, second use overrides first.
 # No `%{?_smp_mflags}' here as it may race.
 # WARNING: can't generate a core file - core tests suppressed - check ulimit
@@ -555,6 +817,7 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil
   # ULIMIT required for `gdb.base/auxv.exp'.
   ulimit -H -c
   ulimit -c unlimited || :
+
   # Setup $CHECK as `check//unix/' or `check//unix/-m64' for explicit bitsize.
   # Never use two different bitsizes as it fails on ppc64.
   echo 'int main (void) { return 0; }' >biarch.c
@@ -585,6 +848,7 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil
   then
     CHECK="$(echo " $CHECK "|sed 's# check//unix/-m64 # #')"
   fi
+
   # Disable some problematic testcases.
   # RUNTESTFLAGS='--ignore ...' is not used below as it gets separated by the
   # `check//...' target spawn and too much escaping there would be dense.
@@ -594,13 +858,19 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil
   ; do
     mv -f ../../gdb/testsuite/$test ../gdb/testsuite/$test-DISABLED || :
   done
+
 %if 0%{!?_with_upstream:1}
   # Run all the scheduled testsuite runs also in the PIE mode.
   # Upstream GDB would lock up the testsuite run for too long on its failures.
   CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIE/-pie#g')"
-%endif	# 0%{!?_with_upstream:1}
-  # FIXME: Temporary F12 disable: ./orphanripper
-  make %{?_smp_mflags} -k $CHECK || :
+%endif # 0%{!?_with_upstream:1}
+
+  ./orphanripper make %{?_smp_mflags} -k $CHECK \
+$(: Serialize the output to keep the order for regression checks. ) \
+%if 0%{?el5:1}
+    RUNTESTFLAGS="--tool gdb" \
+%endif
+    || :
 )
 for t in sum log
 do
@@ -622,15 +892,19 @@ echo ====================TESTING END=====================
 # Initially we're in the %{gdb_src} directory.
 cd %{gdb_build}
 rm -rf $RPM_BUILD_ROOT
+
 make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT
+
 # install the gcore script in /usr/bin
 cp $RPM_BUILD_DIR/%{gdb_src}/gdb/gdb_gcore.sh $RPM_BUILD_ROOT%{_bindir}/gcore
 chmod 755 $RPM_BUILD_ROOT%{_bindir}/gcore
+
 # Remove the gdb/gdbtui binaries duplicity.
 test -x $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui
 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
+
 %if 0%{!?_without_python:1}
 # Temporarily now:
 for LIB in lib lib64;do
@@ -645,10 +919,12 @@ 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}
+%endif # 0%{!?_without_python:1}
+
 # Remove the files that are part of a gdb build but that are owned and
 # provided by other packages.
 # These are part of binutils
+
 rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/
 rm -f $RPM_BUILD_ROOT%{_infodir}/bfd*
 rm -f $RPM_BUILD_ROOT%{_infodir}/standard*
@@ -656,11 +932,15 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/mmalloc*
 rm -f $RPM_BUILD_ROOT%{_infodir}/configure*
 rm -rf $RPM_BUILD_ROOT%{_includedir}
 rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,mmalloc*}
+
 # Delete this too because the dir file will be updated at rpm install time.
 # We don't want a gdb specific one overwriting the system wide one.
+
 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
+
 %if 0%{!?_with_upstream:1}
 # pstack obsoletion
+
 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1
 %endif	# 0%{!?_with_upstream:1}
 
@@ -670,14 +950,28 @@ rm -rf $RPM_BUILD_ROOT
 %post
 # This step is part of the installation of the RPM. Not to be confused
 # with the 'make install ' of the build (rpmbuild) process.
-for infoname in annotate gdb gdbint stabs;do
-%install_info --info-dir=%{_infodir} %_{infodir}/$infoname.info.gz
-done
 
-%postun
-for infoname in annotate gdb gdbint stabs;do
-%install_info_delete --info-dir=%{_infodir} %_{infodir}/$infoname.info.gz
-done
+# For --excludedocs:
+if [ -e %{_infodir}/gdb.info.gz ]
+then
+  %install_info --info-dir=%{_infodir} %{_infodir}/annotate.info.gz
+  %install_info --info-dir=%{_infodir} %{_infodir}/gdb.info.gz
+  %install_info --info-dir=%{_infodir} %{_infodir}/gdbint.info.gz
+  %install_info --info-dir=%{_infodir} %{_infodir}/stabs.info.gz
+fi
+
+%preun
+if [ $1 = 0 ]
+then
+  # For --excludedocs:
+  if [ -e %{_infodir}/gdb.info.gz ]
+  then
+    %install_info_delete --delete --info-dir=%{_infodir} %{_infodir}/annotate.info.gz
+    %install_info_delete --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz
+    %install_info_delete --delete --info-dir=%{_infodir} %{_infodir}/gdbint.info.gz
+    %install_info_delete --delete --info-dir=%{_infodir} %{_infodir}/stabs.info.gz
+  fi
+fi
 
 %files
 %defattr(-,root,root)
@@ -696,7 +990,9 @@ done
 %{_infodir}/gdb.info*
 %{_infodir}/gdbint.info*
 %{_infodir}/stabs.info*
+
 # don't include the files in include, they are part of binutils
+
 %ifnarch sparcv9 
 
 %files -n gdbserver