[insight/f17] * Tue Apr 3 2012 Patrick Monnerat <pm at datasphere.ch> 7.4.50-1.20120403cvs - New cvs snapshot. - Pat
Patrick Monnerat
monnerat at fedoraproject.org
Thu Apr 19 12:10:39 UTC 2012
commit fae20e413836f126f0ba6c9a5a3c8755360a0ab2
Author: Patrick Monnerat <pm at datasphere.ch>
Date: Thu Apr 19 14:08:18 2012 +0200
* Tue Apr 3 2012 Patrick Monnerat <pm at datasphere.ch> 7.4.50-1.20120403cvs
- New cvs snapshot.
- Patches imported or adapted from gdb package.
- Patch "sig2dead" to avoid a segfault while notifying a signal to a dead
process.
http://sourceware.org/ml/insight/2012-q2/msg00002.html
- Patch "sizesizet" to fix a type mismatch between print format descriptors and
corresponding argument.
http://sourceware.org/ml/insight/2012-q2/msg00003.html
.gitignore | 1 +
gdb-6.3-bz231832-obstack-2gb.patch | 192 +
gdb-6.3-gcore-thread-20050204.patch | 25 +
gdb-6.3-gstack-20050411.patch | 232 +
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.3-ppc64displaysymbol-20041124.patch | 24 +
gdb-6.3-ppc64syscall-20040622.patch | 111 +
...bz185337-resolve-tls-without-debuginfo-v2.patch | 143 +
gdb-6.5-bz203661-emit-relocs.patch | 17 +
...bz218379-solib-trampoline-lookup-lock-fix.patch | 21 +
gdb-6.6-bfd-vdso8k.patch | 119 +
gdb-6.6-bz235197-fork-detach-info.patch | 121 +
gdb-6.6-scheduler_locking-step-is-default.patch | 54 +
....6-scheduler_locking-step-sw-watchpoints2.patch | 204 +
gdb-6.8-bz436037-reg-no-longer-active.patch | 25 +
gdb-6.8-quit-never-aborts.patch | 72 +
gdb-6.8-sparc64-silence-memcpy-check.patch | 12 +
...parc-add-workaround-to-broken-debug-files.patch | 51 +
gdb-bz533176-fortran-omp-step.patch | 121 +
gdb-bz562763-pretty-print-2d-vectors.patch | 398 +
gdb-bz568248-oom-is-error.patch | 68 +
gdb-bz592031-siginfo-lost-4of5.patch | 994 +
gdb-bz623749-gcore-relro.patch | 169 +
gdb-core-open-vdso-warning.patch | 84 +
gdb-follow-child-stale-parent.patch | 27 +
gdb-gdb-add-index-script.patch | 118 +
gdb-glibc-vdso-workaround.patch | 30 +
gdb-moribund-utrace-workaround.patch | 16 +
gdb-x86-onstack-2of2.patch | 166 +
gdb-x86_64-i386-syscall-restart.patch | 121 +
insight-6.8-derefbug.patch | 25 -
insight-6.8-destdir.patch | 174 -
insight-6.8-doubleinstall.patch | 16 -
insight-6.8-gcc43.patch | 24 -
insight-6.8-gcc44.patch | 13 -
insight-6.8-ia64bound.patch | 12 -
insight-6.8-itcl33.patch |124385 --------------------
insight-6.8-lib64.patch | 80 -
insight-6.8-readline-system.patch | 144 -
insight-6.8-readline6.patch | 36 -
insight-6.8-syspackages.patch | 855 -
insight-6.8-tclm4.patch | 2442 -
insight-6.8-warnings.patch | 365 -
insight-6.8.1-baseclassfield.patch | 28 -
insight-6.8.1-gcc45.patch | 66 -
insight-6.8.1-sbrk.patch | 42 -
insight-6.8.1-unused.patch | 150 -
insight-7.4.50-acversion.patch | 52 +
insight-7.4.50-bz216711-clone-is-outermost.patch | 418 +
insight-7.4.50-bz541866-rwatch-before-run.patch | 145 +
insight-7.4.50-bz592031-siginfo-lost-5of5.patch | 111 +
insight-7.4.50-fortran-common-reduce.patch | 499 +
insight-7.4.50-fortran-common.patch | 581 +
insight-7.4.50-readline-system.patch | 81 +
insight-7.4.50-readnever-20050907.patch | 80 +
...relocate.patch => insight-7.4.50-relocate.patch | 78 +-
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-unbundle.patch | 103 +
insight-7.4.50-x86-onstack-1of2.patch | 73 +
insight.spec | 220 +-
sources | 2 +-
67 files changed, 6835 insertions(+), 128969 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 4c633c1..253fd9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
insight-6.8-1.tar.bz2
+/insight-7.4.50.tar.bz2
diff --git a/gdb-6.3-bz231832-obstack-2gb.patch b/gdb-6.3-bz231832-obstack-2gb.patch
new file mode 100644
index 0000000..0b08cee
--- /dev/null
+++ b/gdb-6.3-bz231832-obstack-2gb.patch
@@ -0,0 +1,192 @@
+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
+@@ -188,31 +188,31 @@ struct obstack /* control current objec
+
+ /* Declare the external functions we use; they are in obstack.c. */
+
+-extern void _obstack_newchunk (struct obstack *, int);
++extern void _obstack_newchunk (struct obstack *, PTR_INT_TYPE);
+ extern void _obstack_free (struct obstack *, void *);
+-extern int _obstack_begin (struct obstack *, int, int,
++extern int _obstack_begin (struct obstack *, PTR_INT_TYPE, int,
+ void *(*) (long), void (*) (void *));
+-extern int _obstack_begin_1 (struct obstack *, int, int,
++extern int _obstack_begin_1 (struct obstack *, PTR_INT_TYPE, int,
+ void *(*) (void *, long),
+ void (*) (void *, void *), void *);
+-extern int _obstack_memory_used (struct obstack *);
++extern PTR_INT_TYPE _obstack_memory_used (struct obstack *);
+
+ /* Do the function-declarations after the structs
+ but before defining the macros. */
+
+ void obstack_init (struct obstack *obstack);
+
+-void * obstack_alloc (struct obstack *obstack, int size);
++void * obstack_alloc (struct obstack *obstack, PTR_INT_TYPE size);
+
+-void * obstack_copy (struct obstack *obstack, void *address, int size);
+-void * obstack_copy0 (struct obstack *obstack, void *address, int size);
++void * obstack_copy (struct obstack *obstack, void *address, PTR_INT_TYPE size);
++void * obstack_copy0 (struct obstack *obstack, void *address, PTR_INT_TYPE size);
+
+ void obstack_free (struct obstack *obstack, void *block);
+
+-void obstack_blank (struct obstack *obstack, int size);
++void obstack_blank (struct obstack *obstack, PTR_INT_TYPE size);
+
+-void obstack_grow (struct obstack *obstack, void *data, int size);
+-void obstack_grow0 (struct obstack *obstack, void *data, int size);
++void obstack_grow (struct obstack *obstack, void *data, PTR_INT_TYPE size);
++void obstack_grow0 (struct obstack *obstack, void *data, PTR_INT_TYPE size);
+
+ void obstack_1grow (struct obstack *obstack, int data_char);
+ void obstack_ptr_grow (struct obstack *obstack, void *data);
+@@ -220,20 +220,20 @@ void obstack_int_grow (struct obstack *o
+
+ void * obstack_finish (struct obstack *obstack);
+
+-int obstack_object_size (struct obstack *obstack);
++PTR_INT_TYPE obstack_object_size (struct obstack *obstack);
+
+-int obstack_room (struct obstack *obstack);
+-void obstack_make_room (struct obstack *obstack, int size);
++PTR_INT_TYPE obstack_room (struct obstack *obstack);
++void obstack_make_room (struct obstack *obstack, PTR_INT_TYPE size);
+ void obstack_1grow_fast (struct obstack *obstack, int data_char);
+ void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
+ void obstack_int_grow_fast (struct obstack *obstack, int data);
+-void obstack_blank_fast (struct obstack *obstack, int size);
++void obstack_blank_fast (struct obstack *obstack, PTR_INT_TYPE size);
+
+ void * obstack_base (struct obstack *obstack);
+ void * obstack_next_free (struct obstack *obstack);
+ int obstack_alignment_mask (struct obstack *obstack);
+-int obstack_chunk_size (struct obstack *obstack);
+-int obstack_memory_used (struct obstack *obstack);
++size_t obstack_chunk_size (struct obstack *obstack);
++size_t obstack_memory_used (struct obstack *obstack);
+
+ /* Error handler called when `obstack_chunk_alloc' failed to allocate
+ more memory. This can be set to a user defined function. The
+@@ -318,7 +318,7 @@ extern int obstack_exit_failure;
+ # define obstack_make_room(OBSTACK,length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+- int __len = (length); \
++ PTR_INT_TYPE __len = (length); \
+ if (__o->chunk_limit - __o->next_free < __len) \
+ _obstack_newchunk (__o, __len); \
+ (void) 0; })
+@@ -331,7 +331,7 @@ __extension__ \
+ # define obstack_grow(OBSTACK,where,length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+- int __len = (length); \
++ PTR_INT_TYPE __len = (length); \
+ if (__o->next_free + __len > __o->chunk_limit) \
+ _obstack_newchunk (__o, __len); \
+ _obstack_memcpy (__o->next_free, (where), __len); \
+@@ -341,7 +341,7 @@ __extension__ \
+ # define obstack_grow0(OBSTACK,where,length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+- int __len = (length); \
++ PTR_INT_TYPE __len = (length); \
+ if (__o->next_free + __len + 1 > __o->chunk_limit) \
+ _obstack_newchunk (__o, __len + 1); \
+ _obstack_memcpy (__o->next_free, (where), __len); \
+@@ -392,7 +392,7 @@ __extension__ \
+ # define obstack_blank(OBSTACK,length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+- int __len = (length); \
++ PTR_INT_TYPE __len = (length); \
+ 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
+@@ -44,9 +44,11 @@
+ #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
+ #include <gnu-versions.h>
+ #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
++#if 0 /* 64-bit obstack is not compatible with any glibc implementation. */
+ #define ELIDE_CODE
+ #endif
+ #endif
++#endif
+
+
+ #ifndef ELIDE_CODE
+@@ -139,7 +141,7 @@ struct obstack *_obstack;
+ free up some memory, then call this again. */
+
+ int
+-_obstack_begin (struct obstack *h, int size, int alignment,
++_obstack_begin (struct obstack *h, PTR_INT_TYPE size, int alignment,
+ POINTER (*chunkfun) (long), void (*freefun) (void *))
+ {
+ register struct _obstack_chunk *chunk; /* points to new chunk */
+@@ -183,7 +185,7 @@ _obstack_begin (struct obstack *h, int s
+ }
+
+ int
+-_obstack_begin_1 (struct obstack *h, int size, int alignment,
++_obstack_begin_1 (struct obstack *h, PTR_INT_TYPE size, int alignment,
+ POINTER (*chunkfun) (POINTER, long),
+ void (*freefun) (POINTER, POINTER), POINTER arg)
+ {
+@@ -235,7 +237,7 @@ _obstack_begin_1 (struct obstack *h, int
+ to the beginning of the new one. */
+
+ void
+-_obstack_newchunk (struct obstack *h, int length)
++_obstack_newchunk (struct obstack *h, PTR_INT_TYPE length)
+ {
+ register struct _obstack_chunk *old_chunk = h->chunk;
+ register struct _obstack_chunk *new_chunk;
+@@ -388,11 +390,11 @@ obstack_free (struct obstack *h, POINTER
+ abort ();
+ }
+
+-int
++PTR_INT_TYPE
+ _obstack_memory_used (struct obstack *h)
+ {
+ register struct _obstack_chunk* lp;
+- register int nbytes = 0;
++ register PTR_INT_TYPE nbytes = 0;
+
+ for (lp = h->chunk; lp != 0; lp = lp->prev)
+ {
+@@ -421,6 +423,7 @@ print_and_abort (void)
+ }
+
+ #if 0
++/* These functions are now broken for 64-bit obstack! */
+ /* These are now turned off because the applications do not use it
+ and it uses bcopy via obstack_grow, which causes trouble on sysV. */
+
diff --git a/gdb-6.3-gcore-thread-20050204.patch b/gdb-6.3-gcore-thread-20050204.patch
new file mode 100644
index 0000000..31ecbba
--- /dev/null
+++ b/gdb-6.3-gcore-thread-20050204.patch
@@ -0,0 +1,25 @@
+2005-02-07 Jeff Johnston <jjohnstn at redhat.com>
+
+ * linux-nat.c (linux_nat_xfer_memory): Don't use
+ linux_proc_xfer_memory for ia64.
+
+Index: gdb-6.8.50.20090803/gdb/linux-nat.c
+===================================================================
+--- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-04 06:29:47.000000000 +0200
++++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-04 06:29:55.000000000 +0200
+@@ -4495,10 +4495,15 @@ linux_xfer_partial (struct target_ops *o
+ offset &= ((ULONGEST) 1 << addr_bit) - 1;
+ }
+
++#ifndef NATIVE_XFER_UNWIND_TABLE
++ /* FIXME: For ia64, we cannot currently use linux_proc_xfer_memory
++ for accessing thread storage. Revert when Bugzilla 147436
++ is fixed. */
+ xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+ if (xfer != 0)
+ return xfer;
++#endif
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch
new file mode 100644
index 0000000..d6f4cb0
--- /dev/null
+++ b/gdb-6.3-gstack-20050411.patch
@@ -0,0 +1,232 @@
+2004-11-23 Andrew Cagney <cagney at redhat.com>
+
+ * Makefile.in (uninstall-gstack, install-gstack): New rules, add
+ to install and uninstall.
+ * gstack.sh, gstack.1: New files.
+
+Index: gdb-7.4.50.20120103/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
+ install: all
+ @$(MAKE) $(FLAGS_TO_PASS) install-only
+
+-install-only: $(CONFIG_INSTALL)
++install-only: install-gstack $(CONFIG_INSTALL)
+ 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)
+ install-python:
+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
+
+-uninstall: force $(CONFIG_UNINSTALL)
++GSTACK=gstack
++.PHONY: install-gstack
++install-gstack:
++ transformed_name=`t='$(program_transform_name)'; \
++ echo $(GSTACK) | sed -e "$$t"` ; \
++ if test "x$$transformed_name" = x; then \
++ transformed_name=$(GSTACK) ; \
++ else \
++ true ; \
++ fi ; \
++ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
++ $(INSTALL_PROGRAM) $(srcdir)/$(GSTACK).sh \
++ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
++ : $(SHELL) $(srcdir)/../mkinstalldirs \
++ $(DESTDIR)$(man1dir) ; \
++ : $(INSTALL_DATA) $(srcdir)/gstack.1 \
++ $(DESTDIR)$(man1dir)/$$transformed_name.1
++
++uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
+ 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
+ @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+
++.PHONY: uninstall-gstack
++uninstall-gstack:
++ transformed_name=`t='$(program_transform_name)'; \
++ echo $(GSTACK) | sed -e $$t` ; \
++ if test "x$$transformed_name" = x; then \
++ transformed_name=$(GSTACK) ; \
++ else \
++ true ; \
++ fi ; \
++ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
++ $(DESTDIR)$(man1dir)/$$transformed_name.1
++
+ # 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
+===================================================================
+--- /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
+@@ -0,0 +1,43 @@
++#!/bin/sh
++
++if test $# -ne 1; then
++ echo "Usage: `basename $0 .sh` <process-id>" 1>&2
++ exit 1
++fi
++
++if test ! -r /proc/$1; then
++ echo "Process $1 not found." 1>&2
++ exit 1
++fi
++
++# GDB doesn't allow "thread apply all bt" when the process isn't
++# threaded; need to peek at the process to determine if that or the
++# simpler "bt" should be used.
++
++backtrace="bt"
++if test -d /proc/$1/task ; then
++ # Newer kernel; has a task/ directory.
++ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
++ backtrace="thread apply all bt"
++ fi
++elif test -f /proc/$1/maps ; then
++ # Older kernel; go by it loading libpthread.
++ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
++ backtrace="thread apply all bt"
++ fi
++fi
++
++GDB=${GDB:-/usr/bin/gdb}
++
++# 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 |
++set width 0
++set height 0
++set pagination no
++$backtrace
++EOF
++/bin/sed -n \
++ -e 's/^\((gdb) \)*//' \
++ -e '/^#/p' \
++ -e '/^Thread/p'
+Index: gdb-7.4.50.20120103/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
+@@ -0,0 +1,66 @@
++# 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/>.
++
++set testfile gstack
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/$executable
++if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
++ return -1
++}
++
++set test "spawn inferior"
++set command "${binfile}"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $command failed."
++ fail $test
++ return
++}
++set use_gdb_stub 1
++set pid [exp_pid -i $res]
++gdb_expect {
++ -re "looping\r\n" {
++ pass $test
++ }
++ eof {
++ fail "$test (eof)"
++ return
++ }
++ timeout {
++ fail "$test (timeout)"
++ return
++ }
++}
++gdb_exit
++
++# Testcase uses the most simple notification not to get caught by attach on
++# exiting the function. Still we could retry the gstack command if we fail.
++
++set test "spawn gstack"
++set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $command failed."
++ fail $test
++}
++set pid [exp_pid -i $res]
++gdb_test_multiple "" $test {
++ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
++ pass $test
++ }
++}
++gdb_exit
++
++remote_exec host "kill -9 $pid"
+Index: gdb-7.4.50.20120103/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
+@@ -0,0 +1,43 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++#include <stdio.h>
++#include <unistd.h>
++#include <string.h>
++
++void
++func (void)
++{
++ const char msg[] = "looping\n";
++
++ /* Use the most simple notification not to get caught by attach on exiting
++ the function. */
++ write (1, msg, strlen (msg));
++
++ for (;;);
++}
++
++int
++main (void)
++{
++ alarm (60);
++ nice (100);
++
++ func ();
++
++ return 0;
++}
diff --git a/gdb-6.3-ia64-gcore-page0-20050421.patch b/gdb-6.3-ia64-gcore-page0-20050421.patch
new file mode 100644
index 0000000..ecdfbae
--- /dev/null
+++ b/gdb-6.3-ia64-gcore-page0-20050421.patch
@@ -0,0 +1,20 @@
+Index: gdb-7.2.50.20110107/gdb/gcore.c
+===================================================================
+--- gdb-7.2.50.20110107.orig/gdb/gcore.c 2011-01-05 23:22:49.000000000 +0100
++++ gdb-7.2.50.20110107/gdb/gcore.c 2011-01-07 09:04:28.000000000 +0100
+@@ -534,8 +534,14 @@ gcore_copy_callback (bfd *obfd, asection
+ if (size > total_size)
+ size = total_size;
+
++ /* Warn if read error occurs except if we were trying to read the
++ first page for ia64. The first page is marked readable, but it cannot
++ be read. */
+ if (target_read_memory (bfd_section_vma (obfd, osec) + offset,
+- memhunk, size) != 0)
++ memhunk, size) != 0
++ && (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name,
++ "ia64")
++ || bfd_section_vma (obfd, osec) != 0))
+ {
+ warning (_("Memory read failed for corefile "
+ "section, %s bytes at %s."),
diff --git a/gdb-6.3-ia64-gcore-speedup-20050714.patch b/gdb-6.3-ia64-gcore-speedup-20050714.patch
new file mode 100644
index 0000000..f902e62
--- /dev/null
+++ b/gdb-6.3-ia64-gcore-speedup-20050714.patch
@@ -0,0 +1,126 @@
+2005-07-14 Jeff Johnsotn <jjohnstn at redhat.com>
+
+ * linux-nat.c (linux_nat_xfer_memory): Incorporate Fujitsu
+ work-around to use /proc/mem for storage, but to fall-back
+ to PTRACE for ia64 rse register areas.
+ * ia64-linux-nat.c (ia64_rse_slot_num): New static function.
+ (ia64_rse_skip_regs): Ditto.
+ (ia64_linux_check_stack_region): New function.
+
+Index: gdb-6.8.50.20090803/gdb/linux-nat.c
+===================================================================
+--- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-04 06:29:55.000000000 +0200
++++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-04 06:30:53.000000000 +0200
+@@ -4495,15 +4495,38 @@ linux_xfer_partial (struct target_ops *o
+ offset &= ((ULONGEST) 1 << addr_bit) - 1;
+ }
+
+-#ifndef NATIVE_XFER_UNWIND_TABLE
+- /* FIXME: For ia64, we cannot currently use linux_proc_xfer_memory
+- for accessing thread storage. Revert when Bugzilla 147436
+- is fixed. */
+ xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+ if (xfer != 0)
+- return xfer;
++ {
++#ifdef NATIVE_XFER_UNWIND_TABLE
++ struct mem_region range;
++ range.lo = memaddr;
++ range.hi = memaddr + len;
++
++ /* FIXME: For ia64, we cannot currently use
++ linux_proc_xfer_partial for accessing rse register storage.
++ Revert when Bugzilla 147436 is fixed. */
++#ifdef NATIVE_XFER_UNWIND_TABLE
++ extern int ia64_linux_check_stack_region (struct lwp_info *lwp,
++ void *range);
++#endif
++ if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
++ { /* This region contains ia64 rse registers, we have to re-read. */
++ int xxfer;
++
++ /* Re-read register stack area. */
++ xxfer = super_xfer_partial (ops, object, annex,
++ readbuf + (range.lo - memaddr),
++ writebuf + (range.lo - memaddr),
++ offset + (range.lo - memaddr),
++ range.hi - range.lo);
++ if (xxfer == 0)
++ xfer = 0;
++ }
+ #endif
++ return xfer;
++ }
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+Index: gdb-6.8.50.20090803/gdb/ia64-linux-nat.c
+===================================================================
+--- gdb-6.8.50.20090803.orig/gdb/ia64-linux-nat.c 2009-02-23 01:03:49.000000000 +0100
++++ gdb-6.8.50.20090803/gdb/ia64-linux-nat.c 2009-08-04 06:30:53.000000000 +0200
+@@ -809,6 +809,64 @@ ia64_linux_xfer_partial (struct target_o
+
+ void _initialize_ia64_linux_nat (void);
+
++/*
++ * Note: taken from ia64_tdep.c
++ *
++ */
++
++static __inline__ unsigned long
++ia64_rse_slot_num (unsigned long addr)
++{
++ return (addr >> 3) & 0x3f;
++}
++
++/* Skip over a designated number of registers in the backing
++ store, remembering every 64th position is for NAT. */
++static __inline__ unsigned long
++ia64_rse_skip_regs (unsigned long addr, long num_regs)
++{
++ long delta = ia64_rse_slot_num(addr) + num_regs;
++
++ if (num_regs < 0)
++ delta -= 0x3e;
++ return addr + ((num_regs + delta/0x3f) << 3);
++}
++
++/*
++ * Check mem_region is stack or not. If stack, /proc/<pid>/mem cannot return
++ * expected value.
++ */
++int ia64_linux_check_stack_region(struct lwp_info *ti, struct mem_region *range)
++{
++ CORE_ADDR addr;
++ int error;
++ unsigned long bsp, cfm, bspstore;
++ long sof;
++ pid_t pid = ptid_get_lwp(ti->ptid);
++ bsp = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSP ,NULL);
++ if (bsp == (unsigned long)-1) {
++ return 1;
++ }
++ /* stack is allocated by one-segment, not separated into several segments.
++ So, we only have to check whether bsp is in *range* or not. */
++ if((range->lo <= bsp) && (bsp <= range->hi)) {
++ bspstore = ptrace(PTRACE_PEEKUSER, pid, PT_AR_BSPSTORE, NULL);
++ cfm = ptrace(PTRACE_PEEKUSER, pid, PT_CFM, NULL);
++ sof = cfm & 0x3f;
++ bsp = ia64_rse_skip_regs(bsp, -sof);
++ range->lo = bspstore;
++ range->hi = bsp;
++ /* we have to check the size of dirty register stack area */
++ /*
++ fprintf_unfiltered(gdb_stdlog, "<%d> <%p> <%lx> <%p> <%p>\n",
++ pid, bsp, sof, range->lo, range->hi);
++ */
++ return 1;
++ }
++
++ return 0;
++}
++
+ void
+ _initialize_ia64_linux_nat (void)
+ {
diff --git a/gdb-6.3-ia64-info-frame-fix-20050725.patch b/gdb-6.3-ia64-info-frame-fix-20050725.patch
new file mode 100644
index 0000000..2ebab9e
--- /dev/null
+++ b/gdb-6.3-ia64-info-frame-fix-20050725.patch
@@ -0,0 +1,107 @@
+2005-07-25 Jeff Johnstno <jjohnstn at redhat.com>
+
+ * libunwind-frame.c (libunwind_frame_prev_register): Check valuep
+ is not NULL before copying cursor address into it.
+
+testsuite:
+2005-07-25 Jeff Johnstno <jjohnstn at redhat.com>
+
+ * gdb.arch/ia64-sigtramp.exp: New test.
+ * gdb.arch/ia64-sigtramp.c: Ditto.
+
+2008-02-24 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Port to GDB-6.8pre. (Only the testcase has remained.)
+
+--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c.fix 2005-07-25 16:42:46.000000000 -0400
++++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c 2005-07-25 16:42:08.000000000 -0400
+@@ -0,0 +1,23 @@
++#include <stdio.h>
++#include <signal.h>
++
++int *l;
++
++void x (int sig)
++{
++ printf ("in signal handler for signal %d\n", sig);
++}
++
++int main()
++{
++ int k;
++
++ signal (SIGSEGV, &x);
++
++ k = *l;
++
++ printf ("k is %d\n", k);
++
++ return 0;
++}
++
+--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix 2005-07-25 16:42:50.000000000 -0400
++++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp 2005-07-25 16:42:01.000000000 -0400
+@@ -0,0 +1,63 @@
++# Copyright 2005 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Please email any bugs, comments, and/or additions to this file to:
++# bug-gdb at prep.ai.mit.edu
++
++# This file was written by Jeff Johnston (jjohnstn at redhat.com)
++
++if ![istarget "ia64-*-*"] then {
++ return
++}
++
++set testfile "ia64-sigtramp"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if [get_compiler_info ${binfile}] {
++ return -1
++}
++
++gdb_exit
++set match_max_old [match_max]
++match_max -d 1000000
++gdb_start
++match_max -d $match_max_old
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++if ![runto_main] then {
++ fail "Can't run to main"
++ return 0
++}
++
++gdb_test "handle SIGSEGV" "SIGSEGV.*Yes.*Yes.*Yes.*Segmentation fault"
++gdb_test "next" "" "first next"
++gdb_test "next" "Program received signal SIGSEGV.*" "getting SIGSEGV"
++gdb_breakpoint "x"
++gdb_test "continue" "Breakpoint.*x.*" "continue to x"
++
++gdb_test "f 1" ".*signal handler called.*" "frame 1"
++
++# gdb-7.0+ no longer prints the pseudo registers as they are computed.
++# frame_info says: /* For moment, only display registers that were saved on the
++# stack. */
++gdb_test "set debug frame 1"
++gdb_test "info frame" "Stack level 1, .*frame_unwind_register_value \\(frame=1,regnum=750\\(p63\\),\[^\r\n\]*\r\n\[^\r\n\]*-> computed bytes=.*" "info sigtramp frame"
diff --git a/gdb-6.3-ia64-sigill-20051115.patch b/gdb-6.3-ia64-sigill-20051115.patch
new file mode 100644
index 0000000..bf8a1f1
--- /dev/null
+++ b/gdb-6.3-ia64-sigill-20051115.patch
@@ -0,0 +1,95 @@
+2005-11-15 Jeff Johnston <jjohnstn at redhat.com>
+
+ * linux-thread-db.c (thread_db_wait): Don't bother continuing if
+ the wait result indicates the program terminated with a signal.
+ * linux-nat.c (linux_nat_wait): For SIGILL and SIGTRAP, don't
+ throw away the event if the user has specified nostop noprint.
+
+gdb/testsuite:
+
+2005-11-15 Jeff Johnston <jjohnstn at redhat.com>
+
+ * gdb.arch/ia64-sigill.c: New test.
+ * gdb.arch/ia64-sigill.exp: Ditto.
+
+Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.exp 2011-07-22 19:16:13.000000000 +0200
+@@ -0,0 +1,49 @@
++# Copyright 2005 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Please email any bugs, comments, and/or additions to this file to:
++# bug-gdb at prep.ai.mit.edu
++
++# This file was written by Jeff Johnston (jjohnstn at redhat.com)
++
++if ![istarget "ia64-*-*"] then {
++ return
++}
++
++set testfile "ia64-sigill"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++# Deliberately compile with pthreads, even though test is single-threaded.
++# We want to force gdb thread code to be exercised.
++if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
++}
++
++if [get_compiler_info ${binfile}] {
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# We set up SIGILL nostop, noprint, pass and then run the program.
++# We expect to just see a normal run.
++gdb_test "handle SIGILL nostop noprint" "SIGILL.*No.*No.*Yes.*" "handle sigill"
++gdb_test "run" "Starting program.*ia64-sigill.*\[New thread.*\].*hello world.*Program exited normally." "run to exit"
++
+Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.c 2011-07-22 19:16:13.000000000 +0200
+@@ -0,0 +1,8 @@
++#include <stdio.h>
++
++int main()
++{
++ printf ("hello world\n");
++ return 0;
++}
++
+Index: gdb-7.3.50.20110722/gdb/linux-nat.c
+===================================================================
+--- gdb-7.3.50.20110722.orig/gdb/linux-nat.c 2011-07-22 19:15:05.000000000 +0200
++++ gdb-7.3.50.20110722/gdb/linux-nat.c 2011-07-22 19:16:13.000000000 +0200
+@@ -3733,7 +3733,8 @@ retry:
+ threads can be a bit time-consuming so if we want decent
+ performance with heavily multi-threaded programs, especially when
+ they're using a high frequency timer, we'd better avoid it if we
+- can. */
++ can. For possible trap signals like SIGTRAP and SIGILL, don't
++ avoid reporting. */
+
+ if (WIFSTOPPED (status))
+ {
diff --git a/gdb-6.3-ia64-sigtramp-frame-20050708.patch b/gdb-6.3-ia64-sigtramp-frame-20050708.patch
new file mode 100644
index 0000000..c6a7789
--- /dev/null
+++ b/gdb-6.3-ia64-sigtramp-frame-20050708.patch
@@ -0,0 +1,158 @@
+2005-07-08 Jeff Johnston <jjohnstn at redhat.com>
+
+ * ia64-tdep.c (ia64_sigtramp_frame_prev_register): Build
+ pseudo-registers the same as ia64_pseudo_register_read.
+
+2008-04-16 Yi Zhan <yi.zhan at intel.com>
+
+ * ia64-tdep.c (ia64_sigtramp_frame_prev_register): Fix an
+ ISO C compliance compilation error.
+
+2008-02-12 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Port to gdb-6.8.50.20081128, follow the upstream change:
+ http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ia64-tdep.c.diff?cvsroot=src&r1=1.176&r2=1.177
+
+Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
+===================================================================
+--- gdb-6.8.50.20081128.orig/gdb/ia64-tdep.c 2008-11-26 06:27:48.000000000 +0100
++++ gdb-6.8.50.20081128/gdb/ia64-tdep.c 2008-12-02 19:04:32.000000000 +0100
+@@ -2107,6 +2107,94 @@ ia64_sigtramp_frame_prev_register (struc
+ return frame_unwind_got_constant (this_frame, regnum, pc);
+ }
+
++ /* Red Hat patch begin. */
++ else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
++ {
++ /* NAT pseudo registers 0-31: get them from UNAT.
++ * "copied" from ia64_pseudo_register_read() */
++ ULONGEST unatN_val;
++ ULONGEST unat;
++ read_memory (cache->saved_regs[IA64_UNAT_REGNUM], (char *) &unat,
++ register_size (target_gdbarch, IA64_UNAT_REGNUM));
++ unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
++ return frame_unwind_got_constant (this_frame, regnum, unatN_val);
++ }
++ else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
++ {
++ /* NAT pseudo registers 32-127.
++ * "copied" from ia64_pseudo_register_read()
++ * FIXME: Not currently tested -- cannot get the frame to include
++ * NAT32-NAT127. */
++ ULONGEST bsp;
++ ULONGEST cfm;
++ ULONGEST natN_val = 0;
++ CORE_ADDR gr_addr = 0, nat_addr = 0;
++
++ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
++ register_size (target_gdbarch, IA64_BSP_REGNUM));
++ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
++ register_size (target_gdbarch, IA64_CFM_REGNUM));
++
++ /* The bsp points at the end of the register frame so we
++ subtract the size of frame from it to get start of register frame. */
++ bsp = rse_address_add (bsp, -(cfm & 0x7f));
++
++ if ((cfm & 0x7f) > regnum - V32_REGNUM)
++ gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
++
++ if (gr_addr != 0)
++ {
++ /* Compute address of nat collection bits */
++ CORE_ADDR nat_collection;
++ int nat_bit;
++ nat_addr = gr_addr | 0x1f8;
++ /* If our nat collection address is bigger than bsp, we have to get
++ the nat collection from rnat. Otherwise, we fetch the nat
++ collection from the computed address. FIXME: Do not know if
++ RNAT can be not stored in the frame--being extra cautious. */
++ if (nat_addr >= bsp)
++ {
++ nat_addr = cache->saved_regs[IA64_RNAT_REGNUM];
++ if (nat_addr != 0)
++ read_memory (nat_addr, (char *) &nat_collection,
++ register_size (target_gdbarch, IA64_RNAT_REGNUM));
++ }
++ else
++ nat_collection = read_memory_integer (nat_addr, 8, BFD_ENDIAN_LITTLE);
++ if (nat_addr != 0)
++ {
++ nat_bit = (gr_addr >> 3) & 0x3f;
++ natN_val = (nat_collection >> nat_bit) & 1;
++ return frame_unwind_got_constant (this_frame, regnum, natN_val);
++ }
++ }
++ warning (_("ia64_sigtramp_frame_prev_register: unhandled register %d"),
++ regnum);
++ }
++ else if (regnum == VBOF_REGNUM)
++ {
++ /* BOF pseudo register.
++ * "copied" from ia64_pseudo_register_read()
++ *
++ * A virtual register frame start is provided for user convenience.
++ * It can be calculated as the bsp - sof (sizeof frame). */
++ ULONGEST bsp;
++ ULONGEST cfm;
++ ULONGEST bof;
++
++ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
++ register_size (target_gdbarch, IA64_BSP_REGNUM));
++ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
++ register_size (target_gdbarch, IA64_CFM_REGNUM));
++
++ /* The bsp points at the end of the register frame so we
++ subtract the size of frame from it to get beginning of frame. */
++ bof = rse_address_add (bsp, -(cfm & 0x7f));
++
++ return frame_unwind_got_constant (this_frame, regnum, bof);
++ }
++ /* Red Hat patch end. */
++
+ else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM)
+ || (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
+ {
+@@ -2121,7 +2209,42 @@ ia64_sigtramp_frame_prev_register (struc
+ return frame_unwind_got_constant (this_frame, regnum, 0);
+ }
+
+- else /* All other registers not listed above. */
++ /* Red Hat patch begin. */
++ else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
++ {
++ /* VP 0-63.
++ * "copied" from ia64_pseudo_register_read()
++ *
++ * FIXME: Not currently tested--cannot get the frame to include PR. */
++ CORE_ADDR pr_addr = 0;
++
++ pr_addr = cache->saved_regs[IA64_PR_REGNUM];
++ if (pr_addr != 0)
++ {
++ ULONGEST pr;
++ ULONGEST cfm;
++ ULONGEST prN_val;
++ read_memory (pr_addr, (char *) &pr,
++ register_size (target_gdbarch, IA64_PR_REGNUM));
++ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
++ register_size (target_gdbarch, IA64_CFM_REGNUM));
++
++ /* Get the register rename base for this frame and adjust the
++ * register name to take rotation into account. */
++ if (VP16_REGNUM <= regnum && regnum <= VP63_REGNUM)
++ {
++ int rrb_pr = (cfm >> 32) & 0x3f;
++ regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
++ }
++ prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
++ return frame_unwind_got_constant (this_frame, regnum, prN_val);
++ }
++ warning (_("ia64_sigtramp_frame_prev_register: unhandled register %d"),
++ regnum);
++ }
++ /* Red Hat patch end. */
++
++ /* All other registers not listed above. */
+ {
+ CORE_ADDR addr = cache->saved_regs[regnum];
+
diff --git a/gdb-6.3-ppc64displaysymbol-20041124.patch b/gdb-6.3-ppc64displaysymbol-20041124.patch
new file mode 100644
index 0000000..8e94e00
--- /dev/null
+++ b/gdb-6.3-ppc64displaysymbol-20041124.patch
@@ -0,0 +1,24 @@
+2004-11-24 Andrew Cagney <cagney at gnu.org>
+
+ * printcmd.c (build_address_symbolic): Find a section for the
+ address.
+
+Index: gdb-6.8.50.20081128/gdb/printcmd.c
+===================================================================
+--- gdb-6.8.50.20081128.orig/gdb/printcmd.c 2008-12-04 01:36:05.000000000 +0100
++++ gdb-6.8.50.20081128/gdb/printcmd.c 2008-12-04 01:37:18.000000000 +0100
+@@ -616,6 +616,14 @@ build_address_symbolic (CORE_ADDR addr,
+ addr = overlay_mapped_address (addr, section);
+ }
+ }
++ /* To ensure that the symbol returned belongs to the correct setion
++ (and that the last [random] symbol from the previous section
++ isn't returned) try to find the section containing PC. First try
++ the overlay code (which by default returns NULL); and second try
++ the normal section code (which almost always succeeds). */
++ section = find_pc_overlay (addr);
++ if (section == NULL)
++ section = find_pc_section (addr);
+
+ /* First try to find the address in the symbol table, then
+ in the minsyms. Take the closest one. */
diff --git a/gdb-6.3-ppc64syscall-20040622.patch b/gdb-6.3-ppc64syscall-20040622.patch
new file mode 100644
index 0000000..a237cc1
--- /dev/null
+++ b/gdb-6.3-ppc64syscall-20040622.patch
@@ -0,0 +1,111 @@
+2004-06-22 Andrew Cagney <cagney at gnu.org>
+
+ * rs6000-tdep.c (struct rs6000_framedata): Add field "func_start".
+ (skip_prologue): Delete local variable "orig_pc", use
+ "func_start". Add local variable "num_skip_linux_syscall_insn",
+ use to skip over first half of a GNU/Linux syscall and update
+ "func_start".
+
+Index: gdb-7.2.50.20110117/gdb/rs6000-tdep.c
+===================================================================
+--- gdb-7.2.50.20110117.orig/gdb/rs6000-tdep.c 2011-01-11 20:23:02.000000000 +0100
++++ gdb-7.2.50.20110117/gdb/rs6000-tdep.c 2011-01-17 15:48:19.000000000 +0100
+@@ -126,6 +126,7 @@ static const char *powerpc_vector_abi_st
+
+ struct rs6000_framedata
+ {
++ CORE_ADDR func_start; /* True function start. */
+ int offset; /* total size of frame --- the distance
+ by which we decrement sp to allocate
+ the frame */
+@@ -1496,7 +1497,6 @@ static CORE_ADDR
+ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
+ struct rs6000_framedata *fdata)
+ {
+- CORE_ADDR orig_pc = pc;
+ CORE_ADDR last_prologue_pc = pc;
+ CORE_ADDR li_found_pc = 0;
+ gdb_byte buf[4];
+@@ -1514,12 +1514,14 @@ skip_prologue (struct gdbarch *gdbarch,
+ int minimal_toc_loaded = 0;
+ int prev_insn_was_prologue_insn = 1;
+ int num_skip_non_prologue_insns = 0;
++ int num_skip_ppc64_gnu_linux_syscall_insn = 0;
+ int r0_contains_arg = 0;
+ const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+
+ memset (fdata, 0, sizeof (struct rs6000_framedata));
++ fdata->func_start = pc;
+ fdata->saved_gpr = -1;
+ fdata->saved_fpr = -1;
+ fdata->saved_vr = -1;
+@@ -1553,6 +1555,55 @@ skip_prologue (struct gdbarch *gdbarch,
+ break;
+ op = extract_unsigned_integer (buf, 4, byte_order);
+
++ /* A PPC64 GNU/Linux system call function is split into two
++ sub-functions: a non-threaded fast-path (__NAME_nocancel)
++ which does not use a frame; and a threaded slow-path
++ (Lpseudo_cancel) that does create a frame. Ref:
++ nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
++
++ *INDENT-OFF*
++ NAME:
++ SINGLE_THREAD_P
++ bne- .Lpseudo_cancel
++ __NAME_nocancel:
++ li r0,162
++ sc
++ bnslr+
++ b 0x7fe014ef64 <.__syscall_error>
++ Lpseudo_cancel:
++ stdu r1,-128(r1)
++ ...
++ *INDENT-ON*
++
++ Unfortunatly, because the latter case uses a local label (not
++ in the symbol table) a PC in "Lpseudo_cancel" appears to be
++ in "__NAME_nocancel". The following code recognizes this,
++ adjusting FUNC_START to point to where "Lpseudo_cancel"
++ should be, and parsing the prologue sequence as if
++ "Lpseudo_cancel" was the entry point. */
++
++ if (((op & 0xffff0000) == 0x38000000 /* li r0,N */
++ && pc == fdata->func_start + 0
++ && num_skip_ppc64_gnu_linux_syscall_insn == 0)
++ || (op == 0x44000002 /* sc */
++ && pc == fdata->func_start + 4
++ && num_skip_ppc64_gnu_linux_syscall_insn == 1)
++ || (op == 0x4ca30020 /* bnslr+ */
++ && pc == fdata->func_start + 8
++ && num_skip_ppc64_gnu_linux_syscall_insn == 2))
++ {
++ num_skip_ppc64_gnu_linux_syscall_insn++;
++ continue;
++ }
++ else if ((op & 0xfc000003) == 0x48000000 /* b __syscall_error */
++ && pc == fdata->func_start + 12
++ && num_skip_ppc64_gnu_linux_syscall_insn == 3)
++ {
++ num_skip_ppc64_gnu_linux_syscall_insn = -1;
++ fdata->func_start = pc;
++ continue;
++ }
++
+ if ((op & 0xfc1fffff) == 0x7c0802a6)
+ { /* mflr Rx */
+ /* Since shared library / PIC code, which needs to get its
+@@ -1734,9 +1785,9 @@ skip_prologue (struct gdbarch *gdbarch,
+ we have no line table information or the line info tells
+ us that the subroutine call is not part of the line
+ associated with the prologue. */
+- if ((pc - orig_pc) > 8)
++ if ((pc - fdata->func_start) > 8)
+ {
+- struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
++ struct symtab_and_line prologue_sal = find_pc_line (fdata->func_start, 0);
+ struct symtab_and_line this_sal = find_pc_line (pc, 0);
+
+ if ((prologue_sal.line == 0)
diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
new file mode 100644
index 0000000..fa2f4ed
--- /dev/null
+++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
@@ -0,0 +1,143 @@
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
+
+2008-02-24 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Port to GDB-6.8pre.
+
+currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
+will get:
+ (gdb) p errno
+ [some error]
+
+* with -ggdb2 and less "errno" in fact does not exist anywhere as it was
+ compiled to "(*__errno_location ())" and the macro definition is not present.
+ Unfortunately gdb will find the TLS symbol and it will try to access it but
+ as the program has been compiled without -lpthread the TLS base register
+ (%gs on i386) is not setup and it will result in:
+ Cannot access memory at address 0x8
+
+Attached suggestion patch how to deal with the most common "errno" symbol
+for the most common under-ggdb3 compiled programs.
+
+Original patch hooked into target_translate_tls_address. But its inferior
+call invalidates `struct frame *' in the callers - RH BZ 690908.
+
+
+2007-11-03 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer
+ DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C.
+
+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)
+
+ 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
+===================================================================
+--- /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
+@@ -0,0 +1,28 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb at prep.ai.mit.edu */
++
++#include <errno.h>
++
++int main()
++{
++ errno = 42;
++
++ return 0; /* breakpoint */
++}
+Index: gdb-7.2/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
+@@ -0,0 +1,60 @@
++# Copyright 2007 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 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 dw2-errno
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++proc prep {} {
++ global srcdir subdir binfile
++ gdb_exit
++ gdb_start
++ gdb_reinitialize_dir $srcdir/$subdir
++ gdb_load ${binfile}
++
++ runto_main
++
++ gdb_breakpoint [gdb_get_line_number "breakpoint"]
++ gdb_continue_to_breakpoint "breakpoint"
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=N threads=N"
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=Y threads=N"
++
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=N threads=Y"
++
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
++ return -1
++}
++prep
++gdb_test "print errno" ".* = 42" "errno with macros=Y threads=Y"
++
++# TODO: Test the error on resolving ERRNO with only libc loaded.
++# Just how to find the current libc filename?
diff --git a/gdb-6.5-bz203661-emit-relocs.patch b/gdb-6.5-bz203661-emit-relocs.patch
new file mode 100644
index 0000000..61e0d56
--- /dev/null
+++ b/gdb-6.5-bz203661-emit-relocs.patch
@@ -0,0 +1,17 @@
+Index: gdb-7.0.90.20100306/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;
+
++ /* Executable files have all the relocations already resolved.
++ * Handle files linked with --emit-relocs.
++ * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
++ if ((abfd->flags & EXEC_P) != 0)
++ return NULL;
++
+ /* We're only interested in sections with relocation
+ information. */
+ if ((sectp->flags & SEC_RELOC) == 0)
diff --git a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
new file mode 100644
index 0000000..082b9a0
--- /dev/null
+++ b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
@@ -0,0 +1,21 @@
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
+
+
+Index: gdb-7.2.50.20110117/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
+ SYMBOL_LINKAGE_NAME (msymbol)); */
+ ;
+ /* fall through */
++ /* `msymbol' trampoline may be located before its .text symbol
++ 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));
++ /* fall through */
+ else
+ return find_pc_line (SYMBOL_VALUE_ADDRESS (mfunsym), 0);
+ }
diff --git a/gdb-6.6-bfd-vdso8k.patch b/gdb-6.6-bfd-vdso8k.patch
new file mode 100644
index 0000000..06507b0
--- /dev/null
+++ b/gdb-6.6-bfd-vdso8k.patch
@@ -0,0 +1,119 @@
+2007-09-23 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New variables
+ X_SHDR_SHSTRTAB and I_SHDR_SHSTRTAB. Fixed the CONTENTS_SIZE trimming
+ check for its aligned size between the last segment and still before
+ the section header end. Added variables check to cover also the
+ section header string table.
+
+--- gdb-7.4.50.20120120-orig/bfd/elfcode.h 2012-02-29 09:17:08.000000000 +0100
++++ gdb-7.4.50.20120120/bfd/elfcode.h 2012-02-29 10:23:03.000000000 +0100
+@@ -1621,6 +1621,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
+ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
+ Elf_External_Phdr *x_phdrs;
+ Elf_Internal_Phdr *i_phdrs, *last_phdr;
++ Elf_External_Shdr *x_shdrs;
++ Elf_Internal_Shdr *i_shdrs;
+ bfd *nbfd;
+ struct bfd_in_memory *bim;
+ int contents_size;
+@@ -1740,24 +1742,46 @@ NAME(_bfd_elf,bfd_from_remote_memory)
+
+ /* Trim the last segment so we don't bother with zeros in the last page
+ that are off the end of the file. However, if the extra bit in that
+- page includes the section headers, keep them. */
+- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
+- && (bfd_vma) contents_size >= (i_ehdr.e_shoff
+- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
++ page includes the section headers os the section header string table,
++ keep them. */
++ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz)
++ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
++
++ if ((bfd_vma) contents_size < i_ehdr.e_shoff
++ + i_ehdr.e_shnum * i_ehdr.e_shentsize)
++ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
++
++ /* Verify also all the sections fit into CONTENTS_SIZE. */
++
++ x_shdrs = bfd_malloc (i_ehdr.e_shnum * (sizeof *x_shdrs + sizeof *i_shdrs));
++ if (x_shdrs == NULL)
+ {
+- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
+- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
++ free (x_phdrs);
++ bfd_set_error (bfd_error_no_memory);
++ return NULL;
+ }
++ err = target_read_memory (ehdr_vma + i_ehdr.e_shoff, (bfd_byte *) x_shdrs,
++ i_ehdr.e_shnum * sizeof *x_shdrs);
++ if (err)
++ i_shdrs = NULL;
+ else
+- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
++ {
++ i_shdrs = (Elf_Internal_Shdr *) &x_shdrs[i_ehdr.e_shnum];
++ for (i = 0; i < i_ehdr.e_shnum; ++i)
++ {
++ elf_swap_shdr_in (templ, &x_shdrs[i], &i_shdrs[i]);
++
++ if ((bfd_vma) contents_size < i_shdrs[i].sh_offset + i_shdrs[i].sh_size)
++ contents_size = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
++ }
++ }
+
+ /* Now we know the size of the whole image we want read in. */
+ contents = (bfd_byte *) bfd_zmalloc (contents_size);
+ if (contents == NULL)
+ {
+ free (x_phdrs);
++ free (x_shdrs);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+@@ -1776,6 +1800,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
+ if (err)
+ {
+ free (x_phdrs);
++ free (x_shdrs);
+ free (contents);
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+@@ -1784,10 +1809,32 @@ NAME(_bfd_elf,bfd_from_remote_memory)
+ }
+ free (x_phdrs);
+
+- /* If the segments visible in memory didn't include the section headers,
++ if (i_shdrs)
++ {
++ memcpy (contents + i_ehdr.e_shoff, x_shdrs,
++ i_ehdr.e_shnum * sizeof *x_shdrs);
++
++ for (i = 0; i < i_ehdr.e_shnum; ++i)
++ {
++ bfd_vma start = i_shdrs[i].sh_offset;
++ bfd_vma end = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
++
++ if (end > (bfd_vma) contents_size)
++ end = contents_size;
++ err = target_read_memory (ehdr_vma + start, contents + start,
++ end - start);
++ if (err)
++ {
++ i_shdrs = NULL;
++ break;
++ }
++ }
++ }
++ free (x_shdrs);
++
++ /* If the segments readable in memory didn't include the section headers,
+ then clear them from the file header. */
+- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
+- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
++ if (i_shdrs == NULL)
+ {
+ memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff);
+ memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum);
diff --git a/gdb-6.6-bz235197-fork-detach-info.patch b/gdb-6.6-bz235197-fork-detach-info.patch
new file mode 100644
index 0000000..d7263ff
--- /dev/null
+++ b/gdb-6.6-bz235197-fork-detach-info.patch
@@ -0,0 +1,121 @@
+2008-03-01 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ 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
+===================================================================
+--- 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));
+ }
+
+- if (info_verbose || debug_linux_nat)
++ if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat)
+ {
+ target_terminal_ours ();
+ fprintf_filtered (gdb_stdlog,
+Index: gdb-7.2.50.20110320/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
+@@ -0,0 +1,57 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2007 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb at prep.ai.mit.edu */
++
++#include <sys/types.h>
++#include <sys/wait.h>
++#include <unistd.h>
++#include <assert.h>
++#include <stdlib.h>
++
++static void func (void)
++{
++}
++
++int main (void)
++{
++ pid_t child;
++
++ child = fork ();
++ switch (child)
++ {
++ case -1:
++ abort ();
++ case 0:
++ func ();
++ break;
++ default:
++ {
++/* We do not test the switching to the other fork by GDB `fork 1'. */
++#if 0
++ pid_t got;
++
++ got = waitpid (child, NULL, 0);
++ assert (got == child);
++#endif
++ break;
++ }
++ }
++ return 0;
++}
+Index: gdb-7.2.50.20110320/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
+@@ -0,0 +1,36 @@
++# Copyright 2007 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++set testfile fork-detach
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++gdb_run_cmd
++# `Starting program: .*' prefix is available since gdb-6.7.
++gdb_test "" \
++ "Detaching after fork from child process.*\\\[Inferior .* exited normally\\\]" \
++ "Info message caught"
diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch
new file mode 100644
index 0000000..50af796
--- /dev/null
+++ b/gdb-6.6-scheduler_locking-step-is-default.patch
@@ -0,0 +1,54 @@
+Index: gdb-7.3.50.20110722/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[] = {
+ schedlock_step,
+ NULL
+ };
+-static const char *scheduler_mode = schedlock_off;
++static const char *scheduler_mode = schedlock_step;
+ 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
+===================================================================
+--- 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}/
+
+ 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\")?" \
+Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-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}/
+
+ 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} {
diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
new file mode 100644
index 0000000..c7f0d33
--- /dev/null
+++ b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
@@ -0,0 +1,204 @@
+2007-06-25 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * inferior.h (enum resume_step): New definition.
+ (resume): Change STEP parameter type to ENUM RESUME_STEP.
+ * infrun.c (resume): Likewise. Extend debug printing of the STEP
+ parameter. Lock the scheduler only for intentional stepping.
+ (proceed): Replace the variable ONESTEP with tristate RESUME_STEP.
+ Set the third RESUME_STEP state according to BPSTAT_SHOULD_STEP.
+ (currently_stepping): Change the return type to ENUM RESUME_STEP.
+ Return RESUME_STEP_NEEDED if it is just due to BPSTAT_SHOULD_STEP.
+ * linux-nat.c (select_singlestep_lwp_callback): Do not focus on
+ the software watchpoint events.
+ * linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.
+
+2007-10-19 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * infrun.c (proceed): RESUME_STEP initialized for non-stepping.
+ RESUME_STEP set according to STEP only at the end of the function.
+
+2008-02-24 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Port to GDB-6.8pre.
+
+Index: gdb-7.4.50.20111218/gdb/inferior.h
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/inferior.h 2011-10-07 14:06:46.000000000 +0200
++++ gdb-7.4.50.20111218/gdb/inferior.h 2011-12-18 23:40:59.257300451 +0100
+@@ -162,7 +162,15 @@ extern void reopen_exec_file (void);
+ /* The `resume' routine should only be called in special circumstances.
+ Normally, use `proceed', which handles a lot of bookkeeping. */
+
+-extern void resume (int, enum target_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 target_signal);
+
+ extern ptid_t user_visible_resume_ptid (int step);
+
+Index: gdb-7.4.50.20111218/gdb/infrun.c
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/infrun.c 2011-11-22 22:25:17.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/infrun.c 2011-12-19 00:12:34.470854218 +0100
+@@ -79,7 +79,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 int currently_stepping_or_nexting_callback (struct thread_info *tp,
+ void *data);
+@@ -1668,7 +1668,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;
+@@ -1686,7 +1687,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 target_signal sig)
++resume (enum resume_step step, enum target_signal sig)
+ {
+ int should_resume = 1;
+ struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
+@@ -1719,9 +1720,13 @@ resume (int step, enum target_signal sig
+
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+- "infrun: resume (step=%d, signal=%d), "
++ "infrun: resume (step=%s, signal=%d), "
+ "trap_expected=%d, current thread [%s] at %s\n",
+- step, sig, tp->control.trap_expected,
++ (step == RESUME_STEP_CONTINUE
++ ? "RESUME_STEP_CONTINUE"
++ : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
++ : "RESUME_STEP_NEEDED")),
++ sig, tp->control.trap_expected,
+ target_pid_to_str (inferior_ptid),
+ paddress (gdbarch, pc));
+
+@@ -2094,7 +2099,7 @@ proceed (CORE_ADDR addr, enum target_sig
+ struct thread_info *tp;
+ CORE_ADDR pc;
+ struct address_space *aspace;
+- int oneproc = 0;
++ 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
+@@ -2134,13 +2139,13 @@ proceed (CORE_ADDR addr, enum target_sig
+ actually be executing the breakpoint insn anyway.
+ We'll be (un-)executing the previous instruction. */
+
+- oneproc = 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. */
+- oneproc = 1;
++ resume_step = RESUME_STEP_USER;
+ }
+ else
+ {
+@@ -2171,13 +2176,13 @@ proceed (CORE_ADDR addr, enum target_sig
+ is required it returns TRUE and sets the current thread to
+ the old thread. */
+ if (prepare_to_proceed (step))
+- oneproc = 1;
++ resume_step = RESUME_STEP_USER;
+ }
+
+ /* prepare_to_proceed may change the current thread. */
+ tp = inferior_thread ();
+
+- if (oneproc)
++ if (resume_step == RESUME_STEP_USER)
+ {
+ tp->control.trap_expected = 1;
+ /* If displaced stepping is enabled, we can step over the
+@@ -2264,8 +2269,13 @@ proceed (CORE_ADDR addr, enum target_sig
+ /* Reset to normal state. */
+ init_infwait_state ();
+
++ if (step)
++ resume_step = RESUME_STEP_USER;
++ if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
++ resume_step = RESUME_STEP_NEEDED;
++
+ /* Resume inferior. */
+- resume (oneproc || 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. */
+@@ -5223,13 +5233,18 @@ process_event_stop_test:
+
+ /* 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
+- && tp->control.step_resume_breakpoint == NULL)
+- || tp->control.trap_expected
+- || bpstat_should_step ());
++ if ((tp->control.step_range_end
++ && tp->control.step_resume_breakpoint == NULL)
++ || tp->control.trap_expected)
++ return RESUME_STEP_USER;
++
++ if (bpstat_should_step ())
++ return RESUME_STEP_NEEDED;
++
++ return RESUME_STEP_CONTINUE;
+ }
+
+ /* Returns true if any thread *but* the one passed in "data" is in the
+Index: gdb-7.4.50.20111218/gdb/linux-nat.c
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-18 23:35:23.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 00:08:41.824855353 +0100
+@@ -3036,7 +3036,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;
+Index: gdb-7.4.50.20111218/gdb/linux-nat.h
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/linux-nat.h 2011-12-18 23:35:23.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-18 23:40:59.262300431 +0100
+@@ -74,8 +74,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;
+
+ /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
+ be the address of a hardware watchpoint. */
diff --git a/gdb-6.8-bz436037-reg-no-longer-active.patch b/gdb-6.8-bz436037-reg-no-longer-active.patch
new file mode 100644
index 0000000..4987714
--- /dev/null
+++ b/gdb-6.8-bz436037-reg-no-longer-active.patch
@@ -0,0 +1,25 @@
+Index: gdb-6.8.50.20090803/gdb/valops.c
+===================================================================
+--- gdb-6.8.50.20090803.orig/gdb/valops.c 2009-08-04 06:30:45.000000000 +0200
++++ gdb-6.8.50.20090803/gdb/valops.c 2009-08-04 06:33:05.000000000 +0200
+@@ -926,10 +926,18 @@ value_assign (struct value *toval, struc
+ struct gdbarch *gdbarch;
+ int value_reg;
+
+- /* Figure out which frame this is in currently. */
+- frame = frame_find_by_id (VALUE_FRAME_ID (toval));
+ value_reg = VALUE_REGNUM (toval);
+
++ /* Figure out which frame this is in currently. */
++ frame = frame_find_by_id (VALUE_FRAME_ID (toval));
++ /* "set $reg+=1" should work on programs with no debug info,
++ but frame_find_by_id returns NULL here (RH bug 436037).
++ Use current frame, it represents CPU state in this case.
++ If frame_find_by_id is changed to do it internally
++ (it is contemplated there), remove this. */
++ if (!frame)
++ frame = get_current_frame ();
++ /* Probably never happens. */
+ if (!frame)
+ error (_("Value being assigned to is no longer active."));
+
diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch
new file mode 100644
index 0000000..d71557f
--- /dev/null
+++ b/gdb-6.8-quit-never-aborts.patch
@@ -0,0 +1,72 @@
+We may abort the process of detaching threads with multiple SIGINTs - which are
+being sent during a testcase terminating its child GDB.
+
+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
+===================================================================
+--- 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;
+
+ 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
+===================================================================
+--- 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;
+
+- /* 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
+===================================================================
+--- 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;
+
+ int quit_flag;
+
++/* 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
diff --git a/gdb-6.8-sparc64-silence-memcpy-check.patch b/gdb-6.8-sparc64-silence-memcpy-check.patch
new file mode 100644
index 0000000..6df8c9a
--- /dev/null
+++ b/gdb-6.8-sparc64-silence-memcpy-check.patch
@@ -0,0 +1,12 @@
+Index: gdb-7.4.50.20111218/gdb/sparc-tdep.c
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/sparc-tdep.c 2011-09-28 19:59:42.000000000 +0200
++++ gdb-7.4.50.20111218/gdb/sparc-tdep.c 2011-12-19 01:25:29.294046199 +0100
+@@ -1316,6 +1316,7 @@ sparc32_store_return_value (struct type
+ if (sparc_floating_p (type) || sparc_complex_floating_p (type))
+ {
+ /* Floating return values. */
++ len = (len <= 8) ? len : 8;
+ memcpy (buf, valbuf, len);
+ regcache_cooked_write (regcache, SPARC_F0_REGNUM, buf);
+ if (len > 4)
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
new file mode 100644
index 0000000..b011658
--- /dev/null
+++ b/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
@@ -0,0 +1,51 @@
+Index: gdb-7.3.50.20110722/gdb/dwarf2read.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 @@
+ #ifdef HAVE_ZLIB_H
+ #include <zlib.h>
+ #endif
++#ifndef __sparc__
+ #ifdef HAVE_MMAP
+ #include <sys/mman.h>
+ #ifndef MAP_FAILED
+ #define MAP_FAILED ((void *) -1)
+ #endif
+ #endif
++#endif
+
+ typedef struct symbol *symbolp;
+ DEF_VEC_P (symbolp);
+@@ -1618,6 +1620,7 @@ dwarf2_read_section (struct objfile *obj
+ }
+ }
+
++#ifndef __sparc__
+ #ifdef HAVE_MMAP
+ if (pagesize == 0)
+ pagesize = getpagesize ();
+@@ -1641,6 +1644,7 @@ dwarf2_read_section (struct objfile *obj
+ }
+ }
+ #endif
++#endif
+
+ /* 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
+ }
+ }
+
diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch
new file mode 100644
index 0000000..2cddac3
--- /dev/null
+++ b/gdb-bz533176-fortran-omp-step.patch
@@ -0,0 +1,121 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
+
+I find it a bug in DWARF and gdb behaves correctly according to it. From the
+current DWARF's point of view the is a function call which you skip by "next".
+
+If you hide any /usr/lib/debug such as using:
+gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
+and use "step" command instead of "next" there it will work.
+(You need to hide debuginfo from libgomp as you would step into libgomp sources
+to maintain the threads for execution.)
+
+There should be some DWARF extension for it, currently tried to detect
+substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
+consider such sub-function as a skippable by "next".
+
+Another problem is that with "set scheduler-locking" being "off" (default
+upstream) or "step" (default in F/RHEL) the simultaneous execution of the
+threads is inconvenient. Setting it to "on" will lockup the debugging as the
+threads need to get synchronized at some point. This is a more general
+debugging problem of GOMP outside of the scope of this Bug.
+
+
+
+Index: gdb-7.2.50.20101231/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
+
+ if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
+ {
++ struct symbol *stop_fn = find_pc_function (stop_pc);
++
++ if (stop_fn == NULL
++ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
++{ /* ".omp_fn." */
++
+ /* We're doing a "next".
+
+ Normal (forward) execution: set a breakpoint at the
+@@ -4612,6 +4618,7 @@ infrun: not switching back to stepped th
+
+ keep_going (ecs);
+ return;
++} /* ".omp_fn." */
+ }
+
+ /* If we are in a function call trampoline (a stub between the
+Index: gdb-7.2.50.20101231/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
+@@ -0,0 +1,31 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++set testfile "omp-step"
++set srcfile ${testfile}.f90
++if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90 additional_flags=-fopenmp}] } {
++ return -1
++}
++
++if ![runto [gdb_get_line_number "start-here"]] {
++ perror "Couldn't run to start-here"
++ return 0
++}
++
++gdb_test "next" {!\$omp parallel} "step closer"
++gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
++
++gdb_breakpoint [gdb_get_line_number "success"]
++gdb_continue_to_breakpoint "success" ".*success.*"
+Index: gdb-7.2.50.20101231/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
+@@ -0,0 +1,32 @@
++! Copyright 2009 Free Software Foundation, Inc.
++
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 3 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++ use omp_lib
++ integer nthreads, i, a(1000)
++ nthreads = omp_get_num_threads()
++ if (nthreads .gt. 1000) call abort
++
++ do i = 1, nthreads
++ a(i) = 0
++ end do
++ print *, "start-here"
++!$omp parallel
++ a(omp_get_thread_num() + 1) = 1
++!$omp end parallel
++ do i = 1, nthreads
++ if (a(i) .ne. 1) call abort
++ end do
++ print *, "success"
++ end
diff --git a/gdb-bz562763-pretty-print-2d-vectors.patch b/gdb-bz562763-pretty-print-2d-vectors.patch
new file mode 100644
index 0000000..0e3d216
--- /dev/null
+++ b/gdb-bz562763-pretty-print-2d-vectors.patch
@@ -0,0 +1,398 @@
+2010-05-31 Chris Moller <cmoller at redhat.com>
+
+ * python/py-prettyprint.c (print_children): Add formatting for
+ matrices. (apply_val_pretty_printer): Detect and deal with matrix
+ hints.
+
+
+2010-05-31 Chris Moller <cmoller at redhat.com>
+
+ * gdb.python/Makefile.in (EXECUTABLES): Added pr10659.
+ * gdb.python/pr10659.cc: New file.
+ * gdb.python/pr10659.exp. New file.
+ * gdb.python/pr10659.py: New file.
+
+Index: gdb-7.2.50.20110218/gdb/valprint.h
+===================================================================
+--- gdb-7.2.50.20110218.orig/gdb/valprint.h 2011-02-14 12:35:45.000000000 +0100
++++ gdb-7.2.50.20110218/gdb/valprint.h 2011-02-18 10:44:32.000000000 +0100
+@@ -90,6 +90,9 @@ struct value_print_options
+
+ /* If nonzero, print the value in "summary" form. */
+ int summary;
++
++ /* Affects pretty printing of matrices. */
++ int prettyprint_matrix;
+ };
+
+ /* The global print options set by the user. In general this should
+Index: gdb-7.2.50.20110218/gdb/python/py-prettyprint.c
+===================================================================
+--- gdb-7.2.50.20110218.orig/gdb/python/py-prettyprint.c 2011-02-14 12:10:53.000000000 +0100
++++ gdb-7.2.50.20110218/gdb/python/py-prettyprint.c 2011-02-18 10:45:02.000000000 +0100
+@@ -501,7 +501,7 @@ print_children (PyObject *printer, const
+
+ /* Use the prettyprint_arrays option if we are printing an array,
+ and the pretty option otherwise. */
+- if (is_array)
++ if (is_array || options->prettyprint_matrix)
+ pretty = options->prettyprint_arrays;
+ else
+ {
+@@ -521,6 +521,9 @@ print_children (PyObject *printer, const
+ goto done;
+ }
+ make_cleanup_py_decref (frame);
++
++ if (options->prettyprint_matrix && recurse == 0)
++ fputs_filtered ("\n", stream);
+
+ done_flag = 0;
+ for (i = 0; i < options->print_max; ++i)
+@@ -555,12 +558,23 @@ print_children (PyObject *printer, const
+ 3. Other. Always print a ",". */
+ if (i == 0)
+ {
+- if (is_py_none)
+- fputs_filtered ("{", stream);
+- else
+- fputs_filtered (" = {", stream);
++ if (options->prettyprint_matrix && recurse == 0)
++ print_spaces_filtered (2 + 2 * recurse, stream);
++ if (is_py_none)
++ {
++ if (options->prettyprint_matrix && strcmp (hint, "array"))
++ {
++ fputs_filtered ("{\n", stream);
++ print_spaces_filtered (4 + 2 * recurse, stream);
++ }
++ else
++ fputs_filtered ("{", stream);
++ }
++ else
++ fputs_filtered (" = {", stream);
+ }
+-
++ else if (options->prettyprint_matrix)
++ print_spaces_filtered (4 + 2 * recurse, stream);
+ else if (! is_map || i % 2 == 0)
+ fputs_filtered (pretty ? "," : ", ", stream);
+
+@@ -589,6 +603,10 @@ print_children (PyObject *printer, const
+
+ if (is_map && i % 2 == 0)
+ fputs_filtered ("[", stream);
++ else if (options->prettyprint_matrix)
++ {
++ /* Force a do-nothing. */
++ }
+ else if (is_array)
+ {
+ /* We print the index, not whatever the child method
+@@ -667,7 +685,12 @@ print_children (PyObject *printer, const
+ fputs_filtered ("\n", stream);
+ print_spaces_filtered (2 * recurse, stream);
+ }
+- fputs_filtered ("}", stream);
++ if (options->prettyprint_matrix)
++ {
++ print_spaces_filtered (4 * recurse, stream);
++ fputs_filtered ("}\n", stream);
++ }
++ else fputs_filtered ("}", stream);
+ }
+
+ done:
+@@ -689,6 +712,7 @@ apply_val_pretty_printer (struct type *t
+ char *hint = NULL;
+ struct cleanup *cleanups;
+ int result = 0;
++ struct value_print_options *options_copy;
+ enum string_repr_result print_result;
+
+ /* No pretty-printer support for unavailable values. */
+@@ -726,9 +750,21 @@ apply_val_pretty_printer (struct type *t
+
+ /* If we are printing a map, we want some special formatting. */
+ hint = gdbpy_get_display_hint (printer);
++
++ if (recurse == 0)
++ {
++ options_copy = alloca (sizeof (struct value_print_options));
++ memcpy (options_copy, options, sizeof (struct value_print_options));
++ options_copy->prettyprint_matrix = hint && !strcmp (hint, "matrix");
++ }
++ else options_copy = (struct value_print_options *)options;
++
+ make_cleanup (free_current_contents, &hint);
+
+ /* Print the section */
++ if (options_copy->prettyprint_matrix)
++ print_result = string_repr_none;
++else /* Red Hat 2D matrix patch */
+ print_result = print_string_repr (printer, hint, stream, recurse,
+ options, language, gdbarch);
+ if (print_result != string_repr_error)
+Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.cc 2011-02-18 10:44:32.000000000 +0100
+@@ -0,0 +1,43 @@
++#include <list>
++#include <vector> // /usr/include/c++/4.4.1/bits/vector.tcc
++#include <iostream>
++
++using namespace std;
++
++int use_windows = 9999;
++
++int
++main(){
++ vector<int> test1(2,0);
++ test1[0]=8;
++ test1[1]=9;
++
++ vector< vector<int> > test2(3, vector<int>(2,0));
++ test2[0][0]=0;
++ test2[0][1]=1;
++ test2[1][0]=2;
++ test2[1][1]=3;
++ test2[2][0]=4;
++ test2[2][1]=5;
++
++#define NR_ROWS 2
++#define NR_COLS 3
++#define NR_PLANES 4
++ vector<int> rows(NR_ROWS, 0);
++ vector< vector<int> > columns(NR_COLS, rows);
++ vector< vector < vector<int> > > test3(NR_PLANES, columns);
++
++ cout << "rows.size() = " << rows.size()
++ << ", columns.size() = " << columns.size()
++ << ", test3.size() = " << test3.size() << "\n";
++
++ for (int i = 0; i < rows.size(); i++) {
++ for (int j = 0; j < columns.size(); j++) {
++ for (int k = 0; k < test3.size(); k++) {
++ test3[k][j][i] = k * 100 + j * 10 + i;
++ }
++ }
++ }
++
++ return 0; // break
++}
+Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.exp 2011-02-18 10:44:32.000000000 +0100
+@@ -0,0 +1,82 @@
++#Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++set nl "\[\r\n\]+"
++
++set testfile pr10659
++set srcfile ${testfile}.cc
++if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
++ return -1
++}
++
++#if { [skip_python_tests] } { continue }
++
++gdb_test "python execfile(\"$srcdir/$subdir/pr10659.py\")" ""
++gdb_test "python gdb.pretty_printers = \[lookup_function\]" ""
++
++if ![runto_main] then {
++ fail "Can't run to main"
++ return
++}
++
++gdb_breakpoint [gdb_get_line_number "break"]
++gdb_continue_to_breakpoint "break"
++
++gdb_test "p test1" "vector of length 2, capacity 2 =.*"
++
++gdb_test "p test2" "= $nl {$nl {.*"
++
++# Complete result is:
++#
++# (gdb) p test2
++# $2 =
++# {
++# {0 1 }
++# {2 3 }
++# {4 5 }
++# }
++
++
++gdb_test "p test3" "= $nl {$nl {$nl {.*"
++
++# Complete result is:
++#
++# (gdb) p test3
++# $3 =
++# {
++# {
++# {0 1 }
++# {10 11 }
++# {20 21 }
++# }
++# {
++# {100 101 }
++# {110 111 }
++# {120 121 }
++# }
++# {
++# {200 201 }
++# {210 211 }
++# {220 221 }
++# }
++# {
++# {300 301 }
++# {310 311 }
++# {320 321 }
++# }
++# }
++#
++
++
+Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.py
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.py 2011-02-18 10:44:32.000000000 +0100
+@@ -0,0 +1,109 @@
++# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++import gdb
++import itertools
++import re
++
++vector_sig = 'std::vector'
++vector_regex = re.compile('^' + vector_sig + '<.*>$')
++
++class FakeVectorPrinter:
++ "Print a std::vector"
++
++ class _iterator:
++ def __init__ (self, start, finish):
++ self.item = start
++ self.finish = finish
++ self.count = 0
++
++ def __iter__(self):
++ return self
++
++ def next(self):
++ if self.item == self.finish:
++ raise StopIteration
++ count = self.count
++ self.count = self.count + 1
++ elt = self.item.dereference()
++ self.item = self.item + 1
++ return ('[%d]' % count, elt)
++
++ def __init__(self, typename, val):
++ self.typename = typename
++ self.val = val
++
++ def children(self):
++ return self._iterator(self.val['_M_impl']['_M_start'],
++ self.val['_M_impl']['_M_finish'])
++
++ def to_string(self):
++ start = self.val['_M_impl']['_M_start']
++ finish = self.val['_M_impl']['_M_finish']
++ end = self.val['_M_impl']['_M_end_of_storage']
++ return ('std::vector of length %d, capacity %d'
++ % (int (finish - start), int (end - start)))
++
++ def display_hint(self):
++ itype0 = self.val.type.template_argument(0)
++ itag = itype0.tag
++ if itag and re.match(vector_regex, itag):
++ rc = 'matrix'
++ else:
++ rc = 'array'
++ return rc
++
++def register_libstdcxx_printers (obj):
++ "Register libstdc++ pretty-printers with objfile Obj."
++
++ if obj == None:
++ obj = gdb
++
++ obj.pretty_printers.append (lookup_function)
++
++def lookup_function (val):
++ "Look-up and return a pretty-printer that can print val."
++
++ # Get the type.
++ type = val.type;
++
++ # If it points to a reference, get the reference.
++ if type.code == gdb.TYPE_CODE_REF:
++ type = type.target ()
++
++ # Get the unqualified type, stripped of typedefs.
++ type = type.unqualified ().strip_typedefs ()
++
++ # Get the type name.
++ typename = type.tag
++ if typename == None:
++ return None
++
++ # Iterate over local dictionary of types to determine
++ # if a printer is registered for that type. Return an
++ # instantiation of the printer if found.
++ for function in fake_pretty_printers_dict:
++ if function.search (typename):
++ return fake_pretty_printers_dict[function] (val)
++
++ # Cannot find a pretty printer. Return None.
++ return None
++
++def build_libfakecxx_dictionary ():
++ fake_pretty_printers_dict[vector_regex] = lambda val: FakeVectorPrinter(vector_sig, val)
++
++fake_pretty_printers_dict = {}
++
++build_libfakecxx_dictionary ()
+Index: gdb-7.2.50.20110218/gdb/valprint.c
+===================================================================
+--- gdb-7.2.50.20110218.orig/gdb/valprint.c 2011-02-18 10:44:16.000000000 +0100
++++ gdb-7.2.50.20110218/gdb/valprint.c 2011-02-18 10:44:32.000000000 +0100
+@@ -85,7 +85,8 @@ struct value_print_options user_print_op
+ 1, /* static_field_print */
+ 1, /* pascal_static_field_print */
+ 0, /* raw */
+- 0 /* summary */
++ 0, /* summary */
++ 0 /* prettyprint_matrix */
+ };
+
+ /* Initialize *OPTS to be a copy of the user print options. */
diff --git a/gdb-bz568248-oom-is-error.patch b/gdb-bz568248-oom-is-error.patch
new file mode 100644
index 0000000..045d34e
--- /dev/null
+++ b/gdb-bz568248-oom-is-error.patch
@@ -0,0 +1,68 @@
+http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
+Subject: [rfc patch] nomem: internal_error -> error
+
+Hi,
+
+unfortunately I see this problem reproducible only with the
+archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
+OTOH this branch I hopefully submit in some form for FSF GDB later.
+
+In this case (a general problem but tested for example on Fedora 13 i686):
+
+int
+main (int argc, char **argv)
+{
+ char a[argc];
+ return a[0];
+}
+
+(gdb) start
+(gdb) print a
+../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
+
+It is apparently because boundary for the variable `a' is not initialized
+there. Users notice it due to Eclipse-CDT trying to automatically display all
+the local variables on each step.
+
+
+Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
+But is anone aware of the reasons to use internal_error there?
+I find simple error as a perfectly reasonable there.
+(history only tracks it since the initial import)
+
+IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
+
+I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
+sure if it can happen only due to the VLA variables.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-06-01 Jan Kratochvil <jan.kratochvil at redhat.com>
+ Tom Tromey <tromey at redhat.com>
+
+ * utils.c (nomem): Change internal_error to error.
+
+Index: gdb-7.3.50.20110722/gdb/utils.c
+===================================================================
+--- gdb-7.3.50.20110722.orig/gdb/utils.c 2011-07-22 19:28:58.000000000 +0200
++++ gdb-7.3.50.20110722/gdb/utils.c 2011-07-22 19:34:25.000000000 +0200
+@@ -1219,13 +1219,11 @@ malloc_failure (long size)
+ {
+ if (size > 0)
+ {
+- internal_error (__FILE__, __LINE__,
+- _("virtual memory exhausted: can't allocate %ld bytes."),
+- size);
++ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
+ }
+ else
+ {
+- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
++ error (_("virtual memory exhausted."));
+ }
+ }
+
diff --git a/gdb-bz592031-siginfo-lost-4of5.patch b/gdb-bz592031-siginfo-lost-4of5.patch
new file mode 100644
index 0000000..3810fec
--- /dev/null
+++ b/gdb-bz592031-siginfo-lost-4of5.patch
@@ -0,0 +1,994 @@
+http://sourceware.org/ml/gdb-patches/2010-09/msg00360.html
+Subject: [patch 3/4]#3 linux-nat: Do not respawn signals
+
+Hi,
+
+linux-nat.c is fixed to never respawn signals; possibly keeping SIGSTOP
+pending, as is done in current in FSF gdbserver and as suggested by Pedro:
+ http://sourceware.org/ml/gdb-patches/2010-08/msg00544.html
+
+The last linux-nat.c removed patch chunk comes from the initial implementation
+by Mark Kettenis:
+ [PATCH] New Linux threads support
+ http://sourceware.org/ml/gdb-patches/2000-09/msg00020.html
+ 92280a75e017683bf8e4f339f4f85640b0700509
+It gets in part reimplemented into the new stop_wait_callback <if (lp->step)>
+part and partially just not needed as currently GDB never drops the signals as
+it does not PTRACE_CONT the thread; signal is kept for processing:
+ "RC: Not resuming sibling %s (has pending)\n"
+
+In stop_wait_callback I believe breakpoints cancellation is not needed here,
+it would be done later.
+
+
+The testcase sigstep-threads.exp was written to catch a regression-like
+appearance then the new <if (lp->step)> part of stop_wait_callback gets
+removed. Still the tecase fails even with FSF HEAD:
+
+32 var++; /* step-1 */
+(gdb) step
+Program received signal SIGUSR1, User defined signal 1.
+Program received signal SIGUSR1, User defined signal 1.
+31 { /* step-0 */
+
+There is no reason why it shouldn't stop on line 33, between line 32 and line
+33 no signal would occur. Stepping of the current thread should not be
+affected by whatever happens in the other threads as select_event_lwp has:
+ /* Give preference to any LWP that is being single-stepped. */
+
+There is a problem that with FSF HEAD GDB does PTRACE_SINGLESTEP for thread A,
+PTRACE_CONT for thread B (because of set scheduler-locking off), thread B hits
+SIGUSR1, so GDB tkills thread A with SIGSTOP and it can receive SIGSTOP for
+thread A before the SIGTRAP for completed PTRACE_SINGLESTEP. At that moment
+select_event_lwp. forgets it was stepping thread A because there is no pending
+SIGTRAP event. currently_stepping still remembers thread A was stepping so it
+will later stop but as thread A was PTRACE_CONT-ed in the meantime it is too
+late.
+
+There is the new <if (lp->step)> part of stop_wait_callback to always track
+thread A is stepping. Due to different scheduling without this part the
+changed GDB would very rarely stop in this testcase otherwise, making it look
+as a regression.
+
+I have some another patch I may post separately as if multiple signals happen
+besides SIGTRAP GDB still may switch from thread A away (as not considering it
+stepping) to thread B for SIGUSR and accidentally PTRACE_CONT thread A.
+But I do not find this as a prerequisite for this patchset.
+
+
+
+Thanks,
+Jan
+
+
+gdb/
+2010-09-20 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * linux-nat.c (stop_wait_callback): New gdb_assert. Remove signals
+ respawning; keep TP with SIGNALLED. New debugging message "SWC:
+ Delayed SIGSTOP caught for %s.". Catch next signal if SIGSTOP has
+ been caught and LP->STEP is set.
+ (linux_nat_wait_1) <lp && lp->signalled>: Remove.
+
+gdb/testsuite/
+2010-09-20 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * gdb.threads/siginfo-threads.exp: New file.
+ * gdb.threads/siginfo-threads.c: New file.
+ * gdb.threads/sigstep-threads.exp: New file.
+ * gdb.threads/sigstep-threads.c: New file.
+
+Index: gdb-7.4.50.20111218/gdb/linux-nat.c
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-19 01:25:42.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 02:17:05.412607735 +0100
+@@ -2843,6 +2843,8 @@ stop_wait_callback (struct lwp_info *lp,
+ {
+ int status;
+
++ gdb_assert (lp->resumed);
++
+ status = wait_lwp (lp);
+ if (status == 0)
+ return 0;
+@@ -2868,110 +2870,61 @@ stop_wait_callback (struct lwp_info *lp,
+
+ if (WSTOPSIG (status) != SIGSTOP)
+ {
+- if (linux_nat_status_is_event (status))
+- {
+- /* If a LWP other than the LWP that we're reporting an
+- event for has hit a GDB breakpoint (as opposed to
+- some random trap signal), then just arrange for it to
+- hit it again later. We don't keep the SIGTRAP status
+- and don't forward the SIGTRAP signal to the LWP. We
+- will handle the current event, eventually we will
+- resume all LWPs, and this one will get its breakpoint
+- trap again.
+-
+- If we do not do this, then we run the risk that the
+- user will delete or disable the breakpoint, but the
+- thread will have already tripped on it. */
+-
+- /* Save the trap's siginfo in case we need it later. */
+- save_siginfo (lp);
+-
+- save_sigtrap (lp);
+-
+- /* Now resume this LWP and get the SIGSTOP event. */
+- errno = 0;
+- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+- if (debug_linux_nat)
+- {
+- fprintf_unfiltered (gdb_stdlog,
+- "PTRACE_CONT %s, 0, 0 (%s)\n",
+- target_pid_to_str (lp->ptid),
+- errno ? safe_strerror (errno) : "OK");
+-
+- fprintf_unfiltered (gdb_stdlog,
+- "SWC: Candidate SIGTRAP event in %s\n",
+- target_pid_to_str (lp->ptid));
+- }
+- /* Hold this event/waitstatus while we check to see if
+- there are any more (we still want to get that SIGSTOP). */
+- stop_wait_callback (lp, NULL);
++ /* The thread was stopped with a signal other than SIGSTOP. */
+
+- /* Hold the SIGTRAP for handling by linux_nat_wait. If
+- there's another event, throw it back into the
+- queue. */
+- if (lp->status)
+- {
+- if (debug_linux_nat)
+- fprintf_unfiltered (gdb_stdlog,
+- "SWC: kill %s, %s\n",
+- target_pid_to_str (lp->ptid),
+- status_to_str ((int) status));
+- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
+- }
+-
+- /* Save the sigtrap event. */
+- lp->status = status;
+- return 0;
+- }
+- else
+- {
+- /* The thread was stopped with a signal other than
+- SIGSTOP, and didn't accidentally trip a breakpoint. */
++ /* Save the trap's siginfo in case we need it later. */
++ save_siginfo (lp);
+
+- if (debug_linux_nat)
+- {
+- fprintf_unfiltered (gdb_stdlog,
+- "SWC: Pending event %s in %s\n",
+- status_to_str ((int) status),
+- target_pid_to_str (lp->ptid));
+- }
+- /* Now resume this LWP and get the SIGSTOP event. */
+- errno = 0;
+- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+- if (debug_linux_nat)
+- fprintf_unfiltered (gdb_stdlog,
+- "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
+- target_pid_to_str (lp->ptid),
+- errno ? safe_strerror (errno) : "OK");
++ save_sigtrap (lp);
+
+- /* Hold this event/waitstatus while we check to see if
+- there are any more (we still want to get that SIGSTOP). */
+- stop_wait_callback (lp, NULL);
++ if (debug_linux_nat)
++ fprintf_unfiltered (gdb_stdlog,
++ "SWC: Pending event %s in %s\n",
++ status_to_str ((int) status),
++ target_pid_to_str (lp->ptid));
+
+- /* If the lp->status field is still empty, use it to
+- hold this event. If not, then this event must be
+- returned to the event queue of the LWP. */
+- if (lp->status)
+- {
+- if (debug_linux_nat)
+- {
+- fprintf_unfiltered (gdb_stdlog,
+- "SWC: kill %s, %s\n",
+- target_pid_to_str (lp->ptid),
+- status_to_str ((int) status));
+- }
+- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
+- }
+- else
+- lp->status = status;
+- return 0;
+- }
++ /* Save the sigtrap event. */
++ lp->status = status;
++ gdb_assert (! lp->stopped);
++ gdb_assert (lp->signalled);
++ lp->stopped = 1;
+ }
+ else
+ {
+ /* We caught the SIGSTOP that we intended to catch, so
+ there's no SIGSTOP pending. */
+- lp->stopped = 1;
++
++ if (debug_linux_nat)
++ fprintf_unfiltered (gdb_stdlog,
++ "SWC: Delayed SIGSTOP caught for %s.\n",
++ target_pid_to_str (lp->ptid));
++
++ if (lp->step)
++ {
++ /* LP->STATUS is 0 here. That means SIGTRAP from
++ PTRACE_SINGLESTEP still has to be delivered for this inferior
++ stop. Catching the SIGTRAP event is important to prevent
++ starvation in select_event_lwp. */
++
++ registers_changed ();
++ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
++ 1, TARGET_SIGNAL_0);
++ if (debug_linux_nat)
++ fprintf_unfiltered (gdb_stdlog,
++ "SWC: %s %s, 0, 0 (discard SIGSTOP)\n",
++ "PTRACE_SINGLESTEP",
++ target_pid_to_str (lp->ptid));
++
++ lp->stopped = 0;
++ gdb_assert (lp->resumed);
++ stop_wait_callback (lp, NULL);
++ gdb_assert (lp->stopped);
++ }
++ else
++ lp->stopped = 1;
++
++ /* Reset SIGNALLED only after the stop_wait_callback call above as
++ it does gdb_assert on SIGNALLED. */
+ lp->signalled = 0;
+ }
+ }
+@@ -3627,54 +3580,6 @@ retry:
+ lp = NULL;
+ }
+
+- if (lp && lp->signalled && lp->last_resume_kind != resume_stop)
+- {
+- /* A pending SIGSTOP may interfere with the normal stream of
+- events. In a typical case where interference is a problem,
+- we have a SIGSTOP signal pending for LWP A while
+- single-stepping it, encounter an event in LWP B, and take the
+- pending SIGSTOP while trying to stop LWP A. After processing
+- the event in LWP B, LWP A is continued, and we'll never see
+- the SIGTRAP associated with the last time we were
+- single-stepping LWP A. */
+-
+- /* Resume the thread. It should halt immediately returning the
+- pending SIGSTOP. */
+- registers_changed ();
+- if (linux_nat_prepare_to_resume != NULL)
+- linux_nat_prepare_to_resume (lp);
+- linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
+- lp->step, TARGET_SIGNAL_0);
+- if (debug_linux_nat)
+- fprintf_unfiltered (gdb_stdlog,
+- "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
+- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+- target_pid_to_str (lp->ptid));
+- lp->stopped = 0;
+- gdb_assert (lp->resumed);
+-
+- /* Catch the pending SIGSTOP. */
+- status = lp->status;
+- lp->status = 0;
+-
+- stop_wait_callback (lp, NULL);
+-
+- /* If the lp->status field isn't empty, we caught another signal
+- while flushing the SIGSTOP. Return it back to the event
+- queue of the LWP, as we already have an event to handle. */
+- if (lp->status)
+- {
+- if (debug_linux_nat)
+- fprintf_unfiltered (gdb_stdlog,
+- "LLW: kill %s, %s\n",
+- target_pid_to_str (lp->ptid),
+- status_to_str (lp->status));
+- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
+- }
+-
+- lp->status = status;
+- }
+-
+ if (!target_can_async_p ())
+ {
+ /* Causes SIGINT to be passed on to the attached process. */
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c 2011-12-19 02:16:35.236720272 +0100
+@@ -0,0 +1,447 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2010 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++#define _GNU_SOURCE
++#include <pthread.h>
++#include <stdio.h>
++#include <limits.h>
++#include <errno.h>
++#include <stdlib.h>
++#include <string.h>
++#include <assert.h>
++#include <sys/types.h>
++#include <signal.h>
++#include <unistd.h>
++#include <asm/unistd.h>
++
++#define gettid() syscall (__NR_gettid)
++#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, tgid, tid, sig)
++
++/* Terminate always in the main task, it can lock up with SIGSTOPped GDB
++ otherwise. */
++#define TIMEOUT (gettid () == getpid() ? 10 : 15)
++
++static pid_t thread1_tid;
++static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER;
++static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
++static int thread1_sigusr1_hit;
++static int thread1_sigusr2_hit;
++
++static pid_t thread2_tid;
++static pthread_cond_t thread2_tid_cond = PTHREAD_COND_INITIALIZER;
++static pthread_mutex_t thread2_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
++static int thread2_sigusr1_hit;
++static int thread2_sigusr2_hit;
++
++static pthread_mutex_t terminate_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
++
++/* Do not use alarm as it would create a ptrace event which would hang up us if
++ we are being traced by GDB which we stopped ourselves. */
++
++static void timed_mutex_lock (pthread_mutex_t *mutex)
++{
++ int i;
++ struct timespec start, now;
++
++ i = clock_gettime (CLOCK_MONOTONIC, &start);
++ assert (i == 0);
++
++ do
++ {
++ i = pthread_mutex_trylock (mutex);
++ if (i == 0)
++ return;
++ assert (i == EBUSY);
++
++ i = clock_gettime (CLOCK_MONOTONIC, &now);
++ assert (i == 0);
++ assert (now.tv_sec >= start.tv_sec);
++ }
++ while (now.tv_sec - start.tv_sec < TIMEOUT);
++
++ fprintf (stderr, "Timed out waiting for internal lock!\n");
++ exit (EXIT_FAILURE);
++}
++
++static void
++handler (int signo, siginfo_t *siginfo, void *exception)
++{
++ int *varp;
++
++ assert (siginfo->si_signo == signo);
++ assert (siginfo->si_code == SI_TKILL);
++ assert (siginfo->si_pid == getpid ());
++
++ if (gettid () == thread1_tid)
++ {
++ if (signo == SIGUSR1)
++ varp = &thread1_sigusr1_hit;
++ else if (signo == SIGUSR2)
++ varp = &thread1_sigusr2_hit;
++ else
++ assert (0);
++ }
++ else if (gettid () == thread2_tid)
++ {
++ if (signo == SIGUSR1)
++ varp = &thread2_sigusr1_hit;
++ else if (signo == SIGUSR2)
++ varp = &thread2_sigusr2_hit;
++ else
++ assert (0);
++ }
++ else
++ assert (0);
++
++ if (*varp)
++ {
++ fprintf (stderr, "Signal %d for TID %lu has been already hit!\n", signo,
++ (unsigned long) gettid ());
++ exit (EXIT_FAILURE);
++ }
++ *varp = 1;
++}
++
++static void *
++thread1_func (void *unused)
++{
++ int i;
++
++ timed_mutex_lock (&thread1_tid_mutex);
++
++ /* THREAD1_TID_MUTEX must be already locked to avoid race. */
++ thread1_tid = gettid ();
++
++ i = pthread_cond_signal (&thread1_tid_cond);
++ assert (i == 0);
++ i = pthread_mutex_unlock (&thread1_tid_mutex);
++ assert (i == 0);
++
++ /* Be sure the "t (tracing stop)" test can proceed for both threads. */
++ timed_mutex_lock (&terminate_mutex);
++ i = pthread_mutex_unlock (&terminate_mutex);
++ assert (i == 0);
++
++ if (! thread1_sigusr1_hit)
++ {
++ fprintf (stderr, "Thread 1 signal SIGUSR1 not hit!\n");
++ exit (EXIT_FAILURE);
++ }
++ if (! thread1_sigusr2_hit)
++ {
++ fprintf (stderr, "Thread 1 signal SIGUSR2 not hit!\n");
++ exit (EXIT_FAILURE);
++ }
++
++ return NULL;
++}
++
++static void *
++thread2_func (void *unused)
++{
++ int i;
++
++ timed_mutex_lock (&thread2_tid_mutex);
++
++ /* THREAD2_TID_MUTEX must be already locked to avoid race. */
++ thread2_tid = gettid ();
++
++ i = pthread_cond_signal (&thread2_tid_cond);
++ assert (i == 0);
++ i = pthread_mutex_unlock (&thread2_tid_mutex);
++ assert (i == 0);
++
++ /* Be sure the "t (tracing stop)" test can proceed for both threads. */
++ timed_mutex_lock (&terminate_mutex);
++ i = pthread_mutex_unlock (&terminate_mutex);
++ assert (i == 0);
++
++ if (! thread2_sigusr1_hit)
++ {
++ fprintf (stderr, "Thread 2 signal SIGUSR1 not hit!\n");
++ exit (EXIT_FAILURE);
++ }
++ if (! thread2_sigusr2_hit)
++ {
++ fprintf (stderr, "Thread 2 signal SIGUSR2 not hit!\n");
++ exit (EXIT_FAILURE);
++ }
++
++ return NULL;
++}
++
++static const char *
++proc_string (const char *filename, const char *line)
++{
++ FILE *f;
++ static char buf[LINE_MAX];
++ size_t line_len = strlen (line);
++
++ f = fopen (filename, "r");
++ if (f == NULL)
++ {
++ fprintf (stderr, "fopen (\"%s\") for \"%s\": %s\n", filename, line,
++ strerror (errno));
++ exit (EXIT_FAILURE);
++ }
++ while (errno = 0, fgets (buf, sizeof (buf), f))
++ {
++ char *s;
++
++ s = strchr (buf, '\n');
++ assert (s != NULL);
++ *s = 0;
++
++ if (strncmp (buf, line, line_len) != 0)
++ continue;
++
++ if (fclose (f))
++ {
++ fprintf (stderr, "fclose (\"%s\") for \"%s\": %s\n", filename, line,
++ strerror (errno));
++ exit (EXIT_FAILURE);
++ }
++
++ return &buf[line_len];
++ }
++ if (errno != 0)
++ {
++ fprintf (stderr, "fgets (\"%s\": %s\n", filename, strerror (errno));
++ exit (EXIT_FAILURE);
++ }
++ fprintf (stderr, "\"%s\": No line \"%s\" found.\n", filename, line);
++ exit (EXIT_FAILURE);
++}
++
++static unsigned long
++proc_ulong (const char *filename, const char *line)
++{
++ const char *s = proc_string (filename, line);
++ long retval;
++ char *end;
++
++ errno = 0;
++ retval = strtol (s, &end, 10);
++ if (retval < 0 || retval >= LONG_MAX || (end && *end))
++ {
++ fprintf (stderr, "\"%s\":\"%s\": %ld, %s\n", filename, line, retval,
++ strerror (errno));
++ exit (EXIT_FAILURE);
++ }
++ return retval;
++}
++
++static void
++state_wait (pid_t process, const char *wanted)
++{
++ char *filename;
++ int i;
++ struct timespec start, now;
++ const char *state;
++
++ i = asprintf (&filename, "/proc/%lu/status", (unsigned long) process);
++ assert (i > 0);
++
++ i = clock_gettime (CLOCK_MONOTONIC, &start);
++ assert (i == 0);
++
++ do
++ {
++ state = proc_string (filename, "State:\t");
++
++ /* torvalds/linux-2.6.git 464763cf1c6df632dccc8f2f4c7e50163154a2c0
++ has changed "T (tracing stop)" to "t (tracing stop)". Make the GDB
++ testcase backward compatible with older Linux kernels. */
++ if (strcmp (state, "T (tracing stop)") == 0)
++ state = "t (tracing stop)";
++
++ if (strcmp (state, wanted) == 0)
++ {
++ free (filename);
++ return;
++ }
++
++ if (sched_yield ())
++ {
++ perror ("sched_yield()");
++ exit (EXIT_FAILURE);
++ }
++
++ i = clock_gettime (CLOCK_MONOTONIC, &now);
++ assert (i == 0);
++ assert (now.tv_sec >= start.tv_sec);
++ }
++ while (now.tv_sec - start.tv_sec < TIMEOUT);
++
++ fprintf (stderr, "Timed out waiting for PID %lu \"%s\" (now it is \"%s\")!\n",
++ (unsigned long) process, wanted, state);
++ exit (EXIT_FAILURE);
++}
++
++static volatile pid_t tracer = 0;
++static pthread_t thread1, thread2;
++
++static void
++cleanup (void)
++{
++ printf ("Resuming GDB PID %lu.\n", (unsigned long) tracer);
++
++ if (tracer)
++ {
++ int i;
++ int tracer_save = tracer;
++
++ tracer = 0;
++
++ i = kill (tracer_save, SIGCONT);
++ assert (i == 0);
++ }
++}
++
++int
++main (int argc, char **argv)
++{
++ int i;
++ int standalone = 0;
++ struct sigaction act;
++
++ if (argc == 2 && strcmp (argv[1], "-s") == 0)
++ standalone = 1;
++ else
++ assert (argc == 1);
++
++ setbuf (stdout, NULL);
++
++ timed_mutex_lock (&thread1_tid_mutex);
++ timed_mutex_lock (&thread2_tid_mutex);
++
++ timed_mutex_lock (&terminate_mutex);
++
++ errno = 0;
++ memset (&act, 0, sizeof (act));
++ act.sa_sigaction = handler;
++ act.sa_flags = SA_RESTART | SA_SIGINFO;
++ i = sigemptyset (&act.sa_mask);
++ assert_perror (errno);
++ assert (i == 0);
++ i = sigaction (SIGUSR1, &act, NULL);
++ assert_perror (errno);
++ assert (i == 0);
++ i = sigaction (SIGUSR2, &act, NULL);
++ assert_perror (errno);
++ assert (i == 0);
++
++ i = pthread_create (&thread1, NULL, thread1_func, NULL);
++ assert (i == 0);
++
++ i = pthread_create (&thread2, NULL, thread2_func, NULL);
++ assert (i == 0);
++
++ if (!standalone)
++ {
++ tracer = proc_ulong ("/proc/self/status", "TracerPid:\t");
++ if (tracer == 0)
++ {
++ fprintf (stderr, "The testcase must be run by GDB!\n");
++ exit (EXIT_FAILURE);
++ }
++ if (tracer != getppid ())
++ {
++ fprintf (stderr, "The testcase parent must be our GDB tracer!\n");
++ exit (EXIT_FAILURE);
++ }
++ }
++
++ /* SIGCONT our debugger in the case of our crash as we would deadlock
++ otherwise. */
++
++ atexit (cleanup);
++
++ printf ("Stopping GDB PID %lu.\n", (unsigned long) tracer);
++
++ if (tracer)
++ {
++ i = kill (tracer, SIGSTOP);
++ assert (i == 0);
++ state_wait (tracer, "T (stopped)");
++ }
++
++ /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so
++ they could not trigger the signals before GDB gets unstopped later.
++ Threads get resumed at pthread_cond_wait below. Use `while' loops for
++ protection against spurious pthread_cond_wait wakeups. */
++
++ printf ("Waiting till the threads initialize their TIDs.\n");
++
++ while (thread1_tid == 0)
++ {
++ i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
++ assert (i == 0);
++ }
++
++ while (thread2_tid == 0)
++ {
++ i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
++ assert (i == 0);
++ }
++
++ printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n",
++ (unsigned long) thread1_tid, (unsigned long) thread2_tid,
++ (unsigned long) getpid ());
++
++ errno = 0;
++ i = tgkill (getpid (), thread1_tid, SIGUSR1);
++ assert_perror (errno);
++ assert (i == 0);
++ i = tgkill (getpid (), thread1_tid, SIGUSR2);
++ assert_perror (errno);
++ assert (i == 0);
++ i = tgkill (getpid (), thread2_tid, SIGUSR1);
++ assert_perror (errno);
++ assert (i == 0);
++ i = tgkill (getpid (), thread2_tid, SIGUSR2);
++ assert_perror (errno);
++ assert (i == 0);
++
++ printf ("Waiting till the threads get trapped by the signals.\n");
++
++ if (tracer)
++ {
++ /* s390x-unknown-linux-gnu will fail with "R (running)". */
++
++ state_wait (thread1_tid, "t (tracing stop)");
++
++ state_wait (thread2_tid, "t (tracing stop)");
++ }
++
++ cleanup ();
++
++ printf ("Joining the threads.\n");
++
++ i = pthread_mutex_unlock (&terminate_mutex);
++ assert (i == 0);
++
++ i = pthread_join (thread1, NULL);
++ assert (i == 0);
++
++ i = pthread_join (thread2, NULL);
++ assert (i == 0);
++
++ printf ("Exiting.\n"); /* break-at-exit */
++
++ return EXIT_SUCCESS;
++}
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp 2011-12-19 02:16:35.237720268 +0100
+@@ -0,0 +1,94 @@
++# Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++set testfile "siginfo-threads"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } {
++ return -1
++}
++
++clean_restart $testfile
++
++if ![runto_main] {
++ return -1
++}
++
++# `nostop noprint pass' could in some cases report false PASS due to the
++# (preempt 'handle') code path.
++
++gdb_test "handle SIGUSR1 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
++gdb_test "handle SIGUSR2 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
++
++gdb_breakpoint [gdb_get_line_number "break-at-exit"]
++
++set test "get pid"
++gdb_test_multiple "p getpid ()" $test {
++ -re " = (\[0-9\]+)\r\n$gdb_prompt $" {
++ set pid $expect_out(1,string)
++ pass $test
++ }
++}
++
++for {set sigcount 0} {$sigcount < 4} {incr sigcount} {
++ set test "catch signal $sigcount"
++ set sigusr ""
++ gdb_test_multiple "continue" $test {
++ -re "Program received signal SIGUSR(\[12\]), User defined signal \[12\]\\.\r\n.*\r\n$gdb_prompt $" {
++ set sigusr $expect_out(1,string)
++ pass $test
++ }
++ }
++ if {$sigusr == ""} {
++ return -1
++ }
++
++ set test "signal $sigcount si_signo"
++ if {$sigusr == 1} {
++ set signo 10
++ } else {
++ set signo 12
++ }
++ gdb_test_multiple {p $_siginfo.si_signo} $test {
++ -re " = $signo\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
++ unsupported $test
++ }
++ }
++
++ set test "signal $sigcount si_code is SI_TKILL"
++ gdb_test_multiple {p $_siginfo.si_code} $test {
++ -re " = -6\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
++ unsupported $test
++ }
++ }
++
++ set test "signal $sigcount si_pid"
++ gdb_test_multiple {p $_siginfo._sifields._kill.si_pid} $test {
++ -re " = $pid\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
++ unsupported $test
++ }
++ }
++}
++
++gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*"
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c 2011-12-19 02:16:35.237720268 +0100
+@@ -0,0 +1,54 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2010 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++#include <pthread.h>
++#include <assert.h>
++#include <signal.h>
++
++#include <asm/unistd.h>
++#include <unistd.h>
++#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, (tgid), (tid), (sig))
++#define gettid() syscall (__NR_gettid)
++
++static volatile int var;
++
++static void
++handler (int signo) /* step-0 */
++{ /* step-0 */
++ var++; /* step-1 */
++ tgkill (getpid (), gettid (), SIGUSR1); /* step-2 */
++}
++
++static void *
++start (void *arg)
++{
++ signal (SIGUSR1, handler);
++ tgkill (getpid (), gettid (), SIGUSR1);
++ assert (0);
++
++ return NULL;
++}
++
++int
++main (void)
++{
++ pthread_t thread;
++
++ pthread_create (&thread, NULL, start, NULL);
++ start (NULL); /* main-start */
++ return 0;
++}
+Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp 2011-12-19 02:16:35.237720268 +0100
+@@ -0,0 +1,74 @@
++# Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++set testfile sigstep-threads
++set srcfile ${testfile}.c
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/${executable}
++
++if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ untested ${testfile}.exp
++ return -1
++}
++
++clean_restart $executable
++
++if ![runto_main] {
++ return -1;
++}
++
++# `noprint' would not test the full logic of GDB.
++gdb_test "handle SIGUSR1 nostop print pass" "\r\nSIGUSR1\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
++
++gdb_test_no_output "set scheduler-locking off"
++
++gdb_breakpoint [gdb_get_line_number "step-1"]
++gdb_test_no_output {set $step1=$bpnum}
++gdb_continue_to_breakpoint "step-1" ".* step-1 .*"
++gdb_test_no_output {disable $step1}
++
++# 1 as we are now stopped at the `step-1' label.
++set step_at 1
++for {set i 0} {$i < 100} {incr i} {
++ set test "step $i"
++ # Presume this step failed - as in the case of a timeout.
++ set failed 1
++ gdb_test_multiple "step" $test {
++ -re "\r\nProgram received signal SIGUSR1, User defined signal 1.\r\n" {
++ exp_continue -continue_timer
++ }
++ -re "step-(\[012\]).*\r\n$gdb_prompt $" {
++ set now $expect_out(1,string)
++ if {$step_at == 2 && $now == 1} {
++ set failed 0
++ } elseif {$step_at == 1 && $now == 2} {
++ set failed 0
++ # Continue over the re-signalling back to the handle entry.
++ gdb_test_no_output {enable $step1} ""
++ gdb_test "continue" " step-1 .*" ""
++ set now 1
++ gdb_test_no_output {disable $step1} ""
++ } else {
++ fail $test
++ }
++ set step_at $now
++ }
++ }
++ if $failed {
++ return
++ }
++}
++# We can never reliably say the racy problematic case has been tested.
++pass "step"
diff --git a/gdb-bz623749-gcore-relro.patch b/gdb-bz623749-gcore-relro.patch
new file mode 100644
index 0000000..4015a7a
--- /dev/null
+++ b/gdb-bz623749-gcore-relro.patch
@@ -0,0 +1,169 @@
+gdb:
+https://bugzilla.redhat.com/show_bug.cgi?id=623749
+kernel:
+https://bugzilla.redhat.com/show_bug.cgi?id=636937
+
+http://sourceware.org/ml/gdb-patches/2010-09/msg00395.html
+Subject: Re: [patch] Fix gcore writer for -Wl,-z,relro (PR corefiles/11804)
+
+gdb/testsuite/
+2010-09-22 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Fix gcore writer for -Wl,-z,relro.
+ * gdb.base/gcore-relro.exp: New file.
+ * gdb.base/gcore-relro-main.c: New file.
+ * gdb.base/gcore-relro-lib.c: New file.
+
+--- ./gdb/gcore.c 2010-09-23 20:14:56.000000000 +0200
++++ ./gdb/gcore.c 2010-09-23 20:37:56.000000000 +0200
+@@ -401,6 +401,7 @@ gcore_create_callback (CORE_ADDR vaddr,
+
+ if (write == 0 && !solib_keep_data_in_core (vaddr, size))
+ {
++#if 0 /* https://bugzilla.redhat.com/show_bug.cgi?id=636937 */
+ /* See if this region of memory lies inside a known file on disk.
+ If so, we can avoid copying its contents by clearing SEC_LOAD. */
+ struct objfile *objfile;
+@@ -433,6 +434,7 @@ gcore_create_callback (CORE_ADDR vaddr,
+ }
+
+ keep:
++#endif
+ flags |= SEC_READONLY;
+ }
+
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro-lib.c
+@@ -0,0 +1,21 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++void
++lib (void)
++{
++}
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro-main.c
+@@ -0,0 +1,25 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++extern void lib (void);
++
++int
++main (void)
++{
++ lib ();
++ return 0;
++}
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro.exp
+@@ -0,0 +1,80 @@
++# Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++if {[skip_shlib_tests]} {
++ return 0
++}
++
++set testfile "gcore-relro"
++set srcmainfile ${testfile}-main.c
++set srclibfile ${testfile}-lib.c
++set libfile ${objdir}/${subdir}/${testfile}-lib.so
++set objfile ${objdir}/${subdir}/${testfile}-main.o
++set executable ${testfile}-main
++set binfile ${objdir}/${subdir}/${executable}
++set gcorefile ${objdir}/${subdir}/${executable}.gcore
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} {debug}] != ""
++ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
++ untested ${testfile}.exp
++ return -1
++}
++set opts [list debug shlib=${libfile} additional_flags=-Wl,-z,relro]
++if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
++ unsupported "-Wl,-z,relro compilation failed"
++ return -1
++}
++
++clean_restart $executable
++gdb_load_shlibs $libfile
++
++# Does this gdb support gcore?
++set test "help gcore"
++gdb_test_multiple $test $test {
++ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
++ # gcore command not supported -- nothing to test here.
++ unsupported "gdb does not support gcore on this target"
++ return -1;
++ }
++ -re "Save a core file .*\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
++if { ![runto lib] } then {
++ return -1
++}
++
++set escapedfilename [string_to_regexp ${gcorefile}]
++
++set test "save a corefile"
++gdb_test_multiple "gcore ${gcorefile}" $test {
++ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "Can't create a corefile\r\n$gdb_prompt $" {
++ unsupported $test
++ return -1
++ }
++}
++
++# Now restart gdb and load the corefile.
++
++clean_restart $executable
++gdb_load_shlibs $libfile
++
++gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
++
++gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch
new file mode 100644
index 0000000..a421367
--- /dev/null
+++ b/gdb-core-open-vdso-warning.patch
@@ -0,0 +1,84 @@
+http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
+Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
+
+Hi,
+
+GDB currently always prints on loading a core file:
+ warning: Can't read pathname for load map: Input/output error.
+
+The patch is not nice but it was WONTFIXed on the glibc side in:
+ http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html
+
+The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name
+but that one is now ignored thanks to IGNORE_FIRST_LINK_MAP_ENTRY.
+
+This fix is intended for Linux system vDSO l_name which is a second entry in
+the DSO list.
+
+Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-10-06 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Do not print false warning on reading core file with vDSO on GNU/Linux.
+ * solib-svr4.c (svr4_current_sos): Suppress the warning if
+ MASTER_SO_LIST is still NULL.
+ * solib.c (update_solib_list): New variable saved_so_list_head.
+ Conditionally restart the function.
+
+[ Context backport. ]
+
+Index: gdb-7.4.50.20111218/gdb/solib-svr4.c
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/solib-svr4.c 2011-12-19 01:14:31.000000000 +0100
++++ gdb-7.4.50.20111218/gdb/solib-svr4.c 2011-12-19 01:31:10.106752164 +0100
+@@ -1222,8 +1222,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
+ SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+ if (errcode != 0)
+ {
+- warning (_("Can't read pathname for load map: %s."),
+- safe_strerror (errcode));
++ /* During the first ever DSO list reading some strings may be
++ unreadable as residing in the ld.so readonly memory not being
++ present in a dumped core file. Delay the error check after
++ the first pass of DSO list scanning when ld.so should be
++ already mapped in and all the DSO list l_name memory gets
++ readable. */
++
++ if (master_so_list () != NULL)
++ warning (_("Can't read pathname for load map: %s."),
++ safe_strerror (errcode));
++
+ do_cleanups (old_chain);
+ continue;
+ }
+Index: gdb-7.4.50.20111218/gdb/solib.c
+===================================================================
+--- gdb-7.4.50.20111218.orig/gdb/solib.c 2011-09-12 21:00:22.000000000 +0200
++++ gdb-7.4.50.20111218/gdb/solib.c 2011-12-19 01:29:04.815227898 +0100
+@@ -676,6 +676,7 @@ update_solib_list (int from_tty, struct
+ struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct so_list *inferior = ops->current_sos();
+ struct so_list *gdb, **gdb_link;
++ struct so_list *saved_so_list_head = so_list_head;
+
+ /* We can reach here due to changing solib-search-path or the
+ sysroot, before having any inferior. */
+@@ -817,6 +818,12 @@ update_solib_list (int from_tty, struct
+ observer_notify_solib_loaded (i);
+ }
+
++ /* If this was the very first DSO list scan and we possibly read in ld.so
++ recheck all the formerly unreadable DSO names strings. */
++
++ if (saved_so_list_head == NULL && so_list_head != NULL)
++ return update_solib_list (from_tty, target);
++
+ /* If a library was not found, issue an appropriate warning
+ message. We have to use a single call to warning in case the
+ front end does something special with warnings, e.g., pop up
diff --git a/gdb-follow-child-stale-parent.patch b/gdb-follow-child-stale-parent.patch
new file mode 100644
index 0000000..336790c
--- /dev/null
+++ b/gdb-follow-child-stale-parent.patch
@@ -0,0 +1,27 @@
+Problem occurs with python and its get_current_arch () as it selects
+selected_frame and current_frame while still inferior_ptid is valid for the
+original parent. But since this place it is already attached and later
+unwinders try to access it, breaking:
+ -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
+ -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
+ -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
+ -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
+ -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
+ +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
+ +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
+ +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
+ +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
+ +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
+
+--- ./gdb/infrun.c 2009-12-21 20:26:30.000000000 +0100
++++ ./gdb/infrun.c 2009-12-21 20:26:11.000000000 +0100
+@@ -375,6 +375,9 @@ follow_fork (void)
+ }
+ else
+ {
++ /* Possibly referenced PARENT is no longer valid. */
++ reinit_frame_cache ();
++
+ /* This pending follow fork event is now handled, one way
+ or another. The previous selected thread may be gone
+ from the lists by now, but if it is still around, need
diff --git a/gdb-gdb-add-index-script.patch b/gdb-gdb-add-index-script.patch
new file mode 100644
index 0000000..c15df68
--- /dev/null
+++ b/gdb-gdb-add-index-script.patch
@@ -0,0 +1,118 @@
+http://sourceware.org/ml/gdb-patches/2010-07/msg00184.html
+Subject: Re: [0/4] RFC: add DWARF index support
+
+Jan Kratochvil: Fixed $d -> $dir.
+Jan Kratochvil: Remove /dev/null redirection.
+
+>>>>> "Tom" == Tom Tromey <tromey at redhat.com> writes:
+
+Tom> This patch series adds support for a DWARF index to gdb.
+
+Roland suggested we wrap up the index-creation code into a helper
+script.
+
+I'm not sure if this is something people would want in gdb proper, but I
+figured I would send it here just in case.
+
+Tom
+
+2010-07-09 Tom Tromey <tromey at redhat.com>
+
+ * Makefile.in (install-only): Install gdb-add-index.
+ * gdb-add-index: New file.
+
+2010-07-09 Tom Tromey <tromey at redhat.com>
+
+ * gdb.texinfo (Index Files): Mention gdb-add-index.
+
+>From 30714fe719e61baea03d0dc5793eb0d564faebb7 Mon Sep 17 00:00:00 2001
+From: Tom Tromey <tromey at redhat.com>
+Date: Fri, 9 Jul 2010 11:17:54 -0600
+Subject: [PATCH 4/4] add gdb-add-index
+Subject: [PATCH 4/4] add gdb-add-index
+
+---
+ gdb/ChangeLog | 5 +++++
+ gdb/Makefile.in | 11 ++++++++++-
+ gdb/doc/ChangeLog | 4 ++++
+ gdb/doc/gdb.texinfo | 8 ++++++++
+ gdb/gdb-add-index | 30 ++++++++++++++++++++++++++++++
+ 5 files changed, 57 insertions(+), 1 deletions(-)
+ create mode 100755 gdb/gdb-add-index
+
+Index: gdb-7.4.50.20120103/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; \
++ transformed_name=`t='$(program_transform_name)'; \
++ echo gdb-add-index | sed -e "$$t"` ; \
++ if test "x$$transformed_name" = x; then \
++ transformed_name=gdb-add-index ; \
++ else \
++ true ; \
++ fi ; \
++ $(INSTALL_PROGRAM) $(srcdir)/gdb-add-index \
++ $(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
+===================================================================
+--- 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
+ for DWARF debugging information, not stabs. And, they do not
+ currently work for programs using Ada.
+
++ at value{GDBN} comes with a program, @command{gdb-add-index}, which can
++be used to add the index to a symbol file. It takes the symbol file
++as its only argument:
++
++ at smallexample
++$ gdb-add-index symfile
++ at end smallexample
++
+ @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
++
++# Add a .gdb_index section to a file.
++
++# 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/>.
++
++file="$1"
++dir="${file%/*}"
++
++# We don't care if gdb gives an error.
++gdb -nx --batch-silent -ex "file $file" -ex "save gdb-index $dir"
++
++if test -f "${file}.gdb-index"; then
++ objcopy --add-section .gdb_index="${file}.gdb-index" --set-section-flags .gdb_index=readonly "$file" "$file"
++ rm -f "${file}.gdb-index"
++fi
++
++exit 0
diff --git a/gdb-glibc-vdso-workaround.patch b/gdb-glibc-vdso-workaround.patch
new file mode 100644
index 0000000..48646d7
--- /dev/null
+++ b/gdb-glibc-vdso-workaround.patch
@@ -0,0 +1,30 @@
+http://sourceware.org/ml/gdb-patches/2011-08/msg00331.html
+Subject: [RFC] Work around PR libc/13097 "linux-vdso.so.1" #2
+
+Hi,
+
+missed the x86_64-m32 case:
+
+gdb/
+2011-08-16 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ Work around PR libc/13097.
+ * solib.c (update_solib_list): Ignore "linux-vdso.so.1".
+
+--- a/gdb/solib.c
++++ b/gdb/solib.c
+@@ -783,8 +783,11 @@ update_solib_list (int from_tty, struct target_ops *target)
+
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
+- /* Fill in the rest of the `struct so_list' node. */
+- if (!solib_map_sections (i))
++ /* Fill in the rest of the `struct so_list' node.
++ Work around PR libc/13097. */
++ if (!solib_map_sections (i)
++ && strcmp (i->so_original_name, "linux-vdso.so.1") != 0
++ && strcmp (i->so_original_name, "linux-gate.so.1") != 0)
+ {
+ not_found++;
+ if (not_found_filename == NULL)
+
diff --git a/gdb-moribund-utrace-workaround.patch b/gdb-moribund-utrace-workaround.patch
new file mode 100644
index 0000000..6b50a8e
--- /dev/null
+++ b/gdb-moribund-utrace-workaround.patch
@@ -0,0 +1,16 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=590623
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593
+
+Bug in FSF GDB exploited by the ptrace-on-utrace interaction.
+
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -9084,6 +9084,8 @@ update_global_location_list (int should_insert)
+ traps we can no longer explain. */
+
+ old_loc->events_till_retirement = 3 * (thread_count () + 1);
++ /* Red Hat Bug 590623. */
++ old_loc->events_till_retirement *= 10;
+ old_loc->owner = NULL;
+
+ VEC_safe_push (bp_location_p, moribund_locations, old_loc);
diff --git a/gdb-x86-onstack-2of2.patch b/gdb-x86-onstack-2of2.patch
new file mode 100644
index 0000000..a49904a
--- /dev/null
+++ b/gdb-x86-onstack-2of2.patch
@@ -0,0 +1,166 @@
+http://sourceware.org/ml/gdb-patches/2012-03/msg00358.html
+Subject: [patch 2/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5
+
+Hi,
+
+here is the ON_STACK code again, with fixed alignment for i386 SSE.
+
+It is generalized for all OSes on i386/amd64. I can move it to
+{i386,amd64)-linux-tdep.c but I find this code much more lightweight than
+i386_push_dummy_call which is already present in i386-tdep.
+
+No regressions on
+{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for
+gdbsever non-extended mode.
+
+For x86_64-fedora17-linux-gnu it fixes:
+-FAIL: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
+-FAIL: gdb.cp/gdb2495.exp: bt after returning from a popped frame
++PASS: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
++PASS: gdb.cp/gdb2495.exp: bt after returning from a popped frame
+
+
+Thanks,
+Jan
+
+
+gdb/
+2012-03-09 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * amd64-dicos-tdep.c (amd64_dicos_push_dummy_code): Remove.
+ (amd64_dicos_init_abi): Remove its installment.
+ * dicos-tdep.c (dicos_init_abi): Remove the
+ set_gdbarch_call_dummy_location call. Update the comment here.
+ * i386-dicos-tdep.c (i386_dicos_push_dummy_code): Remove.
+ (i386_dicos_init_abi): Remove its installment.
+ * i386-tdep.c (i386_push_dummy_code): New function.
+ (i386_gdbarch_init): Call set_gdbarch_call_dummy_location, install
+ i386_push_dummy_code.
+
+--- a/gdb/amd64-dicos-tdep.c
++++ b/gdb/amd64-dicos-tdep.c
+@@ -23,24 +23,6 @@
+ #include "amd64-tdep.h"
+ #include "dicos-tdep.h"
+
+-static CORE_ADDR
+-amd64_dicos_push_dummy_code (struct gdbarch *gdbarch,
+- CORE_ADDR sp, CORE_ADDR funaddr,
+- struct value **args, int nargs,
+- struct type *value_type,
+- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+- struct regcache *regcache)
+-{
+- int bplen;
+- CORE_ADDR bppc = sp;
+-
+- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
+- *bp_addr = sp - bplen;
+- *real_pc = funaddr;
+-
+- return *bp_addr;
+-}
+-
+ static void
+ amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ {
+@@ -49,8 +31,6 @@ amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ amd64_init_abi (info, gdbarch);
+
+ dicos_init_abi (gdbarch);
+-
+- set_gdbarch_push_dummy_code (gdbarch, amd64_dicos_push_dummy_code);
+ }
+
+ static enum gdb_osabi
+--- a/gdb/dicos-tdep.c
++++ b/gdb/dicos-tdep.c
+@@ -43,8 +43,8 @@ dicos_init_abi (struct gdbarch *gdbarch)
+
+ /* There's no (standard definition of) entry point or a guaranteed
+ text location with a symbol where to place the call dummy, so we
+- put it on the stack. */
+- set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
++ need it on the stack. Rely on i386_gdbarch_init used also for
++ amd64 to set up ON_STACK inferior calls. */
+
+ /* DICOS rewinds the PC itself. */
+ set_gdbarch_decr_pc_after_break (gdbarch, 0);
+--- a/gdb/i386-dicos-tdep.c
++++ b/gdb/i386-dicos-tdep.c
+@@ -22,32 +22,12 @@
+ #include "gdb_string.h"
+ #include "dicos-tdep.h"
+
+-static CORE_ADDR
+-i386_dicos_push_dummy_code (struct gdbarch *gdbarch,
+- CORE_ADDR sp, CORE_ADDR funaddr,
+- struct value **args, int nargs,
+- struct type *value_type,
+- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+- struct regcache *regcache)
+-{
+- int bplen;
+- CORE_ADDR bppc = sp;
+-
+- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
+- *bp_addr = sp - bplen;
+- *real_pc = funaddr;
+-
+- return *bp_addr;
+-}
+-
+ static void
+ i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ {
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ dicos_init_abi (gdbarch);
+-
+- set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code);
+ }
+
+ static enum gdb_osabi
+--- a/gdb/i386-tdep.c
++++ b/gdb/i386-tdep.c
+@@ -2326,6 +2326,30 @@ i386_16_byte_align_p (struct type *type)
+ return 0;
+ }
+
++/* Implementation for set_gdbarch_push_dummy_code. */
++
++static CORE_ADDR
++i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
++ struct value **args, int nargs, struct type *value_type,
++ CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
++ struct regcache *regcache)
++{
++ int bplen;
++ CORE_ADDR bppc = sp;
++
++ gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
++ sp -= bplen;
++
++ /* amd64_push_dummy_call does alignment on its own but i386_push_dummy_call
++ does not. ABI requires stack alignment for executables using SSE. */
++ if (gdbarch_frame_align_p (gdbarch))
++ sp = gdbarch_frame_align (gdbarch, sp);
++
++ *bp_addr = sp;
++ *real_pc = funaddr;
++ return sp;
++}
++
+ static CORE_ADDR
+ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+@@ -7372,6 +7396,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+ set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
+
+ /* Call dummy code. */
++ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
++ set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code);
+ set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
+ set_gdbarch_frame_align (gdbarch, i386_frame_align);
+
+
diff --git a/gdb-x86_64-i386-syscall-restart.patch b/gdb-x86_64-i386-syscall-restart.patch
new file mode 100644
index 0000000..d5d6b10
--- /dev/null
+++ b/gdb-x86_64-i386-syscall-restart.patch
@@ -0,0 +1,121 @@
+http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
+Subject: [patch] Fix syscall restarts for amd64->i386 biarch
+
+Hi,
+
+tested only on recent Linux kernels, it should apply also on vanilla ones.
+There were various changes of the kernels behavior in the past.
+
+FSF GDB HEAD state:
+kernel debugger inferior state
+x86_64 x86_64 x86_64 PASS
+x86_64 x86_64 i386 FAIL without this patch, PASS with this patch
+x86_64 i386 i386 PASS on recent kernels
+ (FAIL: kernel-2.6.31.5-127.fc12.x86_64 - Fedora 12)
+ (PASS: kernel-2.6.32-0.55.rc8.git1.fc13.x86_64)
+i386 i386 i386 PASS
+
+
+Currently gdb.base/interrupt.exp fails on amd64 host running under
+--target_board unix/-m32 with:
+ continue
+ Continuing.
+ Unknown error 512
+
+<linux/errno.h>:
+/*
+ * These should never be seen by user programs. To return one of ERESTART*
+ * codes, signal_pending() MUST be set. Note that ptrace can observe these
+ * at syscall exit tracing, but they will never be left for the debugged user
+ * process to see.
+ */
+#define ERESTARTSYS 512
+
+"Unknown error 512" printed above is printed by the inferior itself, not by GDB.
+
+It is because GDB reads it as 0xfffffffffffffe00 but writes it back as
+0xfffffe00.
++ /* Sign-extend %eax as during return from a syscall it is being checked
++ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
++ interrupt.exp. */
+
+
+Quote of Roland McGrath from IRC:
+
+roland: in the user_regset model, there are 64-bit user_regset flavors and
+32-bit user_regset flavors, so at the kabi level the (kernel) caller can say
+what it means: calls on the 32-bit user_regset flavor will behave as if on
+a 32-bit kernel/userland. in ptrace, there is no way for x86_64 ptrace calls
+to say "i think of the inferior as being 32 bits, so act accordingly" (tho ppc
+and/or sparc have ptr
+roland: ace requests that do that iirc)
+roland: ergo 64-bit ptrace callers must either save/restore full 64-bits so
+the kernel's sign-extension choices are preserved, or else grok magic ways to
+expand stored 32-bit register contents to 64-bit values to stuff via 64-bit
+ptrace
+[...]
+roland: there is a "32-bit-flavored task", but it's not really true that it
+has 32-bit registers. there is no 32-bit-only userland condition. any task
+can always ljmp to the 64-bit code segment and run 64-bit insns including
+a 64-bit syscall
+roland: so a 64-bit debugger should see and be able to fiddle the full
+registers. it can even change cs via ptrace to force the inferior into
+running 32 or 64 bit code.
+
+
+Saving whole 64bits for i386 targets on x86_64 hosts does not much match the
+GDB architecture as `struct type' for these registers still should be 32bit
+etc. Therefore provided just this exception.
+
+The problem is reproducible only if one does an inferior call during the
+interruption to do full inferior save/restore from GDB regcache.
+
+Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-11-29 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * amd64-nat.c (amd64_collect_native_gregset): Do not pre-clear %eax.
+ Sign extend it afterwards.
+
+--- a/gdb/amd64-nat.c
++++ b/gdb/amd64-nat.c
+@@ -131,9 +131,9 @@ amd64_collect_native_gregset (const struct regcache *regcache,
+ {
+ num_regs = amd64_native_gregset32_num_regs;
+
+- /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
++ /* Make sure %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
+ %eip get zero-extended to 64 bits. */
+- for (i = 0; i <= I386_EIP_REGNUM; i++)
++ for (i = I386_ECX_REGNUM; i <= I386_EIP_REGNUM; i++)
+ {
+ if (regnum == -1 || regnum == i)
+ memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8);
+@@ -159,4 +159,20 @@ amd64_collect_native_gregset (const struct regcache *regcache,
+ regcache_raw_collect (regcache, i, regs + offset);
+ }
+ }
++
++ if (gdbarch_ptr_bit (gdbarch) == 32)
++ {
++ /* Sign-extend %eax as during return from a syscall it is being checked
++ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
++ interrupt.exp. */
++
++ int i = I386_EAX_REGNUM;
++
++ if (regnum == -1 || regnum == i)
++ {
++ void *ptr = regs + amd64_native_gregset_reg_offset (gdbarch, i);
++
++ *(int64_t *) ptr = *(int32_t *) ptr;
++ }
++ }
+ }
+
diff --git a/insight-7.4.50-acversion.patch b/insight-7.4.50-acversion.patch
new file mode 100644
index 0000000..003d334
--- /dev/null
+++ b/insight-7.4.50-acversion.patch
@@ -0,0 +1,52 @@
+diff -Naur insight-7.4.50.orig/configure.ac insight-7.4.50.new/configure.ac
+--- insight-7.4.50.orig/configure.ac 2012-04-04 13:22:48.312226132 +0200
++++ insight-7.4.50.new/configure.ac 2012-04-04 14:19:23.730616695 +0200
+@@ -19,6 +19,10 @@
+ ##############################################################################
+ ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
+
++m4_define([_GCC_AUTOCONF_VERSION],
++ m4_bpatsubst(m4_esyscmd([autoconf --version | sed -e 's/.* //' -e 'q']),[
++]))
++
+ m4_include(config/acx.m4)
+ m4_include(config/override.m4)
+ m4_include(config/proginstall.m4)
+diff -Naur insight-7.4.50.orig/gdb/configure.ac insight-7.4.50.new/gdb/configure.ac
+--- insight-7.4.50.orig/gdb/configure.ac 2012-04-04 13:22:48.300226658 +0200
++++ insight-7.4.50.new/gdb/configure.ac 2012-04-04 14:25:03.894758422 +0200
+@@ -18,6 +18,10 @@
+
+ dnl Process this file with autoconf to produce a configure script.
+
++m4_define([_GCC_AUTOCONF_VERSION],
++ m4_bpatsubst(m4_esyscmd([autoconf --version | sed -e 's/.* //' -e 'q']),[
++]))
++
+ AC_PREREQ(2.59)dnl
+ AC_INIT(main.c)
+ AC_CONFIG_HEADER(config.h:config.in)
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/plugins/configure.ac insight-7.4.50.new/gdb/gdbtk/plugins/configure.ac
+--- insight-7.4.50.orig/gdb/gdbtk/plugins/configure.ac 2008-08-03 00:08:32.000000000 +0200
++++ insight-7.4.50.new/gdb/gdbtk/plugins/configure.ac 2012-04-04 14:21:58.995835436 +0200
+@@ -1,3 +1,7 @@
++m4_define([_GCC_AUTOCONF_VERSION],
++ m4_bpatsubst(m4_esyscmd([autoconf --version | sed -e 's/.* //' -e 'q']),[
++]))
++
+ AC_INIT(Make-rules)
+ AC_CONFIG_AUX_DIR(../../..)
+ AM_INIT_AUTOMAKE(insight, 1.0)
+diff -Naur insight-7.4.50.orig/libgui/configure.ac insight-7.4.50.new/libgui/configure.ac
+--- insight-7.4.50.orig/libgui/configure.ac 2008-08-03 01:33:36.000000000 +0200
++++ insight-7.4.50.new/libgui/configure.ac 2012-04-04 14:23:31.101812062 +0200
+@@ -1,5 +1,9 @@
+ dnl Process this file with autoconf to produce configure.
+
++m4_define([_GCC_AUTOCONF_VERSION],
++ m4_bpatsubst(m4_esyscmd([autoconf --version | sed -e 's/.* //' -e 'q']),[
++]))
++
+ AC_INIT(src/subcommand.h)
+ AM_INIT_AUTOMAKE(libgui, 0.0)
+ AM_CONFIG_HEADER(config.h)
diff --git a/insight-7.4.50-bz216711-clone-is-outermost.patch b/insight-7.4.50-bz216711-clone-is-outermost.patch
new file mode 100644
index 0000000..7bee04c
--- /dev/null
+++ b/insight-7.4.50-bz216711-clone-is-outermost.patch
@@ -0,0 +1,418 @@
+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 @@
+
+ /* Set the program counter for process PTID to PC. */
+
++/* Detect the outermost frame; during unwind of
++ #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6
++ avoid the additional bogus frame
++ #6 0x0000000000000000 in ??
++ We compare if the `linux_clone_code' block is _before_ unwound PC. */
++
++static const unsigned char linux_clone_code[] =
++{
++/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */
++/* #ifdef RESET_PID */
++/* ... */
++/* mov $SYS_ify(getpid), %eax */
++/* 0xb8, 0x27, 0x00, 0x00, 0x00 */
++/* OR */
++/* mov $SYS_ify(getpid), %rax */
++/* 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00 */
++/* so just: */
++ 0x27, 0x00, 0x00, 0x00,
++/* syscall */
++ 0x0f, 0x05,
++/* movl %eax, %fs:PID */
++ 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00,
++/* movl %eax, %fs:TID */
++ 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00,
++/* #endif */
++/* |* Set up arguments for the function call. *| */
++/* popq %rax |* Function to call. *| */
++ 0x58,
++/* popq %rdi |* Argument. *| */
++ 0x5f,
++/* call *%rax$ */
++ 0xff, 0xd0
++};
++
++#define LINUX_CLONE_LEN (sizeof linux_clone_code)
++
++static int
++amd64_linux_clone_running (struct frame_info *this_frame)
++{
++ CORE_ADDR pc = get_frame_pc (this_frame);
++ unsigned char buf[LINUX_CLONE_LEN];
++
++ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_LEN, buf,
++ LINUX_CLONE_LEN))
++ return 0;
++
++ if (memcmp (buf, linux_clone_code, LINUX_CLONE_LEN) != 0)
++ return 0;
++
++ return 1;
++}
++
++static int
++amd64_linux_outermost_frame (struct frame_info *this_frame)
++{
++ CORE_ADDR pc = get_frame_pc (this_frame);
++ const char *name;
++
++ find_pc_partial_function (pc, &name, NULL, NULL);
++
++ /* If we have NAME, we can optimize the search.
++ `clone' NAME still needs to have the code checked as its name may be
++ present in the user code.
++ `__clone' NAME should not be present in the user code but in the initial
++ parts of the `__clone' implementation the unwind still makes sense.
++ More detailed unwinding decision would be too much sensitive to possible
++ subtle changes in specific glibc revisions. */
++ if (name == NULL || strcmp (name, "clone") == 0
++ || strcmp ("__clone", name) == 0)
++ return (amd64_linux_clone_running (this_frame) != 0);
++
++ return 0;
++}
++
+ static void
+ amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
+ {
+@@ -1321,6 +1395,8 @@
+
+ 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 @@
+ {
+ struct amd64_frame_cache *cache =
+ amd64_frame_cache (this_frame, this_cache);
++ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
+
+ if (!cache->base_p)
+ return UNWIND_UNAVAILABLE;
+@@ -2116,6 +2117,10 @@
+ if (cache->base == 0)
+ return UNWIND_OUTERMOST;
+
++ /* Detect OS dependent outermost frames; such as `clone'. */
++ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
++ return UNWIND_OUTERMOST;
++
+ return UNWIND_NO_REASON;
+ }
+
+@@ -2125,6 +2130,7 @@
+ {
+ struct amd64_frame_cache *cache =
+ amd64_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);
+ }
+
+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 @@
+
+ tdep->xsave_xcr0_offset = -1;
+
++ /* Unwinding stops on i386 automatically. */
++ tdep->outermost_frame_p = NULL;
++
+ 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 @@
+ int (*i386_sysenter_record) (struct regcache *regcache);
+ /* Parse syscall args. */
+ int (*i386_syscall_record) (struct regcache *regcache);
++
++ /* Detect OS dependent outermost frames; such as `clone'. */
++ int (*outermost_frame_p) (struct frame_info *this_frame);
+ };
+
+ /* 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 @@
+ default_frame_sniffer
+ };
+
++/* Detect the outermost frame; during unwind of
++ #6 0x2000000000347100 in __clone2 () from /lib/libc.so.6.1
++ avoid the additional bogus frame
++ #7 0x0000000000000000 in ?? () */
++
++static char linux_clone2_code[] =
++{
++/* libc/sysdeps/unix/sysv/linux/ia64/clone2.S */
++ 0x09, 0x00, 0x20, 0x12, 0x90, 0x11, 0x00, 0x40,
++ 0x28, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
++/* st4 [r9]=r8 */
++/* st4 [r10]=r8 */
++/* ;; */
++/* #endif */
++ 0x02, 0x50, 0x21, 0x40, 0x18, 0x14, 0x90, 0x02,
++ 0x90, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
++/* 1: ld8 out1=[in0],8 |* Retrieve code pointer. *| */
++/* mov out0=in4 |* Pass proper argument to fn *| */
++/* ;; */
++ 0x11, 0x08, 0x00, 0x40, 0x18, 0x10, 0x60, 0x50,
++ 0x05, 0x80, 0x03, 0x00, 0x68, 0x00, 0x80, 0x12,
++/* ld8 gp=[in0] |* Load function gp. *| */
++/* mov b6=out1 */
++/* br.call.dptk.many rp=b6 |* Call fn(arg) in the child *| */
++/* ;; */
++ 0x10, 0x48, 0x01, 0x10, 0x00, 0x21, 0x10, 0x00,
++ 0xa0, 0x00, 0x42, 0x00, 0x98, 0xdf, 0xf7, 0x5b,
++/* mov out0=r8 |* Argument to _exit *| */
++/* mov gp=loc0 */
++/* .globl HIDDEN_JUMPTARGET(_exit) */
++/* br.call.dpnt.many rp=HIDDEN_JUMPTARGET(_exit) */
++/* |* call _exit with result from fn. *| */
++ 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
++ 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x84, 0x00
++/* ret |* Not reached. *| */
++};
++
++#define LINUX_CLONE_PRE_SLOTS 3 /* Number of slots before PC. */
++#define LINUX_CLONE_LEN (sizeof linux_clone2_code)
++
++static int
++ia64_linux_clone2_running (struct frame_info *this_frame)
++{
++ CORE_ADDR pc = get_frame_pc (this_frame);
++ char buf[LINUX_CLONE_LEN];
++ struct minimal_symbol *minsym;
++ long long instr;
++
++ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_PRE_SLOTS * 16,
++ buf, LINUX_CLONE_LEN))
++ return 0;
++
++ if (memcmp (buf, linux_clone2_code, LINUX_CLONE_PRE_SLOTS * 16) != 0)
++ return 0;
++
++ /* Adjust the expected "_exit" address. */
++ minsym = lookup_minimal_symbol_text ("_exit", NULL);
++ if (minsym == NULL)
++ return 0;
++
++ instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
++ instr &= ~(((1L << 20) - 1) << 13);
++ /* Address is relative to the jump instruction slot, not the next one. */
++ instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
++ & ((1L << 20) - 1)) << 13;
++ replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
++ 2);
++
++ if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
++ &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],
++ LINUX_CLONE_LEN - (LINUX_CLONE_PRE_SLOTS * 16)) != 0)
++ return 0;
++
++ return 1;
++}
++
++static int
++ia64_outermost_frame (struct frame_info *this_frame)
++{
++ CORE_ADDR pc = get_frame_pc (this_frame);
++ char *name;
++
++ find_pc_partial_function (pc, &name, NULL, NULL);
++
++ /* If we have NAME, we can optimize the search.
++ `clone' NAME still needs to have the code checked as its name may be
++ present in the user code.
++ `__clone' NAME should not be present in the user code but in the initial
++ parts of the `__clone' implementation the unwind still makes sense.
++ More detailed unwinding decision would be too much sensitive to possible
++ subtle changes in specific glibc revisions. */
++ if (name == NULL || strcmp (name, "clone2") == 0
++ || strcmp ("__clone2", name) == 0)
++ return (ia64_linux_clone2_running (this_frame) != 0);
++
++ return 0;
++}
++
++static void
++ia64_clone2_frame_this_id (struct frame_info *this_frame, void **this_cache,
++ struct frame_id *this_id)
++{
++ /* Leave the default outermost frame at *THIS_ID. */
++}
++
++static struct value *
++ia64_clone2_frame_prev_register (struct frame_info *this_frame,
++ void **this_cache, int regnum)
++{
++ return frame_unwind_got_register (this_frame, regnum, regnum);
++}
++
++static int
++ia64_clone2_frame_sniffer (const struct frame_unwind *self,
++ struct frame_info *this_frame,
++ void **this_prologue_cache)
++{
++ if (ia64_outermost_frame (this_frame))
++ return 1;
++
++ return 0;
++}
++
++static const struct frame_unwind ia64_clone2_frame_unwind =
++{
++ NORMAL_FRAME,
++ &ia64_clone2_frame_this_id,
++ &ia64_clone2_frame_prev_register,
++ NULL,
++ &ia64_clone2_frame_sniffer
++};
++
+ /* Signal trampolines. */
+
+ static void
+@@ -4152,6 +4284,7 @@
+ set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
+
+ set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
++ frame_unwind_append_unwinder (gdbarch, &ia64_clone2_frame_unwind);
+ #ifdef HAVE_LIBUNWIND_IA64_H
+ frame_unwind_append_unwinder (gdbarch,
+ &ia64_libunwind_sigtramp_frame_unwind);
+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
+@@ -0,0 +1,39 @@
++/* 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., 51 Franklin Street, Fifth Floor, Boston,
++ MA 02110-1301, USA. */
++
++
++#include <pthread.h>
++#include <unistd.h>
++#include <assert.h>
++
++
++void *threader (void *arg)
++{
++ assert (0);
++ return NULL;
++}
++
++int main (void)
++{
++ pthread_t t1;
++
++ pthread_create (&t1, NULL, threader, (void *) NULL);
++ 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
+@@ -0,0 +1,61 @@
++# 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.
++
++# Backtraced `clone' must not have `PC == 0' as its previous frame.
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++set testfile bt-clone-stop
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# threader: threader.c:8: threader: Assertion `0' failed.
++# Program received signal SIGABRT, Aborted.
++
++gdb_test "run" \
++ "Program received signal SIGABRT.*" \
++ "run"
++
++# Former gdb unwind (the first function is `clone'):
++# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
++# #6 0x0000000000000000 in ?? ()
++# (gdb)
++# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'.
++#
++# Two `-re' cases below must be in this order (1st is a subset of the 2nd one).
++# Unhandled case below should not happen and it is fortunately handled by
++# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid').
++gdb_test_multiple "bt" "0x0 entry output invalid" {
++ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
++ fail "0x0 entry found"
++ }
++ -re "in threader \\(.*$gdb_prompt $" {
++ pass "0x0 entry not found"
++ }
++}
diff --git a/insight-7.4.50-bz541866-rwatch-before-run.patch b/insight-7.4.50-bz541866-rwatch-before-run.patch
new file mode 100644
index 0000000..6d84107
--- /dev/null
+++ b/insight-7.4.50-bz541866-rwatch-before-run.patch
@@ -0,0 +1,145 @@
+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 \
+ proc-service.o linux-thread-db.o linux-fork.o \
+ linux-procfs.o linux-ptrace.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
+@@ -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 \
+ 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
+@@ -0,0 +1,28 @@
++/* Native support for GNU/Linux amd64.
++
++ Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++#ifndef NM_LINUX64_H
++#define NM_LINUX64_H
++
++#include "config/nm-linux.h"
++
++/* Red Hat backward compatibility with gdb-6.8. */
++#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
++
++#endif /* NM_LINUX64_H */
+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
+@@ -0,0 +1,28 @@
++/* Native support for GNU/Linux i386.
++
++ Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++#ifndef NM_LINUX_H
++#define NM_LINUX_H
++
++#include "config/nm-linux.h"
++
++/* Red Hat backward compatibility with gdb-6.8. */
++#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
++
++#endif /* NM_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 @@
+ bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
+ (including this one?). OTHERTYPE is who knows what... */
+
++#ifndef target_can_use_hardware_watchpoint
+ #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
+ (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
++#endif
+
+ /* 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
+@@ -0,0 +1,40 @@
++# Copyright 2009, 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
++if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
++ && ![istarget "ia64-*-*"])
++ || [target_info exists gdb,no_hardware_watchpoints]} then {
++ verbose "Skipping watchpoint-hw-before-run test."
++ return
++}
++
++set test watchpoint-hw-before-run
++set srcfile watchpoint-hw-hit-once.c
++if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
++ return -1
++}
++
++gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
++
++# `runto_main' or `runto main' would delete the watchpoint created above.
++
++if { [gdb_start_cmd] < 0 } {
++ untested start
++ return -1
++}
++gdb_test "" "main .* at .*" "start"
++
++gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
diff --git a/insight-7.4.50-bz592031-siginfo-lost-5of5.patch b/insight-7.4.50-bz592031-siginfo-lost-5of5.patch
new file mode 100644
index 0000000..2b7a5fb
--- /dev/null
+++ b/insight-7.4.50-bz592031-siginfo-lost-5of5.patch
@@ -0,0 +1,111 @@
+diff -Naur insight-7.4.50.orig/gdb/linux-nat.c insight-7.4.50.new/gdb/linux-nat.c
+--- insight-7.4.50.orig/gdb/linux-nat.c 2012-04-04 17:15:50.598799525 +0200
++++ insight-7.4.50.new/gdb/linux-nat.c 2012-04-04 17:16:29.086109710 +0200
+@@ -1928,7 +1928,6 @@
+ step, TARGET_SIGNAL_0);
+ lp->stopped = 0;
+ lp->step = step;
+- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+ lp->stopped_by_watchpoint = 0;
+ }
+ else
+@@ -2070,7 +2069,6 @@
+ if (linux_nat_prepare_to_resume != NULL)
+ linux_nat_prepare_to_resume (lp);
+ linux_ops->to_resume (linux_ops, ptid, step, signo);
+- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+ lp->stopped_by_watchpoint = 0;
+
+ if (debug_linux_nat)
+@@ -2624,22 +2622,6 @@
+ return status;
+ }
+
+-/* Save the most recent siginfo for LP. This is currently only called
+- for SIGTRAP; some ports use the si_addr field for
+- target_stopped_data_address. In the future, it may also be used to
+- restore the siginfo of requeued signals. */
+-
+-static void
+-save_siginfo (struct lwp_info *lp)
+-{
+- errno = 0;
+- ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
+- (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
+-
+- if (errno != 0)
+- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+-}
+-
+ /* Send a SIGSTOP to LP. */
+
+ static int
+@@ -2884,9 +2866,6 @@
+ {
+ /* The thread was stopped with a signal other than SIGSTOP. */
+
+- /* Save the trap's siginfo in case we need it later. */
+- save_siginfo (lp);
+-
+ save_sigtrap (lp);
+
+ if (debug_linux_nat)
+@@ -3290,12 +3269,7 @@
+ }
+
+ if (linux_nat_status_is_event (status))
+- {
+- /* Save the trap's siginfo in case we need it later. */
+- save_siginfo (lp);
+-
+- save_sigtrap (lp);
+- }
++ save_sigtrap (lp);
+
+ /* Check if the thread has exited. */
+ if ((WIFEXITED (status) || WIFSIGNALED (status))
+@@ -3949,7 +3923,6 @@
+ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, TARGET_SIGNAL_0);
+ lp->stopped = 0;
+- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
+ lp->stopped_by_watchpoint = 0;
+ }
+
+@@ -5226,11 +5199,19 @@
+ siginfo_t *
+ linux_nat_get_siginfo (ptid_t ptid)
+ {
+- struct lwp_info *lp = find_lwp_pid (ptid);
++ static struct siginfo siginfo;
++ int pid;
+
+- gdb_assert (lp != NULL);
++ pid = GET_LWP (ptid);
++ if (pid == 0)
++ pid = GET_PID (ptid);
++
++ errno = 0;
++ ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
++ if (errno != 0)
++ memset (&siginfo, 0, sizeof (siginfo));
+
+- return &lp->siginfo;
++ return &siginfo;
+ }
+
+ /* Provide a prototype to silence -Wmissing-prototypes. */
+diff -Naur insight-7.4.50.orig/gdb/linux-nat.h insight-7.4.50.new/gdb/linux-nat.h
+--- insight-7.4.50.orig/gdb/linux-nat.h 2012-04-04 17:15:50.442806374 +0200
++++ insight-7.4.50.new/gdb/linux-nat.h 2012-04-04 17:18:17.892332585 +0200
+@@ -76,10 +76,6 @@
+ /* The kind of stepping of this LWP. */
+ enum resume_step step;
+
+- /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
+- be the address of a hardware watchpoint. */
+- siginfo_t siginfo;
+-
+ /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
+ watchpoint trap. */
+ int stopped_by_watchpoint;
diff --git a/insight-7.4.50-fortran-common-reduce.patch b/insight-7.4.50-fortran-common-reduce.patch
new file mode 100644
index 0000000..ed94fbe
--- /dev/null
+++ b/insight-7.4.50-fortran-common-reduce.patch
@@ -0,0 +1,499 @@
+diff -Naur insight-7.4.50.orig/gdb/f-lang.c insight-7.4.50.new/gdb/f-lang.c
+--- insight-7.4.50.orig/gdb/f-lang.c 2012-03-02 20:29:00.000000000 +0100
++++ insight-7.4.50.new/gdb/f-lang.c 2012-04-04 16:34:16.484343730 +0200
+@@ -59,20 +59,6 @@
+ /* Local functions */
+
+ extern void _initialize_f_language (void);
+-#if 0
+-static void clear_function_list (void);
+-static long get_bf_for_fcn (long);
+-static void clear_bf_list (void);
+-static void patch_all_commons_by_name (char *, CORE_ADDR, int);
+-static SAVED_F77_COMMON_PTR find_first_common_named (char *);
+-static void add_common_entry (struct symbol *);
+-static void add_common_block (char *, CORE_ADDR, int, char *);
+-static SAVED_FUNCTION *allocate_saved_function_node (void);
+-static SAVED_BF_PTR allocate_saved_bf_node (void);
+-static COMMON_ENTRY_PTR allocate_common_entry_node (void);
+-static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node (void);
+-static void patch_common_entries (SAVED_F77_COMMON_PTR, CORE_ADDR, int);
+-#endif
+
+ static void f_printchar (int c, struct type *type, struct ui_file * stream);
+ static void f_emit_char (int c, struct type *type,
+@@ -385,185 +371,7 @@
+ add_language (&f_language_defn);
+ }
+
+-#if 0
+-static SAVED_BF_PTR
+-allocate_saved_bf_node (void)
+-{
+- SAVED_BF_PTR new;
+-
+- new = (SAVED_BF_PTR) xmalloc (sizeof (SAVED_BF));
+- return (new);
+-}
+-
+-static SAVED_FUNCTION *
+-allocate_saved_function_node (void)
+-{
+- SAVED_FUNCTION *new;
+-
+- new = (SAVED_FUNCTION *) xmalloc (sizeof (SAVED_FUNCTION));
+- return (new);
+-}
+-
+-static SAVED_F77_COMMON_PTR
+-allocate_saved_f77_common_node (void)
+-{
+- SAVED_F77_COMMON_PTR new;
+-
+- new = (SAVED_F77_COMMON_PTR) xmalloc (sizeof (SAVED_F77_COMMON));
+- return (new);
+-}
+-
+-static COMMON_ENTRY_PTR
+-allocate_common_entry_node (void)
+-{
+- COMMON_ENTRY_PTR new;
+-
+- new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY));
+- return (new);
+-}
+-#endif
+-
+ SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */
+-SAVED_F77_COMMON_PTR tail_common_list = NULL; /* Ptr to last saved COMMON */
+-SAVED_F77_COMMON_PTR current_common = NULL; /* Ptr to current COMMON */
+-
+-#if 0
+-static SAVED_BF_PTR saved_bf_list = NULL; /* Ptr to (.bf,function)
+- list */
+-static SAVED_BF_PTR saved_bf_list_end = NULL; /* Ptr to above list's end */
+-static SAVED_BF_PTR current_head_bf_list = NULL; /* Current head of
+- above list. */
+-
+-static SAVED_BF_PTR tmp_bf_ptr; /* Generic temporary for use
+- in macros. */
+-
+-/* The following function simply enters a given common block onto
+- the global common block chain. */
+-
+-static void
+-add_common_block (char *name, CORE_ADDR offset, int secnum, char *func_stab)
+-{
+- SAVED_F77_COMMON_PTR tmp;
+- char *c, *local_copy_func_stab;
+-
+- /* If the COMMON block we are trying to add has a blank
+- name (i.e. "#BLNK_COM") then we set it to __BLANK
+- because the darn "#" character makes GDB's input
+- parser have fits. */
+-
+-
+- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0
+- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0)
+- {
+-
+- xfree (name);
+- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
+- strcpy (name, BLANK_COMMON_NAME_LOCAL);
+- }
+-
+- tmp = allocate_saved_f77_common_node ();
+-
+- local_copy_func_stab = xmalloc (strlen (func_stab) + 1);
+- strcpy (local_copy_func_stab, func_stab);
+-
+- tmp->name = xmalloc (strlen (name) + 1);
+-
+- /* local_copy_func_stab is a stabstring, let us first extract the
+- function name from the stab by NULLing out the ':' character. */
+-
+-
+- c = NULL;
+- c = strchr (local_copy_func_stab, ':');
+-
+- if (c)
+- *c = '\0';
+- else
+- error (_("Malformed function STAB found in add_common_block()"));
+-
+-
+- tmp->owning_function = xmalloc (strlen (local_copy_func_stab) + 1);
+-
+- strcpy (tmp->owning_function, local_copy_func_stab);
+-
+- strcpy (tmp->name, name);
+- tmp->offset = offset;
+- tmp->next = NULL;
+- tmp->entries = NULL;
+- tmp->secnum = secnum;
+-
+- current_common = tmp;
+-
+- if (head_common_list == NULL)
+- {
+- head_common_list = tail_common_list = tmp;
+- }
+- else
+- {
+- tail_common_list->next = tmp;
+- tail_common_list = tmp;
+- }
+-}
+-#endif
+-
+-/* The following function simply enters a given common entry onto
+- the "current_common" block that has been saved away. */
+-
+-#if 0
+-static void
+-add_common_entry (struct symbol *entry_sym_ptr)
+-{
+- COMMON_ENTRY_PTR tmp;
+-
+-
+-
+- /* The order of this list is important, since
+- we expect the entries to appear in decl.
+- order when we later issue "info common" calls. */
+-
+- tmp = allocate_common_entry_node ();
+-
+- tmp->next = NULL;
+- tmp->symbol = entry_sym_ptr;
+-
+- if (current_common == NULL)
+- error (_("Attempt to add COMMON entry with no block open!"));
+- else
+- {
+- if (current_common->entries == NULL)
+- {
+- current_common->entries = tmp;
+- current_common->end_of_entries = tmp;
+- }
+- else
+- {
+- current_common->end_of_entries->next = tmp;
+- current_common->end_of_entries = tmp;
+- }
+- }
+-}
+-#endif
+-
+-/* This routine finds the first encountred COMMON block named "name". */
+-
+-#if 0
+-static SAVED_F77_COMMON_PTR
+-find_first_common_named (char *name)
+-{
+-
+- SAVED_F77_COMMON_PTR tmp;
+-
+- tmp = head_common_list;
+-
+- while (tmp != NULL)
+- {
+- if (strcmp (tmp->name, name) == 0)
+- return (tmp);
+- else
+- tmp = tmp->next;
+- }
+- return (NULL);
+-}
+-#endif
+
+ /* This routine finds the first encountred COMMON block named "name"
+ that belongs to function funcname. */
+@@ -586,193 +394,3 @@
+ }
+ return (NULL);
+ }
+-
+-
+-#if 0
+-
+-/* The following function is called to patch up the offsets
+- for the statics contained in the COMMON block named
+- "name." */
+-
+-static void
+-patch_common_entries (SAVED_F77_COMMON_PTR blk, CORE_ADDR offset, int secnum)
+-{
+- COMMON_ENTRY_PTR entry;
+-
+- blk->offset = offset; /* Keep this around for future use. */
+-
+- entry = blk->entries;
+-
+- while (entry != NULL)
+- {
+- SYMBOL_VALUE (entry->symbol) += offset;
+- SYMBOL_SECTION (entry->symbol) = secnum;
+-
+- entry = entry->next;
+- }
+- blk->secnum = secnum;
+-}
+-
+-/* Patch all commons named "name" that need patching.Since COMMON
+- blocks occur with relative infrequency, we simply do a linear scan on
+- the name. Eventually, the best way to do this will be a
+- hashed-lookup. Secnum is the section number for the .bss section
+- (which is where common data lives). */
+-
+-static void
+-patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum)
+-{
+-
+- SAVED_F77_COMMON_PTR tmp;
+-
+- /* For blank common blocks, change the canonical reprsentation
+- of a blank name */
+-
+- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0
+- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0)
+- {
+- xfree (name);
+- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
+- strcpy (name, BLANK_COMMON_NAME_LOCAL);
+- }
+-
+- tmp = head_common_list;
+-
+- while (tmp != NULL)
+- {
+- if (COMMON_NEEDS_PATCHING (tmp))
+- if (strcmp (tmp->name, name) == 0)
+- patch_common_entries (tmp, offset, secnum);
+-
+- tmp = tmp->next;
+- }
+-}
+-#endif
+-
+-/* This macro adds the symbol-number for the start of the function
+- (the symbol number of the .bf) referenced by symnum_fcn to a
+- list. This list, in reality should be a FIFO queue but since
+- #line pragmas sometimes cause line ranges to get messed up
+- we simply create a linear list. This list can then be searched
+- first by a queueing algorithm and upon failure fall back to
+- a linear scan. */
+-
+-#if 0
+-#define ADD_BF_SYMNUM(bf_sym,fcn_sym) \
+- \
+- if (saved_bf_list == NULL) \
+-{ \
+- tmp_bf_ptr = allocate_saved_bf_node(); \
+- \
+- tmp_bf_ptr->symnum_bf = (bf_sym); \
+- tmp_bf_ptr->symnum_fcn = (fcn_sym); \
+- tmp_bf_ptr->next = NULL; \
+- \
+- current_head_bf_list = saved_bf_list = tmp_bf_ptr; \
+- saved_bf_list_end = tmp_bf_ptr; \
+- } \
+-else \
+-{ \
+- tmp_bf_ptr = allocate_saved_bf_node(); \
+- \
+- tmp_bf_ptr->symnum_bf = (bf_sym); \
+- tmp_bf_ptr->symnum_fcn = (fcn_sym); \
+- tmp_bf_ptr->next = NULL; \
+- \
+- saved_bf_list_end->next = tmp_bf_ptr; \
+- saved_bf_list_end = tmp_bf_ptr; \
+- }
+-#endif
+-
+-/* This function frees the entire (.bf,function) list. */
+-
+-#if 0
+-static void
+-clear_bf_list (void)
+-{
+-
+- SAVED_BF_PTR tmp = saved_bf_list;
+- SAVED_BF_PTR next = NULL;
+-
+- while (tmp != NULL)
+- {
+- next = tmp->next;
+- xfree (tmp);
+- tmp = next;
+- }
+- saved_bf_list = NULL;
+-}
+-#endif
+-
+-int global_remote_debug;
+-
+-#if 0
+-
+-static long
+-get_bf_for_fcn (long the_function)
+-{
+- SAVED_BF_PTR tmp;
+- int nprobes = 0;
+-
+- /* First use a simple queuing algorithm (i.e. look and see if the
+- item at the head of the queue is the one you want). */
+-
+- if (saved_bf_list == NULL)
+- internal_error (__FILE__, __LINE__,
+- _("cannot get .bf node off empty list"));
+-
+- if (current_head_bf_list != NULL)
+- if (current_head_bf_list->symnum_fcn == the_function)
+- {
+- if (global_remote_debug)
+- fprintf_unfiltered (gdb_stderr, "*");
+-
+- tmp = current_head_bf_list;
+- current_head_bf_list = current_head_bf_list->next;
+- return (tmp->symnum_bf);
+- }
+-
+- /* If the above did not work (probably because #line directives were
+- used in the sourcefile and they messed up our internal tables) we now do
+- the ugly linear scan. */
+-
+- if (global_remote_debug)
+- fprintf_unfiltered (gdb_stderr, "\ndefaulting to linear scan\n");
+-
+- nprobes = 0;
+- tmp = saved_bf_list;
+- while (tmp != NULL)
+- {
+- nprobes++;
+- if (tmp->symnum_fcn == the_function)
+- {
+- if (global_remote_debug)
+- fprintf_unfiltered (gdb_stderr, "Found in %d probes\n", nprobes);
+- current_head_bf_list = tmp->next;
+- return (tmp->symnum_bf);
+- }
+- tmp = tmp->next;
+- }
+-
+- return (-1);
+-}
+-
+-static SAVED_FUNCTION_PTR saved_function_list = NULL;
+-static SAVED_FUNCTION_PTR saved_function_list_end = NULL;
+-
+-static void
+-clear_function_list (void)
+-{
+- SAVED_FUNCTION_PTR tmp = saved_function_list;
+- SAVED_FUNCTION_PTR next = NULL;
+-
+- while (tmp != NULL)
+- {
+- next = tmp->next;
+- xfree (tmp);
+- tmp = next;
+- }
+-
+- saved_function_list = NULL;
+-}
+-#endif
+diff -Naur insight-7.4.50.orig/gdb/f-lang.h insight-7.4.50.new/gdb/f-lang.h
+--- insight-7.4.50.orig/gdb/f-lang.h 2012-03-01 20:26:13.000000000 +0100
++++ insight-7.4.50.new/gdb/f-lang.h 2012-04-04 16:35:49.704248956 +0200
+@@ -78,9 +78,6 @@
+ extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
+ const char *);
+
+-#define UNINITIALIZED_SECNUM -1
+-#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM)
+-
+ #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */
+ #define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
+ #define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */
+diff -Naur insight-7.4.50.orig/gdb/f-valprint.c insight-7.4.50.new/gdb/f-valprint.c
+--- insight-7.4.50.orig/gdb/f-valprint.c 2012-03-01 20:27:18.000000000 +0100
++++ insight-7.4.50.new/gdb/f-valprint.c 2012-04-04 16:34:16.486343629 +0200
+@@ -35,10 +35,6 @@
+ #include "command.h"
+ #include "block.h"
+
+-#if 0
+-static int there_is_a_visible_common_named (char *);
+-#endif
+-
+ extern void _initialize_f_valprint (void);
+ static void info_common_command (char *, int);
+ static void list_all_visible_commons (const char *);
+@@ -514,67 +510,6 @@
+ comname, funname);
+ }
+
+-/* This function is used to determine whether there is a
+- F77 common block visible at the current scope called 'comname'. */
+-
+-#if 0
+-static int
+-there_is_a_visible_common_named (char *comname)
+-{
+- SAVED_F77_COMMON_PTR the_common;
+- struct frame_info *fi;
+- char *funname = 0;
+- struct symbol *func;
+-
+- if (comname == NULL)
+- error (_("Cannot deal with NULL common name!"));
+-
+- fi = get_selected_frame (_("No frame selected"));
+-
+- /* The following is generally ripped off from stack.c's routine
+- print_frame_info(). */
+-
+- func = find_pc_function (fi->pc);
+- if (func)
+- {
+- /* In certain pathological cases, the symtabs give the wrong
+- function (when we are in the first function in a file which
+- is compiled without debugging symbols, the previous function
+- is compiled with debugging symbols, and the "foo.o" symbol
+- that is supposed to tell us where the file with debugging symbols
+- ends has been truncated by ar because it is longer than 15
+- characters).
+-
+- So look in the minimal symbol tables as well, and if it comes
+- up with a larger address for the function use that instead.
+- I don't think this can ever cause any problems; there shouldn't
+- be any minimal symbols in the middle of a function.
+- FIXME: (Not necessarily true. What about text labels?) */
+-
+- struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
+-
+- if (msymbol != NULL
+- && (SYMBOL_VALUE_ADDRESS (msymbol)
+- > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
+- funname = SYMBOL_LINKAGE_NAME (msymbol);
+- else
+- funname = SYMBOL_LINKAGE_NAME (func);
+- }
+- else
+- {
+- struct minimal_symbol *msymbol =
+- lookup_minimal_symbol_by_pc (fi->pc);
+-
+- if (msymbol != NULL)
+- funname = SYMBOL_LINKAGE_NAME (msymbol);
+- }
+-
+- the_common = find_common_for_function (comname, funname);
+-
+- return (the_common ? 1 : 0);
+-}
+-#endif
+-
+ void
+ _initialize_f_valprint (void)
+ {
diff --git a/insight-7.4.50-fortran-common.patch b/insight-7.4.50-fortran-common.patch
new file mode 100644
index 0000000..a3f37a9
--- /dev/null
+++ b/insight-7.4.50-fortran-common.patch
@@ -0,0 +1,581 @@
+diff -Naur insight-7.4.50.orig/gdb/dwarf2read.c insight-7.4.50.new/gdb/dwarf2read.c
+--- insight-7.4.50.orig/gdb/dwarf2read.c 2012-04-04 16:37:56.671672069 +0200
++++ insight-7.4.50.new/gdb/dwarf2read.c 2012-04-04 16:38:28.676266351 +0200
+@@ -8273,12 +8273,14 @@
+ return set_die_type (die, set_type, cu);
+ }
+
+-/* First cut: install each common block member as a global variable. */
++/* Create appropriate locally-scoped variables for all the DW_TAG_common_block
++ entries. Create also TYPE_CODE_STRUCT listing all such variables to be
++ available for `info common'. COMMON_BLOCK_DOMAIN is used to sepate the
++ common blocks name namespace from regular variable names. */
+
+ static void
+ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+ {
+- struct die_info *child_die;
+ struct attribute *attr;
+ struct symbol *sym;
+ CORE_ADDR base = (CORE_ADDR) 0;
+@@ -8303,20 +8305,67 @@
+ }
+ if (die->child != NULL)
+ {
++ struct objfile *objfile = cu->objfile;
++ struct die_info *child_die;
++ struct type *type;
++ struct field *field;
++ char *name;
++ struct symbol *sym;
++
++ type = alloc_type (objfile);
++ TYPE_CODE (type) = TYPE_CODE_STRUCT;
++ /* Artificial type to be used only by `info common'. */
++ TYPE_NAME (type) = "<common>";
++
++ child_die = die->child;
++ while (child_die && child_die->tag)
++ {
++ TYPE_NFIELDS (type)++;
++ child_die = sibling_die (child_die);
++ }
++
++ TYPE_FIELDS (type) = obstack_alloc (&objfile->objfile_obstack,
++ sizeof (*TYPE_FIELDS (type))
++ * TYPE_NFIELDS (type));
++ memset (TYPE_FIELDS (type), 0, sizeof (*TYPE_FIELDS (type))
++ * TYPE_NFIELDS (type));
++
++ field = TYPE_FIELDS (type);
+ child_die = die->child;
+ while (child_die && child_die->tag)
+ {
+ LONGEST offset;
+
++ /* Create the symbol in the DW_TAG_common_block block in the current
++ symbol scope. */
+ sym = new_symbol (child_die, NULL, cu);
++
++ /* Undocumented in DWARF3, when it can be present? */
+ if (sym != NULL
+ && handle_data_member_location (child_die, cu, &offset))
+ {
+ SYMBOL_VALUE_ADDRESS (sym) = base + offset;
+ add_symbol_to_list (sym, &global_symbols);
+ }
++
++ if (SYMBOL_CLASS (sym) == LOC_STATIC)
++ SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym));
++ else
++ SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
++ FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
++ FIELD_NAME (*field) = SYMBOL_NATURAL_NAME (sym);
++ field++;
+ child_die = sibling_die (child_die);
+ }
++
++ /* TYPE_LENGTH (type) is left 0 - it is only a virtual structure even
++ with no consecutive address space. */
++
++ sym = new_symbol (die, type, cu);
++ /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
++ SYMBOL_VALUE_ADDRESS (sym) = base;
++
++ set_die_type (die, type, cu);
+ }
+ }
+
+@@ -11818,6 +11867,13 @@
+ {
+ var_decode_location (attr, sym, cu);
+ attr2 = dwarf2_attr (die, DW_AT_external, cu);
++
++ /* Fortran explicitly imports any global symbols to the local
++ scope by DW_TAG_common_block. */
++ if (cu->language == language_fortran && die->parent
++ && die->parent->tag == DW_TAG_common_block)
++ attr2 = NULL;
++
+ if (SYMBOL_CLASS (sym) == LOC_STATIC
+ && SYMBOL_VALUE_ADDRESS (sym) == 0
+ && !dwarf2_per_objfile->has_section_at_zero)
+@@ -11982,6 +12038,11 @@
+ SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ list_to_add = &global_symbols;
+ break;
++ case DW_TAG_common_block:
++ SYMBOL_CLASS (sym) = LOC_STATIC;
++ SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN;
++ add_symbol_to_list (sym, cu->list_in_scope);
++ break;
+ default:
+ /* Not a tag we recognize. Hopefully we aren't processing
+ trash data, but since we must specifically ignore things
+diff -Naur insight-7.4.50.orig/gdb/f-lang.c insight-7.4.50.new/gdb/f-lang.c
+--- insight-7.4.50.orig/gdb/f-lang.c 2012-04-04 16:37:56.753668466 +0200
++++ insight-7.4.50.new/gdb/f-lang.c 2012-04-04 16:50:24.481823356 +0200
+@@ -370,27 +370,3 @@
+
+ add_language (&f_language_defn);
+ }
+-
+-SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */
+-
+-/* This routine finds the first encountred COMMON block named "name"
+- that belongs to function funcname. */
+-
+-SAVED_F77_COMMON_PTR
+-find_common_for_function (const char *name, const char *funcname)
+-{
+-
+- SAVED_F77_COMMON_PTR tmp;
+-
+- tmp = head_common_list;
+-
+- while (tmp != NULL)
+- {
+- if (strcmp (tmp->name, name) == 0
+- && strcmp (tmp->owning_function, funcname) == 0)
+- return (tmp);
+- else
+- tmp = tmp->next;
+- }
+- return (NULL);
+-}
+diff -Naur insight-7.4.50.orig/gdb/f-lang.h insight-7.4.50.new/gdb/f-lang.h
+--- insight-7.4.50.orig/gdb/f-lang.h 2012-04-04 16:37:56.753668466 +0200
++++ insight-7.4.50.new/gdb/f-lang.h 2012-04-04 16:43:18.060556731 +0200
+@@ -48,39 +48,8 @@
+ NONE_BOUND_DEFAULT /* "(low:high)" */
+ };
+
+-struct common_entry
+- {
+- struct symbol *symbol; /* The symbol node corresponding
+- to this component */
+- struct common_entry *next; /* The next component */
+- };
+-
+-struct saved_f77_common
+- {
+- char *name; /* Name of COMMON */
+- char *owning_function; /* Name of parent function */
+- int secnum; /* Section # of .bss */
+- CORE_ADDR offset; /* Offset from .bss for
+- this block */
+- struct common_entry *entries; /* List of block's components */
+- struct common_entry *end_of_entries; /* ptr. to end of components */
+- struct saved_f77_common *next; /* Next saved COMMON block */
+- };
+-
+-typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR;
+-
+-typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR;
+-
+-extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */
+-extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */
+-extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */
+-
+-extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
+- const char *);
+-
+ #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */
+ #define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
+-#define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */
+
+ /* When reasonable array bounds cannot be fetched, such as when
+ you ask to 'mt print symbols' and there is no stack frame and
+diff -Naur insight-7.4.50.orig/gdb/f-valprint.c insight-7.4.50.new/gdb/f-valprint.c
+--- insight-7.4.50.orig/gdb/f-valprint.c 2012-04-04 16:37:56.753668466 +0200
++++ insight-7.4.50.new/gdb/f-valprint.c 2012-04-04 16:49:11.337036714 +0200
+@@ -34,10 +34,11 @@
+ #include "gdbcore.h"
+ #include "command.h"
+ #include "block.h"
++#include "dictionary.h"
++#include "gdb_assert.h"
+
+ extern void _initialize_f_valprint (void);
+ static void info_common_command (char *, int);
+-static void list_all_visible_commons (const char *);
+ static void f77_create_arrayprint_offset_tbl (struct type *,
+ struct ui_file *);
+ static void f77_get_dynamic_length_of_aggregate (struct type *);
+@@ -399,22 +400,54 @@
+ gdb_flush (stream);
+ }
+
+-static void
+-list_all_visible_commons (const char *funname)
+-{
+- SAVED_F77_COMMON_PTR tmp;
+-
+- tmp = head_common_list;
++static int
++info_common_command_for_block (struct block *block, struct frame_info *frame,
++ const char *comname)
++{
++ struct dict_iterator iter;
++ struct symbol *sym;
++ int values_printed = 0;
++ const char *name;
++ struct value_print_options opts;
++
++ get_user_print_options (&opts);
++
++ ALL_BLOCK_SYMBOLS (block, iter, sym)
++ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
++ {
++ struct type *type = SYMBOL_TYPE (sym);
++ int index;
++
++ gdb_assert (SYMBOL_CLASS (sym) == LOC_STATIC);
++ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT);
++
++ if (comname && (!SYMBOL_LINKAGE_NAME (sym)
++ || strcmp (comname, SYMBOL_LINKAGE_NAME (sym)) != 0))
++ continue;
++
++ values_printed = 1;
++ if (SYMBOL_PRINT_NAME (sym))
++ printf_filtered (_("Contents of F77 COMMON block '%s':\n"),
++ SYMBOL_PRINT_NAME (sym));
++ else
++ printf_filtered (_("Contents of blank COMMON block:\n"));
++
++ for (index = 0; index < TYPE_NFIELDS (type); index++)
++ {
++ struct value *val;
++
++ gdb_assert (field_is_static (&TYPE_FIELD (type, index)));
++ val = value_static_field (type, index);
++
++ printf_filtered ("%s = ", TYPE_FIELD_NAME (type, index));
++ value_print (val, gdb_stdout, &opts);
++ putchar_filtered ('\n');
++ }
+
+- printf_filtered (_("All COMMON blocks visible at this level:\n\n"));
+-
+- while (tmp != NULL)
+- {
+- if (strcmp (tmp->owning_function, funname) == 0)
+- printf_filtered ("%s\n", tmp->name);
++ putchar_filtered ('\n');
++ }
+
+- tmp = tmp->next;
+- }
++ return values_printed;
+ }
+
+ /* This function is used to print out the values in a given COMMON
+@@ -424,11 +457,9 @@
+ static void
+ info_common_command (char *comname, int from_tty)
+ {
+- SAVED_F77_COMMON_PTR the_common;
+- COMMON_ENTRY_PTR entry;
+ struct frame_info *fi;
+- const char *funname = 0;
+- struct symbol *func;
++ struct block *block;
++ int values_printed = 0;
+
+ /* We have been told to display the contents of F77 COMMON
+ block supposedly visible in this function. Let us
+@@ -440,74 +471,31 @@
+ /* The following is generally ripped off from stack.c's routine
+ print_frame_info(). */
+
+- func = find_pc_function (get_frame_pc (fi));
+- if (func)
+- {
+- /* In certain pathological cases, the symtabs give the wrong
+- function (when we are in the first function in a file which
+- is compiled without debugging symbols, the previous function
+- is compiled with debugging symbols, and the "foo.o" symbol
+- that is supposed to tell us where the file with debugging symbols
+- ends has been truncated by ar because it is longer than 15
+- characters).
+-
+- So look in the minimal symbol tables as well, and if it comes
+- up with a larger address for the function use that instead.
+- I don't think this can ever cause any problems; there shouldn't
+- be any minimal symbols in the middle of a function.
+- FIXME: (Not necessarily true. What about text labels?) */
+-
+- struct minimal_symbol *msymbol =
+- lookup_minimal_symbol_by_pc (get_frame_pc (fi));
+-
+- if (msymbol != NULL
+- && (SYMBOL_VALUE_ADDRESS (msymbol)
+- > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
+- funname = SYMBOL_LINKAGE_NAME (msymbol);
+- else
+- funname = SYMBOL_LINKAGE_NAME (func);
+- }
+- else
++ block = get_frame_block (fi, 0);
++ if (block == NULL)
+ {
+- struct minimal_symbol *msymbol =
+- lookup_minimal_symbol_by_pc (get_frame_pc (fi));
+-
+- if (msymbol != NULL)
+- funname = SYMBOL_LINKAGE_NAME (msymbol);
+- else /* Got no 'funname', code below will fail. */
+- error (_("No function found for frame."));
++ printf_filtered (_("No symbol table info available.\n"));
++ return;
+ }
+
+- /* If comname is NULL, we assume the user wishes to see the
+- which COMMON blocks are visible here and then return. */
+-
+- if (comname == 0)
++ while (block)
+ {
+- list_all_visible_commons (funname);
+- return;
++ if (info_common_command_for_block (block, fi, comname))
++ values_printed = 1;
++ /* After handling the function's top-level block, stop. Don't
++ continue to its superblock, the block of per-file symbols. */
++ if (BLOCK_FUNCTION (block))
++ break;
++ block = BLOCK_SUPERBLOCK (block);
+ }
+
+- the_common = find_common_for_function (comname, funname);
+-
+- if (the_common)
++ if (!values_printed)
+ {
+- if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0)
+- printf_filtered (_("Contents of blank COMMON block:\n"));
++ if (comname)
++ printf_filtered (_("No common block '%s'.\n"), comname);
+ else
+- printf_filtered (_("Contents of F77 COMMON block '%s':\n"), comname);
+-
+- printf_filtered ("\n");
+- entry = the_common->entries;
+-
+- while (entry != NULL)
+- {
+- print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0);
+- entry = entry->next;
+- }
++ printf_filtered (_("No common blocks.\n"));
+ }
+- else
+- printf_filtered (_("Cannot locate the common block %s in function '%s'\n"),
+- comname, funname);
+ }
+
+ void
+diff -Naur insight-7.4.50.orig/gdb/stack.c insight-7.4.50.new/gdb/stack.c
+--- insight-7.4.50.orig/gdb/stack.c 2012-03-27 21:08:36.000000000 +0200
++++ insight-7.4.50.new/gdb/stack.c 2012-04-04 16:38:50.745297040 +0200
+@@ -1834,6 +1834,8 @@
+ case LOC_COMPUTED:
+ if (SYMBOL_IS_ARGUMENT (sym))
+ break;
++ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
++ break;
+ (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
+ break;
+
+diff -Naur insight-7.4.50.orig/gdb/symtab.h insight-7.4.50.new/gdb/symtab.h
+--- insight-7.4.50.orig/gdb/symtab.h 2012-02-07 05:48:22.000000000 +0100
++++ insight-7.4.50.new/gdb/symtab.h 2012-04-04 16:38:50.746296996 +0200
+@@ -391,7 +391,10 @@
+
+ /* LABEL_DOMAIN may be used for names of labels (for gotos). */
+
+- LABEL_DOMAIN
++ LABEL_DOMAIN,
++
++ /* Fortran common blocks. Their naming must be separate from VAR_DOMAIN. */
++ COMMON_BLOCK_DOMAIN
+ } domain_enum;
+
+ /* Searching domains, used for `search_symbols'. Element numbers are
+diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.fortran/common-block.exp insight-7.4.50.new/gdb/testsuite/gdb.fortran/common-block.exp
+--- insight-7.4.50.orig/gdb/testsuite/gdb.fortran/common-block.exp 1970-01-01 01:00:00.000000000 +0100
++++ insight-7.4.50.new/gdb/testsuite/gdb.fortran/common-block.exp 2012-04-04 16:38:50.747296952 +0200
+@@ -0,0 +1,101 @@
++# Copyright 2008 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# This file was written by Jan Kratochvil <jan.kratochvil at redhat.com>.
++
++set testfile "common-block"
++set srcfile ${testfile}.f90
++set binfile ${objdir}/${subdir}/${testfile}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
++ untested "Couldn't compile ${srcfile}"
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++if ![runto MAIN__] then {
++ perror "couldn't run to breakpoint MAIN__"
++ continue
++}
++
++gdb_breakpoint [gdb_get_line_number "stop-here-out"]
++gdb_continue_to_breakpoint "stop-here-out"
++
++# Common block naming with source name /foo/:
++# .symtab DW_TAG_common_block's DW_AT_name
++# Intel Fortran foo_ foo_
++# GNU Fortran foo_ foo
++#set suffix "_"
++set suffix ""
++
++set int4 {(integer\(kind=4\)|INTEGER\(4\))}
++set real4 {(real\(kind=4\)|REAL\(4\))}
++set real8 {(real\(kind=8\)|REAL\(8\))}
++
++gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context."
++gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context."
++gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context."
++gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
++gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
++gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
++
++gdb_test "info locals" "ix_x = 11\r\niy_y = 22\r\niz_z = 33\r\nix = 1\r\niy = 2\r\niz = 3" "info locals out"
++gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix_x = 11\r\niy_y = 22\r\niz_z = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix = 1\r\niy = 2\r\niz = 3" "info common out"
++
++gdb_test "ptype ix" "type = $int4" "ptype ix out"
++gdb_test "ptype iy" "type = $real4" "ptype iy out"
++gdb_test "ptype iz" "type = $real8" "ptype iz out"
++gdb_test "ptype ix_x" "type = $int4" "ptype ix_x out"
++gdb_test "ptype iy_y" "type = $real4" "ptype iy_y out"
++gdb_test "ptype iz_z" "type = $real8" "ptype iz_z out"
++
++gdb_test "p ix" " = 1 *" "p ix out"
++gdb_test "p iy" " = 2 *" "p iy out"
++gdb_test "p iz" " = 3 *" "p iz out"
++gdb_test "p ix_x" " = 11 *" "p ix_x out"
++gdb_test "p iy_y" " = 22 *" "p iy_y out"
++gdb_test "p iz_z" " = 33 *" "p iz_z out"
++
++gdb_breakpoint [gdb_get_line_number "stop-here-in"]
++gdb_continue_to_breakpoint "stop-here-in"
++
++gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context." "whatis foo$suffix in"
++gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context." "ptype foo$suffix in"
++gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context." "p foo$suffix in"
++gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "whatis fo_o$suffix in"
++gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "ptype fo_o$suffix in"
++gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "p fo_o$suffix in"
++
++gdb_test "info locals" "ix = 11\r\niy2 = 22\r\niz = 33\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3\r\niy = 5\r\niz_z = 55" "info locals in"
++gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix = 11\r\niy2 = 22\r\niz = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3" "info common in"
++
++gdb_test "ptype ix" "type = $int4" "ptype ix in"
++gdb_test "ptype iy2" "type = $real4" "ptype iy2 in"
++gdb_test "ptype iz" "type = $real8" "ptype iz in"
++gdb_test "ptype ix_x" "type = $int4" "ptype ix_x in"
++gdb_test "ptype iy_y" "type = $real4" "ptype iy_y in"
++gdb_test "ptype iz_z2" "type = $real8" "ptype iz_z2 in"
++
++gdb_test "p ix" " = 11 *" "p ix in"
++gdb_test "p iy2" " = 22 *" "p iy2 in"
++gdb_test "p iz" " = 33 *" "p iz in"
++gdb_test "p ix_x" " = 1 *" "p ix_x in"
++gdb_test "p iy_y" " = 2 *" "p iy_y in"
++gdb_test "p iz_z2" " = 3 *" "p iz_z2 in"
+diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.fortran/common-block.f90 insight-7.4.50.new/gdb/testsuite/gdb.fortran/common-block.f90
+--- insight-7.4.50.orig/gdb/testsuite/gdb.fortran/common-block.f90 1970-01-01 01:00:00.000000000 +0100
++++ insight-7.4.50.new/gdb/testsuite/gdb.fortran/common-block.f90 2012-04-04 16:38:50.747296952 +0200
+@@ -0,0 +1,67 @@
++! Copyright 2008 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! 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 in
++
++ INTEGER*4 ix
++ REAL*4 iy2
++ REAL*8 iz
++
++ INTEGER*4 ix_x
++ REAL*4 iy_y
++ REAL*8 iz_z2
++
++ common /fo_o/ix,iy2,iz
++ common /foo/ix_x,iy_y,iz_z2
++
++ iy = 5
++ iz_z = 55
++
++ if (ix .ne. 11 .or. iy2 .ne. 22.0 .or. iz .ne. 33.0) call abort
++ if (ix_x .ne. 1 .or. iy_y .ne. 2.0 .or. iz_z2 .ne. 3.0) call abort
++
++ ix = 0 ! stop-here-in
++
++end subroutine in
++
++program common_test
++
++ INTEGER*4 ix
++ REAL*4 iy
++ REAL*8 iz
++
++ INTEGER*4 ix_x
++ REAL*4 iy_y
++ REAL*8 iz_z
++
++ common /foo/ix,iy,iz
++ common /fo_o/ix_x,iy_y,iz_z
++
++ ix = 1
++ iy = 2.0
++ iz = 3.0
++
++ ix_x = 11
++ iy_y = 22.0
++ iz_z = 33.0
++
++ call in ! stop-here-out
++
++end program common_test
diff --git a/insight-7.4.50-readline-system.patch b/insight-7.4.50-readline-system.patch
new file mode 100644
index 0000000..3b9cd6a
--- /dev/null
+++ b/insight-7.4.50-readline-system.patch
@@ -0,0 +1,81 @@
+diff -Naur insight-7.4.50.orig/gdb/configure.ac insight-7.4.50.new/gdb/configure.ac
+--- insight-7.4.50.orig/gdb/configure.ac 2012-03-08 20:08:11.000000000 +0100
++++ insight-7.4.50.new/gdb/configure.ac 2012-04-03 14:06:44.114556080 +0200
+@@ -600,16 +600,19 @@
+ if test "$with_system_readline" = yes; then
+ READLINE=-lreadline
+ READLINE_DEPS=
++ READLINE_SRC='$(includedir)/readline'
+ READLINE_CFLAGS=
+ READLINE_TEXI_INCFLAG=
+ else
+ READLINE='$(READLINE_DIR)/libreadline.a'
+ READLINE_DEPS='$(READLINE)'
++ READLINE_SRC='$(srcdir)/../readline'
+ READLINE_CFLAGS='-I$(READLINE_SRC)/..'
+ READLINE_TEXI_INCFLAG='-I $(READLINE_DIR)'
+ fi
+ AC_SUBST(READLINE)
+ AC_SUBST(READLINE_DEPS)
++AC_SUBST(READLINE_SRC)
+ AC_SUBST(READLINE_CFLAGS)
+ AC_SUBST(READLINE_TEXI_INCFLAG)
+
+diff -Naur insight-7.4.50.orig/gdb/doc/gdb.texinfo insight-7.4.50.new/gdb/doc/gdb.texinfo
+--- insight-7.4.50.orig/gdb/doc/gdb.texinfo 2012-03-28 23:31:46.000000000 +0200
++++ insight-7.4.50.new/gdb/doc/gdb.texinfo 2012-04-03 14:03:55.788977692 +0200
+@@ -32920,9 +32920,6 @@
+ @item gdb- at value{GDBVN}/opcodes
+ source for the library of opcode tables and disassemblers
+
+- at item gdb- at value{GDBVN}/readline
+-source for the @sc{gnu} command-line interface
+-
+ @item gdb- at value{GDBVN}/glob
+ source for the @sc{gnu} filename pattern-matching subroutine
+
+@@ -32954,7 +32951,7 @@
+ correct value by examining your system.)
+
+ Running @samp{configure @var{host}} and then running @code{make} builds the
+- at file{bfd}, @file{readline}, @file{mmalloc}, and @file{libiberty}
++ at file{bfd}, @file{mmalloc}, and @file{libiberty}
+ libraries, then @code{gdb} itself. The configured source files, and the
+ binaries, are left in the corresponding source directories.
+
+@@ -32980,7 +32977,7 @@
+ that subdirectory. That is usually not what you want. In particular,
+ if you run the first @file{configure} from the @file{gdb} subdirectory
+ of the @file{gdb- at var{version-number}} directory, you will omit the
+-configuration of @file{bfd}, @file{readline}, and other sibling
++configuration of @file{bfd}, and other sibling
+ directories of the @file{gdb} subdirectory. This leads to build errors
+ about missing include files such as @file{bfd/bfd.h}.
+
+diff -Naur insight-7.4.50.orig/gdb/doc/Makefile.in insight-7.4.50.new/gdb/doc/Makefile.in
+--- insight-7.4.50.orig/gdb/doc/Makefile.in 2012-01-04 09:17:20.000000000 +0100
++++ insight-7.4.50.new/gdb/doc/Makefile.in 2012-04-03 14:16:28.796783806 +0200
+@@ -118,9 +118,7 @@
+ GDB_DOC_SOURCE_INCLUDES = \
+ $(srcdir)/fdl.texi \
+ $(srcdir)/gpl.texi \
+- $(srcdir)/agentexpr.texi \
+- $(READLINE_DIR)/rluser.texi \
+- $(READLINE_DIR)/hsuser.texi
++ $(srcdir)/agentexpr.texi
+ GDB_DOC_BUILD_INCLUDES = \
+ gdb-cfg.texi \
+ GDBvn.texi
+diff -Naur insight-7.4.50.orig/gdb/Makefile.in insight-7.4.50.new/gdb/Makefile.in
+--- insight-7.4.50.orig/gdb/Makefile.in 2012-04-03 14:02:35.701509142 +0200
++++ insight-7.4.50.new/gdb/Makefile.in 2012-04-03 14:03:55.791977556 +0200
+@@ -142,8 +142,7 @@
+ LIBDECNUMBER_CFLAGS = -I$(LIBDECNUMBER_DIR) -I$(LIBDECNUMBER_SRC)
+
+ # Where is the READLINE library? Typically in ../readline.
+-READLINE_DIR = ../readline
+-READLINE_SRC = $(srcdir)/$(READLINE_DIR)
++READLINE_SRC = @READLINE_SRC@
+ READLINE = @READLINE@
+ READLINE_DEPS = @READLINE_DEPS@
+ READLINE_CFLAGS = @READLINE_CFLAGS@
diff --git a/insight-7.4.50-readnever-20050907.patch b/insight-7.4.50-readnever-20050907.patch
new file mode 100644
index 0000000..818c99c
--- /dev/null
+++ b/insight-7.4.50-readnever-20050907.patch
@@ -0,0 +1,80 @@
+diff -Naur insight-7.4.50.orig/gdb/doc/gdb.texinfo insight-7.4.50.new/gdb/doc/gdb.texinfo
+--- insight-7.4.50.orig/gdb/doc/gdb.texinfo 2012-04-04 15:20:49.184402714 +0200
++++ insight-7.4.50.new/gdb/doc/gdb.texinfo 2012-04-04 15:21:32.191518364 +0200
+@@ -1020,6 +1020,12 @@
+ 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 -Naur insight-7.4.50.orig/gdb/dwarf2read.c insight-7.4.50.new/gdb/dwarf2read.c
+--- insight-7.4.50.orig/gdb/dwarf2read.c 2012-03-19 20:59:19.000000000 +0100
++++ insight-7.4.50.new/gdb/dwarf2read.c 2012-04-04 15:21:32.198518056 +0200
+@@ -61,6 +61,7 @@
+ #include "c-lang.h"
+ #include "valprint.h"
+ #include <ctype.h>
++#include "top.h"
+
+ #include <fcntl.h>
+ #include "gdb_string.h"
+@@ -1339,8 +1340,9 @@
+ (void *) names);
+ dwarf2_per_objfile->objfile = objfile;
+ }
+- return (dwarf2_per_objfile->info.asection != NULL
+- && dwarf2_per_objfile->abbrev.asection != NULL);
++ return (! readnever_symbol_files
++ && (dwarf2_per_objfile->info.asection != NULL
++ && dwarf2_per_objfile->abbrev.asection != NULL));
+ }
+
+ /* When loading sections, we look either for uncompressed section or for
+diff -Naur insight-7.4.50.orig/gdb/main.c insight-7.4.50.new/gdb/main.c
+--- insight-7.4.50.orig/gdb/main.c 2012-04-04 15:20:49.216401311 +0200
++++ insight-7.4.50.new/gdb/main.c 2012-04-04 15:21:32.192518321 +0200
+@@ -410,6 +410,7 @@
+ {"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},
+@@ -1058,6 +1059,7 @@
+ fputs_unfiltered (_(" file.\n\
+ --quiet Do not print version number on startup.\n\
+ --readnow Fully read symbol files on first access.\n\
++ --readnever Do not read symbol files.\n\
+ "), stream);
+ fputs_unfiltered (_("\
+ --se=FILE Use FILE as symbol file and executable file.\n\
+diff -Naur insight-7.4.50.orig/gdb/symfile.c insight-7.4.50.new/gdb/symfile.c
+--- insight-7.4.50.orig/gdb/symfile.c 2012-03-13 22:02:36.000000000 +0100
++++ insight-7.4.50.new/gdb/symfile.c 2012-04-04 15:21:32.193518277 +0200
+@@ -80,6 +80,7 @@
+
+ /* Global variables owned by this file. */
+ int readnow_symbol_files; /* Read full symbols immediately. */
++int readnever_symbol_files; /* Never read full symbols. */
+
+ /* External variables and functions referenced. */
+
+diff -Naur insight-7.4.50.orig/gdb/top.h insight-7.4.50.new/gdb/top.h
+--- insight-7.4.50.orig/gdb/top.h 2012-01-23 18:12:30.000000000 +0100
++++ insight-7.4.50.new/gdb/top.h 2012-04-04 15:21:32.198518056 +0200
+@@ -60,6 +60,7 @@
+
+ /* 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-6.8-relocate.patch b/insight-7.4.50-relocate.patch
similarity index 74%
rename from insight-6.8-relocate.patch
rename to insight-7.4.50-relocate.patch
index dc64e01..1a644fe 100644
--- a/insight-6.8-relocate.patch
+++ b/insight-7.4.50-relocate.patch
@@ -1,16 +1,16 @@
-diff -Naur insight-6.8.orig/gdb/gdbtk/generic/gdbtk.c insight-6.8.new/gdb/gdbtk/generic/gdbtk.c
---- insight-6.8.orig/gdb/gdbtk/generic/gdbtk.c 2008-08-19 20:23:44.000000000 +0200
-+++ insight-6.8.new/gdb/gdbtk/generic/gdbtk.c 2008-08-19 20:44:08.000000000 +0200
-@@ -514,7 +514,7 @@
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk.c insight-7.4.50.new/gdb/gdbtk/generic/gdbtk.c
+--- insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk.c 2012-03-30 09:04:59.000000000 +0200
++++ insight-7.4.50.new/gdb/gdbtk/generic/gdbtk.c 2012-04-03 13:55:00.342592443 +0200
+@@ -512,7 +512,7 @@
{
static char set_gdbtk_library_script[] = "\
- if {![info exists env(GDBTK_LIBRARY)]} {\n\
-- set env(GDBTK_LIBRARY) [file join [file dirname [file dirname $Paths(guidir)]] insight1.0]\n\
-+ set env(GDBTK_LIBRARY) [file join [file dirname [file dirname $Paths(guidir)]] insight]\n\
- }\n";
+ if {![info exists env(GDBTK_LIBRARY)]} {\n\
+- set env(GDBTK_LIBRARY) [file join [file dirname [file dirname $Paths(guidir)]] insight1.0]\n\
++ set env(GDBTK_LIBRARY) [file join [file dirname [file dirname $Paths(guidir)]] insight]\n\
+ }\n";
command_obj = Tcl_NewStringObj (set_gdbtk_library_script, -1);
-@@ -600,7 +600,7 @@
+@@ -598,7 +598,7 @@
proc gdbtk_find_main {} {\n\
global Paths GDBTK_LIBRARY\n\
rename gdbtk_find_main {}\n\
@@ -19,7 +19,7 @@ diff -Naur insight-6.8.orig/gdb/gdbtk/generic/gdbtk.c insight-6.8.new/gdb/gdbtk/
set Paths(appdir) $GDBTK_LIBRARY\n\
}\n\
gdbtk_find_main";
-@@ -616,7 +616,7 @@
+@@ -614,7 +614,7 @@
} else {\n\
set debug_startup 0\n\
}\n\
@@ -28,9 +28,9 @@ diff -Naur insight-6.8.orig/gdb/gdbtk/generic/gdbtk.c insight-6.8.new/gdb/gdbtk/
set Paths(appdir) $GDBTK_LIBRARY\n\
}\n\
gdbtk_find_main";
-diff -Naur insight-6.8.orig/gdb/gdbtk/library/main.tcl insight-6.8.new/gdb/gdbtk/library/main.tcl
---- insight-6.8.orig/gdb/gdbtk/library/main.tcl 2008-08-19 20:23:44.000000000 +0200
-+++ insight-6.8.new/gdb/gdbtk/library/main.tcl 2008-08-19 21:15:56.000000000 +0200
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/library/main.tcl insight-7.4.50.new/gdb/gdbtk/library/main.tcl
+--- insight-7.4.50.orig/gdb/gdbtk/library/main.tcl 2008-08-03 00:08:32.000000000 +0200
++++ insight-7.4.50.new/gdb/gdbtk/library/main.tcl 2012-04-03 13:50:55.375399743 +0200
@@ -38,9 +38,15 @@
lappend auto_path $GDBTK_LIBRARY
}
@@ -49,9 +49,9 @@ diff -Naur insight-6.8.orig/gdb/gdbtk/library/main.tcl insight-6.8.new/gdb/gdbtk
if {[file exists $dir]} {
lappend gdb_plugins $dir
lappend auto_path $dir
-diff -Naur insight-6.8.orig/gdb/gdbtk/plugins/HOW-TO insight-6.8.new/gdb/gdbtk/plugins/HOW-TO
---- insight-6.8.orig/gdb/gdbtk/plugins/HOW-TO 2002-08-14 20:06:06.000000000 +0200
-+++ insight-6.8.new/gdb/gdbtk/plugins/HOW-TO 2008-08-19 19:55:08.000000000 +0200
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/plugins/HOW-TO insight-7.4.50.new/gdb/gdbtk/plugins/HOW-TO
+--- insight-7.4.50.orig/gdb/gdbtk/plugins/HOW-TO 2002-08-14 20:06:06.000000000 +0200
++++ insight-7.4.50.new/gdb/gdbtk/plugins/HOW-TO 2012-04-03 13:50:55.375399743 +0200
@@ -81,7 +81,7 @@
be loaded.
@@ -79,9 +79,9 @@ diff -Naur insight-6.8.orig/gdb/gdbtk/plugins/HOW-TO insight-6.8.new/gdb/gdbtk/p
shared by all plug-ins so make sure your install script does not overwrite,
but append to it.
-diff -Naur insight-6.8.orig/gdb/gdbtk/plugins/Make-rules insight-6.8.new/gdb/gdbtk/plugins/Make-rules
---- insight-6.8.orig/gdb/gdbtk/plugins/Make-rules 2008-08-19 20:23:44.000000000 +0200
-+++ insight-6.8.new/gdb/gdbtk/plugins/Make-rules 2008-08-19 19:55:44.000000000 +0200
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/plugins/Make-rules insight-7.4.50.new/gdb/gdbtk/plugins/Make-rules
+--- insight-7.4.50.orig/gdb/gdbtk/plugins/Make-rules 2008-08-03 00:08:32.000000000 +0200
++++ insight-7.4.50.new/gdb/gdbtk/plugins/Make-rules 2012-04-03 13:50:55.375399743 +0200
@@ -104,12 +104,12 @@
install: $(INSTALL_TARGET)
@@ -98,10 +98,10 @@ diff -Naur insight-6.8.orig/gdb/gdbtk/plugins/Make-rules insight-6.8.new/gdb/gdb
done ;
html:
-diff -Naur insight-6.8.orig/gdb/gdbtk/README insight-6.8.new/gdb/gdbtk/README
---- insight-6.8.orig/gdb/gdbtk/README 2008-03-28 17:46:16.000000000 +0100
-+++ insight-6.8.new/gdb/gdbtk/README 2008-08-19 19:54:25.000000000 +0200
-@@ -123,7 +123,7 @@
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/README insight-7.4.50.new/gdb/gdbtk/README
+--- insight-7.4.50.orig/gdb/gdbtk/README 2009-11-09 20:31:57.000000000 +0100
++++ insight-7.4.50.new/gdb/gdbtk/README 2012-04-03 13:50:55.376399710 +0200
+@@ -132,7 +132,7 @@
To make more serious changes to the interface, such as adding a new window or
changing the framework, you will have to hack the tcl code (and probably the C
code as well). The tcl library install directory is $(libdir) (probably
@@ -110,10 +110,10 @@ diff -Naur insight-6.8.orig/gdb/gdbtk/README insight-6.8.new/gdb/gdbtk/README
private copy before putting it up for the rest of the users. To find the GDB tcl
code, GDB first checks for the environment variable GDBTK_LIBRARY. GDB will check
this directory for the file "main.tcl". If GDBTK_LIBRARY is not set, GDB will
-diff -Naur insight-6.8.orig/gdb/Makefile.in insight-6.8.new/gdb/Makefile.in
---- insight-6.8.orig/gdb/Makefile.in 2008-03-17 13:15:08.000000000 +0100
-+++ insight-6.8.new/gdb/Makefile.in 2008-08-19 21:17:52.000000000 +0200
-@@ -301,7 +301,7 @@
+diff -Naur insight-7.4.50.orig/gdb/Makefile.in insight-7.4.50.new/gdb/Makefile.in
+--- insight-7.4.50.orig/gdb/Makefile.in 2012-03-28 23:31:18.000000000 +0200
++++ insight-7.4.50.new/gdb/Makefile.in 2012-04-03 13:50:55.376399710 +0200
+@@ -376,7 +376,7 @@
# The version of gdbtk we're building. This should be kept
# in sync with GDBTK_VERSION and friends in gdbtk.h.
GDBTK_VERSION = 1.0
@@ -122,7 +122,7 @@ diff -Naur insight-6.8.orig/gdb/Makefile.in insight-6.8.new/gdb/Makefile.in
# Gdbtk requires an absolute path to the source directory or
# the testsuite won't run properly.
-@@ -3053,10 +3053,11 @@
+@@ -1738,10 +1738,11 @@
$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
$(SHELL) $(srcdir)/../mkinstalldirs \
$(DESTDIR)$(GDBTK_LIBRARY) ; \
@@ -136,11 +136,11 @@ diff -Naur insight-6.8.orig/gdb/Makefile.in insight-6.8.new/gdb/Makefile.in
$(SHELL) $(srcdir)/../mkinstalldirs \
$(DESTDIR)$(GDBTK_LIBRARY)/images \
$(DESTDIR)$(GDBTK_LIBRARY)/images2 ; \
-diff -Naur insight-6.8.orig/libgui/library/Makefile.am insight-6.8.new/libgui/library/Makefile.am
---- insight-6.8.orig/libgui/library/Makefile.am 2008-08-19 20:23:44.000000000 +0200
-+++ insight-6.8.new/libgui/library/Makefile.am 2008-08-19 19:52:49.000000000 +0200
-@@ -14,7 +14,7 @@
- PACKAGES = combobox.tcl
+diff -Naur insight-7.4.50.orig/libgui/library/Makefile.am insight-7.4.50.new/libgui/library/Makefile.am
+--- insight-7.4.50.orig/libgui/library/Makefile.am 2012-03-30 11:58:59.000000000 +0200
++++ insight-7.4.50.new/libgui/library/Makefile.am 2012-04-03 13:50:55.377399680 +0200
+@@ -12,7 +12,7 @@
+ pane.tcl panedwindow.tcl
## This directory is also referenced in paths.c, which see.
-guidir = $(datadir)/redhat/gui
@@ -148,9 +148,9 @@ diff -Naur insight-6.8.orig/libgui/library/Makefile.am insight-6.8.new/libgui/li
gui_DATA = tclIndex pkgIndex.tcl $(TCL) $(PACKAGES)
-diff -Naur insight-6.8.orig/libgui/src/Makefile.am insight-6.8.new/libgui/src/Makefile.am
---- insight-6.8.orig/libgui/src/Makefile.am 2008-08-19 20:23:44.000000000 +0200
-+++ insight-6.8.new/libgui/src/Makefile.am 2008-08-19 19:52:10.000000000 +0200
+diff -Naur insight-7.4.50.orig/libgui/src/Makefile.am insight-7.4.50.new/libgui/src/Makefile.am
+--- insight-7.4.50.orig/libgui/src/Makefile.am 2008-07-22 22:11:35.000000000 +0200
++++ insight-7.4.50.new/libgui/src/Makefile.am 2012-04-03 13:50:55.377399680 +0200
@@ -12,7 +12,7 @@
endif
@@ -160,9 +160,9 @@ diff -Naur insight-6.8.orig/libgui/src/Makefile.am insight-6.8.new/libgui/src/Ma
# tkTable version info
include $(srcdir)/tkTable_version.in
-diff -Naur insight-6.8.orig/libgui/src/paths.c insight-6.8.new/libgui/src/paths.c
---- insight-6.8.orig/libgui/src/paths.c 2008-08-19 20:23:44.000000000 +0200
-+++ insight-6.8.new/libgui/src/paths.c 2008-08-19 19:51:54.000000000 +0200
+diff -Naur insight-7.4.50.orig/libgui/src/paths.c insight-7.4.50.new/libgui/src/paths.c
+--- insight-7.4.50.orig/libgui/src/paths.c 2008-07-22 22:11:35.000000000 +0200
++++ insight-7.4.50.new/libgui/src/paths.c 2012-04-03 13:50:55.377399680 +0200
@@ -13,13 +13,13 @@
We first look for the gui library. This can be set by the
diff --git a/insight-7.4.50-security-errata-20050610.patch b/insight-7.4.50-security-errata-20050610.patch
new file mode 100644
index 0000000..d82838e
--- /dev/null
+++ b/insight-7.4.50-security-errata-20050610.patch
@@ -0,0 +1,216 @@
+diff -Naur insight-7.4.50.orig/gdb/cli/cli-cmds.c insight-7.4.50.new/gdb/cli/cli-cmds.c
+--- insight-7.4.50.orig/gdb/cli/cli-cmds.c 2012-03-01 20:30:21.000000000 +0100
++++ insight-7.4.50.new/gdb/cli/cli-cmds.c 2012-04-04 15:12:04.335397353 +0200
+@@ -39,6 +39,7 @@
+ #include "source.h"
+ #include "disasm.h"
+ #include "tracepoint.h"
++#include "gdb_stat.h"
+
+ #include "ui-out.h"
+
+@@ -484,7 +485,7 @@
+
+ int
+ find_and_open_script (const char *script_file, int search_path,
+- FILE **streamp, char **full_pathp)
++ FILE **streamp, char **full_pathp, int from_tty)
+ {
+ char *file;
+ int fd;
+@@ -510,6 +511,32 @@
+ return 0;
+ }
+
++#ifdef HAVE_GETUID
++ if (from_tty == -1)
++ {
++ struct stat statbuf;
++
++ if (fstat (fd, &statbuf) < 0)
++ {
++ int save_errno = errno;
++
++ close (fd);
++ do_cleanups (old_cleanups);
++ errno = save_errno;
++ return 0;
++ }
++ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH))
++ {
++ /* FILE gets freed by do_cleanups (old_cleanups). */
++ warning (_("not using untrusted file \"%s\""), file);
++ close (fd);
++ do_cleanups (old_cleanups);
++ errno = EPERM;
++ return 0;
++ }
++ }
++#endif
++
+ do_cleanups (old_cleanups);
+
+ *streamp = fdopen (fd, FOPEN_RT);
+@@ -576,13 +603,14 @@
+ if (file == NULL || *file == 0)
+ error (_("source command requires file name of file to source."));
+
+- if (!find_and_open_script (file, search_path, &stream, &full_path))
++ if (!find_and_open_script (file, search_path, &stream, &full_path,
++ from_tty))
+ {
+ /* The script wasn't found, or was otherwise inaccessible.
+ If the source command was invoked interactively, throw an
+ error. Otherwise (e.g. if it was invoked by a script),
+ silently ignore the error. */
+- if (from_tty)
++ if (from_tty > 0)
+ perror_with_name (file);
+ else
+ return;
+diff -Naur insight-7.4.50.orig/gdb/cli/cli-cmds.h insight-7.4.50.new/gdb/cli/cli-cmds.h
+--- insight-7.4.50.orig/gdb/cli/cli-cmds.h 2012-01-04 09:17:16.000000000 +0100
++++ insight-7.4.50.new/gdb/cli/cli-cmds.h 2012-04-04 15:12:04.337397302 +0200
+@@ -128,7 +128,8 @@
+ /* Exported to objfiles.c. */
+
+ extern int find_and_open_script (const char *file, int search_path,
+- FILE **streamp, char **full_path);
++ FILE **streamp, char **full_path,
++ int from_tty);
+
+ /* Command tracing state. */
+
+diff -Naur insight-7.4.50.orig/gdb/main.c insight-7.4.50.new/gdb/main.c
+--- insight-7.4.50.orig/gdb/main.c 2012-03-19 19:19:24.000000000 +0100
++++ insight-7.4.50.new/gdb/main.c 2012-04-04 15:12:04.335397353 +0200
+@@ -861,7 +861,7 @@
+ debugging or what directory you are in. */
+
+ if (home_gdbinit && !inhibit_gdbinit)
+- catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL);
++ catch_command_errors (source_script, home_gdbinit, -1, RETURN_MASK_ALL);
+
+ /* Now perform all the actions indicated by the arguments. */
+ if (cdarg != NULL)
+@@ -940,7 +940,7 @@
+ /* Read the .gdbinit file in the current directory, *if* it isn't
+ the same as the $HOME/.gdbinit file (it should exist, also). */
+ if (local_gdbinit && !inhibit_gdbinit)
+- catch_command_errors (source_script, local_gdbinit, 0, RETURN_MASK_ALL);
++ catch_command_errors (source_script, local_gdbinit, -1, RETURN_MASK_ALL);
+
+ /* Now that all .gdbinit's have been read and all -d options have been
+ processed, we can read any scripts mentioned in SYMARG.
+diff -Naur insight-7.4.50.orig/gdb/python/py-auto-load.c insight-7.4.50.new/gdb/python/py-auto-load.c
+--- insight-7.4.50.orig/gdb/python/py-auto-load.c 2012-03-19 19:23:52.000000000 +0100
++++ insight-7.4.50.new/gdb/python/py-auto-load.c 2012-04-04 15:12:04.336397329 +0200
+@@ -285,7 +285,7 @@
+ }
+
+ opened = find_and_open_script (file, 1 /*search_path*/,
+- &stream, &full_path);
++ &stream, &full_path, 1 /* from_tty */);
+
+ back_to = make_cleanup (null_cleanup, NULL);
+ if (opened)
+diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.base/gdbinit.exp insight-7.4.50.new/gdb/testsuite/gdb.base/gdbinit.exp
+--- insight-7.4.50.orig/gdb/testsuite/gdb.base/gdbinit.exp 1970-01-01 01:00:00.000000000 +0100
++++ insight-7.4.50.new/gdb/testsuite/gdb.base/gdbinit.exp 2012-04-04 15:12:04.335397353 +0200
+@@ -0,0 +1,91 @@
++# Copyright 2005
++# Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Please email any bugs, comments, and/or additions to this file to:
++# bug-gdb at prep.ai.mit.edu
++
++# This file was written by Jeff Johnston <jjohnstn at redhat.com>.
++
++# are we on a target board
++if [is_remote target] {
++ return
++}
++
++
++global verbose
++global GDB
++global GDBFLAGS
++global gdb_prompt
++global timeout
++global gdb_spawn_id;
++
++gdb_stop_suppressing_tests;
++
++verbose "Spawning $GDB -nw"
++
++if [info exists gdb_spawn_id] {
++ return 0;
++}
++
++if ![is_remote host] {
++ if { [which $GDB] == 0 } then {
++ perror "$GDB does not exist."
++ exit 1
++ }
++}
++
++set env(HOME) [pwd]
++remote_exec build "rm .gdbinit"
++remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit"
++remote_exec build "chmod 646 .gdbinit"
++
++set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $GDB failed."
++ return 1;
++}
++gdb_expect 360 {
++ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
++ pass "untrusted .gdbinit caught."
++ }
++ -re "$gdb_prompt $" {
++ fail "untrusted .gdbinit caught."
++ }
++ timeout {
++ fail "(timeout) untrusted .gdbinit caught."
++ }
++}
++
++remote_exec build "chmod 644 .gdbinit"
++set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $GDB failed."
++ return 1;
++}
++gdb_expect 360 {
++ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
++ fail "trusted .gdbinit allowed."
++ }
++ -re "in gdbinit.*$gdb_prompt $" {
++ pass "trusted .gdbinit allowed."
++ }
++ timeout {
++ fail "(timeout) trusted .gdbinit allowed."
++ }
++}
++
++remote_exec build "rm .gdbinit"
+diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.base/gdbinit.sample insight-7.4.50.new/gdb/testsuite/gdb.base/gdbinit.sample
+--- insight-7.4.50.orig/gdb/testsuite/gdb.base/gdbinit.sample 1970-01-01 01:00:00.000000000 +0100
++++ insight-7.4.50.new/gdb/testsuite/gdb.base/gdbinit.sample 2012-04-04 15:12:04.335397353 +0200
+@@ -0,0 +1 @@
++echo "\nin gdbinit"
diff --git a/insight-7.4.50-sig2dead.patch b/insight-7.4.50-sig2dead.patch
new file mode 100644
index 0000000..918490c
--- /dev/null
+++ b/insight-7.4.50-sig2dead.patch
@@ -0,0 +1,24 @@
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-hooks.c insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-hooks.c
+--- insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-hooks.c 2012-03-28 15:09:12.000000000 +0200
++++ insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-hooks.c 2012-04-05 12:44:20.284306992 +0200
+@@ -804,7 +804,7 @@
+ gdbtk_annotate_signal (void)
+ {
+ char *buf;
+- struct thread_info *tp = inferior_thread ();
++ struct thread_info *tp;
+
+ /* Inform gui that the target has stopped. This is
+ a necessary stop button evil. We don't want signal notification
+@@ -812,6 +812,11 @@
+ timeout. */
+ Tcl_Eval (gdbtk_interp, "gdbtk_stop_idle_callback");
+
++ if (ptid_equal(inferior_ptid, null_ptid))
++ return;
++
++ tp = inferior_thread ();
++
+ buf = xstrprintf ("gdbtk_signal %s {%s}",
+ target_signal_to_name (tp->suspend.stop_signal),
+ target_signal_to_string (tp->suspend.stop_signal));
diff --git a/insight-7.4.50-sizesizet.patch b/insight-7.4.50-sizesizet.patch
new file mode 100644
index 0000000..46fa2a0
--- /dev/null
+++ b/insight-7.4.50-sizesizet.patch
@@ -0,0 +1,22 @@
+diff -Naur insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-register.c insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-register.c
+--- insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-register.c 2012-03-30 09:36:10.000000000 +0200
++++ insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-register.c 2012-04-05 18:03:20.875181085 +0200
+@@ -239,7 +239,8 @@
+ {
+ Tcl_Obj *ar[3], *list;
+ char *buff;
+- buff = xstrprintf ("%lx", (size_t)TYPE_FIELD_TYPE (reg_vtype, i));
++ buff = xstrprintf ("%lx", (unsigned long)
++ (size_t)TYPE_FIELD_TYPE (reg_vtype, i));
+ ar[0] = Tcl_NewStringObj (TYPE_FIELD_NAME (reg_vtype, i), -1);
+ ar[1] = Tcl_NewStringObj (buff, -1);
+ if (TYPE_CODE (TYPE_FIELD_TYPE (reg_vtype, i)) == TYPE_CODE_FLT)
+@@ -255,7 +256,7 @@
+ {
+ Tcl_Obj *ar[3], *list;
+ char *buff;
+- buff = xstrprintf ("%lx", (size_t)reg_vtype);
++ buff = xstrprintf ("%lx", (unsigned long)(size_t)reg_vtype);
+ ar[0] = Tcl_NewStringObj (TYPE_NAME(reg_vtype), -1);
+ ar[1] = Tcl_NewStringObj (buff, -1);
+ if (TYPE_CODE (reg_vtype) == TYPE_CODE_FLT)
diff --git a/insight-7.4.50-unbundle.patch b/insight-7.4.50-unbundle.patch
new file mode 100644
index 0000000..36cf297
--- /dev/null
+++ b/insight-7.4.50-unbundle.patch
@@ -0,0 +1,103 @@
+diff -Naur insight-7.4.50.orig/configure.ac insight-7.4.50.new/configure.ac
+--- insight-7.4.50.orig/configure.ac 2012-03-15 15:13:31.000000000 +0100
++++ insight-7.4.50.new/configure.ac 2012-04-03 15:28:27.345616167 +0200
+@@ -2402,7 +2402,7 @@
+ # leave out the maybe dependencies when enable_gdbtk is false. I'm not
+ # 100% sure that that's safe though.
+
+-gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
++gdb_tk="maybe-all-libgui"
+ case "$enable_gdbtk" in
+ no)
+ GDB_TK="" ;;
+diff -Naur insight-7.4.50.orig/Makefile.def insight-7.4.50.new/Makefile.def
+--- insight-7.4.50.orig/Makefile.def 2011-11-09 19:57:28.000000000 +0100
++++ insight-7.4.50.new/Makefile.def 2012-04-03 15:24:04.838170860 +0200
+@@ -75,9 +75,6 @@
+ host_modules= { module= gold; bootstrap=true; };
+ host_modules= { module= gprof; };
+ host_modules= { module= intl; bootstrap=true; };
+-host_modules= { module= tcl;
+- missing=mostlyclean; };
+-host_modules= { module= itcl; };
+ host_modules= { module= ld; bootstrap=true; };
+ host_modules= { module= libcpp; bootstrap=true; };
+ host_modules= { module= libdecnumber; bootstrap=true; };
+@@ -93,7 +90,6 @@
+ missing= install-html;
+ missing= install-info; };
+ host_modules= { module= m4; };
+-host_modules= { module= readline; };
+ host_modules= { module= sid; };
+ host_modules= { module= sim; };
+ host_modules= { module= texinfo; no_install= true; };
+@@ -101,7 +97,6 @@
+ host_modules= { module= gdb; };
+ host_modules= { module= expect; };
+ host_modules= { module= guile; };
+-host_modules= { module= tk; };
+ host_modules= { module= libtermcap; no_check=true;
+ missing=mostlyclean;
+ missing=clean;
+@@ -343,18 +338,11 @@
+ dependencies = { module=all-gdb; on=all-libiberty; };
+ dependencies = { module=all-gdb; on=all-libiconv; };
+ dependencies = { module=all-gdb; on=all-opcodes; };
+-dependencies = { module=all-gdb; on=all-readline; };
+ dependencies = { module=all-gdb; on=all-build-bison; };
+ dependencies = { module=all-gdb; on=all-sim; };
+ dependencies = { module=all-gdb; on=all-libdecnumber; };
+ dependencies = { module=all-gdb; on=all-libtermcap; };
+
+-dependencies = { module=configure-libgui; on=configure-tcl; };
+-dependencies = { module=configure-libgui; on=configure-tk; };
+-dependencies = { module=all-libgui; on=all-tcl; };
+-dependencies = { module=all-libgui; on=all-tk; };
+-dependencies = { module=all-libgui; on=all-itcl; };
+-
+ // Host modules specific to binutils.
+ dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
+ dependencies = { module=configure-bfd; on=configure-intl; };
+@@ -414,42 +402,17 @@
+ dependencies = { module=all-opcodes; on=all-intl; };
+
+ // Other host modules in the 'src' repository.
+-dependencies = { module=all-dejagnu; on=all-tcl; };
+ dependencies = { module=all-dejagnu; on=all-expect; };
+-dependencies = { module=all-dejagnu; on=all-tk; };
+-dependencies = { module=configure-expect; on=configure-tcl; };
+-dependencies = { module=configure-expect; on=configure-tk; };
+-dependencies = { module=all-expect; on=all-tcl; };
+-dependencies = { module=all-expect; on=all-tk; };
+-
+-// We put install-tcl before install-itcl because itcl wants to run a
+-// program on installation which uses the Tcl libraries.
+-dependencies = { module=configure-itcl; on=configure-tcl; };
+-dependencies = { module=configure-itcl; on=configure-tk; };
+-dependencies = { module=all-itcl; on=all-tcl; };
+-dependencies = { module=all-itcl; on=all-tk; };
+-dependencies = { module=install-itcl; on=install-tcl; };
+-dependencies = { module=install-strip-itcl; on=install-strip-tcl; };
+-
+-dependencies = { module=configure-tk; on=configure-tcl; };
+-dependencies = { module=all-tk; on=all-tcl; };
+
+ dependencies = { module=all-sid; on=all-libiberty; };
+ dependencies = { module=all-sid; on=all-bfd; };
+ dependencies = { module=all-sid; on=all-opcodes; };
+-dependencies = { module=all-sid; on=all-tcl; };
+-dependencies = { module=all-sid; on=all-tk; };
+-dependencies = { module=install-sid; on=install-tcl; };
+-dependencies = { module=install-strip-sid; on=install-strip-tcl; };
+-dependencies = { module=install-sid; on=install-tk; };
+-dependencies = { module=install-strip-sid; on=install-strip-tk; };
+
+ dependencies = { module=configure-sim; on=configure-intl; };
+ dependencies = { module=all-sim; on=all-intl; };
+ dependencies = { module=all-sim; on=all-libiberty; };
+ dependencies = { module=all-sim; on=all-bfd; };
+ dependencies = { module=all-sim; on=all-opcodes; };
+-dependencies = { module=all-sim; on=all-readline; };
+ dependencies = { module=all-sim; on=configure-gdb; };
+
+ // Other host modules.
diff --git a/insight-7.4.50-x86-onstack-1of2.patch b/insight-7.4.50-x86-onstack-1of2.patch
new file mode 100644
index 0000000..90f99da
--- /dev/null
+++ b/insight-7.4.50-x86-onstack-1of2.patch
@@ -0,0 +1,73 @@
+diff -Naur insight-7.4.50.orig/gdb/dummy-frame.c insight-7.4.50.new/gdb/dummy-frame.c
+--- insight-7.4.50.orig/gdb/dummy-frame.c 2012-01-04 09:17:00.000000000 +0100
++++ insight-7.4.50.new/gdb/dummy-frame.c 2012-04-04 17:53:55.871287239 +0200
+@@ -29,6 +29,7 @@
+ #include "gdbcmd.h"
+ #include "gdb_string.h"
+ #include "observer.h"
++#include "gdbthread.h"
+
+ /* Dummy frame. This saves the processor state just prior to setting
+ up the inferior function call. Older targets save the registers
+@@ -108,19 +109,36 @@
+ xfree (dummy);
+ }
+
++/* Delete any breakpoint B which is a momentary breakpoint for return from
++ inferior call matching DUMMY_VOIDP. */
++
++static int
++pop_dummy_frame_bpt (struct breakpoint *b, void *dummy_voidp)
++{
++ struct dummy_frame *dummy = dummy_voidp;
++
++ if (b->disposition == disp_del && frame_id_eq (b->frame_id, dummy->id)
++ && b->thread == pid_to_thread_id (inferior_ptid))
++ delete_breakpoint (b);
++
++ /* Continue the traversal. */
++ return 0;
++}
++
+ /* Pop *DUMMY_PTR, restoring program state to that before the
+ frame was created. */
+
+ static void
+ pop_dummy_frame (struct dummy_frame **dummy_ptr)
+ {
+- struct dummy_frame *dummy;
++ struct dummy_frame *dummy = *dummy_ptr;
++
++ restore_infcall_suspend_state (dummy->caller_state);
+
+- restore_infcall_suspend_state ((*dummy_ptr)->caller_state);
++ iterate_over_breakpoints (pop_dummy_frame_bpt, dummy);
+
+ /* restore_infcall_control_state frees inf_state,
+ all that remains is to pop *dummy_ptr. */
+- dummy = *dummy_ptr;
+ *dummy_ptr = dummy->next;
+ xfree (dummy);
+
+diff -Naur insight-7.4.50.orig/gdb/testsuite/gdb.base/call-signal-resume.exp insight-7.4.50.new/gdb/testsuite/gdb.base/call-signal-resume.exp
+--- insight-7.4.50.orig/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-01-23 18:11:50.000000000 +0100
++++ insight-7.4.50.new/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-04-04 17:53:55.872287182 +0200
+@@ -101,6 +101,18 @@
+ gdb_test_no_output "set confirm off"
+ gdb_test "return" ""
+
++# Verify there are no remains of the dummy frame.
++gdb_test_no_output "maintenance print dummy-frames"
++set test "maintenance info breakpoints"
++gdb_test_multiple $test $test {
++ -re "call dummy.*\r\n$gdb_prompt $" {
++ fail $test
++ }
++ -re "\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
+ # Resume execution, the program should continue without any signal.
+
+ gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*"
diff --git a/insight.spec b/insight.spec
index 01ee4c7..e2fe4b6 100644
--- a/insight.spec
+++ b/insight.spec
@@ -1,35 +1,34 @@
-%global ver 6.8-1
+%global ver 7.4.50
+%global snap 20120403
+
+# CVS snapshots are produced as follows:
+#
+# 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.bz2 insight-%{ver}
Name: insight
Version: %(echo %{ver} | tr - .)
-Release: 5%{?dist}
+Release: 1.%{snap}cvs%{?dist}
Summary: Graphical debugger based on GDB
License: GPLv3+
Group: Development/Debuggers
Url: http://sources.redhat.com/insight/
-Source0: ftp://sourceware.org/pub/insight/releases/insight-%{ver}.tar.bz2
+# Source0: ftp://sourceware.org/pub/insight/releases/insight-%{ver}.tar.bz2
+Source0: insight-%{ver}.tar.bz2
Source1: insight.desktop
Source2: insight.1
-Patch1: insight-6.8-warnings.patch
-Patch2: insight-6.8-destdir.patch
-Patch3: insight-6.8-derefbug.patch
-Patch4: insight-6.8-gcc43.patch
-Patch5: insight-6.8-ia64bound.patch
-Patch6: insight-6.8-itcl33.patch
-Patch7: insight-6.8-syspackages.patch
-Patch8: insight-6.8-relocate.patch
-Patch9: insight-6.8-readline-system.patch
-Patch10: insight-6.8-tclm4.patch
-Patch11: insight-6.8-lib64.patch
-Patch12: insight-6.8-gcc44.patch
-Patch13: insight-6.8-doubleinstall.patch
-Patch14: insight-6.8-readline6.patch
-Patch15: insight-6.8.1-baseclassfield.patch
-Patch16: insight-6.8.1-sbrk.patch
-Patch17: insight-6.8.1-gcc45.patch
-Patch18: insight-6.8.1-unused.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: iwidgets
+Provides: bundled(binutils) = %{snap}
+Provides: bundled(gnulib) = %{snap}
+Provides: bundled(libiberty) = %{snap}
+Provides: bundled(md5-gcc) = %{snap}
BuildRequires: tcl-devel
BuildRequires: tk-devel
BuildRequires: itcl-devel >= 3.3
@@ -40,9 +39,62 @@ BuildRequires: readline-devel >= 6.0
BuildRequires: expat-devel
BuildRequires: ImageMagick
BuildRequires: desktop-file-utils
+BuildRequires: autogen
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: bison
+BuildRequires: flex
+BuildRequires: texinfo
+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
+
+# 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
+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
+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
%description
Insight is a tight graphical user interface to GDB written in Tcl/Tk.
@@ -56,38 +108,75 @@ GDB version 6.x.
#-------------------------------------------------------------------------------
%setup -q -n insight-%{ver}
-%patch1 -p1 -b .warnings
-%patch2 -p1 -b .destdir
-%patch3 -p1 -b .derefbug
-%patch4 -p1 -b .gcc43
-%patch5 -p1 -b .ia64bound
-%patch6 -p1 -b .itcl33
-%patch7 -p1 -b .syspackages
-%patch8 -p1 -b .relocate
-%patch9 -p1 -b .readline-system
-%patch10 -p1 -b .tclm4
-%patch11 -p1 -b .lib64
-%patch12 -p1 -b .gcc44
-%patch13 -p1 -b .doubleinstall
-%patch14 -p1 -b .readline6
-%patch15 -p1 -b .baseclassfield
-%patch16 -p1 -b .sbrk
-%patch17 -p1 -b .gcc45
-%patch18 -p1 -b .unused
+
+%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
+
+%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
#-------------------------------------------------------------------------------
%build
#-------------------------------------------------------------------------------
+TOPDIR=`pwd`
rm -rf itcl tcl tk readline
-# Patches "syspackages" and "relocate" requires some autotools rebuilds.
+# Need a complete reconfiguration after unbundling.
+
+autogen Makefile.def
+autoreconf
+
+# Patch requires some autotools rebuilds.
for location in gdb/gdbtk/plugins libgui
do (
cd $location
- aclocal
+ aclocal -I "${TOPDIR}/config"
automake
autoconf
)
@@ -97,6 +186,7 @@ done
(
cd gdb
+ aclocal -I "${TOPDIR}/config" -I gnulib/m4
autoconf
)
@@ -105,32 +195,6 @@ done
. "%{_libdir}/tclConfig.sh"
. "%{_libdir}/tkConfig.sh"
-# Bug in itcl/itk >= 3.3: no way to determine the include path.
-# Hack configure here.
-
-export ac_cv_c_itclh="%{_includedir}"
-export ac_cv_c_itkh="%{_includedir}"
-
-# We do our best here to have host=target, since this enables native mode,
-# thus local unix process debugging. We also try not to
-# cross-compile.
-# The ix86 processor family is the problem here.
-
-%ifarch %{ix86}
-%define test1 "%{_host_cpu}" == "i386" || "%{_host_cpu}" == "i486"
-%define test2 "%{_host_cpu}" == "i686" || "%{_host_cpu}" == "pentium3"
-%define test3 "%{_host_cpu}" == "pentium4" || "%{_host_cpu}" == "athlon"
-%if %{test1} || %{test2} || %{test3}
-%define test1 "%{_build_cpu}" == "i386" || "%{_build_cpu}" == "i486"
-%define test2 "%{_build_cpu}" == "i686" || "%{_build_cpu}" == "pentium3"
-%define test3 "%{_build_cpu}" == "pentium4" || "%{_build_cpu}" == "athlon"
-%if %{test1} || %{test2} || %{test3}
-%define _build %{_target_platform}
-%endif
-%define _host %{_target_platform}
-%endif
-%endif
-
%configure --enable-gdbtk \
--enable-sim \
--disable-rpath \
@@ -144,7 +208,6 @@ export ac_cv_c_itkh="%{_includedir}"
%else
--without-libunwind \
%endif
- %{_target_platform}
make %{?_smp_mflags}
@@ -164,15 +227,19 @@ make DESTDIR="${RPM_BUILD_ROOT}" INSTALL="${INSTALL}" install
(
cd "${RPM_BUILD_ROOT}"
+ rm -f .%{_bindir}/gdb-add-index
rm -f .%{_bindir}/gdb
rm -f .%{_bindir}/gdbtui
rm -f .%{_bindir}/gdbserver
+ rm -f .%{_bindir}/gstack
+ rm -rf .%{_datadir}/gdb
rm -rf .%{_includedir}
rm -f .%{_libdir}/*.a
rm -f .%{_libdir}/*.la
rm -f .%{_libdir}/*.sh
+ rm -f .%{_libdir}/libinproctrace.so
rm -rf .%{_prefix}/man
rm -rf .%{_datadir}/man
@@ -194,7 +261,6 @@ ${INSTALL} -m 644 -p "%{SOURCE2}" "${RPM_BUILD_ROOT}%{_mandir}/man1/"
${INSTALL} -m 755 -d "${RPM_BUILD_ROOT}%{_datadir}/applications"
desktop-file-install \
- --vendor "fedora" \
--dir "${RPM_BUILD_ROOT}%{_datadir}/applications" \
"%{SOURCE1}"
@@ -227,11 +293,21 @@ rm -rf "${RPM_BUILD_ROOT}"
#-------------------------------------------------------------------------------
%changelog
+#-------------------------------------------------------------------------------
+
+* Tue Apr 3 2012 Patrick Monnerat <pm at datasphere.ch> 7.4.50-1.20120403cvs
+- New cvs snapshot.
+- Patches imported or adapted from gdb package.
+- Patch "sig2dead" to avoid a segfault while notifying a signal to a dead
+ process.
+ http://sourceware.org/ml/insight/2012-q2/msg00002.html
+- Patch "sizesizet" to fix a type mismatch between print format descriptors and
+ corresponding argument.
+ http://sourceware.org/ml/insight/2012-q2/msg00003.html
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 6.8.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
-#-------------------------------------------------------------------------------
-
* Wed Feb 9 2011 Patrick Monnerat <pm at datasphere.ch> 6.8.1-4
- Patch "unused" to suppress "variable set but not used" errors.
- Patch "gcc45" to fix gcc 4.5 errors on incompatible enums.
diff --git a/sources b/sources
index 5f17386..c8d64b4 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-4ee9824c1e8d6108d886c6c09b24f0ac insight-6.8-1.tar.bz2
+4389c1f687d127765d579c7dc128edb1 insight-7.4.50.tar.bz2
More information about the scm-commits
mailing list