[insight] #-------------------------------------------------------------------------------

Patrick Monnerat monnerat at fedoraproject.org
Wed Aug 27 14:28:17 UTC 2014


commit 648e8014273c07e88a2e5b65afd5e685fa2a8bda
Author: Patrick Monnerat <pm at datasphere.ch>
Date:   Wed Aug 27 16:28:10 2014 +0200

    #-------------------------------------------------------------------------------

 .gitignore                                         |    1 +
 binutils-2.24-bfd.patch                            |  156 -
 binutils-2.24-s390-mkopc.patch                     |   19 -
 gdb-6.3-gcore-thread-20050204.patch                |   25 -
 gdb-6.3-gstack-20050411.patch                      |   32 +-
 gdb-6.3-ia64-gcore-page0-20050421.patch            |   20 -
 gdb-6.3-ia64-gcore-speedup-20050714.patch          |  126 -
 gdb-6.3-ia64-info-frame-fix-20050725.patch         |  107 -
 gdb-6.3-ia64-sigill-20051115.patch                 |   95 -
 gdb-6.3-ia64-sigtramp-frame-20050708.patch         |  158 --
 gdb-6.5-bz109921-DW_AT_decl_file-test.patch        |  120 +
 ...bz185337-resolve-tls-without-debuginfo-v2.patch |   20 +-
 gdb-6.5-bz190810-gdbserver-arch-advice.patch       |   28 +
 gdb-6.5-bz203661-emit-relocs.patch                 |   16 +-
 ...ch => gdb-6.5-bz216711-clone-is-outermost.patch |  123 +-
 ...bz218379-solib-trampoline-lookup-lock-fix.patch |   14 +-
 gdb-6.6-bfd-vdso8k.patch                           |  119 -
 ...ding-warning-missing-debuginfo-rhbz981154.patch |  131 +
 gdb-6.6-buildid-locate-rpm-librpm-workaround.patch |   36 +
 gdb-6.6-buildid-locate-rpm-scl.patch               |  109 +
 gdb-6.6-buildid-locate-solib-missing-ids.patch     |   59 +
 gdb-6.6-buildid-locate.patch                       | 1200 ++++++++
 gdb-6.6-bz235197-fork-detach-info.patch            |   18 +-
 gdb-6.6-scheduler_locking-step-is-default.patch    |   78 +-
 ....6-scheduler_locking-step-sw-watchpoints2.patch |  204 --
 gdb-6.8-attach-signalled-detach-stopped.patch      |  152 +
 gdb-6.8-quit-never-aborts.patch                    |   82 +-
 ...parc-add-workaround-to-broken-debug-files.patch |   54 +-
 gdb-archer-pie-addons-keep-disabled.patch          |   83 +
 gdb-archer-pie-addons.patch                        |   82 +
 gdb-archer.patch                                   |  647 +++++
 gdb-btrobust.patch                                 |   82 +
 gdb-bz533176-fortran-omp-step.patch                |   26 +-
 gdb-bz562763-pretty-print-2d-vectors.patch         |  398 ---
 gdb-bz592031-siginfo-lost-4of5.patch               |  994 -------
 gdb-bz623749-gcore-relro.patch                     |  169 --
 gdb-core-open-vdso-warning.patch                   |   84 -
 gdb-dts-rhel6-python-compat.patch                  |  308 ++
 gdb-enable-count-crash.patch                       |   86 +
 gdb-gdb-add-index-script.patch                     |  141 +-
 gdb-glibc-strstr-workaround.patch                  |  144 +
 gdb-gnat-dwarf-crash-3of3.patch                    |   58 +
 gdb-python-gil.patch                               |  224 ++
 gdb-readline62-ask-more-rh.patch                   |   14 +
 gdb-rhel5-compat.patch                             |   29 +
 gdb-stale-frame_info.patch                         |  174 ++
 gdb-vla-intel-04of23-fix.patch                     |   42 +
 gdb-vla-intel-stringbt-fix.patch                   |  165 ++
 gdb-x86-onstack-2of2.patch                         |  166 --
 gdb-x86_64-i386-syscall-restart.patch              |    2 +-
 insight-7.4.50-acversion.patch                     |   52 -
 insight-7.4.50-bfdarm.patch                        |   21 -
 insight-7.4.50-bz592031-siginfo-lost-5of5.patch    |  111 -
 insight-7.4.50-bz883591.patch                      |   12 -
 insight-7.4.50-fortran-common-reduce.patch         |  499 ----
 insight-7.4.50-fortran-common.patch                |  581 ----
 insight-7.4.50-nocygnus.patch                      |   80 -
 insight-7.4.50-objalloc.patch                      |   47 -
 insight-7.4.50-readnever-20050907.patch            |   80 -
 insight-7.4.50-security-errata-20050610.patch      |  216 --
 insight-7.4.50-sig2dead.patch                      |   24 -
 insight-7.4.50-sizesizet.patch                     |   22 -
 insight-7.4.50-structsiginfo.patch                 |  136 -
 insight-7.4.50-tcl86.patch                         |   25 -
 insight-7.4.50-texinfo5.patch                      |  671 -----
 insight-7.4.50-unbundle.patch                      |  103 -
 insight-7.4.50-x86-onstack-1of2.patch              |   73 -
 insight-7.8.50-attach-fail-reasons-5of5.patch      |  373 +++
 insight-7.8.50-buildid-locate-core-as-arg.patch    |  134 +
 insight-7.8.50-buildid-locate-rpm.patch            | 1297 +++++++++
 ...ch => insight-7.8.50-bz231832-obstack-2gb.patch |   32 +-
 ...insight-7.8.50-bz541866-rwatch-before-run.patch |   49 +-
 insight-7.8.50-iwidgetsname.patch                  |   12 +
 insight-7.8.50-python-completer-1of2.patch         |  477 ++++
 insight-7.8.50-readnever-20050907.patch            |   78 +
 ...50-scheduler_locking-step-sw-watchpoints2.patch |  189 ++
 insight-7.8.50-vla-intel.patch                     | 2964 ++++++++++++++++++++
 insight.desktop                                    |   10 -
 insight.spec                                       |  354 ++-
 python-framefilter-invalidarg.patch                |  596 ++++
 sources                                            |    2 +-
 81 files changed, 10681 insertions(+), 6059 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a0e1523..edc1f0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 insight-6.8-1.tar.bz2
 /insight-7.4.50.tar.bz2
 /insight-7.4.50.tar.xz
+/insight-7.8.50.20140827.tar.bz2
diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch
index d6f4cb0..f1e9e3a 100644
--- a/gdb-6.3-gstack-20050411.patch
+++ b/gdb-6.3-gstack-20050411.patch
@@ -4,11 +4,11 @@
 	to install and uninstall.
 	* gstack.sh, gstack.1: New files.
 
-Index: gdb-7.4.50.20120103/gdb/Makefile.in
+Index: gdb-7.7/gdb/Makefile.in
 ===================================================================
---- gdb-7.4.50.20120103.orig/gdb/Makefile.in	2012-01-03 05:52:15.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/Makefile.in	2012-01-03 05:53:25.974210230 +0100
-@@ -1017,7 +1017,7 @@ gdb.z:gdb.1
+--- gdb-7.7.orig/gdb/Makefile.in	2014-02-06 20:29:09.401214339 +0100
++++ gdb-7.7/gdb/Makefile.in	2014-02-06 20:29:09.501214360 +0100
+@@ -1067,7 +1067,7 @@ info install-info clean-info dvi pdf ins
  install: all
  	@$(MAKE) $(FLAGS_TO_PASS) install-only
  
@@ -17,7 +17,7 @@ Index: gdb-7.4.50.20120103/gdb/Makefile.in
  	transformed_name=`t='$(program_transform_name)'; \
  			  echo gdb | sed -e "$$t"` ; \
  		if test "x$$transformed_name" = x; then \
-@@ -1039,7 +1039,25 @@ install-only: $(CONFIG_INSTALL)
+@@ -1104,7 +1104,25 @@ install-strip:
  install-python:
  	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
  
@@ -44,8 +44,8 @@ Index: gdb-7.4.50.20120103/gdb/Makefile.in
  	transformed_name=`t='$(program_transform_name)'; \
  			  echo gdb | sed -e $$t` ; \
  		if test "x$$transformed_name" = x; then \
-@@ -1051,6 +1069,18 @@ uninstall: force $(CONFIG_UNINSTALL)
- 		      $(DESTDIR)$(man1dir)/$$transformed_name.1
+@@ -1127,6 +1145,18 @@ uninstall: force $(CONFIG_UNINSTALL)
+ 	fi
  	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
  
 +.PHONY: uninstall-gstack
@@ -63,10 +63,10 @@ Index: gdb-7.4.50.20120103/gdb/Makefile.in
  # The C++ name parser can be built standalone for testing.
  test-cp-name-parser.o: cp-name-parser.c
  	$(COMPILE) -DTEST_CPNAMES cp-name-parser.c
-Index: gdb-7.4.50.20120103/gdb/gstack.sh
+Index: gdb-7.7/gdb/gstack.sh
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120103/gdb/gstack.sh	2012-01-03 05:52:37.278385632 +0100
++++ gdb-7.7/gdb/gstack.sh	2014-02-06 20:29:09.501214360 +0100
 @@ -0,0 +1,43 @@
 +#!/bin/sh
 +
@@ -101,7 +101,7 @@ Index: gdb-7.4.50.20120103/gdb/gstack.sh
 +
 +# Run GDB, strip out unwanted noise.
 +# --readnever is no longer used since .gdb_index is now in use.
-+$GDB --quiet -nx /proc/$1/exe $1 <<EOF 2>&1 | 
++$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 | 
 +set width 0
 +set height 0
 +set pagination no
@@ -111,10 +111,10 @@ Index: gdb-7.4.50.20120103/gdb/gstack.sh
 +    -e 's/^\((gdb) \)*//' \
 +    -e '/^#/p' \
 +    -e '/^Thread/p'
-Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp
+Index: gdb-7.7/gdb/testsuite/gdb.base/gstack.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp	2012-01-03 05:52:37.279385629 +0100
++++ gdb-7.7/gdb/testsuite/gdb.base/gstack.exp	2014-02-06 20:43:17.774747352 +0100
 @@ -0,0 +1,66 @@
 +# Copyright (C) 2012 Free Software Foundation, Inc.
 +
@@ -133,7 +133,7 @@ Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp
 +
 +set testfile gstack
 +set executable ${testfile}
-+set binfile ${objdir}/${subdir}/$executable
++set binfile [standard_output_file $executable]
 +if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
 +    return -1
 +}
@@ -167,7 +167,7 @@ Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp
 +# exiting the function.  Still we could retry the gstack command if we fail.
 +
 +set test "spawn gstack"
-+set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
++set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
 +set res [remote_spawn host $command];
 +if { $res < 0 || $res == "" } {
 +    perror "Spawning $command failed."
@@ -182,10 +182,10 @@ Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp
 +gdb_exit
 +
 +remote_exec host "kill -9 $pid"
-Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.c
+Index: gdb-7.7/gdb/testsuite/gdb.base/gstack.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.c	2012-01-03 05:52:37.279385629 +0100
++++ gdb-7.7/gdb/testsuite/gdb.base/gstack.c	2014-02-06 20:29:09.502214360 +0100
 @@ -0,0 +1,43 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
diff --git a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch
new file mode 100644
index 0000000..70be875
--- /dev/null
+++ b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch
@@ -0,0 +1,120 @@
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
+
+It is duplicite to its upstream variant:
+http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html
+http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html
+2007-01-21  Jan Kratochvil  <jan.kratochvil at redhat.com>
+	    Daniel Jacobowitz  <dan at codesourcery.com>
+
+	* gdb.base/included.c, gdb.base/included.exp,
+	gdb.base/included.h: New files.
+
+------------------------------------------------------------------------------
+
+2007-01-09  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
+	gdb.dwarf2/dw2-included.h: New files.
+
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ ./gdb/testsuite/gdb.dwarf2/dw2-included.c	2 Jan 2007 00:20:27 -0000
+@@ -0,0 +1,26 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2006 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.  */
++
++#include "dw2-included.h"
++
++int
++main()
++{
++  return 0;
++}
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ ./gdb/testsuite/gdb.dwarf2/dw2-included.exp	2 Jan 2007 00:20:27 -0000
+@@ -0,0 +1,47 @@
++# Copyright 2006 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.
++
++# Minimal DWARF-2 unit test
++
++# This test can only be run on targets which support DWARF-2.
++# 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-included"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++    return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++gdb_test "set listsize 1" ""
++gdb_test "list integer" "int integer;\r"
++gdb_test "ptype integer" "type = int\r"
++# Path varies depending on the build location.
++gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\nint integer;\r"
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ ./gdb/testsuite/gdb.dwarf2/dw2-included.h	2 Jan 2007 00:20:27 -0000
+@@ -0,0 +1,20 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2006 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.  */
++
++int integer;
diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
index fa2f4ed..1c8f99b 100644
--- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
+++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
@@ -32,21 +32,23 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
   <81a2>     DW_AT_name        : (indirect string, offset: 0x280e): __errno_location
   <81a8>     DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
 
---- a/gdb/printcmd.c
-+++ b/gdb/printcmd.c
-@@ -967,6 +967,8 @@ print_command_1 (char *exp, int inspect, int voidprint)
+Index: gdb-7.6.50.20130731-cvs/gdb/printcmd.c
+===================================================================
+--- gdb-7.6.50.20130731-cvs.orig/gdb/printcmd.c	2013-08-02 16:21:13.665758324 +0200
++++ gdb-7.6.50.20130731-cvs/gdb/printcmd.c	2013-08-02 16:22:24.367853322 +0200
+@@ -982,6 +982,8 @@ print_command_1 (const char *exp, int vo
  
    if (exp && *exp)
      {
 +      if (strcmp (exp, "errno") == 0)
 +	exp = "*((int *(*) (void)) __errno_location) ()";
        expr = parse_expression (exp);
-       old_chain = make_cleanup (free_current_contents, &expr);
-       cleanup = 1;
-Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.c
+       make_cleanup (free_current_contents, &expr);
+       val = evaluate_expression (expr);
+Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.c	2011-03-29 10:55:35.000000000 +0200
++++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.c	2013-08-02 16:21:13.665758324 +0200
 @@ -0,0 +1,28 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -76,10 +78,10 @@ Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.c
 +
 +  return 0;	/* breakpoint */
 +}
-Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
+Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.exp	2011-03-29 10:55:35.000000000 +0200
++++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.exp	2013-08-02 16:21:13.665758324 +0200
 @@ -0,0 +1,60 @@
 +# Copyright 2007 Free Software Foundation, Inc.
 +
diff --git a/gdb-6.5-bz190810-gdbserver-arch-advice.patch b/gdb-6.5-bz190810-gdbserver-arch-advice.patch
new file mode 100644
index 0000000..c702327
--- /dev/null
+++ b/gdb-6.5-bz190810-gdbserver-arch-advice.patch
@@ -0,0 +1,28 @@
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=190810
+
+
+2006-09-26  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* remote.c (remote_wait): Suggestion on crash due to nonmatching target.
+	(remote_async_wait): Likewise.
+
+
+Index: gdb-6.8.50.20090818/gdb/remote.c
+===================================================================
+--- gdb-6.8.50.20090818.orig/gdb/remote.c	2009-08-18 21:00:35.000000000 +0200
++++ gdb-6.8.50.20090818/gdb/remote.c	2009-08-18 21:04:46.000000000 +0200
+@@ -4408,8 +4408,13 @@ Packet: '%s'\n"),
+ 	      VEC_safe_push (cached_reg_t, event->regcache, &cached_reg);
+ 	    }
+ 
++	  /* It may also occur on amd64 which defaults to 32-bit i386
++	     target.  gdbserver(1) is not aware of the `set architecture'
++	     name itself as it is not using libbfd.  */
+ 	  if (*p != ';')
+-	    error (_("Remote register badly formatted: %s\nhere: %s"),
++	    error (_("Remote register badly formatted: %s\nhere: %s"
++		     "\nTry to load the executable by `file' first,"
++		     "\nyou may also check `set/show architecture'."),
+ 		   buf, p);
+ 	  ++p;
+ 	}
diff --git a/gdb-6.5-bz203661-emit-relocs.patch b/gdb-6.5-bz203661-emit-relocs.patch
index 61e0d56..cc8e515 100644
--- a/gdb-6.5-bz203661-emit-relocs.patch
+++ b/gdb-6.5-bz203661-emit-relocs.patch
@@ -1,14 +1,14 @@
-Index: gdb-7.0.90.20100306/gdb/symfile.c
+Index: gdb-7.4.50.20120602/gdb/symfile.c
 ===================================================================
---- gdb-7.0.90.20100306.orig/gdb/symfile.c	2010-03-06 23:20:35.000000000 +0100
-+++ gdb-7.0.90.20100306/gdb/symfile.c	2010-03-06 23:26:25.000000000 +0100
-@@ -3642,6 +3642,12 @@ default_symfile_relocate (struct objfile
- {
-   bfd *abfd = objfile->obfd;
+--- gdb-7.4.50.20120602.orig/gdb/symfile.c	2012-06-02 18:25:20.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/symfile.c	2012-06-02 18:26:36.145232057 +0200
+@@ -3630,6 +3630,12 @@ default_symfile_relocate (struct objfile
+      DWO file.  */
+   bfd *abfd = sectp->owner;
  
 +  /* Executable files have all the relocations already resolved.
-+   * Handle files linked with --emit-relocs.
-+   * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html  */
++     Handle files linked with --emit-relocs.
++     http://sources.redhat.com/ml/gdb/2006-08/msg00137.html  */
 +  if ((abfd->flags & EXEC_P) != 0)
 +    return NULL;
 +
diff --git a/insight-7.4.50-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch
similarity index 74%
rename from insight-7.4.50-bz216711-clone-is-outermost.patch
rename to gdb-6.5-bz216711-clone-is-outermost.patch
index 7bee04c..9fb23ed 100644
--- a/insight-7.4.50-bz216711-clone-is-outermost.patch
+++ b/gdb-6.5-bz216711-clone-is-outermost.patch
@@ -1,7 +1,33 @@
-diff -Naur insight-7.4.50.orig/gdb/amd64-linux-tdep.c insight-7.4.50.new/gdb/amd64-linux-tdep.c
---- insight-7.4.50.orig/gdb/amd64-linux-tdep.c	2012-03-01 22:13:57.000000000 +0100
-+++ insight-7.4.50.new/gdb/amd64-linux-tdep.c	2012-04-04 18:17:01.524369932 +0200
-@@ -268,6 +268,80 @@
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711
+
+FIXME: This workaround should be dropped and
+glibc/sysdeps/unix/sysv/linux/x86_64/clone.S should get CFI for the child
+instead.
+
+2006-12-17  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb/amd64-linux-tdep.c (linux_clone_code): New variable.
+	(LINUX_CLONE_LEN): New definition.
+	(amd64_linux_clone_running, amd64_linux_outermost_frame): New function.
+	(amd64_linux_init_abi): Initialize `outermost_frame_p'.
+	* gdb/i386-tdep.c (i386_gdbarch_init): Likewise.
+	* gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member.
+	* gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'.
+
+2006-12-17  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c:
+	New file.
+
+2007-10-16  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Port to GDB-6.7.
+
+Index: gdb-7.6.90.20140127/gdb/amd64-linux-tdep.c
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/amd64-linux-tdep.c	2014-02-04 23:40:06.263483469 +0100
++++ gdb-7.6.90.20140127/gdb/amd64-linux-tdep.c	2014-02-04 23:47:18.438009290 +0100
+@@ -289,6 +289,80 @@ amd64_linux_register_reggroup_p (struct
  
  /* Set the program counter for process PTID to PC.  */
  
@@ -82,19 +108,20 @@ diff -Naur insight-7.4.50.orig/gdb/amd64-linux-tdep.c insight-7.4.50.new/gdb/amd
  static void
  amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
  {
-@@ -1321,6 +1395,8 @@
+@@ -1607,6 +1681,8 @@ amd64_linux_init_abi_common(struct gdbar
  
    tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
  
 +  tdep->outermost_frame_p = amd64_linux_outermost_frame;
 +
-   /* GNU/Linux uses SVR4-style shared libraries.  */
-   set_solib_svr4_fetch_link_map_offsets
-     (gdbarch, svr4_lp64_fetch_link_map_offsets);
-diff -Naur insight-7.4.50.orig/gdb/amd64-tdep.c insight-7.4.50.new/gdb/amd64-tdep.c
---- insight-7.4.50.orig/gdb/amd64-tdep.c	2012-03-20 08:08:55.000000000 +0100
-+++ insight-7.4.50.new/gdb/amd64-tdep.c	2012-04-04 18:15:49.300543940 +0200
-@@ -2108,6 +2108,7 @@
+   /* Add the %orig_rax register used for syscall restarting.  */
+   set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc);
+ 
+Index: gdb-7.6.90.20140127/gdb/amd64-tdep.c
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/amd64-tdep.c	2014-02-04 23:40:06.265483471 +0100
++++ gdb-7.6.90.20140127/gdb/amd64-tdep.c	2014-02-04 23:45:40.846891653 +0100
+@@ -2359,6 +2359,7 @@ amd64_frame_unwind_stop_reason (struct f
  {
    struct amd64_frame_cache *cache =
      amd64_frame_cache (this_frame, this_cache);
@@ -102,7 +129,7 @@ diff -Naur insight-7.4.50.orig/gdb/amd64-tdep.c insight-7.4.50.new/gdb/amd64-tde
  
    if (!cache->base_p)
      return UNWIND_UNAVAILABLE;
-@@ -2116,6 +2117,10 @@
+@@ -2367,6 +2368,10 @@ amd64_frame_unwind_stop_reason (struct f
    if (cache->base == 0)
      return UNWIND_OUTERMOST;
  
@@ -113,29 +140,31 @@ diff -Naur insight-7.4.50.orig/gdb/amd64-tdep.c insight-7.4.50.new/gdb/amd64-tde
    return UNWIND_NO_REASON;
  }
  
-@@ -2125,6 +2130,7 @@
+@@ -2498,6 +2503,7 @@ amd64_sigtramp_frame_this_id (struct fra
  {
    struct amd64_frame_cache *cache =
-     amd64_frame_cache (this_frame, this_cache);
+     amd64_sigtramp_frame_cache (this_frame, this_cache);
 +  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
  
    if (!cache->base_p)
-     return;
-@@ -2133,6 +2139,10 @@
-   if (cache->base == 0)
-     return;
- 
-+  /* Detect OS dependent outermost frames; such as `clone'.  */
-+  if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
-+    return;
-+
-   (*this_id) = frame_id_build (cache->base + 16, cache->pc);
+     (*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame));
+@@ -2506,6 +2512,11 @@ amd64_sigtramp_frame_this_id (struct fra
+       /* This marks the outermost frame.  */
+       return;
+     }
++  else if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
++    {
++      /* Detect OS dependent outermost frames; such as `clone'.  */
++      return;
++    }
+   else
+     (*this_id) = frame_id_build (cache->base + 16, get_frame_pc (this_frame));
  }
- 
-diff -Naur insight-7.4.50.orig/gdb/i386-tdep.c insight-7.4.50.new/gdb/i386-tdep.c
---- insight-7.4.50.orig/gdb/i386-tdep.c	2012-02-29 15:59:41.000000000 +0100
-+++ insight-7.4.50.new/gdb/i386-tdep.c	2012-04-04 18:15:49.302543830 +0200
-@@ -7306,6 +7306,9 @@
+Index: gdb-7.6.90.20140127/gdb/i386-tdep.c
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/i386-tdep.c	2014-02-04 23:40:06.267483473 +0100
++++ gdb-7.6.90.20140127/gdb/i386-tdep.c	2014-02-04 23:43:33.048734974 +0100
+@@ -7830,6 +7830,9 @@ i386_gdbarch_init (struct gdbarch_info i
  
    tdep->xsave_xcr0_offset = -1;
  
@@ -145,10 +174,11 @@ diff -Naur insight-7.4.50.orig/gdb/i386-tdep.c insight-7.4.50.new/gdb/i386-tdep.
    tdep->record_regmap = i386_record_regmap;
  
    set_gdbarch_long_long_align_bit (gdbarch, 32);
-diff -Naur insight-7.4.50.orig/gdb/i386-tdep.h insight-7.4.50.new/gdb/i386-tdep.h
---- insight-7.4.50.orig/gdb/i386-tdep.h	2012-01-04 09:17:04.000000000 +0100
-+++ insight-7.4.50.new/gdb/i386-tdep.h	2012-04-04 18:15:49.303543771 +0200
-@@ -219,6 +219,9 @@
+Index: gdb-7.6.90.20140127/gdb/i386-tdep.h
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/i386-tdep.h	2014-02-04 23:40:06.268483475 +0100
++++ gdb-7.6.90.20140127/gdb/i386-tdep.h	2014-02-04 23:43:33.048734974 +0100
+@@ -192,6 +192,9 @@ struct gdbarch_tdep
    int (*i386_sysenter_record) (struct regcache *regcache);
    /* Parse syscall args.  */
    int (*i386_syscall_record) (struct regcache *regcache);
@@ -158,10 +188,11 @@ diff -Naur insight-7.4.50.orig/gdb/i386-tdep.h insight-7.4.50.new/gdb/i386-tdep.
  };
  
  /* Floating-point registers.  */
-diff -Naur insight-7.4.50.orig/gdb/ia64-tdep.c insight-7.4.50.new/gdb/ia64-tdep.c
---- insight-7.4.50.orig/gdb/ia64-tdep.c	2012-04-04 18:15:22.549719439 +0200
-+++ insight-7.4.50.new/gdb/ia64-tdep.c	2012-04-04 18:15:49.304543713 +0200
-@@ -2180,6 +2180,138 @@
+Index: gdb-7.6.90.20140127/gdb/ia64-tdep.c
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/ia64-tdep.c	2014-02-04 23:40:06.270483477 +0100
++++ gdb-7.6.90.20140127/gdb/ia64-tdep.c	2014-02-04 23:43:33.049734975 +0100
+@@ -2176,6 +2176,138 @@ static const struct frame_unwind ia64_fr
    default_frame_sniffer
  };
  
@@ -300,7 +331,7 @@ diff -Naur insight-7.4.50.orig/gdb/ia64-tdep.c insight-7.4.50.new/gdb/ia64-tdep.
  /* Signal trampolines.  */
  
  static void
-@@ -4152,6 +4284,7 @@
+@@ -4023,6 +4155,7 @@ ia64_gdbarch_init (struct gdbarch_info i
    set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
  
    set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
@@ -308,9 +339,10 @@ diff -Naur insight-7.4.50.orig/gdb/ia64-tdep.c insight-7.4.50.new/gdb/ia64-tdep.
  #ifdef HAVE_LIBUNWIND_IA64_H
    frame_unwind_append_unwinder (gdbarch,
                                  &ia64_libunwind_sigtramp_frame_unwind);
-diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.threads/bt-clone-stop.c insight-7.4.50.new/gdb/testsuite/gdb.threads/bt-clone-stop.c
---- insight-7.4.50.orig/gdb/testsuite/gdb.threads/bt-clone-stop.c	1970-01-01 01:00:00.000000000 +0100
-+++ insight-7.4.50.new/gdb/testsuite/gdb.threads/bt-clone-stop.c	2012-04-04 18:15:49.305543657 +0200
+Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.threads/bt-clone-stop.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.6.90.20140127/gdb/testsuite/gdb.threads/bt-clone-stop.c	2014-02-04 23:43:33.050734976 +0100
 @@ -0,0 +1,39 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -351,9 +383,10 @@ diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.threads/bt-clone-stop.c insight
 +	for (;;)
 +		pause();
 +}
-diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.threads/bt-clone-stop.exp insight-7.4.50.new/gdb/testsuite/gdb.threads/bt-clone-stop.exp
---- insight-7.4.50.orig/gdb/testsuite/gdb.threads/bt-clone-stop.exp	1970-01-01 01:00:00.000000000 +0100
-+++ insight-7.4.50.new/gdb/testsuite/gdb.threads/bt-clone-stop.exp	2012-04-04 18:15:49.305543657 +0200
+Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.threads/bt-clone-stop.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.6.90.20140127/gdb/testsuite/gdb.threads/bt-clone-stop.exp	2014-02-04 23:43:33.050734976 +0100
 @@ -0,0 +1,61 @@
 +# Copyright 2006 Free Software Foundation, Inc.
 +
diff --git a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
index 082b9a0..58aadbf 100644
--- a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
+++ b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
@@ -1,11 +1,11 @@
 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
 
 
-Index: gdb-7.2.50.20110117/gdb/symtab.c
+Index: gdb-7.7.90.20140613/gdb/symtab.c
 ===================================================================
---- gdb-7.2.50.20110117.orig/gdb/symtab.c	2011-01-17 15:47:37.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/symtab.c	2011-01-17 15:51:48.000000000 +0100
-@@ -2015,6 +2015,13 @@ find_pc_sect_line (CORE_ADDR pc, struct 
+--- gdb-7.7.90.20140613.orig/gdb/symtab.c	2014-06-13 21:52:06.219338401 +0200
++++ gdb-7.7.90.20140613/gdb/symtab.c	2014-06-13 21:55:02.753531885 +0200
+@@ -2394,6 +2394,13 @@ find_pc_sect_line (CORE_ADDR pc, struct
  	     SYMBOL_LINKAGE_NAME (msymbol)); */
  	  ;
  	/* fall through */
@@ -13,9 +13,9 @@ Index: gdb-7.2.50.20110117/gdb/symtab.c
 +	   but this text symbol may be the address we were looking for.
 +	   Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop.
 +	   Red Hat Bug 218379.  */
-+	else if (SYMBOL_VALUE (mfunsym) == pc)
-+	  warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", SYMBOL_LINKAGE_NAME (msymbol), paddress (target_gdbarch, pc));
++	else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
++	  warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", MSYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc));
 +	/* fall through */
  	else
- 	  return find_pc_line (SYMBOL_VALUE_ADDRESS (mfunsym), 0);
+ 	  return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);
        }
diff --git a/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch b/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
new file mode 100644
index 0000000..044a408
--- /dev/null
+++ b/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
@@ -0,0 +1,131 @@
+Comments by Sergio Durigan Junior <sergiodj at redhat.com>:
+
+  This is the fix for RH BZ #981154
+
+  It is mainly a testcase addition, but a minor fix in the gdb/build-id.c
+  file was also needed.
+
+  gdb/build-id.c was added by:
+
+  commit dc294be54c96414035eed7d53dafdea0a6f31a72
+  Author: Tom Tromey <tromey at redhat.com>
+  Date:   Tue Oct 8 19:56:15 2013 +0000
+
+  and had a little thinko there.  The variable 'filename' needs to be set to
+  NULL after it is free'd, otherwise the code below thinks that it is still
+  valid and doesn't print the necessary warning ("Try: yum install ...").
+
+Index: gdb-7.7/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
+===================================================================
+--- /dev/null
++++ gdb-7.7/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
+@@ -0,0 +1,97 @@
++#   Copyright (C) 2014  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/>.
++
++standard_testfile "normal.c"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
++    return -1
++}
++
++# Get the build-id of the file
++set build_id_debug_file [build_id_debug_filename_get $binfile]
++regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
++
++# Run to main
++if { ![runto_main] } {
++    return -1
++}
++
++# We first need to generate a corefile
++set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
++set core_supported 0
++gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
++	"save a corefile" \
++{
++  -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
++    pass "save a corefile"
++    global core_supported
++    set core_supported 1
++  }
++  -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
++    unsupported "save a corefile"
++    global core_supported
++    set core_supported 0
++  }
++}
++
++if {!$core_supported} {
++  return -1
++}
++
++# Move the binfile to a temporary name
++remote_exec build "mv $binfile ${binfile}.old"
++
++# Reinitialize GDB and see if we get a yum warning
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++
++with_test_prefix "first run:" {
++    gdb_test "set build-id-verbose 1" "" \
++	"set build-id-verbose"
++
++    gdb_test "set debug-file-directory ${objdir}/${subdir}" "" \
++	"set debug-file-directory"
++
++    gdb_test "core-file ${objdir}/${subdir}/gcore.test" \
++	"Missing separate debuginfo for the main executable file\r\nTry: yum --enablerepo='\\*debug\\*' install $objdir/$subdir/$build_id_without_debug\r\n.*" \
++	"test first yum warning"
++}
++
++# Now we define and create our .build-id
++file mkdir [file dirname ${objdir}/${subdir}/${build_id_without_debug}]
++# Cannot use "file link" (from TCL) because it requires the target file to
++# exist.
++remote_exec build "ln -s $binfile ${objdir}/${subdir}/${build_id_without_debug}"
++
++# Reinitialize GDB to get the second yum warning
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++
++with_test_prefix "second run:" {
++    gdb_test "set build-id-verbose 1" "" \
++	"set build-id-verbose"
++
++    gdb_test "set debug-file-directory ${objdir}/${subdir}" "" \
++	"set debug-file-directory"
++
++    gdb_test "core-file ${objdir}/${subdir}/gcore.test" \
++	"Missing separate debuginfo for the main executable file\r\nTry: yum --enablerepo='\\*debug\\*' install $binfile\r\n.*" \
++	"test second yum warning"
++}
++
++# Leaving the link there will cause breakage in the next run.
++remote_exec build "rm -f ${objdir}/${subdir}/${build_id_without_debug}"
+Index: gdb-7.7/gdb/build-id.c
+===================================================================
+--- gdb-7.7.orig/gdb/build-id.c
++++ gdb-7.7/gdb/build-id.c
+@@ -588,6 +588,7 @@ build_id_to_debug_bfd (size_t build_id_l
+ 	  if (abfd == NULL)
+ 	    {
+ 	      xfree (filename);
++	      filename = NULL;
+ 	      continue;
+ 	    }
+ 
diff --git a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
new file mode 100644
index 0000000..3378717
--- /dev/null
+++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
@@ -0,0 +1,36 @@
+Index: gdb-7.6.90.20140127/gdb/proc-service.list
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/proc-service.list	2014-02-06 17:32:42.810640320 +0100
++++ gdb-7.6.90.20140127/gdb/proc-service.list	2014-02-06 17:33:35.406696964 +0100
+@@ -37,4 +37,7 @@
+   ps_pstop;
+   ps_ptread;
+   ps_ptwrite;
++
++  /* gdb-6.6-buildid-locate-rpm.patch */
++  rpmsqEnable;
+ };
+Index: gdb-7.6.90.20140127/gdb/build-id.c
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/build-id.c	2014-02-06 17:30:14.230480264 +0100
++++ gdb-7.6.90.20140127/gdb/build-id.c	2014-02-06 17:34:28.846754283 +0100
+@@ -677,6 +677,19 @@ build_id_to_filename (const struct elf_b
+ #include <dlfcn.h>
+ #endif
+ 
++/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
++   librpm must not exit() an application on SIGINT
++
++   Enable or disable a signal handler.  SIGNUM: signal to enable (or disable
++   if negative).  HANDLER: sa_sigaction handler (or NULL to use
++   rpmsqHandler()).  Returns: no. of refs, -1 on error.  */
++extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
++int
++rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
++{
++  return 0;
++}
++
+ /* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
+    and avoid their duplicities during a single inferior run.  */
+ 
diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch
new file mode 100644
index 0000000..d5533e8
--- /dev/null
+++ b/gdb-6.6-buildid-locate-rpm-scl.patch
@@ -0,0 +1,109 @@
+warning: Skipping deprecated .gdb_index section
+https://bugzilla.redhat.com/show_bug.cgi?id=953585
+
+Index: gdb-7.6.90.20140127/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/dwarf2read.c	2014-02-06 18:28:23.756232026 +0100
++++ gdb-7.6.90.20140127/gdb/dwarf2read.c	2014-02-06 18:28:48.969259122 +0100
+@@ -3035,6 +3035,14 @@ read_index_from_section (struct objfile
+      "set use-deprecated-index-sections on".  */
+   if (version < 6 && !deprecated_ok)
+     {
++      extern int rpm_verify_vendor (const char *filename);
++
++      /* Red Hat Developer Toolset exception.  */
++      if (rpm_verify_vendor (filename))
++	{}
++      else
++      {
++
+       static int warning_printed = 0;
+       if (!warning_printed)
+ 	{
+@@ -3046,6 +3054,8 @@ to use the section anyway."),
+ 	  warning_printed = 1;
+ 	}
+       return 0;
++
++      }
+     }
+   /* Version 7 indices generated by gold refer to the CU for a symbol instead
+      of the TU (for symbols coming from TUs),
+Index: gdb-7.6.90.20140127/gdb/build-id.c
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/build-id.c	2014-02-06 18:28:23.758232029 +0100
++++ gdb-7.6.90.20140127/gdb/build-id.c	2014-02-06 18:28:26.814235312 +0100
+@@ -711,7 +711,7 @@ static int missing_rpm_list_entries;
+ /* Returns the count of newly added rpms.  */
+ 
+ static int
+-missing_rpm_enlist (const char *filename)
++missing_rpm_enlist_1 (const char *filename, int verify_vendor)
+ {
+   static int rpm_init_done = 0;
+   rpmts ts;
+@@ -815,7 +815,7 @@ missing_rpm_enlist (const char *filename
+   mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
+   if (mi != NULL)
+     {
+-      for (;;)
++      if (!verify_vendor) for (;;)
+ 	{
+ 	  Header h;
+ 	  char *debuginfo, **slot, *s, *s2;
+@@ -933,6 +933,35 @@ missing_rpm_enlist (const char *filename
+ 	    xfree (debuginfo);
+ 	  count++;
+ 	}
++      else /* verify_vendor */
++	{
++	  int vendor_pass = 0, vendor_fail = 0;
++
++	  for (;;)
++	    {
++	      Header h;
++	      errmsg_t err;
++	      char *vendor;
++
++	      h = rpmdbNextIterator_p (mi);
++	      if (h == NULL)
++		break;
++
++	      vendor = headerFormat_p (h, "%{vendor}", &err);
++	      if (!vendor)
++		{
++		  warning (_("Error querying the rpm file `%s': %s"), filename,
++			   err);
++		  continue;
++		}
++	      if (strcmp (vendor, "Red Hat, Inc.") == 0)
++		vendor_pass = 1;
++	      else
++		vendor_fail = 1;
++	      xfree (vendor);
++	    }
++	  count = vendor_pass != 0 && vendor_fail == 0;
++	}
+ 
+       rpmdbFreeIterator_p (mi);
+     }
+@@ -943,6 +972,19 @@ missing_rpm_enlist (const char *filename
+ }
+ 
+ static int
++missing_rpm_enlist (const char *filename)
++{
++  return missing_rpm_enlist_1 (filename, 0);
++}
++
++extern int rpm_verify_vendor (const char *filename);
++int
++rpm_verify_vendor (const char *filename)
++{
++  return missing_rpm_enlist_1 (filename, 1);
++}
++
++static int
+ missing_rpm_list_compar (const char *const *ap, const char *const *bp)
+ {
+   return strcoll (*ap, *bp);
diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch
new file mode 100644
index 0000000..9ad7fcb
--- /dev/null
+++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch
@@ -0,0 +1,59 @@
+Index: gdb-7.5.50.20130310/gdb/solib-svr4.c
+===================================================================
+--- gdb-7.5.50.20130310.orig/gdb/solib-svr4.c	2013-03-10 16:37:49.000000000 +0100
++++ gdb-7.5.50.20130310/gdb/solib-svr4.c	2013-03-10 16:43:45.498585091 +0100
+@@ -1225,14 +1225,27 @@ svr4_read_so_list (CORE_ADDR lm, struct
+ 	}
+ 
+       {
+-	struct elf_build_id *build_id;
++	struct elf_build_id *build_id = NULL;
+ 
+ 	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 (new->lm_info->l_ld);
++	/* 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 the main executable was not loaded according to its build-id do
++	   not do any build-id checking of the libraries.  There may be missing
++	   build-ids dumped in the core file and we would map all the libraries
++	   to the only existing file loaded that time - the executable.  */
++	if (symfile_objfile != NULL
++	    && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
++	  build_id = build_id_addr_get (new->lm_info->l_ld);
+ 	if (build_id != NULL)
+ 	  {
+ 	    char *name, *build_id_filename;
+@@ -1247,23 +1260,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
+ 		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;
+-	      }
++	      debug_print_missing (new->so_name, build_id_filename);
+ 
+ 	    xfree (build_id_filename);
+ 	    xfree (build_id);
diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch
new file mode 100644
index 0000000..eb4f1d3
--- /dev/null
+++ b/gdb-6.6-buildid-locate.patch
@@ -0,0 +1,1200 @@
+Index: gdb-7.7.50.20140609/gdb/corelow.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/corelow.c	2014-06-13 20:09:37.369745221 +0200
++++ gdb-7.7.50.20140609/gdb/corelow.c	2014-06-13 20:09:42.407750265 +0200
+@@ -49,6 +49,10 @@
+ #include "gdb_bfd.h"
+ #include "completer.h"
+ #include "filestuff.h"
++#include "auxv.h"
++#include "elf/common.h"
++#include "gdbcmd.h"
++#include "build-id.h"
+ 
+ #ifndef O_LARGEFILE
+ #define O_LARGEFILE 0
+@@ -272,6 +276,53 @@ add_to_thread_list (bfd *abfd, asection
+     inferior_ptid = ptid;			/* Yes, make it current.  */
+ }
+ 
++static int build_id_core_loads = 1;
++
++static void
++build_id_locate_exec (int from_tty)
++{
++  CORE_ADDR at_entry;
++  struct elf_build_id *build_id;
++  char *execfilename, *debug_filename;
++  char *build_id_filename;
++  struct cleanup *back_to;
++
++  if (exec_bfd != NULL || symfile_objfile != NULL)
++    return;
++
++  if (target_auxv_search (&current_target, AT_ENTRY, &at_entry) <= 0)
++    return;
++
++  build_id = build_id_addr_get (at_entry);
++  if (build_id == NULL)
++    return;
++  back_to = make_cleanup (xfree, build_id);
++
++  /* SYMFILE_OBJFILE should refer to the main executable (not only to its
++     separate debug info file).  gcc44+ keeps .eh_frame only in the main
++     executable without its duplicate .debug_frame in the separate debug info
++     file - such .eh_frame would not be found if SYMFILE_OBJFILE would refer
++     directly to the separate debug info file.  */
++
++  execfilename = build_id_to_filename (build_id, &build_id_filename);
++  make_cleanup (xfree, build_id_filename);
++
++  if (execfilename != NULL)
++    {
++      make_cleanup (xfree, execfilename);
++      exec_file_attach (execfilename, from_tty);
++      symbol_file_add_main (execfilename, from_tty);
++      if (symfile_objfile != NULL)
++        symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
++    }
++  else
++    debug_print_missing (_("the main executable file"), build_id_filename);
++
++  do_cleanups (back_to);
++
++  /* No automatic SOLIB_ADD as the libraries would get read twice.  */
++}
++
+ /* This routine opens and sets up the core file bfd.  */
+ 
+ static void
+@@ -410,6 +461,14 @@ core_open (char *filename, int from_tty)
+ 	switch_to_thread (thread->ptid);
+     }
+ 
++  /* Find the build_id identifiers.  If it gets executed after
++     POST_CREATE_INFERIOR we would clash with asking to discard the already
++     loaded VDSO symbols.  If it gets executed before bfd_map_over_sections
++     INFERIOR_PTID is still not set and libthread_db initialization crashes on
++     PID == 0 in ps_pglobal_lookup.  */
++  if (build_id_core_loads != 0)
++    build_id_locate_exec (from_tty);
++
+   post_create_inferior (&core_ops, from_tty);
+ 
+   /* Now go through the target stack looking for threads since there
+@@ -1029,4 +1088,11 @@ _initialize_corelow (void)
+   init_core_ops ();
+ 
+   add_target_with_completer (&core_ops, filename_completer);
++
++  add_setshow_boolean_cmd ("build-id-core-loads", class_files,
++			   &build_id_core_loads, _("\
++Set whether CORE-FILE loads the build-id associated files automatically."), _("\
++Show whether CORE-FILE loads the build-id associated files automatically."),
++			   NULL, NULL, NULL,
++			   &setlist, &showlist);
+ }
+Index: gdb-7.7.50.20140609/gdb/doc/gdb.texinfo
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/doc/gdb.texinfo	2014-06-13 20:09:37.380745232 +0200
++++ gdb-7.7.50.20140609/gdb/doc/gdb.texinfo	2014-06-13 20:09:42.417750275 +0200
+@@ -17547,6 +17547,27 @@ information files.
+ 
+ @end table
+ 
++You can also adjust the current verbosity of the @dfn{build id} locating.
++
++ at table @code
++
++ at kindex set build-id-verbose
++ at item set build-id-verbose 0
++No additional messages are printed.
++
++ at item set build-id-verbose 1
++Missing separate debug filenames are printed.
++
++ at item set build-id-verbose 2
++Missing separate debug filenames are printed and also all the parsing of the
++binaries to find their @dfn{build id} content is printed.
++
++ at kindex show build-id-verbose
++ at item show build-id-verbose
++Show the current verbosity value for the @dfn{build id} content locating.
++
++ at end table
++
+ @cindex @code{.gnu_debuglink} sections
+ @cindex debug link sections
+ A debug link is a special section of the executable file named
+Index: gdb-7.7.50.20140609/gdb/solib-svr4.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/solib-svr4.c	2014-06-13 20:09:37.382745234 +0200
++++ gdb-7.7.50.20140609/gdb/solib-svr4.c	2014-06-13 20:09:42.418750276 +0200
+@@ -48,6 +48,7 @@
+ #include "exceptions.h"
+ #include "gdb_bfd.h"
+ #include "probe.h"
++#include "build-id.h"
+ 
+ static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
+ static int svr4_have_link_map_offsets (void);
+@@ -1369,9 +1370,52 @@ svr4_read_so_list (CORE_ADDR lm, CORE_AD
+ 	  continue;
+ 	}
+ 
+-      strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+-      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+-      strcpy (new->so_original_name, new->so_name);
++      {
++	struct elf_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 (new->lm_info->l_ld);
++	if (build_id != NULL)
++	  {
++	    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);
++	    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);
++	  }
++      }
++
+       xfree (buffer);
+ 
+       /* If this entry has no name, or its name matches the name
+Index: gdb-7.7.50.20140609/gdb/elfread.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/elfread.c	2014-06-13 20:09:37.383745235 +0200
++++ gdb-7.7.50.20140609/gdb/elfread.c	2014-06-13 20:09:42.418750276 +0200
+@@ -1335,9 +1335,10 @@ elf_symfile_read (struct objfile *objfil
+ 	   && objfile->separate_debug_objfile == NULL
+ 	   && objfile->separate_debug_objfile_backlink == NULL)
+     {
+-      char *debugfile;
++      char *debugfile, *build_id_filename;
+ 
+-      debugfile = find_separate_debug_file_by_buildid (objfile);
++      debugfile = find_separate_debug_file_by_buildid (objfile,
++						       &build_id_filename);
+ 
+       if (debugfile == NULL)
+ 	debugfile = find_separate_debug_file_by_debuglink (objfile);
+@@ -1351,6 +1352,12 @@ elf_symfile_read (struct objfile *objfil
+ 	  symbol_file_add_separate (abfd, debugfile, symfile_flags, objfile);
+ 	  do_cleanups (cleanup);
+ 	}
++      /* Check if any separate debug info has been extracted out.  */
++      else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
++	       != NULL)
++	debug_print_missing (objfile_name (objfile), build_id_filename);
++
++      xfree (build_id_filename);
+     }
+ }
+ 
+Index: gdb-7.7.50.20140609/gdb/symfile.h
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/symfile.h	2014-06-13 20:09:42.419750277 +0200
++++ gdb-7.7.50.20140609/gdb/symfile.h	2014-06-13 20:10:04.478772510 +0200
+@@ -570,6 +570,10 @@ void expand_symtabs_matching (expand_sym
+ void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
+ 			   int need_fullname);
+ 
++/* build-id support.  */
++extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr);
++extern void debug_print_missing (const char *binary, const char *debug);
++
+ /* From dwarf2read.c */
+ 
+ /* Names for a dwarf2 debugging section.  The field NORMAL is the normal
+Index: gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/gdb.exp	2014-06-13 20:09:37.384745236 +0200
++++ gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp	2014-06-13 20:09:42.420750278 +0200
+@@ -1492,6 +1492,16 @@ proc default_gdb_start { } {
+ 	    warning "Couldn't set the width to 0."
+ 	}
+     }
++    # Turn off the missing warnings as the testsuite does not expect it.
++    send_gdb "set build-id-verbose 0\n"
++    gdb_expect 10 {
++	-re "$gdb_prompt $" {
++	    verbose "Disabled the missing debug infos warnings." 2
++	}
++	timeout {
++	    warning "Could not disable the missing debug infos warnings.."
++	}
++    }
+     return 0
+ }
+ 
+Index: gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/mi-support.exp	2014-06-13 20:09:37.385745237 +0200
++++ gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp	2014-06-13 20:09:42.421750279 +0200
+@@ -212,6 +212,16 @@ proc default_mi_gdb_start { args } {
+ 	    warning "Couldn't set the width to 0."
+ 	}
+     }
++    # Turn off the missing warnings as the testsuite does not expect it.
++    send_gdb "190-gdb-set build-id-verbose 0\n"
++    gdb_expect 10 {
++	-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
++	    verbose "Disabled the missing debug infos warnings." 2
++	}
++	timeout {
++	    warning "Could not disable the missing debug infos warnings.."
++	}
++    }
+     # If allowing the inferior to have its own PTY then assign the inferior
+     # its own terminal device here.
+     if { $separate_inferior_pty } {
+Index: gdb-7.7.50.20140609/gdb/objfiles.h
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/objfiles.h	2014-06-13 20:09:37.385745237 +0200
++++ gdb-7.7.50.20140609/gdb/objfiles.h	2014-06-13 20:09:42.421750279 +0200
+@@ -464,6 +464,10 @@ struct objfile
+ 
+ #define OBJF_NOT_FILENAME (1 << 6)
+ 
++/* This file was loaded according to the BUILD_ID_CORE_LOADS rules.  */
++
++#define OBJF_BUILD_ID_CORE_LOADED (1 << 12)
++
+ /* Declarations for functions defined in objfiles.c */
+ 
+ extern struct objfile *allocate_objfile (bfd *, const char *name, int);
+Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.base/corefile.exp
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.base/corefile.exp	2014-06-13 20:09:37.385745237 +0200
++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.base/corefile.exp	2014-06-13 20:09:42.421750279 +0200
+@@ -293,3 +293,33 @@ gdb_test_multiple "core-file $corefile"
+ 	pass $test
+     }
+ }
++
++
++# Test auto-loading of binary files through build-id from the core file.
++set buildid [build_id_debug_filename_get $binfile]
++set wholetest "binfile found by build-id"
++if {$buildid == ""} {
++    untested "$wholetest (binary has no build-id)"
++} else {
++    gdb_exit
++    gdb_start
++
++    regsub {\.debug$} $buildid {} buildid
++    set debugdir ${objdir}/${subdir}/${testfile}-debugdir
++    file delete -force -- $debugdir
++    file mkdir $debugdir/[file dirname $buildid]
++    file copy $binfile $debugdir/$buildid
++
++    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 debugdir_orig $expect_out(1,string)
++	    pass $test
++	}
++    }
++    gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory"
++    gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.}
++    gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable"
++    gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
++    pass $wholetest
++}
+Index: gdb-7.7.50.20140609/gdb/build-id.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/build-id.c	2014-06-13 20:09:37.386745238 +0200
++++ gdb-7.7.50.20140609/gdb/build-id.c	2014-06-13 20:09:42.422750280 +0200
+@@ -27,11 +27,65 @@
+ #include "symfile.h"
+ #include "objfiles.h"
+ #include "filenames.h"
++#include "libbfd.h"
++#include "gdbcore.h"
++#include "gdbcmd.h"
++#include "observer.h"
++#include <sys/stat.h>
++
++#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 void
++show_build_id_verbose (struct ui_file *file, int from_tty,
++		       struct cmd_list_element *c, const char *value)
++{
++  fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"),
++		    value);
++}
++
++/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
++   FIXME: NOTE decoding should be unified with the BFD core notes decoding.  */
+ 
+-/* Locate NT_GNU_BUILD_ID from ABFD and return its content.  */
++static struct elf_build_id *
++build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size)
++{
++  bfd_byte *p;
++
++  p = buf;
++  while (p < buf + size)
++    {
++      /* FIXME: bad alignment assumption.  */
++      Elf_External_Note *xnp = (Elf_External_Note *) p;
++      size_t namesz = H_GET_32 (templ, xnp->namesz);
++      size_t descsz = H_GET_32 (templ, xnp->descsz);
++      bfd_byte *descdata = (gdb_byte *) xnp->name + BFD_ALIGN (namesz, 4);
++
++      if (H_GET_32 (templ, xnp->type) == NT_GNU_BUILD_ID
++	  && namesz == sizeof "GNU"
++	  && memcmp (xnp->name, "GNU", sizeof "GNU") == 0)
++	{
++	  size_t size = descsz;
++	  gdb_byte *data = (void *) descdata;
++	  struct elf_build_id *retval;
++
++	  retval = xmalloc (sizeof *retval - 1 + size);
++	  retval->size = size;
++	  memcpy (retval->data, data, size);
++
++	  return retval;
++	}
++      p = descdata + BFD_ALIGN (descsz, 4);
++    }
++  return NULL;
++}
+ 
++/* Separate debuginfo files have corrupted PHDR but SHDR is correct there.
++   Locate NT_GNU_BUILD_ID from ABFD and return its content.  */
++ 
+ static const struct elf_build_id *
+-build_id_bfd_get (bfd *abfd)
++build_id_bfd_shdr_get (bfd *abfd)
+ {
+   if (!bfd_check_format (abfd, bfd_object)
+       || bfd_get_flavour (abfd) != bfd_target_elf_flavour
+@@ -45,6 +99,348 @@ build_id_bfd_get (bfd *abfd)
+   return elf_tdata (abfd)->build_id;
+ }
+ 
++/* Core files may have missing (corrupt) SHDR but PDHR is correct there.
++   bfd_elf_bfd_from_remote_memory () has too much overhead by
++   allocating/reading all the available ELF PT_LOADs.  */
++
++static struct elf_build_id *
++build_id_phdr_get (bfd *templ, bfd_vma loadbase, unsigned e_phnum,
++		   Elf_Internal_Phdr *i_phdr)
++{
++  int i;
++  struct elf_build_id *retval = NULL;
++
++  for (i = 0; i < e_phnum; i++)
++    if (i_phdr[i].p_type == PT_NOTE && i_phdr[i].p_filesz > 0)
++      {
++	Elf_Internal_Phdr *hdr = &i_phdr[i];
++	gdb_byte *buf;
++	int err;
++
++	buf = xmalloc (hdr->p_filesz);
++	err = target_read_memory (loadbase + i_phdr[i].p_vaddr, buf,
++				  hdr->p_filesz);
++	if (err == 0)
++	  retval = build_id_buf_get (templ, buf, hdr->p_filesz);
++	else
++	  retval = NULL;
++	xfree (buf);
++	if (retval != NULL)
++	  break;
++      }
++  return retval;
++}
++
++/* First we validate the file by reading in the ELF header and checking
++   the magic number.  */
++
++static inline bfd_boolean
++elf_file_p (Elf64_External_Ehdr *x_ehdrp64)
++{
++  gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr));
++  gdb_assert (offsetof (Elf64_External_Ehdr, e_ident)
++	      == offsetof (Elf32_External_Ehdr, e_ident));
++  gdb_assert (sizeof (((Elf64_External_Ehdr *) 0)->e_ident)
++	      == sizeof (((Elf32_External_Ehdr *) 0)->e_ident));
++
++  return ((x_ehdrp64->e_ident[EI_MAG0] == ELFMAG0)
++	  && (x_ehdrp64->e_ident[EI_MAG1] == ELFMAG1)
++	  && (x_ehdrp64->e_ident[EI_MAG2] == ELFMAG2)
++	  && (x_ehdrp64->e_ident[EI_MAG3] == ELFMAG3));
++}
++
++/* Translate an ELF file header in external format into an ELF file header in
++   internal format.  */
++
++#define H_GET_WORD(bfd, ptr) (is64 ? H_GET_64 (bfd, (ptr))		\
++				   : H_GET_32 (bfd, (ptr)))
++#define H_GET_SIGNED_WORD(bfd, ptr) (is64 ? H_GET_S64 (bfd, (ptr))	\
++					  : H_GET_S32 (bfd, (ptr)))
++
++static void
++elf_swap_ehdr_in (bfd *abfd,
++		  const Elf64_External_Ehdr *src64,
++		  Elf_Internal_Ehdr *dst)
++{
++  int is64 = bfd_get_arch_size (abfd) == 64;
++#define SRC(field) (is64 ? src64->field \
++			 : ((const Elf32_External_Ehdr *) src64)->field)
++
++  int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
++  memcpy (dst->e_ident, SRC (e_ident), EI_NIDENT);
++  dst->e_type = H_GET_16 (abfd, SRC (e_type));
++  dst->e_machine = H_GET_16 (abfd, SRC (e_machine));
++  dst->e_version = H_GET_32 (abfd, SRC (e_version));
++  if (signed_vma)
++    dst->e_entry = H_GET_SIGNED_WORD (abfd, SRC (e_entry));
++  else
++    dst->e_entry = H_GET_WORD (abfd, SRC (e_entry));
++  dst->e_phoff = H_GET_WORD (abfd, SRC (e_phoff));
++  dst->e_shoff = H_GET_WORD (abfd, SRC (e_shoff));
++  dst->e_flags = H_GET_32 (abfd, SRC (e_flags));
++  dst->e_ehsize = H_GET_16 (abfd, SRC (e_ehsize));
++  dst->e_phentsize = H_GET_16 (abfd, SRC (e_phentsize));
++  dst->e_phnum = H_GET_16 (abfd, SRC (e_phnum));
++  dst->e_shentsize = H_GET_16 (abfd, SRC (e_shentsize));
++  dst->e_shnum = H_GET_16 (abfd, SRC (e_shnum));
++  dst->e_shstrndx = H_GET_16 (abfd, SRC (e_shstrndx));
++
++#undef SRC
++}
++
++/* Translate an ELF program header table entry in external format into an
++   ELF program header table entry in internal format.  */
++
++static void
++elf_swap_phdr_in (bfd *abfd,
++		  const Elf64_External_Phdr *src64,
++		  Elf_Internal_Phdr *dst)
++{
++  int is64 = bfd_get_arch_size (abfd) == 64;
++#define SRC(field) (is64 ? src64->field					\
++			 : ((const Elf32_External_Phdr *) src64)->field)
++
++  int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
++
++  dst->p_type = H_GET_32 (abfd, SRC (p_type));
++  dst->p_flags = H_GET_32 (abfd, SRC (p_flags));
++  dst->p_offset = H_GET_WORD (abfd, SRC (p_offset));
++  if (signed_vma)
++    {
++      dst->p_vaddr = H_GET_SIGNED_WORD (abfd, SRC (p_vaddr));
++      dst->p_paddr = H_GET_SIGNED_WORD (abfd, SRC (p_paddr));
++    }
++  else
++    {
++      dst->p_vaddr = H_GET_WORD (abfd, SRC (p_vaddr));
++      dst->p_paddr = H_GET_WORD (abfd, SRC (p_paddr));
++    }
++  dst->p_filesz = H_GET_WORD (abfd, SRC (p_filesz));
++  dst->p_memsz = H_GET_WORD (abfd, SRC (p_memsz));
++  dst->p_align = H_GET_WORD (abfd, SRC (p_align));
++
++#undef SRC
++}
++
++#undef H_GET_SIGNED_WORD
++#undef H_GET_WORD
++
++static Elf_Internal_Phdr *
++elf_get_phdr (bfd *templ, bfd_vma ehdr_vma, unsigned *e_phnum_pointer,
++              bfd_vma *loadbase_pointer)
++{
++  /* sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr)  */
++  Elf64_External_Ehdr x_ehdr64;	/* Elf file header, external form */
++  Elf_Internal_Ehdr i_ehdr;	/* Elf file header, internal form */
++  bfd_size_type x_phdrs_size;
++  gdb_byte *x_phdrs_ptr;
++  Elf_Internal_Phdr *i_phdrs;
++  int err;
++  unsigned int i;
++  bfd_vma loadbase;
++  int loadbase_set;
++
++  gdb_assert (templ != NULL);
++  gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr));
++
++  /* Read in the ELF header in external format.  */
++  err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr64, sizeof x_ehdr64);
++  if (err)
++    {
++      if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++        warning (_("build-id: Error reading ELF header at address 0x%lx"),
++		 (unsigned long) ehdr_vma);
++      return NULL;
++    }
++
++  /* Now check to see if we have a valid ELF file, and one that BFD can
++     make use of.  The magic number must match, the address size ('class')
++     and byte-swapping must match our XVEC entry.  */
++
++  if (! elf_file_p (&x_ehdr64)
++      || x_ehdr64.e_ident[EI_VERSION] != EV_CURRENT
++      || !((bfd_get_arch_size (templ) == 64
++            && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS64)
++           || (bfd_get_arch_size (templ) == 32
++	       && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS32)))
++    {
++      if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++        warning (_("build-id: Unrecognized ELF header at address 0x%lx"),
++		 (unsigned long) ehdr_vma);
++      return NULL;
++    }
++
++  /* Check that file's byte order matches xvec's */
++  switch (x_ehdr64.e_ident[EI_DATA])
++    {
++    case ELFDATA2MSB:		/* Big-endian */
++      if (! bfd_header_big_endian (templ))
++	{
++	  if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++	    warning (_("build-id: Unrecognized "
++		       "big-endian ELF header at address 0x%lx"),
++		     (unsigned long) ehdr_vma);
++	  return NULL;
++	}
++      break;
++    case ELFDATA2LSB:		/* Little-endian */
++      if (! bfd_header_little_endian (templ))
++	{
++	  if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++	    warning (_("build-id: Unrecognized "
++		       "little-endian ELF header at address 0x%lx"),
++		     (unsigned long) ehdr_vma);
++	  return NULL;
++	}
++      break;
++    case ELFDATANONE:		/* No data encoding specified */
++    default:			/* Unknown data encoding specified */
++      if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++	warning (_("build-id: Unrecognized "
++		   "ELF header endianity at address 0x%lx"),
++		 (unsigned long) ehdr_vma);
++      return NULL;
++    }
++
++  elf_swap_ehdr_in (templ, &x_ehdr64, &i_ehdr);
++
++  /* The file header tells where to find the program headers.
++     These are what we use to actually choose what to read.  */
++
++  if (i_ehdr.e_phentsize != (bfd_get_arch_size (templ) == 64
++                             ? sizeof (Elf64_External_Phdr)
++			     : sizeof (Elf32_External_Phdr))
++      || i_ehdr.e_phnum == 0)
++    {
++      if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++	warning (_("build-id: Invalid ELF program headers from the ELF header "
++		   "at address 0x%lx"), (unsigned long) ehdr_vma);
++      return NULL;
++    }
++
++  x_phdrs_size = (bfd_get_arch_size (templ) == 64 ? sizeof (Elf64_External_Phdr)
++						: sizeof (Elf32_External_Phdr));
++
++  i_phdrs = xmalloc (i_ehdr.e_phnum * (sizeof *i_phdrs + x_phdrs_size));
++  x_phdrs_ptr = (void *) &i_phdrs[i_ehdr.e_phnum];
++  err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs_ptr,
++			    i_ehdr.e_phnum * x_phdrs_size);
++  if (err)
++    {
++      free (i_phdrs);
++      if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++        warning (_("build-id: Error reading "
++		   "ELF program headers at address 0x%lx"),
++		 (unsigned long) (ehdr_vma + i_ehdr.e_phoff));
++      return NULL;
++    }
++
++  loadbase = ehdr_vma;
++  loadbase_set = 0;
++  for (i = 0; i < i_ehdr.e_phnum; ++i)
++    {
++      elf_swap_phdr_in (templ, (Elf64_External_Phdr *)
++			       (x_phdrs_ptr + i * x_phdrs_size), &i_phdrs[i]);
++      /* IA-64 vDSO may have two mappings for one segment, where one mapping
++	 is executable only, and one is read only.  We must not use the
++	 executable one (PF_R is the first one, PF_X the second one).  */
++      if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
++	{
++	  /* Only the first PT_LOAD segment indicates the file bias.
++	     Next segments may have P_VADDR arbitrarily higher.
++	     If the first segment has P_VADDR zero any next segment must not
++	     confuse us, the first one sets LOADBASE certainly enough.  */
++	  if (!loadbase_set && i_phdrs[i].p_offset == 0)
++	    {
++	      loadbase = ehdr_vma - i_phdrs[i].p_vaddr;
++	      loadbase_set = 1;
++	    }
++	}
++    }
++
++  if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE)
++    warning (_("build-id: Found ELF header at address 0x%lx, loadbase 0x%lx"),
++	     (unsigned long) ehdr_vma, (unsigned long) loadbase);
++
++  *e_phnum_pointer = i_ehdr.e_phnum;
++  *loadbase_pointer = loadbase;
++  return i_phdrs;
++}
++
++/* BUILD_ID_ADDR_GET gets ADDR located somewhere in the object.
++   Find the first section before ADDR containing an ELF header.
++   We rely on the fact the sections from multiple files do not mix.
++   FIXME: We should check ADDR is contained _inside_ the section with possibly
++   missing content (P_FILESZ < P_MEMSZ).  These omitted sections are currently
++   hidden by _BFD_ELF_MAKE_SECTION_FROM_PHDR.  */
++
++static CORE_ADDR build_id_addr;
++struct build_id_addr_sect
++  {
++    struct build_id_addr_sect *next;
++    asection *sect;
++  };
++static struct build_id_addr_sect *build_id_addr_sect;
++
++static void build_id_addr_candidate (bfd *abfd, asection *sect, void *obj)
++{
++  if (build_id_addr >= bfd_section_vma (abfd, sect))
++    {
++      struct build_id_addr_sect *candidate;
++
++      candidate = xmalloc (sizeof *candidate);
++      candidate->next = build_id_addr_sect;
++      build_id_addr_sect = candidate;
++      candidate->sect = sect;
++    }
++}
++
++struct elf_build_id *
++build_id_addr_get (CORE_ADDR addr)
++{
++  struct build_id_addr_sect *candidate;
++  struct elf_build_id *retval = NULL;
++  Elf_Internal_Phdr *i_phdr = NULL;
++  bfd_vma loadbase = 0;
++  unsigned e_phnum = 0;
++
++  if (core_bfd == NULL)
++    return NULL;
++
++  build_id_addr = addr;
++  gdb_assert (build_id_addr_sect == NULL);
++  bfd_map_over_sections (core_bfd, build_id_addr_candidate, NULL);
++
++  /* Sections are sorted in the high-to-low VMAs order.
++     Stop the search on the first ELF header we find.
++     Do not continue the search even if it does not contain NT_GNU_BUILD_ID.  */
++
++  for (candidate = build_id_addr_sect; candidate != NULL;
++       candidate = candidate->next)
++    {
++      i_phdr = elf_get_phdr (core_bfd,
++			     bfd_section_vma (core_bfd, candidate->sect),
++			     &e_phnum, &loadbase);
++      if (i_phdr != NULL)
++	break;
++    }
++
++  if (i_phdr != NULL)
++    {
++      retval = build_id_phdr_get (core_bfd, loadbase, e_phnum, i_phdr);
++      xfree (i_phdr);
++    }
++
++  while (build_id_addr_sect != NULL)
++    {
++      candidate = build_id_addr_sect;
++      build_id_addr_sect = candidate->next;
++      xfree (candidate);
++    }
++
++  return retval;
++}
++
+ /* See build-id.h.  */
+ 
+ int
+@@ -53,7 +449,7 @@ build_id_verify (bfd *abfd, size_t check
+   const struct elf_build_id *found;
+   int retval = 0;
+ 
+-  found = build_id_bfd_get (abfd);
++  found = build_id_bfd_shdr_get (abfd);
+ 
+   if (found == NULL)
+     warning (_("File \"%s\" has no build-id, file skipped"),
+@@ -68,20 +464,56 @@ build_id_verify (bfd *abfd, size_t check
+   return retval;
+ }
+ 
++static char *
++link_resolve (const char *symlink, int level)
++{
++  char buf[PATH_MAX + 1], *target, *retval;
++  ssize_t got;
++
++  if (level > 10)
++    return xstrdup (symlink);
++
++  got = readlink (symlink, buf, sizeof (buf));
++  if (got < 0 || got >= sizeof (buf))
++    return xstrdup (symlink);
++  buf[got] = '\0';
++
++  if (IS_ABSOLUTE_PATH (buf))
++    target = xstrdup (buf);
++  else
++    {
++      char *dir = ldirname (symlink);
++
++      if (dir == NULL)
++	return xstrdup (symlink);
++      target = xstrprintf ("%s"
++#ifndef HAVE_DOS_BASED_FILE_SYSTEM
++			   "/"
++#else /* HAVE_DOS_BASED_FILE_SYSTEM */
++			   "\\"
++#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
++			   "%s", dir, buf);
++    }
++
++  retval = link_resolve (target, level + 1);
++  xfree (target);
++  return retval;
++}
++
+ /* See build-id.h.  */
+ 
+ bfd *
+-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
++build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id,
++		       char **link_return, int add_debug_suffix)
+ {
+-  char *link, *debugdir;
++  char *link, *debugdir, *link_all = NULL;
+   VEC (char_ptr) *debugdir_vec;
+   struct cleanup *back_to;
+   int ix;
+   bfd *abfd = NULL;
+ 
+   /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
+-  link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+-		 + 2 * build_id_len + (sizeof ".debug" - 1) + 1);
++  link = xmalloc (strlen (debug_file_directory) + 2 * build_id_len + 50);
+ 
+   /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+      cause "/.build-id/..." lookups.  */
+@@ -94,8 +526,11 @@ build_id_to_debug_bfd (size_t build_id_l
+       size_t debugdir_len = strlen (debugdir);
+       const gdb_byte *data = build_id;
+       size_t size = build_id_len;
+-      char *s;
+       char *filename = NULL;
++      unsigned seqno;
++      struct stat statbuf_trash;
++      /* Initialize it just to avoid a GCC false warning.  */
++      char *s, *link0 = NULL, *link0_resolved;
+ 
+       memcpy (link, debugdir, debugdir_len);
+       s = &link[debugdir_len];
+@@ -109,44 +544,282 @@ build_id_to_debug_bfd (size_t build_id_l
+ 	*s++ = '/';
+       while (size-- > 0)
+ 	s += sprintf (s, "%02x", (unsigned) *data++);
+-      strcpy (s, ".debug");
++      for (seqno = 0;; seqno++)
++	{
++	  char *s2;
+ 
+-      /* lrealpath() is expensive even for the usually non-existent files.  */
+-      if (access (link, F_OK) == 0)
+-	filename = lrealpath (link);
++	  if (seqno)
++	    {
++	      /* There can be multiple build-id symlinks pointing to real files
++		 with the same build-id (such as hard links).  Some of the real
++		 files may not be installed.  */
++
++	      s2 = s + sprintf (s, ".%u", seqno);
++	    }
++	  else
++	    s2 = s;
++
++	  if (add_debug_suffix)
++	    strcpy (s2, ".debug");
++	  else
++	    *s2 = 0;
++
++	  if (!seqno)
++	    {
++	      /* If none of the real files is found report as missing file
++		 always the non-.%u-suffixed file.  */
++	      link0 = xstrdup (link);
++	    }
++
++	  /* `access' automatically dereferences LINK.  */
++	  if (lstat (link, &statbuf_trash) != 0)
++	    {
++	      /* Stop increasing SEQNO.  */
++	      break;
++	    }
++
++	  filename = lrealpath (link);
++	  if (filename == NULL)
++	    continue;
++
++	  /* We expect to be silent on the non-existing files.  */
++	  abfd = gdb_bfd_open_maybe_remote (filename);
++	  if (abfd == NULL)
++	    {
++	      xfree (filename);
++	      continue;
++	    }
+ 
+-      if (filename == NULL)
+-	continue;
++	  if (build_id_verify (abfd, build_id_len, build_id))
++	    break;
+ 
+-      /* We expect to be silent on the non-existing files.  */
+-      abfd = gdb_bfd_open_maybe_remote (filename);
+-      if (abfd == NULL)
+-	continue;
++	  gdb_bfd_unref (abfd);
++	  abfd = NULL;
+ 
+-      if (build_id_verify (abfd, build_id_len, build_id))
+-	break;
++	  xfree (filename);
++	  filename = NULL;
++	}
++
++      if (filename != NULL)
++	{
++	  /* LINK_ALL is not used below in this non-NULL FILENAME case.  */
++	  xfree (link0);
++	  break;
++	}
++
++      /* If the symlink has target request to install the target.
++         BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
++         https://bugzilla.redhat.com/show_bug.cgi?id=981154  */
++      link0_resolved = link_resolve (link0, 0);
++      xfree (link0);
++
++      if (link_all == NULL)
++	link_all = link0_resolved;
++      else
++	{
++	  size_t len_orig = strlen (link_all);
++
++	  link_all = xrealloc (link_all,
++			       len_orig + 1 + strlen (link0_resolved) + 1);
++
++	  /* Use whitespace instead of DIRNAME_SEPARATOR to be compatible with
++	     its possible use as an argument for installation command.  */
++	  link_all[len_orig] = ' ';
+ 
+-      gdb_bfd_unref (abfd);
+-      abfd = NULL;
++	  strcpy (&link_all[len_orig + 1], link0_resolved);
++	  xfree (link0_resolved);
++	}
++    }
++
++  if (link_return != NULL)
++    {
++      if (abfd != NULL)
++	{
++	  *link_return = link;
++	  link = NULL;
++	}
++      else
++	{
++	  *link_return = link_all;
++	  link_all = NULL;
++	}
+     }
++  xfree (link);
++  xfree (link_all);
+ 
+   do_cleanups (back_to);
+   return abfd;
+ }
+ 
++char *
++build_id_to_filename (const struct elf_build_id *build_id, char **link_return)
++{
++  bfd *abfd;
++  char *result;
++  
++  abfd = build_id_to_debug_bfd (build_id->size, build_id->data, link_return, 0);
++  if (abfd == NULL)
++    return NULL;
++
++  result = xstrdup (bfd_get_filename (abfd));
++  gdb_bfd_unref (abfd);
++  return result;
++}
++
++/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
++     Try to install the hash file ...
++   avoidance.  */
++
++struct missing_filepair
++  {
++    char *binary;
++    char *debug;
++    char data[1];
++  };
++
++static struct htab *missing_filepair_hash;
++static struct obstack missing_filepair_obstack;
++
++static void *
++missing_filepair_xcalloc (size_t nmemb, size_t nmemb_size)
++{
++  void *retval;
++  size_t size = nmemb * nmemb_size;
++
++  retval = obstack_alloc (&missing_filepair_obstack, size);
++  memset (retval, 0, size);
++  return retval;
++}
++
++static hashval_t
++missing_filepair_hash_func (const struct missing_filepair *elem)
++{
++  hashval_t retval = 0;
++
++  retval ^= htab_hash_string (elem->binary);
++  if (elem->debug != NULL)
++    retval ^= htab_hash_string (elem->debug);
++
++  return retval;
++}
++
++static int
++missing_filepair_eq (const struct missing_filepair *elem1,
++		       const struct missing_filepair *elem2)
++{
++  return strcmp (elem1->binary, elem2->binary) == 0
++         && ((elem1->debug == NULL) == (elem2->debug == NULL))
++         && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0);
++}
++
++static void
++missing_filepair_change (void)
++{
++  if (missing_filepair_hash != NULL)
++    {
++      obstack_free (&missing_filepair_obstack, NULL);
++      /* All their memory came just from missing_filepair_OBSTACK.  */
++      missing_filepair_hash = NULL;
++    }
++}
++
++static void
++debug_print_executable_changed (void)
++{
++  missing_filepair_change ();
++}
++
++/* Notify user the file BINARY with (possibly NULL) associated separate debug
++   information file DEBUG is missing.  DEBUG may or may not be the build-id
++   file such as would be:
++     /usr/lib/debug/.build-id/dd/b1d2ce632721c47bb9e8679f369e2295ce71be.debug
++   */
++
++void
++debug_print_missing (const char *binary, const char *debug)
++{
++  size_t binary_len0 = strlen (binary) + 1;
++  size_t debug_len0 = debug ? strlen (debug) + 1 : 0;
++  struct missing_filepair missing_filepair_find;
++  struct missing_filepair *missing_filepair;
++  struct missing_filepair **slot;
++
++  if (build_id_verbose < BUILD_ID_VERBOSE_FILENAMES)
++    return;
++
++  if (missing_filepair_hash == NULL)
++    {
++      obstack_init (&missing_filepair_obstack);
++      missing_filepair_hash = htab_create_alloc (64,
++	(hashval_t (*) (const void *)) missing_filepair_hash_func,
++	(int (*) (const void *, const void *)) missing_filepair_eq, NULL,
++	missing_filepair_xcalloc, NULL);
++    }
++
++  /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with
++     obstack_free in the case of a (rare) match.  The problem is ALLOC_F for
++     MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance
++     structures for MISSING_FILEPAIR_HASH.  Calling obstack_free would possibly
++     not to free only MISSING_FILEPAIR but also some such structures (allocated
++     during the htab_find_slot call).  */
++
++  missing_filepair_find.binary = (char *) binary;
++  missing_filepair_find.debug = (char *) debug;
++  slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
++						      &missing_filepair_find,
++						      INSERT);
++
++  /* While it may be still printed duplicitely with the missing debuginfo file
++   * it is due to once printing about the binary file build-id link and once
++   * about the .debug file build-id link as both the build-id symlinks are
++   * located in the debuginfo package.  */
++
++  if (*slot != NULL)
++    return;
++
++  missing_filepair = obstack_alloc (&missing_filepair_obstack,
++				      sizeof (*missing_filepair) - 1
++				      + binary_len0 + debug_len0);
++  missing_filepair->binary = missing_filepair->data;
++  memcpy (missing_filepair->binary, binary, binary_len0);
++  if (debug != NULL)
++    {
++      missing_filepair->debug = missing_filepair->binary + binary_len0;
++      memcpy (missing_filepair->debug, debug, debug_len0);
++    }
++  else
++    missing_filepair->debug = NULL;
++
++  *slot = missing_filepair;
++
++  /* We do not collect and flush these messages as each such message
++     already requires its own separate lines.  */
++
++  fprintf_unfiltered (gdb_stdlog,
++		      _("Missing separate debuginfo for %s\n"), binary);
++  if (debug != NULL)
++    fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
++			debug);
++}
++
+ /* See build-id.h.  */
+ 
+ char *
+-find_separate_debug_file_by_buildid (struct objfile *objfile)
++find_separate_debug_file_by_buildid (struct objfile *objfile,
++				     char **build_id_filename_return)
+ {
+   const struct elf_build_id *build_id;
+ 
+-  build_id = build_id_bfd_get (objfile->obfd);
++  if (build_id_filename_return)
++    *build_id_filename_return = NULL;
++
++  build_id = build_id_bfd_shdr_get (objfile->obfd);
+   if (build_id != NULL)
+     {
+       bfd *abfd;
+ 
+-      abfd = build_id_to_debug_bfd (build_id->size, build_id->data);
++      abfd = build_id_to_debug_bfd (build_id->size, build_id->data,
++				    build_id_filename_return, 1);
+       /* Prevent looping on a stripped .debug file.  */
+       if (abfd != NULL
+ 	  && filename_cmp (bfd_get_filename (abfd),
+@@ -166,3 +839,21 @@ find_separate_debug_file_by_buildid (str
+     }
+   return NULL;
+ }
++
++extern void _initialize_build_id (void);
++
++void
++_initialize_build_id (void)
++{
++  add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
++			    _("\
++Set debugging level of the build-id locator."), _("\
++Show debugging level of the build-id locator."), _("\
++Level 1 (default) enables printing the missing debug filenames,\n\
++level 2 also prints the parsing of binaries to find the identificators."),
++			    NULL,
++			    show_build_id_verbose,
++			    &setlist, &showlist);
++
++  observer_attach_executable_changed (debug_print_executable_changed);
++}
+Index: gdb-7.7.50.20140609/gdb/build-id.h
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/build-id.h	2014-06-13 20:09:37.386745238 +0200
++++ gdb-7.7.50.20140609/gdb/build-id.h	2014-06-13 20:09:42.422750280 +0200
+@@ -32,13 +32,18 @@ extern int build_id_verify (bfd *abfd,
+    the caller.  */
+ 
+ extern bfd *build_id_to_debug_bfd (size_t build_id_len,
+-				   const bfd_byte *build_id);
++				   const bfd_byte *build_id, char **link_return,
++				   int add_debug_suffix);
++
++extern char *build_id_to_filename (const struct elf_build_id *build_id,
++				   char **link_return);
+ 
+ /* Find the separate debug file for OBJFILE, by using the build-id
+    associated with OBJFILE's BFD.  If successful, returns a malloc'd
+    file name for the separate debug file.  The caller must free this.
+    Otherwise, returns NULL.  */
+ 
+-extern char *find_separate_debug_file_by_buildid (struct objfile *objfile);
++extern char *find_separate_debug_file_by_buildid (struct objfile *objfile,
++					       char **build_id_filename_return);
+ 
+ #endif /* BUILD_ID_H */
+Index: gdb-7.7.50.20140609/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/dwarf2read.c	2014-06-13 20:09:37.389745241 +0200
++++ gdb-7.7.50.20140609/gdb/dwarf2read.c	2014-06-13 20:09:42.425750283 +0200
+@@ -2446,7 +2446,7 @@ dwarf2_get_dwz_file (void)
+     }
+ 
+   if (dwz_bfd == NULL)
+-    dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
++    dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL, 1);
+ 
+   if (dwz_bfd == NULL)
+     error (_("could not find '.gnu_debugaltlink' file for %s"),
diff --git a/gdb-6.6-bz235197-fork-detach-info.patch b/gdb-6.6-bz235197-fork-detach-info.patch
index d7263ff..d6d9416 100644
--- a/gdb-6.6-bz235197-fork-detach-info.patch
+++ b/gdb-6.6-bz235197-fork-detach-info.patch
@@ -3,12 +3,12 @@
 	Port to GDB-6.8pre.
 	Remove the `[' character from the GDB-6.8 default message.
 
-Index: gdb-7.2.50.20110320/gdb/linux-nat.c
+Index: gdb-7.6.90.20140127/gdb/linux-nat.c
 ===================================================================
---- gdb-7.2.50.20110320.orig/gdb/linux-nat.c	2011-03-20 16:59:51.000000000 +0100
-+++ gdb-7.2.50.20110320/gdb/linux-nat.c	2011-03-20 16:59:51.000000000 +0100
-@@ -716,7 +716,7 @@ holding the child stopped.  Try \"set de
- 	      remove_breakpoints_pid (GET_PID (inferior_ptid));
+--- gdb-7.6.90.20140127.orig/gdb/linux-nat.c	2014-02-04 23:47:39.275034491 +0100
++++ gdb-7.6.90.20140127/gdb/linux-nat.c	2014-02-04 23:48:11.943074132 +0100
+@@ -426,7 +426,7 @@ holding the child stopped.  Try \"set de
+ 	      remove_breakpoints_pid (ptid_get_pid (inferior_ptid));
  	    }
  
 -	  if (info_verbose || debug_linux_nat)
@@ -16,10 +16,10 @@ Index: gdb-7.2.50.20110320/gdb/linux-nat.c
  	    {
  	      target_terminal_ours ();
  	      fprintf_filtered (gdb_stdlog,
-Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.c
+Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/fork-detach.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.c	2011-03-20 16:59:51.000000000 +0100
++++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/fork-detach.c	2014-02-04 23:47:39.275034491 +0100
 @@ -0,0 +1,57 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -78,10 +78,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.c
 +    }
 +  return 0;
 +}
-Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.exp
+Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/fork-detach.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/fork-detach.exp	2011-03-20 17:12:22.000000000 +0100
++++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/fork-detach.exp	2014-02-04 23:47:39.276034493 +0100
 @@ -0,0 +1,36 @@
 +# Copyright 2007 Free Software Foundation, Inc.
 +
diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch
index 50af796..e8e0595 100644
--- a/gdb-6.6-scheduler_locking-step-is-default.patch
+++ b/gdb-6.6-scheduler_locking-step-is-default.patch
@@ -1,8 +1,8 @@
-Index: gdb-7.3.50.20110722/gdb/infrun.c
+Index: gdb-7.7.50.20140609/gdb/infrun.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/infrun.c	2011-07-22 19:12:56.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/infrun.c	2011-07-22 19:17:06.000000000 +0200
-@@ -1549,7 +1549,7 @@ static const char *scheduler_enums[] = {
+--- gdb-7.7.50.20140609.orig/gdb/infrun.c	2014-06-13 20:08:51.225699203 +0200
++++ gdb-7.7.50.20140609/gdb/infrun.c	2014-06-13 20:08:55.515703466 +0200
+@@ -1661,7 +1661,7 @@ static const char *const scheduler_enums
    schedlock_step,
    NULL
  };
@@ -11,44 +11,52 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c
  static void
  show_scheduler_mode (struct ui_file *file, int from_tty,
  		     struct cmd_list_element *c, const char *value)
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp
+Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-cli.exp
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-console.exp	2011-01-01 16:33:47.000000000 +0100
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp	2011-07-22 19:17:06.000000000 +0200
-@@ -47,6 +47,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
+--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-cli.exp	2014-06-13 20:08:55.515703466 +0200
++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-cli.exp	2014-06-13 20:09:24.862732832 +0200
+@@ -181,7 +181,7 @@ mi_expect_stop "breakpoint-hit" "main" "
+ # Test that the token is output even for CLI commands
+ # Also test that *stopped includes frame information.
+ mi_gdb_test "34 next" \
+-    ".*34\\\^running.*\\*running,thread-id=\"all\"" \
++    ".*34\\\^running.*\\*running,thread-id=\"1\"" \
+     "34 next: run"
  
- mi_run_to_main
+ # Test that the new current source line is output to the console
+Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-logging.exp
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-logging.exp	2014-06-13 20:08:51.227699205 +0200
++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-logging.exp	2014-06-13 20:08:55.516703467 +0200
+@@ -53,7 +53,7 @@ close $chan
  
-+# thread-id=\"all\" vs. thread-id=\"1\" below:
-+mi_gdb_test "210-gdb-set scheduler-locking off" "210\\^done" "set scheduler-locking off"
-+
- # Next over the hello() call which will produce lots of output
- mi_gdb_test "220-exec-next" \
- 	    "220\\^running(\r\n\\*running,thread-id=\"all\")?" \
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp
+ set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+"
+ 
+-if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
++if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+     pass "Log file contents"
+ } else {
+     fail "Log file contents"
+@@ -76,7 +76,7 @@ set chan [open $milogfile]
+ set logcontent [read $chan]
+ close $chan
+ 
+-if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
++if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+     pass "Redirect log file contents"
+ } else {
+     fail "Redirect log file contents"
+Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-console.exp
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi2-console.exp	2011-06-23 11:40:50.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp	2011-07-22 19:17:27.000000000 +0200
-@@ -47,6 +47,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
+--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-console.exp	2014-06-13 20:08:51.227699205 +0200
++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-console.exp	2014-06-13 20:08:55.516703467 +0200
+@@ -60,6 +60,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
  
  mi_run_to_main
  
 +# thread-id=\"all\" vs. thread-id=\"1\" below:
 +mi_gdb_test "210-gdb-set scheduler-locking off" "210\\^done" "set scheduler-locking off"
 +
- # Next over the hello() call which will produce lots of output
- mi_gdb_test "220-exec-next" "220\\^running(\r\n)?(\\*running,thread-id=\"all\")?" \
- 	"Started step over hello"
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp
-===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-cli.exp	2011-04-27 12:17:38.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp	2011-07-22 19:17:06.000000000 +0200
-@@ -176,7 +176,7 @@ mi_execute_to "exec-continue" "breakpoin
- # Test that the token is output even for CLI commands
- # Also test that *stopped includes frame information.
- mi_gdb_test "34 next" \
--    ".*34\\\^running.*\\*running,thread-id=\"all\"" \
-+    ".*34\\\^running.*\\*running,thread-id=\"1\"" \
-     "34 next: run"
- 
- if {!$async} {
+ # The output we get from the target depends on how it is hosted.  If
+ # we are semihosted (e.g., the sim or a remote target that supports
+ # the File I/O remote protocol extension), we see the target I/O
diff --git a/gdb-6.8-attach-signalled-detach-stopped.patch b/gdb-6.8-attach-signalled-detach-stopped.patch
new file mode 100644
index 0000000..759dec8
--- /dev/null
+++ b/gdb-6.8-attach-signalled-detach-stopped.patch
@@ -0,0 +1,152 @@
+Index: gdb-7.7.90.20140613/gdb/linux-nat.c
+===================================================================
+--- gdb-7.7.90.20140613.orig/gdb/linux-nat.c	2014-06-13 23:03:34.364177614 +0200
++++ gdb-7.7.90.20140613/gdb/linux-nat.c	2014-06-13 23:05:07.749279122 +0200
+@@ -178,6 +178,9 @@ blocked.  */
+ static struct target_ops *linux_ops;
+ static struct target_ops linux_ops_saved;
+ 
++/* PID of the inferior stopped by SIGSTOP before attaching (or zero).  */
++static pid_t pid_was_stopped;
++
+ /* The method to call, if any, when a new thread is attached.  */
+ static void (*linux_nat_new_thread) (struct lwp_info *);
+ 
+@@ -683,7 +686,14 @@ holding the child stopped.  Try \"set de
+ 	  parent_inf->waiting_for_vfork_done = 0;
+ 	}
+       else if (detach_fork)
+-	target_detach (NULL, 0);
++	{
++	  /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
++	     In this point of code it cannot be 1 as we would not get FORK
++	     executed without CONTINUE first which resets PID_WAS_STOPPED.
++	     We would have to first TARGET_STOP and WAITPID it as with running
++	     inferior PTRACE_DETACH, SIGSTOP will ignore the signal.  */
++	  target_detach (NULL, 0);
++	}
+ 
+       /* Note that the detach above makes PARENT_INF dangling.  */
+ 
+@@ -1107,6 +1117,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
+       if (debug_linux_nat)
+ 	fprintf_unfiltered (gdb_stdlog,
+ 			    "LNPAW: Attaching to a stopped process\n");
++      pid_was_stopped = ptid_get_pid (ptid);
+ 
+       /* The process is definitely stopped.  It is in a job control
+ 	 stop, unless the kernel predates the TASK_STOPPED /
+@@ -1529,6 +1540,9 @@ get_pending_status (struct lwp_info *lp,
+ 			    gdb_signal_to_string (signo));
+     }
+ 
++  if (*status == 0 && ptid_get_pid (lp->ptid) == pid_was_stopped)
++    *status = W_STOPCODE (SIGSTOP);
++
+   return 0;
+ }
+ 
+@@ -1642,6 +1656,8 @@ linux_nat_detach (struct target_ops *ops
+     }
+   else
+     linux_ops->to_detach (ops, args, from_tty);
++
++  pid_was_stopped = 0;
+ }
+ 
+ /* Resume LP.  */
+@@ -1824,6 +1840,14 @@ linux_nat_resume (struct target_ops *ops
+       return;
+     }
+ 
++  /* At this point, we are going to resume the inferior and if we
++     have attached to a stopped process, we no longer should leave
++     it as stopped if the user detaches.  PTID variable has PID set to LWP
++     while we need to check the real PID here.  */
++
++  if (!step && lp && pid_was_stopped == ptid_get_pid (lp->ptid))
++    pid_was_stopped = 0;
++
+   if (resume_many)
+     iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
+ 
+@@ -3870,6 +3894,8 @@ linux_nat_mourn_inferior (struct target_
+ 
+   /* Let the arch-specific native code know this process is gone.  */
+   linux_nat_forget_process (pid);
++
++  pid_was_stopped = 0;
+ }
+ 
+ /* Convert a native/host siginfo object, into/from the siginfo in the
+Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.threads/attach-stopped.exp
+===================================================================
+--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.threads/attach-stopped.exp	2014-06-13 23:03:34.365177615 +0200
++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.threads/attach-stopped.exp	2014-06-13 23:03:37.162180660 +0200
+@@ -61,7 +61,65 @@ proc corefunc { threadtype } {
+     gdb_reinitialize_dir $srcdir/$subdir
+     gdb_load ${binfile}
+ 
+-    # Verify that we can attach to the stopped process.
++    # Verify that we can attach to the process by first giving its
++    # executable name via the file command, and using attach with the
++    # process ID.
++
++    set test "$threadtype: set file, before attach1 to stopped process"
++    gdb_test_multiple "file $binfile" "$test" {
++       -re "Load new symbol table from.*y or n. $" {
++	    gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
++		    "$test (re-read)"
++	}
++	-re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
++	    pass "$test"
++	}
++    }
++
++    set test "$threadtype: attach1 to stopped, after setting file"
++    gdb_test_multiple "attach $testpid" "$test" {
++	-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
++	    pass "$test"
++	}
++    }
++
++    # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
++    if {[string equal $threadtype threaded]} {
++	gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
++    } else {
++	gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
++    }
++
++    # Exit and detach the process.
++       
++    gdb_exit
++
++    # Avoid some race:
++    sleep 2
++
++    if [catch {open /proc/${testpid}/status r} fileid] {
++	set line2 "NOTFOUND"
++    } else {
++	gets $fileid line1;
++	gets $fileid line2;
++	close $fileid;
++    }
++
++    set test "$threadtype: attach1, exit leaves process stopped"
++    if {[string match "*(stopped)*" $line2]} {
++      pass $test
++    } else {
++      fail $test
++    }
++
++    # At this point, the process should still be stopped
++
++    gdb_start
++    gdb_reinitialize_dir $srcdir/$subdir
++    gdb_load ${binfile}
++
++    # Verify that we can attach to the process just by giving the
++    # process ID.
+        
+     set test "$threadtype: attach2 to stopped, after setting file"
+     gdb_test_multiple "attach $testpid" "$test" {
diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch
index d71557f..3e637c9 100644
--- a/gdb-6.8-quit-never-aborts.patch
+++ b/gdb-6.8-quit-never-aborts.patch
@@ -5,68 +5,60 @@ Some of the threads may not be properly PTRACE_DETACHed which hurts if they
 should have been detached with SIGSTOP (as they are accidentally left running
 on the debugger termination).
 
-Index: gdb-7.2.50.20110117/gdb/defs.h
+Index: gdb-7.7.90.20140613/gdb/defs.h
 ===================================================================
---- gdb-7.2.50.20110117.orig/gdb/defs.h	2011-01-17 15:47:37.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/defs.h	2011-01-17 15:53:05.000000000 +0100
-@@ -165,6 +165,7 @@ extern char *python_libdir;
- extern char *debug_file_directory;
+--- gdb-7.7.90.20140613.orig/gdb/defs.h	2014-06-13 23:10:18.876623018 +0200
++++ gdb-7.7.90.20140613/gdb/defs.h	2014-06-13 23:10:52.450660505 +0200
+@@ -174,6 +174,7 @@ extern void set_quit_flag (void);
+ /* Flag that function quit should call quit_force.  */
+ extern volatile int sync_quit_force_run;
  
- extern int quit_flag;
 +extern int quit_flag_cleanup;
  extern int immediate_quit;
- extern int sevenbit_strings;
  
-@@ -178,7 +179,7 @@ extern void quit (void);
-    needed.  */
- 
- #define QUIT { \
--  if (quit_flag) quit (); \
-+  if (quit_flag && !quit_flag_cleanup) quit (); \
-   if (deprecated_interactive_hook) deprecated_interactive_hook (); \
- }
- 
-Index: gdb-7.2.50.20110117/gdb/event-top.c
-===================================================================
---- gdb-7.2.50.20110117.orig/gdb/event-top.c	2011-01-17 15:52:39.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/event-top.c	2011-01-17 15:52:49.000000000 +0100
-@@ -904,7 +904,7 @@ async_request_quit (gdb_client_data arg)
-      is no reason to call quit again here, unless immediate_quit is
-      set.  */
- 
--  if (quit_flag || immediate_quit)
-+  if ((quit_flag || immediate_quit) && !quit_flag_cleanup)
-     quit ();
- }
- 
-Index: gdb-7.2.50.20110117/gdb/top.c
+ extern void quit (void);
+Index: gdb-7.7.90.20140613/gdb/top.c
 ===================================================================
---- gdb-7.2.50.20110117.orig/gdb/top.c	2011-01-17 15:47:37.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/top.c	2011-01-17 15:52:49.000000000 +0100
-@@ -1257,7 +1257,9 @@ quit_force (char *args, int from_tty)
-   qt.args = args;
-   qt.from_tty = from_tty;
+--- gdb-7.7.90.20140613.orig/gdb/top.c	2014-06-13 23:10:15.910619715 +0200
++++ gdb-7.7.90.20140613/gdb/top.c	2014-06-13 23:10:18.877623020 +0200
+@@ -1378,7 +1378,9 @@ quit_force (char *args, int from_tty)
+   if (ex.reason < 0) \
+     exception_print (gdb_stderr, ex)
  
 -  /* We want to handle any quit errors and exit regardless.  */
 +  /* We want to handle any quit errors and exit regardless but we should never
 +     get user-interrupted to properly detach the inferior.  */
 +  quit_flag_cleanup = 1;
-   catch_errors (quit_target, &qt,
- 	        "Quitting: ", RETURN_MASK_ALL);
  
-Index: gdb-7.2.50.20110117/gdb/utils.c
+   /* Get out of tfind mode, and kill or detach all inferiors.  */
+   DO_TRY
+Index: gdb-7.7.90.20140613/gdb/utils.c
 ===================================================================
---- gdb-7.2.50.20110117.orig/gdb/utils.c	2011-01-17 15:47:37.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/utils.c	2011-01-17 15:52:49.000000000 +0100
-@@ -121,6 +121,11 @@ int job_control;
+--- gdb-7.7.90.20140613.orig/gdb/utils.c	2014-06-13 23:10:18.878623021 +0200
++++ gdb-7.7.90.20140613/gdb/utils.c	2014-06-13 23:10:38.307644652 +0200
+@@ -125,6 +125,11 @@ int job_control;
  
- int quit_flag;
+ int immediate_quit;
  
 +/* Nonzero means we are already processing the quitting cleanups and we should
 +   no longer get aborted.  */
 +
 +int quit_flag_cleanup;
 +
- /* Nonzero means quit immediately if Control-C is typed now, rather
-    than waiting until QUIT is executed.  Be careful in setting this;
-    code which executes with immediate_quit set has to be very careful
+ /* Nonzero means that strings with character values >0x7F should be printed
+    as octal escapes.  Zero means just print the value (e.g. it's an
+    international character, and the terminal or window can cope.)  */
+Index: gdb-7.7.90.20140613/gdb/extension.c
+===================================================================
+--- gdb-7.7.90.20140613.orig/gdb/extension.c	2014-06-13 03:59:36.000000000 +0200
++++ gdb-7.7.90.20140613/gdb/extension.c	2014-06-13 23:11:32.434704853 +0200
+@@ -817,6 +817,9 @@ check_quit_flag (void)
+   int i, result = 0;
+   const struct extension_language_defn *extlang;
+ 
++  if (quit_flag_cleanup)
++    return 0;
++
+   ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
+     {
+       if (extlang->ops->check_quit_flag != NULL)
diff --git a/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch b/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
index b011658..c5937f3 100644
--- a/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
+++ b/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
@@ -1,8 +1,8 @@
-Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
+Index: gdb-7.6.90.20140127/gdb/gdb_bfd.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c	2011-07-22 19:37:15.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/dwarf2read.c	2011-07-22 19:44:42.000000000 +0200
-@@ -67,12 +67,14 @@
+--- gdb-7.6.90.20140127.orig/gdb/gdb_bfd.c	2014-02-06 17:39:46.370096290 +0100
++++ gdb-7.6.90.20140127/gdb/gdb_bfd.c	2014-02-06 17:40:14.996127247 +0100
+@@ -29,12 +29,14 @@
  #ifdef HAVE_ZLIB_H
  #include <zlib.h>
  #endif
@@ -15,37 +15,37 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
  #endif
 +#endif
  
- typedef struct symbol *symbolp;
- DEF_VEC_P (symbolp);
-@@ -1618,6 +1620,7 @@ dwarf2_read_section (struct objfile *obj
-         }
-     }
+ typedef bfd *bfdp;
+ DEF_VEC_P (bfdp);
+@@ -210,6 +212,7 @@ free_one_bfd_section (bfd *abfd, asectio
  
+   if (sect != NULL && sect->data != NULL)
+     {
 +#ifndef __sparc__
  #ifdef HAVE_MMAP
-   if (pagesize == 0)
-     pagesize = getpagesize ();
-@@ -1641,6 +1644,7 @@ dwarf2_read_section (struct objfile *obj
+       if (sect->map_addr != NULL)
+ 	{
+@@ -220,6 +223,7 @@ free_one_bfd_section (bfd *abfd, asectio
  	}
-     }
+       else
  #endif
 +#endif
+ 	xfree (sect->data);
+     }
+ }
+@@ -371,6 +375,7 @@ gdb_bfd_map_section (asection *sectp, bf
+   if (descriptor->data != NULL)
+     goto done;
  
-   /* If we get here, we are a normal, not-compressed section.  */
-   info->buffer = buf
-@@ -15983,6 +15987,7 @@ munmap_section_buffer (struct dwarf2_sec
- {
-   if (info->map_addr != NULL)
-     {
 +#ifndef __sparc__
  #ifdef HAVE_MMAP
-       int res;
- 
-@@ -15992,6 +15997,7 @@ munmap_section_buffer (struct dwarf2_sec
-       /* Without HAVE_MMAP, we should never be here to begin with.  */
-       gdb_assert_not_reached ("no mmap support");
- #endif
-+#endif
+   if (!bfd_is_section_compressed (abfd, sectp))
+     {
+@@ -405,6 +410,7 @@ gdb_bfd_map_section (asection *sectp, bf
+ 	}
      }
- }
+ #endif /* HAVE_MMAP */
++#endif
  
+   /* Handle compressed sections, or ordinary uncompressed sections in
+      the no-mmap case.  */
diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch
new file mode 100644
index 0000000..1f849d1
--- /dev/null
+++ b/gdb-archer-pie-addons-keep-disabled.patch
@@ -0,0 +1,83 @@
+Index: gdb-7.7.50.20140609/gdb/breakpoint.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/breakpoint.c	2014-06-13 20:24:34.564667225 +0200
++++ gdb-7.7.50.20140609/gdb/breakpoint.c	2014-06-13 20:24:35.650668351 +0200
+@@ -16364,6 +16364,50 @@ initialize_breakpoint_ops (void)
+ static struct cmd_list_element *enablebreaklist = NULL;
+ 
+ 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);
++}
++
++void
+ _initialize_breakpoint (void)
+ {
+   struct cmd_list_element *c;
+Index: gdb-7.7.50.20140609/gdb/breakpoint.h
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/breakpoint.h	2014-06-13 20:24:34.566667227 +0200
++++ gdb-7.7.50.20140609/gdb/breakpoint.h	2014-06-13 20:24:35.651668352 +0200
+@@ -1553,4 +1553,7 @@ extern void breakpoint_free_objfile (str
+ 
+ extern char *ep_parse_optional_if_clause (char **arg);
+ 
++extern void breakpoints_relocate (struct objfile *objfile,
++				  struct section_offsets *delta);
++
+ #endif /* !defined (BREAKPOINT_H) */
+Index: gdb-7.7.50.20140609/gdb/objfiles.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/objfiles.c	2014-06-13 20:24:35.652668353 +0200
++++ gdb-7.7.50.20140609/gdb/objfiles.c	2014-06-13 20:25:10.867704891 +0200
+@@ -820,6 +820,11 @@ objfile_relocate1 (struct objfile *objfi
+ 				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);
++
+   /* Data changed.  */
+   return 1;
+ }
diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch
new file mode 100644
index 0000000..8f7cdea
--- /dev/null
+++ b/gdb-archer-pie-addons.patch
@@ -0,0 +1,82 @@
+Index: gdb-7.7.50.20140609/gdb/gdbtypes.h
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/gdbtypes.h	2014-06-13 20:23:55.210626427 +0200
++++ gdb-7.7.50.20140609/gdb/gdbtypes.h	2014-06-13 20:24:26.156658622 +0200
+@@ -440,6 +440,7 @@ enum field_loc_kind
+   {
+     FIELD_LOC_KIND_BITPOS,	/**< bitpos */
+     FIELD_LOC_KIND_ENUMVAL,	/**< enumval */
++    /* This address is unrelocated by the objfile's ANOFFSET.  */
+     FIELD_LOC_KIND_PHYSADDR,	/**< physaddr */
+     FIELD_LOC_KIND_PHYSNAME,	/**< physname */
+     FIELD_LOC_KIND_DWARF_BLOCK	/**< dwarf_block */
+@@ -617,6 +618,7 @@ struct main_type
+ 	   field.  Otherwise, physname is the mangled label of the
+ 	   static field.  */
+ 
++	/* This address is unrelocated by the objfile's ANOFFSET.  */
+ 	CORE_ADDR physaddr;
+ 	const char *physname;
+ 
+@@ -1262,6 +1264,7 @@ extern void allocate_gnat_aux_type (stru
+ #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
+ #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
+ #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)			\
+@@ -1273,6 +1276,7 @@ extern void allocate_gnat_aux_type (stru
+ #define SET_FIELD_PHYSNAME(thisfld, name)			\
+   (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME,		\
+    FIELD_STATIC_PHYSNAME (thisfld) = (name))
++/* 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))
+@@ -1289,6 +1293,7 @@ extern void allocate_gnat_aux_type (stru
+ #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (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))
+Index: gdb-7.7.50.20140609/gdb/jv-lang.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/jv-lang.c	2014-06-13 20:23:55.211626428 +0200
++++ gdb-7.7.50.20140609/gdb/jv-lang.c	2014-06-13 20:23:56.278627534 +0200
+@@ -427,7 +427,8 @@ java_link_class_type (struct gdbarch *gd
+ 
+   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);
+@@ -475,7 +476,8 @@ java_link_class_type (struct gdbarch *gd
+ 	  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
+ 	SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
+       if (accflags & 0x8000)	/* FIELD_UNRESOLVED_FLAG */
+Index: gdb-7.7.50.20140609/gdb/value.c
+===================================================================
+--- gdb-7.7.50.20140609.orig/gdb/value.c	2014-06-13 20:23:55.212626429 +0200
++++ gdb-7.7.50.20140609/gdb/value.c	2014-06-13 20:23:56.279627535 +0200
+@@ -2783,7 +2783,8 @@ value_static_field (struct type *type, i
+     {
+     case FIELD_LOC_KIND_PHYSADDR:
+       retval = value_at_lazy (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)))));
+       break;
+     case FIELD_LOC_KIND_PHYSNAME:
+     {
diff --git a/gdb-archer.patch b/gdb-archer.patch
new file mode 100644
index 0000000..48f0b8c
--- /dev/null
+++ b/gdb-archer.patch
@@ -0,0 +1,647 @@
+http://sourceware.org/gdb/wiki/ProjectArcher
+http://sourceware.org/gdb/wiki/ArcherBranchManagement
+
+GIT snapshot:
+commit b88230edf4e2da948d633c283ba0893bf22bd7ae
+
+tromey/python
+
+
+Index: gdb-7.8/README.archer
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.8/README.archer	2014-07-29 19:29:04.861982779 +0200
+@@ -0,0 +1,2 @@
++This branch originally held the Python code for gdb.  It still exists
++because a small amount of code here has not yet been merged upstream.
+Index: gdb-7.8/gdb/Makefile.in
+===================================================================
+--- gdb-7.8.orig/gdb/Makefile.in	2014-07-29 19:29:02.665979655 +0200
++++ gdb-7.8/gdb/Makefile.in	2014-07-29 19:29:04.862982781 +0200
+@@ -1476,6 +1476,12 @@ stamp-h: $(srcdir)/config.in config.stat
+ 	  CONFIG_LINKS= \
+ 	  $(SHELL) config.status
+ 
++.gdbinit: $(srcdir)/gdbinit.in config.status
++	CONFIG_FILES=".gdbinit:gdbinit.in" \
++	  CONFIG_COMMANDS= \
++	  CONFIG_HEADERS= \
++	  $(SHELL) config.status
++
+ config.status: $(srcdir)/configure configure.tgt configure.host ../bfd/development.sh
+ 	$(SHELL) config.status --recheck
+ 
+Index: gdb-7.8/gdb/data-directory/Makefile.in
+===================================================================
+--- gdb-7.8.orig/gdb/data-directory/Makefile.in	2014-07-29 19:29:02.665979655 +0200
++++ gdb-7.8/gdb/data-directory/Makefile.in	2014-07-29 19:29:33.053022486 +0200
+@@ -66,6 +66,8 @@ PYTHON_FILE_LIST = \
+ 	gdb/xmethod.py \
+ 	gdb/command/bound_registers.py \
+ 	gdb/command/__init__.py \
++	gdb/command/ignore_errors.py \
++	gdb/command/pahole.py \
+ 	gdb/command/xmethods.py \
+ 	gdb/command/frame_filters.py \
+ 	gdb/command/type_printers.py \
+@@ -73,7 +75,10 @@ PYTHON_FILE_LIST = \
+ 	gdb/command/prompt.py \
+ 	gdb/command/explore.py \
+ 	gdb/function/__init__.py \
+-	gdb/function/strfns.py
++	gdb/function/strfns.py \
++	gdb/function/caller_is.py \
++	gdb/function/in_scope.py \
++	gdb/types.py
+ 
+ @HAVE_PYTHON_TRUE at PYTHON_FILES = $(PYTHON_FILE_LIST)
+ @HAVE_PYTHON_FALSE at PYTHON_FILES =
+Index: gdb-7.8/gdb/doc/gdb.texinfo
+===================================================================
+--- gdb-7.8.orig/gdb/doc/gdb.texinfo	2014-07-29 19:29:02.675979669 +0200
++++ gdb-7.8/gdb/doc/gdb.texinfo	2014-07-29 19:29:04.871982794 +0200
+@@ -1225,6 +1225,16 @@ for remote debugging.
+ Run using @var{device} for your program's standard input and output.
+ @c FIXME: kingdon thinks there is more to -tty.  Investigate.
+ 
++ at item -P
++ at cindex @code{-P}
++ at itemx --python
++ at cindex @code{--python}
++Change interpretation of command line so that the argument immediately
++following this switch is taken to be the name of a Python script file.
++This option stops option processing; subsequent options are passed to
++Python as @code{sys.argv}.  This option is only available if Python
++scripting support was enabled when @value{GDBN} was configured.
++
+ @c resolve the situation of these eventually
+ @item -tui
+ @cindex @code{--tui}
+Index: gdb-7.8/gdb/doc/python.texi
+===================================================================
+--- gdb-7.8.orig/gdb/doc/python.texi	2014-07-29 19:29:02.677979672 +0200
++++ gdb-7.8/gdb/doc/python.texi	2014-07-29 19:29:04.872982795 +0200
+@@ -88,8 +88,6 @@ containing @code{end}.  For example:
+ 
+ @smallexample
+ (@value{GDBP}) python
+-Type python script
+-End with a line saying just "end".
+ >print 23
+ >end
+ 23
+Index: gdb-7.8/gdb/gdb-gdb.gdb.in
+===================================================================
+--- gdb-7.8.orig/gdb/gdb-gdb.gdb.in	2014-07-29 19:29:02.677979672 +0200
++++ gdb-7.8/gdb/gdb-gdb.gdb.in	2014-07-29 19:29:04.872982795 +0200
+@@ -1,5 +1,15 @@
+ echo Setting up the environment for debugging gdb.\n
+ 
++# Set up the Python library and "require" command.
++python
++from os.path import abspath
++gdb.datadir = abspath ('@srcdir@/python/lib')
++gdb.pythonlibdir = gdb.datadir
++gdb.__path__ = [gdb.datadir + '/gdb']
++sys.path.insert(0, gdb.datadir)
++end
++source @srcdir@/python/lib/gdb/__init__.py
++
+ if !$gdb_init_done
+   set variable $gdb_init_done = 1
+ 
+Index: gdb-7.8/gdb/main.c
+===================================================================
+--- gdb-7.8.orig/gdb/main.c	2014-07-29 19:29:02.678979673 +0200
++++ gdb-7.8/gdb/main.c	2014-07-29 19:29:04.872982795 +0200
+@@ -37,6 +37,7 @@
+ 
+ #include "interps.h"
+ #include "main.h"
++#include "python/python.h"
+ #include "source.h"
+ #include "cli/cli-cmds.h"
+ #include "objfiles.h"
+@@ -417,6 +418,8 @@ captured_main (void *data)
+   char *cdarg = NULL;
+   char *ttyarg = NULL;
+ 
++  int python_script = 0;
++
+   /* These are static so that we can take their address in an
+      initializer.  */
+   static int print_help;
+@@ -624,10 +627,14 @@ captured_main (void *data)
+       {"args", no_argument, &set_args, 1},
+       {"l", required_argument, 0, 'l'},
+       {"return-child-result", no_argument, &return_child_result, 1},
++#if HAVE_PYTHON
++      {"python", no_argument, 0, 'P'},
++      {"P", no_argument, 0, 'P'},
++#endif
+       {0, no_argument, 0, 0}
+     };
+ 
+-    while (1)
++    while (!python_script)
+       {
+ 	int option_index;
+ 
+@@ -645,6 +652,9 @@ captured_main (void *data)
+ 	  case 0:
+ 	    /* Long option that just sets a flag.  */
+ 	    break;
++	  case 'P':
++	    python_script = 1;
++	    break;
+ 	  case OPT_SE:
+ 	    symarg = optarg;
+ 	    execarg = optarg;
+@@ -849,7 +859,31 @@ captured_main (void *data)
+ 
+   /* Now that gdb_init has created the initial inferior, we're in
+      position to set args for that inferior.  */
+-  if (set_args)
++  if (python_script)
++    {
++      /* The first argument is a python script to evaluate, and
++	 subsequent arguments are passed to the script for
++	 processing there.  */
++      if (optind >= argc)
++	{
++	  fprintf_unfiltered (gdb_stderr,
++			      _("%s: Python script file name required\n"),
++			      argv[0]);
++	  exit (1);
++	}
++
++      /* FIXME: should handle inferior I/O intelligently here.
++	 E.g., should be possible to run gdb in pipeline and have
++	 Python (and gdb) output go to stderr or file; and if a
++	 prompt is needed, open the tty.  */
++      quiet = 1;
++      /* FIXME: should read .gdbinit if, and only if, a prompt is
++	 requested by the script.  Though... maybe this is not
++	 ideal?  */
++      /* FIXME: likewise, reading in history.  */
++      inhibit_gdbinit = 1;
++    }
++  else if (set_args)
+     {
+       /* The remaining options are the command-line options for the
+ 	 inferior.  The first one is the sym/exec file, and the rest
+@@ -1135,7 +1169,8 @@ captured_main (void *data)
+ 
+   /* Read in the old history after all the command files have been
+      read.  */
+-  init_history ();
++  if (!python_script)
++    init_history ();
+ 
+   if (batch_flag)
+     {
+@@ -1146,13 +1181,25 @@ captured_main (void *data)
+   /* Show time and/or space usage.  */
+   do_cleanups (pre_stat_chain);
+ 
+-  /* NOTE: cagney/1999-11-07: There is probably no reason for not
+-     moving this loop and the code found in captured_command_loop()
+-     into the command_loop() proper.  The main thing holding back that
+-     change - SET_TOP_LEVEL() - has been eliminated.  */
+-  while (1)
++#if HAVE_PYTHON
++  if (python_script)
+     {
+-      catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL);
++      extern int pagination_enabled;
++      pagination_enabled = 0;
++      run_python_script (argc - optind, &argv[optind]);
++      return 1;
++    }
++  else
++#endif
++    {
++      /* NOTE: cagney/1999-11-07: There is probably no reason for not
++	 moving this loop and the code found in captured_command_loop()
++	 into the command_loop() proper.  The main thing holding back that
++	 change - SET_TOP_LEVEL() - has been eliminated. */
++      while (1)
++	{
++	  catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL);
++	}
+     }
+   /* No exit -- exit is through quit_command.  */
+ }
+@@ -1186,6 +1233,12 @@ print_gdb_help (struct ui_file *stream)
+   fputs_unfiltered (_("\
+ This is the GNU debugger.  Usage:\n\n\
+     gdb [options] [executable-file [core-file or process-id]]\n\
++    gdb [options] --args executable-file [inferior-arguments ...]\n"), stream);
++#if HAVE_PYTHON
++  fputs_unfiltered (_("\
++    gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream);
++#endif
++  fputs_unfiltered (_("\n\
+     gdb [options] --args executable-file [inferior-arguments ...]\n\n\
+ "), stream);
+   fputs_unfiltered (_("\
+@@ -1231,6 +1284,13 @@ Output and user interface control:\n\n\
+   fputs_unfiltered (_("\
+   --dbx              DBX compatibility mode.\n\
+   --xdb              XDB compatibility mode.\n\
++"), stream);
++#if HAVE_PYTHON
++  fputs_unfiltered (_("\
++  --python, -P       Following argument is Python script file; remaining\n\
++                     arguments are passed to script.\n"), stream);
++#endif
++  fputs_unfiltered (_("\
+   -q, --quiet, --silent\n\
+                      Do not print version number on startup.\n\n\
+ "), stream);
+Index: gdb-7.8/gdb/python/lib/gdb/command/ignore_errors.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.8/gdb/python/lib/gdb/command/ignore_errors.py	2014-07-29 19:29:04.872982795 +0200
+@@ -0,0 +1,37 @@
++# Ignore errors in user commands.
++
++# Copyright (C) 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/>.
++
++import gdb
++
++class IgnoreErrorsCommand (gdb.Command):
++    """Execute a single command, ignoring all errors.
++Only one-line commands are supported.
++This is primarily useful in scripts."""
++
++    def __init__ (self):
++        super (IgnoreErrorsCommand, self).__init__ ("ignore-errors",
++                                                    gdb.COMMAND_OBSCURE,
++                                                    # FIXME...
++                                                    gdb.COMPLETE_COMMAND)
++
++    def invoke (self, arg, from_tty):
++        try:
++            gdb.execute (arg, from_tty)
++        except:
++            pass
++
++IgnoreErrorsCommand ()
+Index: gdb-7.8/gdb/python/lib/gdb/command/pahole.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.8/gdb/python/lib/gdb/command/pahole.py	2014-07-29 19:29:04.873982797 +0200
+@@ -0,0 +1,81 @@
++# pahole command for gdb
++
++# Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++import gdb
++
++class Pahole (gdb.Command):
++    """Show the holes in a structure.
++This command takes a single argument, a type name.
++It prints the type and displays comments showing where holes are."""
++
++    def __init__ (self):
++        super (Pahole, self).__init__ ("pahole", gdb.COMMAND_NONE,
++                                       gdb.COMPLETE_SYMBOL)
++
++    def maybe_print_hole(self, bitpos, field_bitpos):
++        if bitpos != field_bitpos:
++            hole = field_bitpos - bitpos
++            print '  /* XXX %d bit hole, try to pack */' % hole
++
++    def pahole (self, type, level, name):
++        if name is None:
++            name = ''
++        tag = type.tag
++        if tag is None:
++            tag = ''
++        print '%sstruct %s {' % (' ' * (2 * level), tag)
++        bitpos = 0
++        for field in type.fields ():
++            # Skip static fields.
++            if not hasattr (field, ('bitpos')):
++                continue
++
++            ftype = field.type.strip_typedefs()
++
++            self.maybe_print_hole(bitpos, field.bitpos)
++            bitpos = field.bitpos
++            if field.bitsize > 0:
++                fieldsize = field.bitsize
++            else:
++                # TARGET_CHAR_BIT here...
++                fieldsize = 8 * ftype.sizeof
++
++            # TARGET_CHAR_BIT
++            print ' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)),
++            bitpos = bitpos + fieldsize
++
++            if ftype.code == gdb.TYPE_CODE_STRUCT:
++                self.pahole (ftype, level + 1, field.name)
++            else:
++                print ' ' * (2 + 2 * level),
++                print '%s %s' % (str (ftype), field.name)
++
++        if level == 0:
++            self.maybe_print_hole(bitpos, 8 * type.sizeof)
++
++        print ' ' * (14 + 2 * level),
++        print '} %s' % name
++
++    def invoke (self, arg, from_tty):
++        type = gdb.lookup_type (arg)
++        type = type.strip_typedefs ()
++        if type.code != gdb.TYPE_CODE_STRUCT:
++            raise TypeError, '%s is not a struct type' % arg
++        print ' ' * 14,
++        self.pahole (type, 0, '')
++
++Pahole()
+Index: gdb-7.8/gdb/python/lib/gdb/function/caller_is.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.8/gdb/python/lib/gdb/function/caller_is.py	2014-07-29 19:29:04.873982797 +0200
+@@ -0,0 +1,58 @@
++# Caller-is functions.
++
++# Copyright (C) 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/>.
++
++import gdb
++import re
++
++class CallerIs (gdb.Function):
++    """Return True if the calling function's name is equal to a string.
++This function takes one or two arguments.
++The first argument is the name of a function; if the calling function's
++name is equal to this argument, this function returns True.
++The optional second argument tells this function how many stack frames
++to traverse to find the calling function.  The default is 1."""
++
++    def __init__ (self):
++        super (CallerIs, self).__init__ ("caller_is")
++
++    def invoke (self, name, nframes = 1):
++        frame = gdb.selected_frame ()
++        while nframes > 0:
++            frame = frame.older ()
++            nframes = nframes - 1
++        return frame.name () == name.string ()
++
++class CallerMatches (gdb.Function):
++    """Return True if the calling function's name matches a string.
++This function takes one or two arguments.
++The first argument is a regular expression; if the calling function's
++name is matched by this argument, this function returns True.
++The optional second argument tells this function how many stack frames
++to traverse to find the calling function.  The default is 1."""
++
++    def __init__ (self):
++        super (CallerMatches, self).__init__ ("caller_matches")
++
++    def invoke (self, name, nframes = 1):
++        frame = gdb.selected_frame ()
++        while nframes > 0:
++            frame = frame.older ()
++            nframes = nframes - 1
++        return re.match (name.string (), frame.name ()) is not None
++
++CallerIs()
++CallerMatches()
+Index: gdb-7.8/gdb/python/lib/gdb/function/in_scope.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.8/gdb/python/lib/gdb/function/in_scope.py	2014-07-29 19:29:04.873982797 +0200
+@@ -0,0 +1,47 @@
++# In-scope function.
++
++# Copyright (C) 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/>.
++
++import gdb
++
++class InScope (gdb.Function):
++    """Return True if all the given variables or macros are in scope.
++Takes one argument for each variable name to be checked."""
++
++    def __init__ (self):
++	super (InScope, self).__init__ ("in_scope")
++
++    def invoke (self, *vars):
++        if len (vars) == 0:
++	    raise TypeError, "in_scope takes at least one argument"
++
++        # gdb.Value isn't hashable so it can't be put in a map.
++	# Convert to string first.
++	wanted = set (map (lambda x: x.string (), vars))
++	found = set ()
++	block = gdb.selected_frame ().block ()
++	while block:
++	    for sym in block:
++		if (sym.is_argument or sym.is_constant
++		      or sym.is_function or sym.is_variable):
++		    if sym.name in wanted:
++			found.add (sym.name)
++
++	    block = block.superblock
++
++	return wanted == found
++
++InScope ()
+Index: gdb-7.8/gdb/python/python.c
+===================================================================
+--- gdb-7.8.orig/gdb/python/python.c	2014-07-29 19:29:02.679979674 +0200
++++ gdb-7.8/gdb/python/python.c	2014-07-29 19:29:04.873982797 +0200
+@@ -95,6 +95,8 @@ const struct extension_language_defn ext
+ #include "linespec.h"
+ #include "source.h"
+ #include "version.h"
++#include "inferior.h"
++#include "gdbthread.h"
+ #include "target.h"
+ #include "gdbthread.h"
+ #include "interps.h"
+@@ -1222,6 +1224,56 @@ gdbpy_print_stack (void)
+ 
+ /* Return the current Progspace.
+    There always is one.  */
++/* True if 'gdb -P' was used, false otherwise.  */
++static int running_python_script;
++
++/* True if we are currently in a call to 'gdb.cli', false otherwise.  */
++static int in_cli;
++
++/* Enter the command loop.  */
++
++static PyObject *
++gdbpy_cli (PyObject *unused1, PyObject *unused2)
++{
++  if (! running_python_script || in_cli)
++    return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively");
++  
++  if (ui_out_is_mi_like_p (current_uiout))
++    return PyErr_Format (PyExc_RuntimeError, _("Cannot invoke CLI from MI."));
++
++  in_cli = 1;
++  current_interp_command_loop ();
++  in_cli = 0;
++
++  Py_RETURN_NONE;
++}
++
++/* Set up the Python argument vector and evaluate a script.  This is
++   used to implement 'gdb -P'.  */
++
++void
++run_python_script (int argc, char **argv)
++{
++  FILE *input;
++
++  /* We never free this, since we plan to exit at the end.  */
++  ensure_python_env (get_current_arch (), current_language);
++
++  running_python_script = 1;
++  PySys_SetArgv (argc - 1, argv + 1);
++  input = fopen (argv[0], "r");
++  if (! input)
++    {
++      fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno));
++      exit (1);
++    }
++  PyRun_SimpleFile (input, argv[0]);
++  fclose (input);
++  exit (0);
++}
++
++
++
+ 
+ static PyObject *
+ gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
+@@ -1910,6 +1962,8 @@ static PyMethodDef GdbMethods[] =
+ Evaluate command, a string, as a gdb CLI command.  Optionally returns\n\
+ a Python String containing the output of the command if to_string is\n\
+ set to True." },
++  { "cli", gdbpy_cli, METH_NOARGS,
++    "Enter the gdb CLI" },
+   { "parameter", gdbpy_parameter, METH_VARARGS,
+     "Return a gdb parameter's value" },
+ 
+Index: gdb-7.8/gdb/python/python.h
+===================================================================
+--- gdb-7.8.orig/gdb/python/python.h	2014-07-29 19:29:02.679979674 +0200
++++ gdb-7.8/gdb/python/python.h	2014-07-29 19:29:04.873982797 +0200
+@@ -25,4 +25,6 @@
+ /* This is all that python exports to gdb.  */
+ extern const struct extension_language_defn extension_language_python;
+ 
++extern void run_python_script (int argc, char **argv);
++
+ #endif /* GDB_PYTHON_H */
+Index: gdb-7.8/gdb/testsuite/gdb.gdb/selftest.exp
+===================================================================
+--- gdb-7.8.orig/gdb/testsuite/gdb.gdb/selftest.exp	2014-07-29 19:29:02.679979674 +0200
++++ gdb-7.8/gdb/testsuite/gdb.gdb/selftest.exp	2014-07-29 19:29:04.874982798 +0200
+@@ -92,6 +92,10 @@ proc do_steps_and_nexts {} {
+ 		set description "step over cmdarg_vec initialization"
+ 		set command "step"
+ 	    }
++	    -re ".*python_script = 0.*$gdb_prompt $" {
++		set description "step over python_script initialization"
++		set command "step"
++	    }
+ 	    -re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" {
+ 		set description "next over make_command_stats_cleanup and everything it calls"
+ 		set command "next"
+Index: gdb-7.8/gdb/testsuite/gdb.python/py-frame.exp
+===================================================================
+--- gdb-7.8.orig/gdb/testsuite/gdb.python/py-frame.exp	2014-07-29 19:29:02.680979676 +0200
++++ gdb-7.8/gdb/testsuite/gdb.python/py-frame.exp	2014-07-29 19:29:04.874982798 +0200
+@@ -94,3 +94,5 @@ gdb_test "python print ('result = %s' %
+ gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.read_var - success"
+ 
+ gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame"
++
++gdb_test "python print ('result = %s' % (f0.block ()))" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
+Index: gdb-7.8/gdb/testsuite/gdb.python/py-value.exp
+===================================================================
+--- gdb-7.8.orig/gdb/testsuite/gdb.python/py-value.exp	2014-07-29 19:29:02.680979676 +0200
++++ gdb-7.8/gdb/testsuite/gdb.python/py-value.exp	2014-07-29 19:29:04.874982798 +0200
+@@ -385,6 +385,15 @@ proc test_value_after_death {} {
+     "print value's type"
+ }
+ 
++# Regression test for a cast failure.  The bug was that if we cast a
++# value to its own type, gdb could crash.  This happened because we
++# could end up double-freeing a struct value.
++proc test_cast_regression {} {
++  gdb_test "python v = gdb.Value(5)" "" "create value for cast test"
++  gdb_test "python v = v.cast(v.type)" "" "cast value for cast test"
++  gdb_test "python print v" "5" "print value for cast test"
++}
++
+ # Regression test for invalid subscript operations.  The bug was that
+ # the type of the value was not being checked before allowing a
+ # subscript operation to proceed.
+@@ -514,6 +523,7 @@ test_value_in_inferior
+ test_inferior_function_call
+ test_lazy_strings
+ test_value_after_death
++test_cast_regression
+ 
+ # Test either C or C++ values. 
+ 
diff --git a/gdb-btrobust.patch b/gdb-btrobust.patch
new file mode 100644
index 0000000..0da4515
--- /dev/null
+++ b/gdb-btrobust.patch
@@ -0,0 +1,82 @@
+This should fix the error  with glib.  An error message will still be
+printed, but a default backtrace will occur in this case.
+
+--
+
+--- gdb-7.7.90.20140613/gdb/python/py-framefilter.c-orig	2014-06-13 03:59:37.000000000 +0200
++++ gdb-7.7.90.20140613/gdb/python/py-framefilter.c	2014-06-27 17:20:00.945271945 +0200
+@@ -1475,6 +1475,7 @@ gdbpy_apply_frame_filter (const struct e
+   volatile struct gdb_exception except;
+   PyObject *item;
+   htab_t levels_printed;
++  int count_printed = 0;
+ 
+   if (!gdb_python_initialized)
+     return EXT_LANG_BT_NO_FILTERS;
+@@ -1494,24 +1495,7 @@ gdbpy_apply_frame_filter (const struct e
+   iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high);
+ 
+   if (iterable == NULL)
+-    {
+-      /* Normally if there is an error GDB prints the exception,
+-	 abandons the backtrace and exits.  The user can then call "bt
+-	 no-filters", and get a default backtrace (it would be
+-	 confusing to automatically start a standard backtrace halfway
+-	 through a Python filtered backtrace).  However in the case
+-	 where GDB cannot initialize the frame filters (most likely
+-	 due to incorrect auto-load paths), GDB has printed nothing.
+-	 In this case it is OK to print the default backtrace after
+-	 printing the error message.  GDB returns EXT_LANG_BT_NO_FILTERS
+-	 here to signify there are no filters after printing the
+-	 initialization error.  This return code will trigger a
+-	 default backtrace.  */
+-
+-      gdbpy_print_stack ();
+-      do_cleanups (cleanups);
+-      return EXT_LANG_BT_NO_FILTERS;
+-    }
++    goto error_nothing_printed;
+ 
+   /* If iterable is None, then there are no frame filters registered.
+      If this is the case, defer to default GDB printing routines in MI
+@@ -1540,15 +1524,39 @@ gdbpy_apply_frame_filter (const struct e
+ 	gdbpy_print_stack ();
+ 
+       Py_DECREF (item);
++      count_printed++;
+     }
+ 
+   if (item == NULL && PyErr_Occurred ())
+-    goto error;
++    {
++      if (count_printed > 0)
++	goto error;
++      else
++	goto error_nothing_printed;
++    }
+ 
+  done:
+   do_cleanups (cleanups);
+   return success;
+ 
++  /* Normally if there is an error GDB prints the exception,
++     abandons the backtrace and exits.  The user can then call "bt
++     no-filters", and get a default backtrace (it would be
++     confusing to automatically start a standard backtrace halfway
++     through a Python filtered backtrace).  However in the case
++     where GDB cannot initialize the frame filters (most likely
++     due to incorrect auto-load paths), GDB has printed nothing.
++     In this case it is OK to print the default backtrace after
++     printing the error message.  GDB returns EXT_LANG_BT_NO_FILTERS
++     here to signify there are no filters after printing the
++     initialization error.  This return code will trigger a
++     default backtrace.  */
++
++ error_nothing_printed:
++  gdbpy_print_stack ();
++  do_cleanups (cleanups);
++  return EXT_LANG_BT_NO_FILTERS;
++
+   /* Exit and abandon backtrace on error, printing the exception that
+      is set.  */
+  error:
diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch
index 2cddac3..1ad42b9 100644
--- a/gdb-bz533176-fortran-omp-step.patch
+++ b/gdb-bz533176-fortran-omp-step.patch
@@ -21,24 +21,28 @@ debugging problem of GOMP outside of the scope of this Bug.
 
 
 
-Index: gdb-7.2.50.20101231/gdb/infrun.c
+Index: gdb-7.7.90.20140613/gdb/infrun.c
 ===================================================================
---- gdb-7.2.50.20101231.orig/gdb/infrun.c	2011-01-01 01:02:45.000000000 +0100
-+++ gdb-7.2.50.20101231/gdb/infrun.c	2011-01-01 01:10:22.000000000 +0100
-@@ -4585,6 +4585,12 @@ infrun: not switching back to stepped th
+--- gdb-7.7.90.20140613.orig/gdb/infrun.c	2014-06-13 21:59:10.835805512 +0200
++++ gdb-7.7.90.20140613/gdb/infrun.c	2014-06-13 21:59:31.064829121 +0200
+@@ -4820,6 +4820,16 @@ process_event_stop_test (struct executio
  
        if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
  	{
 +	  struct symbol *stop_fn = find_pc_function (stop_pc);
++	  struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc).minsym;
 +
-+	  if (stop_fn == NULL
-+	      || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
++	  if ((stop_fn == NULL
++	       || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
++	      /* gcc-4.7.2-9.fc19.x86_64 uses a new format.  */
++	      && (stopf == NULL
++		  || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
 +{	/* ".omp_fn." */
 +
  	  /* We're doing a "next".
  
  	     Normal (forward) execution: set a breakpoint at the
-@@ -4612,6 +4618,7 @@ infrun: not switching back to stepped th
+@@ -4855,6 +4865,7 @@ process_event_stop_test (struct executio
  
  	  keep_going (ecs);
  	  return;
@@ -46,10 +50,10 @@ Index: gdb-7.2.50.20101231/gdb/infrun.c
  	}
  
        /* If we are in a function call trampoline (a stub between the
-Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.fortran/omp-step.exp
+Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.exp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.fortran/omp-step.exp	2011-01-01 01:09:58.000000000 +0100
++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.exp	2014-06-13 21:59:22.801819481 +0200
 @@ -0,0 +1,31 @@
 +# Copyright 2009 Free Software Foundation, Inc.
 +
@@ -82,10 +86,10 @@ Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.fortran/omp-step.exp
 +
 +gdb_breakpoint [gdb_get_line_number "success"]
 +gdb_continue_to_breakpoint "success" ".*success.*"
-Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.fortran/omp-step.f90
+Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.f90
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.fortran/omp-step.f90	2011-01-01 01:09:58.000000000 +0100
++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.f90	2014-06-13 21:59:22.801819481 +0200
 @@ -0,0 +1,32 @@
 +! Copyright 2009 Free Software Foundation, Inc.
 +
diff --git a/gdb-dts-rhel6-python-compat.patch b/gdb-dts-rhel6-python-compat.patch
new file mode 100644
index 0000000..3688713
--- /dev/null
+++ b/gdb-dts-rhel6-python-compat.patch
@@ -0,0 +1,308 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=1020004
+
+Index: gdb-7.7.90.20140613/gdb/data-directory/Makefile.in
+===================================================================
+--- gdb-7.7.90.20140613.orig/gdb/data-directory/Makefile.in	2014-06-13 23:02:37.597115787 +0200
++++ gdb-7.7.90.20140613/gdb/data-directory/Makefile.in	2014-06-13 23:03:21.285163909 +0200
+@@ -60,6 +60,8 @@ PYTHON_FILES = \
+ 	gdb/frames.py \
+ 	gdb/FrameIterator.py \
+ 	gdb/FrameDecorator.py \
++	gdb/FrameWrapper.py \
++	gdb/backtrace.py \
+ 	gdb/types.py \
+ 	gdb/printing.py \
+ 	gdb/prompt.py \
+@@ -74,6 +76,7 @@ PYTHON_FILES = \
+ 	gdb/command/pretty_printers.py \
+ 	gdb/command/prompt.py \
+ 	gdb/command/explore.py \
++	gdb/command/backtrace.py \
+ 	gdb/function/__init__.py \
+ 	gdb/function/strfns.py \
+ 	gdb/function/caller_is.py \
+Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py	2014-06-13 23:02:37.598115788 +0200
+@@ -0,0 +1,122 @@
++# Wrapper API for frames.
++
++# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++import gdb
++
++# FIXME: arguably all this should be on Frame somehow.
++class FrameWrapper:
++    def __init__ (self, frame):
++        self.frame = frame;
++
++    def write_symbol (self, stream, sym, block):
++        if len (sym.linkage_name):
++            nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block)
++            if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER:
++                sym = nsym
++
++        stream.write (sym.print_name + "=")
++        try:
++            val = self.read_var (sym)
++            if val != None:
++                val = str (val)
++        # FIXME: would be nice to have a more precise exception here.
++        except RuntimeError, text:
++            val = text
++        if val == None:
++            stream.write ("???")
++        else:
++            stream.write (str (val))
++
++    def print_frame_locals (self, stream, func):
++
++        try:
++            block = self.frame.block()
++        except RuntimeError:
++            block = None
++
++        while block != None:
++            if block.is_global or block.is_static:
++                break
++
++        for sym in block:
++            if sym.is_argument:
++                continue;
++
++            self.write_symbol (stream, sym, block)
++            stream.write ('\n')
++
++    def print_frame_args (self, stream, func):
++
++        try:
++            block = self.frame.block()
++        except RuntimeError:
++            block = None
++
++        while block != None:
++            if block.function != None:
++                break
++            block = block.superblock
++
++        first = True
++        for sym in block:
++            if not sym.is_argument:
++                continue;
++
++            if not first:
++                stream.write (", ")
++
++            self.write_symbol (stream, sym, block)
++            first = False
++
++    # FIXME: this should probably just be a method on gdb.Frame.
++    # But then we need stream wrappers.
++    def describe (self, stream, full):
++        if self.type () == gdb.DUMMY_FRAME:
++            stream.write (" <function called from gdb>\n")
++        elif self.type () == gdb.SIGTRAMP_FRAME:
++            stream.write (" <signal handler called>\n")
++        else:
++            sal = self.find_sal ()
++            pc = self.pc ()
++            name = self.name ()
++            if not name:
++                name = "??"
++            if pc != sal.pc or not sal.symtab:
++                stream.write (" 0x%08x in" % pc)
++            stream.write (" " + name + " (")
++
++            func = self.function ()
++            self.print_frame_args (stream, func)
++
++            stream.write (")")
++
++            if sal.symtab and sal.symtab.filename:
++                stream.write (" at " + sal.symtab.filename)
++                stream.write (":" + str (sal.line))
++
++            if not self.name () or (not sal.symtab or not sal.symtab.filename):
++                lib = gdb.solib_name (pc)
++                if lib:
++                    stream.write (" from " + lib)
++
++            stream.write ("\n")
++
++            if full:
++                self.print_frame_locals (stream, func)
++
++    def __getattr__ (self, name):
++        return getattr (self.frame, name)
+Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py	2014-06-13 23:02:37.598115788 +0200
+@@ -0,0 +1,42 @@
++# Filtering backtrace.
++
++# Copyright (C) 2008, 2011 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++import gdb
++import itertools
++
++# Our only exports.
++__all__ = ['push_frame_filter', 'create_frame_filter']
++
++old_frame_filter = None
++
++def push_frame_filter (constructor):
++    """Register a new backtrace filter class with the 'backtrace' command.
++The filter will be passed an iterator as an argument.  The iterator
++will return gdb.Frame-like objects.  The filter should in turn act as
++an iterator returning such objects."""
++    global old_frame_filter
++    if old_frame_filter == None:
++        old_frame_filter = constructor
++    else:
++        old_frame_filter = lambda iterator, filter = frame_filter: constructor (filter(iterator))
++
++def create_frame_filter (iter):
++    global old_frame_filter
++    if old_frame_filter is None:
++        return iter
++    return old_frame_filter (iter)
++
+Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py	2014-06-13 23:02:37.598115788 +0200
+@@ -0,0 +1,106 @@
++# New backtrace command.
++
++# Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++import gdb
++import gdb.backtrace
++import itertools
++from gdb.FrameIterator import FrameIterator
++from gdb.FrameWrapper import FrameWrapper
++import sys
++
++class ReverseBacktraceParameter (gdb.Parameter):
++    """The new-backtrace command can show backtraces in 'reverse' order.
++This means that the innermost frame will be printed last.
++Note that reverse backtraces are more expensive to compute."""
++
++    set_doc = "Enable or disable reverse backtraces."
++    show_doc = "Show whether backtraces will be printed in reverse order."
++
++    def __init__(self):
++        gdb.Parameter.__init__ (self, "reverse-backtrace",
++                                gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN)
++        # Default to compatibility with gdb.
++        self.value = False
++
++class FilteringBacktrace (gdb.Command):
++    """Print backtrace of all stack frames, or innermost COUNT frames.
++With a negative argument, print outermost -COUNT frames.
++Use of the 'full' qualifier also prints the values of the local variables.
++Use of the 'raw' qualifier avoids any filtering by loadable modules.
++"""
++
++    def __init__ (self):
++        # FIXME: this is not working quite well enough to replace
++        # "backtrace" yet.
++        gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK)
++        self.reverse = ReverseBacktraceParameter()
++
++    def reverse_iter (self, iter):
++        result = []
++        for item in iter:
++            result.append (item)
++        result.reverse()
++        return result
++
++    def final_n (self, iter, x):
++        result = []
++        for item in iter:
++            result.append (item)
++        return result[x:]
++
++    def invoke (self, arg, from_tty):
++        i = 0
++        count = 0
++        filter = True
++        full = False
++
++        for word in arg.split (" "):
++            if word == '':
++                continue
++            elif word == 'raw':
++                filter = False
++            elif word == 'full':
++                full = True
++            else:
++                count = int (word)
++
++        # FIXME: provide option to start at selected frame
++        # However, should still number as if starting from newest
++        newest_frame = gdb.newest_frame()
++        iter = itertools.imap (FrameWrapper,
++                               FrameIterator (newest_frame))
++        if filter:
++            iter = gdb.backtrace.create_frame_filter (iter)
++
++        # Now wrap in an iterator that numbers the frames.
++        iter = itertools.izip (itertools.count (0), iter)
++
++        # Reverse if the user wanted that.
++        if self.reverse.value:
++            iter = self.reverse_iter (iter)
++
++        # Extract sub-range user wants.
++        if count < 0:
++            iter = self.final_n (iter, count)
++        elif count > 0:
++            iter = itertools.islice (iter, 0, count)
++
++        for pair in iter:
++            sys.stdout.write ("#%-2d" % pair[0])
++            pair[1].describe (sys.stdout, full)
++
++FilteringBacktrace()
diff --git a/gdb-enable-count-crash.patch b/gdb-enable-count-crash.patch
new file mode 100644
index 0000000..9461ee9
--- /dev/null
+++ b/gdb-enable-count-crash.patch
@@ -0,0 +1,86 @@
+http://sourceware.org/ml/gdb-patches/2013-06/msg00788.html
+Subject: [PATCH] "enable count" user input error handling (PR gdb/15678)
+
+Typing "enable count" by itself crashes GDB. Also, if you omit the
+breakpoint number/range, the error message is not very clear:
+
+(gdb) enable count 2
+warning: bad breakpoint number at or near ''
+(gdb) enable count
+Segmentation fault (core dumped)
+
+With this patch, the error messages are slightly more helpful:
+
+(gdb) enable count 2
+Argument required (one or more breakpoint numbers).
+(gdb) enable count
+Argument required (hit count).
+
+They are not as helpful to the user as I would like, but it's better
+than crashing. Suggestions are welcome.
+
+Simon
+
+gdb/ChangeLog:
+2013-06-26  Simon Marchi  <simon.marchi at ericsson.com>
+
+	* breakpoint.c (map_breakpoint_numbers): Check for empty args
+	string.
+	(enable_count_command): Check args for NULL value.
+
+gdb/testsuite/ChangeLog:
+2013-06-26  Simon Marchi  <simon.marchi at ericsson.com>
+
+	* gdb.base/ena-dis-br.exp: Test "enable count" for bad user input.
+---
+ gdb/breakpoint.c                      | 9 +++++++--
+ gdb/testsuite/gdb.base/ena-dis-br.exp | 8 ++++++++
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
+index ccd05d9..5a0c5ab 100644
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -14389,7 +14389,7 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *,
+   int match;
+   struct get_number_or_range_state state;
+
+-  if (args == 0)
++  if (args == 0 || *args == '\0')
+     error_no_arg (_("one or more breakpoint numbers"));
+
+   init_number_or_range (&state, args);
+@@ -14713,7 +14713,12 @@ do_map_enable_count_breakpoint (struct breakpoint *bpt, void *countptr)
+ static void
+ enable_count_command (char *args, int from_tty)
+ {
+-  int count = get_number (&args);
++  int count;
++
++  if (args == NULL)
++    error_no_arg (_("hit count"));
++
++  count = get_number (&args);
+
+   map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
+ }
+diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
+index b08b709..82aef64 100644
+--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
++++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
+@@ -173,6 +173,14 @@ set bp [break_at $bp_location7 "line $bp_location7"]
+
+ set bp2 [break_at marker1 " line ($bp_location15|$bp_location16)"]
+
++gdb_test "enable count" \
++    "Argument required \\(hit count\\)\\." \
++    "enable count missing arguments"
++
++gdb_test "enable count 2" \
++    "Argument required \\(one or more breakpoint numbers\\)\\." \
++    "enable count missing last argument"
++
+ gdb_test_no_output "enable count 2 $bp" "disable break with count"
+
+ gdb_test "continue" \
+
diff --git a/gdb-gdb-add-index-script.patch b/gdb-gdb-add-index-script.patch
index c15df68..da88642 100644
--- a/gdb-gdb-add-index-script.patch
+++ b/gdb-gdb-add-index-script.patch
@@ -40,16 +40,14 @@ Subject: [PATCH 4/4] add gdb-add-index
  5 files changed, 57 insertions(+), 1 deletions(-)
  create mode 100755 gdb/gdb-add-index
 
-Index: gdb-7.4.50.20120103/gdb/Makefile.in
+Index: gdb-7.6.90.20140127/gdb/Makefile.in
 ===================================================================
---- gdb-7.4.50.20120103.orig/gdb/Makefile.in	2012-01-03 05:53:25.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/Makefile.in	2012-01-03 15:24:25.693543435 +0100
-@@ -1033,7 +1033,16 @@ install-only: install-gstack $(CONFIG_IN
- 		$(INSTALL_DATA) $(srcdir)/gdb.1 \
- 			$(DESTDIR)$(man1dir)/$$transformed_name.1 ; \
- 		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
--		$(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
-+		$(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h; \
+--- gdb-7.6.90.20140127.orig/gdb/Makefile.in	2014-02-06 17:37:54.555975958 +0100
++++ gdb-7.6.90.20140127/gdb/Makefile.in	2014-02-06 17:38:52.110038415 +0100
+@@ -1093,6 +1093,15 @@ install-only: install-gstack $(CONFIG_IN
+ 		  $(INSTALL_SCRIPT) gcore \
+ 			  $(DESTDIR)$(bindir)/$$transformed_name; \
+ 	fi
 +	transformed_name=`t='$(program_transform_name)'; \
 +			  echo gdb-add-index | sed -e "$$t"` ; \
 +		if test "x$$transformed_name" = x; then \
@@ -57,16 +55,16 @@ Index: gdb-7.4.50.20120103/gdb/Makefile.in
 +		else \
 +		  true ; \
 +		fi ; \
-+		$(INSTALL_PROGRAM) $(srcdir)/gdb-add-index \
++		$(INSTALL_PROGRAM) $(srcdir)/contrib/gdb-add-index.sh \
 +			$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT)
  	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
  
- install-python:
-Index: gdb-7.4.50.20120103/gdb/doc/gdb.texinfo
+ install-strip:
+Index: gdb-7.6.90.20140127/gdb/doc/gdb.texinfo
 ===================================================================
---- gdb-7.4.50.20120103.orig/gdb/doc/gdb.texinfo	2012-01-03 15:20:54.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/doc/gdb.texinfo	2012-01-03 15:23:43.295231946 +0100
-@@ -16228,6 +16228,14 @@ There are currently some limitation on i
+--- gdb-7.6.90.20140127.orig/gdb/doc/gdb.texinfo	2014-02-06 17:37:50.822971940 +0100
++++ gdb-7.6.90.20140127/gdb/doc/gdb.texinfo	2014-02-06 17:37:54.565975968 +0100
+@@ -17749,6 +17749,14 @@ There are currently some limitation on i
  for DWARF debugging information, not stabs.  And, they do not
  currently work for programs using Ada.
  
@@ -81,38 +79,93 @@ Index: gdb-7.4.50.20120103/gdb/doc/gdb.texinfo
  @node Symbol Errors
  @section Errors Reading Symbol Files
  
-Index: gdb-7.4.50.20120103/gdb/gdb-add-index
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120103/gdb/gdb-add-index	2012-01-03 15:23:43.296231942 +0100
-@@ -0,0 +1,30 @@
-+#! /bin/sh
+@@ -43878,6 +43886,7 @@ switch (die->tag)
+ * gdbserver man::               Remote Server for the GNU Debugger man page
+ * gcore man::                   Generate a core file of a running program
+ * gdbinit man::                 gdbinit scripts
++* gdb-add-index man::           Add index files to speed up GDB
+ @end menu
+ 
+ @node gdb man
+@@ -44530,6 +44539,54 @@ gdb(1), @code{info -f gdb -n Startup}
+ The full documentation for @value{GDBN} is maintained as a Texinfo manual.
+ If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
+ documentation are properly installed at your site, the command
++
++ at smallexample
++info gdb
++ at end smallexample
++
++should give you access to the complete manual.
++
++ at cite{Using GDB: A Guide to the GNU Source-Level Debugger},
++Richard M. Stallman and Roland H. Pesch, July 1991.
++ at end ifset
++ at c man end
 +
-+# Add a .gdb_index section to a file.
++ at node gdb-add-index man
++ at heading gdb-add-index
 +
-+# Copyright (C) 2010 Free Software Foundation, Inc.
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ at c man title gdb-add-index Add index files to speed up GDB
 +
-+file="$1"
-+dir="${file%/*}"
++ at c man begin SYNOPSIS gdb-add-index
++gdb-add-index @var{filename}
++ at c man end
 +
-+# We don't care if gdb gives an error.
-+gdb -nx --batch-silent -ex "file $file" -ex "save gdb-index $dir"
++ at c man begin DESCRIPTION gdb-add-index
++When GDB finds a symbol file, it scans the symbols in the file in order
++to construct an internal symbol table.  This lets most GDB operations
++work quickly--at the cost of a delay early on.  For large programs,
++this delay can be quite lengthy, so GDB provides a way to build an
++index, which speeds up startup.
 +
-+if test -f "${file}.gdb-index"; then
-+   objcopy --add-section .gdb_index="${file}.gdb-index" --set-section-flags .gdb_index=readonly "$file" "$file"
-+   rm -f "${file}.gdb-index"
-+fi
++To determine whether a file contains such an index, use the command
++ at command{readelf -S filename}: the index is stored in a section named
++ at code{.gdb_index}.  Note that the index is never generated for files that do
++not contain DWARF debug information (sections named @code{.debug_*}).
++
++See more in
++ at ifset man
++the @value{GDBN} manual in node @code{Index Files}
++-- shell command @code{info -f gdb -n 'Index Files'}.
++ at end ifset
++ at ifclear man
++ at ref{Index Files}.
++ at end ifclear
++ at c man end
++
++ at c man begin SEEALSO gdb-add-index
++ at ifset man
++The full documentation for @value{GDBN} is maintained as a Texinfo manual.
++If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
++documentation are properly installed at your site, the command
+ 
+ @smallexample
+ info gdb
+Index: gdb-7.6.90.20140127/gdb/doc/Makefile.in
+===================================================================
+--- gdb-7.6.90.20140127.orig/gdb/doc/Makefile.in	2014-02-06 17:37:50.824971942 +0100
++++ gdb-7.6.90.20140127/gdb/doc/Makefile.in	2014-02-06 17:37:54.565975968 +0100
+@@ -165,7 +165,7 @@ POD2MAN5 = pod2man --center="GNU Develop
+ 		   --release="gdb-`sed q version.subst`" --section=5
+ 
+ # List of man pages generated from gdb.texi
+-MAN1S = gdb.1 gdbserver.1 gcore.1
++MAN1S = gdb.1 gdbserver.1 gcore.1 gdb-add-index.1
+ MAN5S = gdbinit.5
+ MANS = $(MAN1S) $(MAN5S)
+ 
+@@ -590,6 +590,13 @@ gcore.1: $(GDB_DOC_FILES)
+ 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
+ 	rm -f gcore.pod
+ 
++gdb-add-index.1: $(GDB_DOC_FILES)
++	touch $@
++	-$(TEXI2POD) $(MANCONF) -Dgdb-add-index < $(srcdir)/gdb.texinfo > gdb-add-index.pod
++	-($(POD2MAN1) gdb-add-index.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
++		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
++	rm -f gdb-add-index.pod
 +
-+exit 0
+ gdbinit.5: $(GDB_DOC_FILES)
+ 	touch $@
+ 	-$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod
diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch
new file mode 100644
index 0000000..3c0c042
--- /dev/null
+++ b/gdb-glibc-strstr-workaround.patch
@@ -0,0 +1,144 @@
+Index: gdb-7.7.90.20140613/gdb/dwarf2read.c
+===================================================================
+--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c	2014-06-13 21:56:54.744653443 +0200
++++ gdb-7.7.90.20140613/gdb/dwarf2read.c	2014-06-13 22:01:51.529990684 +0200
+@@ -17695,6 +17695,26 @@ new_symbol_full (struct die_info *die, s
+       /* Cache this symbol's name and the name's demangled form (if any).  */
+       SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
+       linkagename = dwarf2_physname (name, die, cu);
++
++      /* Workaround for:
++       * invalid IFUNC DW_AT_linkage_name: memmove strstr time
++       * http://sourceware.org/bugzilla/show_bug.cgi?id=14166  */
++      if (strcmp (linkagename, "strstr") == 0
++	  && strstr (objfile_name (objfile), "/libc") != NULL)
++	{
++	  struct objfile *objfile_msym;
++	  struct bound_minimal_symbol bmsym;
++
++	  if (objfile->separate_debug_objfile_backlink)
++	    objfile_msym = objfile->separate_debug_objfile_backlink;
++	  else
++	    objfile_msym = objfile;
++	  bmsym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
++	  if (bmsym.minsym != NULL
++	      && MSYMBOL_TYPE (bmsym.minsym) == mst_text_gnu_ifunc)
++	    linkagename = "__strstr";
++	}
++
+       SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
+ 
+       /* Fortran does not have mangling standard and the mangling does differ
+Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp	2014-06-13 21:59:41.174840871 +0200
+@@ -0,0 +1,108 @@
++# Copyright (C) 2012 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/>.
++
++# Workaround for:
++# invalid IFUNC DW_AT_linkage_name: memmove strstr time
++# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
++
++if {[skip_shlib_tests]} {
++    return 0
++}
++
++set testfile "gnu-ifunc-strstr-workaround"
++set executable ${testfile}
++set srcfile start.c
++set binfile ${objdir}/${subdir}/${executable}
++
++if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
++    return -1
++}
++
++if ![runto_main] {
++    return 0
++}
++
++set test "ptype atoi"
++gdb_test_multiple $test $test {
++    -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
++	pass $test
++    }
++    -re "type = int \\(\\)\r\n$gdb_prompt $" {
++	untested "$test (no DWARF)"
++	return 0
++    }
++}
++
++set addr ""
++set test "print strstr"
++gdb_test_multiple $test $test {
++    -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
++	set addr $expect_out(1,string)
++	pass $test
++    }
++    -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
++	set addr $expect_out(1,string)
++	pass "$test (GDB workaround)"
++    }
++    -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" {
++	set addr $expect_out(1,string)
++	pass "$test (fixed glibc)"
++    }
++    -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
++	untested "$test (gnu-ifunc not in use by glibc)"
++	return 0
++    }
++}
++
++set test "info sym"
++gdb_test_multiple "info sym $addr" $test {
++    -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
++	pass $test
++    }
++    -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
++	# unexpected
++	xfail "$test (not in libc.so.6)"
++	return 0
++    }
++}
++
++set test "info addr strstr"
++gdb_test_multiple $test $test {
++    -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
++	fail "$test (DWARF for strstr)"
++    }
++    -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
++	pass "$test"
++    }
++}
++
++set test "print strstr second time"
++gdb_test_multiple "print strstr" $test {
++    -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
++	pass $test
++    }
++    -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
++	pass "$test (GDB workaround)"
++    }
++    -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr>\r\n$gdb_prompt $" {
++	pass "$test (fixed glibc)"
++    }
++    -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
++	fail $test
++    }
++}
++
++gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
++gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
diff --git a/gdb-gnat-dwarf-crash-3of3.patch b/gdb-gnat-dwarf-crash-3of3.patch
new file mode 100644
index 0000000..3f57fd3
--- /dev/null
+++ b/gdb-gnat-dwarf-crash-3of3.patch
@@ -0,0 +1,58 @@
+http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html
+Subject: [patch] gdb_assert -> complaint for weird DWARF
+
+
+--6TrnltStXW4iwmi0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+
+Hi,
+
+PR 16581:
+	GDB crash on inherit_abstract_dies infinite recursion
+	https://sourceware.org/bugzilla/show_bug.cgi?id=16581
+
+fixed crash from an infinite recursion.  But in rare cases the new code can
+now gdb_assert() due to weird DWARF file.
+
+I do not yet fully understand why the DWARF is as it is but just GDB should
+never crash due to invalid DWARF anyway.  The "invalid" DWARF I see only in
+Fedora GCC build, not in FSF GCC build, more info at:
+	https://bugzilla.redhat.com/show_bug.cgi?id=1069382
+	http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug
+
+
+Thanks,
+Jan
+
+--6TrnltStXW4iwmi0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline; filename="complaint.patch"
+
+gdb/
+2014-02-24  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* dwarf2read.c (process_die): Change gdb_assert to complaint.
+
+diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+index 3eaa0b1..71f5d34 100644
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -8029,7 +8029,13 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+   struct cleanup *in_process;
+ 
+   /* We should only be processing those not already in process.  */
+-  gdb_assert (!die->in_process);
++  if (die->in_process)
++    {
++      complaint (&symfile_complaints,
++		 _("DIE at 0x%x attempted to be processed twice"),
++		 die->offset.sect_off);
++      return;
++    }
+ 
+   die->in_process = 1;
+   in_process = make_cleanup (reset_die_in_process,die);
+
+--6TrnltStXW4iwmi0--
+
diff --git a/gdb-python-gil.patch b/gdb-python-gil.patch
new file mode 100644
index 0000000..b2d9de9
--- /dev/null
+++ b/gdb-python-gil.patch
@@ -0,0 +1,224 @@
+diff -dup -ruNp gdb-7.8-orig/gdb/doc/python.texi gdb-7.8/gdb/doc/python.texi
+--- gdb-7.8-orig/gdb/doc/python.texi	2014-08-13 22:04:14.162441271 +0200
++++ gdb-7.8/gdb/doc/python.texi	2014-08-13 22:07:20.894643853 +0200
+@@ -228,6 +228,14 @@ returned as a string.  The default is @c
+ return value is @code{None}.  If @var{to_string} is @code{True}, the
+ @value{GDBN} virtual terminal will be temporarily set to unlimited width
+ and height, and its pagination will be disabled; @pxref{Screen Size}.
++
++The @var{release_gil} flag specifies whether @value{GDBN} ought to
++release the Python GIL before executing the command.  This is useful
++in multi-threaded Python programs where by default the Python
++interpreter will acquire the GIL and lock other threads from
++executing.  After the command has completed executing in @value{GDBN}
++the Python GIL is reacquired. This flag must be a boolean value.  If
++omitted, it defaults to @code{False}.
+ @end defun
+ 
+ @findex gdb.breakpoints
+diff -dup -ruNp gdb-7.8-orig/gdb/python/python-internal.h gdb-7.8/gdb/python/python-internal.h
+--- gdb-7.8-orig/gdb/python/python-internal.h	2014-08-13 22:04:14.835441977 +0200
++++ gdb-7.8/gdb/python/python-internal.h	2014-08-13 22:07:20.895643867 +0200
+@@ -143,6 +143,8 @@ typedef int Py_ssize_t;
+ #define PyGILState_Release(ARG) ((void)(ARG))
+ #define PyEval_InitThreads()
+ #define PyThreadState_Swap(ARG) ((void)(ARG))
++#define PyEval_SaveThread() ((void)(ARG))
++#define PyEval_RestoreThread(ARG) ((void)(ARG))
+ #define PyEval_ReleaseLock()
+ #endif
+ 
+diff -dup -ruNp gdb-7.8-orig/gdb/python/python.c gdb-7.8/gdb/python/python.c
+--- gdb-7.8-orig/gdb/python/python.c	2014-08-13 22:04:14.164441273 +0200
++++ gdb-7.8/gdb/python/python.c	2014-08-13 22:07:20.895643867 +0200
+@@ -620,14 +620,19 @@ execute_gdb_command (PyObject *self, PyO
+ {
+   const char *arg;
+   PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
+-  int from_tty, to_string;
++  PyObject *release_gil_obj = NULL;
++  int from_tty, to_string, release_gil;
+   volatile struct gdb_exception except;
+-  static char *keywords[] = {"command", "from_tty", "to_string", NULL };
++  static char *keywords[] = {"command", "from_tty", "to_string",
++			     "release_gil", NULL };
+   char *result = NULL;
++  /* Initialize it just to avoid a GCC false warning.  */
++  PyThreadState *state = NULL;
+ 
+-  if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg,
++  if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!O!", keywords, &arg,
+ 				     &PyBool_Type, &from_tty_obj,
+-				     &PyBool_Type, &to_string_obj))
++				     &PyBool_Type, &to_string_obj,
++				     &PyBool_Type, &release_gil_obj))
+     return NULL;
+ 
+   from_tty = 0;
+@@ -648,12 +652,28 @@ execute_gdb_command (PyObject *self, PyO
+       to_string = cmp;
+     }
+ 
++  release_gil = 0;
++  if (release_gil_obj)
++    {
++      int cmp = PyObject_IsTrue (release_gil_obj);
++      if (cmp < 0)
++	return NULL;
++      release_gil = cmp;
++    }
++
+   TRY_CATCH (except, RETURN_MASK_ALL)
+     {
+       /* Copy the argument text in case the command modifies it.  */
+       char *copy = xstrdup (arg);
+       struct cleanup *cleanup = make_cleanup (xfree, copy);
+ 
++      /* In the case of long running GDB commands, allow the user to
++	 release the Python GIL acquired by Python.  Restore the GIL
++	 after the command has completed before handing back to
++	 Python.  */
++      if (release_gil)
++	state = PyEval_SaveThread();
++
+       make_cleanup_restore_integer (&interpreter_async);
+       interpreter_async = 0;
+ 
+@@ -666,9 +686,21 @@ execute_gdb_command (PyObject *self, PyO
+ 	  execute_command (copy, from_tty);
+ 	}
+ 
++      /* Reacquire the GIL if it was released earlier.  */
++      if (release_gil)
++	PyEval_RestoreThread (state);
++
+       do_cleanups (cleanup);
+     }
+-  GDB_PY_HANDLE_EXCEPTION (except);
++  if (except.reason < 0)
++    {
++      /* Reacquire the GIL if it was released earlier.  */
++      if (release_gil)
++	PyEval_RestoreThread (state);
++
++      gdbpy_convert_exception (except);
++      return NULL;
++    }
+ 
+   /* Do any commands attached to breakpoint we stopped at.  */
+   bpstat_do_actions ();
+diff -dup -ruNp gdb-7.8-orig/gdb/testsuite/gdb.python/py-gil-mthread.c gdb-7.8/gdb/testsuite/gdb.python/py-gil-mthread.c
+--- gdb-7.8-orig/gdb/testsuite/gdb.python/py-gil-mthread.c	1970-01-01 01:00:00.000000000 +0100
++++ gdb-7.8/gdb/testsuite/gdb.python/py-gil-mthread.c	2014-08-13 22:33:05.052648912 +0200
+@@ -0,0 +1,12 @@
++#include <stdio.h>
++
++int
++main (void)
++{
++  int i;
++  for (i = 0; i < 10; i++)
++    {
++      sleep (1); /* break-here */
++      printf ("Sleeping %d\n", i);
++    }
++}
+diff -dup -ruNp gdb-7.8-orig/gdb/testsuite/gdb.python/py-gil-mthread.exp gdb-7.8/gdb/testsuite/gdb.python/py-gil-mthread.exp
+--- gdb-7.8-orig/gdb/testsuite/gdb.python/py-gil-mthread.exp	1970-01-01 01:00:00.000000000 +0100
++++ gdb-7.8/gdb/testsuite/gdb.python/py-gil-mthread.exp	2014-08-13 22:33:00.660641300 +0200
+@@ -0,0 +1,69 @@
++# Copyright (C) 2014 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/>.
++
++standard_testfile .c .py
++set executable $testfile
++
++if { [prepare_for_testing $testfile.exp $executable $srcfile] } {
++    return -1
++}
++
++# Skip all tests if Python scripting is not enabled.
++if { [skip_python_tests] } { continue }
++
++if ![runto_main] {
++    return -1
++}
++
++gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"] temporary
++gdb_continue_to_breakpoint "break-here" ".* break-here .*"
++
++set test "response"
++set timeout 60
++set sleeping_last -1
++set hello_last 0
++set minimal 5
++gdb_test_multiple "python execfile('$srcdir/$subdir/$srcfile2')" $test {
++    -re "Error: unable to start thread\r\n" {
++	fail $test
++	# Not $gdb_prompt-synced!
++    }
++    -re "Sleeping (\[0-9\]+)\r\n" {
++	set n $expect_out(1,string)
++	if { $sleeping_last + 1 != $n } {
++	    fail $test
++	} else {
++	    set sleeping_last $n
++	    if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
++		pass $test
++	    } else {
++		exp_continue
++	    }
++	}
++    }
++    -re "Hello \\( (\[0-9\]+) \\)\r\n" {
++	set n $expect_out(1,string)
++	if { $hello_last + 1 != $n } {
++	    fail $test
++	} else {
++	    set hello_last $n
++	    if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
++		pass $test
++	    } else {
++		exp_continue
++	    }
++	}
++    }
++}
+diff -dup -ruNp gdb-7.8-orig/gdb/testsuite/gdb.python/py-gil-mthread.py gdb-7.8/gdb/testsuite/gdb.python/py-gil-mthread.py
+--- gdb-7.8-orig/gdb/testsuite/gdb.python/py-gil-mthread.py	1970-01-01 01:00:00.000000000 +0100
++++ gdb-7.8/gdb/testsuite/gdb.python/py-gil-mthread.py	2014-08-13 22:33:08.996654320 +0200
+@@ -0,0 +1,22 @@
++import thread
++import time
++import gdb
++
++# Define a function for the thread
++def print_thread_hello():
++   count = 0
++   while count < 10:
++      time.sleep(1)
++      count += 1
++      print "Hello (", count, ")"
++
++# Create a threads a continue
++try:
++   thread.start_new_thread( print_thread_hello, ())
++   gdb.execute ("continue", release_gil=True)
++   
++except:
++   print "Error: unable to start thread"
++
++while 1:
++   pass
diff --git a/gdb-readline62-ask-more-rh.patch b/gdb-readline62-ask-more-rh.patch
new file mode 100644
index 0000000..6f110be
--- /dev/null
+++ b/gdb-readline62-ask-more-rh.patch
@@ -0,0 +1,14 @@
+--- gdb-7.4.50.20120103-orig/gdb/event-top.c	2012-01-11 15:14:01.426206439 +0100
++++ gdb-7.4.50.20120103/gdb/event-top.c	2012-01-11 15:18:29.766577551 +0100
+@@ -982,6 +982,11 @@ set_async_editing_command (char *args, i
+ void
+ gdb_setup_readline (void)
+ {
++  /* 6.2 regression: no longed asks for --more--
++     gdb.base/readline-ask.exp
++     https://bugzilla.redhat.com/show_bug.cgi?id=701131  */
++  RL_SETSTATE (RL_STATE_FEDORA_GDB);
++
+   /* This function is a noop for the sync case.  The assumption is
+      that the sync setup is ALL done in gdb_init, and we would only
+      mess it up here.  The sync stuff should really go away over
diff --git a/gdb-rhel5-compat.patch b/gdb-rhel5-compat.patch
new file mode 100644
index 0000000..645e4ae
--- /dev/null
+++ b/gdb-rhel5-compat.patch
@@ -0,0 +1,29 @@
+Index: gdb-7.7/gdb/linux-nat.c
+===================================================================
+--- gdb-7.7.orig/gdb/linux-nat.c	2014-02-09 19:18:24.048554459 +0100
++++ gdb-7.7/gdb/linux-nat.c	2014-02-09 19:19:22.210622806 +0100
+@@ -1529,8 +1529,22 @@ get_pending_status (struct lwp_info *lp,
+ 			    gdb_signal_to_string (signo));
+     }
+ 
+-  if (*status == 0 && ptid_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 (ptid_get_pid (lp->ptid) == pid_was_stopped)
++    {
++      int err;
++
++      errno = 0;
++      err = kill_lwp (ptid_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-stale-frame_info.patch b/gdb-stale-frame_info.patch
new file mode 100644
index 0000000..59f8ea1
--- /dev/null
+++ b/gdb-stale-frame_info.patch
@@ -0,0 +1,174 @@
+http://sourceware.org/ml/gdb-patches/2012-04/msg00058.html
+Subject: [downstream patch FYI] workaround stale frame_info * (PR 13866)
+
+Hi,
+
+I did not look at which commit caused this regression but apparently it was
+introduced at least with multi-inferiors.
+
+I understand this fix is not right fix of the crash; but in most GDB cases one
+does not use multi-inferior so why to regress single-inferior by it.
+Some more simple solutions still fix the single-inferior mode but they
+regressed the multi-inferior mode
+	gdb.threads/no-unwaited-for-left.exp
+	gdb.multi/base.exp
+so I had to put there that sorting magic.
+
+With proper C++ sanity check of stale live frame_info references the testcase
+would be simple without the "frame_garbage_collection" reproducer below.
+It is also reproducible just with valgrind but regularly running the whole
+testsuite under valgrind I did not find feasible.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2012-04-04  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Workaround PR backtrace/13866.
+	* progspace.c (switch_to_program_space_and_thread): Try not to call
+	switch_to_thread.
+
+--- a/gdb/progspace.c
++++ b/gdb/progspace.c
+@@ -481,17 +481,28 @@ save_current_space_and_thread (void)
+ void
+ switch_to_program_space_and_thread (struct program_space *pspace)
+ {
+-  struct inferior *inf;
++  struct inferior *inf = current_inferior ();
+ 
+-  inf = find_inferior_for_program_space (pspace);
++  if (inf->pspace != pspace)
++    inf = find_inferior_for_program_space (pspace);
+   if (inf != NULL)
+     {
+-      struct thread_info *tp;
++      struct thread_info *tp, *current_tp = NULL;
++
++      if (ptid_get_pid (inferior_ptid) == inf->pid)
++	current_tp = find_thread_ptid (inferior_ptid);
+ 
+       tp = any_live_thread_of_process (inf->pid);
+       if (tp != NULL)
+ 	{
+-	  switch_to_thread (tp->ptid);
++	  /* Prefer primarily thread not THREAD_EXITED and secondarily thread
++	     not EXECUTING.  */
++	  if (current_tp == NULL
++	      || (tp->state != THREAD_EXITED
++		  && current_tp->state == THREAD_EXITED)
++	      || (!tp->executing && current_tp->executing))
++	    switch_to_thread (tp->ptid);
++
+ 	  /* Switching thread switches pspace implicitly.  We're
+ 	     done.  */
+ 	  return;
+
+
+Reproducer with:
+./gdb -nx ~/t/thread -ex 'b 24' -ex r -ex 'until 25'
+Breakpoint 1, main () at /home/jkratoch/t/thread.c:24
+24	  v++;
+Segmentation fault (core dumped)
+
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+static int v;
+
+static void *start (void *arg)
+{
+  v++;
+  v++;
+  v++;
+  v++;
+  sleep (100);
+  return arg;
+}
+
+int main (void)
+{
+  pthread_t thread1;
+  int i;
+
+  i = pthread_create (&thread1, NULL, start, NULL);
+  assert (i == 0);
+  v++;
+  v++;
+  v++;
+  v++;
+  i = pthread_join (thread1, NULL);
+  assert (i == 0);
+
+  return 0;
+}
+### --- a/gdb/frame.c
+### +++ b/gdb/frame.c
+### @@ -1522,12 +1522,30 @@ frame_observer_target_changed (struct target_ops *target)
+###    reinit_frame_cache ();
+###  }
+###  
+### +typedef struct obstack obstack_s;
+### +DEF_VEC_O (obstack_s);
+### +static VEC (obstack_s) *frame_poison_vec;
+### +
+### +void frame_garbage_collection (void);
+### +void
+### +frame_garbage_collection (void)
+### +{
+### +  struct obstack *obstack_p;
+### +  int ix;
+### +
+### +  for (ix = 0; VEC_iterate (obstack_s, frame_poison_vec, ix, obstack_p); ix++)
+### +    obstack_free (obstack_p, 0);
+### +
+### +  VEC_free (obstack_s, frame_poison_vec);
+### +  frame_poison_vec = NULL;
+### +}
+### +
+###  /* Flush the entire frame cache.  */
+###  
+###  void
+###  reinit_frame_cache (void)
+###  {
+### -  struct frame_info *fi;
+### +  struct frame_info *fi, *fi_prev;
+###  
+###    /* Tear down all frame caches.  */
+###    for (fi = current_frame; fi != NULL; fi = fi->prev)
+### @@ -1538,8 +1556,14 @@ reinit_frame_cache (void)
+###  	fi->base->unwind->dealloc_cache (fi, fi->base_cache);
+###      }
+###  
+### +  for (fi = current_frame; fi != NULL; fi = fi_prev)
+### +    {
+### +      fi_prev = fi->prev;
+### +      memset (fi, 0, sizeof (*fi));
+### +    }
+### +  VEC_safe_push (obstack_s, frame_poison_vec, &frame_cache_obstack);
+### +
+###    /* Since we can't really be sure what the first object allocated was.  */
+### -  obstack_free (&frame_cache_obstack, 0);
+###    obstack_init (&frame_cache_obstack);
+###  
+###    if (current_frame != NULL)
+### --- a/gdb/top.c
+### +++ b/gdb/top.c
+### @@ -359,6 +359,11 @@ prepare_execute_command (void)
+###    if (non_stop)
+###      target_dcache_invalidate ();
+###  
+### +  {
+### +    extern void frame_garbage_collection (void);
+### +    frame_garbage_collection ();
+### +  }
+### +
+###    return cleanup;
+###  }
+###  
diff --git a/gdb-vla-intel-04of23-fix.patch b/gdb-vla-intel-04of23-fix.patch
new file mode 100644
index 0000000..ad239b5
--- /dev/null
+++ b/gdb-vla-intel-04of23-fix.patch
@@ -0,0 +1,42 @@
+Re: [PATCH 04/23] vla: make dynamic fortran arrays functional.
+https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html
+
+Index: gdb-7.7.90.20140627/gdb/valarith.c
+===================================================================
+--- gdb-7.7.90.20140627.orig/gdb/valarith.c	2014-07-07 20:44:03.136394525 +0200
++++ gdb-7.7.90.20140627/gdb/valarith.c	2014-07-07 20:45:41.588536459 +0200
+@@ -195,10 +195,17 @@ value_subscripted_rvalue (struct value *
+   struct type *array_type = check_typedef (value_type (array));
+   struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
+   unsigned int elt_size = TYPE_LENGTH (elt_type);
+-  unsigned int elt_offs = longest_to_int (index - lowerbound);
++  unsigned int elt_offs;
+   LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
+   struct value *v;
+ 
++  if (TYPE_NOT_ASSOCIATED (array_type))
++    error (_("no such vector element because not associated"));
++  if (TYPE_NOT_ALLOCATED (array_type))
++    error (_("no such vector element because not allocated"));
++
++  elt_offs = longest_to_int (index - lowerbound);
++
+   if (elt_stride > 0)
+     elt_offs *= elt_stride;
+   else if (elt_stride < 0)
+@@ -212,14 +219,7 @@ value_subscripted_rvalue (struct value *
+ 
+   if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
+ 			     && elt_offs >= TYPE_LENGTH (array_type)))
+-    {
+-      if (TYPE_NOT_ASSOCIATED (array_type))
+-        error (_("no such vector element because not associated"));
+-      else if (TYPE_NOT_ALLOCATED (array_type))
+-        error (_("no such vector element because not allocated"));
+-      else
+-        error (_("no such vector element"));
+-    }
++    error (_("no such vector element"));
+ 
+   if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
+     v = allocate_value_lazy (elt_type);
diff --git a/gdb-vla-intel-stringbt-fix.patch b/gdb-vla-intel-stringbt-fix.patch
new file mode 100644
index 0000000..937f8fe
--- /dev/null
+++ b/gdb-vla-intel-stringbt-fix.patch
@@ -0,0 +1,165 @@
+http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
+Subject: [patch 1/2] Re: Crash regression(?) printing Fortran strings in bt  [Re: [V2 00/23] Fortran dynamic array support]
+
+
+--FCuugMFkClbJLl1L
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+
+On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
+> I just tried it on Fedora 20 i686.  Applied the patch, you mentioned, on top of
+> the Fortran VLA series and executed your dynamic-other-frame test.  Everything
+> is working fine here, I cannot reproduce the crash.
+
+I have it reproducible on Fedora 20 i686 with plain
+CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp
+
+Besides that I have updated the testcase with
+	gdb_test_no_output "set print frame-arguments all"
+so that there is no longer needed the patch:
+	[patch] Display Fortran strings in backtraces
+	https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
+
+The fix below has no regressions for me.  Unfortunately I do not see why you
+cannot reproduce it.
+
+
+Thanks,
+Jan
+
+--FCuugMFkClbJLl1L
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline; filename="vlastringonly.patch"
+
+diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
+index 53cae2c..cf7ac26 100644
+--- a/gdb/gdbtypes.c
++++ b/gdb/gdbtypes.c
+@@ -1659,6 +1659,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
+       return !has_static_range (TYPE_RANGE_DATA (type));
+ 
+     case TYPE_CODE_ARRAY:
++    case TYPE_CODE_STRING:
+       {
+ 	gdb_assert (TYPE_NFIELDS (type) == 1);
+ 
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
+new file mode 100644
+index 0000000..261ce17
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
+@@ -0,0 +1,24 @@
++! 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 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.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek <jakub at redhat.com>.
++! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil at redhat.com>.
++
++subroutine bar
++  real :: dummy
++  dummy = 1
++end subroutine bar
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
+new file mode 100644
+index 0000000..570a28c
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.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 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 "dynamic-other-frame"
++set srcfile1 ${testfile}.f90
++set srcfile2 ${testfile}-stub.f90
++set objfile2 [standard_output_file ${testfile}-stub.o]
++set executable ${testfile}
++set binfile [standard_output_file ${executable}]
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
++     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
++    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
++    return -1
++}
++
++clean_restart ${executable}
++
++gdb_test_no_output "set print frame-arguments all"
++
++if ![runto bar_] then {
++    perror "couldn't run to bar_"
++    continue
++}
++
++gdb_test "bt" {foo \(string='hello'.*}
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
+new file mode 100644
+index 0000000..2bc637d
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
+@@ -0,0 +1,36 @@
++! 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 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.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek <jakub at redhat.com>.
++! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil at redhat.com>.
++
++subroutine foo (string)
++  interface
++    subroutine bar
++    end subroutine
++  end interface
++  character string*(*)
++  call bar                                ! stop-here
++end subroutine foo
++program test
++  interface
++    subroutine foo (string)
++    character string*(*)
++    end subroutine
++  end interface
++  call foo ('hello')
++end
+
+--FCuugMFkClbJLl1L--
+
diff --git a/gdb-x86_64-i386-syscall-restart.patch b/gdb-x86_64-i386-syscall-restart.patch
index d5d6b10..af3cccd 100644
--- a/gdb-x86_64-i386-syscall-restart.patch
+++ b/gdb-x86_64-i386-syscall-restart.patch
@@ -102,7 +102,7 @@ gdb/
  	}
      }
 +
-+  if (gdbarch_ptr_bit (gdbarch) == 32)
++  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
 +    {
 +      /* Sign-extend %eax as during return from a syscall it is being checked
 +	 for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
diff --git a/insight-7.8.50-attach-fail-reasons-5of5.patch b/insight-7.8.50-attach-fail-reasons-5of5.patch
new file mode 100644
index 0000000..21b463e
--- /dev/null
+++ b/insight-7.8.50-attach-fail-reasons-5of5.patch
@@ -0,0 +1,373 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/config.in insight-7.8.50.20140825.new/gdb/config.in
+--- insight-7.8.50.20140825.orig/gdb/config.in	2014-08-25 18:28:06.147405696 +0200
++++ insight-7.8.50.20140825.new/gdb/config.in	2014-08-25 18:29:27.175081838 +0200
+@@ -219,6 +219,9 @@
+ /* Define if librpm library is being used. */
+ #undef HAVE_LIBRPM
+ 
++/* Define to 1 if you have the `selinux' library (-lselinux). */
++#undef HAVE_LIBSELINUX
++
+ /* Define to 1 if you have the <libunwind-ia64.h> header file. */
+ #undef HAVE_LIBUNWIND_IA64_H
+ 
+@@ -354,6 +357,9 @@
+ /* Define to 1 if you have the `scm_new_smob' function. */
+ #undef HAVE_SCM_NEW_SMOB
+ 
++/* Define to 1 if you have the <selinux/selinux.h> header file. */
++#undef HAVE_SELINUX_SELINUX_H
++
+ /* Define to 1 if you have the `setenv' function. */
+ #undef HAVE_SETENV
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/configure insight-7.8.50.20140825.new/gdb/configure
+--- insight-7.8.50.20140825.orig/gdb/configure	2014-08-25 18:28:06.152405738 +0200
++++ insight-7.8.50.20140825.new/gdb/configure	2014-08-25 18:29:27.184081913 +0200
+@@ -13574,6 +13574,64 @@ cat >>confdefs.h <<_ACEOF
+ _ACEOF
+ 
+ 
++for ac_header in selinux/selinux.h
++do :
++  ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
++if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_SELINUX_SELINUX_H 1
++_ACEOF
++
++fi
++
++done
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
++$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
++if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lselinux  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char security_get_boolean_active ();
++int
++main ()
++{
++return security_get_boolean_active ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_lib_selinux_security_get_boolean_active=yes
++else
++  ac_cv_lib_selinux_security_get_boolean_active=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
++$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
++if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_LIBSELINUX 1
++_ACEOF
++
++  LIBS="-lselinux $LIBS"
++
++fi
++
++
+ 
+ # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
+ # except that the argument to --with-sysroot is optional.
+diff -Naurp insight-7.8.50.20140825.orig/gdb/configure.ac insight-7.8.50.20140825.new/gdb/configure.ac
+--- insight-7.8.50.20140825.orig/gdb/configure.ac	2014-08-25 18:28:06.155405763 +0200
++++ insight-7.8.50.20140825.new/gdb/configure.ac	2014-08-25 18:29:27.153081654 +0200
+@@ -2161,6 +2161,10 @@ case $host_os in
+ esac
+ AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
+ 
++dnl Check security_get_boolean_active availability.
++AC_CHECK_HEADERS(selinux/selinux.h)
++AC_CHECK_LIB(selinux, security_get_boolean_active)
++
+ dnl Handle optional features that can be enabled.
+ 
+ # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
+diff -Naurp insight-7.8.50.20140825.orig/gdb/gdbserver/config.in insight-7.8.50.20140825.new/gdb/gdbserver/config.in
+--- insight-7.8.50.20140825.orig/gdb/gdbserver/config.in	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/gdbserver/config.in	2014-08-25 18:29:27.189081955 +0200
+@@ -75,6 +75,9 @@
+ /* Define to 1 if you have the `mcheck' library (-lmcheck). */
+ #undef HAVE_LIBMCHECK
+ 
++/* Define to 1 if you have the `selinux' library (-lselinux). */
++#undef HAVE_LIBSELINUX
++
+ /* Define if the target supports branch tracing. */
+ #undef HAVE_LINUX_BTRACE
+ 
+@@ -148,6 +151,9 @@
+ /* Define to 1 if you have the `readlink' function. */
+ #undef HAVE_READLINK
+ 
++/* Define to 1 if you have the <selinux/selinux.h> header file. */
++#undef HAVE_SELINUX_SELINUX_H
++
+ /* Define to 1 if you have the <sgtty.h> header file. */
+ #undef HAVE_SGTTY_H
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/gdbserver/configure insight-7.8.50.20140825.new/gdb/gdbserver/configure
+--- insight-7.8.50.20140825.orig/gdb/gdbserver/configure	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/gdbserver/configure	2014-08-25 18:29:27.192081980 +0200
+@@ -6339,6 +6339,64 @@ if $want_ipa ; then
+    fi
+ fi
+ 
++for ac_header in selinux/selinux.h
++do :
++  ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
++if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_SELINUX_SELINUX_H 1
++_ACEOF
++
++fi
++
++done
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
++$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
++if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lselinux  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char security_get_boolean_active ();
++int
++main ()
++{
++return security_get_boolean_active ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_lib_selinux_security_get_boolean_active=yes
++else
++  ac_cv_lib_selinux_security_get_boolean_active=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
++$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
++if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_LIBSELINUX 1
++_ACEOF
++
++  LIBS="-lselinux $LIBS"
++
++fi
++
++
+ 
+ 
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/gdbserver/configure.ac insight-7.8.50.20140825.new/gdb/gdbserver/configure.ac
+--- insight-7.8.50.20140825.orig/gdb/gdbserver/configure.ac	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/gdbserver/configure.ac	2014-08-25 18:29:27.157081688 +0200
+@@ -456,6 +456,10 @@ if $want_ipa ; then
+    fi
+ fi
+ 
++dnl Check security_get_boolean_active availability.
++AC_CHECK_HEADERS(selinux/selinux.h)
++AC_CHECK_LIB(selinux, security_get_boolean_active)
++
+ AC_SUBST(GDBSERVER_DEPFILES)
+ AC_SUBST(GDBSERVER_LIBS)
+ AC_SUBST(srv_xmlbuiltin)
+diff -Naurp insight-7.8.50.20140825.orig/gdb/gdbserver/linux-low.c insight-7.8.50.20140825.new/gdb/gdbserver/linux-low.c
+--- insight-7.8.50.20140825.orig/gdb/gdbserver/linux-low.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/gdbserver/linux-low.c	2014-08-25 18:29:27.162081729 +0200
+@@ -537,6 +537,29 @@ add_lwp (ptid_t ptid)
+   return lwp;
+ }
+ 
++/* Execute PTRACE_TRACEME with error checking.  */
++
++static void
++linux_traceme (const char *program)
++{
++  int save_errno;
++  struct buffer buffer;
++
++  errno = 0;
++  if (ptrace (PTRACE_TRACEME, 0,
++	      (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) == 0)
++    return;
++
++  save_errno = errno;
++  buffer_init (&buffer);
++  linux_ptrace_create_warnings (&buffer);
++  buffer_grow_str0 (&buffer, "");
++  fprintf (stderr, _("%sCannot trace created process %s: %s.\n"),
++	   buffer_finish (&buffer), program, strerror (save_errno));
++  fflush (stderr);
++  _exit (0177);
++}
++
+ /* Start an inferior process and returns its pid.
+    ALLARGS is a vector of program-name and args. */
+ 
+@@ -578,7 +601,7 @@ linux_create_inferior (char *program, ch
+   if (pid == 0)
+     {
+       close_most_fds ();
+-      ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0);
++      linux_traceme (program);
+ 
+ #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does.  */
+       signal (__SIGRTMIN + 1, SIG_DFL);
+diff -Naurp insight-7.8.50.20140825.orig/gdb/inf-ptrace.c insight-7.8.50.20140825.new/gdb/inf-ptrace.c
+--- insight-7.8.50.20140825.orig/gdb/inf-ptrace.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/inf-ptrace.c	2014-08-25 18:29:27.165081754 +0200
+@@ -102,7 +102,15 @@ static void
+ inf_ptrace_me (void)
+ {
+   /* "Trace me, Dr. Memory!"  */
++  errno = 0;
+   ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0);
++  if (errno != 0)
++    {
++      fprintf_unfiltered (gdb_stderr, _("Cannot create process: %s\n"),
++			  safe_strerror (errno));
++      gdb_flush (gdb_stderr);
++      _exit (0177);
++    }
+ }
+ 
+ /* Start a new inferior Unix child process.  EXEC_FILE is the file to
+diff -Naurp insight-7.8.50.20140825.orig/gdb/linux-nat.c insight-7.8.50.20140825.new/gdb/linux-nat.c
+--- insight-7.8.50.20140825.orig/gdb/linux-nat.c	2014-08-25 18:28:06.053404912 +0200
++++ insight-7.8.50.20140825.new/gdb/linux-nat.c	2014-08-25 18:29:27.171081805 +0200
+@@ -1289,6 +1289,7 @@ linux_nat_create_inferior (struct target
+ #ifdef HAVE_PERSONALITY
+   int personality_orig = 0, personality_set = 0;
+ #endif /* HAVE_PERSONALITY */
++  volatile struct gdb_exception ex;
+ 
+   /* The fork_child mechanism is synchronous and calls target_wait, so
+      we have to mask the async mode.  */
+@@ -1313,7 +1314,10 @@ linux_nat_create_inferior (struct target
+   /* Make sure we report all signals during startup.  */
+   linux_nat_pass_signals (ops, 0, NULL);
+ 
+-  linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
++  TRY_CATCH (ex, RETURN_MASK_ERROR)
++    {
++      linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
++    }
+ 
+ #ifdef HAVE_PERSONALITY
+   if (personality_set)
+@@ -1325,6 +1329,24 @@ linux_nat_create_inferior (struct target
+ 		 safe_strerror (errno));
+     }
+ #endif /* HAVE_PERSONALITY */
++
++  if (ex.reason < 0)
++    {
++      struct buffer buffer;
++      char *message, *buffer_s;
++
++      message = xstrdup (ex.message);
++      make_cleanup (xfree, message);
++
++      buffer_init (&buffer);
++      linux_ptrace_create_warnings (&buffer);
++
++      buffer_grow_str0 (&buffer, "");
++      buffer_s = buffer_finish (&buffer);
++      make_cleanup (xfree, buffer_s);
++
++      throw_error (ex.error, "%s%s", buffer_s, message);
++    }
+ }
+ 
+ static void
+diff -Naurp insight-7.8.50.20140825.orig/gdb/nat/linux-ptrace.c insight-7.8.50.20140825.new/gdb/nat/linux-ptrace.c
+--- insight-7.8.50.20140825.orig/gdb/nat/linux-ptrace.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/nat/linux-ptrace.c	2014-08-25 18:29:07.909921078 +0200
+@@ -30,6 +30,10 @@
+ 
+ #include <stdint.h>
+ 
++#ifdef HAVE_SELINUX_SELINUX_H
++# include <selinux/selinux.h>
++#endif /* HAVE_SELINUX_SELINUX_H */
++
+ /* Stores the currently supported ptrace options.  A value of
+    -1 means we did not check for features yet.  A value of 0 means
+    there are no supported features.  */
+@@ -58,6 +62,8 @@ linux_ptrace_attach_fail_reason (pid_t p
+     buffer_xml_printf (buffer, _("process %d is a zombie "
+ 				 "- the process has already terminated"),
+ 		       (int) pid);
++
++  linux_ptrace_create_warnings (buffer);
+ }
+ 
+ #if defined __i386__ || defined __x86_64__
+@@ -555,3 +561,19 @@ linux_ptrace_set_additional_flags (int f
+ {
+   additional_flags = flags;
+ }
++
++/* Print all possible reasons we could fail to create a traced process.  */
++
++void
++linux_ptrace_create_warnings (struct buffer *buffer)
++{
++#ifdef HAVE_LIBSELINUX
++  /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
++     forbidden.  */
++  if (security_get_boolean_active ("deny_ptrace") == 1)
++    buffer_xml_printf (buffer,
++		       _("the SELinux boolean 'deny_ptrace' is enabled, "
++			 "you can disable this process attach protection by: "
++			 "(gdb) shell sudo setsebool deny_ptrace=0"));
++#endif /* HAVE_LIBSELINUX */
++}
+diff -Naurp insight-7.8.50.20140825.orig/gdb/nat/linux-ptrace.h insight-7.8.50.20140825.new/gdb/nat/linux-ptrace.h
+--- insight-7.8.50.20140825.orig/gdb/nat/linux-ptrace.h	2014-07-25 15:10:37.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/nat/linux-ptrace.h	2014-08-25 18:29:27.149081621 +0200
+@@ -85,6 +85,7 @@ struct buffer;
+ 
+ extern void linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer);
+ extern void linux_ptrace_init_warnings (void);
++extern void linux_ptrace_create_warnings (struct buffer *buffer);
+ extern void linux_enable_event_reporting (pid_t pid);
+ extern void linux_disable_event_reporting (pid_t pid);
+ extern int linux_supports_tracefork (void);
diff --git a/insight-7.8.50-buildid-locate-core-as-arg.patch b/insight-7.8.50-buildid-locate-core-as-arg.patch
new file mode 100644
index 0000000..84664d0
--- /dev/null
+++ b/insight-7.8.50-buildid-locate-core-as-arg.patch
@@ -0,0 +1,134 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/exceptions.h insight-7.8.50.20140825.new/gdb/exceptions.h
+--- insight-7.8.50.20140825.orig/gdb/exceptions.h	2014-07-25 15:10:37.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/exceptions.h	2014-08-25 19:11:50.701751187 +0200
+@@ -100,6 +100,9 @@ enum errors {
+   /* Requested feature, method, mechanism, etc. is not supported.  */
+   NOT_SUPPORTED_ERROR,
+ 
++  /* Attempt to load a core file as executable.  */
++  IS_CORE_ERROR,
++
+   /* Add more errors here.  */
+   NR_ERRORS
+ };
+diff -Naurp insight-7.8.50.20140825.orig/gdb/exec.c insight-7.8.50.20140825.new/gdb/exec.c
+--- insight-7.8.50.20140825.orig/gdb/exec.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/exec.c	2014-08-25 19:11:50.703751204 +0200
+@@ -35,6 +35,7 @@
+ #include "progspace.h"
+ #include "gdb_bfd.h"
+ #include "gcore.h"
++#include "exceptions.h"
+ 
+ #include <fcntl.h>
+ #include "readline/readline.h"
+@@ -222,12 +223,27 @@ exec_file_attach (const char *filename,
+ 
+       if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
+ 	{
++	  int is_core;
++
++	  /* If the user accidentally did "gdb core", print a useful
++	     error message.  Check it only after bfd_object has been checked as
++	     a valid executable may get recognized for example also as
++	     "trad-core".  */
++	  is_core = bfd_check_format (exec_bfd, bfd_core);
++
+ 	  /* Make sure to close exec_bfd, or else "run" might try to use
+ 	     it.  */
+ 	  exec_close ();
+-	  error (_("\"%s\": not in executable format: %s"),
+-		 scratch_pathname,
+-		 gdb_bfd_errmsg (bfd_get_error (), matching));
++
++	  if (is_core != 0)
++	    throw_error (IS_CORE_ERROR,
++		   _("\"%s\" is a core file.\n"
++		     "Please specify an executable to debug."),
++		   scratch_pathname);
++	  else
++	    error (_("\"%s\": not in executable format: %s"),
++		   scratch_pathname,
++		   gdb_bfd_errmsg (bfd_get_error (), matching));
+ 	}
+ 
+       if (build_section_table (exec_bfd, &sections, &sections_end))
+diff -Naurp insight-7.8.50.20140825.orig/gdb/main.c insight-7.8.50.20140825.new/gdb/main.c
+--- insight-7.8.50.20140825.orig/gdb/main.c	2014-08-25 19:10:44.933194536 +0200
++++ insight-7.8.50.20140825.new/gdb/main.c	2014-08-25 19:37:06.153577650 +0200
+@@ -419,6 +419,36 @@ typedef struct cmdarg {
+ /* Define type VEC (cmdarg_s).  */
+ DEF_VEC_O (cmdarg_s);
+ 
++/* Call exec_file_attach.  If it detected FILENAME is a core file call
++   core_file_command.  Print the original exec_file_attach error only if
++   core_file_command failed to find a matching executable.  */
++
++static void
++exec_or_core_file_attach (char *filename, int from_tty)
++{
++  volatile struct gdb_exception e;
++
++  gdb_assert (exec_bfd == NULL);
++
++  TRY_CATCH (e, RETURN_MASK_ALL)
++    {
++      exec_file_attach (filename, from_tty);
++    }
++  if (e.reason < 0)
++    {
++      if (e.error == IS_CORE_ERROR)
++	{
++	  core_file_command (filename, from_tty);
++
++	  /* Iff the core file found its executable suppress the error message
++	     from exec_file_attach.  */
++	  if (exec_bfd != NULL)
++	    return;
++	}
++      throw_exception (e);
++    }
++}
++
+ static int
+ captured_main (void *data)
+ {
+@@ -935,6 +965,8 @@ captured_main (void *data)
+ 	{
+ 	  symarg = argv[optind];
+ 	  execarg = argv[optind];
++	  if (optind + 1 == argc && corearg == NULL)
++	    corearg = argv[optind];
+ 	  optind++;
+ 	}
+ 
+@@ -1098,11 +1130,26 @@ captured_main (void *data)
+       && symarg != NULL
+       && strcmp (execarg, symarg) == 0)
+     {
++      int r;
++
++      /* Call exec_or_core_file_attach only if the file was specified as
++	 a command line argument (and not an a command line option).  */
++      if (corearg != NULL && strcmp (corearg, execarg) == 0)
++	{
++	  r = catch_command_errors (exec_or_core_file_attach, execarg,
++				    !batch_flag, RETURN_MASK_ALL);
++	  corearg = NULL;
++	}
++      else
++	  r = catch_command_errors_const (exec_file_attach, execarg,
++				    !batch_flag, RETURN_MASK_ALL);
++
+       /* The exec file and the symbol-file are the same.  If we can't
+          open it, better only print one error message.
+-         catch_command_errors returns non-zero on success!  */
+-      if (catch_command_errors_const (exec_file_attach, execarg,
+-				      !batch_flag, RETURN_MASK_ALL))
++         catch_command_errors returns non-zero on success!
++	 Do not load EXECARG as a symbol file if it has been already processed
++	 as a core file.  */
++      if (r && core_bfd == NULL)
+ 	catch_command_errors_const (symbol_file_add_main, symarg,
+ 				    !batch_flag, RETURN_MASK_ALL);
+     }
diff --git a/insight-7.8.50-buildid-locate-rpm.patch b/insight-7.8.50-buildid-locate-rpm.patch
new file mode 100644
index 0000000..d18d587
--- /dev/null
+++ b/insight-7.8.50-buildid-locate-rpm.patch
@@ -0,0 +1,1297 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/build-id.c insight-7.8.50.20140825.new/gdb/build-id.c
+--- insight-7.8.50.20140825.orig/gdb/build-id.c	2014-08-25 18:04:05.232307984 +0200
++++ insight-7.8.50.20140825.new/gdb/build-id.c	2014-08-25 18:04:37.366583792 +0200
+@@ -31,6 +31,7 @@
+ #include "gdbcmd.h"
+ #include "observer.h"
+ #include <sys/stat.h>
++#include "elf/external.h"
+ 
+ #define BUILD_ID_VERBOSE_NONE 0
+ #define BUILD_ID_VERBOSE_FILENAMES 1
+@@ -665,8 +666,360 @@ build_id_to_filename (const struct elf_b
+   return result;
+ }
+ 
++#ifdef HAVE_LIBRPM
++
++#include <rpm/rpmlib.h>
++#include <rpm/rpmts.h>
++#include <rpm/rpmdb.h>
++#include <rpm/header.h>
++#ifdef DLOPEN_LIBRPM
++#include <dlfcn.h>
++#endif
++
++/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
++   and avoid their duplicities during a single inferior run.  */
++
++static struct htab *missing_rpm_hash;
++
++/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
++   all the rpms right before the nearest GDB prompt.  It gets cleared after
++   each such print (it is questionable if we should clear it after the print).
++   */
++
++struct missing_rpm
++  {
++    struct missing_rpm *next;
++    char rpm[1];
++  };
++static struct missing_rpm *missing_rpm_list;
++static int missing_rpm_list_entries;
++
++/* Returns the count of newly added rpms.  */
++
++static int
++missing_rpm_enlist (const char *filename)
++{
++  static int rpm_init_done = 0;
++  rpmts ts;
++  rpmdbMatchIterator mi;
++  int count = 0;
++
++#ifdef DLOPEN_LIBRPM
++  /* Duplicate here the declarations to verify they match.  The same sanity
++     check is present also in `configure.ac'.  */
++  extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
++  static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
++  extern int rpmReadConfigFiles(const char * file, const char * target);
++  static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
++  extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
++  static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
++  extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
++  static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
++  extern rpmts rpmtsCreate(void);
++  static rpmts (*rpmtsCreate_p) (void);
++  extern rpmts rpmtsFree(rpmts ts);
++  static rpmts (*rpmtsFree_p) (rpmts ts);
++  extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
++                                              const void * keyp, size_t keylen);
++  static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
++						    rpmTag rpmtag,
++						    const void *keyp,
++						    size_t keylen);
++#else	/* !DLOPEN_LIBRPM */
++# define headerFormat_p headerFormat
++# define rpmReadConfigFiles_p rpmReadConfigFiles
++# define rpmdbFreeIterator_p rpmdbFreeIterator
++# define rpmdbNextIterator_p rpmdbNextIterator
++# define rpmtsCreate_p rpmtsCreate
++# define rpmtsFree_p rpmtsFree
++# define rpmtsInitIterator_p rpmtsInitIterator
++#endif	/* !DLOPEN_LIBRPM */
++
++  gdb_assert (filename != NULL);
++
++  if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
++    return 0;
++
++  if (filename[0] != '/')
++    {
++      warning (_("Ignoring non-absolute filename: <%s>"), filename);
++      return 0;
++    }
++
++  if (!rpm_init_done)
++    {
++      static int init_tried;
++
++      /* Already failed the initialization before?  */
++      if (init_tried)
++      	return 0;
++      init_tried = 1;
++
++#ifdef DLOPEN_LIBRPM
++      {
++	void *h;
++
++	h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
++	if (!h)
++	  {
++	    warning (_("Unable to open \"%s\" (%s), "
++		      "missing debuginfos notifications will not be displayed"),
++		     DLOPEN_LIBRPM, dlerror ());
++	    return 0;
++	  }
++
++	if (!((headerFormat_p = dlsym (h, "headerFormat"))
++	      && (rpmReadConfigFiles_p = dlsym (h, "rpmReadConfigFiles"))
++	      && (rpmdbFreeIterator_p = dlsym (h, "rpmdbFreeIterator"))
++	      && (rpmdbNextIterator_p = dlsym (h, "rpmdbNextIterator"))
++	      && (rpmtsCreate_p = dlsym (h, "rpmtsCreate"))
++	      && (rpmtsFree_p = dlsym (h, "rpmtsFree"))
++	      && (rpmtsInitIterator_p = dlsym (h, "rpmtsInitIterator"))))
++	  {
++	    warning (_("Opened library \"%s\" is incompatible (%s), "
++		      "missing debuginfos notifications will not be displayed"),
++		     DLOPEN_LIBRPM, dlerror ());
++	    if (dlclose (h))
++	      warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
++		       dlerror ());
++	    return 0;
++	  }
++      }
++#endif	/* DLOPEN_LIBRPM */
++
++      if (rpmReadConfigFiles_p (NULL, NULL) != 0)
++	{
++	  warning (_("Error reading the rpm configuration files"));
++	  return 0;
++	}
++
++      rpm_init_done = 1;
++    }
++
++  ts = rpmtsCreate_p ();
++
++  mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
++  if (mi != NULL)
++    {
++      for (;;)
++	{
++	  Header h;
++	  char *debuginfo, **slot, *s, *s2;
++	  errmsg_t err;
++	  size_t srcrpmlen = sizeof (".src.rpm") - 1;
++	  size_t debuginfolen = sizeof ("-debuginfo") - 1;
++	  rpmdbMatchIterator mi_debuginfo;
++
++	  h = rpmdbNextIterator_p (mi);
++	  if (h == NULL)
++	    break;
++
++	  /* Verify the debuginfo file is not already installed.  */
++
++	  debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
++				      &err);
++	  if (!debuginfo)
++	    {
++	      warning (_("Error querying the rpm file `%s': %s"), filename,
++	               err);
++	      continue;
++	    }
++	  /* s = `.src.rpm-debuginfo.%{arch}' */
++	  s = strrchr (debuginfo, '-') - srcrpmlen;
++	  s2 = NULL;
++	  if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
++	    {
++	      /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
++	      s2 = memrchr (debuginfo, '-', s - debuginfo);
++	    }
++	  if (s2)
++	    {
++	      /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
++	      s2 = memrchr (debuginfo, '-', s2 - debuginfo);
++	    }
++	  if (!s2)
++	    {
++	      warning (_("Error querying the rpm file `%s': %s"), filename,
++	               debuginfo);
++	      xfree (debuginfo);
++	      continue;
++	    }
++	  /* s = `.src.rpm-debuginfo.%{arch}' */
++	  /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
++	  memmove (s2 + debuginfolen, s2, s - s2);
++	  memcpy (s2, "-debuginfo", debuginfolen);
++	  /* s = `XXXX.%{arch}' */
++	  /* strlen ("XXXX") == srcrpmlen + debuginfolen */
++	  /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
++	  /* strlen ("XX") == srcrpmlen */
++	  memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
++		   strlen (s + srcrpmlen + debuginfolen) + 1);
++	  /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
++
++	  /* RPMDBI_PACKAGES requires keylen == sizeof (int).  */
++	  /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel().  */
++	  mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0);
++	  xfree (debuginfo);
++	  if (mi_debuginfo)
++	    {
++	      rpmdbFreeIterator_p (mi_debuginfo);
++	      count = 0;
++	      break;
++	    }
++
++	  /* The allocated memory gets utilized below for MISSING_RPM_HASH.  */
++	  debuginfo = headerFormat_p (h,
++				      "%{name}-%{version}-%{release}.%{arch}",
++				      &err);
++	  if (!debuginfo)
++	    {
++	      warning (_("Error querying the rpm file `%s': %s"), filename,
++	               err);
++	      continue;
++	    }
++
++	  /* Base package name for `debuginfo-install'.  We do not use the
++	     `yum' command directly as the line
++		 yum --enablerepo='*debug*' 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
++	     debuginfo-install is unable to install the debuginfo package if
++	     the base name PKG binary rpm is not installed while for example
++	     PKG-libs would be installed (RH Bug 467901).
++	     FUTURE: After multiple debuginfo versions simultaneously installed
++	     get supported the support for the VERSION-RELEASE tags handling
++	     may need an update.  */
++
++	  if (missing_rpm_hash == NULL)
++	    {
++	      /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
++		 should not deallocate the entries.  */
++
++	      missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
++			       (int (*) (const void *, const void *)) streq,
++						    NULL, xcalloc, xfree);
++	    }
++	  slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
++	  /* XCALLOC never returns NULL.  */
++	  gdb_assert (slot != NULL);
++	  if (*slot == NULL)
++	    {
++	      struct missing_rpm *missing_rpm;
++
++	      *slot = debuginfo;
++
++	      missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
++	      strcpy (missing_rpm->rpm, debuginfo);
++	      missing_rpm->next = missing_rpm_list;
++	      missing_rpm_list = missing_rpm;
++	      missing_rpm_list_entries++;
++	    }
++	  else
++	    xfree (debuginfo);
++	  count++;
++	}
++
++      rpmdbFreeIterator_p (mi);
++    }
++
++  rpmtsFree_p (ts);
++
++  return count;
++}
++
++static int
++missing_rpm_list_compar (const char *const *ap, const char *const *bp)
++{
++  return strcoll (*ap, *bp);
++}
++
++/* It returns a NULL-terminated array of strings needing to be FREEd.  It may
++   also return only NULL.  */
++
++static void
++missing_rpm_list_print (void)
++{
++  char **array, **array_iter;
++  struct missing_rpm *list_iter;
++  struct cleanup *cleanups;
++
++  if (missing_rpm_list_entries == 0)
++    return;
++
++  array = xmalloc (sizeof (*array) * missing_rpm_list_entries);
++  cleanups = make_cleanup (xfree, array);
++
++  array_iter = array;
++  for (list_iter = missing_rpm_list; list_iter != NULL;
++       list_iter = list_iter->next)
++    {
++      *array_iter++ = list_iter->rpm;
++    }
++  gdb_assert (array_iter == array + missing_rpm_list_entries);
++
++  qsort (array, missing_rpm_list_entries, sizeof (*array),
++	 (int (*) (const void *, const void *)) missing_rpm_list_compar);
++
++  printf_unfiltered (_("Missing separate debuginfos, use: %s"),
++		     "debuginfo-install");
++  for (array_iter = array; array_iter < array + missing_rpm_list_entries;
++       array_iter++)
++    {
++      putchar_unfiltered (' ');
++      puts_unfiltered (*array_iter);
++    }
++  putchar_unfiltered ('\n');
++
++  while (missing_rpm_list != NULL)
++    {
++      list_iter = missing_rpm_list;
++      missing_rpm_list = list_iter->next;
++      xfree (list_iter);
++    }
++  missing_rpm_list_entries = 0;
++
++  do_cleanups (cleanups);
++}
++
++static void
++missing_rpm_change (void)
++{
++  debug_flush_missing ();
++
++  gdb_assert (missing_rpm_list == NULL);
++  if (missing_rpm_hash != NULL)
++    {
++      htab_delete (missing_rpm_hash);
++      missing_rpm_hash = NULL;
++    }
++}
++
++enum missing_exec
++  {
++    /* Init state.  EXEC_BFD also still could be NULL.  */
++    MISSING_EXEC_NOT_TRIED,
++    /* We saw a non-NULL EXEC_BFD but RPM has no info about it.  */
++    MISSING_EXEC_NOT_FOUND,
++    /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
++       or separate) or the main executable's RPM is now contained in
++       MISSING_RPM_HASH.  */
++    MISSING_EXEC_ENLISTED
++  };
++static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
++
++#endif	/* HAVE_LIBRPM */
++
++void
++debug_flush_missing (void)
++{
++#ifdef HAVE_LIBRPM
++  missing_rpm_list_print ();
++#endif
++}
++
+ /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+-     Try to install the hash file ...
++     yum --enablerepo='*debug*' install ...
+    avoidance.  */
+ 
+ struct missing_filepair
+@@ -720,11 +1073,17 @@ missing_filepair_change (void)
+       /* All their memory came just from missing_filepair_OBSTACK.  */
+       missing_filepair_hash = NULL;
+     }
++#ifdef HAVE_LIBRPM
++  missing_exec = MISSING_EXEC_NOT_TRIED;
++#endif
+ }
+ 
+ static void
+ debug_print_executable_changed (void)
+ {
++#ifdef HAVE_LIBRPM
++  missing_rpm_change ();
++#endif
+   missing_filepair_change ();
+ }
+ 
+@@ -791,14 +1150,34 @@ debug_print_missing (const char *binary,
+ 
+   *slot = missing_filepair;
+ 
+-  /* We do not collect and flush these messages as each such message
+-     already requires its own separate lines.  */
++#ifdef HAVE_LIBRPM
++  if (missing_exec == MISSING_EXEC_NOT_TRIED)
++    {
++      char *execfilename;
+ 
+-  fprintf_unfiltered (gdb_stdlog,
+-		      _("Missing separate debuginfo for %s\n"), binary);
+-  if (debug != NULL)
+-    fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
+-			debug);
++      execfilename = get_exec_file (0);
++      if (execfilename != NULL)
++	{
++	  if (missing_rpm_enlist (execfilename) == 0)
++	    missing_exec = MISSING_EXEC_NOT_FOUND;
++	  else
++	    missing_exec = MISSING_EXEC_ENLISTED;
++	}
++    }
++  if (missing_exec != MISSING_EXEC_ENLISTED)
++    if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
++	&& (debug == NULL || missing_rpm_enlist (debug) == 0))
++#endif	/* HAVE_LIBRPM */
++      {
++	/* We do not collect and flush these messages as each such message
++	   already requires its own separate lines.  */
++
++	fprintf_unfiltered (gdb_stdlog,
++			    _("Missing separate debuginfo for %s\n"), binary);
++        if (debug != NULL)
++	  fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
++			      "yum --enablerepo='*debug*' install", debug);
++      }
+ }
+ 
+ /* See build-id.h.  */
+diff -Naurp insight-7.8.50.20140825.orig/gdb/config.in insight-7.8.50.20140825.new/gdb/config.in
+--- insight-7.8.50.20140825.orig/gdb/config.in	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/config.in	2014-08-25 18:04:37.341583578 +0200
+@@ -33,6 +33,9 @@
+ /* Define to BFD's default target vector. */
+ #undef DEFAULT_BFD_VEC
+ 
++/* librpm version specific library name to dlopen. */
++#undef DLOPEN_LIBRPM
++
+ /* Define to 1 if translation of program messages to the user's native
+    language is requested. */
+ #undef ENABLE_NLS
+@@ -213,6 +216,9 @@
+ /* Define if Python 2.7 is being used. */
+ #undef HAVE_LIBPYTHON2_7
+ 
++/* Define if librpm library is being used. */
++#undef HAVE_LIBRPM
++
+ /* Define to 1 if you have the <libunwind-ia64.h> header file. */
+ #undef HAVE_LIBUNWIND_IA64_H
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/configure insight-7.8.50.20140825.new/gdb/configure
+--- insight-7.8.50.20140825.orig/gdb/configure	2014-08-25 14:57:24.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/configure	2014-08-25 18:06:32.383548656 +0200
+@@ -730,6 +730,11 @@ PKGVERSION
+ HAVE_NATIVE_GCORE_TARGET
+ TARGET_OBS
+ subdirs
++RPM_LIBS
++RPM_CFLAGS
++PKG_CONFIG_LIBDIR
++PKG_CONFIG_PATH
++PKG_CONFIG
+ GDB_DATADIR
+ DEBUGDIR
+ MAKEINFO_EXTRA_FLAGS
+@@ -833,6 +838,7 @@ with_gdb_datadir
+ with_relocated_sources
+ with_auto_load_dir
+ with_auto_load_safe_path
++with_rpm
+ enable_targets
+ enable_64_bit_bfd
+ enable_gdbcli
+@@ -884,6 +890,11 @@ CPPFLAGS
+ CPP
+ MAKEINFO
+ MAKEINFOFLAGS
++PKG_CONFIG
++PKG_CONFIG_PATH
++PKG_CONFIG_LIBDIR
++RPM_CFLAGS
++RPM_LIBS
+ YACC
+ YFLAGS
+ XMKMF'
+@@ -1554,6 +1565,8 @@ Optional Packages:
+                           [--with-auto-load-dir]
+   --without-auto-load-safe-path
+                           do not restrict auto-loaded files locations
++  --with-rpm              query rpm database for missing debuginfos (yes/no,
++                          def. auto=librpm.so)
+   --with-libunwind-ia64   use libunwind frame unwinding for ia64 targets
+   --with-curses           use the curses library instead of the termcap
+                           library
+@@ -1603,6 +1616,13 @@ Some influential environment variables:
+   MAKEINFO    Parent configure detects if it is of sufficient version.
+   MAKEINFOFLAGS
+               Parameters for MAKEINFO.
++  PKG_CONFIG  path to pkg-config utility
++  PKG_CONFIG_PATH
++              directories to add to pkg-config's search path
++  PKG_CONFIG_LIBDIR
++              path overriding pkg-config's built-in search path
++  RPM_CFLAGS  C compiler flags for RPM, overriding pkg-config
++  RPM_LIBS    linker flags for RPM, overriding pkg-config
+   YACC        The `Yet Another Compiler Compiler' implementation to use.
+               Defaults to the first program found out of: `bison -y', `byacc',
+               `yacc'.
+@@ -5335,6 +5355,491 @@ _ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
+ $as_echo "$with_auto_load_safe_path" >&6; }
+ 
++# Integration with rpm library to support missing debuginfo suggestions.
++# --without-rpm: Disable any rpm support.
++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
++#   Even with runtime missing `libname.so' GDB will still other run correctly.
++#   Missing `libname.so' during ./configure will abort the configuration.
++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
++#   minor version first such as `librpm-4.6.so' as minor version differences
++#   mean API+ABI incompatibility.  If the specific match versioned library name
++#   could not be found still open dynamically at least `librpm.so'.
++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
++#   to find librpm for compilation-time linking by pkg-config.  GDB binary will
++#   be probably linked with the version specific library (as `librpm-4.6.so').
++#   Failure to find librpm by pkg-config will abort the configuration.
++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
++#   cannot find librpm use to the rpmless compilation (like `--without-rpm').
++
++
++# Check whether --with-rpm was given.
++if test "${with_rpm+set}" = set; then :
++  withval=$with_rpm;
++else
++  with_rpm="auto"
++fi
++
++
++
++
++if test "x$with_rpm" != "xno"; then
++  if test "x$with_rpm" = "xyes"; then
++    LIBRPM="librpm.so"
++    RPM_REQUIRE=true
++    DLOPEN_REQUIRE=false
++  elif test "x$with_rpm" = "xauto"; then
++    LIBRPM="librpm.so"
++    RPM_REQUIRE=false
++    DLOPEN_REQUIRE=false
++  else
++    LIBRPM="$with_rpm"
++    RPM_REQUIRE=true
++    DLOPEN_REQUIRE=true
++  fi
++  LIBRPM_STRING='"'"$LIBRPM"'"'
++
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
++$as_echo_n "checking specific librpm version... " >&6; }
++  HAVE_DLOPEN_LIBRPM=false
++  save_LIBS="$LIBS"
++  LIBS="$LIBS -ldl"
++  if test "$cross_compiling" = yes; then :
++  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error "cannot run test program while cross compiling
++See \`config.log' for more details." "$LINENO" 5; }
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++#include <rpm/rpmlib.h>
++#include <dlfcn.h>
++#include <errno.h>
++
++int
++main ()
++{
++
++    void *h;
++    const char *const *rpmverp;
++    FILE *f;
++
++    f = fopen ("conftest.out", "w");
++    if (!f)
++      {
++	fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
++		 strerror (errno));
++	return 1;
++      }
++    h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
++    if (!h)
++      {
++	fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
++	return 1;
++      }
++    rpmverp = dlsym (h, "RPMVERSION");
++    if (!rpmverp)
++      {
++	fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
++	return 1;
++      }
++    fprintf (stderr, "RPMVERSION is: \"");
++    fprintf (stderr, "%s\"\n", *rpmverp);
++
++    /* Try to find the specific librpm version only for "librpm.so" as we do
++       not know how to assemble the version string otherwise.  */
++
++    if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
++      {
++	fprintf (f, "%s\n", $LIBRPM_STRING);
++	return 0;
++      }
++    else
++      {
++	char *h2_name;
++	void *h2;
++	int major, minor;
++
++	if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
++	  {
++	    fprintf (stderr, "Unable to parse RPMVERSION.\n");
++	    fprintf (f, "%s\n", $LIBRPM_STRING);
++	    return 0;
++	  }
++	/* Avoid the square brackets by malloc.  */
++	h2_name = malloc (64);
++	sprintf (h2_name, "librpm-%d.%d.so", major, minor);
++	h2 = dlopen (h2_name, RTLD_LAZY);
++	if (!h2)
++	  {
++	    fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
++	    fprintf (f, "%s\n", $LIBRPM_STRING);
++	    return 0;
++	  }
++	if (h2 != h)
++	  {
++	    fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
++		     $LIBRPM_STRING, h2_name);
++	    fprintf (f, "%s\n", $LIBRPM_STRING);
++	    return 0;
++	  }
++	/* Found the valid .so name with a specific version.  */
++	fprintf (f, "%s\n", h2_name);
++	return 0;
++      }
++
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_run "$LINENO"; then :
++
++    DLOPEN_LIBRPM="`cat conftest.out`"
++    if test "x$DLOPEN_LIBRPM" != "x"; then
++      HAVE_DLOPEN_LIBRPM=true
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
++$as_echo "$DLOPEN_LIBRPM" >&6; }
++    fi
++
++fi
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
++fi
++
++  rm -f conftest.out
++
++
++
++  if $HAVE_DLOPEN_LIBRPM; then
++
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
++$as_echo_n "checking rpm library API compatibility... " >&6; }
++    # The compilation requires -Werror to verify anything.
++    save_CFLAGS="$CFLAGS"
++    CFLAGS="$CFLAGS -Werror"
++    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Duplicate here the declarations to verify they match "elfread.c".  */
++#include <rpm/rpmlib.h>
++#include <rpm/rpmts.h>
++#include <rpm/rpmdb.h>
++#include <rpm/header.h>
++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
++extern int rpmReadConfigFiles(const char * file, const char * target);
++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
++extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
++extern rpmts rpmtsCreate(void);
++extern rpmts rpmtsFree(rpmts ts);
++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
++					    const void * keyp, size_t keylen);
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++      LIBRPM_COMPAT=true
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++else
++
++      LIBRPM_COMPAT=false
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++    CFLAGS="$save_CFLAGS"
++
++    if ! $LIBRPM_COMPAT; then
++      HAVE_DLOPEN_LIBRPM=false
++    fi
++  fi
++
++  if $HAVE_DLOPEN_LIBRPM; then
++    DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
++
++cat >>confdefs.h <<_ACEOF
++#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
++_ACEOF
++
++
++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
++
++  else
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++    LIBS="$save_LIBS"
++    if $DLOPEN_REQUIRE; then
++      as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
++    fi
++
++
++
++
++
++
++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
++	if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  case $PKG_CONFIG in
++  [\\/]* | ?:[\\/]*)
++  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
++  ;;
++  *)
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  ;;
++esac
++fi
++PKG_CONFIG=$ac_cv_path_PKG_CONFIG
++if test -n "$PKG_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
++$as_echo "$PKG_CONFIG" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_path_PKG_CONFIG"; then
++  ac_pt_PKG_CONFIG=$PKG_CONFIG
++  # Extract the first word of "pkg-config", so it can be a program name with args.
++set dummy pkg-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  case $ac_pt_PKG_CONFIG in
++  [\\/]* | ?:[\\/]*)
++  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
++  ;;
++  *)
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  ;;
++esac
++fi
++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
++if test -n "$ac_pt_PKG_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
++$as_echo "$ac_pt_PKG_CONFIG" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++  if test "x$ac_pt_PKG_CONFIG" = x; then
++    PKG_CONFIG=""
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    PKG_CONFIG=$ac_pt_PKG_CONFIG
++  fi
++else
++  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
++fi
++
++fi
++if test -n "$PKG_CONFIG"; then
++	_pkg_min_version=0.9.0
++	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
++	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
++		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++	else
++		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++		PKG_CONFIG=""
++	fi
++fi
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
++$as_echo_n "checking for RPM... " >&6; }
++
++if test -n "$RPM_CFLAGS"; then
++    pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++if test -n "$RPM_LIBS"; then
++    pkg_cv_RPM_LIBS="$RPM_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++        _pkg_short_errors_supported=yes
++else
++        _pkg_short_errors_supported=no
++fi
++        if test $_pkg_short_errors_supported = yes; then
++	        RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
++        else
++	        RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
++        fi
++	# Put the nasty error message in config.log where it belongs
++	echo "$RPM_PKG_ERRORS" >&5
++
++	HAVE_LIBRPM=false
++elif test $pkg_failed = untried; then
++     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++	HAVE_LIBRPM=false
++else
++	RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
++	RPM_LIBS=$pkg_cv_RPM_LIBS
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++	HAVE_LIBRPM=true
++fi
++
++    if $HAVE_LIBRPM; then
++
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
++$as_echo_n "checking rpm library API compatibility... " >&6; }
++    # The compilation requires -Werror to verify anything.
++    save_CFLAGS="$CFLAGS"
++    CFLAGS="$CFLAGS -Werror"
++    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Duplicate here the declarations to verify they match "elfread.c".  */
++#include <rpm/rpmlib.h>
++#include <rpm/rpmts.h>
++#include <rpm/rpmdb.h>
++#include <rpm/header.h>
++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
++extern int rpmReadConfigFiles(const char * file, const char * target);
++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
++extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
++extern rpmts rpmtsCreate(void);
++extern rpmts rpmtsFree(rpmts ts);
++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
++					    const void * keyp, size_t keylen);
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++      LIBRPM_COMPAT=true
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++else
++
++      LIBRPM_COMPAT=false
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++    CFLAGS="$save_CFLAGS"
++
++      if ! $LIBRPM_COMPAT; then
++	HAVE_LIBRPM=false
++	RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
++      fi
++    fi
++
++    if $HAVE_LIBRPM; then
++
++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
++
++      CFLAGS="$CFLAGS $RPM_CFLAGS"
++      LIBS="$LIBS $RPM_LIBS"
++    else
++      if $RPM_REQUIRE; then
++	as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
++      else
++	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
++$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
++      fi
++    fi
++  fi
++fi
++
+ 
+ 
+ subdirs="$subdirs testsuite"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/configure.ac insight-7.8.50.20140825.new/gdb/configure.ac
+--- insight-7.8.50.20140825.orig/gdb/configure.ac	2014-08-25 18:04:03.969297144 +0200
++++ insight-7.8.50.20140825.new/gdb/configure.ac	2014-08-25 18:04:37.360583741 +0200
+@@ -165,6 +165,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
+ 	      [Directories safe to hold auto-loaded files.])
+ AC_MSG_RESULT([$with_auto_load_safe_path])
+ 
++# Integration with rpm library to support missing debuginfo suggestions.
++# --without-rpm: Disable any rpm support.
++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
++#   Even with runtime missing `libname.so' GDB will still other run correctly.
++#   Missing `libname.so' during ./configure will abort the configuration.
++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
++#   minor version first such as `librpm-4.6.so' as minor version differences
++#   mean API+ABI incompatibility.  If the specific match versioned library name
++#   could not be found still open dynamically at least `librpm.so'.
++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
++#   to find librpm for compilation-time linking by pkg-config.  GDB binary will
++#   be probably linked with the version specific library (as `librpm-4.6.so').
++#   Failure to find librpm by pkg-config will abort the configuration.
++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
++#   cannot find librpm use to the rpmless compilation (like `--without-rpm').
++
++AC_ARG_WITH([rpm],
++  [AS_HELP_STRING([--with-rpm],
++                  [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
++
++m4_pattern_allow([^AC_MSG_ERROR$])
++m4_pattern_allow([^AC_MSG_WARN$])
++if test "x$with_rpm" != "xno"; then
++  if test "x$with_rpm" = "xyes"; then
++    LIBRPM="librpm.so"
++    RPM_REQUIRE=true
++    DLOPEN_REQUIRE=false
++  elif test "x$with_rpm" = "xauto"; then
++    LIBRPM="librpm.so"
++    RPM_REQUIRE=false
++    DLOPEN_REQUIRE=false
++  else
++    LIBRPM="$with_rpm"
++    RPM_REQUIRE=true
++    DLOPEN_REQUIRE=true
++  fi
++  LIBRPM_STRING='"'"$LIBRPM"'"'
++
++  AC_MSG_CHECKING([specific librpm version])
++  HAVE_DLOPEN_LIBRPM=false
++  save_LIBS="$LIBS"
++  LIBS="$LIBS -ldl"
++  AC_RUN_IFELSE(AC_LANG_PROGRAM([[
++#include <rpm/rpmlib.h>
++#include <dlfcn.h>
++#include <errno.h>
++  ]], [[
++    void *h;
++    const char *const *rpmverp;
++    FILE *f;
++
++    f = fopen ("conftest.out", "w");
++    if (!f)
++      {
++	fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
++		 strerror (errno));
++	return 1;
++      }
++    h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
++    if (!h)
++      {
++	fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
++	return 1;
++      }
++    rpmverp = dlsym (h, "RPMVERSION");
++    if (!rpmverp)
++      {
++	fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
++	return 1;
++      }
++    fprintf (stderr, "RPMVERSION is: \"");
++    fprintf (stderr, "%s\"\n", *rpmverp);
++
++    /* Try to find the specific librpm version only for "librpm.so" as we do
++       not know how to assemble the version string otherwise.  */
++
++    if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
++      {
++	fprintf (f, "%s\n", $LIBRPM_STRING);
++	return 0;
++      }
++    else
++      {
++	char *h2_name;
++	void *h2;
++	int major, minor;
++
++	if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
++	  {
++	    fprintf (stderr, "Unable to parse RPMVERSION.\n");
++	    fprintf (f, "%s\n", $LIBRPM_STRING);
++	    return 0;
++	  }
++	/* Avoid the square brackets by malloc.  */
++	h2_name = malloc (64);
++	sprintf (h2_name, "librpm-%d.%d.so", major, minor);
++	h2 = dlopen (h2_name, RTLD_LAZY);
++	if (!h2)
++	  {
++	    fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
++	    fprintf (f, "%s\n", $LIBRPM_STRING);
++	    return 0;
++	  }
++	if (h2 != h)
++	  {
++	    fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
++		     $LIBRPM_STRING, h2_name);
++	    fprintf (f, "%s\n", $LIBRPM_STRING);
++	    return 0;
++	  }
++	/* Found the valid .so name with a specific version.  */
++	fprintf (f, "%s\n", h2_name);
++	return 0;
++      }
++  ]]), [
++    DLOPEN_LIBRPM="`cat conftest.out`"
++    if test "x$DLOPEN_LIBRPM" != "x"; then
++      HAVE_DLOPEN_LIBRPM=true
++      AC_MSG_RESULT($DLOPEN_LIBRPM)
++    fi
++  ])
++  rm -f conftest.out
++
++  m4_define([CHECK_LIBRPM_COMPAT], [
++    AC_MSG_CHECKING([rpm library API compatibility])
++    # The compilation requires -Werror to verify anything.
++    save_CFLAGS="$CFLAGS"
++    CFLAGS="$CFLAGS -Werror"
++    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
++/* Duplicate here the declarations to verify they match "elfread.c".  */
++#include <rpm/rpmlib.h>
++#include <rpm/rpmts.h>
++#include <rpm/rpmdb.h>
++#include <rpm/header.h>
++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
++extern int rpmReadConfigFiles(const char * file, const char * target);
++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
++extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
++extern rpmts rpmtsCreate(void);
++extern rpmts rpmtsFree(rpmts ts);
++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
++					    const void * keyp, size_t keylen);
++    ]]), [
++      LIBRPM_COMPAT=true
++      AC_MSG_RESULT(yes)
++    ], [
++      LIBRPM_COMPAT=false
++      AC_MSG_RESULT(no)
++    ])
++    CFLAGS="$save_CFLAGS"
++  ])
++
++  if $HAVE_DLOPEN_LIBRPM; then
++    CHECK_LIBRPM_COMPAT
++    if ! $LIBRPM_COMPAT; then
++      HAVE_DLOPEN_LIBRPM=false
++    fi
++  fi
++
++  if $HAVE_DLOPEN_LIBRPM; then
++    DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
++    AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
++    AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
++  else
++    AC_MSG_RESULT(no)
++    LIBS="$save_LIBS"
++    if $DLOPEN_REQUIRE; then
++      AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
++    fi
++    PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
++
++    if $HAVE_LIBRPM; then
++      CHECK_LIBRPM_COMPAT
++      if ! $LIBRPM_COMPAT; then
++	HAVE_LIBRPM=false
++	RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
++      fi
++    fi
++
++    if $HAVE_LIBRPM; then
++      AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
++      CFLAGS="$CFLAGS $RPM_CFLAGS"
++      LIBS="$LIBS $RPM_LIBS"
++    else
++      if $RPM_REQUIRE; then
++	AC_MSG_ERROR($RPM_PKG_ERRORS)
++      else
++	AC_MSG_WARN($RPM_PKG_ERRORS)
++      fi
++    fi
++  fi
++fi
++ 
+ AC_CONFIG_SUBDIRS(testsuite)
+ 
+ # Check whether to support alternative target configurations
+diff -Naurp insight-7.8.50.20140825.orig/gdb/corelow.c insight-7.8.50.20140825.new/gdb/corelow.c
+--- insight-7.8.50.20140825.orig/gdb/corelow.c	2014-08-25 18:04:05.204307744 +0200
++++ insight-7.8.50.20140825.new/gdb/corelow.c	2014-08-25 18:04:37.362583758 +0200
+@@ -311,7 +311,7 @@ build_id_locate_exec (int from_tty)
+         symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
+     }
+   else
+-    debug_print_missing (_("the main executable file"), build_id_filename);
++    debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
+ 
+   do_cleanups (back_to);
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/event-top.c insight-7.8.50.20140825.new/gdb/event-top.c
+--- insight-7.8.50.20140825.orig/gdb/event-top.c	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/event-top.c	2014-08-25 18:04:37.324583432 +0200
+@@ -38,6 +38,7 @@
+ #include "gdbcmd.h"		/* for dont_repeat() */
+ #include "annotate.h"
+ #include "maint.h"
++#include "symfile.h"
+ 
+ /* readline include files.  */
+ #include "readline/readline.h"
+@@ -176,6 +177,8 @@ rl_callback_read_char_wrapper (gdb_clien
+ void
+ cli_command_loop (void *data)
+ {
++  debug_flush_missing ();
++
+   display_gdb_prompt (0);
+ 
+   /* Now it's time to start the event loop.  */
+@@ -243,6 +246,8 @@ display_gdb_prompt (char *new_prompt)
+   /* Reset the nesting depth used when trace-commands is set.  */
+   reset_command_nest_depth ();
+ 
++  debug_flush_missing ();
++
+   old_chain = make_cleanup (free_current_contents, &actual_gdb_prompt);
+ 
+   /* Do not call the python hook on an explicit prompt change as
+diff -Naurp insight-7.8.50.20140825.orig/gdb/symfile.h insight-7.8.50.20140825.new/gdb/symfile.h
+--- insight-7.8.50.20140825.orig/gdb/symfile.h	2014-08-25 18:04:05.225307924 +0200
++++ insight-7.8.50.20140825.new/gdb/symfile.h	2014-08-25 18:04:37.326583449 +0200
+@@ -573,6 +573,8 @@ void map_symbol_filenames (symbol_filena
+ /* build-id support.  */
+ extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr);
+ extern void debug_print_missing (const char *binary, const char *debug);
++extern void debug_flush_missing (void);
++#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
+ 
+ /* From dwarf2read.c */
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/lib/gdb.exp insight-7.8.50.20140825.new/gdb/testsuite/lib/gdb.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/lib/gdb.exp	2014-08-25 18:04:05.227307941 +0200
++++ insight-7.8.50.20140825.new/gdb/testsuite/lib/gdb.exp	2014-08-25 18:04:37.331583492 +0200
+@@ -1517,7 +1517,7 @@ proc default_gdb_start { } {
+ 	    warning "Couldn't set the width to 0."
+ 	}
+     }
+-    # Turn off the missing warnings as the testsuite does not expect it.
++    # Turn off the missing RPMs warnings as the testsuite does not expect it.
+     send_gdb "set build-id-verbose 0\n"
+     gdb_expect 10 {
+ 	-re "$gdb_prompt $" {
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/lib/mi-support.exp insight-7.8.50.20140825.new/gdb/testsuite/lib/mi-support.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/lib/mi-support.exp	2014-08-25 18:04:05.228307950 +0200
++++ insight-7.8.50.20140825.new/gdb/testsuite/lib/mi-support.exp	2014-08-25 18:04:37.333583509 +0200
+@@ -214,7 +214,7 @@ proc default_mi_gdb_start { args } {
+ 	    warning "Couldn't set the width to 0."
+ 	}
+     }
+-    # Turn off the missing warnings as the testsuite does not expect it.
++    # Turn off the missing RPMs warnings as the testsuite does not expect it.
+     send_gdb "190-gdb-set build-id-verbose 0\n"
+     gdb_expect 10 {
+ 	-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
+diff -Naurp insight-7.8.50.20140825.orig/gdb/tui/tui-interp.c insight-7.8.50.20140825.new/gdb/tui/tui-interp.c
+--- insight-7.8.50.20140825.orig/gdb/tui/tui-interp.c	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/tui/tui-interp.c	2014-08-25 18:04:37.334583518 +0200
+@@ -32,6 +32,7 @@
+ #include "exceptions.h"
+ #include "infrun.h"
+ #include "observer.h"
++#include "symfile.h"
+ 
+ static struct ui_out *tui_ui_out (struct interp *self);
+ 
diff --git a/gdb-6.3-bz231832-obstack-2gb.patch b/insight-7.8.50-bz231832-obstack-2gb.patch
similarity index 81%
rename from gdb-6.3-bz231832-obstack-2gb.patch
rename to insight-7.8.50-bz231832-obstack-2gb.patch
index 0b08cee..8ed793b 100644
--- a/gdb-6.3-bz231832-obstack-2gb.patch
+++ b/insight-7.8.50-bz231832-obstack-2gb.patch
@@ -1,25 +1,6 @@
-https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231832
-
-
-Index: gdb-7.4.50.20111218/gdb/symmisc.c
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/symmisc.c	2011-04-04 17:19:59.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/symmisc.c	2011-12-19 00:28:18.189232014 +0100
-@@ -147,8 +147,8 @@ print_objfile_statistics (void)
-     if (OBJSTAT (objfile, sz_strtab) > 0)
-       printf_filtered (_("  Space used by a.out string tables: %d\n"),
- 		       OBJSTAT (objfile, sz_strtab));
--    printf_filtered (_("  Total memory used for objfile obstack: %d\n"),
--		     obstack_memory_used (&objfile->objfile_obstack));
-+    printf_filtered (_("  Total memory used for objfile obstack: %ld\n"),
-+		     (long) obstack_memory_used (&objfile->objfile_obstack));
-     printf_filtered (_("  Total memory used for psymbol cache: %d\n"),
- 		     bcache_memory_used (psymbol_bcache_get_bcache
- 		                          (objfile->psymbol_cache)));
-Index: gdb-7.4.50.20111218/include/obstack.h
-===================================================================
---- gdb-7.4.50.20111218.orig/include/obstack.h	2011-10-22 03:35:29.000000000 +0200
-+++ gdb-7.4.50.20111218/include/obstack.h	2011-12-19 00:28:18.189232014 +0100
+diff -Naurp insight-7.8.50.20140825.orig/include/obstack.h insight-7.8.50.20140825.new/include/obstack.h
+--- insight-7.8.50.20140825.orig/include/obstack.h	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/include/obstack.h	2014-08-25 17:57:45.892131749 +0200
 @@ -188,31 +188,31 @@ struct obstack		/* control current objec
  
  /* Declare the external functions we use; they are in obstack.c.  */
@@ -125,10 +106,9 @@ Index: gdb-7.4.50.20111218/include/obstack.h
     if (__o->chunk_limit - __o->next_free < __len)			\
       _obstack_newchunk (__o, __len);					\
     obstack_blank_fast (__o, __len);					\
-Index: gdb-7.4.50.20111218/libiberty/obstack.c
-===================================================================
---- gdb-7.4.50.20111218.orig/libiberty/obstack.c	2005-05-10 17:33:33.000000000 +0200
-+++ gdb-7.4.50.20111218/libiberty/obstack.c	2011-12-19 00:28:18.191232006 +0100
+diff -Naurp insight-7.8.50.20140825.orig/libiberty/obstack.c insight-7.8.50.20140825.new/libiberty/obstack.c
+--- insight-7.8.50.20140825.orig/libiberty/obstack.c	2014-06-25 18:56:15.000000000 +0200
++++ insight-7.8.50.20140825.new/libiberty/obstack.c	2014-08-25 17:57:45.894131765 +0200
 @@ -44,9 +44,11 @@
  #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
  #include <gnu-versions.h>
diff --git a/insight-7.4.50-bz541866-rwatch-before-run.patch b/insight-7.8.50-bz541866-rwatch-before-run.patch
similarity index 65%
rename from insight-7.4.50-bz541866-rwatch-before-run.patch
rename to insight-7.8.50-bz541866-rwatch-before-run.patch
index 6d84107..52bd1f4 100644
--- a/insight-7.4.50-bz541866-rwatch-before-run.patch
+++ b/insight-7.8.50-bz541866-rwatch-before-run.patch
@@ -1,29 +1,29 @@
-diff -Naur insight-7.4.50.orig/gdb/config/i386/linux64.mh insight-7.4.50.new/gdb/config/i386/linux64.mh
---- insight-7.4.50.orig/gdb/config/i386/linux64.mh	2012-03-13 16:00:34.000000000 +0100
-+++ insight-7.4.50.new/gdb/config/i386/linux64.mh	2012-04-04 17:01:42.165056176 +0200
-@@ -4,7 +4,7 @@
- 	linux-nat.o linux-osdata.o \
+diff -Naurp insight-7.8.50.20140825.orig/gdb/config/i386/linux64.mh insight-7.8.50.20140825.new/gdb/config/i386/linux64.mh
+--- insight-7.8.50.20140825.orig/gdb/config/i386/linux64.mh	2014-07-11 15:52:31.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/config/i386/linux64.mh	2014-08-25 18:11:52.059216216 +0200
+@@ -6,7 +6,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
  	proc-service.o linux-thread-db.o linux-fork.o \
- 	linux-procfs.o linux-ptrace.o
+ 	linux-procfs.o linux-ptrace.o linux-btrace.o \
+ 	linux-waitpid.o
 -NAT_FILE= config/nm-linux.h
 +NAT_FILE= nm-linux64.h
  NAT_CDEPS = $(srcdir)/proc-service.list
  
  # The dynamically loaded libthread_db needs access to symbols in the
-diff -Naur insight-7.4.50.orig/gdb/config/i386/linux.mh insight-7.4.50.new/gdb/config/i386/linux.mh
---- insight-7.4.50.orig/gdb/config/i386/linux.mh	2012-03-13 16:00:33.000000000 +0100
-+++ insight-7.4.50.new/gdb/config/i386/linux.mh	2012-04-04 17:00:16.140834327 +0200
+diff -Naurp insight-7.8.50.20140825.orig/gdb/config/i386/linux.mh insight-7.8.50.20140825.new/gdb/config/i386/linux.mh
+--- insight-7.8.50.20140825.orig/gdb/config/i386/linux.mh	2014-07-11 15:52:31.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/config/i386/linux.mh	2014-08-25 18:11:52.061216232 +0200
 @@ -1,6 +1,6 @@
  # Host: Intel 386 running GNU/Linux.
  
 -NAT_FILE= config/nm-linux.h
 +NAT_FILE= nm-linux.h
  NATDEPFILES= inf-ptrace.o fork-child.o \
- 	i386-nat.o i386-linux-nat.o \
+ 	i386-nat.o i386-dregs.o i386-linux-nat.o x86-linux-nat.o \
  	proc-service.o linux-thread-db.o \
-diff -Naur insight-7.4.50.orig/gdb/config/i386/nm-linux64.h insight-7.4.50.new/gdb/config/i386/nm-linux64.h
---- insight-7.4.50.orig/gdb/config/i386/nm-linux64.h	1970-01-01 01:00:00.000000000 +0100
-+++ insight-7.4.50.new/gdb/config/i386/nm-linux64.h	2012-04-04 17:00:16.140834327 +0200
+diff -Naurp insight-7.8.50.20140825.orig/gdb/config/i386/nm-linux64.h insight-7.8.50.20140825.new/gdb/config/i386/nm-linux64.h
+--- insight-7.8.50.20140825.orig/gdb/config/i386/nm-linux64.h	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/config/i386/nm-linux64.h	2014-08-25 18:11:52.062216241 +0200
 @@ -0,0 +1,28 @@
 +/* Native support for GNU/Linux amd64.
 +
@@ -53,9 +53,9 @@ diff -Naur insight-7.4.50.orig/gdb/config/i386/nm-linux64.h insight-7.4.50.new/g
 +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
 +
 +#endif /* NM_LINUX64_H */
-diff -Naur insight-7.4.50.orig/gdb/config/i386/nm-linux.h insight-7.4.50.new/gdb/config/i386/nm-linux.h
---- insight-7.4.50.orig/gdb/config/i386/nm-linux.h	1970-01-01 01:00:00.000000000 +0100
-+++ insight-7.4.50.new/gdb/config/i386/nm-linux.h	2012-04-04 17:00:16.140834327 +0200
+diff -Naurp insight-7.8.50.20140825.orig/gdb/config/i386/nm-linux.h insight-7.8.50.20140825.new/gdb/config/i386/nm-linux.h
+--- insight-7.8.50.20140825.orig/gdb/config/i386/nm-linux.h	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/config/i386/nm-linux.h	2014-08-25 18:11:52.062216241 +0200
 @@ -0,0 +1,28 @@
 +/* Native support for GNU/Linux i386.
 +
@@ -85,23 +85,24 @@ diff -Naur insight-7.4.50.orig/gdb/config/i386/nm-linux.h insight-7.4.50.new/gdb
 +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
 +
 +#endif /* NM_LINUX64_H */
-diff -Naur insight-7.4.50.orig/gdb/target.h insight-7.4.50.new/gdb/target.h
---- insight-7.4.50.orig/gdb/target.h	2012-03-07 20:25:37.000000000 +0100
-+++ insight-7.4.50.new/gdb/target.h	2012-04-04 17:00:16.140834327 +0200
-@@ -1469,8 +1469,10 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/target.h insight-7.8.50.20140825.new/gdb/target.h
+--- insight-7.8.50.20140825.orig/gdb/target.h	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/target.h	2014-08-25 18:11:52.065216266 +0200
+@@ -1760,9 +1760,11 @@ extern char *target_thread_name (struct
     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);
+  (*current_target.to_can_use_hw_breakpoint) (&current_target,  \
+ 					     TYPE, CNT, OTHERTYPE);
 +#endif
  
  /* Returns the number of debug registers needed to watch the given
     memory region, or zero if not supported.  */
-diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp insight-7.4.50.new/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
---- insight-7.4.50.orig/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp	1970-01-01 01:00:00.000000000 +0100
-+++ insight-7.4.50.new/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp	2012-04-04 17:00:16.141834281 +0200
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp	2014-08-25 18:11:52.069216299 +0200
 @@ -0,0 +1,40 @@
 +# Copyright 2009, 2010 Free Software Foundation, Inc.
 +
diff --git a/insight-7.8.50-iwidgetsname.patch b/insight-7.8.50-iwidgetsname.patch
new file mode 100644
index 0000000..d7131dd
--- /dev/null
+++ b/insight-7.8.50-iwidgetsname.patch
@@ -0,0 +1,12 @@
+diff -Naurp insight-7.8.50.20140729.orig/gdb/gdbtk/library/main.tcl insight-7.8.50.20140729.new/gdb/gdbtk/library/main.tcl
+--- insight-7.8.50.20140729.orig/gdb/gdbtk/library/main.tcl	2014-07-29 17:48:22.792343512 +0200
++++ insight-7.8.50.20140729.new/gdb/gdbtk/library/main.tcl	2014-07-29 17:50:01.579343512 +0200
+@@ -62,7 +62,7 @@ if {[info exists auto_path]} {
+ # Require the packages we need.  Most are loaded already, but this will catch 
+ # any odd errors... :
+ 
+-foreach p {{Tcl 8.6} {Tk 8.6} {itcl 4.0} {itk 4.0} {iwidgets 4.0} {Gdbtk 1.0} {combobox 2.2} {debug 1.0}} {
++foreach p {{Tcl 8.6} {Tk 8.6} {itcl 4.0} {itk 4.0} {Iwidgets 4.0} {Gdbtk 1.0} {combobox 2.2} {debug 1.0}} {
+   if {[catch {package require [lindex $p 0] [lindex $p 1]} msg]} {
+     if {![info exists ::env(GDBTK_TEST_RUNNING)] || $::env(GDBTK_TEST_RUNNING) == 0} {
+       if {$::tcl_platform(platform) != "windows"} {
diff --git a/insight-7.8.50-python-completer-1of2.patch b/insight-7.8.50-python-completer-1of2.patch
new file mode 100644
index 0000000..375f841
--- /dev/null
+++ b/insight-7.8.50-python-completer-1of2.patch
@@ -0,0 +1,477 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/cli/cli-decode.c insight-7.8.50.20140825.new/gdb/cli/cli-decode.c
+--- insight-7.8.50.20140825.orig/gdb/cli/cli-decode.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/cli/cli-decode.c	2014-08-25 18:39:48.992270642 +0200
+@@ -161,6 +161,15 @@ set_cmd_completer (struct cmd_list_eleme
+   cmd->completer = completer; /* Ok.  */
+ }
+ 
++/* See definition in commands.h.  */
++
++void
++set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
++			       completer_ftype_void *completer_handle_brkchars)
++{
++  cmd->completer_handle_brkchars = completer_handle_brkchars;
++}
++
+ /* Add element named NAME.
+    Space for NAME and DOC must be allocated by the caller.
+    CLASS is the top level category into which commands are broken down
+@@ -236,6 +245,7 @@ add_cmd (const char *name, enum command_
+   c->prefix = NULL;
+   c->abbrev_flag = 0;
+   set_cmd_completer (c, make_symbol_completion_list_fn);
++  c->completer_handle_brkchars = NULL;
+   c->destroyer = NULL;
+   c->type = not_set_cmd;
+   c->var = NULL;
+diff -Naurp insight-7.8.50.20140825.orig/gdb/cli/cli-decode.h insight-7.8.50.20140825.new/gdb/cli/cli-decode.h
+--- insight-7.8.50.20140825.orig/gdb/cli/cli-decode.h	2014-07-25 15:10:37.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/cli/cli-decode.h	2014-08-25 18:39:48.993270650 +0200
+@@ -176,6 +176,15 @@ struct cmd_list_element
+        "baz/foo", return "baz/foobar".  */
+     completer_ftype *completer;
+ 
++    /* Handle the word break characters for this completer.  Usually
++       this function need not be defined, but for some types of
++       completers (e.g., Python completers declared as methods inside
++       a class) the word break chars may need to be redefined
++       depending on the completer type (e.g., for filename
++       completers).  */
++
++    completer_ftype_void *completer_handle_brkchars;
++
+     /* Destruction routine for this command.  If non-NULL, this is
+        called when this command instance is destroyed.  This may be
+        used to finalize the CONTEXT field, if needed.  */
+diff -Naurp insight-7.8.50.20140825.orig/gdb/command.h insight-7.8.50.20140825.new/gdb/command.h
+--- insight-7.8.50.20140825.orig/gdb/command.h	2014-07-25 15:10:37.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/command.h	2014-08-25 18:39:48.995270667 +0200
+@@ -159,8 +159,16 @@ extern void set_cmd_sfunc (struct cmd_li
+ typedef VEC (char_ptr) *completer_ftype (struct cmd_list_element *,
+ 					 const char *, const char *);
+ 
++typedef void completer_ftype_void (struct cmd_list_element *,
++				   const char *, const char *);
++
+ extern void set_cmd_completer (struct cmd_list_element *, completer_ftype *);
+ 
++/* Set the completer_handle_brkchars callback.  */
++
++extern void set_cmd_completer_handle_brkchars (struct cmd_list_element *,
++					       completer_ftype_void *);
++
+ /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
+    around in cmd objects to test the value of the commands sfunc().  */
+ extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
+diff -Naurp insight-7.8.50.20140825.orig/gdb/completer.c insight-7.8.50.20140825.new/gdb/completer.c
+--- insight-7.8.50.20140825.orig/gdb/completer.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/completer.c	2014-08-25 18:39:49.000270708 +0200
+@@ -449,6 +449,21 @@ expression_completer (struct cmd_list_el
+   return location_completer (ignore, p, word);
+ }
+ 
++/* See definition in completer.h.  */
++
++void
++set_gdb_completion_word_break_characters (completer_ftype *fn)
++{
++  /* So far we are only interested in differentiating filename
++     completers from everything else.  */
++  if (fn == filename_completer)
++    rl_completer_word_break_characters
++      = gdb_completer_file_name_break_characters;
++  else
++    rl_completer_word_break_characters
++      = gdb_completer_command_word_break_characters;
++}
++
+ /* Here are some useful test cases for completion.  FIXME: These
+    should be put in the test suite.  They should be tested with both
+    M-? and TAB.
+@@ -677,6 +692,9 @@ complete_line_internal (const char *text
+ 			   p--)
+ 			;
+ 		    }
++		  if (reason == handle_brkchars
++		      && c->completer_handle_brkchars != NULL)
++		    (*c->completer_handle_brkchars) (c, p, word);
+ 		  if (reason != handle_brkchars && c->completer != NULL)
+ 		    list = (*c->completer) (c, p, word);
+ 		}
+@@ -750,6 +768,9 @@ complete_line_internal (const char *text
+ 		       p--)
+ 		    ;
+ 		}
++	      if (reason == handle_brkchars
++		  && c->completer_handle_brkchars != NULL)
++		(*c->completer_handle_brkchars) (c, p, word);
+ 	      if (reason != handle_brkchars && c->completer != NULL)
+ 		list = (*c->completer) (c, p, word);
+ 	    }
+diff -Naurp insight-7.8.50.20140825.orig/gdb/completer.h insight-7.8.50.20140825.new/gdb/completer.h
+--- insight-7.8.50.20140825.orig/gdb/completer.h	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/completer.h	2014-08-25 18:39:49.004270742 +0200
+@@ -18,6 +18,7 @@
+ #define COMPLETER_H 1
+ 
+ #include "gdb_vecs.h"
++#include "command.h"
+ 
+ extern VEC (char_ptr) *complete_line (const char *text,
+ 				      const char *line_buffer,
+@@ -48,6 +49,13 @@ extern char *get_gdb_completer_quote_cha
+ 
+ extern char *gdb_completion_word_break_characters (void);
+ 
++/* Set the word break characters array to the corresponding set of
++   chars, based on FN.  This function is useful for cases when the
++   completer doesn't know the type of the completion until some
++   calculation is done (e.g., for Python functions).  */
++
++extern void set_gdb_completion_word_break_characters (completer_ftype *fn);
++
+ /* Exported to linespec.c */
+ 
+ extern const char *skip_quoted_chars (const char *, const char *,
+diff -Naurp insight-7.8.50.20140825.orig/gdb/python/py-cmd.c insight-7.8.50.20140825.new/gdb/python/py-cmd.c
+--- insight-7.8.50.20140825.orig/gdb/python/py-cmd.c	2014-07-25 15:10:37.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/python/py-cmd.c	2014-08-25 18:39:49.008270775 +0200
+@@ -208,45 +208,155 @@ cmdpy_function (struct cmd_list_element
+   do_cleanups (cleanup);
+ }
+ 
++/* Helper function for the Python command completers (both "pure"
++   completer and brkchar handler).  This function takes COMMAND, TEXT
++   and WORD and tries to call the Python method for completion with
++   these arguments.  It also takes HANDLE_BRKCHARS_P, an argument to
++   identify whether it is being called from the brkchar handler or
++   from the "pure" completer.  In the first case, it effectively calls
++   the Python method for completion, and records the PyObject in a
++   static variable (used as a "cache").  In the second case, it just
++   returns that variable, without actually calling the Python method
++   again.  This saves us one Python method call.
++
++   It is important to mention that this function is built on the
++   assumption that the calls to cmdpy_completer_handle_brkchars and
++   cmdpy_completer will be subsequent with nothing intervening.  This
++   is true for our completer mechanism.
++
++   This function returns the PyObject representing the Python method
++   call.  */
++
++static PyObject *
++cmdpy_completer_helper (struct cmd_list_element *command,
++			const char *text, const char *word,
++			int handle_brkchars_p)
++{
++  cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command);
++  PyObject *textobj, *wordobj;
++  /* This static variable will server as a "cache" for us, in order to
++     store the PyObject that results from calling the Python
++     function.  */
++  static PyObject *resultobj = NULL;
++
++  if (handle_brkchars_p)
++    {
++      /* If we were called to handle brkchars, it means this is the
++	 first function call of two that will happen in a row.
++	 Therefore, we need to call the completer ourselves, and cache
++	 the return value in the static variable RESULTOBJ.  Then, in
++	 the second call, we can just use the value of RESULTOBJ to do
++	 our job.  */
++      if (resultobj != NULL)
++	Py_DECREF (resultobj);
++
++      resultobj = NULL;
++      if (!obj)
++	error (_("Invalid invocation of Python command object."));
++      if (!PyObject_HasAttr ((PyObject *) obj, complete_cst))
++	{
++	  /* If there is no complete method, don't error.  */
++	  return NULL;
++	}
++
++      textobj = PyUnicode_Decode (text, strlen (text), host_charset (), NULL);
++      if (!textobj)
++	error (_("Could not convert argument to Python string."));
++      wordobj = PyUnicode_Decode (word, sizeof (word), host_charset (), NULL);
++      if (!wordobj)
++	{
++	  Py_DECREF (textobj);
++	  error (_("Could not convert argument to Python string."));
++	}
++
++      resultobj = PyObject_CallMethodObjArgs ((PyObject *) obj, complete_cst,
++					      textobj, wordobj, NULL);
++      Py_DECREF (textobj);
++      Py_DECREF (wordobj);
++      if (!resultobj)
++	{
++	  /* Just swallow errors here.  */
++	  PyErr_Clear ();
++	}
++
++      Py_XINCREF (resultobj);
++    }
++
++  return resultobj;
++}
++
++/* Python function called to determine the break characters of a
++   certain completer.  We are only interested in knowing if the
++   completer registered by the user will return one of the integer
++   codes (see COMPLETER_* symbols).  */
++
++static void
++cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
++				 const char *text, const char *word)
++{
++  PyObject *resultobj = NULL;
++  struct cleanup *cleanup;
++
++  cleanup = ensure_python_env (get_current_arch (), current_language);
++
++  /* Calling our helper to obtain the PyObject of the Python
++     function.  */
++  resultobj = cmdpy_completer_helper (command, text, word, 1);
++
++  /* Check if there was an error.  */
++  if (resultobj == NULL)
++    goto done;
++
++  if (PyInt_Check (resultobj))
++    {
++      /* User code may also return one of the completion constants,
++	 thus requesting that sort of completion.  We are only
++	 interested in this kind of return.  */
++      long value;
++
++      if (!gdb_py_int_as_long (resultobj, &value))
++	{
++	  /* Ignore.  */
++	  PyErr_Clear ();
++	}
++      else if (value >= 0 && value < (long) N_COMPLETERS)
++	{
++	  /* This is the core of this function.  Depending on which
++	     completer type the Python function returns, we have to
++	     adjust the break characters accordingly.  */
++	  set_gdb_completion_word_break_characters
++	    (completers[value].completer);
++	}
++    }
++
++ done:
++
++  /* We do not call Py_XDECREF here because RESULTOBJ will be used in
++     the subsequent call to cmdpy_completer function.  */
++  do_cleanups (cleanup);
++}
++
+ /* Called by gdb for command completion.  */
+ 
+ static VEC (char_ptr) *
+ cmdpy_completer (struct cmd_list_element *command,
+ 		 const char *text, const char *word)
+ {
+-  cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command);
+-  PyObject *textobj, *wordobj, *resultobj = NULL;
++  PyObject *resultobj = NULL;
+   VEC (char_ptr) *result = NULL;
+   struct cleanup *cleanup;
+ 
+   cleanup = ensure_python_env (get_current_arch (), current_language);
+ 
+-  if (! obj)
+-    error (_("Invalid invocation of Python command object."));
+-  if (! PyObject_HasAttr ((PyObject *) obj, complete_cst))
+-    {
+-      /* If there is no complete method, don't error -- instead, just
+-	 say that there are no completions.  */
+-      goto done;
+-    }
+-
+-  textobj = PyUnicode_Decode (text, strlen (text), host_charset (), NULL);
+-  if (! textobj)
+-    error (_("Could not convert argument to Python string."));
+-  wordobj = PyUnicode_Decode (word, strlen (word), host_charset (), NULL);
+-  if (! wordobj)
+-    error (_("Could not convert argument to Python string."));
+-
+-  resultobj = PyObject_CallMethodObjArgs ((PyObject *) obj, complete_cst,
+-					  textobj, wordobj, NULL);
+-  Py_DECREF (textobj);
+-  Py_DECREF (wordobj);
+-  if (! resultobj)
+-    {
+-      /* Just swallow errors here.  */
+-      PyErr_Clear ();
+-      goto done;
+-    }
++  /* Calling our helper to obtain the PyObject of the Python
++     function.  */
++  resultobj = cmdpy_completer_helper (command, text, word, 0);
++
++  /* If the result object of calling the Python function is NULL, it
++     means that there was an error.  In this case, just give up and
++     return NULL.  */
++  if (resultobj == NULL)
++    goto done;
+ 
+   result = NULL;
+   if (PyInt_Check (resultobj))
+@@ -302,7 +412,6 @@ cmdpy_completer (struct cmd_list_element
+ 
+  done:
+ 
+-  Py_XDECREF (resultobj);
+   do_cleanups (cleanup);
+ 
+   return result;
+@@ -548,6 +657,9 @@ cmdpy_init (PyObject *self, PyObject *ar
+       set_cmd_context (cmd, self);
+       set_cmd_completer (cmd, ((completetype == -1) ? cmdpy_completer
+ 			       : completers[completetype].completer));
++      if (completetype == -1)
++	set_cmd_completer_handle_brkchars (cmd,
++					   cmdpy_completer_handle_brkchars);
+     }
+   if (except.reason < 0)
+     {
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.python/py-completion.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.python/py-completion.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.python/py-completion.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.python/py-completion.exp	2014-08-25 18:39:49.010270792 +0200
+@@ -0,0 +1,70 @@
++# Copyright (C) 2014 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 "py-completion"
++
++load_lib gdb-python.exp
++
++gdb_exit
++gdb_start
++
++# Skip all tests if Python scripting is not enabled.
++if { [skip_python_tests] } { continue }
++
++gdb_test_no_output "source ${srcdir}/${subdir}/${testfile}.py"
++
++# Create a temporary directory
++set testdir "${objdir}/${subdir}/py-completion-testdir/"
++set testdir_regex [string_to_regexp $testdir]
++set testdir_complete "${objdir}/${subdir}/py-completion-test"
++file mkdir $testdir
++
++# This one should always pass.
++send_gdb "completefileinit ${testdir_complete}\t"
++gdb_test_multiple "" "completefileinit completion" {
++    -re "^completefileinit ${testdir_regex}$" {
++        pass "completefileinit completion"
++    }
++}
++
++# Just discarding whatever we typed.
++send_gdb "\n"
++gdb_test "print" ".*"
++
++# This is the problematic one.
++send_gdb "completefilemethod ${testdir_complete}\t"
++gdb_test_multiple "" "completefilemethod completion" {
++    -re "^completefilemethod ${testdir_regex} $" {
++        fail "completefilemethod completion (completed filename as wrong command arg)"
++    }
++    -re "^completefilemethod ${testdir_regex}$" {
++        pass "completefilemethod completion"
++    }
++}
++
++# Discarding again
++send_gdb "\n"
++gdb_test "print" ".*"
++
++# Another problematic
++send_gdb "completefilecommandcond ${objdir}/${subdir}/py-completion-t\t"
++gdb_test_multiple "" "completefilecommandcond completion" {
++    -re "^completefilecommandcond ${testdir}$" {
++	fail "completefilecommandcond completion (completed filename instead of command)"
++    }
++    -re "^completefilecommandcond ${objdir}/${subdir}/py-completion-t$" {
++	pass "completefilecommandcond completion"
++    }
++}
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.python/py-completion.py insight-7.8.50.20140825.new/gdb/testsuite/gdb.python/py-completion.py
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.python/py-completion.py	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.python/py-completion.py	2014-08-25 18:39:49.010270792 +0200
+@@ -0,0 +1,58 @@
++# Copyright (C) 2014 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 testcase tests PR python/16699
++
++import gdb
++
++class CompleteFileInit(gdb.Command):
++	def __init__(self):
++		gdb.Command.__init__(self,'completefileinit',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME)
++
++	def invoke(self,argument,from_tty):
++		raise gdb.GdbError('not implemented')
++
++class CompleteFileMethod(gdb.Command):
++	def __init__(self):
++		gdb.Command.__init__(self,'completefilemethod',gdb.COMMAND_USER)
++
++	def invoke(self,argument,from_tty):
++		raise gdb.GdbError('not implemented')
++
++	def complete(self,text,word):
++		return gdb.COMPLETE_FILENAME
++
++class CompleteFileCommandCond(gdb.Command):
++	def __init__(self):
++		gdb.Command.__init__(self,'completefilecommandcond',gdb.COMMAND_USER)
++
++	def invoke(self,argument,from_tty):
++		raise gdb.GdbError('not implemented')
++
++	def complete(self,text,word):
++		# This is a test made to know if the command
++		# completion still works fine.  When the user asks to
++		# complete something like "completefilecommandcond
++		# /path/to/py-completion-t", it should not complete to
++		# "/path/to/py-completion-test/", but instead just
++		# wait for input.
++		if "py-completion-t" in text:
++			return gdb.COMPLETE_COMMAND
++		else:
++			return gdb.COMPLETE_FILENAME
++
++CompleteFileInit()
++CompleteFileMethod()
++CompleteFileCommandCond()
diff --git a/insight-7.8.50-readnever-20050907.patch b/insight-7.8.50-readnever-20050907.patch
new file mode 100644
index 0000000..7e4889e
--- /dev/null
+++ b/insight-7.8.50-readnever-20050907.patch
@@ -0,0 +1,78 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/doc/gdb.texinfo insight-7.8.50.20140825.new/gdb/doc/gdb.texinfo
+--- insight-7.8.50.20140825.orig/gdb/doc/gdb.texinfo	2014-08-25 17:50:11.457373602 +0200
++++ insight-7.8.50.20140825.new/gdb/doc/gdb.texinfo	2014-08-25 17:50:49.403705976 +0200
+@@ -1032,6 +1032,12 @@ Read each symbol file's entire symbol ta
+ the default, which is to read it incrementally as it is needed.
+ This makes startup slower, but makes future operations faster.
+ 
++ at item --readnever
++ at cindex @code{--readnever}
++Do not read each symbol file's symbolic debug information.  This makes
++startup faster but at the expense of not being able to perform
++symbolic debugging.
++
+ @end table
+ 
+ @node Mode Options
+diff -Naurp insight-7.8.50.20140825.orig/gdb/dwarf2read.c insight-7.8.50.20140825.new/gdb/dwarf2read.c
+--- insight-7.8.50.20140825.orig/gdb/dwarf2read.c	2014-08-25 17:50:11.498373988 +0200
++++ insight-7.8.50.20140825.new/gdb/dwarf2read.c	2014-08-25 17:50:49.426706165 +0200
+@@ -70,6 +70,7 @@
+ #include "source.h"
+ #include "filestuff.h"
+ #include "build-id.h"
++#include "top.h"
+ 
+ #include <fcntl.h>
+ #include <sys/types.h>
+@@ -1996,7 +1997,8 @@ dwarf2_has_info (struct objfile *objfile
+                              (void *) names);
+       dwarf2_per_objfile->objfile = objfile;
+     }
+-  return (!dwarf2_per_objfile->info.is_virtual
++  return !readnever_symbol_files &&
++	 (!dwarf2_per_objfile->info.is_virtual
+ 	  && dwarf2_per_objfile->info.s.asection != NULL
+ 	  && !dwarf2_per_objfile->abbrev.is_virtual
+ 	  && dwarf2_per_objfile->abbrev.s.asection != NULL);
+diff -Naurp insight-7.8.50.20140825.orig/gdb/main.c insight-7.8.50.20140825.new/gdb/main.c
+--- insight-7.8.50.20140825.orig/gdb/main.c	2014-08-25 17:50:11.466373686 +0200
++++ insight-7.8.50.20140825.new/gdb/main.c	2014-08-25 17:50:49.407706009 +0200
+@@ -585,6 +585,7 @@ captured_main (void *data)
+       {"xdb", no_argument, &xdb_commands, 1},
+       {"dbx", no_argument, &dbx_commands, 1},
+       {"readnow", no_argument, &readnow_symbol_files, 1},
++      {"readnever", no_argument, &readnever_symbol_files, 1},
+       {"r", no_argument, &readnow_symbol_files, 1},
+       {"quiet", no_argument, &quiet, 1},
+       {"q", no_argument, &quiet, 1},
+@@ -1274,6 +1275,7 @@ Selection of debuggee and its files:\n\n
+   --se=FILE          Use FILE as symbol file and executable file.\n\
+   --symbols=SYMFILE  Read symbols from SYMFILE.\n\
+   --readnow          Fully read symbol files on first access.\n\
++  --readnever        Do not read symbol files.\n\
+   --write            Set writing into executable and core files.\n\n\
+ "), stream);
+   fputs_unfiltered (_("\
+diff -Naurp insight-7.8.50.20140825.orig/gdb/symfile.c insight-7.8.50.20140825.new/gdb/symfile.c
+--- insight-7.8.50.20140825.orig/gdb/symfile.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/symfile.c	2014-08-25 17:50:49.412706050 +0200
+@@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup (
+ 
+ /* Global variables owned by this file.  */
+ int readnow_symbol_files;	/* Read full symbols immediately.  */
++int readnever_symbol_files;	/* Never read full symbols.  */
+ 
+ /* Functions this file defines.  */
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/top.h insight-7.8.50.20140825.new/gdb/top.h
+--- insight-7.8.50.20140825.orig/gdb/top.h	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/top.h	2014-08-25 17:50:49.429706190 +0200
+@@ -59,6 +59,7 @@ extern void set_prompt (const char *s);
+ 
+ /* From random places.  */
+ extern int readnow_symbol_files;
++extern int readnever_symbol_files;
+ 
+ /* Perform _initialize initialization.  */
+ extern void gdb_init (char *);
diff --git a/insight-7.8.50-scheduler_locking-step-sw-watchpoints2.patch b/insight-7.8.50-scheduler_locking-step-sw-watchpoints2.patch
new file mode 100644
index 0000000..f93035f
--- /dev/null
+++ b/insight-7.8.50-scheduler_locking-step-sw-watchpoints2.patch
@@ -0,0 +1,189 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/infrun.c insight-7.8.50.20140825.new/gdb/infrun.c
+--- insight-7.8.50.20140825.orig/gdb/infrun.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/infrun.c	2014-08-25 17:46:31.188446188 +0200
+@@ -82,7 +82,7 @@ static int follow_fork (void);
+ static void set_schedlock_func (char *args, int from_tty,
+ 				struct cmd_list_element *c);
+ 
+-static int currently_stepping (struct thread_info *tp);
++static enum resume_step currently_stepping (struct thread_info *tp);
+ 
+ static void xdb_handle_command (char *args, int from_tty);
+ 
+@@ -1740,7 +1740,8 @@ user_visible_resume_ptid (int step)
+     }
+   else if ((scheduler_mode == schedlock_on)
+ 	   || (scheduler_mode == schedlock_step
+-	       && (step || singlestep_breakpoints_inserted_p)))
++	       && (step == RESUME_STEP_USER
++		   || singlestep_breakpoints_inserted_p)))
+     {
+       /* User-settable 'scheduler' mode requires solo thread resume.  */
+       resume_ptid = inferior_ptid;
+@@ -1764,7 +1765,7 @@ user_visible_resume_ptid (int step)
+    STEP nonzero if we should step (zero to continue instead).
+    SIG is the signal to give the inferior (zero for none).  */
+ void
+-resume (int step, enum gdb_signal sig)
++resume (enum resume_step step, enum gdb_signal sig)
+ {
+   struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
+   struct regcache *regcache = get_current_regcache ();
+@@ -1804,9 +1805,13 @@ resume (int step, enum gdb_signal sig)
+ 
+   if (debug_infrun)
+     fprintf_unfiltered (gdb_stdlog,
+-			"infrun: resume (step=%d, signal=%s), "
++			"infrun: resume (step=%s, signal=%s), "
+ 			"trap_expected=%d, current thread [%s] at %s\n",
+-			step, gdb_signal_to_symbol_string (sig),
++			(step == RESUME_STEP_CONTINUE
++			 ? "RESUME_STEP_CONTINUE"
++			 : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
++						     : "RESUME_STEP_NEEDED")),
++			gdb_signal_to_symbol_string (sig),
+ 			tp->control.trap_expected,
+ 			target_pid_to_str (inferior_ptid),
+ 			paddress (gdbarch, pc));
+@@ -2195,6 +2200,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
+   struct thread_info *tp;
+   CORE_ADDR pc;
+   struct address_space *aspace;
++  enum resume_step resume_step = RESUME_STEP_CONTINUE;
+ 
+   /* If we're stopped at a fork/vfork, follow the branch set by the
+      "set follow-fork-mode" command; otherwise, we'll just proceed
+@@ -2237,13 +2243,19 @@ proceed (CORE_ADDR addr, enum gdb_signal
+ 	   Note, we don't do this in reverse, because we won't
+ 	   actually be executing the breakpoint insn anyway.
+ 	   We'll be (un-)executing the previous instruction.  */
++	{
+ 	tp->stepping_over_breakpoint = 1;
++	resume_step = RESUME_STEP_USER;
++	}
+       else if (gdbarch_single_step_through_delay_p (gdbarch)
+ 	       && gdbarch_single_step_through_delay (gdbarch,
+ 						     get_current_frame ()))
+ 	/* We stepped onto an instruction that needs to be stepped
+ 	   again before re-inserting the breakpoint, do so.  */
++	{
+ 	tp->stepping_over_breakpoint = 1;
++	resume_step = RESUME_STEP_USER;
++	}
+     }
+   else
+     {
+@@ -2298,6 +2310,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
+ 	  tp->prev_pc = regcache_read_pc (get_current_regcache ());
+ 	  switch_to_thread (step_over->ptid);
+ 	  tp = step_over;
++	  resume_step = RESUME_STEP_USER;
+ 	}
+     }
+ 
+@@ -2353,9 +2366,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
+   /* Reset to normal state.  */
+   init_infwait_state ();
+ 
++  if (tp->control.trap_expected || step)
++    resume_step = RESUME_STEP_USER;
++  if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
++    resume_step = RESUME_STEP_NEEDED;
++
+   /* Resume inferior.  */
+-  resume (tp->control.trap_expected || step || bpstat_should_step (),
+-	  tp->suspend.stop_signal);
++  resume (resume_step, tp->suspend.stop_signal);
+ 
+   /* Wait for it to stop (if not standalone)
+      and in any case decode why it stopped, and act accordingly.  */
+@@ -5341,13 +5358,16 @@ switch_back_to_stepped_thread (struct ex
+ 
+ /* Is thread TP in the middle of single-stepping?  */
+ 
+-static int
++static enum resume_step
+ currently_stepping (struct thread_info *tp)
+ {
+-  return ((tp->control.step_range_end
++  if     ((tp->control.step_range_end
+ 	   && tp->control.step_resume_breakpoint == NULL)
+-	  || tp->control.trap_expected
+-	  || bpstat_should_step ());
++	  || tp->control.trap_expected)
++    return RESUME_STEP_USER;
++  if        (bpstat_should_step ())
++    return RESUME_STEP_NEEDED;
++  return RESUME_STEP_CONTINUE;
+ }
+ 
+ /* Inferior has stepped into a subroutine call with source code that
+diff -Naurp insight-7.8.50.20140825.orig/gdb/infrun.h insight-7.8.50.20140825.new/gdb/infrun.h
+--- insight-7.8.50.20140825.orig/gdb/infrun.h	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/infrun.h	2014-08-25 17:46:31.201446295 +0200
+@@ -92,7 +92,14 @@ extern void proceed (CORE_ADDR, enum gdb
+ 
+ /* The `resume' routine should only be called in special circumstances.
+    Normally, use `proceed', which handles a lot of bookkeeping.  */
+-extern void resume (int, enum gdb_signal);
++enum resume_step
++  {
++    /* currently_stepping () should return non-zero for non-continue.  */
++    RESUME_STEP_CONTINUE = 0,
++    RESUME_STEP_USER,          /* Stepping is intentional by the user.  */
++    RESUME_STEP_NEEDED         /* Stepping only for software watchpoints.  */
++  };
++extern void resume (enum resume_step, enum gdb_signal);
+ 
+ /* Return a ptid representing the set of threads that we will proceed,
+    in the perspective of the user/frontend.  */
+diff -Naurp insight-7.8.50.20140825.orig/gdb/linux-nat.c insight-7.8.50.20140825.new/gdb/linux-nat.c
+--- insight-7.8.50.20140825.orig/gdb/linux-nat.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/linux-nat.c	2014-08-25 17:46:31.195446245 +0200
+@@ -2706,7 +2706,11 @@ static int
+ select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
+ {
+   if (lp->last_resume_kind == resume_step
+-      && lp->status != 0)
++      && lp->status != 0
++      /* We do not focus on software watchpoints as we would not catch
++	 STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
++	 as they would remain pending due to `Push back breakpoint for %s'.  */
++      && lp->step == RESUME_STEP_USER)
+     return 1;
+   else
+     return 0;
+diff -Naurp insight-7.8.50.20140825.orig/gdb/linux-nat.h insight-7.8.50.20140825.new/gdb/linux-nat.h
+--- insight-7.8.50.20140825.orig/gdb/linux-nat.h	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/linux-nat.h	2014-08-25 17:46:31.199446278 +0200
+@@ -18,6 +18,7 @@
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+ 
+ #include "target.h"
++#include "infrun.h"
+ 
+ #include <signal.h>
+ 
+@@ -59,8 +60,8 @@ struct lwp_info
+   /* If non-zero, a pending wait status.  */
+   int status;
+ 
+-  /* Non-zero if we were stepping this LWP.  */
+-  int step;
++  /* The kind of stepping of this LWP.  */
++  enum resume_step step;
+ 
+   /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
+      watchpoint trap.  */
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp	2014-08-25 17:46:31.205446327 +0200
+@@ -97,7 +97,7 @@ gdb_test "set debug infrun 1"
+ 
+ gdb_test \
+     "step" \
+-    ".*need to step-over.*resume \\(step=1.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
++    ".*need to step-over.*resume \\(step=RESUME_STEP_USER.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
+     "step"
+ 
+ set cnt_after [get_value "args\[$my_number\]" "get count after step"]
diff --git a/insight-7.8.50-vla-intel.patch b/insight-7.8.50-vla-intel.patch
new file mode 100644
index 0000000..b96b62e
--- /dev/null
+++ b/insight-7.8.50-vla-intel.patch
@@ -0,0 +1,2964 @@
+diff -Naurp insight-7.8.50.20140825.orig/gdb/c-valprint.c insight-7.8.50.20140825.new/gdb/c-valprint.c
+--- insight-7.8.50.20140825.orig/gdb/c-valprint.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/c-valprint.c	2014-08-25 20:01:47.872179742 +0200
+@@ -537,7 +537,16 @@ c_value_print (struct value *val, struct
+ 	{
+ 	  /* normal case */
+ 	  fprintf_filtered (stream, "(");
+-	  type_print (value_type (val), "", stream, -1);
++	  if (is_dynamic_type (TYPE_TARGET_TYPE (type)))
++	    {
++	      struct value *v;
++
++	      v = value_ind (val);
++	      v = value_addr (v);
++	      type_print (value_type (v), "", stream, -1);
++	    }
++	  else
++	    type_print (value_type (val), "", stream, -1);
+ 	  fprintf_filtered (stream, ") ");
+ 	}
+     }
+diff -Naurp insight-7.8.50.20140825.orig/gdb/dwarf2expr.c insight-7.8.50.20140825.new/gdb/dwarf2expr.c
+--- insight-7.8.50.20140825.orig/gdb/dwarf2expr.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/dwarf2expr.c	2014-08-25 20:14:42.173733267 +0200
+@@ -1477,7 +1477,7 @@ execute_stack_op (struct dwarf_expr_cont
+ 	  }
+ 	  break;
+ 
+-	case DW_OP_push_object_address:
++        case DW_OP_push_object_address:
+ 	  /* Return the address of the object we are currently observing.  */
+ 	  result = (ctx->funcs->get_object_address) (ctx->baton);
+ 	  result_val = value_from_ulongest (address_type, result);
+diff -Naurp insight-7.8.50.20140825.orig/gdb/dwarf2loc.c insight-7.8.50.20140825.new/gdb/dwarf2loc.c
+--- insight-7.8.50.20140825.orig/gdb/dwarf2loc.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/dwarf2loc.c	2014-08-25 20:01:47.876179776 +0200
+@@ -2285,6 +2285,11 @@ dwarf2_evaluate_loc_desc_full (struct ty
+ 	    int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
+ 
+ 	    do_cleanups (value_chain);
++
++	    /* Select right frame to correctly evaluate VLA's during a backtrace.  */
++	    if (is_dynamic_type (type))
++	      select_frame (frame);
++
+ 	    retval = value_at_lazy (type, address + byte_offset);
+ 	    if (in_stack_memory)
+ 	      set_value_stack (retval, 1);
+@@ -2515,6 +2520,7 @@ struct needs_frame_baton
+ {
+   int needs_frame;
+   struct dwarf2_per_cu_data *per_cu;
++  CORE_ADDR obj_address;
+ };
+ 
+ /* Reads from registers do require a frame.  */
+@@ -2657,6 +2663,7 @@ dwarf2_loc_desc_needs_frame (const gdb_b
+ 
+   baton.needs_frame = 0;
+   baton.per_cu = per_cu;
++  baton.obj_address = 0;
+ 
+   ctx = new_dwarf_expr_context ();
+   old_chain = make_cleanup_free_dwarf_expr_context (ctx);
+@@ -3427,6 +3434,20 @@ dwarf2_compile_expr_to_ax (struct agent_
+   do_cleanups (cleanups);
+ }
+ 
++/* See dwarf2loc.h.  */
++
++int
++dwarf2_address_data_valid (const struct type *type)
++{
++  if (TYPE_NOT_ASSOCIATED (type))
++    return 0;
++
++  if (TYPE_NOT_ALLOCATED (type))
++    return 0;
++
++  return 1;
++}
++
+ 
+ /* Return the value of SYMBOL in FRAME using the DWARF-2 expression
+    evaluator to calculate the location.  */
+@@ -3856,6 +3877,10 @@ disassemble_dwarf_expression (struct ui_
+ 	  fprintf_filtered (stream, " %s", pulongest (ul));
+ 	  break;
+ 
++  case DW_OP_push_object_address:
++    unimplemented (op);
++    break;
++
+ 	case DW_OP_skip:
+ 	  l = extract_signed_integer (data, 2, gdbarch_byte_order (arch));
+ 	  data += 2;
+diff -Naurp insight-7.8.50.20140825.orig/gdb/dwarf2loc.h insight-7.8.50.20140825.new/gdb/dwarf2loc.h
+--- insight-7.8.50.20140825.orig/gdb/dwarf2loc.h	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/dwarf2loc.h	2014-08-25 20:01:47.877179785 +0200
+@@ -99,6 +99,12 @@ int dwarf2_evaluate_property (const stru
+ 			      CORE_ADDR address,
+ 			      CORE_ADDR *value);
+ 
++/* Checks if a dwarf location definition is valid.
++   Returns 1 if valid; 0 otherwise.  */
++
++extern int dwarf2_address_data_valid (const struct type *type);
++
++
+ CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
+ 				  unsigned int addr_index);
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/dwarf2read.c insight-7.8.50.20140825.new/gdb/dwarf2read.c
+--- insight-7.8.50.20140825.orig/gdb/dwarf2read.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/dwarf2read.c	2014-08-25 20:03:35.807093281 +0200
+@@ -1845,6 +1845,12 @@ static void free_dwo_file_cleanup (void
+ static void process_cu_includes (void);
+ 
+ static void check_producer (struct dwarf2_cu *cu);
++
++static int
++attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
++		      struct dwarf2_cu *cu, struct dynamic_prop *prop,
++		      const gdb_byte *additional_data, int additional_data_size);
++
+ 
+ /* Various complaints about symbol reading that don't abort the process.  */
+ 
+@@ -14201,29 +14207,92 @@ read_tag_string_type (struct die_info *d
+   struct gdbarch *gdbarch = get_objfile_arch (objfile);
+   struct type *type, *range_type, *index_type, *char_type;
+   struct attribute *attr;
+-  unsigned int length;
++  unsigned int length = UINT_MAX;
+ 
++  index_type = objfile_type (objfile)->builtin_int;
++  range_type = create_static_range_type (NULL, index_type, 1, length);
++
++  /* If DW_AT_string_length is defined, the length is stored at some location
++   * in memory. */
+   attr = dwarf2_attr (die, DW_AT_string_length, cu);
+   if (attr)
+     {
+-      length = DW_UNSND (attr);
++      if (attr_form_is_block (attr))
++        {
++          struct attribute *byte_size, *bit_size;
++          struct dynamic_prop high;
++
++          byte_size = dwarf2_attr (die, DW_AT_byte_size, cu);
++          bit_size = dwarf2_attr (die, DW_AT_bit_size, cu);
++
++          /* DW_AT_byte_size should never occur together in combination with
++             DW_AT_string_length.  */
++          if ((byte_size == NULL && bit_size != NULL) ||
++                  (byte_size != NULL && bit_size == NULL))
++            complaint (&symfile_complaints, _("DW_AT_byte_size AND "
++                      "DW_AT_bit_size found together at the same time."));
++
++          /* If DW_AT_string_length AND DW_AT_byte_size exist together, it
++             describes the number of bytes that should be read from the length
++             memory location.  */
++          if (byte_size != NULL && bit_size == NULL)
++            {
++              /* Build new dwarf2_locexpr_baton structure with additions to the
++                 data attribute, to reflect DWARF specialities to get address
++                 sizes.  */
++              const gdb_byte append_ops[] = {
++                /* DW_OP_deref_size: size of an address on the target machine
++                   (bytes), where the size will be specified by the next
++                   operand.  */
++                DW_OP_deref_size,
++                /* Operand for DW_OP_deref_size.  */
++                DW_UNSND (byte_size) };
++
++              if (!attr_to_dynamic_prop (attr, die, cu, &high,
++                      append_ops, ARRAY_SIZE (append_ops)))
++                complaint (&symfile_complaints,
++                        _("Could not parse DW_AT_byte_size"));
++            }
++          else if (bit_size != NULL && byte_size == NULL)
++            complaint (&symfile_complaints, _("DW_AT_string_length AND "
++                      "DW_AT_bit_size found but not supported yet."));
++          /* If DW_AT_string_length WITHOUT DW_AT_byte_size exist, the default
++             is the address size of the target machine.  */
++          else
++            {
++              const gdb_byte append_ops[] = { DW_OP_deref };
++
++              if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops,
++                      ARRAY_SIZE (append_ops)))
++                complaint (&symfile_complaints,
++                        _("Could not parse DW_AT_string_length"));
++            }
++
++          TYPE_RANGE_DATA (range_type)->high = high;
++        }
++      else
++        {
++          TYPE_HIGH_BOUND (range_type) = DW_UNSND (attr);
++          TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
++        }
+     }
+   else
+     {
+-      /* Check for the DW_AT_byte_size attribute.  */
++      /* Check for the DW_AT_byte_size attribute, which represents the length
++         in this case.  */
+       attr = dwarf2_attr (die, DW_AT_byte_size, cu);
+       if (attr)
+         {
+-          length = DW_UNSND (attr);
++          TYPE_HIGH_BOUND (range_type) = DW_UNSND (attr);
++          TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+         }
+       else
+         {
+-          length = 1;
++          TYPE_HIGH_BOUND (range_type) = 1;
++          TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST;
+         }
+     }
+ 
+-  index_type = objfile_type (objfile)->builtin_int;
+-  range_type = create_static_range_type (NULL, index_type, 1, length);
+   char_type = language_string_char_type (cu->language_defn, gdbarch);
+   type = create_string_type (NULL, char_type, range_type);
+ 
+@@ -14540,13 +14609,15 @@ read_base_type (struct die_info *die, st
+   return set_die_type (die, type, cu);
+ }
+ 
++
+ /* Parse dwarf attribute if it's a block, reference or constant and put the
+    resulting value of the attribute into struct bound_prop.
+    Returns 1 if ATTR could be resolved into PROP, 0 otherwise.  */
+ 
+ static int
+ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
+-		      struct dwarf2_cu *cu, struct dynamic_prop *prop)
++		      struct dwarf2_cu *cu, struct dynamic_prop *prop,
++		      const gdb_byte *additional_data, int additional_data_size)
+ {
+   struct dwarf2_property_baton *baton;
+   struct obstack *obstack = &cu->objfile->objfile_obstack;
+@@ -14559,8 +14630,25 @@ attr_to_dynamic_prop (const struct attri
+       baton = obstack_alloc (obstack, sizeof (*baton));
+       baton->referenced_type = NULL;
+       baton->locexpr.per_cu = cu->per_cu;
+-      baton->locexpr.size = DW_BLOCK (attr)->size;
+-      baton->locexpr.data = DW_BLOCK (attr)->data;
++
++      if (additional_data != NULL && additional_data_size > 0)
++        {
++          gdb_byte *data;
++
++          data = obstack_alloc (&cu->objfile->objfile_obstack,
++                  DW_BLOCK (attr)->size + additional_data_size);
++          memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size);
++          memcpy (data + DW_BLOCK (attr)->size,
++                  additional_data, additional_data_size);
++
++          baton->locexpr.data = data;
++          baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size;
++        }
++      else
++        {
++          baton->locexpr.data = DW_BLOCK (attr)->data;
++          baton->locexpr.size = DW_BLOCK (attr)->size;
++        }
+       prop->data.baton = baton;
+       prop->kind = PROP_LOCEXPR;
+       gdb_assert (prop->data.baton != NULL);
+@@ -14590,8 +14678,28 @@ attr_to_dynamic_prop (const struct attri
+ 	  baton = obstack_alloc (obstack, sizeof (*baton));
+ 	  baton->referenced_type = die_type (target_die, target_cu);
+ 	  baton->locexpr.per_cu = cu->per_cu;
+-	  baton->locexpr.size = DW_BLOCK (target_attr)->size;
+-	  baton->locexpr.data = DW_BLOCK (target_attr)->data;
++
++	  if (additional_data != NULL && additional_data_size > 0)
++	    {
++	      gdb_byte *data;
++
++	      data = obstack_alloc (&cu->objfile->objfile_obstack,
++	              DW_BLOCK (target_attr)->size + additional_data_size);
++	      memcpy (data, DW_BLOCK (target_attr)->data,
++	              DW_BLOCK (target_attr)->size);
++	      memcpy (data + DW_BLOCK (target_attr)->size,
++	              additional_data, additional_data_size);
++
++	      baton->locexpr.data = data;
++	      baton->locexpr.size = (DW_BLOCK (target_attr)->size
++	                             + additional_data_size);
++	    }
++	  else
++	    {
++	      baton->locexpr.data = DW_BLOCK (target_attr)->data;
++	      baton->locexpr.size = DW_BLOCK (target_attr)->size;
++	    }
++
+ 	  prop->data.baton = baton;
+ 	  prop->kind = PROP_LOCEXPR;
+ 	  gdb_assert (prop->data.baton != NULL);
+@@ -14626,7 +14734,7 @@ read_subrange_type (struct die_info *die
+   struct type *base_type, *orig_base_type;
+   struct type *range_type;
+   struct attribute *attr;
+-  struct dynamic_prop low, high;
++  struct dynamic_prop low, high, stride;
+   int low_default_is_valid;
+   int high_bound_is_count = 0;
+   const char *name;
+@@ -14646,7 +14754,9 @@ read_subrange_type (struct die_info *die
+ 
+   low.kind = PROP_CONST;
+   high.kind = PROP_CONST;
++  stride.kind = PROP_CONST;
+   high.data.const_val = 0;
++  stride.data.const_val = 0;
+ 
+   /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow
+      omitting DW_AT_lower_bound.  */
+@@ -14679,19 +14789,26 @@ read_subrange_type (struct die_info *die
+       break;
+     }
+ 
++  attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
++  if (attr)
++    if (!attr_to_dynamic_prop (attr, die, cu, &stride, NULL, 0))
++        complaint (&symfile_complaints, _("Missing DW_AT_byte_stride "
++                  "- DIE at 0x%x [in module %s]"),
++             die->offset.sect_off, objfile_name (cu->objfile));
++
+   attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
+   if (attr)
+-    attr_to_dynamic_prop (attr, die, cu, &low);
++    attr_to_dynamic_prop (attr, die, cu, &low, NULL, 0);
+   else if (!low_default_is_valid)
+     complaint (&symfile_complaints, _("Missing DW_AT_lower_bound "
+ 				      "- DIE at 0x%x [in module %s]"),
+ 	       die->offset.sect_off, objfile_name (cu->objfile));
+ 
+   attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
+-  if (!attr_to_dynamic_prop (attr, die, cu, &high))
++  if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
+     {
+       attr = dwarf2_attr (die, DW_AT_count, cu);
+-      if (attr_to_dynamic_prop (attr, die, cu, &high))
++      if (attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
+ 	{
+ 	  /* If bounds are constant do the final calculation here.  */
+ 	  if (low.kind == PROP_CONST && high.kind == PROP_CONST)
+@@ -14755,7 +14872,7 @@ read_subrange_type (struct die_info *die
+       && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
+     high.data.const_val |= negative_mask;
+ 
+-  range_type = create_range_type (NULL, orig_base_type, &low, &high);
++  range_type = create_range_type (NULL, orig_base_type, &low, &high, &stride);
+ 
+   if (high_bound_is_count)
+     TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1;
+@@ -21798,7 +21915,44 @@ set_die_type (struct die_info *die, stru
+ 
+   /* Read DW_AT_data_location and set in type.  */
+   attr = dwarf2_attr (die, DW_AT_data_location, cu);
+-  if (attr_to_dynamic_prop (attr, die, cu, &prop))
++  if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
++    {
++      TYPE_DATA_LOCATION (type)
++        = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
++      *TYPE_DATA_LOCATION (type) = prop;
++    }
++
++  /* Read DW_AT_allocated and set in type.  */
++  attr = dwarf2_attr (die, DW_AT_allocated, cu);
++  if (attr_form_is_block (attr))
++    {
++      struct dynamic_prop prop;
++
++      if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
++        {
++          TYPE_ALLOCATED_PROP (type)
++            = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
++          *TYPE_ALLOCATED_PROP (type) = prop;
++        }
++    }
++
++  /* Read DW_AT_associated and set in type.  */
++  attr = dwarf2_attr (die, DW_AT_associated, cu);
++  if (attr_form_is_block (attr))
++    {
++      struct dynamic_prop prop;
++
++      if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
++        {
++          TYPE_ASSOCIATED_PROP (type)
++            = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
++          *TYPE_ASSOCIATED_PROP (type) = prop;
++        }
++    }
++
++  /* Read DW_AT_data_location and set in type.  */
++  attr = dwarf2_attr (die, DW_AT_data_location, cu);
++  if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0))
+     {
+       TYPE_DATA_LOCATION (type)
+         = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
+diff -Naurp insight-7.8.50.20140825.orig/gdb/f-typeprint.c insight-7.8.50.20140825.new/gdb/f-typeprint.c
+--- insight-7.8.50.20140825.orig/gdb/f-typeprint.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/f-typeprint.c	2014-08-25 20:01:47.888179878 +0200
+@@ -30,6 +30,7 @@
+ #include "gdbcore.h"
+ #include "target.h"
+ #include "f-lang.h"
++#include "valprint.h"
+ 
+ #if 0				/* Currently unused.  */
+ static void f_type_print_args (struct type *, struct ui_file *);
+@@ -53,6 +54,17 @@ f_print_type (struct type *type, const c
+   enum type_code code;
+   int demangled_args;
+ 
++  if (TYPE_NOT_ASSOCIATED (type))
++    {
++      val_print_not_associated (stream);
++      return;
++    }
++  if (TYPE_NOT_ALLOCATED (type))
++    {
++      val_print_not_allocated (stream);
++      return;
++    }
++
+   f_type_print_base (type, stream, show, level);
+   code = TYPE_CODE (type);
+   if ((varstring != NULL && *varstring != '\0')
+@@ -167,28 +179,36 @@ f_type_print_varspec_suffix (struct type
+       if (arrayprint_recurse_level == 1)
+ 	fprintf_filtered (stream, "(");
+ 
+-      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
+-	f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
+-				     arrayprint_recurse_level);
+-
+-      lower_bound = f77_get_lowerbound (type);
+-      if (lower_bound != 1)	/* Not the default.  */
+-	fprintf_filtered (stream, "%d:", lower_bound);
+-
+-      /* Make sure that, if we have an assumed size array, we
+-         print out a warning and print the upperbound as '*'.  */
+-
+-      if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+-	fprintf_filtered (stream, "*");
++      if (TYPE_NOT_ASSOCIATED (type))
++        val_print_not_associated (stream);
++      else if (TYPE_NOT_ALLOCATED (type))
++        val_print_not_allocated (stream);
+       else
+-	{
+-	  upper_bound = f77_get_upperbound (type);
+-	  fprintf_filtered (stream, "%d", upper_bound);
+-	}
+-
+-      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
+-	f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
+-				     arrayprint_recurse_level);
++        {
++
++          if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
++            f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
++                 arrayprint_recurse_level);
++
++          lower_bound = f77_get_lowerbound (type);
++          if (lower_bound != 1)	/* Not the default.  */
++            fprintf_filtered (stream, "%d:", lower_bound);
++
++          /* Make sure that, if we have an assumed size array, we
++             print out a warning and print the upperbound as '*'.  */
++
++          if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
++            fprintf_filtered (stream, "*");
++          else
++            {
++              upper_bound = f77_get_upperbound (type);
++              fprintf_filtered (stream, "%d", upper_bound);
++            }
++
++          if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
++            f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
++                 arrayprint_recurse_level);
++      }
+       if (arrayprint_recurse_level == 1)
+ 	fprintf_filtered (stream, ")");
+       else
+diff -Naurp insight-7.8.50.20140825.orig/gdb/f-valprint.c insight-7.8.50.20140825.new/gdb/f-valprint.c
+--- insight-7.8.50.20140825.orig/gdb/f-valprint.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/f-valprint.c	2014-08-25 20:01:47.889179886 +0200
+@@ -37,8 +37,6 @@
+ 
+ extern void _initialize_f_valprint (void);
+ static void info_common_command (char *, int);
+-static void f77_create_arrayprint_offset_tbl (struct type *,
+-					      struct ui_file *);
+ static void f77_get_dynamic_length_of_aggregate (struct type *);
+ 
+ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
+@@ -46,15 +44,6 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM
+ /* Array which holds offsets to be applied to get a row's elements
+    for a given array.  Array also holds the size of each subarray.  */
+ 
+-/* The following macro gives us the size of the nth dimension, Where 
+-   n is 1 based.  */
+-
+-#define F77_DIM_SIZE(n) (f77_array_offset_tbl[n][1])
+-
+-/* The following gives us the offset for row n where n is 1-based.  */
+-
+-#define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0])
+-
+ int
+ f77_get_lowerbound (struct type *type)
+ {
+@@ -112,47 +101,6 @@ f77_get_dynamic_length_of_aggregate (str
+     * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type)));
+ }
+ 
+-/* Function that sets up the array offset,size table for the array 
+-   type "type".  */
+-
+-static void
+-f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
+-{
+-  struct type *tmp_type;
+-  int eltlen;
+-  int ndimen = 1;
+-  int upper, lower;
+-
+-  tmp_type = type;
+-
+-  while (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY)
+-    {
+-      upper = f77_get_upperbound (tmp_type);
+-      lower = f77_get_lowerbound (tmp_type);
+-
+-      F77_DIM_SIZE (ndimen) = upper - lower + 1;
+-
+-      tmp_type = TYPE_TARGET_TYPE (tmp_type);
+-      ndimen++;
+-    }
+-
+-  /* Now we multiply eltlen by all the offsets, so that later we 
+-     can print out array elements correctly.  Up till now we 
+-     know an offset to apply to get the item but we also 
+-     have to know how much to add to get to the next item.  */
+-
+-  ndimen--;
+-  eltlen = TYPE_LENGTH (tmp_type);
+-  F77_DIM_OFFSET (ndimen) = eltlen;
+-  while (--ndimen > 0)
+-    {
+-      eltlen *= F77_DIM_SIZE (ndimen + 1);
+-      F77_DIM_OFFSET (ndimen) = eltlen;
+-    }
+-}
+-
+-
+-
+ /* Actual function which prints out F77 arrays, Valaddr == address in 
+    the superior.  Address == the address in the inferior.  */
+ 
+@@ -165,41 +113,62 @@ f77_print_array_1 (int nss, int ndimensi
+ 		   const struct value_print_options *options,
+ 		   int *elts)
+ {
++  struct type *range_type = TYPE_INDEX_TYPE (check_typedef (type));
++  CORE_ADDR addr = address + embedded_offset;
++  LONGEST lowerbound, upperbound;
+   int i;
+ 
++  get_discrete_bounds (range_type, &lowerbound, &upperbound);
++
+   if (nss != ndimensions)
+     {
+-      for (i = 0;
+-	   (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max);
++      size_t dim_size;
++      size_t offs = 0;
++      LONGEST byte_stride = abs (TYPE_BYTE_STRIDE (range_type));
++
++      if (byte_stride)
++        dim_size = byte_stride;
++      else
++        dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type));
++
++      for (i = lowerbound;
++	   (i < upperbound + 1 && (*elts) < options->print_max);
+ 	   i++)
+ 	{
++	  struct value *subarray = value_from_contents_and_address
++	    (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val)
++	     + offs, addr + offs);
++
+ 	  fprintf_filtered (stream, "( ");
+-	  f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type),
+-			     valaddr,
+-			     embedded_offset + i * F77_DIM_OFFSET (nss),
+-			     address,
+-			     stream, recurse, val, options, elts);
++	  f77_print_array_1 (nss + 1, ndimensions, value_type (subarray),
++			     value_contents_for_printing (subarray),
++			     value_embedded_offset (subarray),
++			     value_address (subarray),
++			     stream, recurse, subarray, options, elts);
++	  offs += dim_size;
+ 	  fprintf_filtered (stream, ") ");
+ 	}
+-      if (*elts >= options->print_max && i < F77_DIM_SIZE (nss)) 
++      if (*elts >= options->print_max && i < upperbound)
+ 	fprintf_filtered (stream, "...");
+     }
+   else
+     {
+-      for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max;
++      for (i = lowerbound; i < upperbound + 1 && (*elts) < options->print_max;
+ 	   i++, (*elts)++)
+ 	{
+-	  val_print (TYPE_TARGET_TYPE (type),
+-		     valaddr,
+-		     embedded_offset + i * F77_DIM_OFFSET (ndimensions),
+-		     address, stream, recurse,
+-		     val, options, current_language);
++	  struct value *elt = value_subscript ((struct value *)val, i);
++
++	  val_print (value_type (elt),
++		     value_contents_for_printing (elt),
++		     value_embedded_offset (elt),
++		     value_address (elt), stream, recurse,
++		     elt, options, current_language);
+ 
+-	  if (i != (F77_DIM_SIZE (nss) - 1))
++	  if (i != upperbound)
+ 	    fprintf_filtered (stream, ", ");
+ 
+ 	  if ((*elts == options->print_max - 1)
+-	      && (i != (F77_DIM_SIZE (nss) - 1)))
++	      && (i != upperbound))
+ 	    fprintf_filtered (stream, "...");
+ 	}
+     }
+@@ -226,12 +195,6 @@ f77_print_array (struct type *type, cons
+ Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"),
+ 	   ndimensions, MAX_FORTRAN_DIMS);
+ 
+-  /* Since F77 arrays are stored column-major, we set up an 
+-     offset table to get at the various row's elements.  The 
+-     offset table contains entries for both offset and subarray size.  */
+-
+-  f77_create_arrayprint_offset_tbl (type, stream);
+-
+   f77_print_array_1 (1, ndimensions, type, valaddr, embedded_offset,
+ 		     address, stream, recurse, val, options, &elts);
+ }
+@@ -376,12 +339,15 @@ f_val_print (struct type *type, const gd
+       fprintf_filtered (stream, "( ");
+       for (index = 0; index < TYPE_NFIELDS (type); index++)
+         {
+-          int offset = TYPE_FIELD_BITPOS (type, index) / 8;
++	  struct value *field = value_field
++	    ((struct value *)original_value, index);
++
++          val_print (value_type (field),
++		     value_contents_for_printing (field),
++		     value_embedded_offset (field),
++		     value_address (field), stream, recurse + 1,
++		     field, options, current_language);
+ 
+-          val_print (TYPE_FIELD_TYPE (type, index), valaddr,
+-		     embedded_offset + offset,
+-		     address, stream, recurse + 1,
+-		     original_value, options, current_language);
+           if (index != TYPE_NFIELDS (type) - 1)
+             fputs_filtered (", ", stream);
+         }
+diff -Naurp insight-7.8.50.20140825.orig/gdb/gdbtypes.c insight-7.8.50.20140825.new/gdb/gdbtypes.c
+--- insight-7.8.50.20140825.orig/gdb/gdbtypes.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/gdbtypes.c	2014-08-25 20:01:47.891179903 +0200
+@@ -803,7 +803,8 @@ allocate_stub_method (struct type *type)
+ struct type *
+ create_range_type (struct type *result_type, struct type *index_type,
+ 		   const struct dynamic_prop *low_bound,
+-		   const struct dynamic_prop *high_bound)
++		   const struct dynamic_prop *high_bound,
++		   const struct dynamic_prop *stride)
+ {
+   if (result_type == NULL)
+     result_type = alloc_type_copy (index_type);
+@@ -818,6 +819,7 @@ create_range_type (struct type *result_t
+     TYPE_ZALLOC (result_type, sizeof (struct range_bounds));
+   TYPE_RANGE_DATA (result_type)->low = *low_bound;
+   TYPE_RANGE_DATA (result_type)->high = *high_bound;
++  TYPE_RANGE_DATA (result_type)->stride = *stride;
+ 
+   if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
+     TYPE_UNSIGNED (result_type) = 1;
+@@ -839,7 +841,7 @@ struct type *
+ create_static_range_type (struct type *result_type, struct type *index_type,
+ 			  LONGEST low_bound, LONGEST high_bound)
+ {
+-  struct dynamic_prop low, high;
++  struct dynamic_prop low, high, stride;
+ 
+   low.kind = PROP_CONST;
+   low.data.const_val = low_bound;
+@@ -847,7 +849,11 @@ create_static_range_type (struct type *r
+   high.kind = PROP_CONST;
+   high.data.const_val = high_bound;
+ 
+-  result_type = create_range_type (result_type, index_type, &low, &high);
++  stride.kind = PROP_CONST;
++  stride.data.const_val = 0;
++
++  result_type = create_range_type (result_type, index_type,
++                                   &low, &high, &stride);
+ 
+   return result_type;
+ }
+@@ -1001,18 +1007,24 @@ create_array_type_with_stride (struct ty
+ 
+   TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
+   TYPE_TARGET_TYPE (result_type) = element_type;
+-  if (has_static_range (TYPE_RANGE_DATA (range_type)))
++  if (has_static_range (TYPE_RANGE_DATA (range_type))
++      && dwarf2_address_data_valid (result_type))
+     {
+-      LONGEST low_bound, high_bound;
++      LONGEST low_bound, high_bound, byte_stride;
+ 
+       if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
+ 	low_bound = high_bound = 0;
+       CHECK_TYPEDEF (element_type);
++
++      byte_stride = abs (TYPE_BYTE_STRIDE (range_type));
++
+       /* Be careful when setting the array length.  Ada arrays can be
+ 	 empty arrays with the high_bound being smaller than the low_bound.
+ 	 In such cases, the array length should be zero.  */
+       if (high_bound < low_bound)
+ 	TYPE_LENGTH (result_type) = 0;
++      else if (byte_stride > 0)
++	TYPE_LENGTH (result_type) = byte_stride * (high_bound - low_bound + 1);
+       else if (bit_stride > 0)
+ 	TYPE_LENGTH (result_type) =
+ 	  (bit_stride * (high_bound - low_bound + 1) + 7) / 8;
+@@ -1614,12 +1626,31 @@ stub_noname_complaint (void)
+ static int
+ is_dynamic_type_internal (struct type *type, int top_level)
+ {
++  int index;
++
++  if (!type)
++    return 0;
++
+   type = check_typedef (type);
+ 
+   /* We only want to recognize references at the outermost level.  */
+   if (top_level && TYPE_CODE (type) == TYPE_CODE_REF)
+     type = check_typedef (TYPE_TARGET_TYPE (type));
+ 
++  if (TYPE_ASSOCIATED_PROP (type))
++    return 1;
++
++  if (TYPE_ALLOCATED_PROP (type))
++    return 1;
++
++  /* Scan field types in the Fortran case for nested dynamic types.
++     This will be done only for Fortran as in the C++ case an endless recursion
++     can occur in the area of classes.  */
++  if (current_language->la_language == language_fortran)
++    for (index = 0; index < TYPE_NFIELDS (type); index++)
++      if (is_dynamic_type (TYPE_FIELD_TYPE (type, index)))
++        return 1;
++
+   /* Types that have a dynamic TYPE_DATA_LOCATION are considered
+      dynamic, even if the type itself is statically defined.
+      From a user's point of view, this may appear counter-intuitive;
+@@ -1640,11 +1671,19 @@ is_dynamic_type_internal (struct type *t
+       {
+ 	gdb_assert (TYPE_NFIELDS (type) == 1);
+ 
+-	/* The array is dynamic if either the bounds are dynamic,
+-	   or the elements it contains have a dynamic contents.  */
++	/* The array is dynamic if either
++     - the bounds are dynamic,
++	   - the elements it contains have a dynamic contents
++     - a data_locaton attribute was found.  */
+ 	if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type), 0))
+ 	  return 1;
+-	return is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0);
++	else if (TYPE_DATA_LOCATION (type) != NULL
++	         && (TYPE_DATA_LOCATION_KIND (type) == PROP_LOCEXPR
++	             || TYPE_DATA_LOCATION_KIND (type) == PROP_LOCLIST))
++    return 1;
++  else
++    return is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0);
++	break;
+       }
+ 
+     case TYPE_CODE_STRUCT:
+@@ -1657,6 +1696,17 @@ is_dynamic_type_internal (struct type *t
+ 	      && is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0))
+ 	    return 1;
+       }
++    case TYPE_CODE_PTR:
++      {
++        if (TYPE_TARGET_TYPE (type)
++            && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRING)
++          return is_dynamic_type (check_typedef (TYPE_TARGET_TYPE (type)));
++
++        return 0;
++        break;
++      }
++    default:
++      return 0;
+       break;
+     }
+ 
+@@ -1685,7 +1735,8 @@ resolve_dynamic_range (struct type *dyn_
+   struct type *static_range_type;
+   const struct dynamic_prop *prop;
+   const struct dwarf2_locexpr_baton *baton;
+-  struct dynamic_prop low_bound, high_bound;
++  struct dynamic_prop low_bound, high_bound, stride;
++  struct type *range_copy = copy_type (dyn_range_type);
+ 
+   gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE);
+ 
+@@ -1716,10 +1767,17 @@ resolve_dynamic_range (struct type *dyn_
+       high_bound.kind = PROP_UNDEFINED;
+       high_bound.data.const_val = 0;
+     }
++  
++  prop = &TYPE_RANGE_DATA (dyn_range_type)->stride;
++  if (dwarf2_evaluate_property (prop, addr, &value))
++    {
++      stride.kind = PROP_CONST;
++      stride.data.const_val = value;
++    }
+ 
+-  static_range_type = create_range_type (copy_type (dyn_range_type),
+-					 TYPE_TARGET_TYPE (dyn_range_type),
+-					 &low_bound, &high_bound);
++  static_range_type = create_range_type (range_copy,
++					 TYPE_TARGET_TYPE (range_copy),
++					 &low_bound, &high_bound, &stride);
+   TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
+   return static_range_type;
+ }
+@@ -1735,23 +1793,46 @@ resolve_dynamic_array (struct type *type
+   struct type *elt_type;
+   struct type *range_type;
+   struct type *ary_dim;
++  struct dynamic_prop *prop;
++  struct type *copy = copy_type (type);
+ 
+-  gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);
++  gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY
++              || TYPE_CODE (type) == TYPE_CODE_STRING);
+ 
+   elt_type = type;
+   range_type = check_typedef (TYPE_INDEX_TYPE (elt_type));
+   range_type = resolve_dynamic_range (range_type, addr);
+ 
++  prop = TYPE_ALLOCATED_PROP (type);
++  if (dwarf2_evaluate_property (prop, addr, &value))
++    {
++      TYPE_ALLOCATED_PROP (copy)->kind = PROP_CONST;
++      TYPE_ALLOCATED_PROP (copy)->data.const_val = value;
++    }
++
++  prop = TYPE_ASSOCIATED_PROP (type);
++  if (dwarf2_evaluate_property (prop, addr, &value))
++    {
++      TYPE_ASSOCIATED_PROP (copy)->kind = PROP_CONST;
++      TYPE_ASSOCIATED_PROP (copy)->data.const_val = value;
++    }
++
+   ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
+ 
+-  if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY)
+-    elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type), addr);
++  if (ary_dim != NULL && (TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY
++          || TYPE_CODE (ary_dim) == TYPE_CODE_STRING))
++    elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (copy), addr);
+   else
+     elt_type = TYPE_TARGET_TYPE (type);
+ 
+-  return create_array_type (copy_type (type),
+-			    elt_type,
+-			    range_type);
++  if (TYPE_CODE (type) == TYPE_CODE_STRING)
++    return create_string_type (copy,
++            elt_type,
++            range_type);
++  else
++    return create_array_type (copy,
++            elt_type,
++            range_type);
+ }
+ 
+ /* Resolve dynamic bounds of members of the union TYPE to static
+@@ -1890,6 +1971,7 @@ resolve_dynamic_type_internal (struct ty
+ 	}
+ 
+       case TYPE_CODE_ARRAY:
++      case TYPE_CODE_STRING:
+ 	resolved_type = resolve_dynamic_array (type, addr);
+ 	break;
+ 
+@@ -1916,6 +1998,25 @@ resolve_dynamic_type_internal (struct ty
+   else
+     TYPE_DATA_LOCATION (resolved_type) = NULL;
+ 
++  /* Resolve data_location attribute.  */
++  prop = TYPE_DATA_LOCATION (resolved_type);
++  if (dwarf2_evaluate_property (prop, addr, &value))
++    {
++      struct type *range_type = TYPE_INDEX_TYPE (resolved_type);
++
++      /* Adjust the data location with the value of byte stride if set, which
++         can describe the separation between successive elements along the
++         dimension.  */
++      if (TYPE_BYTE_STRIDE (range_type) < 0)
++        value += (TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type))
++                  * TYPE_BYTE_STRIDE (range_type);
++
++      TYPE_DATA_LOCATION_ADDR (resolved_type) = value;
++      TYPE_DATA_LOCATION_KIND (resolved_type) = PROP_CONST;
++    }
++  else
++    TYPE_DATA_LOCATION (resolved_type) = NULL;
++
+   return resolved_type;
+ }
+ 
+@@ -4142,6 +4243,27 @@ copy_type_recursive (struct objfile *obj
+ 	      sizeof (struct dynamic_prop));
+     }
+ 
++  /* Copy the data location information.  */
++  if (TYPE_DATA_LOCATION (type) != NULL)
++    {
++      TYPE_DATA_LOCATION (new_type) = xmalloc (sizeof (struct dynamic_prop));
++      *TYPE_DATA_LOCATION (new_type) = *TYPE_DATA_LOCATION (type);
++    }
++
++  /* Copy allocated information.  */
++  if (TYPE_ALLOCATED_PROP (type) != NULL)
++    {
++      TYPE_ALLOCATED_PROP (new_type) = xmalloc (sizeof (struct dynamic_prop));
++      *TYPE_ALLOCATED_PROP (new_type) = *TYPE_ALLOCATED_PROP (type);
++    }
++
++  /* Copy associated information.  */
++  if (TYPE_ASSOCIATED_PROP (type) != NULL)
++    {
++      TYPE_ASSOCIATED_PROP (new_type) = xmalloc (sizeof (struct dynamic_prop));
++      *TYPE_ASSOCIATED_PROP (new_type) = *TYPE_ASSOCIATED_PROP (type);
++    }
++
+   /* Copy pointers to other types.  */
+   if (TYPE_TARGET_TYPE (type))
+     TYPE_TARGET_TYPE (new_type) = 
+@@ -4195,6 +4317,44 @@ copy_type (const struct type *type)
+ 	      sizeof (struct dynamic_prop));
+     }
+ 
++  if (TYPE_ALLOCATED_PROP (type))
++    {
++      TYPE_ALLOCATED_PROP (new_type)
++              = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
++                                struct dynamic_prop);
++      memcpy (TYPE_ALLOCATED_PROP (new_type), TYPE_ALLOCATED_PROP (type),
++        sizeof (struct dynamic_prop));
++    }
++
++  if (TYPE_ASSOCIATED_PROP (type))
++    {
++      TYPE_ASSOCIATED_PROP (new_type)
++              = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
++                                struct dynamic_prop);
++      memcpy (TYPE_ASSOCIATED_PROP (new_type), TYPE_ASSOCIATED_PROP (type),
++        sizeof (struct dynamic_prop));
++    }
++
++  if (TYPE_DATA_LOCATION (type))
++    {
++      TYPE_DATA_LOCATION (new_type)
++              = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
++                                struct dynamic_prop);
++      memcpy (TYPE_DATA_LOCATION (new_type), TYPE_DATA_LOCATION (type),
++        sizeof (struct dynamic_prop));
++    }
++
++  if (TYPE_NFIELDS (type))
++    {
++      int nfields = TYPE_NFIELDS (type);
++
++      TYPE_FIELDS (new_type)
++              = OBSTACK_CALLOC (&TYPE_OWNER (type).objfile->objfile_obstack,
++                                nfields, struct field);
++      memcpy (TYPE_FIELDS (new_type), TYPE_FIELDS (type),
++        nfields * sizeof (struct field));
++   }
++
+   return new_type;
+ }
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/gdbtypes.h insight-7.8.50.20140825.new/gdb/gdbtypes.h
+--- insight-7.8.50.20140825.orig/gdb/gdbtypes.h	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/gdbtypes.h	2014-08-25 20:01:47.892179912 +0200
+@@ -669,6 +669,10 @@ struct main_type
+ 
+       struct dynamic_prop high;
+ 
++      /* * Stride of range.  */
++
++      struct dynamic_prop stride;
++
+       /* True if HIGH range bound contains the number of elements in the
+ 	 subrange. This affects how the final hight bound is computed.  */
+ 
+@@ -729,6 +733,18 @@ struct main_type
+      this field yields to the location of the data for an object.  */
+ 
+   struct dynamic_prop *data_location;
++
++  /* Structure for DW_AT_allocated.
++     The presence of this attribute indicates that the object of the type
++     can be allocated/deallocated.  The value can be a dwarf expression,
++     reference, or a constant.  */
++  struct dynamic_prop *allocated;
++
++  /* Structure for DW_AT_associated.
++     The presence of this attribute indicated that the object of the type
++     can be associated.  The value can be a dwarf expression,
++     reference, or a constant.  */
++  struct dynamic_prop *associated;
+ };
+ 
+ /* * A ``struct type'' describes a particular instance of a type, with
+@@ -1207,6 +1223,39 @@ extern void allocate_gnat_aux_type (stru
+   TYPE_RANGE_DATA(range_type)->high.kind
+ #define TYPE_LOW_BOUND_KIND(range_type) \
+   TYPE_RANGE_DATA(range_type)->low.kind
++#define TYPE_BYTE_STRIDE(range_type) \
++  TYPE_RANGE_DATA(range_type)->stride.data.const_val
++#define TYPE_BYTE_STRIDE_BLOCK(range_type) \
++  TYPE_RANGE_DATA(range_type)->stride.data.locexpr
++#define TYPE_BYTE_STRIDE_LOCLIST(range_type) \
++  TYPE_RANGE_DATA(range_type)->stride.data.loclist
++#define TYPE_BYTE_STRIDE_KIND(range_type) \
++  TYPE_RANGE_DATA(range_type)->stride.kind
++
++
++/* Attribute accessors for the type data location.  */
++#define TYPE_DATA_LOCATION(thistype) \
++  TYPE_MAIN_TYPE(thistype)->data_location
++#define TYPE_DATA_LOCATION_BATON(thistype) \
++  TYPE_DATA_LOCATION (thistype)->data.baton
++#define TYPE_DATA_LOCATION_ADDR(thistype) \
++  TYPE_DATA_LOCATION (thistype)->data.const_val
++#define TYPE_DATA_LOCATION_KIND(thistype) \
++  TYPE_DATA_LOCATION (thistype)->kind
++#define TYPE_ALLOCATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->allocated
++#define TYPE_ASSOCIATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->associated
++
++/* Allocated status of type object.  If set to non-zero it means the object
++   is allocated. A zero value means it is not allocated.  */
++#define TYPE_NOT_ALLOCATED(t)  (TYPE_ALLOCATED_PROP (t) \
++  && TYPE_ALLOCATED_PROP (t)->kind == PROP_CONST \
++  && !TYPE_ALLOCATED_PROP (t)->data.const_val)
++
++/* Associated status of type object.  If set to non-zero it means the object
++   is associated. A zero value means it is not associated.  */
++#define TYPE_NOT_ASSOCIATED(t)  (TYPE_ASSOCIATED_PROP (t) \
++  && TYPE_ASSOCIATED_PROP (t)->kind == PROP_CONST \
++  && !TYPE_ASSOCIATED_PROP (t)->data.const_val)
+ 
+ /* Attribute accessors for the type data location.  */
+ #define TYPE_DATA_LOCATION(thistype) \
+@@ -1224,6 +1273,9 @@ extern void allocate_gnat_aux_type (stru
+    TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
+ #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
+    TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
++#define TYPE_ARRAY_STRIDE_IS_UNDEFINED(arraytype) \
++   (TYPE_BYTE_STRIDE(TYPE_INDEX_TYPE(arraytype)) == 0)
++
+ 
+ #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
+    (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
+@@ -1692,6 +1744,7 @@ extern struct type *create_array_type_wi
+ 
+ extern struct type *create_range_type (struct type *, struct type *,
+ 				       const struct dynamic_prop *,
++				       const struct dynamic_prop *,
+ 				       const struct dynamic_prop *);
+ 
+ extern struct type *create_array_type (struct type *, struct type *,
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp	2014-08-25 20:01:47.893179920 +0200
+@@ -0,0 +1,65 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Check the association status of various types of VLA's
++# and pointer to VLA's.
++gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
++gdb_continue_to_breakpoint "vla1-allocated"
++gdb_test "print l" " = \\.TRUE\\." \
++  "print vla1 allocation status (allocated)"
++
++gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
++gdb_continue_to_breakpoint "vla2-allocated"
++gdb_test "print l" " = \\.TRUE\\." \
++  "print vla2 allocation status (allocated)"
++
++gdb_breakpoint [gdb_get_line_number "pvla-associated"]
++gdb_continue_to_breakpoint "pvla-associated"
++gdb_test "print l" " = \\.TRUE\\." \
++  "print pvla associated status (associated)"
++
++gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
++gdb_continue_to_breakpoint "pvla-re-associated"
++gdb_test "print l" " = \\.TRUE\\." \
++  "print pvla associated status (re-associated)"
++
++gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
++gdb_continue_to_breakpoint "pvla-deassociated"
++gdb_test "print l" " = \\.FALSE\\." \
++  "print pvla allocation status (deassociated)"
++
++gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
++gdb_continue_to_breakpoint "vla1-deallocated"
++gdb_test "print l" " = \\.FALSE\\." \
++  "print vla1 allocation status (deallocated)"
++gdb_test "print vla1" " = <not allocated>" \
++  "print deallocated vla1"
++
++gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
++gdb_continue_to_breakpoint "vla2-deallocated"
++gdb_test "print l" " = \\.FALSE\\." "print vla2 deallocated"
++gdb_test "print vla2" " = <not allocated>" "print deallocated vla2"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-datatypes.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-datatypes.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-datatypes.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-datatypes.exp	2014-08-25 20:01:47.893179920 +0200
+@@ -0,0 +1,82 @@
++# Copyright 2014 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/>.
++
++standard_testfile ".f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++# check that all fortran standard datatypes will be
++# handled correctly when using as VLA's
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++gdb_breakpoint [gdb_get_line_number "vlas-allocated"]
++gdb_continue_to_breakpoint "vlas-allocated"
++gdb_test "next" " = allocated\\\(realvla\\\)" \
++  "next to allocation status of intvla"
++gdb_test "print l" " = \\.TRUE\\." "intvla allocated"
++gdb_test "next" " = allocated\\\(complexvla\\\)" \
++  "next to allocation status of realvla"
++gdb_test "print l" " = \\.TRUE\\." "realvla allocated"
++gdb_test "next" " = allocated\\\(logicalvla\\\)" \
++  "next to allocation status of complexvla"
++gdb_test "print l" " = \\.TRUE\\." "complexvla allocated"
++gdb_test "next" " = allocated\\\(charactervla\\\)" \
++  "next to allocation status of logicalvla"
++gdb_test "print l" " = \\.TRUE\\." "logicalvla allocated"
++gdb_test "next" "intvla\\\(:,:,:\\\) = 1" \
++  "next to allocation status of charactervla"
++gdb_test "print l" " = \\.TRUE\\." "charactervla allocated"
++
++gdb_breakpoint [gdb_get_line_number "vlas-initialized"]
++gdb_continue_to_breakpoint "vlas-initialized"
++gdb_test "ptype intvla" "type = integer\\\(kind=4\\\) \\\(11,22,33\\\)" \
++  "ptype intvla"
++gdb_test "ptype realvla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \
++  "ptype realvla"
++gdb_test "ptype complexvla" "type = complex\\\(kind=4\\\) \\\(11,22,33\\\)" \
++  "ptype complexvla"
++gdb_test "ptype logicalvla" "type = logical\\\(kind=4\\\) \\\(11,22,33\\\)" \
++  "ptype logicalvla"
++gdb_test "ptype charactervla" "type = character\\\*1 \\\(11,22,33\\\)" \
++  "ptype charactervla"
++
++gdb_test "print intvla(5,5,5)" " = 1" "print intvla(5,5,5) (1st)"
++gdb_test "print realvla(5,5,5)" " = 3.14\\d+" \
++  "print realvla(5,5,5) (1st)"
++gdb_test "print complexvla(5,5,5)" " = \\\(2,-3\\\)" \
++  "print complexvla(5,5,5) (1st)"
++gdb_test "print logicalvla(5,5,5)" " = \\.TRUE\\." \
++  "print logicalvla(5,5,5) (1st)"
++gdb_test "print charactervla(5,5,5)" " = 'K'" \
++  "print charactervla(5,5,5) (1st)"
++
++gdb_breakpoint [gdb_get_line_number "vlas-modified"]
++gdb_continue_to_breakpoint "vlas-modified"
++gdb_test "print intvla(5,5,5)" " = 42" "print intvla(5,5,5) (2nd)"
++gdb_test "print realvla(5,5,5)" " = 4.13\\d+" \
++  "print realvla(5,5,5) (2nd)"
++gdb_test "print complexvla(5,5,5)" " = \\\(-3,2\\\)" \
++  "print complexvla(5,5,5) (2nd)"
++gdb_test "print logicalvla(5,5,5)" " = \\.FALSE\\." \
++  "print logicalvla(5,5,5) (2nd)"
++gdb_test "print charactervla(5,5,5)" " = 'X'" \
++  "print charactervla(5,5,5) (2nd)"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-datatypes.f90 insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-datatypes.f90
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-datatypes.f90	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-datatypes.f90	2014-08-25 20:01:47.894179929 +0200
+@@ -0,0 +1,51 @@
++! Copyright 2014 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.
++
++program vla_primitives
++  integer, allocatable    :: intvla(:, :, :)
++  real, allocatable       :: realvla(:, :, :)
++  complex, allocatable    :: complexvla(:, :, :)
++  logical, allocatable    :: logicalvla(:, :, :)
++  character, allocatable  :: charactervla(:, :, :)
++  logical                 :: l
++
++  allocate (intvla (11,22,33))
++  allocate (realvla (11,22,33))
++  allocate (complexvla (11,22,33))
++  allocate (logicalvla (11,22,33))
++  allocate (charactervla (11,22,33))
++
++  l = allocated(intvla)                   ! vlas-allocated
++  l = allocated(realvla)
++  l = allocated(complexvla)
++  l = allocated(logicalvla)
++  l = allocated(charactervla)
++
++  intvla(:,:,:) = 1
++  realvla(:,:,:) = 3.14
++  complexvla(:,:,:) = cmplx(2.0,-3.0)
++  logicalvla(:,:,:) = .TRUE.
++  charactervla(:,:,:) = char(75)
++
++  intvla(5,5,5) = 42                      ! vlas-initialized
++  realvla(5,5,5) = 4.13
++  complexvla(5,5,5) = cmplx(-3.0,2.0)
++  logicalvla(5,5,5) = .FALSE.
++  charactervla(5,5,5) = 'X'
++
++  ! dummy statement for bp
++  l = .FALSE.                             ! vlas-modified
++end program vla_primitives
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla.f90 insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla.f90
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla.f90	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla.f90	2014-08-25 20:01:47.894179929 +0200
+@@ -0,0 +1,56 @@
++! Copyright 2014 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/>.
++
++program vla
++  real, target, allocatable :: vla1 (:, :, :)
++  real, target, allocatable :: vla2 (:, :, :)
++  real, target, allocatable :: vla3 (:, :)
++  real, pointer :: pvla (:, :, :)
++  logical :: l
++
++  allocate (vla1 (10,10,10))          ! vla1-init
++  l = allocated(vla1)
++
++  allocate (vla2 (1:7,42:50,13:35))   ! vla1-allocated
++  l = allocated(vla2)
++
++  vla1(:, :, :) = 1311                ! vla2-allocated
++  vla1(3, 6, 9) = 42
++  vla1(1, 3, 8) = 1001
++  vla1(6, 2, 7) = 13
++
++  vla2(:, :, :) = 1311                ! vla1-filled
++  vla2(5, 45, 20) = 42
++
++  pvla => vla1                        ! vla2-filled
++  l = associated(pvla)
++
++  pvla => vla2                        ! pvla-associated
++  l = associated(pvla)
++  pvla(5, 45, 20) = 1
++  pvla(7, 45, 14) = 2
++
++  pvla => null()                      ! pvla-re-associated
++  l = associated(pvla)
++
++  deallocate (vla1)                   ! pvla-deassociated
++  l = allocated(vla1)
++
++  deallocate (vla2)                   ! vla1-deallocated
++  l = allocated(vla2)
++
++  allocate (vla3 (2,2))               ! vla2-deallocated
++  vla3(:,:) = 13
++end program vla
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-func.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-func.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-func.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-func.exp	2014-08-25 20:01:47.895179937 +0200
+@@ -0,0 +1,61 @@
++# Copyright 2014 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/>.
++
++standard_testfile ".f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Check VLA passed to first Fortran function.
++gdb_breakpoint [gdb_get_line_number "func1-vla-passed"]
++gdb_continue_to_breakpoint "func1-vla-passed"
++gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \
++  "print vla (func1)"
++gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10,10\\\)" \
++  "ptype vla (func1)"
++
++gdb_breakpoint [gdb_get_line_number "func1-vla-modified"]
++gdb_continue_to_breakpoint "func1-vla-modified"
++gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)"
++gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)"
++
++# Check if the values are correct after returning from func1
++gdb_breakpoint [gdb_get_line_number "func1-returned"]
++gdb_continue_to_breakpoint "func1-returned"
++gdb_test "print ret" " = .TRUE." "print ret after func1 returned"
++
++# Check VLA passed to second Fortran function
++gdb_breakpoint [gdb_get_line_number "func2-vla-passed"]
++gdb_continue_to_breakpoint "func2-vla-passed"
++gdb_test "print vla" \
++  " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \
++  "print vla (func2)"
++gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
++  "ptype vla (func2)"
++
++# Check if the returned VLA has the correct values and ptype.
++gdb_breakpoint [gdb_get_line_number "func2-returned"]
++gdb_continue_to_breakpoint "func2-returned"
++gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \
++  "print vla3 (after func2)"
++gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
++  "ptype vla3 (after func2)"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-func.f90 insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-func.f90
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-func.f90	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-func.f90	2014-08-25 20:01:47.895179937 +0200
+@@ -0,0 +1,71 @@
++! Copyright 2014 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.
++
++logical function func1 (vla)
++  implicit none
++  integer, allocatable :: vla (:, :)
++  func1 = allocated(vla)
++  vla(5,5) = 55               ! func1-vla-passed
++  vla(7,7) = 77
++  return                      ! func1-vla-modified
++end function func1
++
++function func2(vla)
++  implicit none
++  integer :: vla (:)
++  integer :: func2(size(vla))
++  integer :: k
++
++  vla(1) = 1                    ! func2-vla-passed
++  vla(2) = 2
++  vla(4) = 4
++  vla(8) = 8
++
++  func2 = vla
++end function func2
++
++program vla_func
++  implicit none
++  interface
++    logical function func1 (vla)
++      integer :: vla (:, :)
++    end function
++  end interface
++  interface
++    function func2 (vla)
++      integer :: vla (:)
++      integer func2(size(vla))
++    end function
++  end interface
++
++  logical :: ret
++  integer, allocatable :: vla1 (:, :)
++  integer, allocatable :: vla2 (:)
++  integer, allocatable :: vla3 (:)
++
++  ret = .FALSE.
++
++  allocate (vla1 (10,10))
++  vla1(:,:) = 22
++
++  allocate (vla2 (10))
++  vla2(:) = 44
++
++  ret = func1(vla1)
++  vla3 = func2(vla2)          ! func1-returned
++
++  ret = .TRUE.                ! func2-returned
++end program vla_func
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-history.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-history.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-history.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-history.exp	2014-08-25 20:01:47.895179937 +0200
+@@ -0,0 +1,62 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Set some breakpoints and print complete vla.
++gdb_breakpoint [gdb_get_line_number "vla1-init"]
++gdb_continue_to_breakpoint "vla1-init"
++gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
++
++gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
++gdb_continue_to_breakpoint "vla2-allocated"
++gdb_test "print vla1" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
++  "print vla1 allocated"
++gdb_test "print vla2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
++  "print vla2 allocated"
++
++gdb_breakpoint [gdb_get_line_number "vla1-filled"]
++gdb_continue_to_breakpoint "vla1-filled"
++gdb_test "print vla1" \
++  " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" \
++  "print vla1 filled"
++
++# Try to access history values for full vla prints.
++gdb_test "print \$1" " = <not allocated>" "print \$1"
++gdb_test "print \$2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
++  "print \$2"
++gdb_test "print \$3" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
++  "print \$3"
++gdb_test "print \$4" \
++  " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" "print \$4"
++
++gdb_breakpoint [gdb_get_line_number "vla2-filled"]
++gdb_continue_to_breakpoint "vla2-filled"
++gdb_test "print vla2(1,43,20)" " = 1311" "print vla2(1,43,20)"
++gdb_test "print vla1(1,3,8)" " = 1001" "print vla2(1,3,8)"
++
++# Try to access history values for vla values.
++gdb_test "print \$9" " = 1311" "print \$9"
++gdb_test "print \$10" " = 1001" "print \$10"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-ptype.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-ptype.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-ptype.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-ptype.exp	2014-08-25 20:01:47.896179946 +0200
+@@ -0,0 +1,96 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Check the ptype of various VLA states and pointer to VLA's.
++gdb_breakpoint [gdb_get_line_number "vla1-init"]
++gdb_continue_to_breakpoint "vla1-init"
++gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not initialized"
++gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not initialized"
++gdb_test "ptype pvla" "type = <not associated>" "ptype pvla not initialized"
++gdb_test "ptype vla1(3, 6, 9)" "no such vector element because not allocated" \
++  "ptype vla1(3, 6, 9) not initialized"
++gdb_test "ptype vla2(5, 45, 20)" \
++  "no such vector element because not allocated" \
++  "ptype vla1(5, 45, 20) not initialized"
++
++gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
++gdb_continue_to_breakpoint "vla1-allocated"
++gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
++  "ptype vla1 allocated"
++
++gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
++gdb_continue_to_breakpoint "vla2-allocated"
++gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
++  "ptype vla2 allocated"
++
++gdb_breakpoint [gdb_get_line_number "vla1-filled"]
++gdb_continue_to_breakpoint "vla1-filled"
++gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
++  "ptype vla1 filled"
++gdb_test "ptype vla1(3, 6, 9)" "type = real\\\(kind=4\\\)" \
++  "ptype vla1(3, 6, 9)"
++
++gdb_breakpoint [gdb_get_line_number "vla2-filled"]
++gdb_continue_to_breakpoint "vla2-filled"
++gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
++  "ptype vla2 filled"
++gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \
++  "ptype vla1(5, 45, 20) filled"
++
++gdb_breakpoint [gdb_get_line_number "pvla-associated"]
++gdb_continue_to_breakpoint "pvla-associated"
++gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
++  "ptype pvla associated"
++gdb_test "ptype pvla(3, 6, 9)" "type = real\\\(kind=4\\\)" \
++  "ptype pvla(3, 6, 9)"
++
++gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
++gdb_continue_to_breakpoint "pvla-re-associated"
++gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
++  "ptype pvla re-associated"
++gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \
++  "ptype vla1(5, 45, 20) re-associated"
++
++gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
++gdb_continue_to_breakpoint "pvla-deassociated"
++gdb_test "ptype pvla" "type = <not associated>" "ptype pvla deassociated"
++gdb_test "ptype pvla(5, 45, 20)" \
++  "no such vector element because not associated" \
++  "ptype pvla(5, 45, 20) not associated"
++
++gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
++gdb_continue_to_breakpoint "vla1-deallocated"
++gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not allocated"
++gdb_test "ptype vla1(3, 6, 9)" "no such vector element because not allocated" \
++  "ptype vla1(3, 6, 9) not allocated"
++
++gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
++gdb_continue_to_breakpoint "vla2-deallocated"
++gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not allocated"
++gdb_test "ptype vla2(5, 45, 20)" \
++  "no such vector element because not allocated" \
++  "ptype vla2(5, 45, 20) not allocated"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp	2014-08-25 20:01:47.896179946 +0200
+@@ -0,0 +1,87 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla-sub.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Pass fixed array to function and handle them as vla in function.
++gdb_breakpoint [gdb_get_line_number "not-filled"]
++gdb_continue_to_breakpoint "not-filled (1st)"
++gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(42,42\\\)" \
++  "ptype array1 (passed fixed)"
++gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(42,42,42\\\)" \
++  "ptype array2 (passed fixed)"
++gdb_test "ptype array1(40, 10)" "type = integer\\\(kind=4\\\)" \
++  "ptype array1(40, 10) (passed fixed)"
++gdb_test "ptype array2(13, 11, 5)" "type = real\\\(kind=4\\\)" \
++  "ptype array2(13, 11, 5) (passed fixed)"
++
++# Pass sub arrays to function and handle them as vla in function.
++gdb_continue_to_breakpoint "not-filled (2nd)"
++gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(6,6\\\)" \
++  "ptype array1 (passed sub-array)"
++gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(6,6,6\\\)" \
++  "ptype array2 (passed sub-array)"
++gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
++  "ptype array1(3, 3) (passed sub-array)"
++gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
++  "ptype array2(4, 4, 4) (passed sub-array)"
++
++# Check ptype outside of bounds. This should not crash GDB.
++gdb_test "ptype array1(100, 100)" "no such vector element" \
++  "ptype array1(100, 100) subarray do not crash (passed sub-array)"
++gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
++  "ptype array2(100, 100, 100) subarray do not crash (passed sub-array)"
++
++# Pass vla to function.
++gdb_continue_to_breakpoint "not-filled (3rd)"
++gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(20,20\\\)" \
++  "ptype array1 (passed vla)"
++gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
++  "ptype array2 (passed vla)"
++gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
++  "ptype array1(3, 3) (passed vla)"
++gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
++  "ptype array2(4, 4, 4) (passed vla)"
++
++# Check ptype outside of bounds. This should not crash GDB.
++gdb_test "ptype array1(100, 100)" "no such vector element" \
++  "ptype array1(100, 100) VLA do not crash (passed vla)"
++gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
++  "ptype array2(100, 100, 100) VLA do not crash (passed vla)"
++
++# Pass fixed array to function and handle it as VLA of arbitrary length in
++# function.
++gdb_breakpoint [gdb_get_line_number "end-of-bar"]
++gdb_continue_to_breakpoint "end-of-bar"
++gdb_test "ptype array1" \
++  "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" \
++  "ptype array1 (arbitrary length)"
++gdb_test "ptype array2" \
++  "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(4:9,10:\\*\\)\\)?" \
++  "ptype array2 (arbitrary length)"
++gdb_test "ptype array1(100)" "type = integer\\\(kind=4\\\)" \
++  "ptype array1(100) (arbitrary length)"
++gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \
++  "ptype array2(4,100) (arbitrary length)"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-sizeof.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-sizeof.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-sizeof.exp	2014-08-25 20:01:47.897179954 +0200
+@@ -0,0 +1,46 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Try to access values in non allocated VLA
++gdb_breakpoint [gdb_get_line_number "vla1-init"]
++gdb_continue_to_breakpoint "vla1-init"
++gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1"
++
++# Try to access value in allocated VLA
++gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
++gdb_continue_to_breakpoint "vla2-allocated"
++gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1"
++
++# Try to access values in undefined pointer to VLA (dangling)
++gdb_breakpoint [gdb_get_line_number "vla1-filled"]
++gdb_continue_to_breakpoint "vla1-filled"
++gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
++
++# Try to access values in pointer to VLA and compare them
++gdb_breakpoint [gdb_get_line_number "pvla-associated"]
++gdb_continue_to_breakpoint "pvla-associated"
++gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-stride.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-stride.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-stride.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-stride.exp	2014-08-25 20:01:47.897179954 +0200
+@@ -0,0 +1,44 @@
++# Copyright 2014 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/>.
++
++standard_testfile ".f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++gdb_breakpoint [gdb_get_line_number "re-reverse-elements"]
++gdb_continue_to_breakpoint "re-reverse-elements"
++gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \
++  "print re-reverse-elements"
++gdb_test "print pvla(1)" " = 1" "print first re-reverse-element"
++gdb_test "print pvla(10)" " = 10" "print last re-reverse-element"
++
++gdb_breakpoint [gdb_get_line_number "odd-elements"]
++gdb_continue_to_breakpoint "odd-elements"
++gdb_test "print pvla" " = \\\(1, 3, 5, 7, 9\\\)" "print odd-elements"
++gdb_test "print pvla(1)" " = 1" "print first odd-element"
++gdb_test "print pvla(5)" " = 9" "print last odd-element"
++
++gdb_breakpoint [gdb_get_line_number "single-element"]
++gdb_continue_to_breakpoint "single-element"
++gdb_test "print pvla" " = \\\(5\\\)" "print single-element"
++gdb_test "print pvla(1)" " = 5" "print one single-element"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-stride.f90 insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-stride.f90
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-stride.f90	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-stride.f90	2014-08-25 20:01:47.897179954 +0200
+@@ -0,0 +1,30 @@
++! Copyright 2014 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.
++
++program vla_stride
++  integer, target, allocatable :: vla (:)
++  integer, pointer :: pvla (:)
++
++  allocate(vla(10))
++  vla = (/ (I, I = 1,10) /)
++
++  pvla => vla(10:1:-1)
++  pvla => pvla(10:1:-1)
++  pvla => vla(1:10:2)   ! re-reverse-elements
++  pvla => vla(5:4:-2)   ! odd-elements
++
++  pvla => null()        ! single-element
++end program vla_stride
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-strings.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-strings.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-strings.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-strings.exp	2014-08-25 20:01:47.898179962 +0200
+@@ -0,0 +1,104 @@
++# Copyright 2014 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/>.
++
++standard_testfile ".f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++# check that all fortran standard datatypes will be
++# handled correctly when using as VLA's
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
++gdb_continue_to_breakpoint "var_char-allocated-1"
++gdb_test "print var_char" \
++  " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \
++  "print var_char after allocated first time"
++gdb_test "print *var_char" \
++  " = '\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000'" \
++  "print *var_char after allocated first time"
++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \
++  "whatis var_char first time"
++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \
++  "ptype var_char first time"
++gdb_test "next" "\\d+.*var_char = 'foo'.*" \
++  "next to allocation status of var_char"
++gdb_test "print l" " = .TRUE." "print allocation status first time"
++
++gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
++gdb_continue_to_breakpoint "var_char-filled-1"
++gdb_test "print var_char" \
++  " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \
++  "print var_char after filled first time"
++gdb_test "print *var_char" " = 'foo'" \
++  "print *var_char after filled first time"
++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \
++  "whatis var_char after filled first time"
++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \
++  "ptype var_char after filled first time"
++gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
++gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
++
++gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
++gdb_continue_to_breakpoint "var_char-filled-2"
++gdb_test "print var_char" \
++  " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \
++  "print var_char after allocated second time"
++gdb_test "print *var_char" " = 'foobar'" \
++  "print *var_char after allocated second time"
++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \
++  "whatis var_char second time"
++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \
++  "ptype var_char second time"
++
++gdb_breakpoint [gdb_get_line_number "var_char-empty"]
++gdb_continue_to_breakpoint "var_char-empty"
++gdb_test "print var_char" \
++  " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \
++  "print var_char after set empty"
++gdb_test "print *var_char" " = \"\"" "print *var_char after set empty"
++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \
++  "whatis var_char after set empty"
++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \
++  "ptype var_char after set empty"
++
++gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"]
++gdb_continue_to_breakpoint "var_char-allocated-3"
++gdb_test "print var_char" \
++  " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \
++  "print var_char after allocated third time"
++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \
++  "whatis var_char after allocated third time"
++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \
++  "ptype var_char after allocated third time"
++
++gdb_breakpoint [gdb_get_line_number "var_char_p-associated"]
++gdb_continue_to_breakpoint "var_char_p-associated"
++gdb_test "print var_char_p" \
++  " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \
++  "print var_char_p after associated"
++gdb_test "print *var_char_p" " = 'johndoe'" \
++  "print *var_char_ after associated"
++gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
++  "whatis var_char_p after associated"
++gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
++  "ptype var_char_p after associated"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-strings.f90 insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-strings.f90
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-strings.f90	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-strings.f90	2014-08-25 20:01:47.898179962 +0200
+@@ -0,0 +1,40 @@
++! Copyright 2014 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.
++
++program vla_strings
++  character(len=:), target, allocatable   :: var_char
++  character(len=:), pointer               :: var_char_p
++  logical                                 :: l
++
++  allocate(character(len=10) :: var_char)
++  l = allocated(var_char)                 ! var_char-allocated-1
++  var_char = 'foo'
++  deallocate(var_char)                    ! var_char-filled-1
++  l = allocated(var_char)                 ! var_char-deallocated
++  allocate(character(len=42) :: var_char)
++  l = allocated(var_char)
++  var_char = 'foobar'
++  var_char = ''                           ! var_char-filled-2
++  var_char = 'bar'                        ! var_char-empty
++  deallocate(var_char)
++  allocate(character(len=21) :: var_char)
++  l = allocated(var_char)                 ! var_char-allocated-3
++  var_char = 'johndoe'
++  var_char_p => var_char
++  l = associated(var_char_p)              ! var_char_p-associated
++  var_char_p => null()
++  l = associated(var_char_p)              ! var_char_p-not-associated
++end program vla_strings
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-sub.f90 insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-sub.f90
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-sub.f90	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-sub.f90	2014-08-25 20:01:47.899179971 +0200
+@@ -0,0 +1,82 @@
++! Copyright 2014 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.
++!
++! Original file written by Jakub Jelinek <jakub at redhat.com> and
++! Jan Kratochvil <jan.kratochvil at redhat.com>.
++! Modified for the GDB testcases by Keven Boell <keven.boell at intel.com>.
++
++subroutine foo (array1, array2)
++  integer :: array1 (:, :)
++  real    :: array2 (:, :, :)
++
++  array1(:,:) = 5                       ! not-filled
++  array1(1, 1) = 30
++
++  array2(:,:,:) = 6                     ! array1-filled
++  array2(:,:,:) = 3
++  array2(1,1,1) = 30
++  array2(3,3,3) = 90                    ! array2-almost-filled
++end subroutine
++
++subroutine bar (array1, array2)
++  integer :: array1 (*)
++  integer :: array2 (4:9, 10:*)
++
++  array1(5:10) = 1311
++  array1(7) = 1
++  array1(100) = 100
++  array2(4,10) = array1(7)
++  array2(4,100) = array1(7)
++  return                                ! end-of-bar
++end subroutine
++
++program vla_sub
++  interface
++    subroutine foo (array1, array2)
++      integer :: array1 (:, :)
++      real :: array2 (:, :, :)
++    end subroutine
++  end interface
++  interface
++    subroutine bar (array1, array2)
++      integer :: array1 (*)
++      integer :: array2 (4:9, 10:*)
++    end subroutine
++  end interface
++
++  real, allocatable :: vla1 (:, :, :)
++  integer, allocatable :: vla2 (:, :)
++
++  ! used for subroutine
++  integer :: sub_arr1(42, 42)
++  real    :: sub_arr2(42, 42, 42)
++  integer :: sub_arr3(42)
++
++  sub_arr1(:,:) = 1                   ! vla2-deallocated
++  sub_arr2(:,:,:) = 2
++  sub_arr3(:) = 3
++
++  call foo(sub_arr1, sub_arr2)
++  call foo(sub_arr1(5:10, 5:10), sub_arr2(10:15,10:15,10:15))
++
++  allocate (vla1 (10,10,10))
++  allocate (vla2 (20,20))
++  vla1(:,:,:) = 1311
++  vla2(:,:) = 42
++  call foo(vla2, vla1)
++
++  call bar(sub_arr3, sub_arr1)
++end program vla_sub
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value.exp	2014-08-25 20:01:47.899179971 +0200
+@@ -0,0 +1,148 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++     {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Try to access values in non allocated VLA
++gdb_breakpoint [gdb_get_line_number "vla1-init"]
++gdb_continue_to_breakpoint "vla1-init"
++gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
++gdb_test "print &vla1" \
++  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(<not allocated>\\\)\\\)\\\) $hex" \
++  "print non-allocated &vla1"
++gdb_test "print vla1(1,1,1)" "no such vector element because not allocated" \
++  "print member in non-allocated vla1 (1)"
++gdb_test "print vla1(101,202,303)" \
++  "no such vector element because not allocated" \
++  "print member in non-allocated vla1 (2)"
++gdb_test "print vla1(5,2,18)=1" "no such vector element because not allocated" \
++  "set member in non-allocated vla1"
++
++# Try to access value in allocated VLA
++gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
++gdb_continue_to_breakpoint "vla2-allocated"
++gdb_test "next" "\\d+(\\t|\\s)+vla1\\\(3, 6, 9\\\) = 42" \
++  "step over value assignment of vla1"
++gdb_test "print &vla1" \
++  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(10,10,10\\\)\\\)\\\) $hex" \
++  "print allocated &vla1"
++gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)"
++gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)"
++gdb_test "print vla1(9, 9, 9) = 999" " = 999" \
++  "print allocated vla1(9,9,9)=1"
++
++# Try to access values in allocated VLA after specific assignment
++gdb_breakpoint [gdb_get_line_number "vla1-filled"]
++gdb_continue_to_breakpoint "vla1-filled"
++gdb_test "print vla1(3, 6, 9)" " = 42" \
++  "print allocated vla1(3,6,9) after specific assignment (filled)"
++gdb_test "print vla1(1, 3, 8)" " = 1001" \
++  "print allocated vla1(1,3,8) after specific assignment (filled)"
++gdb_test "print vla1(9, 9, 9)" " = 999" \
++  "print allocated vla1(9,9,9) after assignment in debugger (filled)"
++
++# Try to access values in undefined pointer to VLA (dangling)
++gdb_test "print pvla" " = <not associated>" "print undefined pvla"
++gdb_test "print &pvla" \
++  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(<not associated>\\\)\\\)\\\) $hex" \
++  "print non-associated &pvla"
++gdb_test "print pvla(1, 3, 8)" "no such vector element because not associated" \
++  "print undefined pvla(1,3,8)"
++
++# Try to access values in pointer to VLA and compare them
++gdb_breakpoint [gdb_get_line_number "pvla-associated"]
++gdb_continue_to_breakpoint "pvla-associated"
++gdb_test "print &pvla" \
++  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(10,10,10\\\)\\\)\\\) $hex" \
++  "print associated &pvla"
++gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)"
++gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)"
++gdb_test "print pvla(9, 9, 9)" " = 999" "print associated pvla(9,9,9)"
++
++# Fill values to VLA using pointer and check
++gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
++gdb_continue_to_breakpoint "pvla-re-associated"
++gdb_test "print pvla(5, 45, 20)" \
++  " = 1" "print pvla(5, 45, 20) after filled using pointer"
++gdb_test "print vla2(5, 45, 20)" \
++  " = 1" "print vla2(5, 45, 20) after filled using pointer"
++gdb_test "print pvla(7, 45, 14)" " = 2" \
++  "print pvla(7, 45, 14) after filled using pointer"
++gdb_test "print vla2(7, 45, 14)" " = 2" \
++  "print vla2(7, 45, 14) after filled using pointer"
++
++# Try to access values of deassociated VLA pointer
++gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
++gdb_continue_to_breakpoint "pvla-deassociated"
++gdb_test "print pvla(5, 45, 20)" \
++  "no such vector element because not associated" \
++  "print pvla(5, 45, 20) after deassociated"
++gdb_test "print pvla(7, 45, 14)" \
++  "no such vector element because not associated" \
++  "print pvla(7, 45, 14) after dissasociated"
++gdb_test "print pvla" " = <not associated>" \
++  "print vla1 after deassociated"
++
++# Try to access values of deallocated VLA
++gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
++gdb_continue_to_breakpoint "vla1-deallocated"
++gdb_test "print vla1(3, 6, 9)" "no such vector element because not allocated" \
++  "print allocated vla1(3,6,9) after specific assignment (deallocated)"
++gdb_test "print vla1(1, 3, 8)" "no such vector element because not allocated" \
++  "print allocated vla1(1,3,8) after specific assignment (deallocated)"
++gdb_test "print vla1(9, 9, 9)" "no such vector element because not allocated" \
++  "print allocated vla1(9,9,9) after assignment in debugger (deallocated)"
++
++
++# Try to assign VLA to user variable
++clean_restart ${testfile}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
++gdb_continue_to_breakpoint "vla2-allocated"
++gdb_test "next" "\\d+.*vla1\\(3, 6, 9\\) = 42" "next (1)"
++
++gdb_test_no_output "set \$myvar = vla1" "set \$myvar = vla1"
++gdb_test "print \$myvar" \
++  " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" \
++  "print \$myvar set to vla1"
++
++gdb_test "next" "\\d+.*vla1\\(1, 3, 8\\) = 1001" "next (2)"
++gdb_test "print \$myvar(3,6,9)" " = 1311" "print \$myvar(3,6,9)"
++
++gdb_breakpoint [gdb_get_line_number "pvla-associated"]
++gdb_continue_to_breakpoint "pvla-associated"
++gdb_test_no_output "set \$mypvar = pvla" "set \$mypvar = pvla"
++gdb_test "print \$mypvar(1,3,8)" " = 1001" "print \$mypvar(1,3,8)"
++
++# deallocate pointer and make sure user defined variable still has the
++# right value.
++gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
++gdb_continue_to_breakpoint "pvla-deassociated"
++gdb_test "print \$mypvar(1,3,8)" " = 1001" \
++  "print \$mypvar(1,3,8) after deallocated"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp	2014-08-25 20:01:47.899179971 +0200
+@@ -0,0 +1,35 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla-sub.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Check VLA with arbitary length and check that elements outside of
++# bounds of the passed VLA can be accessed correctly.
++gdb_breakpoint [gdb_get_line_number "end-of-bar"]
++gdb_continue_to_breakpoint "end-of-bar"
++gdb_test "p array1(42)" " = 3" "print arbitary array1(42)"
++gdb_test "p array1(100)" " = 100" "print arbitary array1(100)"
++gdb_test "p array2(4,10)" " = 1" "print arbitary array2(4,10)"
++gdb_test "p array2(4,100)" " = 1" "print arbitary array2(4,100)"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value-sub.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value-sub.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value-sub.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value-sub.exp	2014-08-25 20:01:47.900179979 +0200
+@@ -0,0 +1,90 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla-sub.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# Check the values of VLA's in subroutine can be evaluated correctly
++
++# Try to access values from a fixed array handled as VLA in subroutine.
++gdb_breakpoint [gdb_get_line_number "not-filled"]
++gdb_continue_to_breakpoint "not-filled (1st)"
++gdb_test "print array1" " = \\(\[()1, .\]*\\)" \
++  "print passed array1 in foo (passed fixed array)"
++
++gdb_breakpoint [gdb_get_line_number "array1-filled"]
++gdb_continue_to_breakpoint "array1-filled (1st)"
++gdb_test "print array1(5, 7)" " = 5" \
++  "print array1(5, 7) after filled in foo (passed fixed array)"
++gdb_test "print array1(1, 1)" " = 30" \
++  "print array1(1, 1) after filled in foo (passed fixed array)"
++
++gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
++gdb_continue_to_breakpoint "array2-almost-filled (1st)"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was filled (passed fixed array)"
++gdb_test "print array2(2,1,1)=20" " = 20" \
++  "set array(2,2,2) to 20 in subroutine (passed fixed array)"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was mofified in debugger (passed fixed array)"
++
++
++# Try to access values from a fixed sub-array handled as VLA in subroutine.
++gdb_continue_to_breakpoint "not-filled (2nd)"
++gdb_test "print array1" " = \\(\[()5, .\]*\\)" \
++  "print passed array1 in foo (passed sub-array)"
++
++gdb_continue_to_breakpoint "array1-filled (2nd)"
++gdb_test "print array1(5, 5)" " = 5" \
++  "print array1(5, 5) after filled in foo (passed sub-array)"
++gdb_test "print array1(1, 1)" " = 30" \
++  "print array1(1, 1) after filled in foo (passed sub-array)"
++
++gdb_continue_to_breakpoint "array2-almost-filled (2nd)"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was filled (passed sub-array)"
++gdb_test "print array2(2,1,1)=20" " = 20" \
++  "set array(2,2,2) to 20 in subroutine (passed sub-array)"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was mofified in debugger (passed sub-array)"
++
++
++# Try to access values from a VLA passed to subroutine.
++gdb_continue_to_breakpoint "not-filled (3rd)"
++gdb_test "print array1" " = \\(\[()42, .\]*\\)" \
++  "print passed array1 in foo (passed vla)"
++
++gdb_continue_to_breakpoint "array1-filled (3rd)"
++gdb_test "print array1(5, 5)" " = 5" \
++  "print array1(5, 5) after filled in foo (passed vla)"
++gdb_test "print array1(1, 1)" " = 30" \
++  "print array1(1, 1) after filled in foo (passed vla)"
++
++gdb_continue_to_breakpoint "array2-almost-filled (3rd)"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was filled (passed vla)"
++gdb_test "print array2(2,1,1)=20" " = 20" \
++  "set array(2,2,2) to 20 in subroutine (passed vla)"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was mofified in debugger (passed vla)"
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp	2014-08-25 20:01:47.900179979 +0200
+@@ -0,0 +1,49 @@
++# Copyright 2014 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/>.
++
++standard_testfile "vla-sub.f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++    {debug f90 quiet}] } {
++    return -1
++}
++
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
++
++# "up" works with GCC but other Fortran compilers may copy the values into the
++# outer function only on the exit of the inner function.
++# We need both variants as depending on the arch we optionally may still be
++# executing the caller line or not after `finish'.
++
++gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
++gdb_continue_to_breakpoint "array2-almost-filled"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was filled"
++gdb_test "print array2(2,1,1)=20" " = 20" \
++  "set array(2,2,2) to 20 in subroutine"
++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
++  "print array2 in foo after it was mofified in debugger"
++
++gdb_test "finish" \
++  ".*foo\\\(sub_arr1\\\(5:10, 5:10\\\), sub_arr2\\\(10:15,10:15,10:15\\\)\\\)" \
++  "finish function"
++gdb_test "p sub_arr1(5, 7)" " = 5" "sub_arr1(5, 7) after finish"
++gdb_test "p sub_arr1(1, 1)" " = 30" "sub_arr1(1, 1) after finish"
++gdb_test "p sub_arr2(1, 1, 1)" " = 30" "sub_arr2(1, 1, 1) after finish"
++gdb_test "p sub_arr2(2, 1, 1)" " = 20" "sub_arr2(2, 1, 1) after finish"
++
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.mi/mi-vla-fortran.exp insight-7.8.50.20140825.new/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.mi/mi-vla-fortran.exp	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.mi/mi-vla-fortran.exp	2014-08-25 20:01:47.901179988 +0200
+@@ -0,0 +1,182 @@
++# Copyright 2014 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# Verify that, using the MI, we can evaluate a simple C Variable Length
++# Array (VLA).
++
++load_lib mi-support.exp
++set MIFLAGS "-i=mi"
++
++gdb_exit
++if [mi_gdb_start] {
++    continue
++}
++
++standard_testfile vla.f90
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
++     {debug f90}] != "" } {
++     untested mi-vla-fortran.exp
++     return -1
++}
++
++mi_delete_breakpoints
++mi_gdb_reinitialize_dir $srcdir/$subdir
++mi_gdb_load ${binfile}
++
++set bp_lineno [gdb_get_line_number "vla1-not-allocated"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 1 "del" "vla" \
++  ".*vla.f90" $bp_lineno $hex \
++  "insert breakpoint at line $bp_lineno (vla not allocated)"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "500-data-evaluate-expression vla1" \
++  "500\\^done,value=\"<not allocated>\"" "evaluate not allocated vla"
++
++mi_create_varobj_checked vla1_not_allocated vla1 "<not allocated>" \
++  "create local variable vla1_not_allocated"
++mi_gdb_test "501-var-info-type vla1_not_allocated" \
++  "501\\^done,type=\"<not allocated>\"" \
++  "info type variable vla1_not_allocated"
++mi_gdb_test "502-var-show-format vla1_not_allocated" \
++  "502\\^done,format=\"natural\"" \
++  "show format variable vla1_not_allocated"
++mi_gdb_test "503-var-evaluate-expression vla1_not_allocated" \
++  "503\\^done,value=\"\\\[0\\\]\"" \
++  "eval variable vla1_not_allocated"
++mi_list_array_varobj_children_with_index "vla1_not_allocated" "0" "1" \
++    "real\\\(kind=4\\\)" "get children of vla1_not_allocated"
++
++
++
++set bp_lineno [gdb_get_line_number "vla1-allocated"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 2 "del" "vla" ".*vla.f90" \
++  $bp_lineno $hex "insert breakpoint at line $bp_lineno (vla allocated)"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "510-data-evaluate-expression vla1" \
++  "510\\^done,value=\"\\(0, 0, 0, 0, 0\\)\"" "evaluate allocated vla"
++
++mi_create_varobj_checked vla1_allocated vla1 "real\\\(kind=4\\\) \\\(5\\\)" \
++  "create local variable vla1_allocated"
++mi_gdb_test "511-var-info-type vla1_allocated" \
++  "511\\^done,type=\"real\\\(kind=4\\\) \\\(5\\\)\"" \
++  "info type variable vla1_allocated"
++mi_gdb_test "512-var-show-format vla1_allocated" \
++  "512\\^done,format=\"natural\"" \
++  "show format variable vla1_allocated"
++mi_gdb_test "513-var-evaluate-expression vla1_allocated" \
++  "513\\^done,value=\"\\\[5\\\]\"" \
++  "eval variable vla1_allocated"
++mi_list_array_varobj_children_with_index "vla1_allocated" "5" "1" \
++    "real\\\(kind=4\\\)" "get children of vla1_allocated"
++
++
++set bp_lineno [gdb_get_line_number "vla1-filled"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 3 "del" "vla" ".*vla.f90" \
++  $bp_lineno $hex "insert breakpoint at line $bp_lineno"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "520-data-evaluate-expression vla1" \
++  "520\\^done,value=\"\\(1, 1, 1, 1, 1\\)\"" "evaluate filled vla"
++
++
++set bp_lineno [gdb_get_line_number "vla1-modified"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 4 "del" "vla" ".*vla.f90" \
++  $bp_lineno $hex "insert breakpoint at line $bp_lineno"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "530-data-evaluate-expression vla1" \
++  "530\\^done,value=\"\\(1, 42, 1, 24, 1\\)\"" "evaluate filled vla"
++mi_gdb_test "540-data-evaluate-expression vla1(1)" \
++  "540\\^done,value=\"1\"" "evaluate filled vla"
++mi_gdb_test "550-data-evaluate-expression vla1(2)" \
++  "550\\^done,value=\"42\"" "evaluate filled vla"
++mi_gdb_test "560-data-evaluate-expression vla1(4)" \
++  "560\\^done,value=\"24\"" "evaluate filled vla"
++
++
++set bp_lineno [gdb_get_line_number "vla1-deallocated"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 5 "del" "vla" ".*vla.f90" \
++  $bp_lineno $hex "insert breakpoint at line $bp_lineno"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "570-data-evaluate-expression vla1" \
++  "570\\^done,value=\"<not allocated>\"" "evaluate not allocated vla"
++
++
++set bp_lineno [gdb_get_line_number "pvla2-not-associated"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 6 "del" "vla" ".*vla.f90" \
++  $bp_lineno $hex "insert breakpoint at line $bp_lineno"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "580-data-evaluate-expression pvla2" \
++  "580\\^done,value=\"<not associated>\"" "evaluate not associated vla"
++
++mi_create_varobj_checked pvla2_not_associated pvla2 "<not associated>" \
++  "create local variable pvla2_not_associated"
++mi_gdb_test "581-var-info-type pvla2_not_associated" \
++  "581\\^done,type=\"<not associated>\"" \
++  "info type variable pvla2_not_associated"
++mi_gdb_test "582-var-show-format pvla2_not_associated" \
++  "582\\^done,format=\"natural\"" \
++  "show format variable pvla2_not_associated"
++mi_gdb_test "583-var-evaluate-expression pvla2_not_associated" \
++  "583\\^done,value=\"\\\[0\\\]\"" \
++  "eval variable pvla2_not_associated"
++mi_list_array_varobj_children_with_index "pvla2_not_associated" "0" "1" \
++    "real\\\(kind=4\\\)" "get children of pvla2_not_associated"
++
++
++set bp_lineno [gdb_get_line_number "pvla2-associated"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 7 "del" "vla" ".*vla.f90" \
++  $bp_lineno $hex "insert breakpoint at line $bp_lineno"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "590-data-evaluate-expression pvla2" \
++  "590\\^done,value=\"\\(\\( 2, 2, 2, 2, 2\\) \\( 2, 2, 2, 2, 2\\) \\)\"" \
++  "evaluate associated vla"
++
++mi_create_varobj_checked pvla2_associated pvla2 \
++  "real\\\(kind=4\\\) \\\(5,2\\\)" "create local variable pvla2_associated"
++mi_gdb_test "591-var-info-type pvla2_associated" \
++  "591\\^done,type=\"real\\\(kind=4\\\) \\\(5,2\\\)\"" \
++  "info type variable pvla2_associated"
++mi_gdb_test "592-var-show-format pvla2_associated" \
++  "592\\^done,format=\"natural\"" \
++  "show format variable pvla2_associated"
++mi_gdb_test "593-var-evaluate-expression pvla2_associated" \
++  "593\\^done,value=\"\\\[2\\\]\"" \
++  "eval variable pvla2_associated"
++
++
++set bp_lineno [gdb_get_line_number "pvla2-set-to-null"]
++mi_create_breakpoint "-t vla.f90:$bp_lineno" 8 "del" "vla" ".*vla.f90" \
++  $bp_lineno $hex "insert breakpoint at line $bp_lineno"
++mi_run_cmd
++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
++  { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
++mi_gdb_test "600-data-evaluate-expression pvla2" \
++  "600\\^done,value=\"<not associated>\"" "evaluate vla pointer set to null"
++
++mi_gdb_exit
++return 0
+diff -Naurp insight-7.8.50.20140825.orig/gdb/testsuite/gdb.mi/vla.f90 insight-7.8.50.20140825.new/gdb/testsuite/gdb.mi/vla.f90
+--- insight-7.8.50.20140825.orig/gdb/testsuite/gdb.mi/vla.f90	1970-01-01 01:00:00.000000000 +0100
++++ insight-7.8.50.20140825.new/gdb/testsuite/gdb.mi/vla.f90	2014-08-25 20:01:47.901179988 +0200
+@@ -0,0 +1,42 @@
++! Copyright 2014 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/>.
++
++program vla
++  real, allocatable :: vla1 (:)
++  real, target, allocatable :: vla2(:, :)
++  real, pointer :: pvla2 (:, :)
++  logical :: l
++
++  allocate (vla1 (5))         ! vla1-not-allocated
++  l = allocated(vla1)         ! vla1-allocated
++
++  vla1(:) = 1
++  vla1(2) = 42                ! vla1-filled
++  vla1(4) = 24
++
++  deallocate (vla1)           ! vla1-modified
++  l = allocated(vla1)         ! vla1-deallocated
++
++  allocate (vla2 (5, 2))
++  vla2(:, :) = 2
++
++  pvla2 => vla2               ! pvla2-not-associated
++  l = associated(pvla2)       ! pvla2-associated
++
++  pvla2(2, 1) = 42
++
++  pvla2 => null()
++  l = associated(pvla2)       ! pvla2-set-to-null
++end program vla
+diff -Naurp insight-7.8.50.20140825.orig/gdb/typeprint.c insight-7.8.50.20140825.new/gdb/typeprint.c
+--- insight-7.8.50.20140825.orig/gdb/typeprint.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/typeprint.c	2014-08-25 20:01:47.902179996 +0200
+@@ -457,6 +457,13 @@ whatis_exp (char *exp, int show)
+ 
+   type = value_type (val);
+ 
++  if (TYPE_CODE (type) == TYPE_CODE_PTR)
++    if (is_dynamic_type (TYPE_TARGET_TYPE (type)))
++      {
++	val = value_addr (value_ind (val));
++	type = value_type (val);
++      }
++
+   get_user_print_options (&opts);
+   if (opts.objectprint)
+     {
+diff -Naurp insight-7.8.50.20140825.orig/gdb/valarith.c insight-7.8.50.20140825.new/gdb/valarith.c
+--- insight-7.8.50.20140825.orig/gdb/valarith.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/valarith.c	2014-08-25 20:01:47.903180005 +0200
+@@ -194,12 +194,31 @@ value_subscripted_rvalue (struct value *
+   struct type *array_type = check_typedef (value_type (array));
+   struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
+   unsigned int elt_size = TYPE_LENGTH (elt_type);
+-  unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
++  unsigned int elt_offs = longest_to_int (index - lowerbound);
++  LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
+   struct value *v;
+ 
++  if (elt_stride > 0)
++    elt_offs *= elt_stride;
++  else if (elt_stride < 0)
++    {
++      int offs = (elt_offs + 1) * elt_stride;
++
++      elt_offs = TYPE_LENGTH (array_type) + offs;
++    }
++  else
++    elt_offs *= elt_size;
++
+   if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
+ 			     && elt_offs >= TYPE_LENGTH (array_type)))
+-    error (_("no such vector element"));
++    {
++      if (TYPE_NOT_ASSOCIATED (array_type))
++        error (_("no such vector element because not associated"));
++      else if (TYPE_NOT_ALLOCATED (array_type))
++        error (_("no such vector element because not allocated"));
++      else
++        error (_("no such vector element"));
++    }
+ 
+   if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
+     v = allocate_value_lazy (elt_type);
+diff -Naurp insight-7.8.50.20140825.orig/gdb/valprint.c insight-7.8.50.20140825.new/gdb/valprint.c
+--- insight-7.8.50.20140825.orig/gdb/valprint.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/valprint.c	2014-08-25 20:01:47.904180013 +0200
+@@ -304,6 +304,18 @@ valprint_check_validity (struct ui_file
+ {
+   CHECK_TYPEDEF (type);
+ 
++  if (TYPE_NOT_ASSOCIATED (type))
++    {
++      val_print_not_associated (stream);
++      return 0;
++    }
++
++  if (TYPE_NOT_ALLOCATED (type))
++    {
++      val_print_not_allocated (stream);
++      return 0;
++    }
++
+   if (TYPE_CODE (type) != TYPE_CODE_UNION
+       && TYPE_CODE (type) != TYPE_CODE_STRUCT
+       && TYPE_CODE (type) != TYPE_CODE_ARRAY)
+@@ -360,6 +372,18 @@ val_print_invalid_address (struct ui_fil
+   fprintf_filtered (stream, _("<invalid address>"));
+ }
+ 
++void
++val_print_not_allocated (struct ui_file *stream)
++{
++  fprintf_filtered (stream, _("<not allocated>"));
++}
++
++void
++val_print_not_associated (struct ui_file *stream)
++{
++  fprintf_filtered (stream, _("<not associated>"));
++}
++
+ /* A generic val_print that is suitable for use by language
+    implementations of the la_val_print method.  This function can
+    handle most type codes, though not all, notably exception
+@@ -801,12 +825,16 @@ static int
+ value_check_printable (struct value *val, struct ui_file *stream,
+ 		       const struct value_print_options *options)
+ {
++  const struct type *type;
++
+   if (val == 0)
+     {
+       fprintf_filtered (stream, _("<address of value unknown>"));
+       return 0;
+     }
+ 
++  type = value_type (val);
++
+   if (value_entirely_optimized_out (val))
+     {
+       if (options->summary && !val_print_scalar_type_p (value_type (val)))
+@@ -832,6 +860,18 @@ value_check_printable (struct value *val
+       return 0;
+     }
+ 
++  if (TYPE_NOT_ASSOCIATED (type))
++    {
++      val_print_not_associated (stream);
++      return 0;
++    }
++
++  if (TYPE_NOT_ALLOCATED (type))
++    {
++      val_print_not_allocated (stream);
++      return 0;
++    }
++
+   return 1;
+ }
+ 
+diff -Naurp insight-7.8.50.20140825.orig/gdb/valprint.h insight-7.8.50.20140825.new/gdb/valprint.h
+--- insight-7.8.50.20140825.orig/gdb/valprint.h	2014-06-25 18:56:14.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/valprint.h	2014-08-25 20:01:47.905180022 +0200
+@@ -217,4 +217,8 @@ extern void output_command_const (const
+ 
+ extern int val_print_scalar_type_p (struct type *type);
+ 
++extern void val_print_not_allocated (struct ui_file *stream);
++
++extern void val_print_not_associated (struct ui_file *stream);
++
+ #endif
+diff -Naurp insight-7.8.50.20140825.orig/gdb/value.c insight-7.8.50.20140825.new/gdb/value.c
+--- insight-7.8.50.20140825.orig/gdb/value.c	2014-08-25 14:46:22.000000000 +0200
++++ insight-7.8.50.20140825.new/gdb/value.c	2014-08-25 20:01:47.907180039 +0200
+@@ -41,6 +41,7 @@
+ #include "tracepoint.h"
+ #include "cp-abi.h"
+ #include "user-regs.h"
++#include "dwarf2loc.h"
+ 
+ /* Prototypes for exported functions.  */
+ 
+@@ -1732,6 +1733,25 @@ set_value_component_location (struct val
+       if (funcs->copy_closure)
+         component->location.computed.closure = funcs->copy_closure (whole);
+     }
++
++  /* For dynamic types compute the address of the component value location in
++     sub range types based on the location of the sub range type, if not being
++     an internal GDB variable or parts of it.  */
++  if (VALUE_LVAL (component) != lval_internalvar
++      && VALUE_LVAL (component) != lval_internalvar_component)
++    {
++      CORE_ADDR addr;
++      struct type *type = value_type (whole);
++
++      addr = value_raw_address (component);
++
++      if (TYPE_DATA_LOCATION (type)
++          && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
++        {
++          addr = TYPE_DATA_LOCATION_ADDR (type);
++          set_value_address (component, addr);
++        }
++    }
+ }
+ 
+ 
+@@ -3018,13 +3038,22 @@ value_primitive_field (struct value *arg
+ 	v = allocate_value_lazy (type);
+       else
+ 	{
+-	  v = allocate_value (type);
+-	  value_contents_copy_raw (v, value_embedded_offset (v),
+-				   arg1, value_embedded_offset (arg1) + offset,
+-				   TYPE_LENGTH (type));
++	  if (TYPE_DATA_LOCATION (type)
++	      && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
++	    v = value_at_lazy (type, value_address (arg1) + offset);
++	  else
++	    {
++	      v = allocate_value (type);
++	      value_contents_copy_raw (v, value_embedded_offset (v),
++				       arg1, value_embedded_offset (arg1) + offset,
++				       TYPE_LENGTH (type));
++	    }
+ 	}
+-      v->offset = (value_offset (arg1) + offset
+-		   + value_embedded_offset (arg1));
++
++      if (!TYPE_DATA_LOCATION (type)
++          || !TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
++	v->offset = (value_offset (arg1) + offset
++		     + value_embedded_offset (arg1));
+     }
+   set_value_component_location (v, arg1);
+   VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
+@@ -3618,7 +3647,8 @@ readjust_indirect_value_type (struct val
+ 			      struct value *original_value)
+ {
+   /* Re-adjust type.  */
+-  deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type));
++  if (!is_dynamic_type (TYPE_TARGET_TYPE (original_type)))
++    deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type));
+ 
+   /* Add embedding info.  */
+   set_value_enclosing_type (value, enc_type);
+@@ -3635,6 +3665,12 @@ coerce_ref (struct value *arg)
+   struct value *retval;
+   struct type *enc_type;
+ 
++  if (current_language->la_language != language_fortran
++      && TYPE_DATA_LOCATION (value_type_arg_tmp) != NULL
++      && TYPE_DATA_LOCATION_KIND (value_type_arg_tmp) == PROP_CONST)
++    arg = value_at_lazy (value_type_arg_tmp,
++                         TYPE_DATA_LOCATION_ADDR (value_type_arg_tmp));
++
+   retval = coerce_ref_if_computed (arg);
+   if (retval)
+     return retval;
+@@ -3784,8 +3820,14 @@ value_fetch_lazy (struct value *val)
+     }
+   else if (VALUE_LVAL (val) == lval_memory)
+     {
+-      CORE_ADDR addr = value_address (val);
+       struct type *type = check_typedef (value_enclosing_type (val));
++      CORE_ADDR addr;
++
++      if (TYPE_DATA_LOCATION (type) != NULL
++	  && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST)
++	addr = TYPE_DATA_LOCATION_ADDR (type);
++      else
++	addr = value_address (val);
+ 
+       if (TYPE_LENGTH (type))
+ 	read_value_memory (val, 0, value_stack (val),
diff --git a/insight.spec b/insight.spec
index f8c7b05..d261907 100644
--- a/insight.spec
+++ b/insight.spec
@@ -1,44 +1,50 @@
-%global ver	7.4.50
-%global snap	20120403
+%global ver	7.8.50
+%global snap	20140827
 
-#	CVS snapshots are produced as follows:
+# Turn off the brp-python-bytecompile script
+%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
+
+
+#	Git snapshots are produced as follows:
+#
+#	git clone --recursive https://github.com/monnerat/insight.git
+#	cd insight.git
+#	autoconf
+#	configure
+#	make -C bundle -f src-release insight.tar.bz2
 #
-#	mkdir insight-snapshot
-#	cd insight-snapshot
-#	cvs -z9 -d :pserver:anoncvs at sourceware.org:/cvs/src login
-#	(Password: anonymous)
-#	cvs -z9 -d :pserver:anoncvs at sourceware.org:/cvs/src export	\
-#		-D '2012-04-03 09:00' insight
-#	mv src insight-%{ver}
-#	tar cJf insight-%{ver}.tar.xz insight-%{ver}
+#	Tarball is then found at bundle/insight-%{ver}.%{snap}.tar.bz2
 
 Name:		insight
 Version:	%(echo %{ver} | tr - .)
-Release:	16.%{snap}cvs%{?dist}
+Release:	1%{?snap:.%{snap}git}%{?dist}
 Summary:	Graphical debugger based on GDB
-License:	GPLv3+
+License:	GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
 Group:		Development/Debuggers
 Url:		http://sources.redhat.com/insight/
 # Source0:	ftp://sourceware.org/pub/insight/releases/insight-%{ver}.tar.bz2
-Source0:	insight-%{ver}.tar.xz
-Source1:	insight.desktop
-Source2:	insight.1
+Source0:	insight-%{ver}%{?snap:.%{snap}}.tar.bz2
+Source1:	insight.1
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires:	iwidgets
 Requires:	xterm
-Provides:	bundled(binutils) = %{snap}
-Provides:	bundled(gnulib) = %{snap}
-Provides:	bundled(libiberty) = %{snap}
-Provides:	bundled(md5-gcc) = %{snap}
+Provides:	bundled(binutils) = 20140804
+Provides:	bundled(gnulib) = 20140804
+Provides:	bundled(libiberty) = 20140804
+Provides:	bundled(md5-gcc) = 20140804
 BuildRequires:	tcl-devel%{?_isa}
 BuildRequires:	tk-devel%{?_isa}
-BuildRequires:	itcl-devel%{?_isa} >= 3.3
-BuildRequires:	itk-devel%{?_isa} >= 3.3
+BuildRequires:	itcl-devel%{?_isa} >= 4.0
+BuildRequires:	itk-devel%{?_isa} >= 4.0
 BuildRequires:	iwidgets
 BuildRequires:	ncurses-devel%{?_isa}
 BuildRequires:	readline-devel%{?_isa} >= 6.0
 BuildRequires:	expat-devel%{?_isa}
 BuildRequires:	python-devel%{?_isa}
+BuildRequires:	python2-devel
+BuildRequires:	python3-devel
+BuildRequires:	xz-devel%{?_isa}
+BuildRequires:	zlib-devel%{?_isa}
 BuildRequires:	ImageMagick%{?_isa}
 BuildRequires:	desktop-file-utils%{?_isa}
 BuildRequires:	autogen%{?_isa}
@@ -46,69 +52,72 @@ BuildRequires:	automake
 BuildRequires:	autoconf
 BuildRequires:	bison%{?_isa}
 BuildRequires:	flex%{?_isa}
-BuildRequires:	texinfo%{?_isa}
+BuildRequires:	texinfo-tex
+BuildRequires:	perl-podlators
+BuildRequires:	libbabeltrace-devel
+#	For C++ pretty printers.
+BuildRequires:	libstdc++%{?_isa}
+
+#	Insight patches.
+
 Patch1:		insight-7.4.50-relocate.patch
 Patch2:		insight-7.4.50-readline-system.patch
-Patch3:		insight-7.4.50-unbundle.patch
-Patch4:		insight-7.4.50-acversion.patch
-Patch5:		insight-7.4.50-sig2dead.patch
-Patch6:		insight-7.4.50-sizesizet.patch
-Patch7:		insight-7.4.50-objalloc.patch
-Patch8:		insight-7.4.50-bz883591.patch
-Patch9:		insight-7.4.50-nocygnus.patch
-Patch10:	insight-7.4.50-texinfo5.patch
-
-#	Some patches from gdb.
-
-Patch100:	gdb-6.3-ppc64syscall-20040622.patch
-Patch101:	gdb-6.3-ppc64displaysymbol-20041124.patch
-Patch102:	gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
-Patch103:	gdb-6.6-scheduler_locking-step-is-default.patch
-Patch104:	gdb-6.3-gstack-20050411.patch
-Patch105:	gdb-6.3-gcore-thread-20050204.patch
-Patch106:	gdb-6.3-ia64-gcore-page0-20050421.patch
-Patch107:	insight-7.4.50-security-errata-20050610.patch
-Patch108:	gdb-6.3-ia64-sigtramp-frame-20050708.patch
-Patch109:	gdb-6.3-ia64-gcore-speedup-20050714.patch
-Patch110:	gdb-6.3-ia64-info-frame-fix-20050725.patch
-Patch111:	insight-7.4.50-readnever-20050907.patch
-Patch112:	gdb-6.3-ia64-sigill-20051115.patch
-Patch113:	gdb-6.5-bz203661-emit-relocs.patch
-Patch114:	gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
-Patch115:	insight-7.4.50-bz216711-clone-is-outermost.patch
-Patch116:	gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
-Patch117:	gdb-6.3-bz231832-obstack-2gb.patch
-Patch118:	gdb-6.6-bz235197-fork-detach-info.patch
-Patch119:	gdb-6.6-bfd-vdso8k.patch
-Patch120:	gdb-6.8-sparc64-silence-memcpy-check.patch
-Patch121:	gdb-6.8-bz436037-reg-no-longer-active.patch
-Patch122:	gdb-6.8-quit-never-aborts.patch
-Patch123:	gdb-core-open-vdso-warning.patch
+Patch3:		insight-7.8.50-iwidgetsname.patch
+
+#	Some patches from gdb. See gdb spec file for info.
+
+Patch101:	gdb-archer.patch
+Patch102:	insight-7.8.50-vla-intel.patch
+Patch103:	gdb-vla-intel-04of23-fix.patch
+Patch104:	gdb-vla-intel-stringbt-fix.patch
+Patch105:	gdb-6.3-ppc64syscall-20040622.patch
+Patch106:	gdb-6.3-ppc64displaysymbol-20041124.patch
+Patch107:	insight-7.8.50-scheduler_locking-step-sw-watchpoints2.patch
+Patch108:	gdb-6.3-gstack-20050411.patch
+Patch109:	insight-7.8.50-readnever-20050907.patch
+Patch110:	gdb-6.5-bz203661-emit-relocs.patch
+Patch111:	gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
+Patch112:	gdb-6.5-bz190810-gdbserver-arch-advice.patch
+Patch113:	gdb-6.5-bz216711-clone-is-outermost.patch
+Patch114:	gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
+Patch115:	gdb-6.5-bz109921-DW_AT_decl_file-test.patch
+Patch116:	insight-7.8.50-bz231832-obstack-2gb.patch
+Patch117:	gdb-6.6-bz235197-fork-detach-info.patch
+Patch118:	gdb-6.6-scheduler_locking-step-is-default.patch
+Patch119:	gdb-6.6-buildid-locate.patch
+Patch120:	gdb-6.6-buildid-locate-solib-missing-ids.patch
+Patch121:	insight-7.8.50-buildid-locate-rpm.patch
+Patch122:	gdb-6.8-sparc64-silence-memcpy-check.patch
+Patch123:	gdb-6.8-bz436037-reg-no-longer-active.patch
 Patch124:	gdb-x86_64-i386-syscall-restart.patch
 Patch125:	gdb-bz533176-fortran-omp-step.patch
 Patch126:	gdb-follow-child-stale-parent.patch
-Patch127:	insight-7.4.50-fortran-common-reduce.patch
-Patch128:	insight-7.4.50-fortran-common.patch
-Patch129:	insight-7.4.50-bz541866-rwatch-before-run.patch
+Patch127:	gdb-archer-pie-addons.patch
+Patch128:	gdb-archer-pie-addons-keep-disabled.patch
+Patch129:	insight-7.8.50-bz541866-rwatch-before-run.patch
 Patch130:	gdb-moribund-utrace-workaround.patch
-Patch131:	gdb-bz562763-pretty-print-2d-vectors.patch
-Patch132:	gdb-gdb-add-index-script.patch
-Patch133:	gdb-bz568248-oom-is-error.patch
-Patch134:	gdb-bz623749-gcore-relro.patch
-Patch135:	gdb-bz592031-siginfo-lost-4of5.patch
-Patch136:	insight-7.4.50-bz592031-siginfo-lost-5of5.patch
-Patch137:	gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
-Patch138:	gdb-glibc-vdso-workaround.patch
-Patch139:	insight-7.4.50-x86-onstack-1of2.patch
-Patch140:	gdb-x86-onstack-2of2.patch
-Patch141:	binutils-2.24-s390-mkopc.patch
-Patch142:	binutils-2.24-bfd.patch
-Patch143:	insight-7.4.50-tcl86.patch
-Patch144:	insight-7.4.50-bfdarm.patch
-
-#	Patches to apply after gdb patches.
-
-Patch200:	insight-7.4.50-structsiginfo.patch
+Patch131:	insight-7.8.50-buildid-locate-core-as-arg.patch
+Patch132:	gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
+Patch133:	gdb-gdb-add-index-script.patch
+Patch134:	gdb-bz568248-oom-is-error.patch
+Patch135:	gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
+Patch136:	gdb-glibc-vdso-workaround.patch
+Patch137:	insight-7.8.50-attach-fail-reasons-5of5.patch
+Patch138:	gdb-stale-frame_info.patch
+Patch139:	gdb-glibc-strstr-workaround.patch
+Patch140:	gdb-enable-count-crash.patch
+Patch141:	gdb-gnat-dwarf-crash-3of3.patch
+Patch142:	gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
+Patch143:	gdb-btrobust.patch
+Patch144:	insight-7.8.50-python-completer-1of2.patch
+Patch145:	gdb-python-gil.patch
+Patch146:	python-framefilter-invalidarg.patch
+Patch147:	gdb-dts-rhel6-python-compat.patch
+Patch148:	gdb-6.6-buildid-locate-rpm-scl.patch
+Patch149:	gdb-readline62-ask-more-rh.patch
+Patch150:	gdb-6.8-attach-signalled-detach-stopped.patch
+Patch151:	gdb-6.8-quit-never-aborts.patch
+Patch152:	gdb-rhel5-compat.patch
 
 
 %description
@@ -122,66 +131,80 @@ GDB version 6.x.
 %prep 
 #-------------------------------------------------------------------------------
 
-%setup -q -n insight-%{ver}
+%setup -q -n insight-%{ver}%{?snap:.%{snap}}
 
 %patch1 -p1 -b .relocate
 %patch2 -p1 -b .readline-system
-%patch3 -p1 -b .unbundle
-%patch4 -p1 -b .acversion
-%patch5 -p1 -b .sig2dead
-%patch6 -p1 -b .sizesizet
-%patch7 -p1 -b .objalloc
-%patch8 -p1 -b .bz883591
-%patch9 -p1 -b .nocygnus
-%patch10 -p1 -b .texinfo5
-
-%patch100 -p 1 -b .ppc64syscall
-%patch101 -p 1 -b .ppc64displaysymbol
-%patch102 -p 1 -b .scheduler_locking-step-sw-watchpoints2
-%patch103 -p 1 -b .scheduler_locking-step-is-default
-%patch104 -p 1 -b .gstack
-%patch105 -p 1 -b .gcore-thread
-%patch106 -p 1 -b .ia64-gcore-page0
-%patch107 -p 1 -b .security-errata
-%patch108 -p 1 -b .ia64-sigtramp-frame
-%patch109 -p 1 -b .ia64-gcore-speedup
-%patch110 -p 1 -b .ia64-info-frame-fix
-%patch111 -p 1 -b .readnever
-%patch112 -p 1 -b .ia64-sigill
-%patch113 -p 1 -b .bz203661-emit-relocs
-%patch114 -p 1 -b .bz185337-resolve-tls-without-debuginfo-v2
-%patch115 -p 1 -b .bz216711-clone-is-outermost
-%patch116 -p 1 -b .bz218379-solib-trampoline-lookup-lock-fix
-%patch117 -p 1 -b .bz231832-obstack-2gb
-%patch118 -p 1 -b .bz235197-fork-detach-info
-%patch119 -p 1 -b .bfd-vdso8k
-%patch120 -p 1 -b .sparc64-silence-memcpy-check
-%patch121 -p 1 -b .bz436037-reg-no-longer-active
-%patch122 -p 1 -b .quit-never-aborts
-%patch123 -p 1 -b .core-open-vdso-warning
-%patch124 -p 1 -b .x86_64-i386-syscall-restart
-%patch125 -p 1 -b .bz533176-fortran-omp-step
-%patch126 -p 1 -b .follow-child-stale-parent
-%patch127 -p 1 -b .fortran-common-reduce
-%patch128 -p 1 -b .fortran-common
-%patch129 -p 1 -b .bz541866-rwatch-before-run
-%patch130 -p 1 -b .moribund-utrace-workaround
-%patch131 -p 1 -b .bz562763-pretty-print-2d-vectors
-%patch132 -p 1 -b .gdb-add-index-script
-%patch133 -p 1 -b .bz568248-oom-is-error
-%patch134 -p 1 -b .bz623749-gcore-relro
-%patch135 -p 1 -b .bz592031-siginfo-lost-4of5
-%patch136 -p 1 -b .bz592031-siginfo-lost-5of5
-%patch137 -p 1 -b .sparc-add-workaround-to-broken-debug-files
-%patch138 -p 1 -b .glibc-vdso-workaround
-%patch139 -p 1 -b .x86-onstack-1of2
-%patch140 -p 1 -b .x86-onstack-2of2
-%patch141 -p 0 -b .s390-mkopc
-%patch142 -p 1 -b .bfd
-%patch143 -p 1 -b .tcl86
-%patch144 -p 1 -b .bfdarm
-
-%patch200 -p 1 -b .structsiginfo
+%patch3 -p1 -b .iwidgetsname
+
+%patch101 -p1
+%patch102 -p1
+%patch103 -p1
+%patch104 -p1
+
+%patch105 -p1
+%patch106 -p1
+%patch107 -p1
+%patch108 -p1
+%patch109 -p1
+%patch110 -p1
+%patch111 -p1
+%patch112 -p1
+%patch113 -p1
+%patch114 -p1
+%patch115 -p1
+%patch116 -p1
+%patch117 -p1
+%patch118 -p1
+%patch119 -p1
+%patch120 -p1
+%patch121 -p1
+%patch122 -p1
+%patch123 -p1
+%patch124 -p1
+%patch125 -p1
+%patch126 -p1
+%patch127 -p1
+%patch128 -p1
+%patch129 -p1
+%patch130 -p1
+%patch131 -p1
+%patch132 -p1
+%patch133 -p1
+%patch134 -p1
+%patch135 -p1
+%patch136 -p1
+%patch137 -p1
+%patch138 -p1
+%patch139 -p1
+%patch140 -p1
+%patch141 -p1
+%patch142 -p1
+%patch143 -p1
+%patch144 -p1
+%patch145 -p1
+%patch146 -p1
+
+%patch147 -p1
+%if 0%{!?el6:1}
+%patch147 -p1 -R
+%endif
+%patch148 -p1
+%if 0%{!?el6:1} || 0%{!?scl:1}
+%patch148 -p1 -R
+%endif
+%patch149 -p1
+%if 0%{?rhel:1} && 0%{?rhel} <= 6
+%patch149 -p1 -R
+%endif
+%patch150 -p1
+%patch151 -p1
+%patch152 -p1
+%if 0%{!?rhel:1} || 0%{?rhel} > 6
+%patch152 -p1 -R
+%patch151 -p1 -R
+%patch150 -p1 -R
+%endif
 
 
 #-------------------------------------------------------------------------------
@@ -189,7 +212,7 @@ GDB version 6.x.
 #-------------------------------------------------------------------------------
 
 TOPDIR=`pwd`
-rm -rf itcl tcl tk readline
+rm -rf tcl tk itcl itk iwidgets readline
 
 #	Need a complete reconfiguration after unbundling.
 
@@ -211,7 +234,7 @@ done
 
 (
 	cd gdb
-	aclocal -I "${TOPDIR}/config" -I gnulib/m4
+	aclocal -I "${TOPDIR}/config"
 	autoconf
 )
 
@@ -228,14 +251,24 @@ done
 		--with-separate-debug-dir='/usr/lib/debug'		\
 		--with-system-readline					\
 		--with-expat						\
+		--with-python						\
 		--with-tclinclude="${TCL_SRC_DIR}"			\
 		--with-tkinclude="${TK_SRC_DIR}"			\
-		--with-python=yes					\
-%ifarch ia64
-		--with-libunwind					\
-%else
 		--without-libunwind					\
+		--enable-64-bit-bfd					\
+%if 0%{!?rhel:1}
+		--with-babeltrace					\
+%else
+		--without-babeltrace					\
 %endif
+%if 0%{!?rhel:1} || 0%{?rhel} > 6
+		--with-lzma						\
+%else
+		--without-lzma						\
+%endif
+		--with-auto-load-dir='$debugdir:$datadir/auto-load'	\
+		--enable-targets=s390-linux-gnu,powerpc-linux-gnu,arm-linux-gnu,aarch64-linux-gnu \
+		%{_target_platform}
 
 make %{?_smp_mflags}
 
@@ -279,17 +312,33 @@ make DESTDIR="${RPM_BUILD_ROOT}" INSTALL="${INSTALL}" install
 
 echo "pkg_mkIndex \"${RPM_BUILD_ROOT}%{_datadir}/insight/gui\"" | tclsh
 
+#	Populate the auto-load directory from the libstdc++ gdb-specific
+#		directory.
+
+for i in $(echo bin lib $(basename '%{_libdir}') sbin | tr ' ' '\n' | sort -u)
+do	mkdir -p "${RPM_BUILD_ROOT}%{_datadir}/insight/auto-load%{_prefix}/$i"
+	ln -s "$(echo %{_prefix} | sed 's#^/*##')/$i"			\
+	    "${RPM_BUILD_ROOT}%{_datadir}/insight/auto-load/$i"
+	find "%{_datadir}/gdb/auto-load%{_prefix}/${i}" -mindepth 1
+done | while read FROM
+do	TO=`echo "${FROM}" | sed 's#/gdb/#/insight/#'`
+	if [ -d "${FROM}" ]
+	then	mkdir -p "${RPM_BUILD_ROOT}${TO}"
+	else	ln -s "${FROM}" "${RPM_BUILD_ROOT}${TO}"
+	fi
+done
+
 #	Install man file.
 
 ${INSTALL} -m 755 -d "${RPM_BUILD_ROOT}%{_mandir}/man1"
-${INSTALL} -m 644 -p "%{SOURCE2}" "${RPM_BUILD_ROOT}%{_mandir}/man1/"
+${INSTALL} -m 644 -p "%{SOURCE1}" "${RPM_BUILD_ROOT}%{_mandir}/man1/"
 
 #	Create the menu entry.
 
 ${INSTALL} -m 755 -d "${RPM_BUILD_ROOT}%{_datadir}/applications"
 desktop-file-install							\
 	--dir		"${RPM_BUILD_ROOT}%{_datadir}/applications"	\
-	"%{SOURCE1}"
+	gdb/gdbtk/insight.desktop
 
 #	Install icon.
 
@@ -297,6 +346,10 @@ ${INSTALL} -m 755 -d "${RPM_BUILD_ROOT}%{_datadir}/pixmaps"
 convert "gdb/gdbtk/library/images/gdbtk_icon.gif"			\
 	"${RPM_BUILD_ROOT}%{_datadir}/pixmaps/%{name}.png"
 
+#	Python byte compile, but not in auto-load.
+
+%py_byte_compile %{__python2} %{buildroot}%{_datadir}/insight/python
+
 
 #-------------------------------------------------------------------------------
 %clean 
@@ -310,7 +363,7 @@ rm -rf "${RPM_BUILD_ROOT}"
 #-------------------------------------------------------------------------------
 
 %defattr(-, root, root, -)
-%doc gdb/NEWS gdb/gdbtk/README gdb/gdbtk/plugins/HOW-TO include/COPYING3
+%doc gdb/NEWS gdb/gdbtk/README gdb/gdbtk/plugins/HOW-TO COPYING COPYING3
 %{_bindir}/*
 %{_datadir}/insight
 %{_datadir}/applications/*
@@ -320,13 +373,18 @@ rm -rf "${RPM_BUILD_ROOT}"
 
 #-------------------------------------------------------------------------------
 %changelog
+#-------------------------------------------------------------------------------
+
+* Wed Aug 27 2014 Patrick Monnerat <pm at datasphere.ch> 7.8.50-1.20140827git
+- New snapshot.
+- Patch "iwidgetsname" for package name case spelling.
+- Limited pretty printers support (from console window).
+
 * Sat Aug 16 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 7.4.50-16.20120403cvs
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 
-#-------------------------------------------------------------------------------
-
 * Tue Jun 10 2014 Patrick Monnerat <pm at datasphere.ch> 7.4.50-15.20120403cvs
-- Patch "tcl86" for tcl version 8.6 compatibility.
+- Patch "tcl86" for tcl/tk version 8.6 and itcl/itk/iwidgets 4.0 compatibility.
 - Patch "bfdarm" to fix bfd compilation on arm.
 - Requires xterm for Fedora 21.
 
diff --git a/python-framefilter-invalidarg.patch b/python-framefilter-invalidarg.patch
new file mode 100644
index 0000000..4c1f16b
--- /dev/null
+++ b/python-framefilter-invalidarg.patch
@@ -0,0 +1,596 @@
+http://sourceware.org/ml/gdb-patches/2014-08/msg00364.html
+Subject: [patch+7.8?] Fix crash on Python frame filters with unreadable arg
+
+
+--d6Gm4EdcadzBjdND
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+
+Hi,
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1126177
+
+ERROR: AddressSanitizer: SEGV on unknown address 0x000000000050 (pc 0x000000992bef sp 0x7ffff9039530 bp 0x7ffff9039540 T0)
+    #0 0x992bee in value_type .../gdb/value.c:925
+    #1 0x87c951 in py_print_single_arg python/py-framefilter.c:445
+    #2 0x87cfae in enumerate_args python/py-framefilter.c:596
+    #3 0x87e0b0 in py_print_args python/py-framefilter.c:968
+
+It crashes because frame_arg::val is documented it may contain NULL
+(frame_arg::error is then non-NULL) but the code does not handle it.
+
+Another bug is that py_print_single_arg() calls goto out of its TRY_CATCH
+which messes up GDB cleanup chain crashing GDB later.
+
+I tried to somehow separate it to two patches first but it in the end kept
+them merged.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu.
+
+It is probably 7.7 regression (I have not verified it) due to the introduction
+of Python frame filters.
+
+I am not sure if it is more suitable for gdb.arch/ or gdb.python/ , used the
+latter.
+
+
+Thanks,
+Jan
+
+--d6Gm4EdcadzBjdND
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline; filename="pyinvalidarg.patch"
+
+gdb/
+2014-08-19  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* python/py-framefilter.c (py_print_single_arg): Handle NULL FA->VAL.
+	Fix goto out of TRY_CATCH.
+
+gdb/testsuite/
+2014-08-19  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* gdb.python/amd64-py-framefilter-invalidarg.S: New file.
+	* gdb.python/py-framefilter-invalidarg-gdb.py.in: New file.
+	* gdb.python/py-framefilter-invalidarg.exp: New file.
+	* gdb.python/py-framefilter-invalidarg.py: New file.
+
+diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
+index 9db83c7..d53282f 100644
+--- a/gdb/python/py-framefilter.c
++++ b/gdb/python/py-framefilter.c
+@@ -365,9 +365,12 @@ py_print_single_arg (struct ui_out *out,
+ {
+   struct value *val;
+   volatile struct gdb_exception except;
++  enum ext_lang_bt_status retval = EXT_LANG_BT_OK;
+ 
+   if (fa != NULL)
+     {
++      if (fa->val == NULL && fa->error == NULL)
++	return EXT_LANG_BT_OK;
+       language = language_def (SYMBOL_LANGUAGE (fa->sym));
+       val = fa->val;
+     }
+@@ -433,16 +436,18 @@ py_print_single_arg (struct ui_out *out,
+       /* For MI print the type, but only for simple values.  This seems
+ 	 weird, but this is how MI choose to format the various output
+ 	 types.  */
+-      if (args_type == MI_PRINT_SIMPLE_VALUES)
++      if (args_type == MI_PRINT_SIMPLE_VALUES && val != NULL)
+ 	{
+ 	  if (py_print_type (out, val) == EXT_LANG_BT_ERROR)
+ 	    {
++	      retval = EXT_LANG_BT_ERROR;
+ 	      do_cleanups (cleanups);
+-	      goto error;
++	      continue;
+ 	    }
+ 	}
+ 
+-      annotate_arg_value (value_type (val));
++      if (val != NULL)
++	annotate_arg_value (value_type (val));
+ 
+       /* If the output is to the CLI, and the user option "set print
+ 	 frame-arguments" is set to none, just output "...".  */
+@@ -454,27 +459,25 @@ py_print_single_arg (struct ui_out *out,
+ 	     for the case of MI_PRINT_NO_VALUES.  */
+ 	  if (args_type != NO_VALUES)
+ 	    {
+-	      if (py_print_value (out, val, opts, 0, args_type, language)
+-		  == EXT_LANG_BT_ERROR)
++	      if (val == NULL)
+ 		{
+-		  do_cleanups (cleanups);
+-		  goto error;
++		  gdb_assert (fa != NULL && fa->error != NULL);
++		  ui_out_field_fmt (out, "value",
++				    _("<error reading variable: %s>"),
++				    fa->error);
+ 		}
++	      else if (py_print_value (out, val, opts, 0, args_type, language)
++		       == EXT_LANG_BT_ERROR)
++		retval = EXT_LANG_BT_ERROR;
+ 	    }
+ 	}
+ 
+       do_cleanups (cleanups);
+     }
+   if (except.reason < 0)
+-    {
+-      gdbpy_convert_exception (except);
+-      goto error;
+-    }
+-
+-  return EXT_LANG_BT_OK;
++    gdbpy_convert_exception (except);
+ 
+- error:
+-  return EXT_LANG_BT_ERROR;
++  return retval;
+ }
+ 
+ /* Helper function to loop over frame arguments provided by the
+diff --git a/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S b/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S
+new file mode 100755
+index 0000000..3ac1b23
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S
+@@ -0,0 +1,261 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2014 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 file is compiled from a single line
++   int main (int argc, char **argv) { return 0; }
++   using -g -dA -S -O2 and patched as #if-ed below.  */
++
++	.file	"py-framefilter-invalidarg.c"
++	.text
++.Ltext0:
++	.globl	main
++	.type	main, @function
++main:
++.LFB0:
++	.file 1 "py-framefilter-invalidarg.c"
++	# py-framefilter-invalidarg.c:1
++	.loc 1 1 0
++	.cfi_startproc
++# BLOCK 2 seq:0
++# PRED: ENTRY (FALLTHRU)
++	pushq	%rbp
++	.cfi_def_cfa_offset 16
++	.cfi_offset 6, -16
++	movq	%rsp, %rbp
++	.cfi_def_cfa_register 6
++	movl	%edi, -4(%rbp)
++	movq	%rsi, -16(%rbp)
++	# py-framefilter-invalidarg.c:2
++	.loc 1 2 0
++	movl	$0, %eax
++	# py-framefilter-invalidarg.c:3
++	.loc 1 3 0
++	popq	%rbp
++	.cfi_def_cfa 7, 8
++# SUCC: EXIT [100.0%] 
++	ret
++	.cfi_endproc
++.LFE0:
++	.size	main, .-main
++.Letext0:
++	.section	.debug_info,"", at progbits
++.Ldebug_info0:
++	.long	.Le - .Ls	# Length of Compilation Unit Info
++.Ls:
++	.value	0x4	# DWARF version number
++	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
++	.byte	0x8	# Pointer Size (in bytes)
++	.uleb128 0x1	# (DIE (0xb) DW_TAG_compile_unit)
++	.long	.LASF3	# DW_AT_producer: "GNU C 4.9.1 20140813 (Red Hat 4.9.1-7) -mtune=generic -march=x86-64 -g"
++	.byte	0x1	# DW_AT_language
++	.long	.LASF4	# DW_AT_name: "py-framefilter-invalidarg.c"
++	.long	.LASF5	# DW_AT_comp_dir: ""
++	.quad	.Ltext0	# DW_AT_low_pc
++	.quad	.Letext0-.Ltext0	# DW_AT_high_pc
++	.long	.Ldebug_line0	# DW_AT_stmt_list
++die2d:
++	.uleb128 0x2	# (DIE (0x2d) DW_TAG_subprogram)
++			# DW_AT_external
++	.long	.LASF6	# DW_AT_name: "main"
++	.byte	0x1	# DW_AT_decl_file (py-framefilter-invalidarg.c)
++	.byte	0x1	# DW_AT_decl_line
++			# DW_AT_prototyped
++	.long	die6b-.Ldebug_info0	# DW_AT_type
++	.quad	.LFB0	# DW_AT_low_pc
++	.quad	.LFE0-.LFB0	# DW_AT_high_pc
++	.uleb128 0x1	# DW_AT_frame_base
++	.byte	0x9c	# DW_OP_call_frame_cfa
++			# DW_AT_GNU_all_call_sites
++die4e:
++	.uleb128 0x3	# (DIE (0x4e) DW_TAG_formal_parameter)
++	.long	.LASF0	# DW_AT_name: "argc"
++	.byte	0x1	# DW_AT_decl_file (py-framefilter-invalidarg.c)
++	.byte	0x1	# DW_AT_decl_line
++	.long	die6b-.Ldebug_info0	# DW_AT_type
++#if 0
++	.uleb128 0x2	# DW_AT_location
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 -20
++#endif
++#if 0
++	.uleb128 1f - 2f	# DW_AT_location
++2:
++	.byte	0x03	# DW_OP_addr
++	.quad 0
++1:
++#endif
++#if 1
++	.uleb128 1f - 2f	# DW_AT_location
++2:
++	.byte	0x13	# DW_OP_drop
++	.quad 0
++1:
++#endif
++die5c:
++	.uleb128 0x3	# (DIE (0x5c) DW_TAG_formal_parameter)
++	.long	.LASF1	# DW_AT_name: "argv"
++	.byte	0x1	# DW_AT_decl_file (py-framefilter-invalidarg.c)
++	.byte	0x1	# DW_AT_decl_line
++	.long	die72-.Ldebug_info0	# DW_AT_type
++	.uleb128 0x2	# DW_AT_location
++	.byte	0x91	# DW_OP_fbreg
++	.sleb128 -32
++	.byte	0	# end of children of DIE 0x2d
++die6b:
++	.uleb128 0x4	# (DIE (0x6b) DW_TAG_base_type)
++	.byte	0x4	# DW_AT_byte_size
++	.byte	0x5	# DW_AT_encoding
++	.ascii "int\0"	# DW_AT_name
++die72:
++	.uleb128 0x5	# (DIE (0x72) DW_TAG_pointer_type)
++	.byte	0x8	# DW_AT_byte_size
++	.long	die78-.Ldebug_info0	# DW_AT_type
++die78:
++	.uleb128 0x5	# (DIE (0x78) DW_TAG_pointer_type)
++	.byte	0x8	# DW_AT_byte_size
++	.long	die7e-.Ldebug_info0	# DW_AT_type
++die7e:
++	.uleb128 0x6	# (DIE (0x7e) DW_TAG_base_type)
++	.byte	0x1	# DW_AT_byte_size
++	.byte	0x6	# DW_AT_encoding
++	.long	.LASF2	# DW_AT_name: "char"
++	.byte	0	# end of children of DIE 0xb
++.Le:
++	.section	.debug_abbrev,"", at progbits
++.Ldebug_abbrev0:
++	.uleb128 0x1	# (abbrev code)
++	.uleb128 0x11	# (TAG: DW_TAG_compile_unit)
++	.byte	0x1	# DW_children_yes
++	.uleb128 0x25	# (DW_AT_producer)
++	.uleb128 0xe	# (DW_FORM_strp)
++	.uleb128 0x13	# (DW_AT_language)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3	# (DW_AT_name)
++	.uleb128 0xe	# (DW_FORM_strp)
++	.uleb128 0x1b	# (DW_AT_comp_dir)
++	.uleb128 0xe	# (DW_FORM_strp)
++	.uleb128 0x11	# (DW_AT_low_pc)
++	.uleb128 0x1	# (DW_FORM_addr)
++	.uleb128 0x12	# (DW_AT_high_pc)
++	.uleb128 0x7	# (DW_FORM_data8)
++	.uleb128 0x10	# (DW_AT_stmt_list)
++	.uleb128 0x17	# (DW_FORM_sec_offset)
++	.byte	0
++	.byte	0
++	.uleb128 0x2	# (abbrev code)
++	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
++	.byte	0x1	# DW_children_yes
++	.uleb128 0x3f	# (DW_AT_external)
++	.uleb128 0x19	# (DW_FORM_flag_present)
++	.uleb128 0x3	# (DW_AT_name)
++	.uleb128 0xe	# (DW_FORM_strp)
++	.uleb128 0x3a	# (DW_AT_decl_file)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3b	# (DW_AT_decl_line)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x27	# (DW_AT_prototyped)
++	.uleb128 0x19	# (DW_FORM_flag_present)
++	.uleb128 0x49	# (DW_AT_type)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.uleb128 0x11	# (DW_AT_low_pc)
++	.uleb128 0x1	# (DW_FORM_addr)
++	.uleb128 0x12	# (DW_AT_high_pc)
++	.uleb128 0x7	# (DW_FORM_data8)
++	.uleb128 0x40	# (DW_AT_frame_base)
++	.uleb128 0x18	# (DW_FORM_exprloc)
++	.uleb128 0x2117	# (DW_AT_GNU_all_call_sites)
++	.uleb128 0x19	# (DW_FORM_flag_present)
++	.byte	0
++	.byte	0
++	.uleb128 0x3	# (abbrev code)
++	.uleb128 0x5	# (TAG: DW_TAG_formal_parameter)
++	.byte	0	# DW_children_no
++	.uleb128 0x3	# (DW_AT_name)
++	.uleb128 0xe	# (DW_FORM_strp)
++	.uleb128 0x3a	# (DW_AT_decl_file)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3b	# (DW_AT_decl_line)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x49	# (DW_AT_type)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.uleb128 0x2	# (DW_AT_location)
++	.uleb128 0x18	# (DW_FORM_exprloc)
++	.byte	0
++	.byte	0
++	.uleb128 0x4	# (abbrev code)
++	.uleb128 0x24	# (TAG: DW_TAG_base_type)
++	.byte	0	# DW_children_no
++	.uleb128 0xb	# (DW_AT_byte_size)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3e	# (DW_AT_encoding)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3	# (DW_AT_name)
++	.uleb128 0x8	# (DW_FORM_string)
++	.byte	0
++	.byte	0
++	.uleb128 0x5	# (abbrev code)
++	.uleb128 0xf	# (TAG: DW_TAG_pointer_type)
++	.byte	0	# DW_children_no
++	.uleb128 0xb	# (DW_AT_byte_size)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x49	# (DW_AT_type)
++	.uleb128 0x13	# (DW_FORM_ref4)
++	.byte	0
++	.byte	0
++	.uleb128 0x6	# (abbrev code)
++	.uleb128 0x24	# (TAG: DW_TAG_base_type)
++	.byte	0	# DW_children_no
++	.uleb128 0xb	# (DW_AT_byte_size)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3e	# (DW_AT_encoding)
++	.uleb128 0xb	# (DW_FORM_data1)
++	.uleb128 0x3	# (DW_AT_name)
++	.uleb128 0xe	# (DW_FORM_strp)
++	.byte	0
++	.byte	0
++	.byte	0
++	.section	.debug_aranges,"", at progbits
++	.long	0x2c	# Length of Address Ranges Info
++	.value	0x2	# DWARF Version
++	.long	.Ldebug_info0	# Offset of Compilation Unit Info
++	.byte	0x8	# Size of Address
++	.byte	0	# Size of Segment Descriptor
++	.value	0	# Pad to 16 byte boundary
++	.value	0
++	.quad	.Ltext0	# Address
++	.quad	.Letext0-.Ltext0	# Length
++	.quad	0
++	.quad	0
++	.section	.debug_line,"", at progbits
++.Ldebug_line0:
++	.section	.debug_str,"MS", at progbits,1
++.LASF1:
++	.string	"argv"
++.LASF4:
++	.string	"py-framefilter-invalidarg.c"
++.LASF5:
++	.string	""
++.LASF0:
++	.string	"argc"
++.LASF3:
++	.string	"GNU C 4.9.1 20140813 (Red Hat 4.9.1-7) -mtune=generic -march=x86-64 -g"
++.LASF6:
++	.string	"main"
++.LASF2:
++	.string	"char"
++	.ident	"GCC: (GNU) 4.9.1 20140813 (Red Hat 4.9.1-7)"
++	.section	.note.GNU-stack,"", at progbits
+diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py.in b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py.in
+new file mode 100644
+index 0000000..1fa6ffc
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py.in
+@@ -0,0 +1,48 @@
++# Copyright (C) 2014 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 file is part of the GDB testsuite.  It tests Python-based
++# frame-filters.
++import gdb
++import itertools
++from gdb.FrameDecorator import FrameDecorator
++
++
++class FrameObjFile ():
++
++    def __init__ (self):
++        self.name = "Filter1"
++        self.priority = 1
++        self.enabled = False
++        gdb.current_progspace().frame_filters ["Progspace" + self.name] = self
++        gdb.current_objfile().frame_filters ["ObjectFile" + self.name] = self
++
++    def filter (self, frame_iter):
++        return frame_iter
++
++class FrameObjFile2 ():
++
++    def __init__ (self):
++        self.name = "Filter2"
++        self.priority = 100
++        self.enabled = True
++        gdb.current_progspace().frame_filters ["Progspace" + self.name] = self
++        gdb.current_objfile().frame_filters ["ObjectFile" + self.name] = self
++
++    def filter (self, frame_iter):
++        return frame_iter
++
++FrameObjFile()
++FrameObjFile2()
+diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
+new file mode 100644
+index 0000000..f70d16e
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
+@@ -0,0 +1,67 @@
++# Copyright (C) 2014 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/>.
++
++load_lib gdb-python.exp
++
++standard_testfile amd64-py-framefilter-invalidarg.S
++
++if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
++    verbose "Skipping py-framefilter-invalidarg."
++    return
++}
++
++# We cannot use prepare_for_testing as we have to set the safe-patch
++# to check objfile and progspace printers.
++if {[build_executable $testfile.exp $testfile $srcfile {}] == -1} {
++    return -1
++}
++
++# Start with a fresh gdb.
++gdb_exit
++gdb_start
++
++# Skip all tests if Python scripting is not enabled.
++if { [skip_python_tests] } { continue }
++
++# Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
++# Care is taken to put it in the same directory as the binary so that
++# gdb will find it.
++set remote_obj_python_file \
++    [remote_download \
++	 host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
++	 [standard_output_file ${testfile}-gdb.py]]
++
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
++    "set auto-load safe-path"
++gdb_load ${binfile}
++# Verify gdb loaded the script.
++gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \
++    "Test auto-load had loaded python scripts"
++
++if ![runto_main] then {
++    perror "couldn't run to breakpoint"
++    return
++}
++gdb_test_no_output "set python print-stack full" \
++    "Set python print-stack to full"
++
++# Load global frame-filters
++set remote_python_file [gdb_remote_download host \
++			    ${srcdir}/${subdir}/${testfile}.py]
++gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
++    "Load python file"
++
++gdb_test "bt" " in niam \\(argc=<error reading variable: dwarf expression stack underflow>, argv=0x\[0-9a-f\]+\\) at py-framefilter-invalidarg.c:\[0-9\]+" "bt full with filters"
+diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py
+new file mode 100644
+index 0000000..d5f92cb
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py
+@@ -0,0 +1,59 @@
++# Copyright (C) 2014 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 file is part of the GDB testsuite.  It tests Python-based
++# frame-filters.
++import gdb
++import itertools
++from gdb.FrameDecorator import FrameDecorator
++import copy
++
++class Reverse_Function (FrameDecorator):
++
++    def __init__(self, fobj):
++        super(Reverse_Function, self).__init__(fobj)
++        self.fobj = fobj
++
++    def function (self):
++        fname = str (self.fobj.function())
++        if (fname == None or fname == ""):
++            return None
++        if fname == 'end_func':
++            extra = self.fobj.inferior_frame().read_var('str').string()
++        else:
++            extra = ''
++        fname = fname[::-1] + extra
++        return fname
++
++class FrameFilter ():
++
++    def __init__ (self):
++        self.name = "Reverse"
++        self.priority = 100
++        self.enabled = True
++        gdb.frame_filters [self.name] = self
++
++    def filter (self, frame_iter):
++        # Python 3.x moved the itertools.imap functionality to map(),
++        # so check if it is available.
++        if hasattr(itertools, "imap"):
++            frame_iter = itertools.imap (Reverse_Function,
++                                         frame_iter)
++        else:
++            frame_iter = map(Reverse_Function, frame_iter)
++
++        return frame_iter
++
++FrameFilter()
+
+--d6Gm4EdcadzBjdND--
+
diff --git a/sources b/sources
index 1456ddb..ce16108 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-b9079e62c1dd0a09789505780a16b0f2  insight-7.4.50.tar.xz
+6418ee5151544832de0b751a1f73c4d0  insight-7.8.50.20140827.tar.bz2


More information about the scm-commits mailing list