From: Jan RÄ™korajski Date: Fri, 2 Aug 2013 05:41:55 +0000 (+0200) Subject: - removed fedora/RH patchwork X-Git-Tag: auto/th/gdb-7.6-1~5 X-Git-Url: https://git.pld-linux.org/?a=commitdiff_plain;h=55fa9d9db63a56f0d482f1b3d046b7545cbcf20d;p=packages%2Fgdb.git - removed fedora/RH patchwork - removed oubsolete std_section and texinfo patches --- diff --git a/gdb-6.3-attach-see-vdso-test.patch b/gdb-6.3-attach-see-vdso-test.patch deleted file mode 100644 index a0923f8..0000000 --- a/gdb-6.3-attach-see-vdso-test.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/attach-see-vdso.c 6 Jul 2007 14:14:44 -0000 -@@ -0,0 +1,25 @@ -+/* 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. */ -+ -+#include -+ -+int main () -+{ -+ pause (); -+ return 1; -+} ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/attach-see-vdso.exp 6 Jul 2007 14:14:44 -0000 -@@ -0,0 +1,72 @@ -+# Copyright 2007 -+ -+# 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 created by Jan Kratochvil . -+ -+# This test only works on Linux -+if { ![istarget "*-*-linux-gnu*"] } { -+ return 0 -+} -+ -+set testfile "attach-see-vdso" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] -+ -+# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64). -+# -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } { -+ gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+# Start the program running and then wait for a bit, to be sure -+# that it can be attached to. -+ -+set testpid [eval exec $binfile &] -+ -+# Avoid some race: -+sleep 2 -+ -+# Start with clean gdb -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+# Never call: gdb_load ${binfile} -+# as the former problem would not reproduce otherwise. -+ -+set test "attach" -+gdb_test_multiple "attach $testpid" "$test" { -+ -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" { -+ pass "$test" -+ } -+} -+ -+gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO" -+ -+# Exit and detach the process. -+ -+gdb_exit -+ -+# Make sure we don't leave a process around to confuse -+# the next test run (and prevent the compile by keeping -+# the text file busy), in case the "set should_exit" didn't -+# work. -+ -+remote_exec build "kill -9 ${testpid}" diff --git a/gdb-6.3-bz140532-ppc-unwinding-test.patch b/gdb-6.3-bz140532-ppc-unwinding-test.patch deleted file mode 100644 index 6494cde..0000000 --- a/gdb-6.3-bz140532-ppc-unwinding-test.patch +++ /dev/null @@ -1,310 +0,0 @@ -diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S ---- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S 2007-08-02 13:23:10.000000000 -0400 -@@ -0,0 +1,78 @@ -+/* 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. */ -+ -+ .section ".text" -+ .align 2 -+ .globl func0 -+ .type func0, @function -+func0: -+ stwu 1,-16(1) -+ mflr 0 -+ stw 31,12(1) -+ stw 0,20(1) -+ mr 31,1 -+ bl abort -+ .size func0, .-func0 -+ .align 2 -+ .globl func1 -+ .type func1, @function -+func1: -+ stwu 1,-16(1) -+ mflr 0 -+/* 20 = BO = branch always -+ 31 = BI = CR bit (ignored) */ -+ bcl 20,31,.Lpie -+.Lpie: stw 31,12(1) -+ stw 0,20(1) -+ mr 31,1 -+ bl func0 -+ mr 0,3 -+ lis 9,var@ha -+ lwz 9,var@l(9) -+ add 0,0,9 -+ mr 3,0 -+ lwz 11,0(1) -+ lwz 0,4(11) -+ mtlr 0 -+ lwz 31,-4(11) -+ mr 1,11 -+ blr -+ .size func1, .-func1 -+ .section .note.GNU-stack,"",@progbits -+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)" -+ -+/* Original source file: -+ -+#include -+ -+extern volatile int var; -+ -+int func0 (void) __attribute__((__noinline__)); -+int func0 (void) -+{ -+ abort (); -+ return var; -+} -+ -+int func1 (void) __attribute__((__noinline__)); -+int func1 (void) -+{ -+ return func0 () + var; -+} -+ -+*/ -diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S ---- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S 2007-08-02 14:28:56.000000000 -0400 -@@ -0,0 +1,98 @@ -+/* 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. */ -+ -+ .section ".toc","aw" -+ .section ".text" -+ .align 2 -+ .globl func0 -+ .section ".opd","aw" -+ .align 3 -+func0: -+ .quad .L.func0,.TOC.@tocbase -+ .previous -+ .type func0, @function -+.L.func0: -+ mflr 0 -+ std 31,-8(1) -+ std 0,16(1) -+ stdu 1,-128(1) -+ mr 31,1 -+ bl abort -+ nop -+ .long 0 -+ .byte 0,0,0,1,128,1,0,1 -+ .size func0,.-.L.func0 -+ .section ".toc","aw" -+.LC1: -+ .tc var[TC],var -+ .section ".text" -+ .align 2 -+ .globl func1 -+ .section ".opd","aw" -+ .align 3 -+func1: -+ .quad .L.func1,.TOC.@tocbase -+ .previous -+ .type func1, @function -+.L.func1: -+ mflr 0 -+/* 20 = BO = branch always -+ 31 = BI = CR bit (ignored) */ -+ bcl 20,31,.Lpie -+.Lpie: std 31,-8(1) -+ std 0,16(1) -+ stdu 1,-128(1) -+ mr 31,1 -+ bl func0 -+ mr 11,3 -+ ld 9,.LC1@toc(2) -+ lwz 0,0(9) -+ add 0,11,0 -+ extsw 0,0 -+ mr 3,0 -+ ld 1,0(1) -+ ld 0,16(1) -+ mtlr 0 -+ ld 31,-8(1) -+ blr -+ .long 0 -+ .byte 0,0,0,1,128,1,0,1 -+ .size func1,.-.L.func1 -+ .section .note.GNU-stack,"",@progbits -+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)" -+ -+/* Original source file: -+ -+#include -+ -+extern volatile int var; -+ -+int func0 (void) __attribute__((__noinline__)); -+int func0 (void) -+{ -+ abort (); -+ return var; -+} -+ -+int func1 (void) __attribute__((__noinline__)); -+int func1 (void) -+{ -+ return func0 () + var; -+} -+ -+*/ -diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c ---- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c 2007-08-02 13:25:10.000000000 -0400 -@@ -0,0 +1,29 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2007 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -+ -+/* Force `-fpie' double jump bl->blrl. */ -+/* No longer used. */ -+volatile int var; -+ -+extern int func1 (void); -+ -+int main (void) -+{ -+ func1 (); -+ return 0; -+} -diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp ---- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 2007-08-02 14:21:29.000000000 -0400 -@@ -0,0 +1,72 @@ -+# Copyright 2006, 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. -+ -+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL -+# jump of the PIE code. -+ -+if ![istarget "powerpc*-*-linux*"] then { -+ verbose "Skipping powerpc-linux prologue tests." -+ return -+} -+ -+set testfile "powerpc-bcl-prologue" -+set srcfile1 ${testfile}.c -+set flags "debug" -+if [istarget "powerpc-*"] then { -+ set srcfile2 ${testfile}-asm32.S -+ set flags "$flags additional_flags=-m32" -+} elseif [istarget "powerpc64-*"] then { -+ set srcfile2 ${testfile}-asm64.S -+ set flags "$flags additional_flags=-m64" -+} else { -+ fail "powerpc arch test" -+ return -+} -+set objfile2 ${objdir}/${subdir}/${testfile}-asm.o -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# We should stop in abort(3). -+ -+gdb_run_cmd -+ -+gdb_test_multiple {} "continue to abort()" { -+ -re ".*Program received signal SIGABRT,.*$gdb_prompt $" { -+ pass "continue to abort()" -+ } -+} -+ -+# Check backtrace: -+# #3 0x0804835f in func0 () -+# #4 0x0804836a in func1 () -+# #5 0x0804838c in main () -+# (gdb) -+# `\\.?' prefixes are needed for ppc64 without `debug' (another bug). -+ -+set test "matching unwind" -+gdb_test_multiple "backtrace" $test { -+ -re "\r\n#\[0-9\]\[^\r\n\]* in \\.?func0 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?func1 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?main \\(\[^\r\n\]*\r\n$gdb_prompt $" { -+ pass $test -+ } -+} - -Fixup the testcase for ppc64 biarch GDB. - ---- ./gdb/testsuite/gdb.arch/powerpc-prologue.exp 2008-01-13 13:32:19.000000000 +0100 -+++ ./gdb/testsuite/gdb.arch/powerpc-prologue.exp 2008-01-02 00:04:10.000000000 +0100 -@@ -17,8 +17,9 @@ - # Test PowerPC prologue analyzer. - - # Do not run on AIX (where we won't be able to build the tests without --# some surgery) or on PowerPC64 (ditto, dot symbols). --if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then { -+# some surgery). PowerPC64 target would break due to dot symbols but we build -+# there PowerPC32 inferior. -+if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} then { - verbose "Skipping PowerPC prologue tests." - return - } diff --git a/gdb-6.3-bz202689-exec-from-pthread-test.patch b/gdb-6.3-bz202689-exec-from-pthread-test.patch deleted file mode 100644 index 91dc69a..0000000 --- a/gdb-6.3-bz202689-exec-from-pthread-test.patch +++ /dev/null @@ -1,98 +0,0 @@ -2007-01-17 Jan Kratochvil - - * gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files. - - ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.threads/threaded-exec.c 17 Jan 2007 23:10:22 -0000 -@@ -0,0 +1,46 @@ -+/* 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. */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+ -+static void * -+threader (void *arg) -+{ -+ return NULL; -+} -+ -+int -+main (void) -+{ -+ pthread_t t1; -+ int i; -+ -+ i = pthread_create (&t1, NULL, threader, (void *) NULL); -+ assert (i == 0); -+ i = pthread_join (t1, NULL); -+ assert (i == 0); -+ -+ execl ("/bin/true", "/bin/true", NULL); -+ abort (); -+} ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.threads/threaded-exec.exp 17 Jan 2007 23:10:22 -0000 -@@ -0,0 +1,41 @@ -+# threaded-exec.exp -- Check reset of the tracked threads on exec*(2) -+# Copyright (C) 2007 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+set testfile threaded-exec -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+gdb_load ${binfile} -+ -+gdb_run_cmd -+ -+gdb_test_multiple {} "Program exited" { -+ -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { -+ pass "Program exited" -+ } -+} diff --git a/gdb-6.3-bz231832-obstack-2gb.patch b/gdb-6.3-bz231832-obstack-2gb.patch deleted file mode 100644 index 0b08cee..0000000 --- a/gdb-6.3-bz231832-obstack-2gb.patch +++ /dev/null @@ -1,192 +0,0 @@ -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 - #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-focus-cmd-prev-test.patch b/gdb-6.3-focus-cmd-prev-test.patch deleted file mode 100644 index 88f52f1..0000000 --- a/gdb-6.3-focus-cmd-prev-test.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- /dev/null 2008-03-23 13:41:46.072650180 +0100 -+++ gdb-6.3/gdb/testsuite/gdb.base/focus-cmd-prev.exp 2008-03-23 23:46:45.000000000 +0100 -@@ -0,0 +1,25 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+gdb_exit -+gdb_start -+ -+gdb_test "focus cmd" -+gdb_test "focus prev" diff --git a/gdb-6.3-gcore-thread-20050204.patch b/gdb-6.3-gcore-thread-20050204.patch deleted file mode 100644 index 31ecbba..0000000 --- a/gdb-6.3-gcore-thread-20050204.patch +++ /dev/null @@ -1,25 +0,0 @@ -2005-02-07 Jeff Johnston - - * 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 deleted file mode 100644 index d6f4cb0..0000000 --- a/gdb-6.3-gstack-20050411.patch +++ /dev/null @@ -1,232 +0,0 @@ -2004-11-23 Andrew Cagney - - * 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` " 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 <&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 . -+ -+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 . */ -+ -+#include -+#include -+#include -+ -+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 deleted file mode 100644 index ecdfbae..0000000 --- a/gdb-6.3-ia64-gcore-page0-20050421.patch +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index f902e62..0000000 --- a/gdb-6.3-ia64-gcore-speedup-20050714.patch +++ /dev/null @@ -1,126 +0,0 @@ -2005-07-14 Jeff Johnsotn - - * 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//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 deleted file mode 100644 index 2ebab9e..0000000 --- a/gdb-6.3-ia64-info-frame-fix-20050725.patch +++ /dev/null @@ -1,107 +0,0 @@ -2005-07-25 Jeff Johnstno - - * libunwind-frame.c (libunwind_frame_prev_register): Check valuep - is not NULL before copying cursor address into it. - -testsuite: -2005-07-25 Jeff Johnstno - - * gdb.arch/ia64-sigtramp.exp: New test. - * gdb.arch/ia64-sigtramp.c: Ditto. - -2008-02-24 Jan Kratochvil - - 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 -+#include -+ -+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@prep.ai.mit.edu -+ -+# This file was written by Jeff Johnston (jjohnstn@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 deleted file mode 100644 index bf8a1f1..0000000 --- a/gdb-6.3-ia64-sigill-20051115.patch +++ /dev/null @@ -1,95 +0,0 @@ -2005-11-15 Jeff Johnston - - * 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 - - * 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@prep.ai.mit.edu -+ -+# This file was written by Jeff Johnston (jjohnstn@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 -+ -+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 deleted file mode 100644 index c6a7789..0000000 --- a/gdb-6.3-ia64-sigtramp-frame-20050708.patch +++ /dev/null @@ -1,158 +0,0 @@ -2005-07-08 Jeff Johnston - - * ia64-tdep.c (ia64_sigtramp_frame_prev_register): Build - pseudo-registers the same as ia64_pseudo_register_read. - -2008-04-16 Yi Zhan - - * ia64-tdep.c (ia64_sigtramp_frame_prev_register): Fix an - ISO C compliance compilation error. - -2008-02-12 Jan Kratochvil - - 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-inferior-notification-20050721.patch b/gdb-6.3-inferior-notification-20050721.patch deleted file mode 100644 index 0eb397c..0000000 --- a/gdb-6.3-inferior-notification-20050721.patch +++ /dev/null @@ -1,315 +0,0 @@ -2005-07-21 Jeff Johnston - - * gdb.base/attach-32.exp: New test for attaching in 32-bit - mode on 64-bit systems. - * gdb.base/attach-32.c: Ditto. - * gdb.base/attach-32b.c: Ditto. - -2007-12-26 Jan Kratochvil - - * gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set. - -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/attach-32.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/attach-32.c 2011-03-20 20:15:57.000000000 +0100 -@@ -0,0 +1,20 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return 0; -+} -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/attach-32.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/attach-32.exp 2011-03-20 20:20:03.000000000 +0100 -@@ -0,0 +1,245 @@ -+# 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. -+# -+# This test was based on attach.exp and modified for 32/64 bit Linux systems. */ -+ -+# On HP-UX 11.0, this test is causing a process running the program -+# "attach" to be left around spinning. Until we figure out why, I am -+# commenting out the test to avoid polluting tiamat (our 11.0 nightly -+# test machine) with these processes. RT -+# -+# Setting the magic bit in the target app should work. I added a -+# "kill", and also a test for the R3 register warning. JB -+if { ![istarget "x86_64*-*linux*"] -+ && ![istarget "powerpc64*-*linux*"]} { -+ return 0 -+} -+ -+# are we on a target board -+if [is_remote target] then { -+ return 0 -+} -+ -+set testfile "attach-32" -+set srcfile ${testfile}.c -+set srcfile2 ${testfile}b.c -+set binfile ${objdir}/${subdir}/${testfile} -+set binfile2 ${objdir}/${subdir}/${testfile}b -+set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] -+ -+#execute_anywhere "rm -f ${binfile} ${binfile2}" -+remote_exec build "rm -f ${binfile} ${binfile2}" -+# For debugging this test -+# -+#log_user 1 -+ -+# build the first test case -+# -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-m32"]] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+# Build the in-system-call test -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable [list debug "additional_flags=-m32"]] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+proc do_attach_tests {} { -+ global gdb_prompt -+ global binfile -+ global escapedbinfile -+ global srcfile -+ global testfile -+ global objdir -+ global subdir -+ global timeout -+ global testpid -+ -+ # Verify that we can "see" the variable "should_exit" in the -+ # program, and that it is zero. -+ -+ gdb_test "print should_exit" " = 0" "after attach-32, print should_exit" -+ -+ # Verify that we can modify the variable "should_exit" in the -+ # program. -+ -+ gdb_test "set should_exit=1" "" "after attach-32, set should_exit" -+ -+ # Verify that the modification really happened. -+ -+ send_gdb "tbreak 19\n" -+ gdb_expect { -+ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" { -+ pass "after attach-32, set tbreak postloop" -+ } -+ -re "$gdb_prompt $" { -+ fail "after attach-32, set tbreak postloop" -+ } -+ timeout { -+ fail "(timeout) after attach-32, set tbreak postloop" -+ } -+ } -+ send_gdb "continue\n" -+ gdb_expect { -+ -re "main.*at.*$srcfile:19.*$gdb_prompt $" { -+ pass "after attach-32, reach tbreak postloop" -+ } -+ -re "$gdb_prompt $" { -+ fail "after attach-32, reach tbreak postloop" -+ } -+ timeout { -+ fail "(timeout) after attach-32, reach tbreak postloop" -+ } -+ } -+ -+ # Allow the test process to exit, to cleanup after ourselves. -+ -+ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach-32, exit" -+ -+ # Make sure we don't leave a process around to confuse -+ # the next test run (and prevent the compile by keeping -+ # the text file busy), in case the "set should_exit" didn't -+ # work. -+ -+ remote_exec build "kill -9 ${testpid}" -+ -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ -+ set testpid [eval exec $binfile &] -+ exec sleep 2 -+ if { [istarget "*-*-cygwin*"] } { -+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -+ # different due to the way fork/exec works. -+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -+ } -+ -+ # Verify that we can attach to the process, and find its a.out -+ # when we're cd'd to some directory that doesn't contain the -+ # a.out. (We use the source path set by the "dir" command.) -+ -+ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \ -+ "set source path" -+ -+ gdb_test "cd /tmp" "Working directory /tmp." \ -+ "cd away from process working directory" -+ -+ # Explicitly flush out any knowledge of the previous attachment. -+ -+ set test "before attach-32-3, flush symbols" -+ gdb_test_multiple "symbol" "$test" { -+ -re "Discard symbol table from.*y or n. $" { -+ gdb_test "y" "No symbol file now." \ -+ "$test" -+ } -+ -re "No symbol file now.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ gdb_test "exec" "No executable file now." \ -+ "before attach-32-3, flush exec" -+ -+ gdb_test "attach $testpid" \ -+ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \ -+ "attach-32 when process' a.out not in cwd" -+ -+ set test "after attach-32-3, exit" -+ gdb_test_multiple "kill" "$test" { -+ -re "Kill the program being debugged.*y or n. $" { -+ gdb_test "y" "" "$test" -+ } -+ } -+ -+ # Another "don't leave a process around" -+ remote_exec build "kill -9 ${testpid}" -+} -+ -+proc do_call_attach_tests {} { -+ global gdb_prompt -+ global binfile2 -+ global testpid -+ -+ # See if other registers are problems -+ -+ set test "info other register" -+ gdb_test_multiple "i r r3" "$test" { -+ -re "warning: reading register.*$gdb_prompt $" { -+ fail "$test" -+ } -+ -re "r3.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ # Get rid of the process -+ -+ gdb_test "p should_exit = 1" -+ gdb_test "c" {\[Inferior .* exited normally\]} -+ -+ # Be paranoid -+ -+ remote_exec build "kill -9 ${testpid}" -+} -+ -+ -+# Start with a fresh gdb -+ -+gdb_exit -+set testpid [eval exec $binfile &] -+exec sleep 3 -+if { [istarget "*-*-cygwin*"] } { -+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -+ # different due to the way fork/exec works. -+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -+} -+ -+set GDBFLAGS_orig $GDBFLAGS -+set GDBFLAGS "--pid=$testpid" -+gdb_start -+set GDBFLAGS $GDBFLAGS_orig -+ -+gdb_reinitialize_dir $srcdir/$subdir -+ -+# This is a test of gdb's ability to attach to a running process. -+ -+do_attach_tests -+ -+# Test attaching when the target is inside a system call -+ -+gdb_exit -+set testpid [eval exec $binfile2 &] -+exec sleep 3 -+if { [istarget "*-*-cygwin*"] } { -+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -+ # different due to the way fork/exec works. -+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -+} -+ -+set GDBFLAGS_orig $GDBFLAGS -+set GDBFLAGS "--pid=$testpid" -+gdb_start -+set GDBFLAGS $GDBFLAGS_orig -+ -+gdb_reinitialize_dir $srcdir/$subdir -+do_call_attach_tests -+ -+return 0 -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.base/attach-32b.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.base/attach-32b.c 2011-03-20 20:15:57.000000000 +0100 -@@ -0,0 +1,24 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+#include -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ sleep( 10 ); /* System call causes register fetch to fail */ -+ /* This is a known HPUX "feature" */ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return (0); -+} diff --git a/gdb-6.3-inheritancetest-20050726.patch b/gdb-6.3-inheritancetest-20050726.patch deleted file mode 100644 index ab81976..0000000 --- a/gdb-6.3-inheritancetest-20050726.patch +++ /dev/null @@ -1,153 +0,0 @@ -2005-07-26 Jeff Johnston - - * gdb.cp/b146835.exp: New testcase. - * gdb.cp/b146835.cc: Ditto. - * gdb.cp/b146835b.cc: Ditto. - * gdb.cp/b146835.h: Ditto. - -Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835b.cc -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835b.cc 2009-08-12 06:07:50.000000000 +0200 -@@ -0,0 +1,11 @@ -+#include "b146835.h" -+ -+C::C() { d = 0; x = 3; } -+ -+int C::z (char *s) { return 0; } -+ -+C::~C() {} -+ -+void A::funcD (class E *e, class D *d) {} -+void A::funcE (E *e, D *d) {} -+void A::funcF (unsigned long x, D *d) {} -Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.cc -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.cc 2009-08-12 06:07:50.000000000 +0200 -@@ -0,0 +1,32 @@ -+#include "b146835.h" -+#include -+ -+class F : public C { -+ -+protected: -+ -+ virtual void funcA (unsigned long a, B *b); -+ virtual void funcB (E *e); -+ virtual void funcC (unsigned long x, bool y); -+ -+ char *s1, *s2; -+ bool b1; -+ int k; -+ -+public: -+ void foo() { -+ std::cout << "foo" << std::endl; -+ } -+}; -+ -+ -+void F::funcA (unsigned long a, B *b) {} -+void F::funcB (E *e) {} -+void F::funcC (unsigned long x, bool y) {} -+ -+int main() -+{ -+ F f; -+ f.foo(); -+} -+ -Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp 2009-08-12 06:58:28.000000000 +0200 -@@ -0,0 +1,47 @@ -+# This testcase is part of GDB, the GNU debugger. -+ -+# 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. -+ -+# Check that GDB can properly print an inherited member variable -+# (Bugzilla 146835) -+ -+set testfile "b146835" -+set srcfile ${testfile}.cc -+set srcfile2 ${testfile}b.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable {debug c++}] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# -+# Run to `main' where we begin our tests. -+# -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+gdb_test "break 'F::foo()'" "" -+gdb_continue_to_breakpoint "First line foo" -+ -+# Verify that we can access the inherited member d -+gdb_test "p d" " = \\(D \\*\\) *0x0" "Verify inherited member d accessible" -Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.h 2009-08-12 06:07:50.000000000 +0200 -@@ -0,0 +1,36 @@ -+ -+class A { -+ -+protected: -+ -+ virtual void funcA (unsigned long a, class B *b) = 0; -+ virtual void funcB (class E *e) = 0; -+ virtual void funcC (unsigned long x, bool y) = 0; -+ -+ void funcD (class E *e, class D* d); -+ virtual void funcE (E *e, D *d); -+ virtual void funcF (unsigned long x, D *d); -+}; -+ -+ -+class C : public A { -+ -+protected: -+ -+ int x; -+ class K *k; -+ class H *h; -+ -+ D *d; -+ -+ class W *w; -+ class N *n; -+ class L *l; -+ unsigned long *r; -+ -+public: -+ -+ C(); -+ int z (char *s); -+ virtual ~C(); -+}; diff --git a/gdb-6.3-mapping-zero-inode-test.patch b/gdb-6.3-mapping-zero-inode-test.patch deleted file mode 100644 index 73d2446..0000000 --- a/gdb-6.3-mapping-zero-inode-test.patch +++ /dev/null @@ -1,229 +0,0 @@ -Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.exp 2009-06-29 16:24:36.000000000 +0200 -@@ -0,0 +1,96 @@ -+# Copyright 2007, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Test GDB's handling of gcore for mapping with a name but zero inode. -+ -+if { [prepare_for_testing gcore-shmid0.exp gcore-shmid0] } { -+ return -1 -+} -+ -+# Does this gdb support gcore? -+set test "help gcore" -+gdb_test_multiple $test $test { -+ -re "Undefined command: .gcore.*$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 .*$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+if { ! [ runto_main ] } then { -+ untested gcore-shmid0.exp -+ return -1 -+} -+ -+gdb_breakpoint "initialized" -+gdb_breakpoint "unresolved" -+ -+set test "Continue to initialized." -+gdb_test_multiple "continue" $test { -+ -re "Breakpoint .*, initialized .* at .*\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "Breakpoint .*, unresolved .* at .*\r\n$gdb_prompt $" { -+ unsupported $test -+ return -1 -+ } -+} -+ -+set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore-shmid0.test] -+ -+set test "save a corefile" -+gdb_test_multiple "gcore ${objdir}/${subdir}/gcore-shmid0.test" $test { -+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { -+ pass $test -+ } -+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { -+ unsupported $test -+ } -+} -+ -+# Be sure to remove the handle first. -+# But it would get removed even on a kill by GDB as the handle is already -+# deleted, just it is still attached. -+gdb_continue_to_end "finish" -+ -+set test "core-file command" -+gdb_test_multiple "core-file $objdir/$subdir/gcore-shmid0.test" $test { -+ -re ".* program is being debugged already.*y or n. $" { -+ # gdb_load may connect us to a gdbserver. -+ send_gdb "y\n" -+ exp_continue; -+ } -+ -re "Core was generated by .*\r\n\#0 .*\\\(\\\).*\r\n$gdb_prompt $" { -+ # The filename does not fit there anyway so do not check it. -+ pass $test -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "core-file command (could not read registers from core file)" -+ } -+} -+ -+set test "backtrace" -+gdb_test_multiple "bt" $test { -+ -re "#0 *initialized \\\(\\\) at .*#1 .* main \\\(.*$gdb_prompt $" { -+ pass $test -+ } -+ -re "#0 *initialized \\\(\\\) at .*Cannot access memory at address .*$gdb_prompt $" { -+ fail $test -+ } -+} -Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.c 2009-06-29 16:22:49.000000000 +0200 -@@ -0,0 +1,123 @@ -+/* Copyright 2007, 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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. */ -+ -+/* -+ * Test GDB's handling of gcore for mapping with a name but zero inode. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* The same test running in a parallel testsuite may steal us the zero SID, -+ even if we never get any EEXIST. Just try a while. */ -+ -+#define TIMEOUT_SEC 10 -+ -+static void -+initialized (void) -+{ -+} -+ -+static void -+unresolved (void) -+{ -+} -+ -+int -+main (void) -+{ -+ int sid; -+ unsigned int *addr = (void *) -1L; -+ int attempt, round = 0; -+ time_t ts_start, ts; -+ -+ if (time (&ts_start) == (time_t) -1) -+ { -+ printf ("time (): %m\n"); -+ exit (1); -+ } -+ -+ /* The generated SID will cycle with an increment of 32768, attempt until it -+ * wraps to 0. */ -+ -+ for (attempt = 0; addr == (void *) -1L; attempt++) -+ { -+ /* kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by -+ shmget(2). shmget returns SID range 0..1<<31 in steps of 32768, -+ 0x1000 should be enough but wrap the range it to be sure. */ -+ -+ if (attempt > 0x21000) -+ { -+ if (time (&ts) == (time_t) -1) -+ { -+ printf ("time (): %m\n"); -+ exit (1); -+ } -+ -+ if (ts >= ts_start && ts < ts_start + TIMEOUT_SEC) -+ { -+ attempt = 0; -+ round++; -+ continue; -+ } -+ -+ printf ("Problem is not reproducible on this kernel (attempt %d, " -+ "round %d))\n", attempt, round); -+ unresolved (); -+ exit (1); -+ } -+ -+ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777); -+ if (sid == -1) -+ { -+ if (errno == EEXIST) -+ continue; -+ -+ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno); -+ exit (1); -+ } -+ -+ /* Use SID only if it is 0, retry it otherwise. */ -+ -+ if (sid == 0) -+ { -+ addr = shmat (sid, NULL, SHM_RND); -+ if (addr == (void *) -1L) -+ { -+ printf ("shmat (%d, NULL, SHM_RND): errno %d\n", sid, -+ errno); -+ exit (1); -+ } -+ } -+ if (shmctl (sid, IPC_RMID, NULL) != 0) -+ { -+ printf ("shmctl (%d, IPC_RMID, NULL): errno %d\n", sid, errno); -+ exit (1); -+ } -+ } -+ -+ initialized (); -+ -+ return 0; -+} diff --git a/gdb-6.3-ppc64displaysymbol-20041124.patch b/gdb-6.3-ppc64displaysymbol-20041124.patch deleted file mode 100644 index 8e94e00..0000000 --- a/gdb-6.3-ppc64displaysymbol-20041124.patch +++ /dev/null @@ -1,24 +0,0 @@ -2004-11-24 Andrew Cagney - - * 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 deleted file mode 100644 index a237cc1..0000000 --- a/gdb-6.3-ppc64syscall-20040622.patch +++ /dev/null @@ -1,111 +0,0 @@ -2004-06-22 Andrew Cagney - - * 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.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch deleted file mode 100644 index 7728070..0000000 --- a/gdb-6.3-readnever-20050907.patch +++ /dev/null @@ -1,98 +0,0 @@ -2004-11-18 Andrew Cagney - - * dwarf2read.c: Include "top.c". - (dwarf2_has_info): Check for readnever_symbol_files. - * symfile.c (readnever_symbol_files): Define. - * top.h (readnever_symbol_files): Declare. - * main.c (captured_main): Add --readnever option. - (print_gdb_help): Ditto. - -2004-11-18 Andrew Cagney - - * gdb.texinfo (File Options): Document --readnever. - -Index: gdb-7.4.50.20120703/gdb/doc/gdb.texinfo -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/doc/gdb.texinfo 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/doc/gdb.texinfo 2012-07-03 17:31:40.695642449 +0200 -@@ -1023,6 +1023,12 @@ Read each symbol file's entire symbol ta - the default, which is to read it incrementally as it is needed. - This makes startup slower, but makes future operations faster. - -+@item --readnever -+@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 -Index: gdb-7.4.50.20120703/gdb/main.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/main.c 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/main.c 2012-07-03 17:31:40.696642448 +0200 -@@ -414,6 +414,7 @@ captured_main (void *data) - {"xdb", no_argument, &xdb_commands, 1}, - {"dbx", no_argument, &dbx_commands, 1}, - {"readnow", no_argument, &readnow_symbol_files, 1}, -+ {"readnever", no_argument, &readnever_symbol_files, 1}, - {"r", no_argument, &readnow_symbol_files, 1}, - {"quiet", no_argument, &quiet, 1}, - {"q", no_argument, &quiet, 1}, -@@ -1131,6 +1132,7 @@ Options:\n\n\ - fputs_unfiltered (_("\ - --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\ -Index: gdb-7.4.50.20120703/gdb/symfile.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/symfile.c 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/symfile.c 2012-07-03 17:31:40.697642447 +0200 -@@ -81,6 +81,7 @@ static void clear_symtab_users_cleanup ( - - /* Global variables owned by this file. */ - int readnow_symbol_files; /* Read full symbols immediately. */ -+int readnever_symbol_files; /* Never read full symbols. */ - - /* External variables and functions referenced. */ - -Index: gdb-7.4.50.20120703/gdb/dwarf2read.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/dwarf2read.c 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/dwarf2read.c 2012-07-03 17:31:53.421627153 +0200 -@@ -65,6 +65,7 @@ - #include "gdb/gdb-index.h" - #include - #include "gdb_bfd.h" -+#include "top.h" - - #include - #include "gdb_string.h" -@@ -1587,8 +1588,9 @@ dwarf2_has_info (struct objfile *objfile - (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 -Index: gdb-7.4.50.20120703/gdb/top.h -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/top.h 2012-01-23 18:12:30.000000000 +0100 -+++ gdb-7.4.50.20120703/gdb/top.h 2012-07-03 17:31:40.700642444 +0200 -@@ -60,6 +60,7 @@ extern void set_prompt (const char *s); - - /* From random places. */ - extern int readnow_symbol_files; -+extern int readnever_symbol_files; - - /* Perform _initialize initialization. */ - extern void gdb_init (char *); diff --git a/gdb-6.3-rh-dummykfail-20041202.patch b/gdb-6.3-rh-dummykfail-20041202.patch deleted file mode 100644 index 1f0bc9d..0000000 --- a/gdb-6.3-rh-dummykfail-20041202.patch +++ /dev/null @@ -1,22 +0,0 @@ -2003-07-11 Elena Zannoni - - * lib/gdb.exp (setup_kfail, kfail): Redefine procedures. - ---- ./gdb/testsuite/lib/gdb.exp.1 2004-11-24 15:59:46.131394720 -0500 -+++ ./gdb/testsuite/lib/gdb.exp 2004-11-24 16:01:06.304206600 -0500 -@@ -63,6 +63,15 @@ - - ### Only procedures should come after this point. - -+if {![llength [info procs kfail]]} { -+ proc setup_kfail { args } { -+ #setup_xfail args -+ } -+ proc kfail { bugid message } { -+ fail $message -+ } -+} -+ - # - # gdb_version -- extract and print the version number of GDB - # diff --git a/gdb-6.3-rh-testlibunwind-20041202.patch b/gdb-6.3-rh-testlibunwind-20041202.patch deleted file mode 100644 index 0a121c3..0000000 --- a/gdb-6.3-rh-testlibunwind-20041202.patch +++ /dev/null @@ -1,103 +0,0 @@ -2003-11-17 Elena Zannoni - - From Jeff Johnston - * gdb.arch/ia64-libunwind.exp: New file. - * gdb.arch/ia64-libunwind.c: New file. - -2004-08-03 Jeff Johnston - - * gdb.arch/ia64-libunwind.exp: Fix test string to match - current code base. - - [ acquire_unwind_info -> ia64_find_proc_info_x ] - -2009-04-30 Jan Kratochvil - - Remove a race from send_gdb "COMMAND\n". - Cleanup. - Merge in: Patch4: gdb-6.3-rh-testlibunwind1fix-20041202.patch - ---- /dev/null 2009-04-19 08:52:54.499000000 +0200 -+++ gdb-6.8/gdb/testsuite/gdb.arch/ia64-libunwind.c 2009-04-30 19:15:16.000000000 +0200 -@@ -0,0 +1,26 @@ -+/* Copyright 2003, 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+int -+main () -+{ -+ printf ("hello world\n"); -+ -+ return 0; -+} ---- /dev/null 2009-04-19 08:52:54.499000000 +0200 -+++ gdb-6.8/gdb/testsuite/gdb.arch/ia64-libunwind.exp 2009-04-30 19:19:22.000000000 +0200 -@@ -0,0 +1,52 @@ -+# Copyright 2003, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Jeff Johnston (jjohnstn@redhat.com) -+ -+if ![istarget "ia64-*-*"] then { -+ return -+} -+ -+set testfile "ia64-libunwind" -+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 -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+gdb_test "set debug arch 1" -+gdb_breakpoint "main" -+gdb_run_cmd -+ -+set test "libunwind message" -+gdb_test_multiple "" $test { -+ -re "ia64_find_proc_info_x.*$gdb_prompt $" { -+ pass $test -+ } -+} diff --git a/gdb-6.3-rh-testversion-20041202.patch b/gdb-6.3-rh-testversion-20041202.patch deleted file mode 100644 index 7839200..0000000 --- a/gdb-6.3-rh-testversion-20041202.patch +++ /dev/null @@ -1,19 +0,0 @@ -2003-02-24 Elena Zannoni - - * gdb.gdb/selftest.exp: Add matching on specific Red Hat only version - string. - -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.gdb/selftest.exp -=================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.gdb/selftest.exp 2010-06-26 08:44:47.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.gdb/selftest.exp 2010-07-12 09:59:42.000000000 +0200 -@@ -342,6 +342,9 @@ proc test_with_self { executable } { - -re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" { - pass "printed version with cast" - } -+ -re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" { -+ pass "printed version Fedora or Red Hat Enterprise Linux only" -+ } - } - - do_steps_and_nexts diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch deleted file mode 100644 index a8a0266..0000000 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ /dev/null @@ -1,239 +0,0 @@ -Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.cc -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.cc 2011-12-19 22:05:02.825431735 +0100 -@@ -0,0 +1,99 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ 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. */ -+ -+class A -+{ -+ public: -+ A(); -+ ~A(); -+ int k; -+ private: -+ int x; -+}; -+ -+class B: public A -+{ -+ public: -+ B(); -+ private: -+ int y; -+}; -+ -+/* C and D are for the $delete destructor. */ -+ -+class C -+{ -+ public: -+ C(); -+ virtual ~C(); -+ private: -+ int x; -+}; -+ -+class D: public C -+{ -+ public: -+ D(); -+ private: -+ int y; -+}; -+ -+int main(int argc, char *argv[]) -+{ -+ A* a = new A; -+ B* b = new B; -+ D* d = new D; -+ delete a; -+ delete b; -+ delete d; -+ return 0; -+} -+ -+A::A() /* Constructor A */ -+{ -+ x = 1; /* First line A */ -+ k = 4; /* Second line A */ -+} -+ -+A::~A() /* Destructor A */ -+{ -+ x = 3; /* First line ~A */ -+ k = 6; /* Second line ~A */ -+} -+ -+B::B() -+{ -+ y = 2; /* First line B */ -+ k = 5; -+} -+ -+C::C() /* Constructor C */ -+{ -+ x = 1; /* First line C */ -+} -+ -+C::~C() /* Destructor C */ -+{ -+ x = 3; /* First line ~C */ -+} -+ -+D::D() -+{ -+ y = 2; /* First line D */ -+} -Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.exp 2011-12-19 23:07:24.148290893 +0100 -@@ -0,0 +1,130 @@ -+# 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 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. -+ -+# Check that GDB can break at multiple forms of constructors. -+ -+set testfile "constructortest" -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+# PIE is required for testing proper BREAKPOINT_RE_SET of the multiple-PC -+# breakpoints. -+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ "additional_flags=-fpie -pie"}] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# -+# Run to `main' where we begin our tests. -+# -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+# Break on the various forms of the A::A constructor. -+# " (2 locations)" is displayed depending on G++ version. -+gdb_test "break A\:\:A" "Breakpoint 2 at .*" "breaking on A::A" -+ -+# Verify that we break for the A constructor two times -+# Once for new A and once for new B -+gdb_continue_to_breakpoint "First line A" -+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A" -+gdb_continue_to_breakpoint "First line A" -+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A" -+ -+# Now do the same for destructors -+gdb_test "break 'A::~A()'" "" -+ -+# Verify that we break for the A destructor two times -+# Once for delete a and once for delete b -+gdb_continue_to_breakpoint "First line ~A" -+gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A" -+gdb_continue_to_breakpoint "First line ~A" -+gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A" -+ -+ -+# Verify that we can break by line number in a constructor and find -+# both occurrences -+runto_main -+gdb_test "break 'A::A()'" "" "break in constructor A 2" -+gdb_continue_to_breakpoint "First line A" -+set second_line [gdb_get_line_number "Second line A"] -+# " (2 locations)" is displayed depending on G++ version. -+gdb_test "break $second_line" "Breakpoint .*, line $second_line\\..*" "break by line in constructor" -+gdb_continue_to_breakpoint "Second line A" -+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line" -+gdb_continue_to_breakpoint "Second line A" -+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line" -+ -+# Verify that we can break by line number in a destructor and find -+# both occurrences -+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2" -+gdb_continue_to_breakpoint "First line ~A" -+set second_line_dtor [gdb_get_line_number "Second line ~A"] -+# " (2 locations)" is displayed depending on G++ version. -+gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor\\..*" "break by line in destructor" -+gdb_continue_to_breakpoint "Second line ~A" -+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line" -+# FIXME: Analyse this case better. -+gdb_continue_to_breakpoint "Second line ~A" -+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2" -+gdb_continue_to_breakpoint "Second line ~A" -+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line" -+ -+ -+# Test now the $delete destructors. -+ -+gdb_load ${binfile} -+runto_main -+ -+set first_line_dtor [gdb_get_line_number "First line ~C"] -+set define_line_dtor [gdb_get_line_number "Destructor C"] -+# Break on the various forms of the C::~C destructor -+# " ([23] locations)" is displayed depending on G++ version. -+gdb_test "break C\:\:~C" "Breakpoint .*: C::~C\\. \\(2 locations\\)" "breaking on C::~C" -+gdb_continue_to_breakpoint "First line ~C" -+ -+# Verify that we can break by line number in a destructor and find -+# the $delete occurence -+ -+gdb_load ${binfile} -+delete_breakpoints -+ -+# " (3 locations)" is displayed depending on G++ version. -+gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor\\..*" "break by line in destructor" -+ -+# Run to `main' where we begin our tests. -+# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET. -+# RUNTO_MAIN or RUNTO MAIN are not usable here as it runs DELETE_BREAKPOINTS. -+ -+if ![gdb_breakpoint main] { -+ gdb_suppress_tests -+} -+gdb_run_cmd -+set test "running to main" -+gdb_test_multiple "" $test { -+ -re "Breakpoint \[0-9\]*, main .*$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+gdb_continue_to_breakpoint "First line ~C" diff --git a/gdb-6.3-test-movedir-20050125.patch b/gdb-6.3-test-movedir-20050125.patch deleted file mode 100644 index 4b05c13..0000000 --- a/gdb-6.3-test-movedir-20050125.patch +++ /dev/null @@ -1,95 +0,0 @@ -2005-01-25 Elena Zannoni - - * gdb.base/move-dir.exp: New test. - * gdb.base/move-dir.c: Ditto. - * gdb.base/move-dir.h: Ditto. - -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.c 2008-12-07 23:57:41.000000000 +0100 -@@ -0,0 +1,10 @@ -+#include -+#include -+#include "move-dir.h" -+ -+int main() { -+ const char* hw = "hello world."; -+ printf ("%s\n", hw);; -+ other(); -+} -+ -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.exp 2008-12-07 10:13:01.000000000 +0100 -@@ -0,0 +1,57 @@ -+# 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. -+ -+set testfile "move-dir" -+set srcfile ${testfile}.c -+set incfile ${testfile}.h -+set binfile ${objdir}/${subdir}/${testfile} -+ -+set testdir "${objdir}/${subdir}/incdir" -+ -+remote_exec build "mkdir $testdir" -+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}" -+remote_exec build "cp ${srcdir}/${subdir}/${incfile} ${testdir}" -+ -+set additional_flags "additional_flags=-I${subdir}/incdir" -+ -+if { [gdb_compile "${objdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+# Create and source the file that provides information about the compiler -+# used to compile the test case. -+ -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+ -+set oldtimeout $timeout -+set timeout [expr "$timeout + 60"] -+ -+# Start with a fresh gdb. -+ -+gdb_exit -+gdb_start -+gdb_test "cd ../.." "" "" -+gdb_load ${binfile} -+gdb_test "list main" ".*hw.*other.*" "found main" -+gdb_test "list other" ".*ostring.*" "found include file" -+ -+ -+set timeout $oldtimeout -+return 0 -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.h 2008-12-07 10:13:01.000000000 +0100 -@@ -0,0 +1,7 @@ -+#include -+ -+void other() { -+ const char* ostring = "other"; -+ printf ("%s\n", ostring);; -+} -+ diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch deleted file mode 100644 index f877225..0000000 --- a/gdb-6.3-test-pie-20050107.patch +++ /dev/null @@ -1,2085 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/testsuite/configure.ac -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/configure.ac 2012-04-25 16:07:22.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/testsuite/configure.ac 2012-06-02 18:24:38.456266545 +0200 -@@ -96,6 +96,6 @@ AC_OUTPUT([Makefile \ - gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \ - gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \ - gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \ -- gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ -+ gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \ - gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \ - gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile]) -Index: gdb-7.4.50.20120602/gdb/testsuite/configure -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/configure 2012-04-25 16:07:21.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/testsuite/configure 2012-06-02 18:25:06.200258240 +0200 -@@ -3448,7 +3448,7 @@ done - - - --ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" -+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" - - cat >confcache <<\_ACEOF - # This file is a shell script that caches the results of configure -@@ -4175,6 +4175,7 @@ do - "gdb.opencl/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opencl/Makefile" ;; - "gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;; - "gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;; -+ "gdb.pie/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pie/Makefile" ;; - "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;; - "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;; - "gdb.stabs/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.stabs/Makefile" ;; -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c 2012-06-02 18:24:38.497266532 +0200 -@@ -0,0 +1,20 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return 0; -+} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c 2012-06-02 18:24:38.504266529 +0200 -@@ -0,0 +1,24 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+#include -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ sleep( 10 ); /* System call causes register fetch to fail */ -+ /* This is a known HPUX "feature" */ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return (0); -+} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c 2012-06-02 18:24:38.505266529 +0200 -@@ -0,0 +1,146 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software -+ Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#ifdef vxworks -+ -+# include -+ -+/* VxWorks does not supply atoi. */ -+static int -+atoi (z) -+ char *z; -+{ -+ int i = 0; -+ -+ while (*z >= '0' && *z <= '9') -+ i = i * 10 + (*z++ - '0'); -+ return i; -+} -+ -+/* I don't know of any way to pass an array to VxWorks. This function -+ can be called directly from gdb. */ -+ -+vxmain (arg) -+char *arg; -+{ -+ char *argv[2]; -+ -+ argv[0] = ""; -+ argv[1] = arg; -+ main (2, argv, (char **) 0); -+} -+ -+#else /* ! vxworks */ -+# include -+# include -+#endif /* ! vxworks */ -+ -+#ifdef PROTOTYPES -+extern int marker1 (void); -+extern int marker2 (int a); -+extern void marker3 (char *a, char *b); -+extern void marker4 (long d); -+#else -+extern int marker1 (); -+extern int marker2 (); -+extern void marker3 (); -+extern void marker4 (); -+#endif -+ -+/* -+ * This simple classical example of recursion is useful for -+ * testing stack backtraces and such. -+ */ -+ -+#ifdef PROTOTYPES -+int factorial(int); -+ -+int -+main (int argc, char **argv, char **envp) -+#else -+int -+main (argc, argv, envp) -+int argc; -+char *argv[], **envp; -+#endif -+{ -+#ifdef usestubs -+ set_debug_traps(); /* set breakpoint 5 here */ -+ breakpoint(); -+#endif -+ if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ -+ fprintf (stderr, "usage: factorial \n"); -+ return 1; -+ } -+ printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ -+ /* set breakpoint 12 here */ -+ marker1 (); /* set breakpoint 11 here */ -+ marker2 (43); /* set breakpoint 20 here */ -+ marker3 ("stack", "trace"); /* set breakpoint 21 here */ -+ marker4 (177601976L); -+ argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */ -+ return argc; /* set breakpoint 10 here */ -+} -+ -+#ifdef PROTOTYPES -+int factorial (int value) -+#else -+int factorial (value) -+int value; -+#endif -+{ -+ if (value > 1) { /* set breakpoint 7 here */ -+ value *= factorial (value - 1); -+ } -+ return (value); /* set breakpoint 19 here */ -+} -+ -+#ifdef PROTOTYPES -+int multi_line_if_conditional (int a, int b, int c) -+#else -+int multi_line_if_conditional (a, b, c) -+ int a, b, c; -+#endif -+{ -+ if (a /* set breakpoint 3 here */ -+ && b -+ && c) -+ return 0; -+ else -+ return 1; -+} -+ -+#ifdef PROTOTYPES -+int multi_line_while_conditional (int a, int b, int c) -+#else -+int multi_line_while_conditional (a, b, c) -+ int a, b, c; -+#endif -+{ -+ while (a /* set breakpoint 4 here */ -+ && b -+ && c) -+ { -+ a--, b--, c--; -+ } -+ return 0; -+} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c 2012-06-02 18:24:38.506266530 +0200 -@@ -0,0 +1,44 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software -+ Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+/* The code for this file was extracted from the gdb testsuite -+ testcase "break.c". */ -+ -+/* The following functions do nothing useful. They are included -+ simply as places to try setting breakpoints at. They are -+ explicitly "one-line functions" to verify that this case works -+ (some versions of gcc have or have had problems with this). -+ -+ These functions are in a separate source file to prevent an -+ optimizing compiler from inlining them and optimizing them away. */ -+ -+#ifdef PROTOTYPES -+int marker1 (void) { return (0); } /* set breakpoint 15 here */ -+int marker2 (int a) { return (1); } /* set breakpoint 8 here */ -+void marker3 (char *a, char *b) {} /* set breakpoint 17 here */ -+void marker4 (long d) {} /* set breakpoint 14 here */ -+#else -+int marker1 () { return (0); } /* set breakpoint 16 here */ -+int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ -+void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ -+void marker4 (d) long d; {} /* set breakpoint 13 here */ -+#endif -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c 2012-06-02 18:24:38.506266530 +0200 -@@ -0,0 +1,142 @@ -+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999 -+ 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 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. */ -+ -+/* Simple little program that just generates a core dump from inside some -+ nested function calls. */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifndef __STDC__ -+#define const /**/ -+#endif -+ -+#define MAPSIZE (8 * 1024) -+ -+/* Don't make these automatic vars or we will have to walk back up the -+ stack to access them. */ -+ -+char *buf1; -+char *buf2; -+ -+int coremaker_data = 1; /* In Data section */ -+int coremaker_bss; /* In BSS section */ -+ -+const int coremaker_ro = 201; /* In Read-Only Data section */ -+ -+/* Note that if the mapping fails for any reason, we set buf2 -+ to -1 and the testsuite notices this and reports it as -+ a failure due to a mapping error. This way we don't have -+ to test for specific errors when running the core maker. */ -+ -+void -+mmapdata () -+{ -+ int j, fd; -+ -+ /* Allocate and initialize a buffer that will be used to write -+ the file that is later mapped in. */ -+ -+ buf1 = (char *) malloc (MAPSIZE); -+ for (j = 0; j < MAPSIZE; ++j) -+ { -+ buf1[j] = j; -+ } -+ -+ /* Write the file to map in */ -+ -+ fd = open ("coremmap.data", O_CREAT | O_RDWR, 0666); -+ if (fd == -1) -+ { -+ perror ("coremmap.data open failed"); -+ buf2 = (char *) -1; -+ return; -+ } -+ write (fd, buf1, MAPSIZE); -+ -+ /* Now map the file into our address space as buf2 */ -+ -+ buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); -+ if (buf2 == (char *) -1) -+ { -+ perror ("mmap failed"); -+ return; -+ } -+ -+ /* Verify that the original data and the mapped data are identical. -+ If not, we'd rather fail now than when trying to access the mapped -+ data from the core file. */ -+ -+ for (j = 0; j < MAPSIZE; ++j) -+ { -+ if (buf1[j] != buf2[j]) -+ { -+ fprintf (stderr, "mapped data is incorrect"); -+ buf2 = (char *) -1; -+ return; -+ } -+ } -+} -+ -+void -+func2 () -+{ -+ int coremaker_local[5]; -+ int i; -+ -+#ifdef SA_FULLDUMP -+ /* Force a corefile that includes the data section for AIX. */ -+ { -+ struct sigaction sa; -+ -+ sigaction (SIGABRT, (struct sigaction *)0, &sa); -+ sa.sa_flags |= SA_FULLDUMP; -+ sigaction (SIGABRT, &sa, (struct sigaction *)0); -+ } -+#endif -+ -+ /* Make sure that coremaker_local doesn't get optimized away. */ -+ for (i = 0; i < 5; i++) -+ coremaker_local[i] = i; -+ coremaker_bss = 0; -+ for (i = 0; i < 5; i++) -+ coremaker_bss += coremaker_local[i]; -+ coremaker_data = coremaker_ro + 1; -+ abort (); -+} -+ -+void -+func1 () -+{ -+ func2 (); -+} -+ -+int main () -+{ -+ mmapdata (); -+ func1 (); -+ return 0; -+} -+ -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp 2012-06-02 18:24:38.508266531 +0200 -@@ -0,0 +1,417 @@ -+# Copyright 1997, 1999, 2002 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. */ -+ -+# On HP-UX 11.0, this test is causing a process running the program -+# "attach" to be left around spinning. Until we figure out why, I am -+# commenting out the test to avoid polluting tiamat (our 11.0 nightly -+# test machine) with these processes. RT -+# -+# Setting the magic bit in the target app should work. I added a -+# "kill", and also a test for the R3 register warning. JB -+if { [istarget "hppa*-*-hpux*"] } { -+ return 0 -+} -+ -+# are we on a target board -+if [is_remote target] then { -+ return 0 -+} -+ -+set testfile "attach" -+set srcfile ${testfile}.c -+set srcfile2 ${testfile}2.c -+set binfile ${objdir}/${subdir}/${testfile} -+set binfile2 ${objdir}/${subdir}/${testfile}2 -+set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] -+set cleanupfile ${objdir}/${subdir}/${testfile}.awk -+ -+#execute_anywhere "rm -f ${binfile} ${binfile2}" -+remote_exec build "rm -f ${binfile} ${binfile2}" -+# For debugging this test -+# -+#log_user 1 -+ -+# Clean out any old files from past runs. -+# -+remote_exec build "${cleanupfile}" -+ -+# build the first test case -+# -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags= -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+# Build the in-system-call test -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug "additional_flags= -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+proc do_attach_tests {} { -+ global gdb_prompt -+ global binfile -+ global escapedbinfile -+ global srcfile -+ global testfile -+ global objdir -+ global subdir -+ global timeout -+ -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ # -+ set testpid [eval exec $binfile &] -+ exec sleep 2 -+ -+ # Verify that we cannot attach to nonsense. -+ # -+ send_gdb "attach abc\n" -+ gdb_expect { -+ -re ".*Illegal process-id: abc.*$gdb_prompt $"\ -+ {pass "attach to nonsense is prohibited"} -+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ -+ { -+ # Response expected from /proc-based systems. -+ pass "attach to nonsense is prohibited" -+ } -+ -re "Attaching to.*$gdb_prompt $"\ -+ {fail "attach to nonsense is prohibited (bogus pid allowed)"} -+ -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"} -+ timeout {fail "(timeout) attach to nonsense is prohibited"} -+ } -+ -+ # Verify that we cannot attach to what appears to be a valid -+ # process ID, but is a process that doesn't exist. Traditionally, -+ # most systems didn't have a process with ID 0, so we take that as -+ # the default. However, there are a few exceptions. -+ # -+ set boguspid 0 -+ if { [istarget "*-*-*bsd*"] } { -+ # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead -+ # (which should have the desired effect on any version of -+ # FreeBSD, and probably other *BSD's too). -+ set boguspid -1 -+ } -+ send_gdb "attach $boguspid\n" -+ gdb_expect { -+ -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\ -+ { -+ # Response expected on ptrace-based systems (i.e. HP-UX 10.20). -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\ -+ { -+ # Response expected on ttrace-based systems (i.e. HP-UX 11.0). -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\ -+ {pass "attach to nonexistent process is prohibited"} -+ -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $"\ -+ {pass "attach to nonexistent process is prohibited"} -+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ -+ { -+ # Response expected from /proc-based systems. -+ pass "attach to nonexistent process is prohibited" -+ } -+ -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} -+ timeout { -+ fail "(timeout) attach to nonexistent process is prohibited" -+ } -+ } -+ -+ # Verify that we can attach to the process by first giving its -+ # executable name via the file command, and using attach with -+ # the process ID. -+ # -+ # (Actually, the test system appears to do this automatically -+ # for us. So, we must also be prepared to be asked if we want -+ # to discard an existing set of symbols.) -+ # -+ send_gdb "file $binfile\n" -+ gdb_expect { -+ -re "Load new symbol table from.*y or n.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ {pass "(re)set file, before attach1"} -+ -re "$gdb_prompt $" {fail "(re)set file, before attach1"} -+ timeout {fail "(timeout) (re)set file, before attach1"} -+ } -+ } -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\ -+ {pass "set file, before attach1"} -+ -re "$gdb_prompt $" {fail "set file, before attach1"} -+ timeout {fail "(timeout) set file, before attach1"} -+ } -+ -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\ -+ {pass "attach1, after setting file"} -+ -re "$gdb_prompt $" {fail "attach1, after setting file"} -+ timeout {fail "(timeout) attach1, after setting file"} -+ } -+ -+ # Verify that we can "see" the variable "should_exit" in the -+ # program, and that it is zero. -+ # -+ send_gdb "print should_exit\n" -+ gdb_expect { -+ -re ".* = 0.*$gdb_prompt $"\ -+ {pass "after attach1, print should_exit"} -+ -re "$gdb_prompt $" {fail "after attach1, print should_exit"} -+ timeout {fail "(timeout) after attach1, print should_exit"} -+ } -+ -+ # Detach the process. -+ # -+ send_gdb "detach\n" -+ gdb_expect { -+ -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\ -+ {pass "attach1 detach"} -+ -re "$gdb_prompt $" {fail "attach1 detach"} -+ timeout {fail "(timeout) attach1 detach"} -+ } -+ -+ # Wait a bit for gdb to finish detaching -+ # -+ exec sleep 5 -+ -+ # Purge the symbols from gdb's brain. (We want to be certain -+ # the next attach, which won't be preceded by a "file" command, -+ # is really getting the executable file without our help.) -+ # -+ set old_timeout $timeout -+ set timeout 15 -+ send_gdb "file\n" -+ gdb_expect { -+ -re ".*gdb internal error.*$" { -+ fail "Internal error, prob. Memory corruption" -+ } -+ -re "No executable file now.*Discard symbol table.*y or n.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "No symbol file now.*$gdb_prompt $"\ -+ {pass "attach1, purging symbols after detach"} -+ -re "$gdb_prompt $" {fail "attach1, purging symbols after detach"} -+ timeout {fail "(timeout) attach1, purging symbols after detach"} -+ } -+ } -+ -re "$gdb_prompt $" {fail "attach1, purging file after detach"} -+ timeout { -+ fail "(timeout) attach1, purging file after detach" -+ } -+ } -+ set timeout $old_timeout -+ -+ # Verify that we can attach to the process just by giving the -+ # process ID. -+ # -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ -+ {pass "attach2"} -+ -re "$gdb_prompt $" {fail "attach2"} -+ timeout {fail "(timeout) attach2"} -+ } -+ -+ # Verify that we can modify the variable "should_exit" in the -+ # program. -+ # -+ send_gdb "set should_exit=1\n" -+ gdb_expect { -+ -re "$gdb_prompt $" {pass "after attach2, set should_exit"} -+ timeout {fail "(timeout) after attach2, set should_exit"} -+ } -+ -+ # Verify that the modification really happened. -+ # -+ send_gdb "tbreak 19\n" -+ gdb_expect { -+ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $"\ -+ {pass "after attach2, set tbreak postloop"} -+ -re "$gdb_prompt $" {fail "after attach2, set tbreak postloop"} -+ timeout {fail "(timeout) after attach2, set tbreak postloop"} -+ } -+ send_gdb "continue\n" -+ gdb_expect { -+ -re "main.*at.*$srcfile:19.*$gdb_prompt $"\ -+ {pass "after attach2, reach tbreak postloop"} -+ -re "$gdb_prompt $" {fail "after attach2, reach tbreak postloop"} -+ timeout {fail "(timeout) after attach2, reach tbreak postloop"} -+ } -+ -+ # Allow the test process to exit, to cleanup after ourselves. -+ # -+ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach2, exit" -+ -+ # Make sure we don't leave a process around to confuse -+ # the next test run (and prevent the compile by keeping -+ # the text file busy), in case the "set should_exit" didn't -+ # work. -+ # -+ remote_exec build "kill -9 ${testpid}" -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ # -+ set testpid [eval exec $binfile &] -+ exec sleep 2 -+ -+ # Verify that we can attach to the process, and find its a.out -+ # when we're cd'd to some directory that doesn't contain the -+ # a.out. (We use the source path set by the "dir" command.) -+ # -+ send_gdb "dir ${objdir}/${subdir}\n" -+ gdb_expect { -+ -re ".*Source directories searched: .*$gdb_prompt $"\ -+ {pass "set source path"} -+ -re "$gdb_prompt $" {fail "set source path"} -+ timeout {fail "(timeout) set source path"} -+ } -+ -+ send_gdb "cd /tmp\n" -+ gdb_expect { -+ -re ".*Working directory /tmp.*$gdb_prompt $"\ -+ {pass "cd away from process' a.out"} -+ -re "$gdb_prompt $" {fail "cd away from process' a.out"} -+ timeout {fail "(timeout) cd away from process' a.out"} -+ } -+ -+ # Explicitly flush out any knowledge of the previous attachment. -+ send_gdb "symbol\n" -+ gdb_expect { -+ -re ".*Discard symbol table from.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re ".*No symbol file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush symbols"} -+ -re "$gdb_prompt $" {fail "before attach3, flush symbols"} -+ timeout {fail "(timeout) before attach3, flush symbols"} -+ } -+ } -+ -re ".*No symbol file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush symbols"} -+ -re "$gdb_prompt $" {fail "before attach3, flush symbols"} -+ timeout {fail "(timeout) before attach3, flush symbols"} -+ } -+ send_gdb "exec\n" -+ gdb_expect { -+ -re ".*No executable file now.*$gdb_prompt $"\ -+ {pass "before attach3, flush exec"} -+ -re "$gdb_prompt $" {fail "before attach3, flush exec"} -+ timeout {fail "(timeout) before attach3, flush exec"} -+ } -+ -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\ -+ {pass "attach when process' a.out not in cwd"} -+ -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"} -+ timeout {fail "(timeout) attach when process' a.out not in cwd"} -+ } -+ -+ send_gdb "kill\n" -+ gdb_expect { -+ -re ".*Kill the program being debugged.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re "$gdb_prompt $" {pass "after attach3, exit"} -+ timeout {fail "(timeout) after attach3, exit"} -+ } -+ } -+ -re "$gdb_prompt $" {fail "after attach3, exit"} -+ timeout {fail "(timeout) after attach3, exit"} -+ } -+ -+ # Another "don't leave a process around" -+ remote_exec build "kill -9 ${testpid}" -+} -+ -+proc do_call_attach_tests {} { -+ global gdb_prompt -+ global binfile2 -+ -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ # -+ set testpid [eval exec $binfile2 &] -+ exec sleep 2 -+ -+ # Attach -+ # -+ gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary" -+ send_gdb "attach $testpid\n" -+ gdb_expect { -+ -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" { -+ fail "attach call, read register 3 error" -+ } -+ -re "Attaching to.*process $testpid.*$gdb_prompt $" { -+ # libc is relocated, not relocated, therefore not printed. -+ pass "attach call" -+ } -+ -re "$gdb_prompt $" {fail "attach call"} -+ timeout {fail "(timeout) attach call"} -+ } -+ -+ # See if other registers are problems -+ # -+ send_gdb "i r r3\n" -+ gdb_expect { -+ -re ".*warning: reading register.*$gdb_prompt $" { -+ pass "CHFts23490: known bug" -+ } -+ -re ".*r3.*$gdb_prompt $" { -+ pass "Bug fixed, Yayyy!" -+ } -+ timeout { fail "timeout on info reg" } -+ } -+ -+ # Get rid of the process -+ # -+ gdb_test "p should_exit = 1" ".*" -+ gdb_test "c" {\[Inferior .* exited normally\]} -+ -+ # Be paranoid -+ # -+ remote_exec build "kill -9 ${testpid}" -+ -+} -+ -+ -+# Start with a fresh gdb -+# -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# This is a test of gdb's ability to attach to a running process. -+# -+do_attach_tests -+ -+# Test attaching when the target is inside a system call -+# -+gdb_exit -+gdb_start -+ -+gdb_reinitialize_dir $srcdir/$subdir -+do_call_attach_tests -+ -+return 0 -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp 2012-06-02 18:24:38.510266529 +0200 -@@ -0,0 +1,962 @@ -+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, -+# 2000, 2002, 2003, 2004 -+# Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Rob Savoye. (rob@cygnus.com) -+ -+# Test the same stuff but with PIE executables -+ -+set testfile "break" -+set srcfile ${testfile}.c -+set srcfile1 ${testfile}1.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ 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} -+ -+if [target_info exists gdb_stub] { -+ gdb_step_for_stub; -+} -+# -+# test simple breakpoint setting commands -+# -+ -+# Test deleting all breakpoints when there are none installed, -+# GDB should not prompt for confirmation. -+# Note that gdb-init.exp provides a "delete_breakpoints" proc -+# for general use elsewhere. -+ -+send_gdb "delete breakpoints\n" -+gdb_expect { -+ -re "Delete all breakpoints.*$" { -+ send_gdb "y\n" -+ gdb_expect { -+ -re "$gdb_prompt $" { -+ fail "Delete all breakpoints when none (unexpected prompt)" -+ } -+ timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" } -+ } -+ } -+ -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" } -+ timeout { fail "Delete all breakpoints when none (timeout)" } -+} -+ -+# -+# test break at function -+# -+gdb_test "break main" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function" -+ -+# -+# test break at quoted function -+# -+gdb_test "break \"marker2\"" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" \ -+ "breakpoint quoted function" -+ -+# -+# test break at function in file -+# -+gdb_test "break $srcfile:factorial" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function in file" -+ -+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] -+ -+# -+# test break at line number -+# -+# Note that the default source file is the last one whose source text -+# was printed. For native debugging, before we've executed the -+# program, this is the file containing main, but for remote debugging, -+# it's wherever the processor was stopped when we connected to the -+# board. So, to be sure, we do a list command. -+# -+gdb_test "list main" \ -+ ".*main \\(argc, argv, envp\\).*" \ -+ "use `list' to establish default source file" -+gdb_test "break $bp_location1" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ -+ "breakpoint line number" -+ -+# -+# test duplicate breakpoint -+# -+gdb_test "break $bp_location1" \ -+ "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \ -+ "breakpoint duplicate" -+ -+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] -+ -+# -+# test break at line number in file -+# -+gdb_test "break $srcfile:$bp_location2" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \ -+ "breakpoint line number in file" -+ -+set bp_location3 [gdb_get_line_number "set breakpoint 3 here"] -+set bp_location4 [gdb_get_line_number "set breakpoint 4 here"] -+ -+# -+# Test putting a break at the start of a multi-line if conditional. -+# Verify the breakpoint was put at the start of the conditional. -+# -+gdb_test "break multi_line_if_conditional" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ -+ "breakpoint at start of multi line if conditional" -+ -+gdb_test "break multi_line_while_conditional" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ -+ "breakpoint at start of multi line while conditional" -+ -+set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] -+set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] -+ -+# -+# check to see what breakpoints are set -+# -+if [target_info exists gdb_stub] { -+ set main_line $bp_location5 -+} else { -+ set main_line $bp_location6 -+} -+ -+if {$hp_aCC_compiler} { -+ set proto "\\(int\\)" -+} else { -+ set proto "" -+} -+ -+set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] -+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] -+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] -+ -+# Test a pending breakpoint in PIE executable does not crash later GDB. -+gdb_breakpoint "non_existent_function" allow-pending -+ -+gdb_test "info break" \ -+ "Num\[ \]+Type\[ \]+Disp Enb Address\[ \]+What.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* -+\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.* -+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4.* -+\[0-9\]+\[\t \]+breakpoint keep y.* *non_existent_function" \ -+ "breakpoint info" -+ -+# FIXME: The rest of this test doesn't work with anything that can't -+# handle arguments. -+# Huh? There doesn't *appear* to be anything that passes arguments -+# below. -+if [istarget "mips-idt-*"] then { -+ return -+} -+ -+# -+# run until the breakpoint at main is hit. For non-stubs-using targets. -+# -+if ![target_info exists use_gdb_stub] { -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"2\"\n" -+ set timeout 120 -+ verbose "Timeout is now $timeout seconds" 2 -+ } else { -+ send_gdb "run\n" -+ } -+ gdb_expect { -+ -re "The program .* has been started already.*y or n. $" { -+ send_gdb "y\n" -+ exp_continue -+ } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ -+ { pass "run until function breakpoint" } -+ -re ".*$gdb_prompt $" { fail "run until function breakpoint" } -+ timeout { fail "run until function breakpoint (timeout)" } -+ } -+} else { -+ if ![target_info exists gdb_stub] { -+ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue" -+ } -+} -+ -+# -+# run until the breakpoint at a line number -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ -+ "run until breakpoint set at a line number" -+ -+# -+# Run until the breakpoint set in a function in a file -+# -+for {set i 6} {$i >= 1} {incr i -1} { -+ gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \ -+ "run until file:function($i) breakpoint" -+} -+ -+# -+# Run until the breakpoint set at a quoted function -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \ -+ "run until quoted breakpoint" -+# -+# run until the file:function breakpoint at a line number in a file -+# -+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ -+ "run until file:linenum breakpoint" -+ -+# Test break at offset +1 -+set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] -+ -+gdb_test "break +1" \ -+ "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \ -+ "breakpoint offset +1" -+ -+# Check to see if breakpoint is hit when stepped onto -+ -+gdb_test "step" \ -+ ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ -+ "step onto breakpoint" -+ -+# -+# delete all breakpoints so we can start over, course this can be a test too -+# -+delete_breakpoints -+ -+# -+# test temporary breakpoint at function -+# -+ -+gdb_test "tbreak main" "reakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function" -+ -+# -+# test break at function in file -+# -+ -+gdb_test "tbreak $srcfile:factorial" "reakpoint.*at.* file .*$srcfile, line.*" \ -+ "Temporary breakpoint function in file" -+ -+# -+# test break at line number -+# -+send_gdb "tbreak $bp_location1\n" -+gdb_expect { -+ -re "reakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -+ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -+ timeout { fail "breakpoint line number #1 (timeout)" } -+} -+ -+gdb_test "tbreak $bp_location6" "reakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2" -+ -+# -+# test break at line number in file -+# -+send_gdb "tbreak $srcfile:$bp_location2\n" -+gdb_expect { -+ -re "reakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -+ -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -+ timeout { fail "Temporary breakpoint line number in file #1 (timeout)" } -+} -+ -+set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] -+gdb_test "tbreak $srcfile:$bp_location11" "reakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" -+ -+# -+# check to see what breakpoints are set (temporary this time) -+# -+gdb_test "info break" "Num.*Type.*Disp Enb Address.*What.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\] -+\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \ -+ "Temporary breakpoint info" -+ -+ -+#*********** -+ -+# Verify that catchpoints for fork, vfork and exec don't trigger -+# inappropriately. (There are no calls to those system functions -+# in this test program.) -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "catch\n" -+gdb_expect { -+ -re "Catch requires an event name.*$gdb_prompt $"\ -+ {pass "catch requires an event name"} -+ -re "$gdb_prompt $"\ -+ {fail "catch requires an event name"} -+ timeout {fail "(timeout) catch requires an event name"} -+} -+ -+ -+set name "set catch fork, never expected to trigger" -+send_gdb "catch fork\n" -+gdb_expect { -+ -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of fork not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+} -+ -+ -+set name "set catch vfork, never expected to trigger" -+send_gdb "catch vfork\n" -+ -+# If we are on HP-UX 10.20, we expect an error message to be -+# printed if we type "catch vfork" at the gdb gdb_prompt. This is -+# because on HP-UX 10.20, we cannot catch vfork events. -+ -+if [istarget "hppa*-hp-hpux10.20"] then { -+ gdb_expect { -+ -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+ } -+} else { -+ gdb_expect { -+ -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of vfork not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" -+ {fail $name} -+ timeout {fail "(timeout) $name"} -+ } -+} -+ -+set name "set catch exec, never expected to trigger" -+send_gdb "catch exec\n" -+gdb_expect { -+ -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $" -+ {pass $name} -+ -re "Catch of exec not yet implemented.*$gdb_prompt $" -+ {pass $name} -+ -re "$gdb_prompt $" {fail $name} -+ timeout {fail "(timeout) $name"} -+} -+ -+# Verify that GDB responds gracefully when asked to set a breakpoint -+# on a nonexistent source line. -+# -+gdb_test_no_output "set breakpoint pending off" -+gdb_test "break 999" \ -+ "No line 999 in the current file." \ -+ "break on non-existent source line" -+ -+# Run to the desired default location. If not positioned here, the -+# tests below don't work. -+# -+gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1" -+ -+ -+# Verify that GDB allows one to just say "break", which is treated -+# as the "default" breakpoint. Note that GDB gets cute when printing -+# the informational message about other breakpoints at the same -+# location. We'll hit that bird with this stone too. -+# -+send_gdb "break\n" -+gdb_expect { -+ -re "Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 1st time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 1st time"} -+ timeout {fail "(timeout) break on default location, 1st time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 2nd time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 2nd time"} -+ timeout {fail "(timeout) break on default location, 2nd time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 3rd time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 3rd time"} -+ timeout {fail "(timeout) break on default location, 3rd time"} -+} -+ -+send_gdb "break\n" -+gdb_expect { -+ -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ -+ {pass "break on default location, 4th time"} -+ -re "$gdb_prompt $"\ -+ {fail "break on default location, 4th time"} -+ timeout {fail "(timeout) break on default location, 4th time"} -+} -+ -+# Verify that a "silent" breakpoint can be set, and that GDB is indeed -+# "silent" about its triggering. -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "break $bp_location1\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\ -+ {pass "set to-be-silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "set to-be-silent break bp_location1"} -+ timeout {fail "(timeout) set to-be-silent break bp_location1"} -+} -+ -+send_gdb "commands $expect_out(1,string)\n" -+send_gdb "silent\n" -+send_gdb "end\n" -+gdb_expect { -+ -re ".*$gdb_prompt $"\ -+ {pass "set silent break bp_location1"} -+ timeout {fail "(timeout) set silent break bp_location1"} -+} -+ -+send_gdb "info break $expect_out(1,string)\n" -+gdb_expect { -+ -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\ -+ {pass "info silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "info silent break bp_location1"} -+ timeout {fail "(timeout) info silent break bp_location1"} -+} -+send_gdb "continue\n" -+gdb_expect { -+ -re "Continuing.\r\n$gdb_prompt $"\ -+ {pass "hit silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "hit silent break bp_location1"} -+ timeout {fail "(timeout) hit silent break bp_location1"} -+} -+send_gdb "bt\n" -+gdb_expect { -+ -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\ -+ {pass "stopped for silent break bp_location1"} -+ -re "$gdb_prompt $"\ -+ {fail "stopped for silent break bp_location1"} -+ timeout {fail "(timeout) stopped for silent break bp_location1"} -+} -+ -+# Verify that GDB can at least parse a breakpoint with the -+# "thread" keyword. (We won't attempt to test here that a -+# thread-specific breakpoint really triggers appropriately. -+# The gdb.threads subdirectory contains tests for that.) -+# -+set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] -+send_gdb "break $bp_location12 thread 999\n" -+gdb_expect { -+ -re "Unknown thread 999.*$gdb_prompt $"\ -+ {pass "thread-specific breakpoint on non-existent thread disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "thread-specific breakpoint on non-existent thread disallowed"} -+ timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} -+} -+send_gdb "break $bp_location12 thread foo\n" -+gdb_expect { -+ -re "Junk after thread keyword..*$gdb_prompt $"\ -+ {pass "thread-specific breakpoint on bogus thread ID disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "thread-specific breakpoint on bogus thread ID disallowed"} -+ timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a breakpoint command with -+# trailing garbage. -+# -+send_gdb "break $bp_location12 foo\n" -+gdb_expect { -+ -re "malformed linespec error: unexpected string, \"foo\"\r\n$gdb_prompt $"\ -+ {pass "breakpoint with trailing garbage disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "breakpoint with trailing garbage disallowed"} -+ timeout {fail "(timeout) breakpoint with trailing garbage disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a "clear" command that has -+# no matching breakpoint. (First, get us off the current source line, -+# which we know has a breakpoint.) -+# -+send_gdb "next\n" -+gdb_expect { -+ -re ".*$gdb_prompt $"\ -+ {pass "step over breakpoint"} -+ timeout {fail "(timeout) step over breakpoint"} -+} -+send_gdb "clear 81\n" -+gdb_expect { -+ -re "No breakpoint at 81..*$gdb_prompt $"\ -+ {pass "clear line has no breakpoint disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "clear line has no breakpoint disallowed"} -+ timeout {fail "(timeout) clear line has no breakpoint disallowed"} -+} -+send_gdb "clear\n" -+gdb_expect { -+ -re "No breakpoint at this line..*$gdb_prompt $"\ -+ {pass "clear current line has no breakpoint disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "clear current line has no breakpoint disallowed"} -+ timeout {fail "(timeout) clear current line has no breakpoint disallowed"} -+} -+ -+# Verify that we can set and clear multiple breakpoints. -+# -+# We don't test that it deletes the correct breakpoints. We do at -+# least test that it deletes more than one breakpoint. -+# -+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1" -+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" -+gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} -+ -+# Verify that a breakpoint can be set via a convenience variable. -+# -+send_gdb "set \$foo=$bp_location11\n" -+gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set convenience variable \$foo to bp_location11"} -+ timeout {fail "(timeout) set convenience variable \$foo to bp_location11"} -+} -+send_gdb "break \$foo\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\ -+ {pass "set breakpoint via convenience variable"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint via convenience variable"} -+ timeout {fail "(timeout) set breakpoint via convenience variable"} -+} -+ -+# Verify that GDB responds gracefully to an attempt to set a -+# breakpoint via a convenience variable whose type is not integer. -+# -+send_gdb "set \$foo=81.5\n" -+gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set convenience variable \$foo to 81.5"} -+ timeout {fail "(timeout) set convenience variable \$foo to 81.5"} -+} -+send_gdb "break \$foo\n" -+gdb_expect { -+ -re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\ -+ {pass "set breakpoint via non-integer convenience variable disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint via non-integer convenience variable disallowed"} -+ timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"} -+} -+ -+# Verify that we can set and trigger a breakpoint in a user-called function. -+# -+send_gdb "break marker2\n" -+gdb_expect { -+ -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ -+ {pass "set breakpoint on to-be-called function"} -+ -re "$gdb_prompt $"\ -+ {fail "set breakpoint on to-be-called function"} -+ timeout {fail "(timeout) set breakpoint on to-be-called function"} -+} -+send_gdb "print marker2(99)\n" -+gdb_expect { -+ -re "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2$proto. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.\r\n$gdb_prompt $"\ -+ {pass "hit breakpoint on called function"} -+ -re "$gdb_prompt $"\ -+ {fail "hit breakpoint on called function"} -+ timeout {fail "(timeout) hit breakpoint on called function"} -+} -+ -+# As long as we're stopped (breakpointed) in a called function, -+# verify that we can successfully backtrace & such from here. -+# -+# In this and the following test, the _sr4export check apparently is needed -+# for hppa*-*-hpux. -+# -+send_gdb "bt\n" -+gdb_expect { -+ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\ -+ {pass "backtrace while in called function"} -+ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\ -+ {pass "backtrace while in called function"} -+ -re "$gdb_prompt $"\ -+ {fail "backtrace while in called function"} -+ timeout {fail "(timeout) backtrace while in called function"} -+} -+ -+# Return from the called function. For remote targets, it's important to do -+# this before runto_main, which otherwise may silently stop on the dummy -+# breakpoint inserted by GDB at the program's entry point. -+# -+send_gdb "finish\n" -+gdb_expect { -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\ -+ {pass "finish from called function"} -+ -re "$gdb_prompt $"\ -+ {fail "finish from called function"} -+ timeout {fail "(timeout) finish from called function"} -+} -+ -+# Verify that GDB responds gracefully to a "finish" command with -+# arguments. -+# -+if ![runto_main] then { fail "break tests suppressed" } -+ -+send_gdb "finish 123\n" -+gdb_expect { -+ -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\ -+ {pass "finish with arguments disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "finish with arguments disallowed"} -+ timeout {fail "(timeout) finish with arguments disallowed"} -+} -+ -+# Verify that GDB responds gracefully to a request to "finish" from -+# the outermost frame. On a stub that never exits, this will just -+# run to the stubs routine, so we don't get this error... Thus the -+# second condition. -+# -+ -+send_gdb "finish\n" -+gdb_expect { -+ -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\ -+ {pass "finish from outermost frame disallowed"} -+ -re "Run till exit from.*\r\n$gdb_prompt $" { -+ pass "finish from outermost frame disallowed" -+ } -+ -re "$gdb_prompt $"\ -+ {fail "finish from outermost frame disallowed"} -+ timeout {fail "(timeout) finish from outermost frame disallowed"} -+} -+ -+# Verify that we can explicitly ask GDB to stop on all shared library -+# events, and that it does so. -+# -+if [istarget "hppa*-*-hpux*"] then { -+ if ![runto_main] then { fail "break tests suppressed" } -+ -+ send_gdb "set stop-on-solib-events 1\n" -+ gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "set stop-on-solib-events"} -+ timeout {fail "(timeout) set stop-on-solib-events"} -+ } -+ -+ send_gdb "run\n" -+ gdb_expect { -+ -re ".*Start it from the beginning.*y or n. $"\ -+ {send_gdb "y\n" -+ gdb_expect { -+ -re ".*Stopped due to shared library event.*$gdb_prompt $"\ -+ {pass "triggered stop-on-solib-events"} -+ -re "$gdb_prompt $"\ -+ {fail "triggered stop-on-solib-events"} -+ timeout {fail "(timeout) triggered stop-on-solib-events"} -+ } -+ } -+ -re "$gdb_prompt $"\ -+ {fail "rerun for stop-on-solib-events"} -+ timeout {fail "(timeout) rerun for stop-on-solib-events"} -+ } -+ -+ send_gdb "set stop-on-solib-events 0\n" -+ gdb_expect { -+ -re "$gdb_prompt $"\ -+ {pass "reset stop-on-solib-events"} -+ timeout {fail "(timeout) reset stop-on-solib-events"} -+ } -+} -+ -+# Hardware breakpoints are unsupported on HP-UX. Verify that GDB -+# gracefully responds to requests to create them. -+# -+if [istarget "hppa*-*-hpux*"] then { -+ if ![runto_main] then { fail "break tests suppressed" } -+ -+ send_gdb "hbreak\n" -+ gdb_expect { -+ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ -+ {pass "hw breaks disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "hw breaks disallowed"} -+ timeout {fail "(timeout) hw breaks disallowed"} -+ } -+ -+ send_gdb "thbreak\n" -+ gdb_expect { -+ -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ -+ {pass "temporary hw breaks disallowed"} -+ -re "$gdb_prompt $"\ -+ {fail "temporary hw breaks disallowed"} -+ timeout {fail "(timeout) temporary hw breaks disallowed"} -+ } -+} -+ -+#******** -+ -+ -+# -+# Test "next" over recursive function call. -+# -+ -+proc test_next_with_recursion {} { -+ global gdb_prompt -+ global decimal -+ global binfile -+ -+ if [target_info exists use_gdb_stub] { -+ # Reload the program. -+ delete_breakpoints -+ gdb_load ${binfile}; -+ } else { -+ # FIXME: should be using runto -+ gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y" -+ -+ delete_breakpoints -+ } -+ -+ gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial" -+ -+ # Run until we call factorial with 6 -+ -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"6\"\n" -+ } else { -+ gdb_run_cmd -+ } -+ gdb_expect { -+ -re "Break.* factorial .value=6. .*$gdb_prompt $" {} -+ -re ".*$gdb_prompt $" { -+ fail "run to factorial(6)"; -+ gdb_suppress_tests; -+ } -+ timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests } -+ } -+ -+ # Continue until we call factorial recursively with 5. -+ -+ if [gdb_test "continue" \ -+ "Continuing.*Break.* factorial .value=5. .*" \ -+ "continue to factorial(5)"] then { gdb_suppress_tests } -+ -+ # Do a backtrace just to confirm how many levels deep we are. -+ -+ if [gdb_test "backtrace" \ -+ "#0\[ \t\]+ factorial .value=5..*" \ -+ "backtrace from factorial(5)"] then { gdb_suppress_tests } -+ -+ # Now a "next" should position us at the recursive call, which -+ # we will be performing with 4. -+ -+ if [gdb_test "next" \ -+ ".* factorial .value - 1.;.*" \ -+ "next to recursive call"] then { gdb_suppress_tests } -+ -+ # Disable the breakpoint at the entry to factorial by deleting them all. -+ # The "next" should run until we return to the next line from this -+ # recursive call to factorial with 4. -+ # Buggy versions of gdb will stop instead at the innermost frame on -+ # the line where we are trying to "next" to. -+ -+ delete_breakpoints -+ -+ if [istarget "mips*tx39-*"] { -+ set timeout 60 -+ } -+ # We used to set timeout here for all other targets as well. This -+ # is almost certainly wrong. The proper timeout depends on the -+ # target system in use, and how we communicate with it, so there -+ # is no single value appropriate for all targets. The timeout -+ # should be established by the Dejagnu config file(s) for the -+ # board, and respected by the test suite. -+ # -+ # For example, if I'm running GDB over an SSH tunnel talking to a -+ # portmaster in California talking to an ancient 68k board running -+ # a crummy ROM monitor (a situation I can only wish were -+ # hypothetical), then I need a large timeout. But that's not the -+ # kind of knowledge that belongs in this file. -+ -+ gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \ -+ "next over recursive call" -+ -+ # OK, we should be back in the same stack frame we started from. -+ # Do a backtrace just to confirm. -+ -+ set result [gdb_test "backtrace" \ -+ "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \ -+ "backtrace from factorial(5.1)"] -+ if { $result != 0 } { gdb_suppress_tests } -+ -+ if [target_info exists gdb,noresults] { gdb_suppress_tests } -+ gdb_continue_to_end "recursive next test" -+ gdb_stop_suppressing_tests; -+} -+ -+test_next_with_recursion -+ -+ -+#******** -+ -+# build a new file with optimization enabled so that we can try breakpoints -+# on targets with optimized prologues -+ -+set binfileo2 ${objdir}/${subdir}/${testfile}o2 -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfileo2}] { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfileo2} -+ -+if [target_info exists gdb_stub] { -+ gdb_step_for_stub; -+} -+ -+# -+# test break at function -+# -+gdb_test "break main" \ -+ "Breakpoint.*at.* file .*$srcfile, line.*" \ -+ "breakpoint function, optimized file" -+ -+# -+# test break at function -+# -+gdb_test "break marker4" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" \ -+ "breakpoint small function, optimized file" -+ -+# -+# run until the breakpoint at main is hit. For non-stubs-using targets. -+# -+if ![target_info exists use_gdb_stub] { -+ if [istarget "*-*-vxworks*"] then { -+ send_gdb "run vxmain \"2\"\n" -+ set timeout 120 -+ verbose "Timeout is now $timeout seconds" 2 -+ } else { -+ send_gdb "run\n" -+ } -+ gdb_expect { -+ -re "The program .* has been started already.*y or n. $" { -+ send_gdb "y\n" -+ exp_continue -+ } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ -+ { pass "run until function breakpoint, optimized file" } -+ -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\ -+ { pass "run until function breakpoint, optimized file (code motion)" } -+ -re ".*$gdb_prompt $" { fail "run until function breakpoint, optimized file" } -+ timeout { fail "run until function breakpoint, optimized file (timeout)" } -+ } -+} else { -+ if ![target_info exists gdb_stub] { -+ gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file" -+ } -+} -+ -+# -+# run until the breakpoint at a small function -+# -+ -+# -+# Add a second pass pattern. The behavior differs here between stabs -+# and dwarf for one-line functions. Stabs preserves two line symbols -+# (one before the prologue and one after) with the same line number, -+# but dwarf regards these as duplicates and discards one of them. -+# Therefore the address after the prologue (where the breakpoint is) -+# has no exactly matching line symbol, and GDB reports the breakpoint -+# as if it were in the middle of a line rather than at the beginning. -+ -+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] -+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] -+send_gdb "continue\n" -+gdb_expect { -+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { -+ pass "run until breakpoint set at small function, optimized file" -+ } -+ -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { -+ pass "run until breakpoint set at small function, optimized file" -+ } -+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { -+ # marker4() is defined at line 46 when compiled with -DPROTOTYPES -+ pass "run until breakpoint set at small function, optimized file (line bp_location14)" -+ } -+ -re ".*$gdb_prompt " { -+ fail "run until breakpoint set at small function, optimized file" -+ } -+ timeout { -+ fail "run until breakpoint set at small function, optimized file (timeout)" -+ } -+} -+ -+ -+# Reset the default arguments for VxWorks -+if [istarget "*-*-vxworks*"] { -+ set timeout 10 -+ verbose "Timeout is now $timeout seconds" 2 -+ send_gdb "set args main\n" -+ gdb_expect -re ".*$gdb_prompt $" {} -+} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp 2012-06-02 18:24:38.511266528 +0200 -@@ -0,0 +1,233 @@ -+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 -+# 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 Fred Fish. (fnf@cygnus.com) -+ -+# are we on a target board -+if ![isnative] then { -+ return -+} -+ -+set testfile "coremaker" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags=-fpie -pie"}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+# Create and source the file that provides information about the compiler -+# used to compile the test case. -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+# Create a core file named "corefile" rather than just "core", to -+# avoid problems with sys admin types that like to regularly prune all -+# files named "core" from the system. -+# -+# Arbitrarily try setting the core size limit to "unlimited" since -+# this does not hurt on systems where the command does not work and -+# allows us to generate a core on systems where it does. -+# -+# Some systems append "core" to the name of the program; others append -+# the name of the program to "core"; still others (like Linux, as of -+# May 2003) create cores named "core.PID". In the latter case, we -+# could have many core files lying around, and it may be difficult to -+# tell which one is ours, so let's run the program in a subdirectory. -+set found 0 -+set coredir "${objdir}/${subdir}/coredir.[getpid]" -+file mkdir $coredir -+catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" -+# remote_exec host "${binfile}" -+foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i ${objdir}/${subdir}/corefile" -+ set found 1 -+ } -+} -+# Check for "core.PID". -+if { $found == 0 } { -+ set names [glob -nocomplain -directory $coredir core.*] -+ if {[llength $names] == 1} { -+ set corefile [file join $coredir [lindex $names 0]] -+ remote_exec build "mv $corefile ${objdir}/${subdir}/corefile" -+ set found 1 -+ } -+} -+if { $found == 0 } { -+ # The braindamaged HPUX shell quits after the ulimit -c above -+ # without executing ${binfile}. So we try again without the -+ # ulimit here if we didn't find a core file above. -+ # Oh, I should mention that any "braindamaged" non-Unix system has -+ # the same problem. I like the cd bit too, it's really neat'n stuff. -+ catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\"" -+ foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i ${objdir}/${subdir}/corefile" -+ set found 1 -+ } -+ } -+} -+ -+# Try to clean up after ourselves. -+remote_file build delete [file join $coredir coremmap.data] -+remote_exec build "rmdir $coredir" -+ -+if { $found == 0 } { -+ warning "can't generate a core file - core tests suppressed - check ulimit -c" -+ return 0 -+} -+ -+# -+# Test that we can simply startup with a "-core=corefile" command line arg -+# and recognize that the core file is a valid, usable core file. -+# To do this, we must shutdown the currently running gdb and restart -+# with the -core args. We can't use gdb_start because it looks for -+# the first gdb prompt, and the message we are looking for occurs -+# before the first prompt. Also, we can't include GDBFLAGS because -+# if it is empty, this confuses gdb with an empty argument that it -+# grumbles about (said grumbling currently being ignored in gdb_start). -+# **FIXME** -+# -+# Another problem is that on some systems (solaris for example), there -+# is apparently a limit on the length of a fully specified path to -+# the coremaker executable, at about 80 chars. For this case, consider -+# it a pass, but note that the program name is bad. -+ -+gdb_exit -+if $verbose>1 then { -+ send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n" -+} -+ -+set oldtimeout $timeout -+set timeout [expr "$timeout + 60"] -+verbose "Timeout is now $timeout seconds" 2 -+eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile" -+expect { -+ -re "Couldn't find .* registers in core file.*$gdb_prompt $" { -+ fail "args: -core=corefile (couldn't find regs)" -+ } -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: -core=corefile" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: -core=corefile (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "args: -core=corefile (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "args: -core=corefile" } -+ timeout { fail "(timeout) starting with -core" } -+} -+ -+ -+# -+# Test that startup with both an executable file and -core argument. -+# See previous comments above, they are still applicable. -+# -+ -+close; -+ -+if $verbose>1 then { -+ send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n" -+} -+ -+ -+eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile"; -+expect { -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: execfile -core=corefile" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "args: execfile -core=corefile (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "args: execfile -core=corefile (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "args: execfile -core=corefile" } -+ timeout { fail "(timeout) starting with -core" } -+} -+set timeout $oldtimeout -+verbose "Timeout is now $timeout seconds" 2 -+ -+close; -+ -+# Now restart normally. -+ -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# Test basic corefile recognition via core-file command. -+ -+send_gdb "core-file $objdir/$subdir/corefile\n" -+gdb_expect { -+ -re ".* program is being debugged already.*y or n. $" { -+ # gdb_load may connect us to a gdbserver. -+ send_gdb "y\n" -+ exp_continue; -+ } -+ -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "core-file command" -+ } -+ -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -+ pass "core-file command (with bad program name)" -+ } -+ -re ".*registers from core file: File in wrong format.* $" { -+ fail "core-file command (could not read registers from core file)" -+ } -+ -re ".*$gdb_prompt $" { fail "core-file command" } -+ timeout { fail "(timeout) core-file command" } -+} -+ -+# Test correct mapping of corefile sections by printing some variables. -+ -+gdb_test "print coremaker_data" "\\\$$decimal = 202" -+gdb_test "print coremaker_bss" "\\\$$decimal = 10" -+gdb_test "print coremaker_ro" "\\\$$decimal = 201" -+ -+gdb_test "print func2::coremaker_local" "\\\$$decimal = \\{0, 1, 2, 3, 4\\}" -+ -+# Somehow we better test the ability to read the registers out of the core -+# file correctly. I don't think the other tests do this. -+ -+gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp" -+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp" -+ -+# Test ability to read mmap'd data -+ -+gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file" -+setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*" -+set test "accessing mmapped data in core file" -+gdb_test_multiple "x/8bd buf2" "$test" { -+ -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$gdb_prompt $" { -+ pass "$test" -+ } -+ -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$gdb_prompt $" { -+ fail "$test (mapping failed at runtime)" -+ } -+ -re "0x.*:.*Cannot access memory at address 0x.*$gdb_prompt $" { -+ fail "$test (mapping address not found in core file)" -+ } -+} -+ -+# test reinit_frame_cache -+ -+gdb_load ${binfile} -+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)" -+ -+gdb_test "core" "No core file now." -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in 2012-06-02 18:24:38.512266527 +0200 -@@ -0,0 +1,19 @@ -+VPATH = @srcdir@ -+srcdir = @srcdir@ -+ -+EXECUTABLES = -+MISCELLANEOUS = arch.inc -+ -+all info install-info dvi install uninstall installcheck check: -+ @echo "Nothing to be done for $@..." -+ -+clean mostlyclean: -+ -rm -f *~ *.o a.out *.x *.ci *.tmp -+ -rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES) -+ -rm -f $(MISCELLANEOUS) -+ -+distclean maintainer-clean realclean: clean -+ -rm -f *~ core -+ -rm -f Makefile config.status config.log -+ -rm -f *-init.exp -+ -rm -fr *.log summary detail *.plog *.sum *.psum site.* diff --git a/gdb-6.3-test-self-20050110.patch b/gdb-6.3-test-self-20050110.patch deleted file mode 100644 index a3ada08..0000000 --- a/gdb-6.3-test-self-20050110.patch +++ /dev/null @@ -1,101 +0,0 @@ -2004-02-23 Elena Zannoni - - * gdb.gdb/selftest.exp: Make sure that the debug directory is - set up properly. - * gdb.gdb/complaints.exp: Ditto. - * gdb.gdb/xfullpath.exp: Ditto. - * gdb.gdb/observer.exp: Ditto. - -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/complaints.exp -=================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/gdb.gdb/complaints.exp 2009-01-03 06:58:04.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/complaints.exp 2009-02-26 22:10:48.000000000 +0100 -@@ -302,13 +302,13 @@ proc find_gdb { arg } { - set GDB_FULLPATH [find_gdb $GDB] - - # Remove any old copy lying around. --remote_file host delete x$tool -+#remote_file host delete x$tool - - gdb_start - --set file [remote_download host $GDB_FULLPATH x$tool] -+#set file [remote_download host $GDB_FULLPATH x$tool] - --set setup_result [setup_test $file ] -+set setup_result [setup_test $GDB_FULLPATH ] - if {$setup_result <0} then { - return -1 - } -@@ -319,4 +319,4 @@ test_short_complaints - test_empty_complaints - - gdb_exit; --catch "remote_file host delete $file"; -+#catch "remote_file host delete $file"; -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/observer.exp -=================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/gdb.gdb/observer.exp 2009-02-17 20:52:27.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/observer.exp 2009-02-26 22:11:40.000000000 +0100 -@@ -258,13 +258,13 @@ proc find_gdb { arg } { - set GDB_FULLPATH [find_gdb $GDB] - - # Remove any old copy lying around. --remote_file host delete x$tool -+#remote_file host delete x$tool - - gdb_start --set file [remote_download host $GDB_FULLPATH x$tool] --set result [test_observer $file]; -+#set file [remote_download host $GDB_FULLPATH x$tool] -+set result [test_observer $GDB_FULLPATH]; - gdb_exit; --catch "remote_file host delete $file"; -+#catch "remote_file host delete $file"; - - if {$result <0} then { - warning "Couldn't test self" -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/selftest.exp -=================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/gdb.gdb/selftest.exp 2009-02-26 22:09:59.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/selftest.exp 2009-02-26 22:10:48.000000000 +0100 -@@ -551,13 +551,13 @@ proc find_gdb { arg } { - set GDB_FULLPATH [find_gdb $GDB] - - # Remove any old copy lying around. --remote_file host delete x$tool -+#remote_file host delete x$tool - - gdb_start --set file [remote_download host $GDB_FULLPATH x$tool] --set result [test_with_self $file]; -+#set file [remote_download host $GDB_FULLPATH x$tool] -+set result [test_with_self $GDB_FULLPATH]; - gdb_exit; --catch "remote_file host delete $file"; -+#catch "remote_file host delete $file"; - - if {$result <0} then { - warning "Couldn't test self" -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/xfullpath.exp -=================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/gdb.gdb/xfullpath.exp 2009-01-03 06:58:04.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.gdb/xfullpath.exp 2009-02-26 22:10:48.000000000 +0100 -@@ -179,13 +179,13 @@ proc find_gdb { arg } { - set GDB_FULLPATH [find_gdb $GDB] - - # Remove any old copy lying around. --remote_file host delete x$tool -+#remote_file host delete x$tool - - gdb_start --set file [remote_download host $GDB_FULLPATH x$tool] --set result [test_with_self $file]; -+#set file [remote_download host $GDB_FULLPATH x$tool] -+set result [test_with_self $GDB_FULLPATH]; - gdb_exit; --catch "remote_file host delete $file"; -+#catch "remote_file host delete $file"; - - if {$result <0} then { - warning "Couldn't test self" diff --git a/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch deleted file mode 100644 index a24c448..0000000 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ /dev/null @@ -1,246 +0,0 @@ -2005-02-28 Jeff Johnston - - * config/i386/nm-linux.h: Change dr register routines to - accept a ptid_t first argument. Change all calling macros - to default the inferior_ptid for the first argument. - (i386_linux_insert_watchpoint): New prototype. - (i386_linux_remove_watchpoint, i386_linux_insert_hw_breakpoint): Ditto. - (i386_linux_remove_hw_breakpoint): Ditto. - (target_insert_watchpoint, target_remove_watchpoint): Undef and - override. - (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Ditto. - * config/i386/nm-linux64.h: Ditto except add amd64 versions of - the watchpoint/hw-breakpoint insert/remove routines. - * i386-nat.c: Include "inferior.h" to define inferior_ptid. - * i386-linux-nat.c: Change all dr get/set routines to accept - ptid_t as first argument and to use this argument to determine - the tid for PTRACE. - (i386_linux_set_debug_regs_for_thread): New function. - (i386_linux_sync_debug_registers_callback): Ditto. - (i386_linux_sync_debug_registers_across_threads): Ditto. - (i386_linux_insert_watchpoint, i386_linux_remove_watchpoint): Ditto. - (i386_linux_hw_breakpoint, i386_linux_remove_hw_breakpoint): Ditto. - (i386_linux_new_thread): Ditto. - (_initialize_i386_linux_nat): Ditto. - * amd64-linux-nat.c: Change all dr get/set routines to accept - ptid_t as first argument and to use this argument to determine - the tid for PTRACE. - (amd64_linux_set_debug_regs_for_thread): New function. - (amd64_linux_sync_debug_registers_callback): Ditto. - (amd64_linux_sync_debug_registers_across_threads): Ditto. - (amd64_linux_insert_watchpoint, amd64_linux_remove_watchpoint): Ditto. - (amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto. - (amd64_linux_new_thread): Ditto. - (_initialize_amd64_linux_nat): Register linux new thread observer. - * testsuite/gdb.threads/watchthreads-threaded.c: New test case. - * testsuite/gdb.threads/watchthreads-threaded.exp: Ditto. - -[ With recent upstream GDB (6.8) reduced only to the testcase. ] - -[ It was called watchthreads2.{exp,c} before but it conflicted with FSF GDB new - testcase of the same name. ] - -FIXME: The testcase does not expects multiple watchpoints hits per one stop. - -Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.c 2011-12-19 22:05:02.867431570 +0100 -@@ -0,0 +1,66 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2002, 2003, 2004, 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. -+ -+ This file is copied from schedlock.c. */ -+ -+#include -+#include -+#include -+#include -+ -+void *thread_function(void *arg); /* Pointer to function executed by each thread */ -+ -+#define NUM 5 -+ -+unsigned int args[NUM+1]; -+ -+int main() { -+ int res; -+ pthread_t threads[NUM]; -+ void *thread_result; -+ long i; -+ -+ for (i = 0; i < NUM; i++) -+ { -+ args[i] = 1; /* Init value. */ -+ res = pthread_create(&threads[i], -+ NULL, -+ thread_function, -+ (void *) i); -+ } -+ -+ args[i] = 1; -+ thread_function ((void *) i); -+ -+ exit(EXIT_SUCCESS); -+} -+ -+void *thread_function(void *arg) { -+ int my_number = (long) arg; -+ int *myp = (int *) &args[my_number]; -+ -+ /* Don't run forever. Run just short of it :) */ -+ while (*myp > 0) -+ { -+ (*myp) ++; usleep (1); /* Loop increment. */ -+ } -+ -+ pthread_exit(NULL); -+} -+ -Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.exp 2011-12-19 22:28:33.294911982 +0100 -@@ -0,0 +1,126 @@ -+# This testcase is part of GDB, the GNU debugger. -+ -+# 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. -+ -+# Check that GDB can support multiple watchpoints across threads. -+ -+# This test verifies that a watchpoint is detected in the proper thread -+# so the test is only meaningful on a system with hardware watchpoints. -+if [target_info exists gdb,no_hardware_watchpoints] { -+ return 0; -+} -+ -+set testfile "watchthreads-threaded" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+gdb_test "set can-use-hw-watchpoints 1" "" "" -+ -+# -+# Run to `main' where we begin our tests. -+# -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+set args_2 0 -+set args_3 0 -+ -+gdb_breakpoint "thread_function" -+gdb_continue_to_breakpoint "thread_function" -+gdb_test "disable 2" "" -+ -+gdb_test_multiple "p args\[2\]" "get initial args2" { -+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" { -+ set init_args_2 $expect_out(1,string) -+ pass "get initial args2" -+ } -+} -+ -+gdb_test_multiple "p args\[3\]" "get initial args3" { -+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" { -+ set init_args_3 $expect_out(1,string) -+ pass "get initial args3" -+ } -+} -+ -+set args_2 $init_args_2 -+set args_3 $init_args_3 -+ -+# Watch values that will be modified by distinct threads. -+gdb_test "watch args\[2\]" "Hardware watchpoint 3: args\\\[2\\\]" -+gdb_test "watch args\[3\]" "Hardware watchpoint 4: args\\\[3\\\]" -+ -+set init_line [expr [gdb_get_line_number "Init value"]+1] -+set inc_line [gdb_get_line_number "Loop increment"] -+ -+# Loop and continue to allow both watchpoints to be triggered. -+for {set i 0} {$i < 30} {incr i} { -+ set test_flag 0 -+ gdb_test_multiple "continue" "threaded watch loop" { -+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $" -+ { set args_2 1; set test_flag 1 } -+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $" -+ { set args_3 1; set test_flag 1 } -+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" -+ { set args_2 [expr $args_2+1]; set test_flag 1 } -+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" -+ { set args_3 [expr $args_3+1]; set test_flag 1 } -+ } -+ # If we fail above, don't bother continuing loop -+ if { $test_flag == 0 } { -+ set i 30; -+ } -+} -+ -+# Print success message if loop succeeded. -+if { $test_flag == 1 } { -+ pass "threaded watch loop" -+} -+ -+# Verify that we hit first watchpoint in child thread. -+set message "watchpoint on args\[2\] hit in thread" -+if { $args_2 > 1 } { -+ pass $message -+} else { -+ fail $message -+} -+ -+# Verify that we hit second watchpoint in child thread. -+set message "watchpoint on args\[3\] hit in thread" -+if { $args_3 > 1 } { -+ pass $message -+} else { -+ fail $message -+} -+ -+# Verify that all watchpoint hits are accounted for. -+set message "combination of threaded watchpoints = 30 + initial values" -+if { [expr $args_2+$args_3] == [expr [expr 30+$init_args_2]+$init_args_3] } { -+ pass $message -+} else { -+ fail $message -+} diff --git a/gdb-6.5-BEA-testsuite.patch b/gdb-6.5-BEA-testsuite.patch deleted file mode 100644 index 76d7566..0000000 --- a/gdb-6.5-BEA-testsuite.patch +++ /dev/null @@ -1,938 +0,0 @@ -Index: ./gdb/testsuite/gdb.threads/threadcrash.c -=================================================================== -RCS file: gdb/testsuite/gdb.threads/threadcrash.c -diff -N gdb/testsuite/gdb.threads/threadcrash.c ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.threads/threadcrash.c 31 Oct 2006 17:54:38 -0000 -@@ -0,0 +1,301 @@ -+/* -+ * The point of this program is to crash in a multi-threaded app. -+ * There are seven threads, doing the following things: -+ * * Spinning -+ * * Spinning inside a signal handler -+ * * Spinning inside a signal handler executing on the altstack -+ * * In a syscall -+ * * In a syscall inside a signal handler -+ * * In a syscall inside a signal handler executing on the altstack -+ * * Finally, the main thread crashes in main, with no frills. -+ * -+ * These are the things threads in JRockit tend to be doing. If gdb -+ * can handle those things, both in core files and during live -+ * debugging, that will help (at least) JRockit development. -+ * -+ * Let the program create a core file, then load the core file into -+ * gdb. Inside gdb, you should be able to do something like this: -+ * -+ * (gdb) t a a bt -+ * -+ * Thread 7 (process 4352): -+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6 -+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6 -+ * #2 0x080488a2 in makeSyscall (ignored=0x0) at threadcrash.c:118 -+ * #3 0x006aadec in start_thread () from /lib/tls/libpthread.so.0 -+ * #4 0x001ed19a in clone () from /lib/tls/libc.so.6 -+ * -+ * Thread 6 (process 4353): -+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6 -+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6 -+ * #2 0x0804898f in syscallingSighandler (signo=10, info=0xb6be76f0, context=0xb6be7770) -+ * at threadcrash.c:168 -+ * #3 -+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0 -+ * #5 0x08048a51 in makeSyscallFromSighandler (ignored=0x0) at threadcrash.c:204 -+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0 -+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6 -+ * -+ * Thread 5 (process 4354): -+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6 -+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6 -+ * #2 0x08048936 in syscallingAltSighandler (signo=3, info=0x959cd70, context=0x959cdf0) -+ * at threadcrash.c:144 -+ * #3 -+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0 -+ * #5 0x080489e2 in makeSyscallFromAltSighandler (ignored=0x0) at threadcrash.c:190 -+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0 -+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6 -+ * -+ * Thread 4 (process 4355): -+ * #0 spin (ignored=0x0) at threadcrash.c:242 -+ * #1 0x006aadec in start_thread () from /lib/tls/libpthread.so.0 -+ * #2 0x001ed19a in clone () from /lib/tls/libc.so.6 -+ * -+ * Thread 3 (process 4356): -+ * #0 spinningSighandler (signo=12, info=0xb4de46f0, context=0xb4de4770) at threadcrash.c:180 -+ * #1 -+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0 -+ * #3 0x08048b2f in spinFromSighandler (ignored=0x0) at threadcrash.c:232 -+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0 -+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6 -+ * -+ * Thread 2 (process 4357): -+ * #0 spinningAltSighandler (signo=14, info=0x959ee50, context=0x959eed0) at threadcrash.c:156 -+ * #1 -+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0 -+ * #3 0x08048ac0 in spinFromAltSighandler (ignored=0x0) at threadcrash.c:218 -+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0 -+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6 -+ * -+ * Thread 1 (process 4351): -+ * #0 0x08048cf3 in main (argc=1, argv=0xbfff9d74) at threadcrash.c:273 -+ * (gdb) -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define SIGSYSCALL_ALT SIGQUIT -+#define SIGSYSCALL SIGUSR1 -+#define SIGSPIN_ALT SIGALRM -+#define SIGSPIN SIGUSR2 -+ -+typedef void (*sigaction_t)(int, siginfo_t *, void *); -+ -+static void installHandler(int signo, sigaction_t handler, int onAltstack) { -+ struct sigaction action; -+ sigset_t sigset; -+ int result; -+ stack_t altstack; -+ stack_t oldaltstack; -+ -+ memset(&action, 0, sizeof(action)); -+ memset(&altstack, 0, sizeof(altstack)); -+ memset(&oldaltstack, 0, sizeof(oldaltstack)); -+ -+ if (onAltstack) { -+ altstack.ss_sp = malloc(SIGSTKSZ); -+ assert(altstack.ss_sp != NULL); -+ altstack.ss_size = SIGSTKSZ; -+ altstack.ss_flags = 0; -+ result = sigaltstack(&altstack, &oldaltstack); -+ assert(result == 0); -+ assert(oldaltstack.ss_flags == SS_DISABLE); -+ } -+ -+ sigemptyset(&sigset); -+ -+ action.sa_handler = NULL; -+ action.sa_sigaction = handler; -+ action.sa_mask = sigset; -+ action.sa_flags = SA_SIGINFO; -+ if (onAltstack) { -+ action.sa_flags |= SA_ONSTACK; -+ } -+ -+ result = sigaction(signo, &action, NULL); -+ assert(result == 0); -+} -+ -+static void installNormalHandler(int signo, sigaction_t handler) { -+ installHandler(signo, handler, 0); -+} -+ -+static void installAlthandler(int signo, sigaction_t handler) { -+ installHandler(signo, handler, 1); -+} -+ -+static void *makeSyscall(void *ignored) { -+ (void)ignored; -+ -+ sleep(42); -+ -+ fprintf(stderr, "%s: returning\n", __FUNCTION__); -+ return NULL; -+} -+ -+/* Return true if we're currently executing on the altstack */ -+static int onAltstack(void) { -+ stack_t stack; -+ int result; -+ -+ result = sigaltstack(NULL, &stack); -+ assert(result == 0); -+ -+ return stack.ss_flags & SS_ONSTACK; -+} -+ -+static void syscallingAltSighandler(int signo, siginfo_t *info, void *context) { -+ (void)signo; -+ (void)info; -+ (void)context; -+ -+ if (!onAltstack()) { -+ printf("%s() not running on altstack!\n", __FUNCTION__); -+ } -+ -+ sleep(42); -+} -+ -+static void spinningAltSighandler(int signo, siginfo_t *info, void *context) { -+ (void)signo; -+ (void)info; -+ (void)context; -+ -+ if (!onAltstack()) { -+ printf("%s() not running on altstack!\n", __FUNCTION__); -+ } -+ -+ while (1); -+} -+ -+static void syscallingSighandler(int signo, siginfo_t *info, void *context) { -+ (void)signo; -+ (void)info; -+ (void)context; -+ -+ if (onAltstack()) { -+ printf("%s() running on altstack!\n", __FUNCTION__); -+ } -+ -+ sleep(42); -+} -+ -+static void spinningSighandler(int signo, siginfo_t *info, void *context) { -+ (void)signo; -+ (void)info; -+ (void)context; -+ -+ if (onAltstack()) { -+ printf("%s() running on altstack!\n", __FUNCTION__); -+ } -+ -+ while (1); -+} -+ -+static void *makeSyscallFromAltSighandler(void *ignored) { -+ (void)ignored; -+ -+ int result; -+ -+ installAlthandler(SIGSYSCALL_ALT, syscallingAltSighandler); -+ -+ result = pthread_kill(pthread_self(), SIGSYSCALL_ALT); -+ assert(result == 0); -+ -+ fprintf(stderr, "%s: returning\n", __FUNCTION__); -+ return NULL; -+} -+ -+static void *makeSyscallFromSighandler(void *ignored) { -+ (void)ignored; -+ -+ int result; -+ -+ installNormalHandler(SIGSYSCALL, syscallingSighandler); -+ -+ result = pthread_kill(pthread_self(), SIGSYSCALL); -+ assert(result == 0); -+ -+ fprintf(stderr, "%s: returning\n", __FUNCTION__); -+ return NULL; -+} -+ -+static void *spinFromAltSighandler(void *ignored) { -+ (void)ignored; -+ -+ int result; -+ -+ installAlthandler(SIGSPIN_ALT, spinningAltSighandler); -+ -+ result = pthread_kill(pthread_self(), SIGSPIN_ALT); -+ assert(result == 0); -+ -+ fprintf(stderr, "%s: returning\n", __FUNCTION__); -+ return NULL; -+} -+ -+static void *spinFromSighandler(void *ignored) { -+ (void)ignored; -+ -+ int result; -+ -+ installNormalHandler(SIGSPIN, spinningSighandler); -+ -+ result = pthread_kill(pthread_self(), SIGSPIN); -+ assert(result == 0); -+ -+ fprintf(stderr, "%s: returning\n", __FUNCTION__); -+ return NULL; -+} -+ -+static void *spin(void *ignored) { -+ (void)ignored; -+ -+ while (1); -+ -+ fprintf(stderr, "%s: returning\n", __FUNCTION__); -+ return NULL; -+} -+ -+int main(int argc, char *argv[]) { -+ int result; -+ pthread_t thread; -+ volatile int bad; -+ -+ result = pthread_create(&thread, NULL, makeSyscall, NULL); -+ assert(result == 0); -+ result = pthread_create(&thread, NULL, makeSyscallFromSighandler, NULL); -+ assert(result == 0); -+ result = pthread_create(&thread, NULL, makeSyscallFromAltSighandler, NULL); -+ assert(result == 0); -+ result = pthread_create(&thread, NULL, spin, NULL); -+ assert(result == 0); -+ result = pthread_create(&thread, NULL, spinFromSighandler, NULL); -+ assert(result == 0); -+ result = pthread_create(&thread, NULL, spinFromAltSighandler, NULL); -+ assert(result == 0); -+ -+ // Give threads some time to get going -+ sleep(3); -+ -+ // Crash -+ bad = *(int*)7; -+ -+ /* Workaround: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29628 -+ Simulate use to ensure `DW_AT_location' for them: -+ readelf -a --debug threadcrash|grep -A5 -w argc -+ --> DW_AT_location : 2 byte block: 71 0 (DW_OP_breg1: 0) -+ This case verified on: gcc-4.1.1-30.i386 -+ Keep it late to ensure persistency in the registers. */ -+ bad = (int) argc; -+ bad = (unsigned long) argv; -+ -+ return 0; -+} -Index: ./gdb/testsuite/gdb.threads/threadcrash.exp -=================================================================== -RCS file: gdb/testsuite/gdb.threads/threadcrash.exp -diff -N gdb/testsuite/gdb.threads/threadcrash.exp ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.threads/threadcrash.exp 31 Oct 2006 17:54:38 -0000 -@@ -0,0 +1,37 @@ -+# threadcrash.exp - The point of this program is to crash in a multi-threaded app. -+ -+ -+set testfile threadcrash -+set srcfile ${testfile}.c -+set shellfile ${srcdir}/${subdir}/${testfile}.sh -+set binfile ${objdir}/${subdir}/${testfile} -+ -+set GDB_abs ${GDB} -+if [regexp "^\[^/\]" ${GDB_abs}] { -+ set GDB_abs $env(PWD)/${GDB_abs} -+} -+ -+if [istarget "*-*-linux"] then { -+ set target_cflags "-D_MIT_POSIX_THREADS" -+} else { -+ set target_cflags "" -+} -+ -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ return -1 -+} -+ -+# ${shellfile} argument must not contain any directories. -+set fd [open "|bash ${shellfile} ${binfile} $GDB -nw $GDBFLAGS" r] -+while { [gets $fd line] >= 0 } { -+ if [regexp " PASS: (.*)$" $line trash message] { -+ pass $message -+ } elseif [regexp " FAIL: (.*)$" $line trash message] { -+ fail $message -+ } -+} -+catch { -+ close $fd -+} -+ -+return 0 -Index: ./gdb/testsuite/gdb.threads/threadcrash.sh -=================================================================== -RCS file: gdb/testsuite/gdb.threads/threadcrash.sh -diff -N gdb/testsuite/gdb.threads/threadcrash.sh ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.threads/threadcrash.sh 31 Oct 2006 17:54:38 -0000 -@@ -0,0 +1,324 @@ -+#! /bin/bash -+ -+# NOTE: threadcrash.c *must* be built with debugging symbols -+# -+# The point of this shell script is to crash treadcrash.c, load the -+# resulting core file into gdb and verify that gdb can extract enough -+# information from the core file. -+# -+# The return code from this script is the number of failed tests. -+ -+LOG=gdbresult.log -+ -+if [ $# = 0 ] ; then -+ echo >&2 Syntax: $0 \ [\ \] -+ exit 1 -+fi -+RUNME="$1" -+shift -+GDB="${*:-gdb}" -+ -+ -+pf_prefix="" -+function pf_prefix() { -+ pf_prefix="$*" -+} -+ -+set_test="" -+function set_test() { -+ if [ -n "$set_test" ] ; then -+ echo >&2 "DEJAGNU-BASH ERROR: set_test already set" -+ exit 1 -+ fi -+ set_test="$*" -+ if [ -n "$pf_prefix" ] ; then -+ set_test="$pf_prefix: $set_test" -+ fi -+} -+ -+# INTERNAL -+function record_test { -+ if [ -z "$set_test" ] ; then -+ echo >&2 "DEJAGNU-BASH ERROR: set_test not set" -+ exit 1 -+ fi -+ # Provide the leading whitespace delimiter: -+ echo " $1: $set_test" -+ set_test="" -+} -+ -+function pass() { -+ record_test PASS -+} -+function fail() { -+ record_test FAIL -+} -+ -+ -+# Verify that the gdb output doesn't contain $1. -+function mustNotHave() { -+ local BADWORD=$1 -+ set_test gdb output contains "$BADWORD" -+ if grep -q "$BADWORD" $LOG ; then -+ fail -+ return 1 -+ fi -+ pass -+ return 0 -+} -+ -+# Verify that the gdb output contains exactly $1 $2s. -+function mustHaveCorrectAmount() { -+ local WANTEDNUMBER=$1 -+ local GOODWORD=$2 -+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l) -+ set_test gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected -+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then -+ fail -+ return 1 -+ fi -+ pass -+ return 0 -+} -+ -+# Verify that the gdb output contains seven threads -+function mustHaveSevenThreads() { -+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l) -+ set_test gdb output contains $NTHREADS threads, not 7 as expected -+ if [ $NTHREADS != 7 ] ; then -+ fail -+ return 1 -+ fi -+ pass -+ return 0 -+} -+ -+# Verify that the gdb output has all parameters on consecutive lines -+function mustHaveSequence() { -+ SEQUENCE="$*" -+ NPARTS=$# -+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log -+ -+ while [ $# -gt 1 ] ; do -+ shift -+ ((NPARTS--)) -+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log -+ mv temp.log matches.log -+ done -+ LASTPART=$1 -+ -+ set_test gdb output does not contain the sequence: $SEQUENCE -+ if ! grep -q "$LASTPART" matches.log ; then -+ fail -+ return 1 -+ fi -+ pass -+ return 0 -+} -+ -+# Verify that $LOG contains all information we want -+function verifyLog() { -+ local FAILURES=0 -+ -+ mustNotHave '??' || ((FAILURES++)) -+ mustHaveCorrectAmount 12 threadcrash.c: || ((FAILURES++)) -+ -+ mustHaveSevenThreads || ((FAILURES++)) -+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++)) -+ -+ return $FAILURES -+} -+ -+# Put result of debugging a core file in $LOG -+function getLogFromCore() { -+ # Make sure we get a core file -+ set_test Make sure we get a core file -+ if ! ulimit -c unlimited ; then -+ fail -+ exit 1 -+ fi -+ pass -+ -+ # Run the crasher -+ ./$(basename "$RUNME") -+ EXITCODE=$? -+ -+ # Verify that we actually crashed -+ set_test $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE -+ if [ $EXITCODE -lt 128 ] ; then -+ fail -+ exit 1 -+ fi -+ pass -+ -+ # Verify that we got a core file -+ set_test $RUNME did not create a core file -+ if [ ! -r core* ] ; then -+ fail -+ exit 1 -+ fi -+ pass -+ -+ # Run gdb -+ cat > gdbscript.gdb < $LOG -+ EXITCODE=$? -+ -+ set_test gdb exited with error code -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >&2 gdb exited with error code $EXITCODE -+ fail -+ fi -+ pass -+} -+ -+# Put result of debugging a gcore file in $LOG -+function getLogFromGcore() { -+ # Create the core file -+ rm -f core* -+ cat > gdbscript.gdb < /dev/null -+ EXITCODE=$? -+ -+ set_test gdb exited with error code when creating gcore file -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >&2 gdb exited with error code $EXITCODE when creating gcore file -+ fail -+ fi -+ pass -+ -+ # Verify that we got a core file from gcore -+ set_test gdb gcore did not create a core file -+ if [ ! -r core* ] ; then -+ fail -+ exit 1 -+ fi -+ pass -+ -+ # Run gdb on the gcore file -+ cat > gdbscript.gdb < $LOG -+ EXITCODE=$? -+ -+ set_test gdb exited with error code when examining gcore file -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >&2 gdb exited with error code $EXITCODE when examining gcore file -+ fail -+ fi -+ pass -+} -+ -+# Put result of debugging a core file in $LOG -+function getLogFromLiveProcess() { -+ # Run gdb -+ cat > gdbscript.gdb < $LOG -+ EXITCODE=$? -+ -+ set_test gdb exited with error code -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >&2 gdb exited with error code $EXITCODE -+ fail -+ fi -+ pass -+} -+ -+####### Main program follows ##################### -+ -+# Make sure we don't clobber anybody else's (core) file(s) -+WORKDIR=/tmp/$PPID -+mkdir -p $WORKDIR -+cp "$RUNME" $WORKDIR -+cd $WORKDIR -+ -+# Count problems -+FAILURES=0 -+ -+echo === Testing gdb vs core file... -+pf_prefix core file -+getLogFromCore -+verifyLog -+((FAILURES+=$?)) -+pf_prefix -+echo === Core file tests done. -+ -+echo -+ -+echo === Testing gdb vs gcore file... -+pf_prefix gcore file -+getLogFromGcore -+verifyLog -+((FAILURES+=$?)) -+pf_prefix -+echo === Gcore file tests done. -+ -+echo -+ -+echo === Testing gdb vs live process... -+pf_prefix live process -+getLogFromLiveProcess -+verifyLog -+((FAILURES+=$?)) -+pf_prefix -+echo === Live process tests done. -+ -+# Executive summary -+echo -+if [ $FAILURES == 0 ] ; then -+ echo All tests passed! -+else -+ echo $FAILURES tests failed! -+ echo -+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\). -+fi -+ -+# Clean up -+cd / -+rm -rf $WORKDIR -+ -+exit $FAILURES -Index: ./gdb/testsuite/gdb.threads/threadcrash.sh-orig -=================================================================== -RCS file: gdb/testsuite/gdb.threads/threadcrash.sh-orig -diff -N gdb/testsuite/gdb.threads/threadcrash.sh-orig ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.threads/threadcrash.sh-orig 31 Oct 2006 17:54:38 -0000 -@@ -0,0 +1,248 @@ -+#! /bin/bash -+ -+# NOTE: threadcrash.c *must* be built with debugging symbols -+# -+# The point of this shell script is to crash treadcrash.c, load the -+# resulting core file into gdb and verify that gdb can extract enough -+# information from the core file. -+# -+# The return code from this script is the number of failed tests. -+ -+LOG=gdbresult.log -+ -+if [ $# != 1 ] ; then -+ echo > /dev/stderr Syntax: $0 \ -+ exit 1 -+fi -+RUNME="$1" -+ -+# Verify that the gdb output doesn't contain $1. -+function mustNotHave() { -+ local BADWORD=$1 -+ if grep -q "$BADWORD" $LOG ; then -+ echo >> /dev/stderr WARNING: gdb output contains "$BADWORD" -+ return 1 -+ fi -+ return 0 -+} -+ -+# Verify that the gdb output contains exactly $1 $2s. -+function mustHaveCorrectAmount() { -+ local WANTEDNUMBER=$1 -+ local GOODWORD=$2 -+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l) -+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then -+ echo >> /dev/stderr WARNING: gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected -+ return 1 -+ fi -+ return 0 -+} -+ -+# Verify that the gdb output contains seven threads -+function mustHaveSevenThreads() { -+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l) -+ if [ $NTHREADS != 7 ] ; then -+ echo >> /dev/stderr WARNING: gdb output contains $NTHREADS threads, not 7 as expected -+ return 1 -+ fi -+ return 0 -+} -+ -+# Verify that the gdb output has all parameters on consecutive lines -+function mustHaveSequence() { -+ SEQUENCE="$*" -+ NPARTS=$# -+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log -+ -+ while [ $# -gt 1 ] ; do -+ shift -+ ((NPARTS--)) -+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log -+ mv temp.log matches.log -+ done -+ LASTPART=$1 -+ -+ if ! grep -q "$LASTPART" matches.log ; then -+ echo >> /dev/stderr WARNING: gdb output does not contain the sequence: $SEQUENCE -+ return 1 -+ fi -+ return 0 -+} -+ -+# Verify that $LOG contains all information we want -+function verifyLog() { -+ local FAILURES=0 -+ -+ mustNotHave '??' || ((FAILURES++)) -+ mustHaveCorrectAmount 12 threadcrash.c: || ((FAILURES++)) -+ -+ mustHaveSevenThreads || ((FAILURES++)) -+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++)) -+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++)) -+ -+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++)) -+ -+ return $FAILURES -+} -+ -+# Put result of debugging a core file in $LOG -+function getLogFromCore() { -+ # Make sure we get a core file -+ ulimit -c unlimited || exit 1 -+ -+ # Run the crasher -+ ./$(basename "$RUNME") -+ EXITCODE=$? -+ -+ # Verify that we actually crashed -+ if [ $EXITCODE -lt 128 ] ; then -+ echo >> /dev/stderr ERROR: $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE -+ exit 1 -+ fi -+ -+ # Verify that we got a core file -+ if [ ! -r core* ] ; then -+ echo >> /dev/stderr ERROR: $RUNME did not create a core file -+ exit 1 -+ fi -+ -+ # Run gdb -+ cat > gdbscript.gdb < $LOG -+ EXITCODE=$? -+ -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE -+ fi -+} -+ -+# Put result of debugging a gcore file in $LOG -+function getLogFromGcore() { -+ # Create the core file -+ rm -f core* -+ cat > gdbscript.gdb < /dev/null -+ EXITCODE=$? -+ -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when creating gcore file -+ fi -+ -+ # Verify that we got a core file from gcore -+ if [ ! -r core* ] ; then -+ echo >> /dev/stderr ERROR: gdb gcore did not create a core file -+ exit 1 -+ fi -+ -+ # Run gdb on the gcore file -+ cat > gdbscript.gdb < $LOG -+ EXITCODE=$? -+ -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when examining gcore file -+ fi -+} -+ -+# Put result of debugging a core file in $LOG -+function getLogFromLiveProcess() { -+ # Run gdb -+ cat > gdbscript.gdb < $LOG -+ EXITCODE=$? -+ -+ if [ $EXITCODE != 0 ] ; then -+ ((FAILURES++)) -+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE -+ fi -+} -+ -+####### Main program follows ##################### -+ -+# Make sure we don't clobber anybody else's (core) file(s) -+WORKDIR=/tmp/$PPID -+mkdir -p $WORKDIR -+cp "$RUNME" $WORKDIR -+cd $WORKDIR -+ -+# Count problems -+FAILURES=0 -+ -+echo === Testing gdb vs core file... -+getLogFromCore -+verifyLog -+((FAILURES+=$?)) -+echo === Core file tests done. -+ -+echo -+ -+echo === Testing gdb vs gcore file... -+getLogFromGcore -+verifyLog -+((FAILURES+=$?)) -+echo === Gcore file tests done. -+ -+echo -+ -+echo === Testing gdb vs live process... -+getLogFromLiveProcess -+verifyLog -+((FAILURES+=$?)) -+echo === Live process tests done. -+ -+# Executive summary -+echo -+if [ $FAILURES == 0 ] ; then -+ echo All tests passed! -+else -+ echo $FAILURES tests failed! -+ echo -+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\). -+fi -+ -+# Clean up -+cd / -+rm -rf $WORKDIR -+ -+exit $FAILURES diff --git a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch deleted file mode 100644 index 70be875..0000000 --- a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch +++ /dev/null @@ -1,120 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921 - -It is duplicite to its upstream variant: -http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html -http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html -2007-01-21 Jan Kratochvil - Daniel Jacobowitz - - * gdb.base/included.c, gdb.base/included.exp, - gdb.base/included.h: New files. - ------------------------------------------------------------------------------- - -2007-01-09 Jan Kratochvil - - * gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c, - gdb.dwarf2/dw2-included.h: New files. - ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.c 2 Jan 2007 00:20:27 -0000 -@@ -0,0 +1,26 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2006 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+ USA. */ -+ -+#include "dw2-included.h" -+ -+int -+main() -+{ -+ return 0; -+} ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.exp 2 Jan 2007 00:20:27 -0000 -@@ -0,0 +1,47 @@ -+# Copyright 2006 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Minimal DWARF-2 unit test -+ -+# This test can only be run on targets which support DWARF-2. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-included" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+gdb_test "set listsize 1" "" -+gdb_test "list integer" "int integer;\r" -+gdb_test "ptype integer" "type = int\r" -+# Path varies depending on the build location. -+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\nint integer;\r" ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.h 2 Jan 2007 00:20:27 -0000 -@@ -0,0 +1,20 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2006 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+ USA. */ -+ -+int integer; diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch deleted file mode 100644 index fa2f4ed..0000000 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ /dev/null @@ -1,143 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 - -2008-02-24 Jan Kratochvil - - 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 - - * ./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 . -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#include -+ -+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 . -+ -+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-bz190810-gdbserver-arch-advice.patch b/gdb-6.5-bz190810-gdbserver-arch-advice.patch deleted file mode 100644 index c702327..0000000 --- a/gdb-6.5-bz190810-gdbserver-arch-advice.patch +++ /dev/null @@ -1,28 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=190810 - - -2006-09-26 Jan Kratochvil - - * remote.c (remote_wait): Suggestion on crash due to nonmatching target. - (remote_async_wait): Likewise. - - -Index: gdb-6.8.50.20090818/gdb/remote.c -=================================================================== ---- gdb-6.8.50.20090818.orig/gdb/remote.c 2009-08-18 21:00:35.000000000 +0200 -+++ gdb-6.8.50.20090818/gdb/remote.c 2009-08-18 21:04:46.000000000 +0200 -@@ -4408,8 +4408,13 @@ Packet: '%s'\n"), - VEC_safe_push (cached_reg_t, event->regcache, &cached_reg); - } - -+ /* It may also occur on amd64 which defaults to 32-bit i386 -+ target. gdbserver(1) is not aware of the `set architecture' -+ name itself as it is not using libbfd. */ - if (*p != ';') -- error (_("Remote register badly formatted: %s\nhere: %s"), -+ error (_("Remote register badly formatted: %s\nhere: %s" -+ "\nTry to load the executable by `file' first," -+ "\nyou may also check `set/show architecture'."), - buf, p); - ++p; - } diff --git a/gdb-6.5-bz203661-emit-relocs.patch b/gdb-6.5-bz203661-emit-relocs.patch deleted file mode 100644 index cc8e515..0000000 --- a/gdb-6.5-bz203661-emit-relocs.patch +++ /dev/null @@ -1,17 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/symfile.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/symfile.c 2012-06-02 18:25:20.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/symfile.c 2012-06-02 18:26:36.145232057 +0200 -@@ -3630,6 +3630,12 @@ default_symfile_relocate (struct objfile - DWO file. */ - bfd *abfd = sectp->owner; - -+ /* Executable files have all the relocations already resolved. -+ Handle files linked with --emit-relocs. -+ http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */ -+ 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-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch deleted file mode 100644 index 41a887a..0000000 --- a/gdb-6.5-bz216711-clone-is-outermost.patch +++ /dev/null @@ -1,450 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711 - -FIXME: This workaround should be dropped and -glibc/sysdeps/unix/sysv/linux/x86_64/clone.S should get CFI for the child -instead. - -2006-12-17 Jan Kratochvil - - * gdb/amd64-linux-tdep.c (linux_clone_code): New variable. - (LINUX_CLONE_LEN): New definition. - (amd64_linux_clone_running, amd64_linux_outermost_frame): New function. - (amd64_linux_init_abi): Initialize `outermost_frame_p'. - * gdb/i386-tdep.c (i386_gdbarch_init): Likewise. - * gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member. - * gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'. - -2006-12-17 Jan Kratochvil - - * gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c: - New file. - -2007-10-16 Jan Kratochvil - - Port to GDB-6.7. - -Index: gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/amd64-linux-tdep.c 2012-06-13 22:36:48.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c 2012-07-03 17:32:46.547563363 +0200 -@@ -271,6 +271,80 @@ amd64_linux_register_reggroup_p (struct - - /* 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) - { -@@ -1547,6 +1621,8 @@ amd64_linux_init_abi (struct gdbarch_inf - - amd64_linux_init_abi_common (info, gdbarch); - -+ 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); -Index: gdb-7.4.50.20120703/gdb/amd64-tdep.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/amd64-tdep.c 2012-06-16 17:20:22.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/amd64-tdep.c 2012-07-03 17:32:12.335604415 +0200 -@@ -2324,6 +2324,7 @@ amd64_frame_unwind_stop_reason (struct f - { - 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; -@@ -2332,6 +2333,10 @@ amd64_frame_unwind_stop_reason (struct f - 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; - } - -@@ -2341,6 +2346,7 @@ amd64_frame_this_id (struct frame_info * - { - 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; -@@ -2349,6 +2355,10 @@ amd64_frame_this_id (struct frame_info * - 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); - } - -Index: gdb-7.4.50.20120703/gdb/i386-tdep.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/i386-tdep.c 2012-06-18 19:31:34.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/i386-tdep.c 2012-07-03 17:32:12.339604409 +0200 -@@ -7655,6 +7655,9 @@ i386_gdbarch_init (struct gdbarch_info i - - 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); -Index: gdb-7.4.50.20120703/gdb/i386-tdep.h -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/i386-tdep.h 2012-06-13 22:29:15.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/i386-tdep.h 2012-07-03 17:32:12.340604408 +0200 -@@ -219,6 +219,9 @@ struct gdbarch_tdep - 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. */ -Index: gdb-7.4.50.20120703/gdb/ia64-tdep.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/ia64-tdep.c 2012-07-03 17:30:09.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/ia64-tdep.c 2012-07-03 17:32:12.343604405 +0200 -@@ -2176,6 +2176,138 @@ static const struct frame_unwind ia64_fr - 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 -@@ -4146,6 +4278,7 @@ ia64_gdbarch_init (struct gdbarch_info i - set_gdbarch_dummy_id (gdbarch, ia64_dummy_id); - - set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc); -+ frame_unwind_append_unwinder (gdbarch, &ia64_clone2_frame_unwind); - #ifdef HAVE_LIBUNWIND_IA64_H - frame_unwind_append_unwinder (gdbarch, - &ia64_libunwind_sigtramp_frame_unwind); -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c 2012-07-03 17:32:12.344604404 +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 -+#include -+#include -+ -+ -+void *threader (void *arg) -+{ -+ assert (0); -+ return NULL; -+} -+ -+int main (void) -+{ -+ pthread_t t1; -+ -+ pthread_create (&t1, NULL, threader, (void *) NULL); -+ for (;;) -+ pause(); -+} -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2012-07-03 17:32:12.344604404 +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/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch deleted file mode 100644 index bb6f3f1..0000000 --- a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +++ /dev/null @@ -1,91 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 - - ---- /dev/null 2006-12-17 14:18:21.881669220 -0500 -+++ gdb-6.5/gdb/testsuite/gdb.base/step-over-trampoline.exp 2006-12-17 16:52:51.000000000 -0500 -@@ -0,0 +1,54 @@ -+# 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. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set testfile step-over-trampoline -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# For C programs, "start" should stop in main(). -+ -+gdb_test "start" \ -+ "main \\(\\) at .*$srcfile.*" \ -+ "start" -+ -+# main () at hello2.c:5 -+# 5 puts("hello world\n"); -+# (gdb) next -+# 0x100007e0 in call___do_global_ctors_aux () -+ -+gdb_test_multiple "next" "invalid `next' output" { -+ -re "\nhello world.*return 0;.*" { -+ pass "stepped over" -+ } -+ -re " in call___do_global_ctors_aux \\(\\).*" { -+ fail "stepped into trampoline" -+ } -+} ---- /dev/null 2006-12-17 14:18:21.881669220 -0500 -+++ gdb-6.5/gdb/testsuite/gdb.base/step-over-trampoline.c 2006-12-17 16:18:12.000000000 -0500 -@@ -0,0 +1,28 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2006 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#include -+ -+int main (void) -+{ -+ puts ("hello world"); -+ return 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 deleted file mode 100644 index 082b9a0..0000000 --- a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +++ /dev/null @@ -1,21 +0,0 @@ -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.5-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch deleted file mode 100644 index 1c9b1f2..0000000 --- a/gdb-6.5-bz243845-stale-testing-zombie-test.patch +++ /dev/null @@ -1,79 +0,0 @@ -diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp ---- gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp 2007-07-31 13:04:12.000000000 -0400 -@@ -0,0 +1,75 @@ -+# 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. */ -+ -+# are we on a target board -+if [is_remote target] then { -+ return 0 -+} -+ -+# Start the program running and then wait for a bit, to be sure -+# that it can be attached to. -+ -+gdb_exit -+gdb_start -+gdb_load sleep -+ -+set gdb_pid [exp_pid -i [board_info host fileid]] -+set test "identified the child GDB" -+if {$gdb_pid != "" && $gdb_pid > 0} { -+ pass $test -+ verbose -log "Child GDB PID $gdb_pid" -+} else { -+ fail $test -+} -+ -+set testpid [eval exec sleep 10 &] -+exec sleep 2 -+ -+set test "attach" -+gdb_test_multiple "attach $testpid" "$test" { -+ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" { -+ pass "$test" -+ } -+ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" { -+ # Response expected on Cygwin -+ pass "$test" -+ } -+} -+ -+# Some time to let GDB spawn its testing child. -+exec sleep 2 -+ -+set found none -+foreach procpid [glob -directory /proc -type d {[0-9]*}] { -+ if {[catch {open $procpid/status} statusfi]} { -+ continue -+ } -+ set status [read $statusfi] -+ close $statusfi -+ if {1 -+ && [regexp -line {^Name:\tgdb$} $status] -+ && [regexp -line {^PPid:\t1$} $status] -+ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} { -+ set found $procpid -+ verbose -log "Found linux_test_for_tracefork zombie PID $procpid" -+ } -+} -+set test "linux_test_for_tracefork leaves no zombie" -+if {$found eq {none}} { -+ pass $test -+} else { -+ fail $test -+} diff --git a/gdb-6.5-gcore-buffer-limit-test.patch b/gdb-6.5-gcore-buffer-limit-test.patch deleted file mode 100644 index dad4833..0000000 --- a/gdb-6.5-gcore-buffer-limit-test.patch +++ /dev/null @@ -1,139 +0,0 @@ -diff -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.5/gdb/testsuite/gdb.base/gcore-excessive-memory.c gdb-6.5-unknown/gdb/testsuite/gdb.base/gcore-excessive-memory.c ---- gdb-6.5/gdb/testsuite/gdb.base/gcore-excessive-memory.c 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.5-unknown/gdb/testsuite/gdb.base/gcore-excessive-memory.c 2008-01-08 11:25:45.000000000 +0100 -@@ -0,0 +1,37 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#include -+#include -+ -+#define MEGS 64 -+ -+int main() -+{ -+ void *mem; -+ -+ mem = malloc (MEGS * 1024ULL * 1024ULL); -+ -+ for (;;) -+ sleep (1); -+ -+ return 0; -+} -diff -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.5/gdb/testsuite/gdb.base/gcore-excessive-memory.exp gdb-6.5-unknown/gdb/testsuite/gdb.base/gcore-excessive-memory.exp ---- gdb-6.5/gdb/testsuite/gdb.base/gcore-excessive-memory.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.5-unknown/gdb/testsuite/gdb.base/gcore-excessive-memory.exp 2008-01-08 11:47:32.000000000 +0100 -@@ -0,0 +1,94 @@ -+# 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. -+ -+set testfile gcore-excessive-memory -+set srcfile ${testfile}.c -+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh -+set corefile ${objdir}/${subdir}/${testfile}.core -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+set f [open "|getconf PAGESIZE" "r"] -+gets $f pagesize -+close $f -+ -+set pid_of_bin [eval exec $binfile &] -+sleep 2 -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach" -+gdb_test "up 99" "in main .*" "verify we can get to main" -+ -+proc memory_v_pages_get {} { -+ global pid_of_gdb pagesize -+ set fd [open "/proc/$pid_of_gdb/statm"] -+ gets $fd line -+ close $fd -+ # number of pages of virtual memory -+ scan $line "%d" drs -+ return $drs -+} -+ -+set pages_found [memory_v_pages_get] -+ -+# It must be definitely less than `MEGS' of `gcore-excessive-memory.c'. -+set mb_gcore_reserve 4 -+verbose -log "pages_found = $pages_found, mb_gcore_reserve = $mb_gcore_reserve" -+set kb_found [expr $pages_found * $pagesize / 1024] -+set kb_permit [expr $kb_found + 1 * 1024 + $mb_gcore_reserve * 1024] -+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit" -+ -+# Create the ulimit wrapper. -+set f [open $shfile "w"] -+puts $f "#! /bin/sh" -+puts $f "ulimit -v $kb_permit" -+puts $f "exec $GDB \"\$@\"" -+close $f -+remote_exec host "chmod +x $shfile" -+ -+gdb_exit -+set GDBold $GDB -+set GDB "$shfile" -+gdb_start -+set GDB $GDBold -+ -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach" -+gdb_test "up 99" "in main .*" "verify we can get to main" -+ -+verbose -log "kb_found before gcore = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+gdb_test "gcore $corefile" "Saved corefile \[^\n\r\]*" "Save the core file" -+ -+verbose -log "kb_found after gcore = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+# Cleanup. -+exec kill -9 $pid_of_bin diff --git a/gdb-6.5-ia64-libunwind-leak-test.patch b/gdb-6.5-ia64-libunwind-leak-test.patch deleted file mode 100644 index c77c677..0000000 --- a/gdb-6.5-ia64-libunwind-leak-test.patch +++ /dev/null @@ -1,120 +0,0 @@ -diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.c gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.c ---- gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.c 2007-12-19 15:12:55.000000000 -0500 -+++ gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.c 2007-12-19 13:55:22.000000000 -0500 -@@ -0,0 +1,29 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2007 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+#include -+ -+int main() -+{ -+ for (;;) -+ alarm (0); -+ return 0; -+} -diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp ---- gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:12:53.000000000 -0500 -+++ gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:11:35.000000000 -0500 -@@ -0,0 +1,83 @@ -+# 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 unwind-leak -+set srcfile ${testfile}.c -+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh -+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} -+ -+set pid [exp_pid -i [board_info host fileid]] -+ -+# For C programs, "start" should stop in main(). -+ -+gdb_test "start" \ -+ "main \\(\\) at .*$srcfile.*" \ -+ "start" -+ -+set loc [gdb_get_line_number "alarm"] -+gdb_breakpoint $loc -+ -+proc memory_get {} { -+ global pid -+ set fd [open "/proc/$pid/statm"] -+ gets $fd line -+ close $fd -+ # number of pages of data/stack -+ scan $line "%*d%*d%*d%*d%*d%d" drs -+ return $drs -+} -+ -+set cycles 100 -+# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB -+set permit_kb 100 -+verbose -log "cycles = $cycles, permit_kb = $permit_kb" -+ -+set fail 0 -+set test "breakpoint stop/continue cycles" -+for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} { -+ gdb_test_multiple "continue" $test { -+ -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" { -+ } -+ -re "Segmentation fault" { -+ fail $test -+ set i 0 -+ set fail 1 -+ } -+ } -+ if ![info exists from] { -+ set from [memory_get] -+ } -+} -+set to [memory_get] -+if {!$fail} { -+ verbose -log "from = $from KB, to = $to KB" -+ if {$from > 0 && $to > 10 && $to < $from + $permit_kb} { -+ pass $test -+ } else { -+ fail $test -+ } -+} diff --git a/gdb-6.5-last-address-space-byte-test.patch b/gdb-6.5-last-address-space-byte-test.patch deleted file mode 100644 index 8bdbb2b..0000000 --- a/gdb-6.5-last-address-space-byte-test.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp -=================================================================== -RCS file: ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp -diff -N ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/largecore-last-address-lock.exp 15 Nov 2006 21:43:24 -0000 -@@ -0,0 +1,49 @@ -+# 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. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+ -+# i386 (32-bit) only: gdb with Red Hat largecore patch did lock up: -+# https://enterprise.redhat.com/issue-tracker/?module=issues&action=view&tid=103263 -+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=210614 -+ -+# i386: Bug exists when the `target_xfer_memory' condition -+# `(memaddr + len < region->hi)' operates on 64-bit operands on -+# largecore-patched with 32-bit addresses and so it can get `false' with -+# arbitrary `len'. -+ -+# x86_64: The bug is not present as the operands and calculations have the same -+# bit size. Would would still need to pass there the highest address -+# (`memaddr == 0xffffffffffffffff') but we would need to pass `len == 0' -+# to make the condition `(memaddr + len < region->hi)' false. -+# `len == 0' would get caught eariler. -+ -+# Error in the success case is immediate. -+set timeoutold ${timeout} -+set timeout 10 -+ -+gdb_test "x/xb 0xffffffff" \ -+ "Cannot access memory at address 0xffffffff" \ -+ "Read the last address space byte" -+ -+set timeout ${timeoutold} diff --git a/gdb-6.5-missed-trap-on-step-test.patch b/gdb-6.5-missed-trap-on-step-test.patch deleted file mode 100644 index 2f4436d..0000000 --- a/gdb-6.5-missed-trap-on-step-test.patch +++ /dev/null @@ -1,83 +0,0 @@ -Fix has been committed to: - gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch - ---- /dev/null 2007-12-14 20:45:09.113039517 +0100 -+++ gdb-6.5/gdb/testsuite/gdb.base/watchpoint-during-step.exp 2007-12-24 19:42:00.000000000 +0100 -@@ -0,0 +1,44 @@ -+# 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 watchpoint-during-step -+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} -+ -+runto_main -+ -+gdb_breakpoint [gdb_get_line_number "var = 2"] -+gdb_continue_to_breakpoint "Find the first var set" -+ -+gdb_test "step" ".*var = 3;" "Step to the next var set" -+ -+gdb_test "watch var" "atchpoint .*: var" "Set the watchpoint" -+ -+# Here is the target point. Be careful to not have breakpoint set on the line -+# we step from as in this case it is a valid upstream KFAIL gdb/38 -+ -+gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint" ---- /dev/null 2007-12-14 20:45:09.113039517 +0100 -+++ gdb-6.5/gdb/testsuite/gdb.base/watchpoint-during-step.c 2007-12-24 19:38:10.000000000 +0100 -@@ -0,0 +1,30 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2007 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+static int var; -+ -+int main() -+{ -+ var = 1; -+ var = 2; -+ var = 3; -+ return 0; -+} diff --git a/gdb-6.5-readline-long-line-crash-test.patch b/gdb-6.5-readline-long-line-crash-test.patch deleted file mode 100644 index 86a82a4..0000000 --- a/gdb-6.5-readline-long-line-crash-test.patch +++ /dev/null @@ -1,136 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 - - -Index: ./gdb/testsuite/gdb.base/readline-overflow.exp -=================================================================== -RCS file: ./gdb/testsuite/gdb.base/readline-overflow.exp -diff -N ./gdb/testsuite/gdb.base/readline-overflow.exp ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/readline-overflow.exp 13 Nov 2006 23:42:50 -0000 -@@ -0,0 +1,125 @@ -+# 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. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Jan Kratochvil -+ -+# This file is part of the gdb testsuite. -+ -+# -+# Tests for readline buffer overflow. -+# -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+# Don't let a .inputrc file or an existing setting of INPUTRC mess up -+# the test results. Even if /dev/null doesn't exist on the particular -+# platform, the readline library will use the default setting just by -+# failing to open the file. OTOH, opening /dev/null successfully will -+# also result in the default settings being used since nothing will be -+# read from this file. -+global env -+if [info exists env(INPUTRC)] { -+ set old_inputrc $env(INPUTRC) -+} -+set env(INPUTRC) "/dev/null" -+ -+set oldtimeout1 $timeout -+set timeout 600 -+ -+if [info exists env(GDBHISTFILE)] { -+ set old_gdbhistfile $env(GDBHISTFILE) -+} -+if [info exists env(HISTSIZE)] { -+ set old_histsize $env(HISTSIZE) -+} -+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history" -+set env(HISTSIZE) "10" -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+ -+set width 11 -+gdb_test "set width $width" \ -+ "" \ -+ "Setting width to $width." -+#gdb_test "set height 1" \ -+# "" \ -+# "Setting height to 1." -+send_gdb "run X" -+set i 0 -+# It crashes using `set width 7' on `set total 3560'. -+# Sometimes it corrupts screen on `set width 7'. -+# Bugreport used `set total 130001': -+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 -+# Check also `timeout' above. -+set total 4200 -+gdb_expect { -+ -re X { -+ incr i -+ if {$i <= $total} { -+ send_gdb "X" -+ exp_continue -+ } -+ } -+ -re "\[ \b\r\n\]" { -+ exp_continue -+ } -+ eof { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters, reason: EOF" -+ gdb_clear_suppressed -+ } -+ timeout { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT" -+ gdb_clear_suppressed -+ } -+ default { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]" -+ gdb_clear_suppressed -+ } -+} -+gdb_test "\r" \ -+ "No executable file specified..*" \ -+ "All the characters transferred" -+ -+ -+# Restore globals modified in this test... -+if [info exists old_inputrc] { -+ set env(INPUTRC) $old_inputrc -+} else { -+ unset env(INPUTRC) -+} -+if [info exists old_gdbhistfile] { -+ set env(GDBHISTFILE) $old_gdbhistfile -+} else { -+ unset env(GDBHISTFILE) -+} -+if [info exists old_histsize] { -+ set env(HISTSIZE) $old_histsize -+} else { -+ unset env(HISTSIZE) -+} -+set timeout $oldtimeout1 -+ -+return 0 diff --git a/gdb-6.5-section-num-fixup-test.patch b/gdb-6.5-section-num-fixup-test.patch deleted file mode 100644 index 53f7fec..0000000 --- a/gdb-6.5-section-num-fixup-test.patch +++ /dev/null @@ -1,111 +0,0 @@ -diff -up -ruNp gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-lib.c gdb-6.5/gdb/testsuite/gdb.base/datalib-lib.c ---- gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-lib.c 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.5/gdb/testsuite/gdb.base/datalib-lib.c 2008-05-29 13:51:50.000000000 -0400 -@@ -0,0 +1,22 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+int var; -diff -up -ruNp gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-main.c gdb-6.5/gdb/testsuite/gdb.base/datalib-main.c ---- gdb-6.5-orig/gdb/testsuite/gdb.base/datalib-main.c 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.5/gdb/testsuite/gdb.base/datalib-main.c 2008-05-29 13:51:39.000000000 -0400 -@@ -0,0 +1,26 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+int -+main (void) -+{ -+ return 0; -+} -diff -up -ruNp gdb-6.5-orig/gdb/testsuite/gdb.base/datalib.exp gdb-6.5/gdb/testsuite/gdb.base/datalib.exp ---- gdb-6.5-orig/gdb/testsuite/gdb.base/datalib.exp 1969-12-31 19:00:00.000000000 -0500 -+++ gdb-6.5/gdb/testsuite/gdb.base/datalib.exp 2008-05-29 14:58:33.000000000 -0400 -@@ -0,0 +1,51 @@ -+# 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. -+ -+set testfile datalib -+set srcfilemain ${testfile}-main.c -+set srcfilelib ${testfile}-lib.c -+set libfile ${objdir}/${subdir}/${testfile}-lib.so -+set binfile ${objdir}/${subdir}/${testfile}-main -+if { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" 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} -+ -+# We must use a separate library as the main executable is compiled to the -+# address 0 by default and it would get fixed up already at the end of -+# INIT_OBJFILE_SECT_INDICES. We also cannot PRELINK it as PRELINK is missing -+# on ia64. The library must be NOSTDLIB as otherwise some stub code would -+# create the `.text' section there. Also DEBUG option is useful as some of -+# the crashes occur in dwarf2read.c. -+ -+# FAIL case: -+# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized -+# A problem internal to GDB has been detected, -+ -+gdb_test "start" \ -+ "main \\(\\) at .*${srcfilemain}.*" \ -+ "start" diff --git a/gdb-6.5-sharedlibrary-path.patch b/gdb-6.5-sharedlibrary-path.patch deleted file mode 100644 index 3e0c101..0000000 --- a/gdb-6.5-sharedlibrary-path.patch +++ /dev/null @@ -1,171 +0,0 @@ -If you provided some relative path to the shared library, such as with - export LD_LIBRARY_PATH=. -then gdb would fail to match the shared library name during the TLS lookup. - - -Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed? - - -The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'. -The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. - - -2006-09-01 Jan Kratochvil - - * solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute - requested pathnames to the internal loaded relative pathnames. - -2007-10-16 Jan Kratochvil - - Port to GDB-6.7. - -2008-02-27 Jan Kratochvil - - Port to gdb-6.7.50.20080227. - -Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-main.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-main.c 2008-02-27 09:00:15.000000000 +0100 -@@ -0,0 +1,25 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2006 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+int main() -+{ -+ return 0; -+} -Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c 2008-02-27 09:00:15.000000000 +0100 -@@ -0,0 +1,22 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2006 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+__thread int var = 42; ---- /dev/null 2009-02-10 00:19:00.494289687 +0100 -+++ gdb-6.8.50.20090209-x/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-02-10 00:49:38.000000000 +0100 -@@ -0,0 +1,86 @@ -+# 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. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set testfile tls-sepdebug -+set srcmainfile ${testfile}-main.c -+set srcsharedfile ${testfile}-shared.c -+ -+set binmainfile ${objdir}/${subdir}/${testfile}-main -+set binsharedbase ${testfile}-shared.so -+set binsharedfile ${objdir}/${subdir}/${binsharedbase} -+set binshareddebugfile ${objdir}/${subdir}/${binsharedbase}.debug -+ -+# Use explicit -soname as otherwise the full path to the library would get -+# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless. -+ -+# FIXME: gcc dependency (-Wl,-soname). -+ -+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } { -+ untested "Couldn't compile test library" -+ return -1 -+} -+ -+# eu-strip(1) works fine but it is a part of `elfutils', not `binutils'. -+if 0 then { -+ remote_exec build "eu-strip -f ${binshareddebugfile} ${binsharedfile}" -+} else { -+ remote_exec build "objcopy --only-keep-debug ${binsharedfile} ${binshareddebugfile}" -+ remote_exec build "objcopy --strip-debug ${binsharedfile}" -+ remote_exec build "objcopy --add-gnu-debuglink=${binshareddebugfile} ${binsharedfile}" -+} -+ -+# Do not use `shlib=' as it will automatically add also -rpath for gcc. -+ -+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile} ${binsharedfile}" "${binmainfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+# Test also the proper resolving of relative library names to absolute ones. -+# \$PWD is easy - it is the absolute way -+# ${subdir} would fail on "print var" -+ -+foreach ld_library_path [list [pwd]/${subdir} ./${subdir}] name { absolute relative } { -+ -+ gdb_exit -+ gdb_start -+ ###gdb_reinitialize_dir $srcdir/$subdir -+ -+ gdb_test "set env LD_LIBRARY_PATH=$ld_library_path" \ -+ "" \ -+ "set env LD_LIBRARY_PATH is $name" -+ -+ gdb_load ${binmainfile} -+ -+ # For C programs, "start" should stop in main(). -+ -+ gdb_test "start" \ -+ "main \\(\\) at .*${srcmainfile}.*" \ -+ "start" -+ -+ # Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list -+ # as happens with TLS variables and `separate_debug_objfile_backlink'. -+ -+ gdb_test "print var" \ -+ "\\\$1 = \[0-9\].*" \ -+ "print TLS variable from a shared library with $name-directory separate debug info file" -+} diff --git a/gdb-6.6-bfd-vdso8k.patch b/gdb-6.6-bfd-vdso8k.patch deleted file mode 100644 index 06507b0..0000000 --- a/gdb-6.6-bfd-vdso8k.patch +++ /dev/null @@ -1,119 +0,0 @@ -2007-09-23 Jan Kratochvil - - * 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-bz229517-gcore-without-terminal.patch b/gdb-6.6-bz229517-gcore-without-terminal.patch deleted file mode 100644 index c2d0180..0000000 --- a/gdb-6.6-bz229517-gcore-without-terminal.patch +++ /dev/null @@ -1,171 +0,0 @@ -2007-04-22 Jan Kratochvil - - * gdb_gcore.sh: Redirect GDB from ` - - * gdb.base/gcorebg.exp, gdb.base/gcorebg.c: New files. - - ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/gcorebg.c 25 Feb 2007 12:21:20 -0000 -@@ -0,0 +1,43 @@ -+#include -+#include -+#include -+#include -+#include -+ -+int main (int argc, char **argv) -+{ -+ pid_t pid = 0; -+ pid_t ppid; -+ char buf[256]; -+ -+ if (argc != 4) -+ { -+ fprintf (stderr, "Syntax: %s {standard|detached} \n", -+ argv[0]); -+ exit (1); -+ } -+ -+ pid = fork (); -+ -+ switch (pid) -+ { -+ case 0: -+ if (strcmp (argv[1], "detached") == 0) -+ setpgrp (); -+ ppid = getppid (); -+ sprintf (buf, "sh %s -o %s %d", argv[2], argv[3], (int) ppid); -+ system (buf); -+ kill (ppid, SIGTERM); -+ break; -+ -+ case -1: -+ perror ("fork err\n"); -+ exit (1); -+ break; -+ -+ default: -+ sleep (60); -+ } -+ -+ return 0; -+} ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/gcorebg.exp 25 Feb 2007 12:21:20 -0000 -@@ -0,0 +1,113 @@ -+# Copyright 2007 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Jan Kratochvil . -+# This is a test for `gdb_gcore.sh' functionality. -+# It also tests a regression with `gdb_gcore.sh' being run without its -+# accessible terminal. -+ -+if ![info exists GCORE] { -+ set GCORE "${srcdir}/../gdb_gcore.sh" -+} -+verbose "using GCORE = $GCORE" 2 -+ -+set testfile "gcorebg" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set corefile ${objdir}/${subdir}/${testfile}.test -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested gcorebg.exp -+ return -1 -+} -+ -+# Cleanup. -+ -+proc core_clean {} { -+ global corefile -+ -+ foreach file [glob -nocomplain [join [list $corefile *] ""]] { -+ verbose "Delete file $file" 1 -+ remote_file target delete $file -+ } -+} -+core_clean -+remote_file target delete "./gdb" -+ -+# Generate the core file. -+ -+# Provide `./gdb' for `gdb_gcore.sh' running it as a bare `gdb' command. -+# Setup also `$PATH' appropriately. -+# If GDB was not found let `gdb_gcore.sh' to find the system GDB by `$PATH'. -+if {$GDB != "gdb"} { -+ file link ./gdb $GDB -+} -+global env -+set oldpath $env(PATH) -+set env(PATH) [join [list . $env(PATH)] ":"] -+verbose "PATH = $env(PATH)" 2 -+ -+# Test file body. -+# $detached == "standard" || $detached == "detached" -+ -+proc test_body { detached } { -+ global binfile -+ global GCORE -+ global corefile -+ -+ set res [remote_spawn target "$binfile $detached $GCORE $corefile"] -+ if { $res < 0 || $res == "" } { -+ fail "Spawning $detached gcore" -+ return 1 -+ } -+ pass "Spawning $detached gcore" -+ remote_expect target 20 { -+ timeout { -+ fail "Spawned $detached gcore finished" -+ remote_exec target "kill -9 -[exp_pid -i $res]" -+ return 1 -+ } -+ eof { -+ pass "Spawned $detached gcore finished" -+ remote_wait target 20 -+ } -+ } -+ -+ if {1 == [llength [glob -nocomplain [join [list $corefile *] ""]]]} { -+ pass "Core file generated by $detached gcore" -+ } else { -+ fail "Core file generated by $detached gcore" -+ } -+ core_clean -+} -+ -+# First a general `gdb_gcore.sh' spawn with its controlling terminal available. -+ -+test_body standard -+ -+# And now `gdb_gcore.sh' spawn without its controlling terminal available. -+# It is spawned through `gcorebg.c' using setpgrp (). -+ -+test_body detached -+ -+ -+# Cleanup. -+ -+set env(PATH) $oldpath -+remote_file target delete "./gdb" diff --git a/gdb-6.6-bz230000-power6-disassembly-test.patch b/gdb-6.6-bz230000-power6-disassembly-test.patch deleted file mode 100644 index 1ebf31b..0000000 --- a/gdb-6.6-bz230000-power6-disassembly-test.patch +++ /dev/null @@ -1,83 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000 - -The original testcase - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000#c1 -requires too recent GCC. - - ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.arch/powerpc-power6.exp 25 Feb 2007 18:27:39 -0000 -@@ -0,0 +1,54 @@ -+# 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. -+ -+# Test PowerPC Power6 instructions disassembly. -+ -+if {![istarget "powerpc*-*-*"]} then { -+ verbose "Skipping PowerPC Power6 instructions disassembly." -+ return -+} -+ -+set testfile "powerpc-power6" -+set srcfile ${testfile}.s -+set objfile ${objdir}/${subdir}/${testfile}.o -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } { -+ untested "PowerPC prologue tests" -+ return -1 -+} -+ -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${objfile} -+ -+# Disassemble the function. -+ -+gdb_test "disass func" ":\tblr\r\n.*" "Basic disassembly" -+ -+gdb_test "disass func" ":\tdcbzl *r8,r9\r\n.*" "Power5 disassembly dcbzl" -+gdb_test "disass func" ":\tfrsqrtes *f10,f11\r\n.*" "Power5 disassembly frsqrtes" -+gdb_test "disass func" ":\tdadd *f1,f2,f1\r\n.*" "Power6 disassembly dadd" -+gdb_test "disass func" ":\tdaddq *f1,f2,f1\r\n.*" "Power6 disassembly daddq" -+gdb_test "disass func" ":\tdsub *f1,f2,f1\r\n.*" "Power6 disassembly dsub" -+gdb_test "disass func" ":\tdsubq *f1,f2,f1\r\n.*" "Power6 disassembly dsubq" -+gdb_test "disass func" ":\tdmul *f1,f2,f1\r\n.*" "Power6 disassembly dmul" -+gdb_test "disass func" ":\tdmulq *f1,f2,f1\r\n.*" "Power6 disassembly dmulq" -+gdb_test "disass func" ":\tddiv *f1,f2,f1\r\n.*" "Power6 disassembly ddiv" -+gdb_test "disass func" ":\tddivq *f1,f2,f1\r\n.*" "Power6 disassembly ddivq" -+gdb_test "disass func" ":\tdcmpu *cr1,f2,f1\r\n.*" "Power6 disassembly dcmpu" -+gdb_test "disass func" ":\tdcmpuq *cr1,f2,f1\r\n.*" "Power6 disassembly dcmpuq" ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.arch/powerpc-power6.s 25 Feb 2007 18:27:39 -0000 -@@ -0,0 +1,16 @@ -+ .text -+ .globl func -+func: -+ blr -+ .long 0x7c284fec /* dcbzl r8,r9 */ -+ .long 0xed405834 /* frsqrtes f10,f11 */ -+ .long 0xec220804 /* dadd f1,f2,f1 */ -+ .long 0xfc220804 /* daddq f1,f2,f1 */ -+ .long 0xec220c04 /* dsub f1,f2,f1 */ -+ .long 0xfc220c04 /* dsubq f1,f2,f1 */ -+ .long 0xec220844 /* dmul f1,f2,f1 */ -+ .long 0xfc220844 /* dmulq f1,f2,f1 */ -+ .long 0xec220c44 /* ddiv f1,f2,f1 */ -+ .long 0xfc220c44 /* ddivq f1,f2,f1 */ -+ .long 0xec820d04 /* dcmpu cr1,f2,f1 */ -+ .long 0xfc820d04 /* dcmpuq cr1,f2,f1 */ diff --git a/gdb-6.6-bz235197-fork-detach-info.patch b/gdb-6.6-bz235197-fork-detach-info.patch deleted file mode 100644 index d7263ff..0000000 --- a/gdb-6.6-bz235197-fork-detach-info.patch +++ /dev/null @@ -1,121 +0,0 @@ -2008-03-01 Jan Kratochvil - - 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@prep.ai.mit.edu */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+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-bz237572-ppc-atomic-sequence-test.patch b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch deleted file mode 100644 index 928c7fb..0000000 --- a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +++ /dev/null @@ -1,270 +0,0 @@ -2007-06-25 Jan Kratochvil - - * gdb.threads/atomic-seq-threaded.c, - gdb.threads/atomic-seq-threaded.exp: New files. - -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/atomic-seq-threaded.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/atomic-seq-threaded.c 2008-12-08 22:27:01.000000000 +0100 -@@ -0,0 +1,171 @@ -+/* 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., 51 Franklin Street, Fifth Floor, Boston, -+ MA 02110-1301, USA. */ -+ -+/* Test stepping over RISC atomic sequences. -+ This variant testcases the code for stepping another thread while skipping -+ over the atomic sequence in the former thread -+ (STEPPING_PAST_SINGLESTEP_BREAKPOINT). -+ Code comes from gcc/testsuite/gcc.dg/sync-2.c */ -+ -+/* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ -+/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */ -+ -+/* Test functionality of the intrinsics for 'short' and 'char'. */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define LOOPS 2 -+ -+static int unused; -+ -+static char AI[18]; -+static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 }; -+static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 }; -+ -+static void -+do_qi (void) -+{ -+ if (__sync_fetch_and_add(AI+4, 1) != 0) -+ abort (); -+ if (__sync_fetch_and_add(AI+5, 4) != 0) -+ abort (); -+ if (__sync_fetch_and_add(AI+6, 22) != 0) -+ abort (); -+ if (__sync_fetch_and_sub(AI+7, 12) != 0) -+ abort (); -+ if (__sync_fetch_and_and(AI+8, 7) != (char)-1) -+ abort (); -+ if (__sync_fetch_and_or(AI+9, 8) != 0) -+ abort (); -+ if (__sync_fetch_and_xor(AI+10, 9) != 0) -+ abort (); -+ if (__sync_fetch_and_nand(AI+11, 7) != 0) -+ abort (); -+ -+ if (__sync_add_and_fetch(AI+12, 1) != 1) -+ abort (); -+ if (__sync_sub_and_fetch(AI+13, 12) != (char)-12) -+ abort (); -+ if (__sync_and_and_fetch(AI+14, 7) != 7) -+ abort (); -+ if (__sync_or_and_fetch(AI+15, 8) != 8) -+ abort (); -+ if (__sync_xor_and_fetch(AI+16, 9) != 9) -+ abort (); -+ if (__sync_nand_and_fetch(AI+17, 7) != 7) -+ abort (); -+} -+ -+static short AL[18]; -+static short init_hi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 }; -+static short test_hi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 }; -+ -+static void -+do_hi (void) -+{ -+ if (__sync_fetch_and_add(AL+4, 1) != 0) -+ abort (); -+ if (__sync_fetch_and_add(AL+5, 4) != 0) -+ abort (); -+ if (__sync_fetch_and_add(AL+6, 22) != 0) -+ abort (); -+ if (__sync_fetch_and_sub(AL+7, 12) != 0) -+ abort (); -+ if (__sync_fetch_and_and(AL+8, 7) != -1) -+ abort (); -+ if (__sync_fetch_and_or(AL+9, 8) != 0) -+ abort (); -+ if (__sync_fetch_and_xor(AL+10, 9) != 0) -+ abort (); -+ if (__sync_fetch_and_nand(AL+11, 7) != 0) -+ abort (); -+ -+ if (__sync_add_and_fetch(AL+12, 1) != 1) -+ abort (); -+ if (__sync_sub_and_fetch(AL+13, 12) != -12) -+ abort (); -+ if (__sync_and_and_fetch(AL+14, 7) != 7) -+ abort (); -+ if (__sync_or_and_fetch(AL+15, 8) != 8) -+ abort (); -+ if (__sync_xor_and_fetch(AL+16, 9) != 9) -+ abort (); -+ if (__sync_nand_and_fetch(AL+17, 7) != 7) -+ abort (); -+} -+ -+static void * -+start1 (void *arg) -+{ -+ unsigned loop; -+ sleep(1); -+ -+ for (loop = 0; loop < LOOPS; loop++) -+ { -+ memcpy(AI, init_qi, sizeof(init_qi)); -+ -+ do_qi (); -+ -+ if (memcmp (AI, test_qi, sizeof(test_qi))) -+ abort (); -+ } -+ -+ return arg; /* _delete1_ */ -+} -+ -+static void * -+start2 (void *arg) -+{ -+ unsigned loop; -+ -+ for (loop = 0; loop < LOOPS; loop++) -+ { -+ memcpy(AL, init_hi, sizeof(init_hi)); -+ -+ do_hi (); -+ -+ if (memcmp (AL, test_hi, sizeof(test_hi))) -+ abort (); -+ } -+ -+ return arg; /* _delete2_ */ -+} -+ -+int -+main (int argc, char **argv) -+{ -+ pthread_t thread; -+ int i; -+ -+ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */ -+ assert (i == 0); /* _create_after_ */ -+ -+ sleep (1); -+ -+ start2 (NULL); -+ -+ i = pthread_join (thread, NULL); /* _delete_ */ -+ assert (i == 0); -+ -+ return 0; /* _exit_ */ -+} -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp 2008-12-08 22:31:01.000000000 +0100 -@@ -0,0 +1,84 @@ -+# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs. -+# This variant testcases the code for stepping another thread while skipping -+# over the atomic sequence in the former thread -+# (STEPPING_PAST_SINGLESTEP_BREAKPOINT). -+# Copyright (C) 2007 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+set testfile atomic-seq-threaded -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+foreach opts {{} {compiler=gcc4} {FAIL}} { -+ if {$opts eq "FAIL"} { -+ return -1 -+ } -+ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $opts]] eq "" } { -+ break -+ } -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+gdb_load ${binfile} -+if ![runto_main] then { -+ fail "Can't run to main" -+ return 0 -+} -+ -+# pthread_create () will not pass even on x86_64 with software watchpoint. -+# Pass after pthread_create () without any watchpoint active. -+set line [gdb_get_line_number "_create_after_"] -+gdb_test "tbreak $line" \ -+ "reakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \ -+ "set breakpoint after pthread_create ()" -+gdb_test "c" \ -+ ".*/\\* _create_after_ \\*/.*" \ -+ "run till after pthread_create ()" -+ -+# Without a watchpoint being software no single-stepping would be used. -+set test "Start (software) watchpoint" -+gdb_test_multiple "watch unused" $test { -+ -re "Watchpoint \[0-9\]+: unused.*$gdb_prompt $" { -+ pass $test -+ } -+ -re "Hardware watchpoint \[0-9\]+: unused.*$gdb_prompt $" { -+ # We do not test the goal but still the whole testcase should pass. -+ unsupported $test -+ } -+} -+ -+# More thorough testing of the scheduling logic. -+gdb_test "set scheduler-locking step" "" -+ -+# Critical code path is stepped through at this point. -+set line [gdb_get_line_number "_exit_"] -+gdb_test "tbreak $line" \ -+ "reakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \ -+ "set breakpoint at _exit_" -+gdb_test "c" \ -+ ".*/\\* _exit_ \\*/.*" \ -+ "run till _exit_" -+ -+# Just a nonproblematic program exit. -+gdb_test "c" \ -+ ".*Program exited normally\\..*" \ -+ "run till program exit" diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch deleted file mode 100644 index bfc8e96..0000000 --- a/gdb-6.6-scheduler_locking-step-is-default.patch +++ /dev/null @@ -1,76 +0,0 @@ -Index: gdb-7.4.50.20120703/gdb/infrun.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/infrun.c 2012-07-03 20:26:25.060940765 +0200 -+++ gdb-7.4.50.20120703/gdb/infrun.c 2012-07-03 20:26:32.808929860 +0200 -@@ -1591,7 +1591,7 @@ static const char *const 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.4.50.20120703/gdb/testsuite/gdb.mi/mi-console.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-console.exp 2012-07-03 20:26:25.060940765 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-console.exp 2012-07-03 20:26:32.809929858 +0200 -@@ -46,6 +46,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.4.50.20120703/gdb/testsuite/gdb.mi/mi2-console.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi2-console.exp 2012-07-03 20:26:25.060940765 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi2-console.exp 2012-07-03 20:26:32.809929858 +0200 -@@ -46,6 +46,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.4.50.20120703/gdb/testsuite/gdb.mi/mi-cli.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2012-07-03 20:26:25.060940765 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-cli.exp 2012-07-03 20:26:32.810929856 +0200 -@@ -175,7 +175,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} { -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-logging.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-logging.exp 2012-06-29 00:11:23.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-logging.exp 2012-07-03 20:29:03.573717651 +0200 -@@ -56,7 +56,7 @@ close $chan - - set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+" - --if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { -+if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { - pass "Log file contents" - } else { - fail "Log file contents" -@@ -79,7 +79,7 @@ set chan [open $milogfile] - set logcontent [read $chan] - close $chan - --if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { -+if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { - pass "Redirect log file contents" - } else { - fail "Redirect log file contents" diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch deleted file mode 100644 index 36b10a5..0000000 --- a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +++ /dev/null @@ -1,204 +0,0 @@ -2007-06-25 Jan Kratochvil - - * 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 - - * 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 - - Port to GDB-6.8pre. - -Index: gdb-7.4.50.20120714/gdb/inferior.h -=================================================================== ---- gdb-7.4.50.20120714.orig/gdb/inferior.h 2012-06-13 20:15:05.000000000 +0200 -+++ gdb-7.4.50.20120714/gdb/inferior.h 2012-07-14 23:21:01.795161794 +0200 -@@ -159,7 +159,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 gdb_signal); -+enum resume_step -+ { -+ /* currently_stepping () should return non-zero for non-continue. */ -+ RESUME_STEP_CONTINUE = 0, -+ RESUME_STEP_USER, /* Stepping is intentional by the user. */ -+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */ -+ }; -+ -+extern void resume (enum resume_step, enum gdb_signal); - - extern ptid_t user_visible_resume_ptid (int step); - -Index: gdb-7.4.50.20120714/gdb/infrun.c -=================================================================== ---- gdb-7.4.50.20120714.orig/gdb/infrun.c 2012-07-01 12:37:04.000000000 +0200 -+++ gdb-7.4.50.20120714/gdb/infrun.c 2012-07-14 23:21:01.800161767 +0200 -@@ -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); -@@ -1672,7 +1672,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; -@@ -1690,7 +1691,7 @@ user_visible_resume_ptid (int step) - STEP nonzero if we should step (zero to continue instead). - SIG is the signal to give the inferior (zero for none). */ - void --resume (int step, enum gdb_signal sig) -+resume (enum resume_step step, enum gdb_signal sig) - { - int should_resume = 1; - struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); -@@ -1723,9 +1724,13 @@ resume (int step, enum gdb_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)); - -@@ -2102,7 +2107,7 @@ proceed (CORE_ADDR addr, enum gdb_signal - 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 -@@ -2142,13 +2147,13 @@ proceed (CORE_ADDR addr, enum gdb_signal - 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 - { -@@ -2179,13 +2184,13 @@ proceed (CORE_ADDR addr, enum gdb_signal - 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 -@@ -2272,8 +2277,13 @@ proceed (CORE_ADDR addr, enum gdb_signal - /* 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. */ -@@ -5205,13 +5215,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.20120714/gdb/linux-nat.c -=================================================================== ---- gdb-7.4.50.20120714.orig/gdb/linux-nat.c 2012-07-07 14:13:56.000000000 +0200 -+++ gdb-7.4.50.20120714/gdb/linux-nat.c 2012-07-14 23:21:01.803161750 +0200 -@@ -2982,7 +2982,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.20120714/gdb/linux-nat.h -=================================================================== ---- gdb-7.4.50.20120714.orig/gdb/linux-nat.h 2012-07-06 18:52:20.000000000 +0200 -+++ gdb-7.4.50.20120714/gdb/linux-nat.h 2012-07-14 23:21:17.414075355 +0200 -@@ -73,8 +73,8 @@ struct lwp_info - /* If non-zero, a pending wait status. */ - int status; - -- /* Non-zero if we were stepping this LWP. */ -- int step; -+ /* The kind of stepping of this LWP. */ -+ enum resume_step step; - - /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data - watchpoint trap. */ diff --git a/gdb-6.6-testsuite-timeouts.patch b/gdb-6.6-testsuite-timeouts.patch deleted file mode 100644 index 00f5d85..0000000 --- a/gdb-6.6-testsuite-timeouts.patch +++ /dev/null @@ -1,26 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota1.exp 2012-03-16 17:47:33.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp 2012-06-02 18:27:46.623210711 +0200 -@@ -45,6 +45,8 @@ gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - -+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions" -+ - # The commands we test here produce many lines of output; disable "press - # to continue" prompts. - gdb_test_no_output "set height 0" -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota3.exp 2012-02-28 23:40:48.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp 2012-06-02 18:28:00.375206457 +0200 -@@ -45,6 +45,8 @@ gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - -+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions" -+ - # The commands we test here produce many lines of output; disable "press - # to continue" prompts. - gdb_test_no_output "set height 0" diff --git a/gdb-6.6-threads-static-test.patch b/gdb-6.6-threads-static-test.patch deleted file mode 100644 index 3f8d16e..0000000 --- a/gdb-6.6-threads-static-test.patch +++ /dev/null @@ -1,18 +0,0 @@ -Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/staticthreads.exp -=================================================================== ---- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.threads/staticthreads.exp 2011-12-19 21:07:01.436475201 +0100 -+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/staticthreads.exp 2011-12-19 22:08:55.444514127 +0100 -@@ -45,6 +45,13 @@ gdb_test_no_output "set print sevenbit-s - # See if the static multi-threaded program runs. - - runto_main -+ -+# See if we get excessive LWP there (patched glibc with unpatched GDB): -+# * 2 Thread 135661664 (LWP 3856) main () at threadloop.c:41 -+# 1 process 3856 main () at threadloop.c:41 -+ -+gdb_test "info threads" "^info threads\r\n\[ \t\]*Id\[ \t\]+Target Id\[ \t\]+Frame\[ \t\]*\r\n\[^\r\n\]* Thread \[^\r\n\]*" "info threads on start" -+ - gdb_test "break sem_post" - set test "Continue to main's call of sem_post" - gdb_test_multiple "continue" "$test" { diff --git a/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch b/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch deleted file mode 100644 index 9dc8a7b..0000000 --- a/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch +++ /dev/null @@ -1,703 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html - -2007-12-22 Jan Kratochvil - - * gdb.arch/i386-interface.S, gdb.arch/i386-interface.exp: New files. - -2008-03-02 Jan Kratochvil - - * gdb.arch/i386-interface.exp: Fix a testcase race. - ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.arch/i386-interface.S 22 Dec 2007 19:07:28 -0000 -@@ -0,0 +1,628 @@ -+/* 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 . -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@gnu.org -+ -+ This file is part of the gdb testsuite. -+ -+ This file was produced by: -+ $ gcj -S interface.java -ggdb2 -Wall -m32 -+ from the .java file: -+ interface Interface -+ { -+ } -+ class Class implements Interface -+ { -+ } -+*/ -+ -+ .file "cc28Pp2B.jar" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+ .local _MT_Interface -+ .comm _MT_Interface,0,4 -+ .data -+ .align 4 -+ .type _catch_classes_Interface, @object -+ .size _catch_classes_Interface, 24 -+_catch_classes_Interface: -+ .zero 24 -+ .section .rodata -+ .align 2 -+ .type _Utf1, @object -+ .size _Utf1, 4 -+_Utf1: -+ .value 36121 -+ .value 9 -+ .ascii "Interface" -+ .zero 1 -+.globl _ZN9Interface6class$E -+ .data -+ .align 32 -+ .type _ZN9Interface6class$E, @object -+ .size _ZN9Interface6class$E, 144 -+_ZN9Interface6class$E: -+ .long _ZTVN4java4lang5ClassE+8 -+ .long 403000 -+ .long _Utf1 -+ .value 1536 -+ .zero 2 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long _MT_Interface -+ .value 0 -+ .value 6 -+ .long 0 -+ .long 4 -+ .value 0 -+ .value 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long _catch_classes_Interface -+ .long 0 -+ .long 0 -+ .value 0 -+ .byte 1 -+ .zero 1 -+ .long 0 -+ .value 0 -+ .zero 2 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .hidden _ZN9Interface7class$$E -+.globl _ZN9Interface7class$$E -+ .section .rodata -+ .align 4 -+ .type _ZN9Interface7class$$E, @object -+ .size _ZN9Interface7class$$E, 4 -+_ZN9Interface7class$$E: -+ .long _ZN9Interface6class$E -+ .text -+ .align 2 -+.globl _ZN5ClassC1Ev -+ .type _ZN5ClassC1Ev, @function -+_ZN5ClassC1Ev: -+.LFB2: -+ pushl %ebp -+.LCFI0: -+ movl %esp, %ebp -+.LCFI1: -+ subl $24, %esp -+.LCFI2: -+.LBB2: -+#if 0 -+ .file 1 "interface.java" -+#else -+ .file "interface.java" -+#endif -+ .loc 1 4 0 -+ movl 8(%ebp), %eax -+ movl %eax, -4(%ebp) -+ movl -4(%ebp), %eax -+ movl %eax, (%esp) -+ call _ZN4java4lang6ObjectC1Ev -+.LBE2: -+ leave -+ ret -+.LFE2: -+ .size _ZN5ClassC1Ev, .-_ZN5ClassC1Ev -+ .hidden _ZTVN5ClassE -+.globl _ZTVN5ClassE -+ .data -+ .align 32 -+ .type _ZTVN5ClassE, @object -+ .size _ZTVN5ClassE, 40 -+_ZTVN5ClassE: -+ .long 0 -+ .long 0 -+ .long _ZN5Class6class$E -+ .long 4 -+ .long _ZN4java4lang6Object8finalizeEJvv -+ .long _ZN4java4lang6Object8hashCodeEJiv -+ .long _ZN4java4lang6Object6equalsEJbPS1_ -+ .long _ZN4java4lang6Object8toStringEJPNS0_6StringEv -+ .long _ZN4java4lang6Object5cloneEJPS1_v -+ .long _ZN4java4lang6Object22throwNoSuchMethodErrorEJvv -+ .set .L_ZN5ClassC1Ev0,_ZN5ClassC1Ev -+ .section .rodata -+ .align 2 -+ .type _Utf2, @object -+ .size _Utf2, 4 -+_Utf2: -+ .value 626 -+ .value 6 -+ .ascii "" -+ .zero 1 -+ .align 2 -+ .type _Utf3, @object -+ .size _Utf3, 4 -+_Utf3: -+ .value 39797 -+ .value 3 -+ .ascii "()V" -+ .zero 1 -+ .data -+ .align 4 -+ .type _MT_Class, @object -+ .size _MT_Class, 20 -+_MT_Class: -+ .long _Utf2 -+ .long _Utf3 -+ .value 16384 -+ .value -1 -+ .long .L_ZN5ClassC1Ev0 -+ .long 0 -+ .align 4 -+ .type _IF_Class, @object -+ .size _IF_Class, 4 -+_IF_Class: -+ .long _ZN9Interface6class$E -+ .align 4 -+ .type _catch_classes_Class, @object -+ .size _catch_classes_Class, 24 -+_catch_classes_Class: -+ .zero 24 -+ .section .rodata -+ .align 2 -+ .type _Utf4, @object -+ .size _Utf4, 4 -+_Utf4: -+ .value 47448 -+ .value 5 -+ .ascii "Class" -+ .zero 1 -+.globl _ZN5Class6class$E -+ .data -+ .align 32 -+ .type _ZN5Class6class$E, @object -+ .size _ZN5Class6class$E, 144 -+_ZN5Class6class$E: -+ .long _ZTVN4java4lang5ClassE+8 -+ .long 403000 -+ .long _Utf4 -+ .value 32 -+ .zero 2 -+ .long _ZN4java4lang6Object6class$E -+ .long 0 -+ .long 0 -+ .long 0 -+ .long _MT_Class -+ .value 1 -+ .value 6 -+ .long 0 -+ .long 4 -+ .value 0 -+ .value 0 -+ .long _ZTVN5ClassE+8 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long _catch_classes_Class -+ .long _IF_Class -+ .long 0 -+ .value 1 -+ .byte 1 -+ .zero 1 -+ .long 0 -+ .value 0 -+ .zero 2 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .long 0 -+ .hidden _ZN5Class7class$$E -+.globl _ZN5Class7class$$E -+ .section .rodata -+ .align 4 -+ .type _ZN5Class7class$$E, @object -+ .size _ZN5Class7class$$E, 4 -+_ZN5Class7class$$E: -+ .long _ZN5Class6class$E -+ .section .jcr,"aw",@progbits -+ .align 4 -+ .long _ZN9Interface6class$E -+ .long _ZN5Class6class$E -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 -+.LSCIE0: -+ .long 0xffffffff -+ .byte 0x1 -+ .string "" -+ .uleb128 0x1 -+ .sleb128 -4 -+ .byte 0x8 -+ .byte 0xc -+ .uleb128 0x4 -+ .uleb128 0x4 -+ .byte 0x88 -+ .uleb128 0x1 -+ .align 4 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 -+.LASFDE0: -+ .long .Lframe0 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x8 -+ .byte 0x85 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x5 -+ .align 4 -+.LEFDE0: -+ .section .eh_frame,"a",@progbits -+.Lframe1: -+ .long .LECIE1-.LSCIE1 -+.LSCIE1: -+ .long 0x0 -+ .byte 0x1 -+.globl __gcj_personality_v0 -+ .string "zP" -+ .uleb128 0x1 -+ .sleb128 -4 -+ .byte 0x8 -+ .uleb128 0x5 -+ .byte 0x0 -+ .long __gcj_personality_v0 -+ .byte 0xc -+ .uleb128 0x4 -+ .uleb128 0x4 -+ .byte 0x88 -+ .uleb128 0x1 -+ .align 4 -+.LECIE1: -+.LSFDE1: -+ .long .LEFDE1-.LASFDE1 -+.LASFDE1: -+ .long .LASFDE1-.Lframe1 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .uleb128 0x0 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x8 -+ .byte 0x85 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x5 -+ .align 4 -+.LEFDE1: -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .long .LFB2-.Ltext0 -+ .long .LCFI0-.Ltext0 -+ .value 0x2 -+ .byte 0x74 -+ .sleb128 4 -+ .long .LCFI0-.Ltext0 -+ .long .LCFI1-.Ltext0 -+ .value 0x2 -+ .byte 0x74 -+ .sleb128 8 -+ .long .LCFI1-.Ltext0 -+ .long .LFE2-.Ltext0 -+ .value 0x2 -+ .byte 0x75 -+ .sleb128 8 -+ .long 0x0 -+ .long 0x0 -+ .section .debug_info -+ .long 0x117 -+ .value 0x2 -+ .long .Ldebug_abbrev0 -+ .byte 0x4 -+ .uleb128 0x1 -+ .string "GNU Java 4.3.0 20071221 (experimental)" -+ .byte 0xb -+ .string "interface.java" -+ .string "/home/jkratoch/redhat/bz371831" -+ .long .Ltext0 -+ .long .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .string "Interface" -+ .byte 0x4 -+ .byte 0x1 -+ .byte 0x0 -+ .long 0x8e -+ .long 0x8e -+ .uleb128 0x3 -+ .long 0x8e -+ .byte 0x2 -+ .byte 0x23 -+ .uleb128 0x0 -+ .byte 0x1 -+ .byte 0x0 -+ .uleb128 0x4 -+ .string "java.lang.Object" -+ .byte 0x1 -+ .uleb128 0x5 -+ .string "Class" -+ .byte 0x4 -+ .byte 0x1 -+ .byte 0x0 -+ .long 0x8e -+ .long 0xe8 -+ .uleb128 0x3 -+ .long 0x8e -+ .byte 0x2 -+ .byte 0x23 -+ .uleb128 0x0 -+ .byte 0x1 -+ .uleb128 0x6 -+ .long 0x6e -+ .byte 0x2 -+ .byte 0x23 -+ .uleb128 0x0 -+ .byte 0x1 -+ .byte 0x1 -+ .uleb128 0x7 -+ .byte 0x1 -+ .string "" -+ .byte 0x1 -+ .byte 0x0 -+ .string "_ZN5ClassC1Ev" -+ .byte 0x1 -+ .uleb128 0x8 -+ .long 0xe8 -+ .byte 0x1 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 -+ .byte 0x4 -+ .long 0xa1 -+ .uleb128 0xa -+ .long 0xc6 -+ .long .LFB2 -+ .long .LFE2 -+ .long .LLST0 -+ .long 0x114 -+ .uleb128 0xb -+ .long 0xe8 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 0 -+ .uleb128 0xc -+ .long 0x114 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -12 -+ .byte 0x0 -+ .uleb128 0x9 -+ .byte 0x4 -+ .long 0x8e -+ .byte 0x0 -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0x8 -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x1b -+ .uleb128 0x8 -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x38 -+ .byte 0x1 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x1d -+ .uleb128 0x13 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x1c -+ .byte 0x0 -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x38 -+ .uleb128 0xa -+ .uleb128 0x32 -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 -+ .uleb128 0x2 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3c -+ .uleb128 0xc -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x2 -+ .byte 0x1 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x1d -+ .uleb128 0x13 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0x1c -+ .byte 0x0 -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x38 -+ .uleb128 0xa -+ .uleb128 0x4c -+ .uleb128 0xb -+ .uleb128 0x32 -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x2007 -+ .uleb128 0x8 -+ .uleb128 0x3c -+ .uleb128 0xc -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x8 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x34 -+ .uleb128 0xc -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 -+ .uleb128 0xf -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xa -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x47 -+ .uleb128 0x13 -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0x6 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xc -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x15 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0x11b -+ .long 0xee -+ .string "()" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x1c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x4 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .long .Ltext0 -+ .long .Letext0-.Ltext0 -+ .long 0x0 -+ .long 0x0 -+ .ident "GCC: (GNU) 4.3.0 20071221 (experimental)" -+ .section .note.GNU-stack,"",@progbits ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.arch/i386-interface.exp 22 Dec 2007 19:07:28 -0000 -@@ -0,0 +1,59 @@ -+# 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 . -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@gnu.org -+ -+# This file is part of the gdb testsuite. -+ -+# Test basis recognization of DW_TAG_interface_type. -+# GCC java_classify_record() produces it if returns RECORD_IS_INTERFACE. -+ -+if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} then { -+ verbose "Skipping i386 Java DW_TAG_interface_type test." -+ return -+} -+ -+set testfile "i386-interface" -+set srcfile ${testfile}.S -+set binfile ${objdir}/${subdir}/${testfile}.o -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug additional_flags=-m32}] != "" } { -+ untested i386-gnu-cfi.exp -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+gdb_test "set language java" -+ -+set test "ptype Interface" -+gdb_test_multiple $test $test { -+ -re "type = class Interface *extends java.lang.Object \{.*$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+set test "ptype Class" -+gdb_test_multiple $test $test { -+ -re "type = class Class *extends java.lang.Object implements Interface \{.*$gdb_prompt $" { -+ pass $test -+ } -+} diff --git a/gdb-6.7-charsign-test.patch b/gdb-6.7-charsign-test.patch deleted file mode 100644 index 793ff8a..0000000 --- a/gdb-6.7-charsign-test.patch +++ /dev/null @@ -1,118 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128 - -2007-01-25 Jan Kratochvil - - * gdb.base/charsign.exp, gdb.base/charsign.c: New files. - [ stripped ] - -2007-10-19 Jan Kratochvil - - Port to GDB-6.7 - only the testcase left, patch has been reverted, - char-vectors restricted. - ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/charsign.c 26 Jan 2007 10:32:00 -0000 -@@ -0,0 +1,37 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2007 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+int main() -+{ -+ return 0; -+} -+ -+char n[]="A"; -+signed char s[]="A"; -+unsigned char u[]="A"; -+ -+typedef char char_n; -+typedef signed char char_s; -+typedef unsigned char char_u; -+ -+char_n n_typed[]="A"; -+char_s s_typed[]="A"; -+char_u u_typed[]="A"; ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/charsign.exp 26 Jan 2007 10:32:00 -0000 -@@ -0,0 +1,63 @@ -+# 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 charsign -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+proc do_test { cflags } { -+ global srcdir -+ global binfile -+ global subdir -+ global srcfile -+ global gdb_prompt -+ -+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$cflags]] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+ } -+ -+ # Get things started. -+ -+ gdb_exit -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ gdb_load ${binfile} -+ -+ # For C programs, "start" should stop in main(). -+ -+ gdb_test "p n" \ -+ "= \"A\"" -+ gdb_test "p s" \ -+ "= \\{65 'A', 0 '\\\\0'\\}" -+ gdb_test "p u" \ -+ "= \\{65 'A', 0 '\\\\0'\\}" -+ gdb_test "p n_typed" \ -+ "= \"A\"" -+ gdb_test "p s_typed" \ -+ "= \\{65 'A', 0 '\\\\0'\\}" -+ gdb_test "p u_typed" \ -+ "= \\{65 'A', 0 '\\\\0'\\}" -+} -+ -+# The string identification works despite the compiler flags below due to -+# gdbtypes.c: -+# if (name && strcmp (name, "char") == 0) -+# TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN; -+ -+do_test {} -+do_test {-fsigned-char} -+do_test {-funsigned-char} diff --git a/gdb-6.7-ppc-clobbered-registers-O2-test.patch b/gdb-6.7-ppc-clobbered-registers-O2-test.patch deleted file mode 100644 index 761d10f..0000000 --- a/gdb-6.7-ppc-clobbered-registers-O2-test.patch +++ /dev/null @@ -1,96 +0,0 @@ -2007-11-04 Jan Kratochvil - - * gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to - `powerpc*'. - -Testcase for: - -http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html - -2007-10-21 Luis Machado - - * rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function. - * (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as - default dwarf2_frame_set_init_reg function. - ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c 3 Nov 2007 22:22:28 -0000 -@@ -0,0 +1,21 @@ -+ -+unsigned * __attribute__((noinline)) -+start_sequence (unsigned * x, unsigned * y) -+{ -+ return (unsigned *)0xdeadbeef; -+}; -+ -+unsigned __attribute__((noinline)) -+gen_movsd (unsigned * operand0, unsigned * operand1) -+{ -+ return *start_sequence(operand0, operand1); -+} -+ -+int main(void) -+{ -+ unsigned x, y; -+ -+ x = 13; -+ y = 14; -+ return (int)gen_movsd (&x, &y); -+} ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp 3 Nov 2007 22:22:28 -0000 -@@ -0,0 +1,54 @@ -+# 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. -+# -+# This file is part of the gdb testsuite. -+ -+# Test displaying call clobbered registers in optimized binaries for ppc. -+# GDB should not show incorrect values. -+ -+if ![istarget "powerpc*-*"] then { -+ verbose "Skipping powerpc* call clobbered registers testing." -+ return -+} -+ -+set testfile "ppc-clobbered-registers-O2" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set compile_flags "debug additional_flags=-O2" -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } { -+ unsupported "Testcase compile failed." -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ perror "Couldn't run to breakpoint" -+ continue -+} -+ -+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \ -+ "Insert breakpoint at problematic function" -+ -+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \ -+ "Run until problematic function" -+ -+gdb_test backtrace ".*operand0=.*operand1=.*" \ -+ "Check value of call clobbered registers" diff --git a/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch deleted file mode 100644 index 7e2fb39..0000000 --- a/gdb-6.7-testsuite-stable-results.patch +++ /dev/null @@ -1,108 +0,0 @@ -gdb/testsuite/gdb.base/fileio.c: -gdb/testsuite/gdb.base/fileio.exp: -2007-12-08 Jan Kratochvil - - * gdb.base/fileio.c (ROOTSUBDIR): New macro. - (main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into - ROOTSUBDIR if we are being run as root. - * gdb.base/fileio.exp: Change the startup and finish cleanup. - Change the test file reference to be into the `fileio.dir' directory. - - -sources/gdb/testsuite/gdb.base/dump.exp: -Found on RHEL-5.s390x. - - -gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp: -random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore - - -gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp: -frames-invalid can happen asynchronously. - -Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c -=================================================================== ---- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200 -+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c 2012-01-03 15:21:28.122729249 +0100 -@@ -58,6 +58,8 @@ system (const char * string); - 1) Invalid string/command. - returns 127. */ - static const char *strerrno (int err); - -+#define ROOTSUBDIR "fileio.dir" -+ - #define FILENAME "foo.fileio.test" - #define RENAMED "bar.fileio.test" - #define NONEXISTANT "nofoo.fileio.test" -@@ -542,6 +544,37 @@ strerrno (int err) - int - main () - { -+ /* ROOTSUBDIR is already prepared by fileio.exp. We use it for easy cleanup -+ (by fileio.exp) if we are run by multiple users in the same directory. */ -+ -+ if (chdir (ROOTSUBDIR) != 0) -+ { -+ printf ("chdir " ROOTSUBDIR ": %s\n", strerror (errno)); -+ exit (1); -+ } -+ -+ /* These tests -+ Open for write but no write permission returns EACCES -+ Unlinking a file in a directory w/o write access returns EACCES -+ fail if we are being run as root - drop the privileges here. */ -+ -+ if (geteuid () == 0) -+ { -+ uid_t uid = 99; -+ -+ if (chown (".", uid, uid) != 0) -+ { -+ printf ("chown %d.%d " ROOTSUBDIR ": %s\n", (int) uid, (int) uid, -+ strerror (errno)); -+ exit (1); -+ } -+ if (setuid (uid) || geteuid () == 0) -+ { -+ printf ("setuid %d: %s\n", (int) uid, strerror (errno)); -+ exit (1); -+ } -+ } -+ - /* Don't change the order of the calls. They partly depend on each other */ - test_open (); - test_write (); -Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp -=================================================================== ---- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.exp 2011-12-26 12:24:55.000000000 +0100 -+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp 2012-01-03 15:22:02.716601956 +0100 -@@ -42,8 +42,8 @@ if [get_compiler_info ${binfile}] { - return -1; - } - --remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test} --remote_exec build {sh -xc rm\ -rf\ *.fileio.test} -+remote_exec build {sh -xc rm\ -rf\ fileio.dir} -+remote_exec build {sh -xc mkdir\ -m777\ fileio.dir} - - set oldtimeout $timeout - set timeout [expr "$timeout + 60"] -@@ -85,7 +85,7 @@ gdb_test continue \ - - gdb_test "continue" ".*" "" - --catch "system \"chmod -f -w nowrt.fileio.test\"" -+catch "system \"chmod -f -w fileio.dir/nowrt.fileio.test\"" - - gdb_test continue \ - "Continuing\\..*open 5:.*EACCES$stop_msg" \ -@@ -251,8 +251,8 @@ gdb_exit - # Wait till GDB really exits. - sleep 1 - --remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test} --remote_exec build {sh -xc rm\ -rf\ *.fileio.test} -+remote_exec build {sh -xc test\ -r\ fileio.dir/dir2.fileio.test\ &&\ chmod\ -f\ +w\ fileio.dir/dir2.fileio.test} -+remote_exec build {sh -xc rm\ -rf\ fileio.dir} - - set timeout $oldtimeout - return 0 diff --git a/gdb-6.8-attach-signalled-detach-stopped.patch b/gdb-6.8-attach-signalled-detach-stopped.patch deleted file mode 100644 index 13966f2..0000000 --- a/gdb-6.8-attach-signalled-detach-stopped.patch +++ /dev/null @@ -1,152 +0,0 @@ -Index: gdb-7.4.50.20120703/gdb/linux-nat.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/linux-nat.c 2012-07-03 17:46:55.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/linux-nat.c 2012-07-03 17:57:29.608734933 +0200 -@@ -180,6 +180,9 @@ blocked. */ - static struct target_ops *linux_ops; - static struct target_ops linux_ops_saved; - -+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */ -+static pid_t pid_was_stopped; -+ - /* The method to call, if any, when a new thread is attached. */ - static void (*linux_nat_new_thread) (struct lwp_info *); - -@@ -909,7 +912,14 @@ holding the child stopped. Try \"set de - parent_inf->waiting_for_vfork_done = 0; - } - else if (detach_fork) -- target_detach (NULL, 0); -+ { -+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly. -+ In this point of code it cannot be 1 as we would not get FORK -+ executed without CONTINUE first which resets PID_WAS_STOPPED. -+ We would have to first TARGET_STOP and WAITPID it as with running -+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */ -+ target_detach (NULL, 0); -+ } - - /* Note that the detach above makes PARENT_INF dangling. */ - -@@ -1377,6 +1387,7 @@ linux_nat_post_attach_wait (ptid_t ptid, - if (debug_linux_nat) - fprintf_unfiltered (gdb_stdlog, - "LNPAW: Attaching to a stopped process\n"); -+ pid_was_stopped = GET_PID (ptid); - - /* The process is definitely stopped. It is in a job control - stop, unless the kernel predates the TASK_STOPPED / -@@ -1805,6 +1816,9 @@ get_pending_status (struct lwp_info *lp, - gdb_signal_to_string (signo)); - } - -+ if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped) -+ *status = W_STOPCODE (SIGSTOP); -+ - return 0; - } - -@@ -1918,6 +1932,8 @@ linux_nat_detach (struct target_ops *ops - } - else - linux_ops->to_detach (ops, args, from_tty); -+ -+ pid_was_stopped = 0; - } - - /* Resume LP. */ -@@ -2104,6 +2120,14 @@ linux_nat_resume (struct target_ops *ops - linux_nat_resume_callback. */ - lp->stopped = 0; - -+ /* At this point, we are going to resume the inferior and if we -+ have attached to a stopped process, we no longer should leave -+ it as stopped if the user detaches. PTID variable has PID set to LWP -+ while we need to check the real PID here. */ -+ -+ if (!step && lp && pid_was_stopped == GET_PID (lp->ptid)) -+ pid_was_stopped = 0; -+ - if (resume_many) - iterate_over_lwps (ptid, linux_nat_resume_callback, NULL); - -@@ -4129,6 +4153,8 @@ linux_nat_mourn_inferior (struct target_ - there are other viable forks to debug. Delete the exiting - one and context-switch to the first available. */ - linux_fork_mourn_inferior (); -+ -+ pid_was_stopped = 0; - } - - /* Convert a native/host siginfo object, into/from the siginfo in the -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/attach-stopped.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2012-06-26 21:23:20.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/attach-stopped.exp 2012-07-03 17:56:43.797790120 +0200 -@@ -61,7 +61,65 @@ proc corefunc { threadtype } { - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - -- # Verify that we can attach to the stopped process. -+ # Verify that we can attach to the process by first giving its -+ # executable name via the file command, and using attach with the -+ # process ID. -+ -+ set test "$threadtype: set file, before attach1 to stopped process" -+ gdb_test_multiple "file $binfile" "$test" { -+ -re "Load new symbol table from.*y or n. $" { -+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \ -+ "$test (re-read)" -+ } -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ set test "$threadtype: attach1 to stopped, after setting file" -+ gdb_test_multiple "attach $testpid" "$test" { -+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there. -+ if {[string equal $threadtype threaded]} { -+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt" -+ } else { -+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt" -+ } -+ -+ # Exit and detach the process. -+ -+ gdb_exit -+ -+ # Avoid some race: -+ sleep 2 -+ -+ if [catch {open /proc/${testpid}/status r} fileid] { -+ set line2 "NOTFOUND" -+ } else { -+ gets $fileid line1; -+ gets $fileid line2; -+ close $fileid; -+ } -+ -+ set test "$threadtype: attach1, exit leaves process stopped" -+ if {[string match "*(stopped)*" $line2]} { -+ pass $test -+ } else { -+ fail $test -+ } -+ -+ # At this point, the process should still be stopped -+ -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ gdb_load ${binfile} -+ -+ # Verify that we can attach to the process just by giving the -+ # process ID. - - set test "$threadtype: attach2 to stopped, after setting file" - gdb_test_multiple "attach $testpid" "$test" { diff --git a/gdb-6.8-bz254229-gcore-prpsinfo.patch b/gdb-6.8-bz254229-gcore-prpsinfo.patch deleted file mode 100644 index 51071f4..0000000 --- a/gdb-6.8-bz254229-gcore-prpsinfo.patch +++ /dev/null @@ -1,280 +0,0 @@ -Index: gdb-7.4.50.20120602/bfd/elf-bfd.h -=================================================================== ---- gdb-7.4.50.20120602.orig/bfd/elf-bfd.h 2012-06-02 21:26:09.928717069 +0200 -+++ gdb-7.4.50.20120602/bfd/elf-bfd.h 2012-06-02 21:27:21.727689625 +0200 -@@ -2221,8 +2221,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find - /* Exported interface for writing elf corefile notes. */ - extern char *elfcore_write_note - (bfd *, char *, int *, const char *, int, const void *, int); -+struct elf_prpsinfo; -+typedef struct elf_prpsinfo prpsinfo_t; - extern char *elfcore_write_prpsinfo -- (bfd *, char *, int *, const char *, const char *); -+ (bfd *, char *, int *, const prpsinfo_t *); - extern char *elfcore_write_prstatus - (bfd *, char *, int *, long, int, const void *); - extern char * elfcore_write_pstatus -Index: gdb-7.4.50.20120602/bfd/elf.c -=================================================================== ---- gdb-7.4.50.20120602.orig/bfd/elf.c 2012-06-02 21:26:09.928717069 +0200 -+++ gdb-7.4.50.20120602/bfd/elf.c 2012-06-02 21:27:21.732689623 +0200 -@@ -8917,56 +8917,61 @@ char * - elfcore_write_prpsinfo (bfd *abfd, - char *buf, - int *bufsiz, -- const char *fname, -- const char *psargs) -+ const prpsinfo_t *input) - { - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (bed->elf_backend_write_core_note != NULL) - { - char *ret; -+ char fname[sizeof (input->pr_fname) + 1]; -+ char psargs[sizeof (input->pr_psargs) + 1]; -+ -+ strncpy (fname, input->pr_fname, sizeof (input->pr_fname)); -+ fname[sizeof (input->pr_fname)] = 0; -+ strncpy (psargs, input->pr_psargs, sizeof (input->pr_psargs)); -+ psargs[sizeof (input->pr_psargs)] = 0; -+ - ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz, - NT_PRPSINFO, fname, psargs); - if (ret != NULL) - return ret; - } - --#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) --#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T) -+#if defined (HAVE_PRPSINFO_T) -+#if defined (HAVE_PRPSINFO32_T) - if (bed->s->elfclass == ELFCLASS32) - { --#if defined (HAVE_PSINFO32_T) -- psinfo32_t data; -- int note_type = NT_PSINFO; --#else - prpsinfo32_t data; - int note_type = NT_PRPSINFO; --#endif - -- memset (&data, 0, sizeof (data)); -- strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); -- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); -+ data.pr_state = input->pr_state; -+ data.pr_sname = input->pr_sname; -+ data.pr_zomb = input->pr_zomb; -+ data.pr_nice = input->pr_nice; -+ data.pr_flag = input->pr_flag; -+ data.pr_uid = input->pr_uid; -+ data.pr_gid = input->pr_gid; -+ data.pr_pid = input->pr_pid; -+ data.pr_ppid = input->pr_ppid; -+ data.pr_pgrp = input->pr_pgrp; -+ data.pr_sid = input->pr_sid; -+ BFD_ASSERT (sizeof (data.pr_fname) == sizeof (input->pr_fname)); -+ memcpy (data.pr_fname, input->pr_fname, sizeof (data.pr_fname)); -+ BFD_ASSERT (sizeof (data.pr_psargs) == sizeof (input->pr_psargs)); -+ memcpy (data.pr_psargs, input->pr_psargs, sizeof (data.pr_psargs)); - return elfcore_write_note (abfd, buf, bufsiz, - "CORE", note_type, &data, sizeof (data)); - } - else - #endif - { --#if defined (HAVE_PSINFO_T) -- psinfo_t data; -- int note_type = NT_PSINFO; --#else -- prpsinfo_t data; - int note_type = NT_PRPSINFO; --#endif - -- memset (&data, 0, sizeof (data)); -- strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); -- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); - return elfcore_write_note (abfd, buf, bufsiz, -- "CORE", note_type, &data, sizeof (data)); -+ "CORE", note_type, input, sizeof (*input)); - } --#endif /* PSINFO_T or PRPSINFO_T */ -+#endif /* PRPSINFO_T */ - - free (buf); - return NULL; -Index: gdb-7.4.50.20120602/gdb/procfs.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/procfs.c 2012-06-02 21:26:09.928717069 +0200 -+++ gdb-7.4.50.20120602/gdb/procfs.c 2012-06-02 21:27:21.745689618 +0200 -@@ -5541,6 +5541,7 @@ procfs_make_note_section (bfd *obfd, int - note_data = (char *) elfcore_write_prpsinfo (obfd, - note_data, - note_size, -+ NULL, - fname, - psargs); - -Index: gdb-7.4.50.20120602/gdb/linux-tdep.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-tdep.c 2012-06-02 21:26:09.928717069 +0200 -+++ gdb-7.4.50.20120602/gdb/linux-tdep.c 2012-06-02 21:31:12.051601510 +0200 -@@ -30,6 +30,7 @@ - #include "elf-bfd.h" /* for elfcore_write_* */ - #include "inferior.h" - #include "cli/cli-utils.h" -+#include - - #include - -@@ -769,6 +770,131 @@ linux_corefile_thread_callback (struct t - return !args->note_data; - } - -+/* Should be always true for Linux */ -+#define HAVE_PRPSINFO_T 1 -+ -+#if defined (HAVE_PRPSINFO_T) -+ -+/* Fills struct elf_prpsinfo{32,64} as much as possible, imitate Linux kernel -+ binfmt_elf.c. Unknown values are filled with zeroes. The structure is -+ malloced. */ -+ -+static const prpsinfo_t * -+fill_prpsinfo (void) -+{ -+ struct stat sb; -+ char filename[sizeof ("/proc//cmdline") + sizeof (int) * 3 + 2]; -+ char buf[1024]; -+ char proc_state[5]; -+ char proc_cmdline[sizeof (((struct elf_prpsinfo*)0)->pr_psargs) + 1]; -+ unsigned flags; -+ long proc_nice; -+ unsigned proc_ppid; -+ unsigned proc_pgid; -+ unsigned proc_sid; -+ pid_t pid; -+ int fd, n; -+ char *cp, *proc_comm, *state_s; -+ /* String comes from Linux kernel binfmt_elf.c FILL_PSINFO but it is already -+ obsolete there to TASK_* constants. */ -+ const char state_string[] = "RSDTZW"; -+ int state_num; -+ static prpsinfo_t retval; -+ -+ /* Get /proc/$PID/stat. */ -+ pid = ptid_get_pid (inferior_ptid); -+ sprintf (filename, "/proc/%u/stat", (unsigned)pid); -+ fd = open (filename, O_RDONLY); -+ if (fd < 0) -+ return NULL; -+ fstat (fd, &sb); /* No error checking (can it ever happen?). */ -+ n = read (fd, buf, sizeof (buf) - 1); -+ close (fd); -+ if (n < 0) -+ return NULL; -+ buf[n] = 0; -+ -+ cp = strrchr (buf, ')'); /* Split into "PID (COMM" and "". */ -+ if (!cp) -+ return NULL; -+ *cp = 0; -+ -+ /* Grab COMM. */ -+ proc_comm = strchr (buf, '('); -+ if (!proc_comm) -+ return NULL; -+ proc_comm++; -+ -+ /* Read /proc/$PID/cmdline. */ -+ proc_cmdline[0] = 0; -+ strcpy (strrchr (filename, '/'), "/cmdline"); -+ fd = open (filename, O_RDONLY); -+ if (fd >= 0) -+ { -+ int n; -+ -+ n = read (fd, proc_cmdline, sizeof (proc_cmdline) - 1); -+ if (n < 0) -+ n = 0; -+ proc_cmdline[n] = 0; -+ while (n--) /* Replace NULs with spaces. */ -+ if (proc_cmdline[n] == 0) -+ proc_cmdline[n] = ' '; -+ close (fd); -+ } -+ -+ /* Parse /proc/$PID/stat. */ -+ n = sscanf (cp + 2, /* skip ") " */ -+ "%4s %u " /* state, ppid */ -+ "%u %u %*s %*s " /* pgid, sid, tty, tpgid */ -+ "%u %*s %*s %*s " /* flags, min_flt, cmin_flt, maj_flt */ -+ "%*s " /* cmaj_flt */ -+ "%*s %*s " /* utime, stime */ -+ "%*s %*s %*s " /* cutime, cstime, priority */ -+ "%ld " /* nice */ -+ /*"%*s %*s " timeout, it_real_value */ -+ /*"%lu " start_time */ -+ /*"%lu " vsize */ -+ /*"%lu " rss */ -+ /*"%lu %lu %lu " rss_rlim, start_code, end_code */ -+ /*"%lu %lu %lu " start_stack, kstk_esp, kstk_eip */ -+ /*"%u %u %u %u " signal, blocked, sigignore, sigcatch */ -+ /*"%lu %lu %lu" wchan, nswap, cnswap */ -+ , proc_state, &proc_ppid, -+ &proc_pgid, &proc_sid, -+ &flags, -+ &proc_nice); -+ if (n != 6) -+ return NULL; -+ -+ state_s = strchr (state_string, proc_state[0]); -+ if (state_s != NULL) -+ state_num = state_s - state_string; -+ else -+ { -+ /* 0 means Running, some more unusal state would be better. */ -+ state_num = 0; -+ } -+ -+ memset (&retval, 0, sizeof (retval)); -+ retval.pr_state = state_num; -+ retval.pr_sname = proc_state[0]; -+ retval.pr_zomb = (proc_state[0] == 'Z'); -+ retval.pr_nice = proc_nice; -+ retval.pr_flag = flags; -+ retval.pr_uid = sb.st_uid; -+ retval.pr_gid = sb.st_gid; -+ retval.pr_pid = pid; -+ retval.pr_ppid = proc_ppid; -+ retval.pr_pgrp = proc_pgid; -+ retval.pr_sid = proc_sid; -+ strncpy (retval.pr_fname, proc_comm, sizeof (retval.pr_fname)); -+ strncpy (retval.pr_psargs, proc_cmdline, sizeof (retval.pr_psargs)); -+ -+ return &retval; -+} -+#endif -+ - /* Fills the "to_make_corefile_note" target vector. Builds the note - section for a corefile, and returns it in a malloc buffer. */ - -@@ -784,16 +910,9 @@ linux_make_corefile_notes (struct gdbarc - /* Process information. */ - if (get_exec_file (0)) - { -- const char *fname = lbasename (get_exec_file (0)); -- char *psargs = xstrdup (fname); -+ const prpsinfo_t *data = fill_prpsinfo (); - -- if (get_inferior_args ()) -- psargs = reconcat (psargs, psargs, " ", get_inferior_args (), -- (char *) NULL); -- -- note_data = elfcore_write_prpsinfo (obfd, note_data, note_size, -- fname, psargs); -- xfree (psargs); -+ note_data = elfcore_write_prpsinfo (obfd, note_data, note_size, data); - - if (!note_data) - return NULL; diff --git a/gdb-6.8-bz436037-reg-no-longer-active.patch b/gdb-6.8-bz436037-reg-no-longer-active.patch deleted file mode 100644 index 4987714..0000000 --- a/gdb-6.8-bz436037-reg-no-longer-active.patch +++ /dev/null @@ -1,25 +0,0 @@ -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-bz442765-threaded-exec-test.patch b/gdb-6.8-bz442765-threaded-exec-test.patch deleted file mode 100644 index 1006588..0000000 --- a/gdb-6.8-bz442765-threaded-exec-test.patch +++ /dev/null @@ -1,173 +0,0 @@ -Test various forms of threads tracking across exec(2). - -diff -up -u -X /root/jkratoch/.diffi.list -rup gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.c gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.c ---- gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.c 2008-04-16 17:05:19.000000000 -0400 -+++ gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.c 2008-04-16 14:43:50.000000000 -0400 -@@ -18,21 +18,95 @@ - Boston, MA 02111-1307, USA. */ - - #include --#include - #include - #include - #include -+#include - -+#ifdef THREADS -+ -+# include - - static void * - threader (void *arg) - { -- return NULL; -+ return NULL; - } - -+#endif -+ - int --main (void) -+main (int argc, char **argv) - { -+ char *exec_nothreads, *exec_threads, *cmd; -+ int phase; -+ char phase_s[8]; -+ -+ setbuf (stdout, NULL); -+ -+ if (argc != 4) -+ { -+ fprintf (stderr, "%s \n", argv[0]); -+ return 1; -+ } -+ -+#ifdef THREADS -+ puts ("THREADS: Y"); -+#else -+ puts ("THREADS: N"); -+#endif -+ exec_nothreads = argv[1]; -+ printf ("exec_nothreads: %s\n", exec_nothreads); -+ exec_threads = argv[2]; -+ printf ("exec_threads: %s\n", exec_threads); -+ phase = atoi (argv[3]); -+ printf ("phase: %d\n", phase); -+ -+ /* Phases: threading -+ 0: N -> N -+ 1: N -> Y -+ 2: Y -> Y -+ 3: Y -> N -+ 4: N -> exit */ -+ -+ cmd = NULL; -+ -+#ifndef THREADS -+ switch (phase) -+ { -+ case 0: -+ cmd = exec_nothreads; -+ break; -+ case 1: -+ cmd = exec_threads; -+ break; -+ case 2: -+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0], -+ phase); -+ return 1; -+ case 3: -+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0], -+ phase); -+ return 1; -+ case 4: -+ return 0; -+ default: -+ assert (0); -+ } -+#else /* THREADS */ -+ switch (phase) -+ { -+ case 0: -+ fprintf (stderr, "%s: We should not have threads for phase %d!\n", -+ argv[0], phase); -+ return 1; -+ case 1: -+ fprintf (stderr, "%s: We should not have threads for phase %d!\n", -+ argv[0], phase); -+ return 1; -+ case 2: -+ cmd = exec_threads; -+ { - pthread_t t1; - int i; - -@@ -40,7 +114,34 @@ main (void) - assert (i == 0); - i = pthread_join (t1, NULL); - assert (i == 0); -+ } -+ break; -+ case 3: -+ cmd = exec_nothreads; -+ { -+ pthread_t t1; -+ int i; -+ -+ i = pthread_create (&t1, NULL, threader, (void *) NULL); -+ assert (i == 0); -+ i = pthread_join (t1, NULL); -+ assert (i == 0); -+ } -+ break; -+ case 4: -+ fprintf (stderr, "%s: We should not have threads for phase %d!\n", -+ argv[0], phase); -+ return 1; -+ default: -+ assert (0); -+ } -+#endif /* THREADS */ -+ -+ assert (cmd != NULL); -+ -+ phase++; -+ snprintf (phase_s, sizeof phase_s, "%d", phase); - -- execl ("/bin/true", "/bin/true", NULL); -- abort (); -+ execl (cmd, cmd, exec_nothreads, exec_threads, phase_s, NULL); -+ assert (0); - } -diff -up -u -X /root/jkratoch/.diffi.list -rup gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.exp gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.exp ---- gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.exp 2008-04-16 17:05:19.000000000 -0400 -+++ gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.exp 2008-04-16 14:42:49.000000000 -0400 -@@ -20,9 +20,14 @@ - - set testfile threaded-exec - set srcfile ${testfile}.c --set binfile ${objdir}/${subdir}/${testfile} -+set binfile_nothreads ${objdir}/${subdir}/${testfile}N -+set binfile_threads ${objdir}/${subdir}/${testfile}Y - --if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } { -+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_nothreads}" executable {additional_flags=-UTHREADS}] != "" } { -+ return -1 -+} -+ -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile_threads}" executable {additional_flags=-DTHREADS}] != "" } { - return -1 - } - -@@ -30,9 +35,9 @@ gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - --gdb_load ${binfile} -+gdb_load ${binfile_nothreads} - --gdb_run_cmd -+gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0 - - gdb_test_multiple {} "Program exited" { - -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { diff --git a/gdb-6.8-bz457187-largefile-test.patch b/gdb-6.8-bz457187-largefile-test.patch deleted file mode 100644 index d2d6cf8..0000000 --- a/gdb-6.8-bz457187-largefile-test.patch +++ /dev/null @@ -1,105 +0,0 @@ ---- /dev/null 2009-04-19 14:49:00.974648389 +0200 -+++ gdb-6.8/gdb/testsuite/gdb.arch/i386-biarch-core.exp 2009-04-19 16:30:12.000000000 +0200 -@@ -0,0 +1,61 @@ -+# This testcase is part of GDB, the GNU debugger. -+ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Test ability to load an elf64-i386 core file. The provided core file was -+# elf64-x8664 one but it got binary patched to i386: -+# Elf32_Ehdr.e_machine @0x12..0x13 -+# Elf64_Ehdr.e_machine @0x12..0x13 -+# #define EM_386 3 /* Intel 80386 */ -+# #define EM_X86_64 62 /* AMD x86-64 architecture */ -+# patch @0x12: 0x3E -> 0x03 -+ -+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { -+ verbose "Skipping i386-biarch-core test." -+ return -+} -+ -+set testfile "i386-biarch-core" -+set corebz2uufile ${srcdir}/${subdir}/${testfile}.core.bz2.uu -+set corefile ${objdir}/${subdir}/${testfile}.core -+# Entry point of the original executable. -+set address 0x400078 -+ -+if {[catch "system \"uudecode -o - ${corebz2uufile} | bzip2 -dc >${corefile}\""] != 0} { -+ untested "failed uudecode or bzip2" -+ return -1 -+} -+file stat ${corefile} corestat -+if {$corestat(size) != 102400} { -+ untested "uudecode or bzip2 produce invalid result" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+# Wrongly built GDB complains by: -+# "..." is not a core dump: File format not recognized -+# As the provided test core has 64bit PRSTATUS i386 built GDB cannot parse it. -+# This is just a problem of the test care, real-world elf64-i386 file will have -+# 32bit PRSTATUS. One cannot prepare elf64-i386 core file from elf32-i386 by -+# objcopy as it corrupts the core file beyond all recognition. -+# "\r\nCore was generated by `\[^\r\n\]*'\\.\r\nProgram terminated with signal 11, Segmentation fault\\.\r\n.*" -+gdb_test "core-file ${corefile}" -+ -+gdb_test "x/i $address" "\r\n\[ \t\]*$address:\[ \t\]*hlt\[ \t\]*" ".text is readable" ---- /dev/null 2009-04-19 14:49:00.974648389 +0200 -+++ gdb-6.8/gdb/testsuite/gdb.arch/i386-biarch-core.S 2009-04-19 14:52:28.000000000 +0200 -@@ -0,0 +1,22 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+ .globl _start -+_start: -+ hlt ---- /dev/null 2009-04-19 14:49:00.974648389 +0200 -+++ gdb-6.8/gdb/testsuite/gdb.arch/i386-biarch-core.core.bz2.uu 2009-04-19 15:02:12.000000000 +0200 -@@ -0,0 +1,13 @@ -+begin 600 i386-biarch-core.core.bz2 -+M0EIH.3%!629361`P1\P`!)?_____\9'@"8Q)6P380'9@'&#`0D@``"``%(`` -+M@`#`"!<(L`%F"(:$GH13::F-)M&D&U,AD:`--#)M0&FT0XR9--,)D9`P(Q-& -+M",(-&F``02)%38HT]0T`&AH```'H@``T^>9T*(,("&)SE`>`9@+GP=[,N)KB -+M'I8BL(L]N5TCY\%V]/?DB.BN*UZ'U@]TN7-]UJ5\_%0QTT<*086#%MHT7XVJ -+M9D"+C!"2*L:8D1XPD!`--M@*XT1H5RFYN&)(!0P0#:`I:;2;$5M&\*9"0@%: -+MK@X[T()M)9N7`D$VA!^63)%,;@8LT`(7\K&[7G;U:"B6'!GG+46ALOZF.2F- -+M!@>C*%86X$-]C2`KE;HG)UL(913VR2G]0BD:J=Z_`G@S,`W%.8RMS-#5P:J0 -+MAJ2\8&X?@DE;UF68QHM<,D`('::J65/S:PAG*R-09["8DBI)'V]Y.[(/AM*L -+M"X_O^V;%FY.S6Q]FM=D37>5F,%4-F1ZF#,CFJVU;H*^IT<(%. */ -+ -+/* dw2-loclist-prelinked-func.S */ -+extern void func (void); -+ -+int -+main (void) -+{ -+ func (); -+ return 0; -+} -Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S 2009-09-09 20:10:35.000000000 +0200 -@@ -0,0 +1,328 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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 . */ -+ -+/* -+#include -+ -+void -+func (void) -+{ -+ int i; -+ -+ abort (); -+} -+*/ -+ .file "dw2-loclist-prelinked.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+.globl func -+ .type func, @function -+func: -+.LFB2: -+ .file 1 "dw2-loclist-prelinked.c" -+ .loc 1 5 0 -+ pushl %ebp -+.LCFI0: -+ movl %esp, %ebp -+.LCFI1: -+ subl $24, %esp -+.LCFI2: -+ .loc 1 8 0 -+ call abort -+.LFE2: -+ .size func, .-func -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 -+.LSCIE0: -+ .long 0xffffffff -+ .byte 0x1 -+ .string "" -+ .uleb128 0x1 -+ .sleb128 -4 -+ .byte 0x8 -+ .byte 0xc -+ .uleb128 0x4 -+ .uleb128 0x4 -+ .byte 0x88 -+ .uleb128 0x1 -+ .align 4 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 -+.LASFDE0: -+ .long .Lframe0 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x8 -+ .byte 0x85 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x5 -+ .align 4 -+.LEFDE0: -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .long .LFB2-.Ltext0 -+ .long .LCFI0-.Ltext0 -+ .value 0x2 -+ .byte 0x74 -+ .sleb128 4 -+ .long .LCFI0-.Ltext0 -+ .long .LCFI1-.Ltext0 -+ .value 0x2 -+ .byte 0x74 -+ .sleb128 8 -+ .long .LCFI1-.Ltext0 -+ .long .LFE2-.Ltext0 -+ .value 0x2 -+ .byte 0x75 -+ .sleb128 8 -+ .long 0x0 -+ .long 0x0 -+ .section .debug_info -+ .long 0x94 -+ .value 0x2 -+ .long .Ldebug_abbrev0 -+ .byte 0x4 -+ .uleb128 0x1 -+ .long .LASF10 -+ .byte 0x1 -+ .long .LASF11 -+ .long .LASF12 -+ .long .Ltext0 -+ .long .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .byte 0x4 -+ .byte 0x7 -+ .long .LASF0 -+ .uleb128 0x3 -+ .byte 0x4 -+ .byte 0x5 -+ .string "int" -+ .uleb128 0x2 -+ .byte 0x4 -+ .byte 0x5 -+ .long .LASF1 -+ .uleb128 0x2 -+ .byte 0x1 -+ .byte 0x8 -+ .long .LASF2 -+ .uleb128 0x2 -+ .byte 0x2 -+ .byte 0x7 -+ .long .LASF3 -+ .uleb128 0x2 -+ .byte 0x4 -+ .byte 0x7 -+ .long .LASF4 -+ .uleb128 0x2 -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF5 -+ .uleb128 0x2 -+ .byte 0x2 -+ .byte 0x5 -+ .long .LASF6 -+ .uleb128 0x2 -+ .byte 0x8 -+ .byte 0x5 -+ .long .LASF7 -+ .uleb128 0x2 -+ .byte 0x8 -+ .byte 0x7 -+ .long .LASF8 -+ .uleb128 0x4 -+ .byte 0x4 -+ .byte 0x7 -+ .uleb128 0x2 -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF9 -+ .uleb128 0x5 -+ .byte 0x1 -+ .long .LASF13 -+ .byte 0x1 -+ .byte 0x5 -+ .byte 0x1 -+ .long .LFB2 -+ .long .LFE2 -+ .long .LLST0 -+ .uleb128 0x6 -+ .string "i" -+ .byte 0x1 -+ .byte 0x6 -+ .long 0x2c -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -12 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0xe -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x1b -+ .uleb128 0xe -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x27 -+ .uleb128 0xc -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x17 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0x98 -+ .long 0x75 -+ .string "func" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x1c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x4 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .long .Ltext0 -+ .long .Letext0-.Ltext0 -+ .long 0x0 -+ .long 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF7: -+ .string "long long int" -+.LASF0: -+ .string "unsigned int" -+.LASF11: -+ .string "dw2-loclist-prelinked.c" -+.LASF12: -+ .string "gdb-6.8/gdb/testsuite/gdb.dwarf2" -+.LASF4: -+ .string "long unsigned int" -+.LASF8: -+ .string "long long unsigned int" -+.LASF2: -+ .string "unsigned char" -+.LASF9: -+ .string "char" -+.LASF1: -+ .string "long int" -+.LASF3: -+ .string "short unsigned int" -+.LASF5: -+ .string "signed char" -+.LASF10: -+ .string "GNU C 4.3.2 20081007 (Red Hat 4.3.2-6)" -+.LASF13: -+ .string "func" -+.LASF6: -+ .string "short int" -+ .ident "GCC: (GNU) 4.3.2 20081007 (Red Hat 4.3.2-6)" -+ .section .note.GNU-stack,"",@progbits diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch deleted file mode 100644 index d71557f..0000000 --- a/gdb-6.8-quit-never-aborts.patch +++ /dev/null @@ -1,72 +0,0 @@ -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 deleted file mode 100644 index 6df8c9a..0000000 --- a/gdb-6.8-sparc64-silence-memcpy-check.patch +++ /dev/null @@ -1,12 +0,0 @@ -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-6.8-watchpoint-conditionals-test.patch b/gdb-6.8-watchpoint-conditionals-test.patch deleted file mode 100644 index b014074..0000000 --- a/gdb-6.8-watchpoint-conditionals-test.patch +++ /dev/null @@ -1,78 +0,0 @@ -For: -http://sourceware.org/ml/gdb-patches/2008-04/msg00379.html -http://sourceware.org/ml/gdb-cvs/2008-04/msg00104.html - ---- /dev/null 2008-11-04 06:31:10.599601840 +0100 -+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint-cond.exp 2008-11-04 06:43:29.000000000 +0100 -@@ -0,0 +1,37 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile watchpoint-cond -+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} -+ -+if { [runto_main] < 0 } { -+ untested watchpoint-cond -+ return -1 -+} -+ -+gdb_test "watch i if i < 20" "atchpoint \[0-9\]+: i" -+gdb_test "cont" "atchpoint \[0-9\]+: i.*Old value = 20.*New value = 19.*" ---- /dev/null 2008-11-04 06:31:10.599601840 +0100 -+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint-cond.c 2008-11-04 06:42:48.000000000 +0100 -@@ -0,0 +1,31 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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 . -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@prep.ai.mit.edu */ -+ -+int -+main (int argc, char **argv) -+{ -+ static int i = 0; /* `static' to start initialized. */ -+ int j = 2; -+ -+ for (j = 0; j < 30; j++) -+ i = 30 - j; -+ -+ return 0; -+} 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 deleted file mode 100644 index becf80e..0000000 --- a/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch +++ /dev/null @@ -1,51 +0,0 @@ -Index: gdb-7.4.50.20120703/gdb/gdb_bfd.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/gdb_bfd.c 2012-07-03 17:30:07.356754655 +0200 -+++ gdb-7.4.50.20120703/gdb/gdb_bfd.c 2012-07-03 17:43:52.565762454 +0200 -@@ -26,12 +26,14 @@ - #ifdef HAVE_ZLIB_H - #include - #endif -+#ifndef __sparc__ - #ifdef HAVE_MMAP - #include - #ifndef MAP_FAILED - #define MAP_FAILED ((void *) -1) - #endif - #endif -+#endif - - /* An object of this type is stored in the section's user data when - mapping a section. */ -@@ -181,6 +183,7 @@ free_one_bfd_section (bfd *abfd, asectio - - if (sect != NULL && sect->data != NULL) - { -+#ifndef __sparc__ - #ifdef HAVE_MMAP - if (sect->map_addr != NULL) - { -@@ -191,6 +194,7 @@ free_one_bfd_section (bfd *abfd, asectio - } - else - #endif -+#endif - xfree (sect->data); - } - } -@@ -425,6 +429,7 @@ gdb_bfd_map_section (asection *sectp, bf - } - } - -+#ifndef __sparc__ - #ifdef HAVE_MMAP - { - /* The page size, used when mmapping. */ -@@ -458,6 +463,7 @@ gdb_bfd_map_section (asection *sectp, bf - } - } - #endif /* HAVE_MMAP */ -+#endif - - /* If we get here, we are a normal, not-compressed section. */ - diff --git a/gdb-archer-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch deleted file mode 100644 index cbd9a36..0000000 --- a/gdb-archer-next-over-throw-cxx-exec.patch +++ /dev/null @@ -1,85 +0,0 @@ -Archer-upstreamed: -http://sourceware.org/ml/archer/2010-q2/msg00031.html - ---- ./gdb/testsuite/gdb.cp/cxxexec.cc 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/testsuite/gdb.cp/cxxexec.cc 2010-05-29 01:18:56.000000000 +0200 -@@ -0,0 +1,25 @@ -+/* This test script is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+int -+main() -+{ -+ execlp ("true", "true", NULL); -+ return 1; -+} ---- ./gdb/testsuite/gdb.cp/cxxexec.exp 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/testsuite/gdb.cp/cxxexec.exp 2010-05-29 01:29:25.000000000 +0200 -@@ -0,0 +1,51 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if { [skip_cplus_tests] } { continue } -+ -+set testfile cxxexec -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } { -+ return -1 -+} -+ -+runto_main -+ -+# We could stop after `continue' again at `main'. -+delete_breakpoints -+ -+set test "p _Unwind_DebugHook" -+gdb_test_multiple $test $test { -+ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "\r\nNo symbol .*\r\n$gdb_prompt $" { -+ xfail $test -+ untested ${testfile}.exp -+ return -1 -+ } -+} -+ -+set test continue -+gdb_test_multiple $test $test { -+ -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" { -+ fail $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+# `info inferiors' can show on older GDBs. -+gdb_test "info threads" "info threads" "program finished" diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch deleted file mode 100644 index 41b9b46..0000000 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ /dev/null @@ -1,83 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/breakpoint.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/breakpoint.c 2012-06-02 19:11:54.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/breakpoint.c 2012-06-02 19:52:58.161226506 +0200 -@@ -15495,6 +15495,50 @@ initialize_breakpoint_ops (void) - } - - void -+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta) -+{ -+ struct bp_location *bl, **blp_tmp; -+ int changed = 0; -+ -+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL); -+ -+ ALL_BP_LOCATIONS (bl, blp_tmp) -+ { -+ struct obj_section *osect; -+ -+ /* BL->SECTION can be correctly NULL for breakpoints with multiple -+ locations expanded through symtab. */ -+ -+ ALL_OBJFILE_OSECTIONS (objfile, osect) -+ { -+ CORE_ADDR relocated_address; -+ CORE_ADDR delta_offset; -+ -+ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index); -+ if (delta_offset == 0) -+ continue; -+ relocated_address = bl->address + delta_offset; -+ -+ if (obj_section_addr (osect) <= relocated_address -+ && relocated_address < obj_section_endaddr (osect)) -+ { -+ if (bl->inserted) -+ remove_breakpoint (bl, mark_uninserted); -+ -+ bl->address += delta_offset; -+ bl->requested_address += delta_offset; -+ -+ changed = 1; -+ } -+ } -+ } -+ -+ if (changed) -+ qsort (bp_location, bp_location_count, sizeof (*bp_location), -+ bp_location_compare); -+} -+ -+void - _initialize_breakpoint (void) - { - struct cmd_list_element *c; -Index: gdb-7.4.50.20120602/gdb/breakpoint.h -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/breakpoint.h 2012-05-16 16:35:03.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/breakpoint.h 2012-06-02 19:53:09.268223263 +0200 -@@ -1503,4 +1503,7 @@ extern struct gdbarch *get_sal_arch (str - - extern void handle_solib_event (void); - -+extern void breakpoints_relocate (struct objfile *objfile, -+ struct section_offsets *delta); -+ - #endif /* !defined (BREAKPOINT_H) */ -Index: gdb-7.4.50.20120602/gdb/objfiles.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/objfiles.c 2012-05-10 21:50:08.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/objfiles.c 2012-06-02 19:52:58.202226502 +0200 -@@ -802,6 +802,11 @@ objfile_relocate1 (struct objfile *objfi - objfile->sf->sym_probe_fns->sym_relocate_probe (objfile, - new_offsets, delta); - -+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if -+ their addresses match. */ -+ if (objfile->separate_debug_objfile_backlink == NULL) -+ breakpoints_relocate (objfile, delta); -+ - /* Data changed. */ - return 1; - } diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch deleted file mode 100644 index f811964..0000000 --- a/gdb-archer-pie-addons.patch +++ /dev/null @@ -1,135 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/dwarf2read.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 19:14:38.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 19:51:29.977252338 +0200 -@@ -9746,7 +9746,12 @@ read_common_block (struct die_info *die, - { - struct attribute *attr; - struct symbol *sym; -- CORE_ADDR base = (CORE_ADDR) 0; -+ struct objfile *objfile = cu->objfile; -+ CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets, -+ SECT_OFF_TEXT (objfile)); -+ /* This is used only for DW_AT_data_member_location entries. */ -+ CORE_ADDR base = 0; -+ int base_p = 0; - - attr = dwarf2_attr (die, DW_AT_location, cu); - if (attr) -@@ -9755,6 +9760,7 @@ read_common_block (struct die_info *die, - if (attr_form_is_block (attr)) - { - base = decode_locdesc (DW_BLOCK (attr), cu); -+ base_p = 1; - } - else if (attr_form_is_section_offset (attr)) - { -@@ -9807,12 +9813,15 @@ read_common_block (struct die_info *die, - if (sym != NULL - && handle_data_member_location (child_die, cu, &offset)) - { -- SYMBOL_VALUE_ADDRESS (sym) = base + offset; -+ if (!base_p) -+ dwarf2_invalid_attrib_class_complaint -+ ("DW_AT_data_member_location", "common block member"); -+ SYMBOL_VALUE_ADDRESS (sym) = base + offset + baseaddr; - add_symbol_to_list (sym, &global_symbols); - } - - if (SYMBOL_CLASS (sym) == LOC_STATIC) -- SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym)); -+ SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym) - baseaddr); - else - SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym)); - FIELD_TYPE (*field) = SYMBOL_TYPE (sym); -@@ -9826,7 +9835,7 @@ read_common_block (struct die_info *die, - - sym = new_symbol (die, type, cu); - /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */ -- SYMBOL_VALUE_ADDRESS (sym) = base; -+ SYMBOL_VALUE_ADDRESS (sym) = base + baseaddr; - - set_die_type (die, type, cu); - } -Index: gdb-7.4.50.20120602/gdb/gdbtypes.h -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/gdbtypes.h 2012-06-02 19:11:54.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/gdbtypes.h 2012-06-02 19:52:44.990230200 +0200 -@@ -401,6 +401,7 @@ enum field_loc_kind - { - FIELD_LOC_KIND_BITPOS, /* bitpos */ - FIELD_LOC_KIND_ENUMVAL, /* enumval */ -+ /* This address is unrelocated by the objfile's ANOFFSET. */ - FIELD_LOC_KIND_PHYSADDR, /* physaddr */ - FIELD_LOC_KIND_PHYSNAME, /* physname */ - FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */ -@@ -595,6 +596,7 @@ struct main_type - is the location (in the target) of the static field. - Otherwise, physname is the mangled label of the static field. */ - -+ /* This address is unrelocated by the objfile's ANOFFSET. */ - CORE_ADDR physaddr; - const char *physname; - -@@ -1200,6 +1202,7 @@ extern void allocate_gnat_aux_type (stru - #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval) - #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0) - #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) -+/* This address is unrelocated by the objfile's ANOFFSET. */ - #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) - #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) - #define SET_FIELD_BITPOS(thisfld, bitpos) \ -@@ -1211,6 +1214,7 @@ extern void allocate_gnat_aux_type (stru - #define SET_FIELD_PHYSNAME(thisfld, name) \ - (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ - FIELD_STATIC_PHYSNAME (thisfld) = (name)) -+/* This address is unrelocated by the objfile's ANOFFSET. */ - #define SET_FIELD_PHYSADDR(thisfld, addr) \ - (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ - FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -@@ -1227,6 +1231,7 @@ extern void allocate_gnat_aux_type (stru - #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) - #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) - #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) -+/* This address is unrelocated by the objfile's ANOFFSET. */ - #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) - #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) - #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) -Index: gdb-7.4.50.20120602/gdb/jv-lang.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/jv-lang.c 2012-05-10 21:59:12.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/jv-lang.c 2012-06-02 19:51:53.286245280 +0200 -@@ -431,7 +431,8 @@ java_link_class_type (struct gdbarch *gd - - fields = NULL; - nfields--; /* First set up dummy "class" field. */ -- SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas)); -+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas) -+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); - TYPE_FIELD_NAME (type, nfields) = "class"; - TYPE_FIELD_TYPE (type, nfields) = value_type (clas); - SET_TYPE_FIELD_PRIVATE (type, nfields); -@@ -479,7 +480,8 @@ java_link_class_type (struct gdbarch *gd - SET_TYPE_FIELD_PROTECTED (type, i); - } - if (accflags & 0x0008) /* ACC_STATIC */ -- SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset); -+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset -+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); - else - SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset); - if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ -Index: gdb-7.4.50.20120602/gdb/value.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/value.c 2012-06-02 19:11:55.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/value.c 2012-06-02 19:51:30.031252317 +0200 -@@ -2592,7 +2592,8 @@ value_static_field (struct type *type, i - { - case FIELD_LOC_KIND_PHYSADDR: - retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), -- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); -+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno) -+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); - break; - case FIELD_LOC_KIND_PHYSNAME: - { diff --git a/gdb-archer.patch b/gdb-archer.patch deleted file mode 100644 index 80e3cf2..0000000 --- a/gdb-archer.patch +++ /dev/null @@ -1,13979 +0,0 @@ -http://sourceware.org/gdb/wiki/ProjectArcher -http://sourceware.org/gdb/wiki/ArcherBranchManagement - -GIT snapshot: -commit 897686c0aedb7a6da59b823f22b1d24ec5a1d2ba - -branch `archer' - the merge of branches: -archer-jankratochvil-vla -archer-tromey-python -archer-tromey-dwz-multifile-rebase (but from post-7.5 FSF GDB commits) - - -diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index a41cff9..d7786a6 100644 ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -704,7 +704,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ - exceptions.c expprint.c \ - f-exp.y f-lang.c f-typeprint.c f-valprint.c filesystem.c \ - findcmd.c findvar.c frame.c frame-base.c frame-unwind.c \ -- gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ -+ gdbarch.c arch-utils.c gdb_bfd.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ - go-exp.y go-lang.c go-typeprint.c go-valprint.c \ - inf-loop.c \ - infcall.c \ -@@ -829,7 +829,7 @@ gnulib/import/extra/snippet/warn-on-use.h \ - gnulib/import/stddef.in.h gnulib/import/inttypes.in.h inline-frame.h skip.h \ - common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \ - common/format.h \ --common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h -+common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h gdb_bfd.h - - # Header files that already have srcdir in them, or which are in objdir. - -@@ -879,7 +879,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ - macrotab.o macrocmd.o macroexp.o macroscope.o \ - mi-common.o \ - event-loop.o event-top.o inf-loop.o completer.o \ -- gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o \ -+ gdbarch.o arch-utils.o gdbtypes.o gdb_bfd.o osabi.o copying.o \ - memattr.o mem-break.o target.o parse.o language.o buildsym.o \ - findcmd.o \ - std-regs.o \ -@@ -1307,6 +1307,12 @@ stamp-h: $(srcdir)/config.in config.status - CONFIG_LINKS= \ - $(SHELL) config.status - -+.gdbinit: $(srcdir)/gdbinit.in config.status -+ CONFIG_FILES=".gdbinit:gdbinit.in" \ -+ CONFIG_COMMANDS= \ -+ CONFIG_HEADERS= \ -+ $(SHELL) config.status -+ - config.status: $(srcdir)/configure configure.tgt configure.host - $(SHELL) config.status --recheck - -diff --git a/gdb/NEWS b/gdb/NEWS -index b281824..4da886c 100644 ---- a/gdb/NEWS -+++ b/gdb/NEWS -@@ -1,6 +1,13 @@ - What has changed in GDB? - (Organized release by release) - -+*** Changes since GDB 7.5 -+ -+* New commands (for set/show, see "New options" below) -+ -+maint info bfds -+ List the BFDs known to GDB. -+ - *** Changes in GDB 7.5 - - * GDB now supports x32 ABI. Visit -diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c -index aa090af..e672731 100644 ---- a/gdb/ada-lang.c -+++ b/gdb/ada-lang.c -@@ -12037,6 +12037,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, - - static int - ada_operator_check (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, void *data), - void *data) - { -@@ -12051,12 +12052,15 @@ ada_operator_check (struct expression *exp, int pos, - break; - - default: -- return operator_check_standard (exp, pos, objfile_func, data); -+ return operator_check_standard (exp, pos, type_func, objfile_func, -+ data); - } - - /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ - -- if (type && TYPE_OBJFILE (type) -+ if (type && type_func && (*type_func) (type, data)) -+ return 1; -+ if (type && TYPE_OBJFILE (type) && objfile_func - && (*objfile_func) (TYPE_OBJFILE (type), data)) - return 1; - -diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c -index 6728800..455d3e6 100644 ---- a/gdb/bfd-target.c -+++ b/gdb/bfd-target.c -@@ -21,6 +21,7 @@ - #include "target.h" - #include "bfd-target.h" - #include "exec.h" -+#include "gdb_bfd.h" - - /* The object that is stored in the target_ops->to_data field has this - type. */ -@@ -70,7 +71,7 @@ target_bfd_xclose (struct target_ops *t, int quitting) - { - struct target_bfd_data *data = t->to_data; - -- bfd_close (data->bfd); -+ gdb_bfd_unref (data->bfd); - xfree (data->table.sections); - xfree (data); - xfree (t); -@@ -84,6 +85,7 @@ target_bfd_reopen (struct bfd *abfd) - - data = XZALLOC (struct target_bfd_data); - data->bfd = abfd; -+ gdb_bfd_ref (abfd); - build_section_table (abfd, &data->table.sections, &data->table.sections_end); - - t = XZALLOC (struct target_ops); -diff --git a/gdb/bfd-target.h b/gdb/bfd-target.h -index 71001c5..7f4e628 100644 ---- a/gdb/bfd-target.h -+++ b/gdb/bfd-target.h -@@ -23,9 +23,9 @@ - struct bfd; - struct target_ops; - --/* Given an existing BFD, re-open it as a "struct target_ops". On -- close, it will also close the corresponding BFD (which is like -- freopen and fdopen). */ -+/* Given an existing BFD, re-open it as a "struct target_ops". This -+ acquires a new reference to the BFD. This reference will be -+ released when the target is closed. */ - struct target_ops *target_bfd_reopen (struct bfd *bfd); - - #endif -diff --git a/gdb/block.c b/gdb/block.c -index a0f82ec..097dbf6 100644 ---- a/gdb/block.c -+++ b/gdb/block.c -@@ -692,3 +692,21 @@ block_iter_match_next (const char *name, - - return block_iter_match_step (iterator, name, compare, 0); - } -+ -+/* Return OBJFILE in which BLOCK is located or NULL if we cannot find it for -+ whatever reason. */ -+ -+struct objfile * -+block_objfile (const struct block *block) -+{ -+ struct symbol *func; -+ -+ if (block == NULL) -+ return NULL; -+ -+ func = block_linkage_function (block); -+ if (func == NULL) -+ return NULL; -+ -+ return SYMBOL_SYMTAB (func)->objfile; -+} -diff --git a/gdb/block.h b/gdb/block.h -index 99c4788..6ceb704 100644 ---- a/gdb/block.h -+++ b/gdb/block.h -@@ -279,4 +279,6 @@ extern struct symbol *block_iter_match_next (const char *name, - (sym); \ - (sym) = block_iterator_next (&(iter))) - -+extern struct objfile *block_objfile (const struct block *block); -+ - #endif /* BLOCK_H */ -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 78fffd3..224ba49 100644 ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -15519,6 +15519,24 @@ all_tracepoints (void) - return tp_vec; - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+breakpoint_types_mark_used (void) -+{ -+ struct breakpoint *b; -+ -+ ALL_BREAKPOINTS (b) -+ { -+ if (b->exp) -+ exp_types_mark_used (b->exp); -+ if (b->val) -+ type_mark_used (value_type (b->val)); -+ } -+} -+#endif -+ - - /* This help string is used for the break, hbreak, tbreak and thbreak - commands. It is defined as a macro to prevent duplication. -@@ -16484,4 +16502,7 @@ agent-printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\ - automatic_hardware_breakpoints = 1; - - observer_attach_about_to_proceed (breakpoint_about_to_proceed); -+#if 0 -+ observer_attach_mark_used (breakpoint_types_mark_used); -+#endif - } -diff --git a/gdb/buildsym.c b/gdb/buildsym.c -index d547012..e4882fb 100644 ---- a/gdb/buildsym.c -+++ b/gdb/buildsym.c -@@ -966,11 +966,14 @@ reset_symtab_globals (void) - file's text. - - If EXPANDABLE is non-zero the STATIC_BLOCK dictionary is made -- expandable. */ -+ expandable. -+ -+ If REQUIRED is non-zero, then a symtab is created even if it does -+ not contain any symbols. */ - - struct block * - end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile, -- int expandable) -+ int expandable, int required) - { - /* Finish the lexical context of the last function in the file; pop - the context stack. */ -@@ -1038,7 +1041,8 @@ end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile, - cleanup_undefined_stabs_types (objfile); - finish_global_stabs (objfile); - -- if (pending_blocks == NULL -+ if (!required -+ && pending_blocks == NULL - && file_symbols == NULL - && global_symbols == NULL - && have_line_numbers == 0 -@@ -1296,7 +1300,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) - { - struct block *static_block; - -- static_block = end_symtab_get_static_block (end_addr, objfile, 0); -+ static_block = end_symtab_get_static_block (end_addr, objfile, 0, 0); - return end_symtab_from_static_block (static_block, objfile, section, 0); - } - -@@ -1308,7 +1312,7 @@ end_expandable_symtab (CORE_ADDR end_addr, struct objfile *objfile, - { - struct block *static_block; - -- static_block = end_symtab_get_static_block (end_addr, objfile, 1); -+ static_block = end_symtab_get_static_block (end_addr, objfile, 1, 0); - return end_symtab_from_static_block (static_block, objfile, section, 1); - } - -diff --git a/gdb/buildsym.h b/gdb/buildsym.h -index 162ee8c..33b34c8 100644 ---- a/gdb/buildsym.h -+++ b/gdb/buildsym.h -@@ -260,7 +260,8 @@ extern char *pop_subfile (void); - - extern struct block *end_symtab_get_static_block (CORE_ADDR end_addr, - struct objfile *objfile, -- int expandable); -+ int expandable, -+ int required); - - extern struct symtab *end_symtab_from_static_block (struct block *static_block, - struct objfile *objfile, -diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c -index a5892b5..2944c2d 100644 ---- a/gdb/c-typeprint.c -+++ b/gdb/c-typeprint.c -@@ -624,9 +624,14 @@ c_type_print_varspec_suffix (struct type *type, - fprintf_filtered (stream, ")"); - - fprintf_filtered (stream, "["); -- if (get_array_bounds (type, &low_bound, &high_bound)) -- fprintf_filtered (stream, "%d", -- (int) (high_bound - low_bound + 1)); -+ if (TYPE_RANGE_DATA (TYPE_INDEX_TYPE (type))->high.kind -+ != RANGE_BOUND_KIND_CONSTANT) -+ { -+ /* No _() - printed sources should not be locale dependent. */ -+ fprintf_filtered (stream, "variable"); -+ } -+ else if (get_array_bounds (type, &low_bound, &high_bound)) -+ fprintf_filtered (stream, "%d", (int) (high_bound - low_bound + 1)); - fprintf_filtered (stream, "]"); - - c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, -diff --git a/gdb/cc-with-dwz.sh b/gdb/cc-with-dwz.sh -deleted file mode 100755 -index f66deb1..0000000 ---- a/gdb/cc-with-dwz.sh -+++ /dev/null -@@ -1,80 +0,0 @@ --#! /bin/sh --# Wrapper around gcc to run 'dwz' when running the testsuite. -- --# Copyright (C) 2010-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 . -- --# This program requires dwz in addition to gcc. --# --# Example usage: --# --# bash$ cd $objdir/gdb/testsuite --# bash$ runtest \ --# CC_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh gcc" \ --# CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh g++" --# -- --myname=cc-with-dwz.sh -- --DWZ=${DWZ:-dwz} -- --have_link=unknown --next_is_output_file=no --output_file=a.out -- --for arg in "$@" --do -- if [ "$next_is_output_file" = "yes" ] -- then -- output_file="$arg" -- next_is_output_file=no -- continue -- fi -- -- # Poor man's gcc argument parser. -- # We don't need to handle all arguments, we just need to know if we're -- # doing a link and what the output file is. -- # It's not perfect, but it seems to work well enough for the task at hand. -- case "$arg" in -- "-c") have_link=no ;; -- "-E") have_link=no ;; -- "-S") have_link=no ;; -- "-o") next_is_output_file=yes ;; -- esac --done -- --if [ "$next_is_output_file" = "yes" ] --then -- echo "$myname: Unable to find output file" >&2 -- exit 1 --fi -- --if [ "$have_link" = "no" ] --then -- "$@" -- exit $? --fi -- --"$@" --rc=$? --[ $rc != 0 ] && exit $rc --if [ ! -f "$output_file" ] --then -- echo "$myname: Internal error: $output_file missing." >&2 -- exit 1 --fi -- --$DWZ "$output_file" > /dev/null 2>&1 -- --exit 0 -diff --git a/gdb/cc-with-index.sh b/gdb/cc-with-index.sh -deleted file mode 100644 -index 644ba34..0000000 ---- a/gdb/cc-with-index.sh -+++ /dev/null -@@ -1,126 +0,0 @@ --#! /bin/sh --# Wrapper around gcc to add the .gdb_index section when running the testsuite. -- --# Copyright (C) 2010-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 . -- --# This program requires gdb and objcopy in addition to gcc. --# The default values are gdb from the build tree and objcopy from $PATH. --# They may be overridden by setting environment variables GDB and OBJCOPY --# respectively. --# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite. --# --# Example usage: --# --# bash$ cd $objdir/gdb/testsuite --# bash$ runtest \ --# CC_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh gcc" \ --# CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh g++" --# --# For documentation on index files: info -f gdb.info -n "Index Files" -- --myname=cc-with-index.sh -- --if [ -z "$GDB" ] --then -- if [ -f ./gdb ] -- then -- GDB="./gdb" -- elif [ -f ../gdb ] -- then -- GDB="../gdb" -- elif [ -f ../../gdb ] -- then -- GDB="../../gdb" -- else -- echo "$myname: unable to find usable gdb" >&2 -- exit 1 -- fi --fi -- --OBJCOPY=${OBJCOPY:-objcopy} -- --have_link=unknown --next_is_output_file=no --output_file=a.out -- --for arg in "$@" --do -- if [ "$next_is_output_file" = "yes" ] -- then -- output_file="$arg" -- next_is_output_file=no -- continue -- fi -- -- # Poor man's gcc argument parser. -- # We don't need to handle all arguments, we just need to know if we're -- # doing a link and what the output file is. -- # It's not perfect, but it seems to work well enough for the task at hand. -- case "$arg" in -- "-c") have_link=no ;; -- "-E") have_link=no ;; -- "-S") have_link=no ;; -- "-o") next_is_output_file=yes ;; -- esac --done -- --if [ "$next_is_output_file" = "yes" ] --then -- echo "$myname: Unable to find output file" >&2 -- exit 1 --fi -- --if [ "$have_link" = "no" ] --then -- "$@" -- exit $? --fi -- --index_file="${output_file}.gdb-index" --if [ -f "$index_file" ] --then -- echo "$myname: Index file $index_file exists, won't clobber." >&2 -- exit 1 --fi -- --output_dir="${output_file%/*}" --[ "$output_dir" = "$output_file" ] && output_dir="." -- --"$@" --rc=$? --[ $rc != 0 ] && exit $rc --if [ ! -f "$output_file" ] --then -- echo "$myname: Internal error: $output_file missing." >&2 -- exit 1 --fi -- --$GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir" --rc=$? --[ $rc != 0 ] && exit $rc -- --# GDB might not always create an index. Cope. --if [ -f "$index_file" ] --then -- $OBJCOPY --add-section .gdb_index="$index_file" \ -- --set-section-flags .gdb_index=readonly \ -- "$output_file" "$output_file" -- rc=$? --else -- rc=0 --fi -- --rm -f "$index_file" --exit $rc -diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c -index 4a8b5d1..7341f00 100644 ---- a/gdb/cli/cli-dump.c -+++ b/gdb/cli/cli-dump.c -@@ -32,6 +32,7 @@ - #include "readline/readline.h" - #include "gdbcore.h" - #include "cli/cli-utils.h" -+#include "gdb_bfd.h" - - #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - -@@ -111,12 +112,12 @@ bfd_openr_with_cleanup (const char *filename, const char *target) - { - bfd *ibfd; - -- ibfd = bfd_openr (filename, target); -+ ibfd = gdb_bfd_openr (filename, target); - if (ibfd == NULL) - error (_("Failed to open %s: %s."), filename, - bfd_errmsg (bfd_get_error ())); - -- make_cleanup_bfd_close (ibfd); -+ make_cleanup_bfd_unref (ibfd); - if (!bfd_check_format (ibfd, bfd_object)) - error (_("'%s' is not a recognized file format."), filename); - -@@ -131,11 +132,11 @@ bfd_openw_with_cleanup (const char *filename, const char *target, - - if (*mode == 'w') /* Write: create new file */ - { -- obfd = bfd_openw (filename, target); -+ obfd = gdb_bfd_openw (filename, target); - if (obfd == NULL) - error (_("Failed to open %s: %s."), filename, - bfd_errmsg (bfd_get_error ())); -- make_cleanup_bfd_close (obfd); -+ make_cleanup_bfd_unref (obfd); - if (!bfd_set_format (obfd, bfd_object)) - error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ())); - } -diff --git a/gdb/coffread.c b/gdb/coffread.c -index b0a8b82..0c7e6d9 100644 ---- a/gdb/coffread.c -+++ b/gdb/coffread.c -@@ -653,13 +653,14 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags) - char *debugfile; - - debugfile = find_separate_debug_file_by_debuglink (objfile); -+ make_cleanup (xfree, debugfile); - - if (debugfile) - { - bfd *abfd = symfile_bfd_open (debugfile); - -+ make_cleanup_bfd_unref (abfd); - symbol_file_add_separate (abfd, symfile_flags, objfile); -- xfree (debugfile); - } - } - -diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh -new file mode 100755 -index 0000000..7d7932c ---- /dev/null -+++ b/gdb/contrib/cc-with-tweaks.sh -@@ -0,0 +1,162 @@ -+#! /bin/sh -+# Wrapper around gcc to tweak the output in various ways when running -+# the testsuite. -+ -+# Copyright (C) 2010-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 . -+ -+# This program requires gdb and objcopy in addition to gcc. -+# The default values are gdb from the build tree and objcopy from $PATH. -+# They may be overridden by setting environment variables GDB and OBJCOPY -+# respectively. -+# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite. -+# -+# Example usage: -+# -+# bash$ cd $objdir/gdb/testsuite -+# bash$ runtest \ -+# CC_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS gcc" \ -+# CXX_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS g++" -+# -+# For documentation on index files: info -f gdb.info -n "Index Files" -+# For information about 'dwz', see the announcement: -+# http://gcc.gnu.org/ml/gcc/2012-04/msg00686.html -+# (More documentation is to come.) -+ -+# ARGS determine what is done. They can be: -+# -z compress using dwz -+# -m compress using dwz -m -+# -i make an index -+# If nothing is given, no changes are made -+ -+myname=cc-with-tweaks.sh -+ -+if [ -z "$GDB" ] -+then -+ if [ -f ./gdb ] -+ then -+ GDB="./gdb" -+ elif [ -f ../gdb ] -+ then -+ GDB="../gdb" -+ elif [ -f ../../gdb ] -+ then -+ GDB="../../gdb" -+ else -+ echo "$myname: unable to find usable gdb" >&2 -+ exit 1 -+ fi -+fi -+ -+OBJCOPY=${OBJCOPY:-objcopy} -+ -+DWZ=${DWZ:-dwz} -+ -+have_link=unknown -+next_is_output_file=no -+output_file=a.out -+ -+want_index=false -+want_dwz=false -+want_multi=false -+ -+while [ $# -gt 0 ]; do -+ case "$1" in -+ -z) want_dwz=true ;; -+ -i) want_index=true ;; -+ -m) want_multi=true ;; -+ *) break ;; -+ esac -+ shift -+done -+ -+for arg in "$@" -+do -+ if [ "$next_is_output_file" = "yes" ] -+ then -+ output_file="$arg" -+ next_is_output_file=no -+ continue -+ fi -+ -+ # Poor man's gcc argument parser. -+ # We don't need to handle all arguments, we just need to know if we're -+ # doing a link and what the output file is. -+ # It's not perfect, but it seems to work well enough for the task at hand. -+ case "$arg" in -+ "-c") have_link=no ;; -+ "-E") have_link=no ;; -+ "-S") have_link=no ;; -+ "-o") next_is_output_file=yes ;; -+ esac -+done -+ -+if [ "$next_is_output_file" = "yes" ] -+then -+ echo "$myname: Unable to find output file" >&2 -+ exit 1 -+fi -+ -+if [ "$have_link" = "no" ] -+then -+ "$@" -+ exit $? -+fi -+ -+index_file="${output_file}.gdb-index" -+if [ "$want_index" = true ] && [ -f "$index_file" ] -+then -+ echo "$myname: Index file $index_file exists, won't clobber." >&2 -+ exit 1 -+fi -+ -+output_dir="${output_file%/*}" -+[ "$output_dir" = "$output_file" ] && output_dir="." -+ -+"$@" -+rc=$? -+[ $rc != 0 ] && exit $rc -+if [ ! -f "$output_file" ] -+then -+ echo "$myname: Internal error: $output_file missing." >&2 -+ exit 1 -+fi -+ -+if [ "$want_index" = true ]; then -+ $GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir" -+ rc=$? -+ [ $rc != 0 ] && exit $rc -+ -+ # GDB might not always create an index. Cope. -+ if [ -f "$index_file" ] -+ then -+ $OBJCOPY --add-section .gdb_index="$index_file" \ -+ --set-section-flags .gdb_index=readonly \ -+ "$output_file" "$output_file" -+ rc=$? -+ else -+ rc=0 -+ fi -+ [ $rc != 0 ] && exit $rc -+fi -+ -+if [ "$want_dwz" = true ]; then -+ $DWZ "$output_file" > /dev/null 2>&1 -+elif [ "$want_multi" = true ]; then -+ cp $output_file ${output_file}.alt -+ $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null 2>&1 -+fi -+ -+rm -f "$index_file" -+exit $rc -diff --git a/gdb/corelow.c b/gdb/corelow.c -index dd62560..340b149 100644 ---- a/gdb/corelow.c -+++ b/gdb/corelow.c -@@ -46,6 +46,7 @@ - #include "filenames.h" - #include "progspace.h" - #include "objfiles.h" -+#include "gdb_bfd.h" - - #ifndef O_LARGEFILE - #define O_LARGEFILE 0 -@@ -215,9 +216,7 @@ core_close (int quitting) - core_data = NULL; - } - -- name = bfd_get_filename (core_bfd); -- gdb_bfd_close_or_warn (core_bfd); -- xfree (name); -+ gdb_bfd_unref (core_bfd); - core_bfd = NULL; - } - core_vec = NULL; -@@ -319,9 +318,9 @@ core_open (char *filename, int from_tty) - if (scratch_chan < 0) - perror_with_name (filename); - -- temp_bfd = bfd_fopen (filename, gnutarget, -- write_files ? FOPEN_RUB : FOPEN_RB, -- scratch_chan); -+ temp_bfd = gdb_bfd_fopen (filename, gnutarget, -+ write_files ? FOPEN_RUB : FOPEN_RB, -+ scratch_chan); - if (temp_bfd == NULL) - perror_with_name (filename); - -@@ -332,7 +331,7 @@ core_open (char *filename, int from_tty) - /* FIXME: should be checking for errors from bfd_close (for one - thing, on error it does not free all the storage associated - with the bfd). */ -- make_cleanup_bfd_close (temp_bfd); -+ make_cleanup_bfd_unref (temp_bfd); - error (_("\"%s\" is not a core dump: %s"), - filename, bfd_errmsg (bfd_get_error ())); - } -@@ -340,7 +339,7 @@ core_open (char *filename, int from_tty) - /* Looks semi-reasonable. Toss the old core file and work on the - new. */ - -- discard_cleanups (old_chain); /* Don't free filename any more */ -+ do_cleanups (old_chain); - unpush_target (&core_ops); - core_bfd = temp_bfd; - old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/); -diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in -index 87c6dd4..1c26652 100644 ---- a/gdb/data-directory/Makefile.in -+++ b/gdb/data-directory/Makefile.in -@@ -52,14 +52,25 @@ SYSCALLS_FILES = \ - PYTHON_DIR = python - PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) - PYTHON_FILES = \ -+ gdb/FrameIterator.py \ -+ gdb/FrameWrapper.py \ - gdb/__init__.py \ -- gdb/types.py \ -- gdb/printing.py \ -- gdb/prompt.py \ -+ gdb/backtrace.py \ - gdb/command/__init__.py \ -+ gdb/command/backtrace.py \ -+ gdb/command/ignore_errors.py \ -+ gdb/command/pahole.py \ - gdb/command/pretty_printers.py \ - gdb/command/prompt.py \ -- gdb/command/explore.py -+ gdb/command/explore.py \ -+ gdb/command/require.py \ -+ gdb/command/upto.py \ -+ gdb/function/__init__.py \ -+ gdb/function/caller_is.py \ -+ gdb/function/in_scope.py \ -+ gdb/printing.py \ -+ gdb/prompt.py \ -+ gdb/types.py - - FLAGS_TO_PASS = \ - "prefix=$(prefix)" \ -diff --git a/gdb/defs.h b/gdb/defs.h -index 1c6fa79..ec08348 100644 ---- a/gdb/defs.h -+++ b/gdb/defs.h -@@ -315,7 +315,7 @@ extern struct cleanup *make_cleanup_close (int fd); - - extern struct cleanup *make_cleanup_fclose (FILE *file); - --extern struct cleanup *make_cleanup_bfd_close (bfd *abfd); -+extern struct cleanup *make_cleanup_bfd_unref (bfd *abfd); - - struct obstack; - extern struct cleanup *make_cleanup_obstack_free (struct obstack *obstack); -@@ -353,6 +353,8 @@ extern struct cleanup *make_cleanup_restore_page_info (void); - extern struct cleanup * - set_batch_flag_and_make_cleanup_restore_page_info (void); - -+extern struct cleanup *make_cleanup_restore_selected_frame (void); -+ - extern char *gdb_realpath (const char *); - extern char *xfullpath (const char *); - -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 68ea817..5945bac 100644 ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -1200,6 +1200,16 @@ for remote debugging. - Run using @var{device} for your program's standard input and output. - @c FIXME: kingdon thinks there is more to -tty. Investigate. - -+@item -P -+@cindex @code{-P} -+@itemx --python -+@cindex @code{--python} -+Change interpretation of command line so that the argument immediately -+following this switch is taken to be the name of a Python script file. -+This option stops option processing; subsequent options are passed to -+Python as @code{sys.argv}. This option is only available if Python -+scripting support was enabled when @value{GDBN} was configured. -+ - @c resolve the situation of these eventually - @item -tui - @cindex @code{--tui} -@@ -22563,8 +22573,6 @@ containing @code{end}. For example: - - @smallexample - (@value{GDBP}) python --Type python script --End with a line saying just "end". - >print 23 - >end - 23 -@@ -22578,6 +22586,14 @@ controlled using @code{set python print-stack}: if @code{full}, then - full Python stack printing is enabled; if @code{none}, then Python stack - and message printing is disabled; if @code{message}, the default, only - the message component of the error is printed. -+ -+@kindex maint set python auto-load -+@item maint set python auto-load -+By default, @value{GDBN} will attempt to automatically load Python -+code when an object file is opened. This can be controlled using -+@code{maint set python auto-load}: if @code{on}, the default, then -+Python auto-loading is enabled; if @code{off}, then Python -+auto-loading is disabled. - @end table - - It is also possible to execute a Python script from the @value{GDBN} -@@ -22599,6 +22615,14 @@ and thus is always available. - @cindex python api - @cindex programming in python - -+You can get quick online help for @value{GDBN}'s Python API by issuing -+the command @w{@kbd{python help (gdb)}}. -+ -+Functions and methods which have two or more optional arguments allow -+them to be specified using keyword syntax. This allows passing some -+optional arguments while skipping others. Example: -+@w{@code{gdb.some_function ('foo', bar = 1, baz = 2)}}. -+ - @cindex python stdout - @cindex python pagination - At startup, @value{GDBN} overrides Python's @code{sys.stdout} and -@@ -34536,6 +34560,11 @@ Shared library events. - - @end table - -+@kindex maint info bfds -+@item maint info bfds -+This prints information about each @code{bfd} object that is known to -+@value{GDBN}. @xref{Top, , BFD, bfd, The Binary File Descriptor Library}. -+ - @kindex set displaced-stepping - @kindex show displaced-stepping - @cindex displaced stepping support -diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo -index 5e00f1f..c5c432b 100644 ---- a/gdb/doc/gdbint.texinfo -+++ b/gdb/doc/gdbint.texinfo -@@ -2102,6 +2102,18 @@ time, and so we attempt to handle symbols incrementally. For instance, - we create @dfn{partial symbol tables} consisting of only selected - symbols, and only expand them to full symbol tables when necessary. - -+@menu -+* Symbol Reading:: -+* Partial Symbol Tables:: -+* Types:: -+* Object File Formats:: -+* Debugging File Formats:: -+* Adding a New Symbol Reader to GDB:: -+* Memory Management for Symbol Files:: -+* Memory Management for Types:: -+@end menu -+ -+@node Symbol Reading - @section Symbol Reading - - @cindex symbol reading -@@ -2194,6 +2206,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and - zero if there were no symbols in that part of the symbol file. - @end table - -+@node Partial Symbol Tables - @section Partial Symbol Tables - - @value{GDBN} has three types of symbol tables: -@@ -2295,6 +2308,7 @@ and partial symbol tables behind a set of function pointers known as - the @dfn{quick symbol functions}. These are documented in - @file{symfile.h}. - -+@node Types - @section Types - - @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}). -@@ -2317,6 +2331,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by - other members of the type struct, such as whether the type is signed - or unsigned, and how many bits it uses. - -+@anchor{Builtin Types} - @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}). - - These are instances of type structs that roughly correspond to -@@ -2331,6 +2346,7 @@ only one instance exists, while @file{c-lang.c} builds as many - @code{TYPE_CODE_INT} types as needed, with each one associated with - some particular objfile. - -+@node Object File Formats - @section Object File Formats - @cindex object file formats - -@@ -2416,6 +2432,7 @@ SOM, which is a cross-language ABI). - - The SOM reader is in @file{somread.c}. - -+@node Debugging File Formats - @section Debugging File Formats - - This section describes characteristics of debugging information that -@@ -2487,6 +2504,7 @@ DWARF 3 is an improved version of DWARF 2. - @cindex SOM debugging info - Like COFF, the SOM definition includes debugging information. - -+@node Adding a New Symbol Reader to GDB - @section Adding a New Symbol Reader to @value{GDBN} - - @cindex adding debugging info reader -@@ -2509,6 +2527,7 @@ will only ever be implemented by one object file format may be called - directly. This interface should be described in a file - @file{bfd/lib@var{xyz}.h}, which is included by @value{GDBN}. - -+@node Memory Management for Symbol Files - @section Memory Management for Symbol Files - - Most memory associated with a loaded symbol file is stored on -@@ -2520,10 +2539,45 @@ released when the objfile is unloaded or reloaded. Therefore one - objfile must not reference symbol or type data from another objfile; - they could be unloaded at different times. - --User convenience variables, et cetera, have associated types. Normally --these types live in the associated objfile. However, when the objfile --is unloaded, those types are deep copied to global memory, so that --the values of the user variables and history items are not lost. -+@node Memory Management for Types -+@section Memory Management for Types -+@cindex memory management for types -+ -+@findex TYPE_OBJFILE -+@code{TYPE_OBJFILE} macro indicates the current memory owner of the type. -+Non-@code{NULL} value indicates it is owned by an objfile (specifically by its -+obstack) and in such case the type remains valid till the objfile is unloaded -+or reloaded. For such types with an associated objfile no reference counting -+is being made. -+ -+User convenience variables, et cetera, have associated types. Normally these -+types live in the associated objfile. However, when the objfile is unloaded, -+those types are deep copied to global memory, so that the values of the user -+variables and history items are not lost. During the copy they will get their -+@code{TYPE_OBJFILE} set to @code{NULL} and become so-called @dfn{reclaimable} -+types. -+ -+Types with null @code{TYPE_OBJFILE} can be either permanent types -+(@pxref{Builtin Types}) or reclaimable types which will be deallocated at the -+first idle @value{GDBN} moment if the last object referencing them is removed. -+Permanent types are allocated by the function @code{alloc_type} (and its -+derivations like @code{init_type}) specifying objfile as @code{NULL}. The -+reclaimable types are created the same way but moreover they need to have -+@code{type_init_group} called to start their tracking as being possibly -+deallocatable. -+ -+@findex free_all_types -+When @value{GDBN} gets idle it always calls the @code{free_all_types} function -+which deallocates any unused types. All types currently not owned by an -+objfile must be marked as used on each @code{free_all_types} call as they would -+get deallocated as unused otherwise. -+ -+@code{free_all_types} automatically checks for any cross-type references such -+as through @code{TYPE_TARGET_TYPE}, @code{TYPE_POINTER_TYPE} etc.@: and -+prevents early deallocation for any such existing references. Reclaimable -+types may reference any other reclaimable types or even permanent types. But -+permanent types must not reference reclaimable types (nor an objfile associated -+type). - - - @node Language Support -diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi -index 6827ed8..c63b901 100644 ---- a/gdb/doc/observer.texi -+++ b/gdb/doc/observer.texi -@@ -230,6 +230,11 @@ the current top-level prompt. - Variable gdb_datadir has been set. The value may not necessarily change. - @end deftypefun - -+@c @deftypefun void mark_used (void) -+@c Mark any possibly reclaimable objects as used during a mark-and-sweep garbage -+@c collector pass. Currently only @code{type_mark_used} marker is supported. -+@c @end deftypefun -+ - @deftypefun void test_notification (int @var{somearg}) - This observer is used for internal testing. Do not use. - See testsuite/gdb.gdb/observer.exp. -diff --git a/gdb/dsrec.c b/gdb/dsrec.c -index d2c99b2..f39d0ed 100644 ---- a/gdb/dsrec.c -+++ b/gdb/dsrec.c -@@ -23,6 +23,7 @@ - #include - #include "gdb_assert.h" - #include "gdb_string.h" -+#include "gdb_bfd.h" - - extern void report_transfer_performance (unsigned long, time_t, time_t); - -@@ -56,19 +57,22 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset, - int reclen; - time_t start_time, end_time; - unsigned long data_count = 0; -+ struct cleanup *cleanup; - - srec = (char *) alloca (maxrecsize + 1); - -- abfd = bfd_openr (file, 0); -+ abfd = gdb_bfd_openr (file, 0); - if (!abfd) - { - printf_filtered (_("Unable to open file %s\n"), file); - return; - } - -+ cleanup = make_cleanup_bfd_unref (abfd); - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered (_("File is not an object file\n")); -+ do_cleanups (cleanup); - return; - } - -@@ -170,6 +174,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset, - serial_flush_input (desc); - - report_transfer_performance (data_count, start_time, end_time); -+ do_cleanups (cleanup); - } - - /* -diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index 214b371..d9b3751 100644 ---- a/gdb/dwarf2expr.c -+++ b/gdb/dwarf2expr.c -@@ -1480,6 +1480,14 @@ execute_stack_op (struct dwarf_expr_context *ctx, - } - break; - -+ case DW_OP_push_object_address: -+ if (ctx->funcs->get_object_address == NULL) -+ error (_("DWARF-2 expression error: DW_OP_push_object_address must " -+ "have a value to push.")); -+ result = (ctx->funcs->get_object_address) (ctx->baton); -+ result_val = value_from_ulongest (address_type, result); -+ break; -+ - default: - error (_("Unhandled dwarf expression opcode 0x%x"), op); - } -diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index 19efbfd..0e0e498 100644 ---- a/gdb/dwarf2expr.h -+++ b/gdb/dwarf2expr.h -@@ -78,12 +78,8 @@ struct dwarf_expr_context_funcs - This can throw an exception if the index is out of range. */ - CORE_ADDR (*get_addr_index) (void *baton, unsigned int index); - --#if 0 -- /* Not yet implemented. */ -- - /* Return the `object address' for DW_OP_push_object_address. */ - CORE_ADDR (*get_object_address) (void *baton); --#endif - }; - - /* The location of a value. */ -diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index 38e4814..46a033d 100644 ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c -@@ -293,6 +293,9 @@ struct dwarf_expr_baton - { - struct frame_info *frame; - struct dwarf2_per_cu_data *per_cu; -+ /* From DW_TAG_variable's DW_AT_location (not DW_TAG_type's -+ DW_AT_data_location) for DW_OP_push_object_address. */ -+ CORE_ADDR object_address; - }; - - /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -352,16 +355,14 @@ static void - dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, - const gdb_byte **start, size_t *length) - { -- if (SYMBOL_LOCATION_BATON (framefunc) == NULL) -- *length = 0; -- else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs) -+ if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs) - { - struct dwarf2_loclist_baton *symbaton; - - symbaton = SYMBOL_LOCATION_BATON (framefunc); - *start = dwarf2_find_location_expression (symbaton, length, pc); - } -- else -+ else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_locexpr_funcs) - { - struct dwarf2_locexpr_baton *symbaton; - -@@ -374,10 +375,23 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, - else - *length = 0; - } -+ else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_missing_funcs) -+ { -+ struct dwarf2_locexpr_baton *symbaton; -+ -+ symbaton = SYMBOL_LOCATION_BATON (framefunc); -+ gdb_assert (symbaton == NULL); -+ *length = 0; -+ } -+ else -+ internal_error (__FILE__, __LINE__, -+ _("Unsupported SYMBOL_COMPUTED_OPS %p for \"%s\""), -+ SYMBOL_COMPUTED_OPS (framefunc), -+ SYMBOL_PRINT_NAME (framefunc)); - - if (*length == 0) - error (_("Could not find the frame base for \"%s\"."), -- SYMBOL_NATURAL_NAME (framefunc)); -+ SYMBOL_PRINT_NAME (framefunc)); - } - - /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for -@@ -445,6 +459,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, cu_offset die_offset) - ctx->funcs->get_frame_pc, ctx->baton); - } - -+static CORE_ADDR -+dwarf_expr_object_address (void *baton) -+{ -+ struct dwarf_expr_baton *debaton = baton; -+ -+ /* The message is suppressed in DWARF_BLOCK_EXEC. */ -+ if (debaton->object_address == 0) -+ error (_("Cannot resolve DW_OP_push_object_address for a missing object")); -+ -+ return debaton->object_address; -+} -+ -+/* Address of the variable we are currently referring to. It is set from -+ DW_TAG_variable's DW_AT_location (not DW_TAG_type's DW_AT_data_location) for -+ DW_OP_push_object_address. */ -+ -+static CORE_ADDR object_address; -+ -+/* Callers use object_address_set while their callers use the result set so we -+ cannot run the cleanup at the local block of our direct caller. Still we -+ should reset OBJECT_ADDRESS at least for the next GDB command. */ -+ -+static void -+object_address_cleanup (void *prev_save_voidp) -+{ -+ CORE_ADDR *prev_save = prev_save_voidp; -+ -+ object_address = *prev_save; -+ xfree (prev_save); -+} -+ -+/* Set the base address - DW_AT_location - of a variable. It is being later -+ used to derive other object addresses by DW_OP_push_object_address. -+ -+ It would be useful to sanity check ADDRESS - such as for some objects with -+ unset value_raw_address - but some valid addresses may be zero (such as first -+ objects in relocatable .o files). */ -+ -+void -+object_address_set (CORE_ADDR address) -+{ -+ CORE_ADDR *prev_save; -+ -+ prev_save = xmalloc (sizeof *prev_save); -+ *prev_save = object_address; -+ make_cleanup (object_address_cleanup, prev_save); -+ -+ object_address = address; -+} -+ -+/* Evaluate DWARF location list at DLLBATON expecting it produces exactly one -+ CORE_ADDR result stored to *ADDRP on the DWARF stack stack. If the result -+ could not be found return zero and keep *ADDRP unchanged. */ -+ -+int -+dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton, -+ struct type *type, CORE_ADDR *addrp) -+{ -+ struct frame_info *frame = get_selected_frame (NULL); -+ const gdb_byte *data; -+ size_t size; -+ struct value *val; -+ -+ if (!dllbaton) -+ return 0; -+ -+ data = dwarf2_find_location_expression (dllbaton, &size, -+ get_frame_address_in_block (frame)); -+ if (data == NULL) -+ return 0; -+ -+ val = dwarf2_evaluate_loc_desc (type, frame, data, size, dllbaton->per_cu); -+ if (value_optimized_out (val)) -+ return 0; -+ -+ *addrp = value_as_address (val); -+ return 1; -+} -+ - /* Callback function for dwarf2_evaluate_loc_desc. */ - - static struct type * -@@ -1139,10 +1232,12 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, - - saved_ctx.gdbarch = ctx->gdbarch; - saved_ctx.addr_size = ctx->addr_size; -+ saved_ctx.ref_addr_size = ctx->ref_addr_size; - saved_ctx.offset = ctx->offset; - saved_ctx.baton = ctx->baton; - ctx->gdbarch = get_objfile_arch (dwarf2_per_cu_objfile (baton_local.per_cu)); - ctx->addr_size = dwarf2_per_cu_addr_size (baton_local.per_cu); -+ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (baton_local.per_cu); - ctx->offset = dwarf2_per_cu_text_offset (baton_local.per_cu); - ctx->baton = &baton_local; - -@@ -1150,10 +1245,95 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, - - ctx->gdbarch = saved_ctx.gdbarch; - ctx->addr_size = saved_ctx.addr_size; -+ ctx->ref_addr_size = saved_ctx.ref_addr_size; - ctx->offset = saved_ctx.offset; - ctx->baton = saved_ctx.baton; - } - -+static CORE_ADDR dwarf_expr_get_addr_index (void *baton, unsigned int index); -+ -+/* Virtual method table for dwarf2_evaluate_loc_desc_full below. */ -+ -+static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs = -+{ -+ dwarf_expr_read_reg, -+ dwarf_expr_read_mem, -+ dwarf_expr_frame_base, -+ dwarf_expr_frame_cfa, -+ dwarf_expr_frame_pc, -+ dwarf_expr_tls_address, -+ dwarf_expr_dwarf_call, -+ dwarf_expr_get_base_type, -+ dwarf_expr_push_dwarf_reg_entry_value, -+ dwarf_expr_get_addr_index, -+ dwarf_expr_object_address -+}; -+ -+/* Evaluate DWARF expression at DATA ... DATA + SIZE with its result readable -+ by dwarf_expr_fetch (RETVAL, 0). FRAME parameter can be NULL to call -+ get_selected_frame to find it. Returned dwarf_expr_context freeing is -+ pushed on the cleanup chain. */ -+ -+static void -+dwarf_expr_prep_ctx (struct dwarf_expr_context *ctx, struct frame_info *frame, -+ const gdb_byte *data, size_t size, -+ struct dwarf2_per_cu_data *per_cu) -+{ -+ struct dwarf_expr_baton baton; -+ struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); -+ volatile struct gdb_exception ex; -+ -+ baton.frame = frame; -+ baton.per_cu = per_cu; -+ baton.object_address = object_address; -+ -+ ctx->gdbarch = get_objfile_arch (objfile); -+ ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); -+ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); -+ ctx->offset = dwarf2_per_cu_text_offset (per_cu); -+ ctx->baton = &baton; -+ ctx->funcs = &dwarf_expr_ctx_funcs; -+ -+ dwarf_expr_eval (ctx, data, size); -+} -+ -+/* Evaluate DWARF expression at DLBATON expecting it produces exactly one -+ CORE_ADDR result on the DWARF stack stack. */ -+ -+CORE_ADDR -+dwarf_locexpr_baton_eval (struct dwarf2_locexpr_baton *dlbaton) -+{ -+ struct dwarf_expr_context *ctx; -+ CORE_ADDR retval; -+ struct cleanup *back_to; -+ -+ ctx = new_dwarf_expr_context (); -+ back_to = make_cleanup_free_dwarf_expr_context (ctx); -+ -+ dwarf_expr_prep_ctx (ctx, get_selected_frame (NULL), dlbaton->data, -+ dlbaton->size, dlbaton->per_cu); -+ -+ if (ctx->num_pieces > 0) -+ error (_("DW_OP_*piece is unsupported for DW_FORM_block")); -+ -+ retval = dwarf_expr_fetch_address (ctx, 0); -+ -+ if (ctx->location == DWARF_VALUE_REGISTER) -+ { -+ /* Inlined dwarf_expr_read_reg as we no longer have the baton. */ -+ -+ int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (ctx->gdbarch, retval); -+ struct type *type = builtin_type (ctx->gdbarch)->builtin_data_ptr; -+ struct frame_info *frame = get_selected_frame (NULL); -+ -+ retval = address_from_register (type, gdb_regnum, frame); -+ } -+ -+ do_cleanups (back_to); -+ -+ return retval; -+} -+ - /* Callback function for dwarf2_evaluate_loc_desc. - Fetch the address indexed by DW_OP_GNU_addr_index. */ - -@@ -2088,22 +2268,6 @@ invalid_synthetic_pointer (void) - "referenced via synthetic pointer")); - } - --/* Virtual method table for dwarf2_evaluate_loc_desc_full below. */ -- --static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs = --{ -- dwarf_expr_read_reg, -- dwarf_expr_read_mem, -- dwarf_expr_frame_base, -- dwarf_expr_frame_cfa, -- dwarf_expr_frame_pc, -- dwarf_expr_tls_address, -- dwarf_expr_dwarf_call, -- dwarf_expr_get_base_type, -- dwarf_expr_push_dwarf_reg_entry_value, -- dwarf_expr_get_addr_index --}; -- - /* Evaluate a location description, starting at DATA and with length - SIZE, to find the current location of variable of TYPE in the - context of FRAME. BYTE_OFFSET is applied after the contents are -@@ -2116,7 +2280,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - LONGEST byte_offset) - { - struct value *retval; -- struct dwarf_expr_baton baton; - struct dwarf_expr_context *ctx; - struct cleanup *old_chain, *value_chain; - struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); -@@ -2128,29 +2291,18 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - if (size == 0) - return allocate_optimized_out_value (type); - -- baton.frame = frame; -- baton.per_cu = per_cu; -- - ctx = new_dwarf_expr_context (); - old_chain = make_cleanup_free_dwarf_expr_context (ctx); - value_chain = make_cleanup_value_free_to_mark (value_mark ()); - -- ctx->gdbarch = get_objfile_arch (objfile); -- ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); -- ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); -- ctx->offset = dwarf2_per_cu_text_offset (per_cu); -- ctx->baton = &baton; -- ctx->funcs = &dwarf_expr_ctx_funcs; -- - TRY_CATCH (ex, RETURN_MASK_ERROR) - { -- dwarf_expr_eval (ctx, data, size); -+ dwarf_expr_prep_ctx (ctx, frame, data, size, per_cu); - } - if (ex.reason < 0) - { - if (ex.error == NOT_AVAILABLE_ERROR) - { -- do_cleanups (old_chain); - retval = allocate_value (type); - mark_value_bytes_unavailable (retval, 0, TYPE_LENGTH (type)); - return retval; -@@ -2214,6 +2366,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); - - do_cleanups (value_chain); -+ -+ /* Frame may be needed for check_typedef of TYPE_DYNAMIC. */ -+ make_cleanup_restore_selected_frame (); -+ select_frame (frame); -+ -+ /* object_address_set called here is required in ALLOCATE_VALUE's -+ CHECK_TYPEDEF for the object's possible -+ DW_OP_push_object_address. */ -+ object_address_set (address); -+ - retval = allocate_value_lazy (type); - VALUE_LVAL (retval) = lval_memory; - if (in_stack_memory) -@@ -4130,8 +4292,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, - dlbaton->per_cu); - } - --/* The set of location functions used with the DWARF-2 expression -- evaluator and location lists. */ -+/* The set of location functions used with the DWARF-2 location lists. */ - const struct symbol_computed_ops dwarf2_loclist_funcs = { - loclist_read_variable, - loclist_read_variable_at_entry, -@@ -4140,6 +4301,48 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = { - loclist_tracepoint_var_ref - }; - -+static struct value * -+missing_read_variable (struct symbol *symbol, struct frame_info *frame) -+{ -+ struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); -+ -+ gdb_assert (dlbaton == NULL); -+ error (_("Unable to resolve variable \"%s\""), SYMBOL_PRINT_NAME (symbol)); -+} -+ -+static int -+missing_read_needs_frame (struct symbol *symbol) -+{ -+ return 0; -+} -+ -+static void -+missing_describe_location (struct symbol *symbol, CORE_ADDR addr, -+ struct ui_file *stream) -+{ -+ fprintf_filtered (stream, _("a variable we are unable to resolve")); -+} -+ -+static void -+missing_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, -+ struct agent_expr *ax, struct axs_value *value) -+{ -+ struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); -+ -+ gdb_assert (dlbaton == NULL); -+ error (_("Unable to resolve variable \"%s\""), SYMBOL_PRINT_NAME (symbol)); -+} -+ -+/* The set of location functions used with the DWARF-2 evaluator when we are -+ unable to resolve the symbols. */ -+const struct symbol_computed_ops dwarf2_missing_funcs = { -+ missing_read_variable, -+ missing_read_variable, /* read_variable_at_entry */ -+ missing_read_needs_frame, -+ missing_describe_location, -+ missing_tracepoint_var_ref -+}; -+ - /* Provide a prototype to silence -Wmissing-prototypes. */ - extern initialize_file_ftype _initialize_dwarf2loc; - -diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h -index e9d06a3..bfa6776 100644 ---- a/gdb/dwarf2loc.h -+++ b/gdb/dwarf2loc.h -@@ -127,6 +127,15 @@ struct dwarf2_loclist_baton - - extern const struct symbol_computed_ops dwarf2_locexpr_funcs; - extern const struct symbol_computed_ops dwarf2_loclist_funcs; -+extern const struct symbol_computed_ops dwarf2_missing_funcs; -+ -+extern void object_address_set (CORE_ADDR address); -+ -+extern CORE_ADDR dwarf_locexpr_baton_eval -+ (struct dwarf2_locexpr_baton *dlbaton); -+ -+extern int dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton, -+ struct type *type, CORE_ADDR *addrp); - - /* Compile a DWARF location expression to an agent expression. - -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index deee5a2..b2f052b 100644 ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -64,20 +64,12 @@ - #include "gdbcore.h" /* for gnutarget */ - #include "gdb/gdb-index.h" - #include -+#include "gdb_bfd.h" - - #include - #include "gdb_string.h" - #include "gdb_assert.h" - #include --#ifdef HAVE_ZLIB_H --#include --#endif --#ifdef HAVE_MMAP --#include --#ifndef MAP_FAILED --#define MAP_FAILED ((void *) -1) --#endif --#endif - - typedef struct symbol *symbolp; - DEF_VEC_P (symbolp); -@@ -95,8 +87,6 @@ static int check_physname = 0; - /* When non-zero, do not reject deprecated .gdb_index sections. */ - static int use_deprecated_index_sections = 0; - --static int pagesize; -- - /* When set, the file that we're processing is known to have debugging - info for C++ namespaces. GCC 3.3.x did not produce this information, - but later versions do. */ -@@ -110,10 +100,6 @@ struct dwarf2_section_info - asection *asection; - gdb_byte *buffer; - bfd_size_type size; -- /* Not NULL if the section was actually mmapped. */ -- void *map_addr; -- /* Page aligned size of mmapped area. */ -- bfd_size_type map_len; - /* True if we have tried to read this section. */ - int readin; - }; -@@ -247,6 +233,10 @@ struct dwarf2_per_objfile - This is NULL if the table hasn't been allocated yet. */ - htab_t dwo_files; - -+ /* The shared '.dwz' file, if one exists. This is used when the -+ original data was compressed using 'dwz -m'. */ -+ struct dwz_file *dwz_file; -+ - /* A flag indicating wether this objfile has a section loaded at a - VMA of 0. */ - int has_section_at_zero; -@@ -505,15 +495,13 @@ struct dwarf2_cu - - struct dwarf2_per_cu_data - { -- /* The start offset and length of this compilation unit. 2**29-1 -- bytes should suffice to store the length of any compilation unit -- - if it doesn't, GDB will fall over anyway. -+ /* The start offset and length of this compilation unit. - NOTE: Unlike comp_unit_head.length, this length includes - initial_length_size. - If the DIE refers to a DWO file, this is always of the original die, - not the DWO file. */ - sect_offset offset; -- unsigned int length : 29; -+ unsigned int length; - - /* Flag indicating this compilation unit will be read in before - any of the current compilation units are processed. */ -@@ -528,6 +516,9 @@ struct dwarf2_per_cu_data - /* Non-zero if this CU is from .debug_types. */ - unsigned int is_debug_types : 1; - -+ /* Non-zero if this CU is from the .dwz file. */ -+ unsigned int is_dwz : 1; -+ - /* The section this CU/TU lives in. - If the DIE refers to a DWO file, this is always the original die, - not the DWO file. */ -@@ -715,6 +706,22 @@ struct dwo_file - htab_t tus; - }; - -+/* This represents a '.dwz' file. */ -+ -+struct dwz_file -+{ -+ /* A dwz file can only contain a few sections. */ -+ struct dwarf2_section_info abbrev; -+ struct dwarf2_section_info info; -+ struct dwarf2_section_info str; -+ struct dwarf2_section_info line; -+ struct dwarf2_section_info macro; -+ struct dwarf2_section_info gdb_index; -+ -+ /* The dwz's BFD. */ -+ bfd *dwz_bfd; -+}; -+ - /* Struct used to pass misc. parameters to read_die_and_children, et - al. which are used for both .debug_info and .debug_types dies. - All parameters here are unchanging for the life of the call. This -@@ -828,6 +835,12 @@ struct partial_die_info - /* Flag set if fixup_partial_die has been called on this die. */ - unsigned int fixup_called : 1; - -+ /* Flag set if DW_TAG_imported_unit uses DW_FORM_GNU_ref_alt. */ -+ unsigned int is_dwz : 1; -+ -+ /* Flag set if spec_offset uses DW_FORM_GNU_ref_alt. */ -+ unsigned int spec_is_dwz : 1; -+ - /* The name of this DIE. Normally the value of DW_AT_name, but - sometimes a default name for unnamed DIEs. */ - char *name; -@@ -1213,7 +1226,7 @@ static gdb_byte *read_partial_die (const struct die_reader_specs *, - unsigned int, - gdb_byte *); - --static struct partial_die_info *find_partial_die (sect_offset, -+static struct partial_die_info *find_partial_die (sect_offset, int, - struct dwarf2_cu *); - - static void fixup_partial_die (struct partial_die_info *, -@@ -1258,6 +1271,8 @@ static char *read_indirect_string (bfd *, gdb_byte *, - const struct comp_unit_head *, - unsigned int *); - -+static char *read_indirect_string_from_dwz (struct dwz_file *, LONGEST); -+ - static ULONGEST read_unsigned_leb128 (bfd *, gdb_byte *, unsigned int *); - - static LONGEST read_signed_leb128 (bfd *, gdb_byte *, unsigned int *); -@@ -1509,6 +1524,9 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu, - struct dwarf2_loclist_baton *baton, - struct attribute *attr); - -+static struct dwarf2_loclist_baton *dwarf2_attr_to_loclist_baton -+ (struct attribute *attr, struct dwarf2_cu *cu); -+ - static void dwarf2_symbol_mark_computed (struct attribute *attr, - struct symbol *sym, - struct dwarf2_cu *cu); -@@ -1524,7 +1542,7 @@ static hashval_t partial_die_hash (const void *item); - static int partial_die_eq (const void *item_lhs, const void *item_rhs); - - static struct dwarf2_per_cu_data *dwarf2_find_containing_comp_unit -- (sect_offset offset, struct objfile *objfile); -+ (sect_offset offset, unsigned int offset_in_dwz, struct objfile *objfile); - - static void init_one_comp_unit (struct dwarf2_cu *cu, - struct dwarf2_per_cu_data *per_cu); -@@ -1541,6 +1559,9 @@ static void age_cached_comp_units (void); - - static void free_one_cached_comp_unit (struct dwarf2_per_cu_data *); - -+static void fetch_die_type_attrs (struct die_info *die, struct type *type, -+ struct dwarf2_cu *cu); -+ - static struct type *set_die_type (struct die_info *, struct type *, - struct dwarf2_cu *); - -@@ -1569,6 +1590,9 @@ static struct type *get_die_type_at_offset (sect_offset, - - static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); - -+static struct dwarf2_locexpr_baton *dwarf2_attr_to_locexpr_baton -+ (struct attribute *attr, struct dwarf2_cu *cu); -+ - static void dwarf2_release_queue (void *dummy); - - static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, -@@ -1587,6 +1611,12 @@ static void find_file_and_directory (struct die_info *die, - static char *file_full_name (int file, struct line_header *lh, - const char *comp_dir); - -+static gdb_byte *read_and_check_comp_unit_head -+ (struct comp_unit_head *header, -+ struct dwarf2_section_info *section, -+ struct dwarf2_section_info *abbrev_section, gdb_byte *info_ptr, -+ int is_debug_types_section); -+ - static void init_cutu_and_read_dies - (struct dwarf2_per_cu_data *this_cu, struct abbrev_table *abbrev_table, - int use_existing_cu, int keep, -@@ -1608,8 +1638,6 @@ static struct dwo_unit *lookup_dwo_type_unit - - static void free_dwo_file_cleanup (void *); - --static void munmap_section_buffer (struct dwarf2_section_info *); -- - static void process_cu_includes (void); - - #if WORDS_BIGENDIAN -@@ -1779,85 +1807,6 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames) - dwarf2_per_objfile->has_section_at_zero = 1; - } - --/* Decompress a section that was compressed using zlib. Store the -- decompressed buffer, and its size, in OUTBUF and OUTSIZE. */ -- --static void --zlib_decompress_section (struct objfile *objfile, asection *sectp, -- gdb_byte **outbuf, bfd_size_type *outsize) --{ -- bfd *abfd = sectp->owner; --#ifndef HAVE_ZLIB_H -- error (_("Support for zlib-compressed DWARF data (from '%s') " -- "is disabled in this copy of GDB"), -- bfd_get_filename (abfd)); --#else -- bfd_size_type compressed_size = bfd_get_section_size (sectp); -- gdb_byte *compressed_buffer = xmalloc (compressed_size); -- struct cleanup *cleanup = make_cleanup (xfree, compressed_buffer); -- bfd_size_type uncompressed_size; -- gdb_byte *uncompressed_buffer; -- z_stream strm; -- int rc; -- int header_size = 12; -- -- if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 -- || bfd_bread (compressed_buffer, -- compressed_size, abfd) != compressed_size) -- error (_("Dwarf Error: Can't read DWARF data from '%s'"), -- bfd_get_filename (abfd)); -- -- /* Read the zlib header. In this case, it should be "ZLIB" followed -- by the uncompressed section size, 8 bytes in big-endian order. */ -- if (compressed_size < header_size -- || strncmp (compressed_buffer, "ZLIB", 4) != 0) -- error (_("Dwarf Error: Corrupt DWARF ZLIB header from '%s'"), -- bfd_get_filename (abfd)); -- uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8; -- uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8; -- uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8; -- uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8; -- uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8; -- uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8; -- uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8; -- uncompressed_size += compressed_buffer[11]; -- -- /* It is possible the section consists of several compressed -- buffers concatenated together, so we uncompress in a loop. */ -- strm.zalloc = NULL; -- strm.zfree = NULL; -- strm.opaque = NULL; -- strm.avail_in = compressed_size - header_size; -- strm.next_in = (Bytef*) compressed_buffer + header_size; -- strm.avail_out = uncompressed_size; -- uncompressed_buffer = obstack_alloc (&objfile->objfile_obstack, -- uncompressed_size); -- rc = inflateInit (&strm); -- while (strm.avail_in > 0) -- { -- if (rc != Z_OK) -- error (_("Dwarf Error: setting up DWARF uncompression in '%s': %d"), -- bfd_get_filename (abfd), rc); -- strm.next_out = ((Bytef*) uncompressed_buffer -- + (uncompressed_size - strm.avail_out)); -- rc = inflate (&strm, Z_FINISH); -- if (rc != Z_STREAM_END) -- error (_("Dwarf Error: zlib error uncompressing from '%s': %d"), -- bfd_get_filename (abfd), rc); -- rc = inflateReset (&strm); -- } -- rc = inflateEnd (&strm); -- if (rc != Z_OK -- || strm.avail_out != 0) -- error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"), -- bfd_get_filename (abfd), rc); -- -- do_cleanups (cleanup); -- *outbuf = uncompressed_buffer; -- *outsize = uncompressed_size; --#endif --} -- - /* A helper function that decides whether a section is empty, - or not present. */ - -@@ -1884,56 +1833,27 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) - if (info->readin) - return; - info->buffer = NULL; -- info->map_addr = NULL; - info->readin = 1; - - if (dwarf2_section_empty_p (info)) - return; - -- /* Note that ABFD may not be from OBJFILE, e.g. a DWO section. */ - abfd = sectp->owner; - -- /* Check if the file has a 4-byte header indicating compression. */ -- if (info->size > sizeof (header) -- && bfd_seek (abfd, sectp->filepos, SEEK_SET) == 0 -- && bfd_bread (header, sizeof (header), abfd) == sizeof (header)) -- { -- /* Upon decompression, update the buffer and its size. */ -- if (strncmp (header, "ZLIB", sizeof (header)) == 0) -- { -- zlib_decompress_section (objfile, sectp, &info->buffer, -- &info->size); -- return; -- } -- } -- --#ifdef HAVE_MMAP -- if (pagesize == 0) -- pagesize = getpagesize (); -- -- /* Only try to mmap sections which are large enough: we don't want to -- waste space due to fragmentation. Also, only try mmap for sections -- without relocations. */ -- -- if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0) -+ /* If the section has relocations, we must read it ourselves. -+ Otherwise we attach it to the BFD. */ -+ if ((sectp->flags & SEC_RELOC) == 0) - { -- info->buffer = bfd_mmap (abfd, 0, info->size, PROT_READ, -- MAP_PRIVATE, sectp->filepos, -- &info->map_addr, &info->map_len); -+ const gdb_byte *bytes = gdb_bfd_map_section (sectp, &info->size); - -- if ((caddr_t)info->buffer != MAP_FAILED) -- { --#if HAVE_POSIX_MADVISE -- posix_madvise (info->map_addr, info->map_len, POSIX_MADV_WILLNEED); --#endif -- return; -- } -+ /* We have to cast away const here for historical reasons. -+ Fixing dwarf2read to be const-correct would be quite nice. */ -+ info->buffer = (gdb_byte *) bytes; -+ return; - } --#endif - -- /* If we get here, we are a normal, not-compressed section. */ -- info->buffer = buf -- = obstack_alloc (&objfile->objfile_obstack, info->size); -+ buf = obstack_alloc (&objfile->objfile_obstack, info->size); -+ info->buffer = buf; - - /* When debugging .o files, we may need to apply relocations; see - http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . -@@ -2009,6 +1929,111 @@ dwarf2_get_section_info (struct objfile *objfile, - *sizep = info->size; - } - -+/* A helper function to find the sections for a .dwz file. */ -+ -+static void -+locate_dwz_sections (bfd *abfd, asection *sectp, void *arg) -+{ -+ struct dwz_file *dwz_file = arg; -+ -+ /* Note that we only support the standard ELF names, because .dwz -+ is ELF-only (at the time of writing). */ -+ if (section_is_p (sectp->name, &dwarf2_elf_names.abbrev)) -+ { -+ dwz_file->abbrev.asection = sectp; -+ dwz_file->abbrev.size = bfd_get_section_size (sectp); -+ } -+ else if (section_is_p (sectp->name, &dwarf2_elf_names.info)) -+ { -+ dwz_file->info.asection = sectp; -+ dwz_file->info.size = bfd_get_section_size (sectp); -+ } -+ else if (section_is_p (sectp->name, &dwarf2_elf_names.str)) -+ { -+ dwz_file->str.asection = sectp; -+ dwz_file->str.size = bfd_get_section_size (sectp); -+ } -+ else if (section_is_p (sectp->name, &dwarf2_elf_names.line)) -+ { -+ dwz_file->line.asection = sectp; -+ dwz_file->line.size = bfd_get_section_size (sectp); -+ } -+ else if (section_is_p (sectp->name, &dwarf2_elf_names.macro)) -+ { -+ dwz_file->macro.asection = sectp; -+ dwz_file->macro.size = bfd_get_section_size (sectp); -+ } -+ else if (section_is_p (sectp->name, &dwarf2_elf_names.gdb_index)) -+ { -+ dwz_file->gdb_index.asection = sectp; -+ dwz_file->gdb_index.size = bfd_get_section_size (sectp); -+ } -+} -+ -+/* Open the separate '.dwz' debug file, if needed. Error if the file -+ cannot be found. */ -+ -+static struct dwz_file * -+dwarf2_get_dwz_file (void) -+{ -+ bfd *abfd, *dwz_bfd; -+ asection *section; -+ gdb_byte *data; -+ struct cleanup *cleanup; -+ const char *filename; -+ struct dwz_file *result; -+ -+ if (dwarf2_per_objfile->dwz_file != NULL) -+ return dwarf2_per_objfile->dwz_file; -+ -+ abfd = dwarf2_per_objfile->objfile->obfd; -+ section = bfd_get_section_by_name (abfd, ".gnu_debugaltlink"); -+ if (section == NULL) -+ error (_("could not find '.gnu_debugaltlink' section")); -+ if (!bfd_malloc_and_get_section (abfd, section, &data)) -+ error (_("could not read '.gnu_debugaltlink' section: %s"), -+ bfd_errmsg (bfd_get_error ())); -+ cleanup = make_cleanup (xfree, data); -+ -+ filename = data; -+ if (!IS_ABSOLUTE_PATH (filename)) -+ { -+ char *abs = gdb_realpath (dwarf2_per_objfile->objfile->name); -+ char *rel; -+ -+ make_cleanup (xfree, abs); -+ abs = ldirname (abs); -+ make_cleanup (xfree, abs); -+ -+ rel = concat (abs, SLASH_STRING, filename, (char *) NULL); -+ make_cleanup (xfree, rel); -+ filename = rel; -+ } -+ -+ /* The format is just a NUL-terminated file name, followed by the -+ build-id. For now, though, we ignore the build-id. */ -+ dwz_bfd = gdb_bfd_open (filename, gnutarget, -1); -+ if (dwz_bfd == NULL) -+ error (_("could not read '%s': %s"), filename, -+ bfd_errmsg (bfd_get_error ())); -+ -+ if (!bfd_check_format (dwz_bfd, bfd_object)) -+ { -+ gdb_bfd_unref (dwz_bfd); -+ error (_("file '%s' was not usable: %s"), filename, -+ bfd_errmsg (bfd_get_error ())); -+ } -+ -+ result = OBSTACK_ZALLOC (&dwarf2_per_objfile->objfile->objfile_obstack, -+ struct dwz_file); -+ result->dwz_bfd = dwz_bfd; -+ -+ bfd_map_over_sections (dwz_bfd, locate_dwz_sections, result); -+ -+ do_cleanups (cleanup); -+ -+ return result; -+} - - /* DWARF quick_symbols_functions support. */ - -@@ -2279,23 +2304,19 @@ extract_cu_value (const char *bytes, ULONGEST *result) - return 1; - } - --/* Read the CU list from the mapped index, and use it to create all -- the CU objects for this objfile. Return 0 if something went wrong, -- 1 if everything went ok. */ -+/* A helper for create_cus_from_index that handles a given list of -+ CUs. */ - - static int --create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list, -- offset_type cu_list_elements) -+create_cus_from_index_list (struct objfile *objfile, -+ const gdb_byte *cu_list, offset_type n_elements, -+ struct dwarf2_section_info *section, -+ int is_dwz, -+ int base_offset) - { - offset_type i; - -- dwarf2_per_objfile->n_comp_units = cu_list_elements / 2; -- dwarf2_per_objfile->all_comp_units -- = obstack_alloc (&objfile->objfile_obstack, -- dwarf2_per_objfile->n_comp_units -- * sizeof (struct dwarf2_per_cu_data *)); -- -- for (i = 0; i < cu_list_elements; i += 2) -+ for (i = 0; i < n_elements; i += 2) - { - struct dwarf2_per_cu_data *the_cu; - ULONGEST offset, length; -@@ -2310,15 +2331,45 @@ create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list, - the_cu->offset.sect_off = offset; - the_cu->length = length; - the_cu->objfile = objfile; -- the_cu->info_or_types_section = &dwarf2_per_objfile->info; -+ the_cu->info_or_types_section = section; - the_cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack, - struct dwarf2_per_cu_quick_data); -- dwarf2_per_objfile->all_comp_units[i / 2] = the_cu; -+ the_cu->is_dwz = is_dwz; -+ dwarf2_per_objfile->all_comp_units[base_offset + i / 2] = the_cu; - } - - return 1; - } - -+/* Read the CU list from the mapped index, and use it to create all -+ the CU objects for this objfile. Return 0 if something went wrong, -+ 1 if everything went ok. */ -+ -+static int -+create_cus_from_index (struct objfile *objfile, -+ const gdb_byte *cu_list, offset_type cu_list_elements, -+ const gdb_byte *dwz_list, offset_type dwz_elements) -+{ -+ struct dwz_file *dwz; -+ -+ dwarf2_per_objfile->n_comp_units = (cu_list_elements + dwz_elements) / 2; -+ dwarf2_per_objfile->all_comp_units -+ = obstack_alloc (&objfile->objfile_obstack, -+ dwarf2_per_objfile->n_comp_units -+ * sizeof (struct dwarf2_per_cu_data *)); -+ -+ if (!create_cus_from_index_list (objfile, cu_list, cu_list_elements, -+ &dwarf2_per_objfile->info, 0, 0)) -+ return 0; -+ -+ if (dwz_elements == 0) -+ return 1; -+ -+ dwz = dwarf2_get_dwz_file (); -+ return create_cus_from_index_list (objfile, dwz_list, dwz_elements, -+ &dwz->info, 1, cu_list_elements / 2); -+} -+ - /* Create the signatured type hash table from the index. */ - - static int -@@ -2508,33 +2559,44 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name, - } - } - --/* Read the index file. If everything went ok, initialize the "quick" -- elements of all the CUs and return 1. Otherwise, return 0. */ -+/* A helper function that reads the .gdb_index from SECTION and fills -+ in MAP. FILENAME is the name of the file containing the section; -+ it is used for error reporting. DEPRECATED_OK is nonzero if it is -+ ok to use deprecated sections. -+ -+ CU_LIST, CU_LIST_ELEMENTS, TYPES_LIST, and TYPES_LIST_ELEMENTS are -+ out parameters that are filled in with information about the CU and -+ TU lists in the section. -+ -+ Returns 1 if all went well, 0 otherwise. */ - - static int --dwarf2_read_index (struct objfile *objfile) -+read_index_from_section (struct objfile *objfile, -+ const char *filename, -+ int deprecated_ok, -+ struct dwarf2_section_info *section, -+ struct mapped_index *map, -+ const gdb_byte **cu_list, -+ offset_type *cu_list_elements, -+ const gdb_byte **types_list, -+ offset_type *types_list_elements) - { - char *addr; -- struct mapped_index *map; -+ offset_type version; - offset_type *metadata; -- const gdb_byte *cu_list; -- const gdb_byte *types_list = NULL; -- offset_type version, cu_list_elements; -- offset_type types_list_elements = 0; - int i; - -- if (dwarf2_section_empty_p (&dwarf2_per_objfile->gdb_index)) -+ if (dwarf2_section_empty_p (section)) - return 0; - - /* Older elfutils strip versions could keep the section in the main - executable while splitting it for the separate debug info file. */ -- if ((bfd_get_file_flags (dwarf2_per_objfile->gdb_index.asection) -- & SEC_HAS_CONTENTS) == 0) -+ if ((bfd_get_file_flags (section->asection) & SEC_HAS_CONTENTS) == 0) - return 0; - -- dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index); -+ dwarf2_read_section (objfile, section); - -- addr = dwarf2_per_objfile->gdb_index.buffer; -+ addr = section->buffer; - /* Version check. */ - version = MAYBE_SWAP (*(offset_type *) addr); - /* Versions earlier than 3 emitted every copy of a psymbol. This -@@ -2547,7 +2609,7 @@ dwarf2_read_index (struct objfile *objfile) - if (!warning_printed) - { - warning (_("Skipping obsolete .gdb_index section in %s."), -- objfile->name); -+ filename); - warning_printed = 1; - } - return 0; -@@ -2560,7 +2622,7 @@ dwarf2_read_index (struct objfile *objfile) - set breakpoints on inlined functions by name, so we ignore these - indices unless the user has done - "set use-deprecated-index-sections on". */ -- if (version < 6 && !use_deprecated_index_sections) -+ if (version < 6 && !deprecated_ok) - { - static int warning_printed = 0; - if (!warning_printed) -@@ -2569,7 +2631,7 @@ dwarf2_read_index (struct objfile *objfile) - Skipping deprecated .gdb_index section in %s.\n\ - Do \"set use-deprecated-index-sections on\" before the file is read\n\ - to use the section anyway."), -- objfile->name); -+ filename); - warning_printed = 1; - } - return 0; -@@ -2579,22 +2641,21 @@ to use the section anyway."), - if (version > 7) - return 0; - -- map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index); - map->version = version; -- map->total_size = dwarf2_per_objfile->gdb_index.size; -+ map->total_size = section->size; - - metadata = (offset_type *) (addr + sizeof (offset_type)); - - i = 0; -- cu_list = addr + MAYBE_SWAP (metadata[i]); -- cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i])) -- / 8); -+ *cu_list = addr + MAYBE_SWAP (metadata[i]); -+ *cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i])) -+ / 8); - ++i; - -- types_list = addr + MAYBE_SWAP (metadata[i]); -- types_list_elements = ((MAYBE_SWAP (metadata[i + 1]) -- - MAYBE_SWAP (metadata[i])) -- / 8); -+ *types_list = addr + MAYBE_SWAP (metadata[i]); -+ *types_list_elements = ((MAYBE_SWAP (metadata[i + 1]) -+ - MAYBE_SWAP (metadata[i])) -+ / 8); - ++i; - - map->address_table = addr + MAYBE_SWAP (metadata[i]); -@@ -2610,11 +2671,55 @@ to use the section anyway."), - - map->constant_pool = addr + MAYBE_SWAP (metadata[i]); - -+ return 1; -+} -+ -+ -+/* Read the index file. If everything went ok, initialize the "quick" -+ elements of all the CUs and return 1. Otherwise, return 0. */ -+ -+static int -+dwarf2_read_index (struct objfile *objfile) -+{ -+ struct mapped_index local_map, *map; -+ const gdb_byte *cu_list, *types_list, *dwz_list = NULL; -+ offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0; -+ -+ if (!read_index_from_section (objfile, objfile->name, -+ use_deprecated_index_sections, -+ &dwarf2_per_objfile->gdb_index, &local_map, -+ &cu_list, &cu_list_elements, -+ &types_list, &types_list_elements)) -+ return 0; -+ - /* Don't use the index if it's empty. */ -- if (map->symbol_table_slots == 0) -+ if (local_map.symbol_table_slots == 0) - return 0; - -- if (!create_cus_from_index (objfile, cu_list, cu_list_elements)) -+ /* If there is a .dwz file, read it so we can get its CU list as -+ well. */ -+ if (bfd_get_section_by_name (objfile->obfd, ".gnu_debugaltlink") != NULL) -+ { -+ struct dwz_file *dwz = dwarf2_get_dwz_file (); -+ struct mapped_index dwz_map; -+ const gdb_byte *dwz_types_ignore; -+ offset_type dwz_types_elements_ignore; -+ -+ if (!read_index_from_section (objfile, bfd_get_filename (dwz->dwz_bfd), -+ 1, -+ &dwz->gdb_index, &dwz_map, -+ &dwz_list, &dwz_list_elements, -+ &dwz_types_ignore, -+ &dwz_types_elements_ignore)) -+ { -+ warning (_("could not read '.gdb_index' section from %s; skipping"), -+ bfd_get_filename (dwz->dwz_bfd)); -+ return 0; -+ } -+ } -+ -+ if (!create_cus_from_index (objfile, cu_list, cu_list_elements, -+ dwz_list, dwz_list_elements)) - return 0; - - if (types_list_elements) -@@ -2635,7 +2740,10 @@ to use the section anyway."), - return 0; - } - -- create_addrmap_from_index (objfile, map); -+ create_addrmap_from_index (objfile, &local_map); -+ -+ map = obstack_alloc (&objfile->objfile_obstack, sizeof (struct mapped_index)); -+ *map = local_map; - - dwarf2_per_objfile->index_table = map; - dwarf2_per_objfile->using_index = 1; -@@ -3686,6 +3794,22 @@ read_comp_unit_head (struct comp_unit_head *cu_header, - return info_ptr; - } - -+/* Helper function that returns the proper abbrev section for -+ THIS_CU. */ -+ -+static struct dwarf2_section_info * -+get_abbrev_section_for_cu (struct dwarf2_per_cu_data *this_cu) -+{ -+ struct dwarf2_section_info *abbrev; -+ -+ if (this_cu->is_dwz) -+ abbrev = &dwarf2_get_dwz_file ()->abbrev; -+ else -+ abbrev = &dwarf2_per_objfile->abbrev; -+ -+ return abbrev; -+} -+ - /* Subroutine of read_and_check_comp_unit_head and - read_and_check_type_unit_head to simplify them. - Perform various error checking on the header. */ -@@ -3704,8 +3828,7 @@ error_check_comp_unit_head (struct comp_unit_head *header, - filename); - - if (header->abbrev_offset.sect_off -- >= dwarf2_section_size (dwarf2_per_objfile->objfile, -- &dwarf2_per_objfile->abbrev)) -+ >= dwarf2_section_size (dwarf2_per_objfile->objfile, abbrev_section)) - error (_("Dwarf Error: bad offset (0x%lx) in compilation unit header " - "(offset 0x%lx + 6) [in module %s]"), - (long) header->abbrev_offset.sect_off, (long) header->offset.sect_off, -@@ -3942,6 +4065,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file, - { - bfd *abfd; - gdb_byte *info_ptr, *end_ptr; -+ struct dwarf2_section_info *abbrev_section; - - dwarf2_read_section (objfile, section); - info_ptr = section->buffer; -@@ -3953,6 +4077,11 @@ create_debug_types_hash_table (struct dwo_file *dwo_file, - not present, in which case section->asection will be NULL. */ - abfd = section->asection->owner; - -+ if (dwo_file) -+ abbrev_section = &dwo_file->sections.abbrev; -+ else -+ abbrev_section = &dwarf2_per_objfile->abbrev; -+ - if (types_htab == NULL) - { - if (dwo_file) -@@ -4192,7 +4321,8 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu, - dwarf2_read_section (objfile, section); - - begin_info_ptr = info_ptr = section->buffer + this_cu->offset.sect_off; -- abbrev_section = &dwarf2_per_objfile->abbrev; -+ -+ abbrev_section = get_abbrev_section_for_cu (this_cu); - - if (use_existing_cu && this_cu->cu != NULL) - { -@@ -4574,7 +4704,7 @@ init_cutu_and_read_dies_simple (struct dwarf2_per_cu_data *this_cu, - void *data) - { - init_cutu_and_read_dies_no_follow (this_cu, -- &dwarf2_per_objfile->abbrev, -+ get_abbrev_section_for_cu (this_cu), - NULL, - die_reader_func, data); - } -@@ -5202,6 +5332,9 @@ set_partial_user (struct objfile *objfile) - struct partial_symtab *pst = per_cu->v.psymtab; - int j; - -+ if (pst == NULL) -+ continue; -+ - for (j = 0; j < pst->number_of_dependencies; ++j) - { - /* Set the 'user' field only if it is not already set. */ -@@ -5296,38 +5429,32 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu) - load_partial_comp_unit_reader, NULL); - } - --/* Create a list of all compilation units in OBJFILE. -- This is only done for -readnow and building partial symtabs. */ -- - static void --create_all_comp_units (struct objfile *objfile) -+read_comp_units_from_section (struct objfile *objfile, -+ struct dwarf2_section_info *section, -+ unsigned int is_dwz, -+ int *n_allocated, -+ int *n_comp_units, -+ struct dwarf2_per_cu_data ***all_comp_units) - { -- int n_allocated; -- int n_comp_units; -- struct dwarf2_per_cu_data **all_comp_units; - gdb_byte *info_ptr; -+ bfd *abfd = section->asection->owner; - -- dwarf2_read_section (objfile, &dwarf2_per_objfile->info); -- info_ptr = dwarf2_per_objfile->info.buffer; -+ dwarf2_read_section (objfile, section); - -- n_comp_units = 0; -- n_allocated = 10; -- all_comp_units = xmalloc (n_allocated -- * sizeof (struct dwarf2_per_cu_data *)); -+ info_ptr = section->buffer; - -- while (info_ptr < dwarf2_per_objfile->info.buffer -- + dwarf2_per_objfile->info.size) -+ while (info_ptr < section->buffer + section->size) - { - unsigned int length, initial_length_size; - struct dwarf2_per_cu_data *this_cu; - sect_offset offset; - -- offset.sect_off = info_ptr - dwarf2_per_objfile->info.buffer; -+ offset.sect_off = info_ptr - section->buffer; - - /* Read just enough information to find out where the next - compilation unit is. */ -- length = read_initial_length (objfile->obfd, info_ptr, -- &initial_length_size); -+ length = read_initial_length (abfd, info_ptr, &initial_length_size); - - /* Save the compilation unit for later lookup. */ - this_cu = obstack_alloc (&objfile->objfile_obstack, -@@ -5335,20 +5462,50 @@ create_all_comp_units (struct objfile *objfile) - memset (this_cu, 0, sizeof (*this_cu)); - this_cu->offset = offset; - this_cu->length = length + initial_length_size; -+ this_cu->is_dwz = is_dwz; - this_cu->objfile = objfile; -- this_cu->info_or_types_section = &dwarf2_per_objfile->info; -+ this_cu->info_or_types_section = section; - -- if (n_comp_units == n_allocated) -+ if (*n_comp_units == *n_allocated) - { -- n_allocated *= 2; -- all_comp_units = xrealloc (all_comp_units, -- n_allocated -- * sizeof (struct dwarf2_per_cu_data *)); -+ *n_allocated *= 2; -+ *all_comp_units = xrealloc (*all_comp_units, -+ *n_allocated -+ * sizeof (struct dwarf2_per_cu_data *)); - } -- all_comp_units[n_comp_units++] = this_cu; -+ (*all_comp_units)[*n_comp_units] = this_cu; -+ ++*n_comp_units; - - info_ptr = info_ptr + this_cu->length; - } -+} -+ -+/* Create a list of all compilation units in OBJFILE. -+ This is only done for -readnow and building partial symtabs. */ -+ -+static void -+create_all_comp_units (struct objfile *objfile) -+{ -+ int n_allocated; -+ int n_comp_units; -+ struct dwarf2_per_cu_data **all_comp_units; -+ -+ n_comp_units = 0; -+ n_allocated = 10; -+ all_comp_units = xmalloc (n_allocated -+ * sizeof (struct dwarf2_per_cu_data *)); -+ -+ read_comp_units_from_section (objfile, &dwarf2_per_objfile->info, 0, -+ &n_allocated, &n_comp_units, &all_comp_units); -+ -+ if (bfd_get_section_by_name (objfile->obfd, ".gnu_debugaltlink") != NULL) -+ { -+ struct dwz_file *dwz = dwarf2_get_dwz_file (); -+ -+ read_comp_units_from_section (objfile, &dwz->info, 1, -+ &n_allocated, &n_comp_units, -+ &all_comp_units); -+ } - - dwarf2_per_objfile->all_comp_units - = obstack_alloc (&objfile->objfile_obstack, -@@ -5441,6 +5598,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc, - } - - per_cu = dwarf2_find_containing_comp_unit (pdi->d.offset, -+ pdi->is_dwz, - cu->objfile); - - /* Go read the partial unit, if needed. */ -@@ -5498,7 +5656,8 @@ partial_die_parent_scope (struct partial_die_info *pdi, - - real_pdi = pdi; - while (real_pdi->has_specification) -- real_pdi = find_partial_die (real_pdi->spec_offset, cu); -+ real_pdi = find_partial_die (real_pdi->spec_offset, -+ real_pdi->spec_is_dwz, cu); - - parent = real_pdi->die_parent; - if (parent == NULL) -@@ -5998,6 +6157,9 @@ skip_one_die (const struct die_reader_specs *reader, gdb_byte *info_ptr, - else - info_ptr += cu->header.offset_size; - break; -+ case DW_FORM_GNU_ref_alt: -+ info_ptr += cu->header.offset_size; -+ break; - case DW_FORM_addr: - info_ptr += cu->header.addr_size; - break; -@@ -6027,6 +6189,7 @@ skip_one_die (const struct die_reader_specs *reader, gdb_byte *info_ptr, - break; - case DW_FORM_sec_offset: - case DW_FORM_strp: -+ case DW_FORM_GNU_strp_alt: - info_ptr += cu->header.offset_size; - break; - case DW_FORM_exprloc: -@@ -6694,7 +6857,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu, - it, by scanning the DIE's below the compilation unit. */ - get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu); - -- static_block = end_symtab_get_static_block (highpc + baseaddr, objfile, 0); -+ static_block -+ = end_symtab_get_static_block (highpc + baseaddr, objfile, 0, -+ per_cu->s.imported_symtabs != NULL); - - /* If the comp unit has DW_AT_ranges, it may have discontiguous ranges. - Also, DW_AT_ranges may record ranges not belonging to any child DIEs -@@ -6845,9 +7010,11 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) - struct dwarf2_per_cu_data *per_cu; - struct symtab *imported_symtab; - sect_offset offset; -+ int is_dwz; - - offset = dwarf2_get_ref_die_offset (attr); -- per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile); -+ is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz); -+ per_cu = dwarf2_find_containing_comp_unit (offset, is_dwz, cu->objfile); - - /* Queue the unit, if needed. */ - if (maybe_queue_comp_unit (cu, per_cu, cu->language)) -@@ -8116,24 +8283,21 @@ try_open_dwo_file (const char *file_name) - if (desc < 0) - return NULL; - -- sym_bfd = bfd_fopen (absolute_name, gnutarget, FOPEN_RB, desc); -+ sym_bfd = gdb_bfd_open (absolute_name, gnutarget, desc); - if (!sym_bfd) - { - xfree (absolute_name); - return NULL; - } -+ xfree (absolute_name); - bfd_set_cacheable (sym_bfd, 1); - - if (!bfd_check_format (sym_bfd, bfd_object)) - { -- bfd_close (sym_bfd); /* This also closes desc. */ -- xfree (absolute_name); -+ gdb_bfd_unref (sym_bfd); /* This also closes desc. */ - return NULL; - } - -- /* bfd_usrdata exists for applications and libbfd must not touch it. */ -- gdb_assert (bfd_usrdata (sym_bfd) == NULL); -- - return sym_bfd; - } - -@@ -8325,20 +8489,7 @@ free_dwo_file (struct dwo_file *dwo_file, struct objfile *objfile) - struct dwarf2_section_info *section; - - gdb_assert (dwo_file->dwo_bfd != objfile->obfd); -- bfd_close (dwo_file->dwo_bfd); -- -- munmap_section_buffer (&dwo_file->sections.abbrev); -- munmap_section_buffer (&dwo_file->sections.info); -- munmap_section_buffer (&dwo_file->sections.line); -- munmap_section_buffer (&dwo_file->sections.loc); -- munmap_section_buffer (&dwo_file->sections.str); -- munmap_section_buffer (&dwo_file->sections.str_offsets); -- -- for (ix = 0; -- VEC_iterate (dwarf2_section_info_def, dwo_file->sections.types, -- ix, section); -- ++ix) -- munmap_section_buffer (section); -+ gdb_bfd_unref (dwo_file->dwo_bfd); - - VEC_free (dwarf2_section_info_def, dwo_file->sections.types); - } -@@ -10721,6 +10872,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) - new_symbol (die, this_type, cu); - } - -+/* Create a new array dimension referencing its target type TYPE. -+ -+ Multidimensional arrays are internally represented as a stack of -+ singledimensional arrays being referenced by their TYPE_TARGET_TYPE. */ -+ -+static struct type * -+create_single_array_dimension (struct type *type, struct type *range_type, -+ struct die_info *die, struct dwarf2_cu *cu) -+{ -+ type = create_array_type (NULL, type, range_type); -+ -+ /* These generic type attributes need to be fetched by -+ evaluate_subexp_standard 's call of -+ value_subscripted_rvalue only for the innermost array type. */ -+ fetch_die_type_attrs (die, type, cu); -+ -+ /* These generic type attributes are checked for allocated/associated -+ validity while accessing FIELD_LOC_KIND_DWARF_BLOCK. */ -+ fetch_die_type_attrs (die, range_type, cu); -+ -+ return type; -+} -+ - /* Extract all information from a DW_TAG_array_type DIE and put it in - the DIE's type field. For now, this only handles one dimensional - arrays. */ -@@ -10734,7 +10908,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) - struct type *element_type, *range_type, *index_type; - struct type **range_types = NULL; - struct attribute *attr; -- int ndim = 0; -+ int ndim = 0, i; - struct cleanup *back_to; - char *name; - -@@ -10787,17 +10961,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) - type = element_type; - - if (read_array_order (die, cu) == DW_ORD_col_major) -- { -- int i = 0; -- -- while (i < ndim) -- type = create_array_type (NULL, type, range_types[i++]); -- } -- else -- { -- while (ndim-- > 0) -- type = create_array_type (NULL, type, range_types[ndim]); -- } -+ for (i = 0; i < ndim; i++) -+ type = create_single_array_dimension (type, range_types[i], die, cu); -+ else /* (read_array_order (die, cu) == DW_ORD_row_major) */ -+ for (i = ndim - 1; i >= 0; i--) -+ type = create_single_array_dimension (type, range_types[i], die, cu); -+ -+ /* Data locations should be set only for the outermost dimension as they -+ would be confusing for the dereferenced offset on the inner ones. */ -+ attr = dwarf2_attr (die, DW_AT_data_location, cu); -+ if (attr_form_is_block (attr)) -+ TYPE_DATA_LOCATION_DWARF_BLOCK (type) -+ = dwarf2_attr_to_locexpr_baton (attr, cu); -+ gdb_assert (!TYPE_DATA_LOCATION_IS_ADDR (type)); - - /* Understand Dwarf2 support for vector types (like they occur on - the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -11281,29 +11457,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) - struct gdbarch *gdbarch = get_objfile_arch (objfile); - struct type *type, *range_type, *index_type, *char_type; - struct attribute *attr; -- unsigned int length; -+ int length; -+ -+ index_type = objfile_type (objfile)->builtin_int; -+ /* RANGE_TYPE is allocated from OBJFILE, not as a permanent type. */ -+ range_type = alloc_type (objfile); -+ /* LOW_BOUND and HIGH_BOUND are set for real below. */ -+ range_type = create_range_type (range_type, index_type, 0, -1); -+ -+ /* C/C++ should probably have the low bound 0 but C/C++ does not use -+ DW_TAG_string_type. */ -+ TYPE_LOW_BOUND (range_type) = 1; - - attr = dwarf2_attr (die, DW_AT_string_length, cu); -- if (attr) -+ if (attr && attr_form_is_block (attr)) - { -- length = DW_UNSND (attr); -+ /* Security check for a size overflow. */ -+ if (DW_BLOCK (attr)->size + 2 < DW_BLOCK (attr)->size) -+ TYPE_HIGH_BOUND (range_type) = 1; -+ /* Extend the DWARF block by a new DW_OP_deref/DW_OP_deref_size -+ instruction as DW_AT_string_length specifies the length location, not -+ its value. */ -+ else -+ { -+ struct dwarf2_locexpr_baton *length_baton = NULL; -+ struct dwarf_block *blk = DW_BLOCK (attr); -+ -+ /* Turn any single DW_OP_reg* into DW_OP_breg*(0) but clearing -+ DW_OP_deref* in such case. */ -+ -+ if (blk->size == 1 && blk->data[0] >= DW_OP_reg0 -+ && blk->data[0] <= DW_OP_reg31) -+ length_baton = dwarf2_attr_to_locexpr_baton (attr, cu); -+ else if (blk->size > 1 && blk->data[0] == DW_OP_regx) -+ { -+ ULONGEST ulongest; -+ const gdb_byte *end; -+ -+ end = safe_read_uleb128 (&blk->data[1], &blk->data[blk->size], -+ &ulongest); -+ if (end == &blk->data[blk->size]) -+ length_baton = dwarf2_attr_to_locexpr_baton (attr, cu); -+ } -+ -+ if (length_baton == NULL) -+ { -+ struct attribute *size_attr; -+ gdb_byte *data; -+ -+ length_baton = obstack_alloc (&cu->comp_unit_obstack, -+ sizeof (*length_baton)); -+ length_baton->per_cu = cu->per_cu; -+ length_baton->size = DW_BLOCK (attr)->size + 2; -+ data = obstack_alloc (&cu->comp_unit_obstack, -+ length_baton->size); -+ length_baton->data = data; -+ memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size); -+ -+ /* DW_AT_BYTE_SIZE existing together with DW_AT_STRING_LENGTH -+ specifies the size of an integer to fetch. */ -+ size_attr = dwarf2_attr (die, DW_AT_byte_size, cu); -+ if (size_attr) -+ { -+ data[DW_BLOCK (attr)->size] = DW_OP_deref_size; -+ data[DW_BLOCK (attr)->size + 1] = DW_UNSND (size_attr); -+ if (data[DW_BLOCK (attr)->size + 1] != DW_UNSND (size_attr)) -+ complaint (&symfile_complaints, -+ _("DW_AT_string_length's DW_AT_byte_size " -+ "integer exceeds the byte size storage")); -+ } -+ else -+ { -+ data[DW_BLOCK (attr)->size] = DW_OP_deref; -+ data[DW_BLOCK (attr)->size + 1] = DW_OP_nop; -+ } -+ } -+ -+ TYPE_RANGE_DATA (range_type)->high.kind -+ = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = length_baton; -+ TYPE_DYNAMIC (range_type) = 1; -+ } - } - else - { -- /* Check for the DW_AT_byte_size attribute. */ -+ if (attr && attr_form_is_constant (attr)) -+ { -+ /* We currently do not support a constant address where the location -+ should be read from - attr_form_is_block is expected instead. See -+ DWARF for the DW_AT_STRING_LENGTH vs. DW_AT_BYTE_SIZE difference. -+ */ -+ /* PASSTHRU */ -+ } -+ - attr = dwarf2_attr (die, DW_AT_byte_size, cu); -- if (attr) -- { -- length = DW_UNSND (attr); -- } -+ if (attr && attr_form_is_block (attr)) -+ { -+ TYPE_RANGE_DATA (range_type)->high.kind -+ = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && attr_form_is_constant (attr)) -+ TYPE_HIGH_BOUND (range_type) = dwarf2_get_attr_constant_value (attr, 0); - else -- { -- length = 1; -- } -+ TYPE_HIGH_BOUND (range_type) = 1; - } - -- index_type = objfile_type (objfile)->builtin_int; -- range_type = create_range_type (NULL, index_type, 1, length); - char_type = language_string_char_type (cu->language_defn, gdbarch); - type = create_string_type (NULL, char_type, range_type); - -@@ -11607,7 +11868,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - struct type *base_type; - struct type *range_type; - struct attribute *attr; -- LONGEST low, high; -+ LONGEST low; - int low_default_is_valid; - char *name; - LONGEST negative_mask; -@@ -11663,42 +11924,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - "- DIE at 0x%x [in module %s]"), - die->offset.sect_off, cu->objfile->name); - -- attr = dwarf2_attr (die, DW_AT_upper_bound, cu); -- if (attr) -- { -- if (attr_form_is_block (attr) || is_ref_attr (attr)) -- { -- /* GCC encodes arrays with unspecified or dynamic length -- with a DW_FORM_block1 attribute or a reference attribute. -- FIXME: GDB does not yet know how to handle dynamic -- arrays properly, treat them as arrays with unspecified -- length for now. -- -- FIXME: jimb/2003-09-22: GDB does not really know -- how to handle arrays of unspecified length -- either; we just represent them as zero-length -- arrays. Choose an appropriate upper bound given -- the lower bound we've computed above. */ -- high = low - 1; -- } -- else -- high = dwarf2_get_attr_constant_value (attr, 1); -- } -- else -- { -- attr = dwarf2_attr (die, DW_AT_count, cu); -- if (attr) -- { -- int count = dwarf2_get_attr_constant_value (attr, 1); -- high = low + count - 1; -- } -- else -- { -- /* Unspecified array length. */ -- high = low - 1; -- } -- } -- - /* Dwarf-2 specifications explicitly allows to create subrange types - without specifying a base type. - In that case, the base type must be set to the type of -@@ -11737,24 +11962,163 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - } - } - -- negative_mask = -+ /* LOW_BOUND and HIGH_BOUND are set for real below. */ -+ range_type = create_range_type (NULL, base_type, 0, -1); -+ TYPE_UNSIGNED (range_type) = 0; -+ -+ negative_mask = - (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); -- if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) -- low |= negative_mask; -- if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) -- high |= negative_mask; - -- range_type = create_range_type (NULL, base_type, low, high); -+ /* Exclude language_ada from any TYPE_DYNAMIC constructs below. GDB Ada -+ supports implements the dynamic bounds in a non-DWARF way and the -+ existing DWARF dynamic bounds are invalid, leading to memory access -+ errors. */ - -- /* Mark arrays with dynamic length at least as an array of unspecified -- length. GDB could check the boundary but before it gets implemented at -- least allow accessing the array elements. */ -- if (attr && attr_form_is_block (attr)) -- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -+ attr = dwarf2_attr (die, DW_AT_lower_bound, cu); -+ if (attr && attr_form_is_block (attr) && cu->language != language_ada) -+ { -+ TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->low.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ /* For setting a default if DW_AT_UPPER_BOUND would be missing. */ -+ low = 0; -+ } -+ else if (attr && is_ref_attr (attr) && cu->language != language_ada) -+ { -+ struct die_info *target_die; -+ struct dwarf2_cu *target_cu = cu; -+ struct attribute *target_loc_attr; - -- /* Ada expects an empty array on no boundary attributes. */ -- if (attr == NULL && cu->language != language_ada) -- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -+ target_die = follow_die_ref_or_sig (die, attr, &target_cu); -+ gdb_assert (target_cu->objfile == cu->objfile); -+ target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ -+ TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_LOCLIST; -+ TYPE_RANGE_DATA (range_type)->low.u.dwarf_loclist.loclist -+ = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu); -+ TYPE_RANGE_DATA (range_type)->low.u.dwarf_loclist.type -+ = die_type (target_die, target_cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ /* For setting a default if DW_AT_UPPER_BOUND would be missing. */ -+ low = 0; -+ } -+ else -+ { -+ if (attr && attr_form_is_constant (attr)) -+ low = dwarf2_get_attr_constant_value (attr, 0); -+ else -+ { -+ if (cu->language == language_fortran) -+ { -+ /* FORTRAN implies a lower bound of 1, if not given. */ -+ low = 1; -+ } -+ else -+ { -+ /* According to DWARF we should assume the value 0 only for -+ LANGUAGE_C and LANGUAGE_CPLUS. */ -+ low = 0; -+ } -+ } -+ if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) -+ low |= negative_mask; -+ TYPE_LOW_BOUND (range_type) = low; -+ if (low >= 0) -+ TYPE_UNSIGNED (range_type) = 1; -+ } -+ -+ attr = dwarf2_attr (die, DW_AT_upper_bound, cu); -+ if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr) -+ && !is_ref_attr (attr))) -+ { -+ attr = dwarf2_attr (die, DW_AT_count, cu); -+ /* It does not hurt but it is needlessly ineffective in check_typedef. */ -+ if (attr && (attr_form_is_block (attr) || attr_form_is_constant (attr))) -+ { -+ TYPE_RANGE_HIGH_BOUND_IS_COUNT (range_type) = 1; -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ /* Pass it now as the regular DW_AT_upper_bound. */ -+ } -+ -+ if (attr && attr_form_is_block (attr) && cu->language != language_ada) -+ { -+ TYPE_RANGE_DATA (range_type)->high.kind = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && is_ref_attr (attr) && cu->language != language_ada) -+ { -+ struct die_info *target_die; -+ struct dwarf2_cu *target_cu = cu; -+ struct attribute *target_loc_attr; -+ -+ target_die = follow_die_ref_or_sig (die, attr, &target_cu); -+ gdb_assert (target_cu->objfile == cu->objfile); -+ target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ -+ TYPE_RANGE_DATA (range_type)->high.kind = RANGE_BOUND_KIND_DWARF_LOCLIST; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_loclist.loclist -+ = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu); -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_loclist.type -+ = die_type (target_die, target_cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else -+ { -+ LONGEST high; -+ -+ if (attr && attr_form_is_constant (attr)) -+ high = dwarf2_get_attr_constant_value (attr, 0); -+ else -+ { -+ /* Ada expects an empty array on no boundary attributes. */ -+ if (cu->language != language_ada) -+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -+ high = low - 1; -+ } -+ if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) -+ high |= negative_mask; -+ TYPE_HIGH_BOUND (range_type) = high; -+ } -+ -+ /* DW_AT_bit_stride is currently unsupported as we count in bytes. */ -+ attr = dwarf2_attr (die, DW_AT_byte_stride, cu); -+ if (attr && attr_form_is_block (attr) && cu->language != language_ada) -+ { -+ TYPE_RANGE_DATA (range_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && is_ref_attr (attr) && cu->language != language_ada) -+ { -+ struct die_info *target_die; -+ struct dwarf2_cu *target_cu = cu; -+ struct attribute *target_loc_attr; -+ -+ target_die = follow_die_ref_or_sig (die, attr, &target_cu); -+ gdb_assert (target_cu->objfile == cu->objfile); -+ target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ -+ TYPE_RANGE_DATA (range_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_DWARF_LOCLIST; -+ TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.loclist -+ = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu); -+ TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.type -+ = die_type (target_die, target_cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && attr_form_is_constant (attr)) -+ { -+ TYPE_BYTE_STRIDE (range_type) = dwarf2_get_attr_constant_value (attr, 0); -+ if (TYPE_BYTE_STRIDE (range_type) == 0) -+ complaint (&symfile_complaints, -+ _("Found DW_AT_byte_stride with unsupported value 0")); -+ } - - name = dwarf2_name (die, cu); - if (name) -@@ -12544,6 +12908,8 @@ read_partial_die (const struct die_reader_specs *reader, - case DW_AT_extension: - part_die->has_specification = 1; - part_die->spec_offset = dwarf2_get_ref_die_offset (&attr); -+ part_die->spec_is_dwz = (attr.form == DW_FORM_GNU_ref_alt -+ || cu->per_cu->is_dwz); - break; - case DW_AT_sibling: - /* Ignore absolute siblings, they might point outside of -@@ -12590,7 +12956,11 @@ read_partial_die (const struct die_reader_specs *reader, - - case DW_AT_import: - if (part_die->tag == DW_TAG_imported_unit) -- part_die->d.offset = dwarf2_get_ref_die_offset (&attr); -+ { -+ part_die->d.offset = dwarf2_get_ref_die_offset (&attr); -+ part_die->is_dwz = (attr.form == DW_FORM_GNU_ref_alt -+ || cu->per_cu->is_dwz); -+ } - break; - - default: -@@ -12661,13 +13031,14 @@ find_partial_die_in_comp_unit (sect_offset offset, struct dwarf2_cu *cu) - DW_FORM_ref_sig8). */ - - static struct partial_die_info * --find_partial_die (sect_offset offset, struct dwarf2_cu *cu) -+find_partial_die (sect_offset offset, int offset_in_dwz, struct dwarf2_cu *cu) - { - struct objfile *objfile = cu->objfile; - struct dwarf2_per_cu_data *per_cu = NULL; - struct partial_die_info *pd = NULL; - -- if (offset_in_cu_p (&cu->header, offset)) -+ if (offset_in_dwz == cu->per_cu->is_dwz -+ && offset_in_cu_p (&cu->header, offset)) - { - pd = find_partial_die_in_comp_unit (offset, cu); - if (pd != NULL) -@@ -12686,7 +13057,8 @@ find_partial_die (sect_offset offset, struct dwarf2_cu *cu) - (long) cu->header.offset.sect_off, (long) offset.sect_off, - bfd_get_filename (objfile->obfd)); - } -- per_cu = dwarf2_find_containing_comp_unit (offset, objfile); -+ per_cu = dwarf2_find_containing_comp_unit (offset, offset_in_dwz, -+ objfile); - - if (per_cu->cu == NULL || per_cu->cu->partial_dies == NULL) - load_partial_comp_unit (per_cu); -@@ -12744,7 +13116,8 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi, - - real_pdi = struct_pdi; - while (real_pdi->has_specification) -- real_pdi = find_partial_die (real_pdi->spec_offset, cu); -+ real_pdi = find_partial_die (real_pdi->spec_offset, -+ real_pdi->spec_is_dwz, cu); - - if (real_pdi->die_parent != NULL) - return; -@@ -12792,7 +13165,8 @@ fixup_partial_die (struct partial_die_info *part_die, - { - struct partial_die_info *spec_die; - -- spec_die = find_partial_die (part_die->spec_offset, cu); -+ spec_die = find_partial_die (part_die->spec_offset, -+ part_die->spec_is_dwz, cu); - - fixup_partial_die (spec_die, cu); - -@@ -12880,6 +13254,10 @@ read_attribute_value (const struct die_reader_specs *reader, - &cu->header, &bytes_read); - info_ptr += bytes_read; - break; -+ case DW_FORM_GNU_ref_alt: -+ DW_UNSND (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read); -+ info_ptr += bytes_read; -+ break; - case DW_FORM_addr: - DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read); - info_ptr += bytes_read; -@@ -12922,10 +13300,25 @@ read_attribute_value (const struct die_reader_specs *reader, - info_ptr += bytes_read; - break; - case DW_FORM_strp: -- DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header, -- &bytes_read); -- DW_STRING_IS_CANONICAL (attr) = 0; -- info_ptr += bytes_read; -+ if (!cu->per_cu->is_dwz) -+ { -+ DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header, -+ &bytes_read); -+ DW_STRING_IS_CANONICAL (attr) = 0; -+ info_ptr += bytes_read; -+ break; -+ } -+ /* FALLTHROUGH */ -+ case DW_FORM_GNU_strp_alt: -+ { -+ struct dwz_file *dwz = dwarf2_get_dwz_file (); -+ LONGEST str_offset = read_offset (abfd, info_ptr, cu_header, -+ &bytes_read); -+ -+ DW_STRING (attr) = read_indirect_string_from_dwz (dwz, str_offset); -+ DW_STRING_IS_CANONICAL (attr) = 0; -+ info_ptr += bytes_read; -+ } - break; - case DW_FORM_exprloc: - case DW_FORM_block: -@@ -13037,6 +13430,10 @@ read_attribute_value (const struct die_reader_specs *reader, - bfd_get_filename (abfd)); - } - -+ /* Super hack. */ -+ if (cu->per_cu->is_dwz && is_ref_attr (attr)) -+ attr->form = DW_FORM_GNU_ref_alt; -+ - /* We have seen instances where the compiler tried to emit a byte - size attribute of -1 which ended up being encoded as an unsigned - 0xffffffff. Although 0xffffffff is technically a valid size value, -@@ -13333,6 +13730,30 @@ read_indirect_string_at_offset (bfd *abfd, LONGEST str_offset) - return (char *) (dwarf2_per_objfile->str.buffer + str_offset); - } - -+/* Read a string at offset STR_OFFSET in the .debug_str section from -+ the .dwz file DWZ. Throw an error if the offset is too large. If -+ the string consists of a single NUL byte, return NULL; otherwise -+ return a pointer to the string. */ -+ -+static char * -+read_indirect_string_from_dwz (struct dwz_file *dwz, LONGEST str_offset) -+{ -+ dwarf2_read_section (dwarf2_per_objfile->objfile, &dwz->str); -+ -+ if (dwz->str.buffer == NULL) -+ error (_("DW_FORM_GNU_strp_alt used without .debug_str " -+ "section [in module %s]"), -+ bfd_get_filename (dwz->dwz_bfd)); -+ if (str_offset >= dwz->str.size) -+ error (_("DW_FORM_GNU_strp_alt pointing outside of " -+ ".debug_str section [in module %s]"), -+ bfd_get_filename (dwz->dwz_bfd)); -+ gdb_assert (HOST_CHAR_BIT == 8); -+ if (dwz->str.buffer[str_offset] == '\0') -+ return NULL; -+ return (char *) (dwz->str.buffer + str_offset); -+} -+ - static char * - read_indirect_string (bfd *abfd, gdb_byte *buf, - const struct comp_unit_head *cu_header, -@@ -13804,6 +14225,30 @@ add_file_name (struct line_header *lh, - fe->symtab = NULL; - } - -+/* A convenience function to find the proper .debug_line section for a -+ CU. */ -+ -+static struct dwarf2_section_info * -+get_debug_line_section (struct dwarf2_cu *cu) -+{ -+ struct dwarf2_section_info *section; -+ -+ /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the -+ DWO file. */ -+ if (cu->dwo_unit && cu->per_cu->is_debug_types) -+ section = &cu->dwo_unit->dwo_file->sections.line; -+ else if (cu->per_cu->is_dwz) -+ { -+ struct dwz_file *dwz = dwarf2_get_dwz_file (); -+ -+ section = &dwz->line; -+ } -+ else -+ section = &dwarf2_per_objfile->line; -+ -+ return section; -+} -+ - /* Read the statement program header starting at OFFSET in - .debug_line, or .debug_line.dwo. Return a pointer - to a struct line_header, allocated using xmalloc. -@@ -13824,13 +14269,7 @@ dwarf_decode_line_header (unsigned int offset, struct dwarf2_cu *cu) - struct dwarf2_section_info *section; - bfd *abfd; - -- /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the -- DWO file. */ -- if (cu->dwo_unit && cu->per_cu->is_debug_types) -- section = &cu->dwo_unit->dwo_file->sections.line; -- else -- section = &dwarf2_per_objfile->line; -- -+ section = get_debug_line_section (cu); - dwarf2_read_section (dwarf2_per_objfile->objfile, section); - if (section->buffer == NULL) - { -@@ -14155,7 +14594,7 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir, - GCd by the linker. Ignore it. PR gdb/12528 */ - - long line_offset -- = line_ptr - dwarf2_per_objfile->line.buffer; -+ = line_ptr - get_debug_line_section (cu)->buffer; - - complaint (&symfile_complaints, - _(".debug_line address at offset 0x%lx is 0 " -@@ -14534,10 +14973,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, - (i.e. when the value of a register or memory location is - referenced, or a thread-local block, etc.). Then again, it might - not be worthwhile. I'm assuming that it isn't unless performance -- or memory numbers show me otherwise. */ -+ or memory numbers show me otherwise. -+ -+ SYMBOL_CLASS may get overriden by dwarf2_symbol_mark_computed. */ - -- dwarf2_symbol_mark_computed (attr, sym, cu); - SYMBOL_CLASS (sym) = LOC_COMPUTED; -+ dwarf2_symbol_mark_computed (attr, sym, cu); - - if (SYMBOL_COMPUTED_OPS (sym) == &dwarf2_loclist_funcs) - cu->has_loclist = 1; -@@ -14578,6 +15019,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, - else - sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol); - OBJSTAT (objfile, n_syms++); -+ /* Some methods are called w/o checking SYMBOL_COMPUTED_OPS validity. */ -+ SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs; - - /* Cache this symbol's name and the name's demangled form (if any). */ - SYMBOL_SET_LANGUAGE (sym, cu->language); -@@ -15001,6 +15444,7 @@ dwarf2_const_value_attr (struct attribute *attr, struct type *type, - case DW_FORM_string: - case DW_FORM_strp: - case DW_FORM_GNU_str_index: -+ case DW_FORM_GNU_strp_alt: - /* DW_STRING is already allocated on the objfile obstack, point - directly to it. */ - *bytes = (gdb_byte *) DW_STRING (attr); -@@ -15187,7 +15631,15 @@ lookup_die_type (struct die_info *die, struct attribute *attr, - - /* First see if we have it cached. */ - -- if (is_ref_attr (attr)) -+ if (attr->form == DW_FORM_GNU_ref_alt) -+ { -+ struct dwarf2_per_cu_data *per_cu; -+ sect_offset offset = dwarf2_get_ref_die_offset (attr); -+ -+ per_cu = dwarf2_find_containing_comp_unit (offset, 1, cu->objfile); -+ this_type = get_die_type_at_offset (offset, per_cu); -+ } -+ else if (is_ref_attr (attr)) - { - sect_offset offset = dwarf2_get_ref_die_offset (attr); - -@@ -15352,6 +15804,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) - break; - } - -+ if (this_type) -+ finalize_type (this_type); -+ - return this_type; - } - -@@ -15960,6 +16415,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) - fprintf_unfiltered (f, "ref address: "); - fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f); - break; -+ case DW_FORM_GNU_ref_alt: -+ fprintf_unfiltered (f, "alt ref address: "); -+ fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f); -+ break; - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: -@@ -15991,6 +16450,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) - case DW_FORM_string: - case DW_FORM_strp: - case DW_FORM_GNU_str_index: -+ case DW_FORM_GNU_strp_alt: - fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)", - DW_STRING (&die->attrs[i]) - ? DW_STRING (&die->attrs[i]) : "", -@@ -16094,6 +16554,7 @@ is_ref_attr (struct attribute *attr) - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: -+ case DW_FORM_GNU_ref_alt: - return 1; - default: - return 0; -@@ -16171,7 +16632,8 @@ follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr, - Returns NULL if OFFSET is invalid. */ - - static struct die_info * --follow_die_offset (sect_offset offset, struct dwarf2_cu **ref_cu) -+follow_die_offset (sect_offset offset, int offset_in_dwz, -+ struct dwarf2_cu **ref_cu) - { - struct die_info temp_die; - struct dwarf2_cu *target_cu, *cu = *ref_cu; -@@ -16188,11 +16650,13 @@ follow_die_offset (sect_offset offset, struct dwarf2_cu **ref_cu) - if (! offset_in_cu_p (&cu->header, offset)) - return NULL; - } -- else if (! offset_in_cu_p (&cu->header, offset)) -+ else if (offset_in_dwz != cu->per_cu->is_dwz -+ || ! offset_in_cu_p (&cu->header, offset)) - { - struct dwarf2_per_cu_data *per_cu; - -- per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile); -+ per_cu = dwarf2_find_containing_comp_unit (offset, offset_in_dwz, -+ cu->objfile); - - /* If necessary, add it to the queue and load its DIEs. */ - if (maybe_queue_comp_unit (cu, per_cu, cu->language)) -@@ -16224,7 +16688,10 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr, - struct dwarf2_cu *cu = *ref_cu; - struct die_info *die; - -- die = follow_die_offset (offset, ref_cu); -+ die = follow_die_offset (offset, -+ (attr->form == DW_FORM_GNU_ref_alt -+ || cu->per_cu->is_dwz), -+ ref_cu); - if (!die) - error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE " - "at 0x%x [in module %s]"), -@@ -16255,7 +16722,7 @@ dwarf2_fetch_die_location_block (cu_offset offset_in_cu, - load_cu (per_cu); - cu = per_cu->cu; - -- die = follow_die_offset (offset, &cu); -+ die = follow_die_offset (offset, per_cu->is_dwz, &cu); - if (!die) - error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), - offset.sect_off, per_cu->objfile->name); -@@ -17049,6 +17516,7 @@ skip_form_bytes (bfd *abfd, gdb_byte *bytes, gdb_byte *buffer_end, - - case DW_FORM_sec_offset: - case DW_FORM_strp: -+ case DW_FORM_GNU_strp_alt: - bytes += offset_size; - break; - -@@ -17204,7 +17672,7 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, - struct macro_source_file *current_file, - struct line_header *lh, char *comp_dir, - struct dwarf2_section_info *section, -- int section_is_gnu, -+ int section_is_gnu, int section_is_dwz, - unsigned int offset_size, - struct objfile *objfile, - htab_t include_hash) -@@ -17255,6 +17723,8 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, - case DW_MACRO_GNU_undef: - case DW_MACRO_GNU_define_indirect: - case DW_MACRO_GNU_undef_indirect: -+ case DW_MACRO_GNU_define_indirect_alt: -+ case DW_MACRO_GNU_undef_indirect_alt: - { - unsigned int bytes_read; - int line; -@@ -17277,11 +17747,21 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, - str_offset = read_offset_1 (abfd, mac_ptr, offset_size); - mac_ptr += offset_size; - -- body = read_indirect_string_at_offset (abfd, str_offset); -+ if (macinfo_type == DW_MACRO_GNU_define_indirect_alt -+ || macinfo_type == DW_MACRO_GNU_undef_indirect_alt -+ || section_is_dwz) -+ { -+ struct dwz_file *dwz = dwarf2_get_dwz_file (); -+ -+ body = read_indirect_string_from_dwz (dwz, str_offset); -+ } -+ else -+ body = read_indirect_string_at_offset (abfd, str_offset); - } - - is_define = (macinfo_type == DW_MACRO_GNU_define -- || macinfo_type == DW_MACRO_GNU_define_indirect); -+ || macinfo_type == DW_MACRO_GNU_define_indirect -+ || macinfo_type == DW_MACRO_GNU_define_indirect_alt); - if (! current_file) - { - /* DWARF violation as no main source is present. */ -@@ -17305,7 +17785,8 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, - else - { - gdb_assert (macinfo_type == DW_MACRO_GNU_undef -- || macinfo_type == DW_MACRO_GNU_undef_indirect); -+ || macinfo_type == DW_MACRO_GNU_undef_indirect -+ || macinfo_type == DW_MACRO_GNU_undef_indirect_alt); - macro_undef (current_file, line, body); - } - } -@@ -17380,6 +17861,7 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, - break; - - case DW_MACRO_GNU_transparent_include: -+ case DW_MACRO_GNU_transparent_include_alt: - { - LONGEST offset; - void **slot; -@@ -17398,13 +17880,32 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, - } - else - { -+ bfd *include_bfd = abfd; -+ struct dwarf2_section_info *include_section = section; -+ struct dwarf2_section_info alt_section; -+ gdb_byte *include_mac_end = mac_end; -+ int is_dwz = section_is_dwz; -+ - *slot = mac_ptr; - -- dwarf_decode_macro_bytes (abfd, -- section->buffer + offset, -- mac_end, current_file, -+ if (macinfo_type == DW_MACRO_GNU_transparent_include_alt) -+ { -+ struct dwz_file *dwz = dwarf2_get_dwz_file (); -+ -+ dwarf2_read_section (dwarf2_per_objfile->objfile, -+ &dwz->macro); -+ -+ include_bfd = dwz->macro.asection->owner; -+ include_section = &dwz->macro; -+ include_mac_end = dwz->macro.buffer + dwz->macro.size; -+ is_dwz = 1; -+ } -+ -+ dwarf_decode_macro_bytes (include_bfd, -+ include_section->buffer + offset, -+ include_mac_end, current_file, - lh, comp_dir, -- section, section_is_gnu, -+ section, section_is_gnu, is_dwz, - offset_size, objfile, include_hash); - - htab_remove_elt (include_hash, mac_ptr); -@@ -17571,6 +18072,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, - - case DW_MACRO_GNU_define_indirect: - case DW_MACRO_GNU_undef_indirect: -+ case DW_MACRO_GNU_define_indirect_alt: -+ case DW_MACRO_GNU_undef_indirect_alt: - { - unsigned int bytes_read; - -@@ -17581,6 +18084,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, - break; - - case DW_MACRO_GNU_transparent_include: -+ case DW_MACRO_GNU_transparent_include_alt: - /* Note that, according to the spec, a transparent include - chain cannot call DW_MACRO_GNU_start_file. So, we can just - skip this opcode. */ -@@ -17623,7 +18127,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, - slot = htab_find_slot (include_hash, mac_ptr, INSERT); - *slot = mac_ptr; - dwarf_decode_macro_bytes (abfd, mac_ptr, mac_end, -- current_file, lh, comp_dir, section, section_is_gnu, -+ current_file, lh, comp_dir, section, -+ section_is_gnu, 0, - offset_size, objfile, include_hash); - do_cleanups (cleanup); - } -@@ -17721,62 +18226,100 @@ fill_in_loclist_baton (struct dwarf2_cu *cu, - baton->from_dwo = cu->dwo_unit != NULL; - } - --static void --dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, -- struct dwarf2_cu *cu) -+/* Convert DW_BLOCK into struct dwarf2_locexpr_baton. ATTR must be a DW_BLOCK -+ attribute type. */ -+ -+static struct dwarf2_locexpr_baton * -+dwarf2_attr_to_locexpr_baton (struct attribute *attr, struct dwarf2_cu *cu) -+{ -+ struct objfile *objfile = dwarf2_per_objfile->objfile; -+ struct dwarf2_locexpr_baton *baton; -+ -+ gdb_assert (attr_form_is_block (attr)); -+ -+ baton = obstack_alloc (&objfile->objfile_obstack, sizeof (*baton)); -+ baton->per_cu = cu->per_cu; -+ gdb_assert (baton->per_cu); -+ -+ /* Note that we're just copying the block's data pointer -+ here, not the actual data. We're still pointing into the -+ info_buffer for SYM's objfile; right now we never release -+ that buffer, but when we do clean up properly this may -+ need to change. */ -+ baton->size = DW_BLOCK (attr)->size; -+ baton->data = DW_BLOCK (attr)->data; -+ gdb_assert (baton->size == 0 || baton->data != NULL); -+ -+ return baton; -+} -+ -+static struct dwarf2_loclist_baton * -+dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu) - { - struct objfile *objfile = dwarf2_per_objfile->objfile; - struct dwarf2_section_info *section = cu_debug_loc_section (cu); -+ struct dwarf2_loclist_baton *baton; -+ -+ /* DW_AT_location of the referenced DIE may be missing if the referenced -+ variable has been optimized out. */ -+ if (!attr) -+ return NULL; -+ -+ dwarf2_read_section (dwarf2_per_objfile->objfile, section); - -- if (attr_form_is_section_offset (attr) -+ if (!(attr_form_is_section_offset (attr) - /* .debug_loc{,.dwo} may not exist at all, or the offset may be outside - the section. If so, fall through to the complaint in the - other branch. */ -- && DW_UNSND (attr) < dwarf2_section_size (objfile, section)) -- { -- struct dwarf2_loclist_baton *baton; -+ && DW_UNSND (attr) < dwarf2_section_size (objfile, section))) -+ return NULL; - -- baton = obstack_alloc (&objfile->objfile_obstack, -- sizeof (struct dwarf2_loclist_baton)); -+ baton = obstack_alloc (&objfile->objfile_obstack, -+ sizeof (struct dwarf2_loclist_baton)); - -- fill_in_loclist_baton (cu, baton, attr); -+ fill_in_loclist_baton (cu, baton, attr); - -- if (cu->base_known == 0) -- complaint (&symfile_complaints, -- _("Location list used without " -- "specifying the CU base address.")); -+ if (cu->base_known == 0) -+ complaint (&symfile_complaints, -+ _("Location list used without " -+ "specifying the CU base address.")); -+ -+ return baton; -+} -+ -+/* SYM may get its SYMBOL_CLASS overriden on invalid ATTR content. */ -+ -+static void -+dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, -+ struct dwarf2_cu *cu) -+{ -+ struct dwarf2_loclist_baton *loclist_baton; - -+ loclist_baton = dwarf2_attr_to_loclist_baton (attr, cu); -+ if (loclist_baton) -+ { - SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs; -- SYMBOL_LOCATION_BATON (sym) = baton; -+ SYMBOL_LOCATION_BATON (sym) = loclist_baton; -+ } -+ else if (attr_form_is_block (attr)) -+ { -+ SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs; -+ SYMBOL_LOCATION_BATON (sym) = dwarf2_attr_to_locexpr_baton (attr, cu); - } - else - { -- struct dwarf2_locexpr_baton *baton; -+ dwarf2_invalid_attrib_class_complaint ("location description", -+ SYMBOL_NATURAL_NAME (sym)); - -- baton = obstack_alloc (&objfile->objfile_obstack, -- sizeof (struct dwarf2_locexpr_baton)); -- baton->per_cu = cu->per_cu; -- gdb_assert (baton->per_cu); -+ /* Some methods are called w/o checking SYMBOL_COMPUTED_OPS validity. */ - -- if (attr_form_is_block (attr)) -- { -- /* Note that we're just copying the block's data pointer -- here, not the actual data. We're still pointing into the -- info_buffer for SYM's objfile; right now we never release -- that buffer, but when we do clean up properly this may -- need to change. */ -- baton->size = DW_BLOCK (attr)->size; -- baton->data = DW_BLOCK (attr)->data; -- } -- else -- { -- dwarf2_invalid_attrib_class_complaint ("location description", -- SYMBOL_NATURAL_NAME (sym)); -- baton->size = 0; -- } -+ SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs; -+ SYMBOL_LOCATION_BATON (sym) = NULL; - -- SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs; -- SYMBOL_LOCATION_BATON (sym) = baton; -+ /* For functions a missing DW_AT_frame_base does not optimize out the -+ whole function definition, only its frame base resolving. */ -+ if (attr->name == DW_AT_location) -+ SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT; - } - } - -@@ -17878,28 +18421,35 @@ dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu) - - static struct dwarf2_per_cu_data * - dwarf2_find_containing_comp_unit (sect_offset offset, -+ unsigned int offset_in_dwz, - struct objfile *objfile) - { - struct dwarf2_per_cu_data *this_cu; - int low, high; -+ const sect_offset *cu_off; - - low = 0; - high = dwarf2_per_objfile->n_comp_units - 1; - while (high > low) - { -+ struct dwarf2_per_cu_data *mid_cu; - int mid = low + (high - low) / 2; - -- if (dwarf2_per_objfile->all_comp_units[mid]->offset.sect_off -- >= offset.sect_off) -+ mid_cu = dwarf2_per_objfile->all_comp_units[mid]; -+ cu_off = &mid_cu->offset; -+ if (mid_cu->is_dwz > offset_in_dwz -+ || (mid_cu->is_dwz == offset_in_dwz -+ && cu_off->sect_off >= offset.sect_off)) - high = mid; - else - low = mid + 1; - } - gdb_assert (low == high); -- if (dwarf2_per_objfile->all_comp_units[low]->offset.sect_off -- > offset.sect_off) -+ this_cu = dwarf2_per_objfile->all_comp_units[low]; -+ cu_off = &this_cu->offset; -+ if (this_cu->is_dwz != offset_in_dwz || cu_off->sect_off > offset.sect_off) - { -- if (low == 0) -+ if (low == 0 || this_cu->is_dwz != offset_in_dwz) - error (_("Dwarf Error: could not find partial DIE containing " - "offset 0x%lx [in module %s]"), - (long) offset.sect_off, bfd_get_filename (objfile->obfd)); -@@ -18140,6 +18690,25 @@ per_cu_offset_and_type_eq (const void *item_lhs, const void *item_rhs) - && ofs_lhs->offset.sect_off == ofs_rhs->offset.sect_off); - } - -+/* Fill in generic attributes applicable for type DIEs. */ -+ -+static void -+fetch_die_type_attrs (struct die_info *die, struct type *type, -+ struct dwarf2_cu *cu) -+{ -+ struct attribute *attr; -+ -+ attr = dwarf2_attr (die, DW_AT_allocated, cu); -+ if (attr_form_is_block (attr)) -+ TYPE_ALLOCATED (type) = dwarf2_attr_to_locexpr_baton (attr, cu); -+ gdb_assert (!TYPE_NOT_ALLOCATED (type)); -+ -+ attr = dwarf2_attr (die, DW_AT_associated, cu); -+ if (attr_form_is_block (attr)) -+ TYPE_ASSOCIATED (type) = dwarf2_attr_to_locexpr_baton (attr, cu); -+ gdb_assert (!TYPE_NOT_ASSOCIATED (type)); -+} -+ - /* Set the type associated with DIE to TYPE. Save it in CU's hash - table if necessary. For convenience, return TYPE. - -@@ -18164,6 +18733,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - struct dwarf2_per_cu_offset_and_type **slot, ofs; - struct objfile *objfile = cu->objfile; - -+ fetch_die_type_attrs (die, type, cu); -+ - /* For Ada types, make sure that the gnat-specific data is always - initialized (if not already set). There are a few types where - we should not be doing so, because the type-specific area is -@@ -18341,53 +18912,13 @@ show_dwarf2_cmd (char *args, int from_tty) - cmd_show_list (show_dwarf2_cmdlist, from_tty, ""); - } - --/* If section described by INFO was mmapped, munmap it now. */ -- --static void --munmap_section_buffer (struct dwarf2_section_info *info) --{ -- if (info->map_addr != NULL) -- { --#ifdef HAVE_MMAP -- int res; -- -- res = munmap (info->map_addr, info->map_len); -- gdb_assert (res == 0); --#else -- /* Without HAVE_MMAP, we should never be here to begin with. */ -- gdb_assert_not_reached ("no mmap support"); --#endif -- } --} -- --/* munmap debug sections for OBJFILE, if necessary. */ -+/* Free data associated with OBJFILE, if necessary. */ - - static void - dwarf2_per_objfile_free (struct objfile *objfile, void *d) - { - struct dwarf2_per_objfile *data = d; - int ix; -- struct dwarf2_section_info *section; -- -- /* This is sorted according to the order they're defined in to make it easier -- to keep in sync. */ -- munmap_section_buffer (&data->info); -- munmap_section_buffer (&data->abbrev); -- munmap_section_buffer (&data->line); -- munmap_section_buffer (&data->loc); -- munmap_section_buffer (&data->macinfo); -- munmap_section_buffer (&data->macro); -- munmap_section_buffer (&data->str); -- munmap_section_buffer (&data->ranges); -- munmap_section_buffer (&data->addr); -- munmap_section_buffer (&data->frame); -- munmap_section_buffer (&data->eh_frame); -- munmap_section_buffer (&data->gdb_index); -- -- for (ix = 0; -- VEC_iterate (dwarf2_section_info_def, data->types, ix, section); -- ++ix) -- munmap_section_buffer (section); - - for (ix = 0; ix < dwarf2_per_objfile->n_comp_units; ++ix) - VEC_free (dwarf2_per_cu_ptr, -@@ -18397,6 +18928,9 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d) - - if (data->dwo_files) - free_dwo_files (data->dwo_files, objfile); -+ -+ if (data->dwz_file && data->dwz_file->dwz_bfd) -+ gdb_bfd_unref (data->dwz_file->dwz_bfd); - } - - -diff --git a/gdb/elfread.c b/gdb/elfread.c -index 1edfb27..0b54b8a 100644 ---- a/gdb/elfread.c -+++ b/gdb/elfread.c -@@ -44,6 +44,7 @@ - #include "gdbthread.h" - #include "regcache.h" - #include "bcache.h" -+#include "gdb_bfd.h" - - extern void _initialize_elfread (void); - -@@ -1108,7 +1109,7 @@ build_id_verify (const char *filename, struct build_id *check) - int retval = 0; - - /* We expect to be silent on the non-existing files. */ -- abfd = bfd_open_maybe_remote (filename); -+ abfd = gdb_bfd_open_maybe_remote (filename); - if (abfd == NULL) - return 0; - -@@ -1123,7 +1124,7 @@ build_id_verify (const char *filename, struct build_id *check) - else - retval = 1; - -- gdb_bfd_close_or_warn (abfd); -+ gdb_bfd_unref (abfd); - - xfree (found); - -@@ -1444,10 +1445,12 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) - - if (debugfile) - { -+ struct cleanup *cleanup = make_cleanup (xfree, debugfile); - bfd *abfd = symfile_bfd_open (debugfile); - -+ make_cleanup_bfd_unref (abfd); - symbol_file_add_separate (abfd, symfile_flags, objfile); -- xfree (debugfile); -+ do_cleanups (cleanup); - } - } - -diff --git a/gdb/eval.c b/gdb/eval.c -index 7d3a8b9..f69dff0 100644 ---- a/gdb/eval.c -+++ b/gdb/eval.c -@@ -41,6 +41,7 @@ - #include "gdb_obstack.h" - #include "objfiles.h" - #include "python/python.h" -+#include "dwarf2loc.h" - - #include "gdb_assert.h" - -@@ -500,27 +501,217 @@ init_array_element (struct value *array, struct value *element, - } - - static struct value * --value_f90_subarray (struct value *array, -- struct expression *exp, int *pos, enum noside noside) -+value_f90_subarray (struct value *array, struct expression *exp, int *pos, -+ int nargs, enum noside noside) - { -- int pc = (*pos) + 1; -- LONGEST low_bound, high_bound; -- struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array))); -- enum f90_range_type range_type = longest_to_int (exp->elts[pc].longconst); -- -- *pos += 3; -- -- if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) -- low_bound = TYPE_LOW_BOUND (range); -+ /* Type to use for the newly allocated value ARRAY. */ -+ struct type *new_array_type; -+ -+ /* Type being iterated for each dimension. */ -+ struct type *type, *type_last_target; -+ -+ /* Pointer in the last holder to the type of current dimension. */ -+ struct type **typep = &new_array_type; -+ -+ struct subscript_index -+ { -+ enum { SUBSCRIPT_RANGE, SUBSCRIPT_NUMBER } kind; -+ union -+ { -+ struct subscript_range -+ { -+ enum f90_range_type f90_range_type; -+ LONGEST low_bound, high_bound; -+ } -+ range; -+ LONGEST number; -+ }; -+ } -+ *subscript_array; -+ struct type **type_array; -+ int i; -+ struct cleanup *old_chain; -+ CORE_ADDR value_byte_address, value_byte_offset = 0; -+ htab_t copied_types; -+ struct value *saved_array; -+ -+ old_chain = make_cleanup (null_cleanup, 0); -+ object_address_set (value_raw_address (array)); -+ -+ if (value_optimized_out (array) -+ || (VALUE_LVAL (array) != not_lval -+ && VALUE_LVAL (array) != lval_memory -+ && VALUE_LVAL (array) != lval_internalvar_component -+ && VALUE_LVAL (array) != lval_internalvar)) -+ error (_("value being subranged must be in memory")); -+ type = check_typedef (value_type (array)); -+ f_object_address_data_valid_or_error (type); -+ -+ copied_types = create_copied_types_hash (NULL); -+ type = copy_type_recursive (type, copied_types); -+ htab_delete (copied_types); -+ -+ if (nargs != calc_f77_array_dims (type)) -+ error (_("Wrong number of subscripts")); -+ -+ if (TYPE_DATA_LOCATION_IS_ADDR (type)) -+ { -+ value_byte_address = (TYPE_DATA_LOCATION_ADDR (type) -+ + value_offset (array)); -+ TYPE_DATA_LOCATION_IS_ADDR (type) = 0; -+ TYPE_DATA_LOCATION_DWARF_BLOCK (type) = NULL; -+ } - else -- low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); -+ { -+ gdb_assert (TYPE_DATA_LOCATION_DWARF_BLOCK (type) == NULL); -+ value_byte_address = value_address (array); -+ } -+ -+ new_array_type = type; -+ -+ subscript_array = alloca (sizeof (*subscript_array) * nargs); -+ -+ gdb_assert (nargs > 0); -+ -+ /* Now that we know we have a legal array subscript expression -+ let us actually find out where this element exists in the array. */ -+ -+ /* Take array indices left to right. */ -+ for (i = 0; i < nargs; i++) -+ { -+ struct subscript_index *index = &subscript_array[i]; -+ -+ if (exp->elts[*pos].opcode == OP_F90_RANGE) -+ { -+ int pc = (*pos) + 1; -+ struct subscript_range *range; -+ -+ index->kind = SUBSCRIPT_RANGE; -+ range = &index->range; -+ -+ *pos += 3; -+ range->f90_range_type = longest_to_int (exp->elts[pc].longconst); -+ -+ if (range->f90_range_type == HIGH_BOUND_DEFAULT -+ || range->f90_range_type == NONE_BOUND_DEFAULT) -+ range->low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, -+ pos, noside)); -+ -+ if (range->f90_range_type == LOW_BOUND_DEFAULT -+ || range->f90_range_type == NONE_BOUND_DEFAULT) -+ range->high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, -+ pos, noside)); -+ } -+ else -+ { -+ struct value *val; -+ -+ index->kind = SUBSCRIPT_NUMBER; - -- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) -- high_bound = TYPE_HIGH_BOUND (range); -+ /* Evaluate each subscript; it must be a legal integer in F77. */ -+ val = evaluate_subexp_with_coercion (exp, pos, noside); -+ index->number = value_as_long (val); -+ } -+ } -+ -+ /* Internal type of array is arranged right to left. */ -+ for (i = nargs - 1; i >= 0; i--) -+ { -+ struct subscript_index *index = &subscript_array[i]; -+ struct type *range_type = TYPE_INDEX_TYPE (type); -+ -+ switch (index->kind) -+ { -+ case SUBSCRIPT_RANGE: -+ { -+ struct subscript_range *range = &index->range; -+ CORE_ADDR byte_offset; -+ -+ if (range->f90_range_type == LOW_BOUND_DEFAULT -+ || range->f90_range_type == BOTH_BOUND_DEFAULT) -+ range->low_bound = TYPE_LOW_BOUND (range_type); -+ -+ if (range->f90_range_type == HIGH_BOUND_DEFAULT -+ || range->f90_range_type == BOTH_BOUND_DEFAULT) -+ range->high_bound = TYPE_HIGH_BOUND (range_type); -+ -+ if (range->low_bound < TYPE_LOW_BOUND (range_type) -+ || (!TYPE_HIGH_BOUND_UNDEFINED (range_type) -+ && range->high_bound > TYPE_HIGH_BOUND (range_type))) -+ error (_("slice out of range")); -+ -+ byte_offset = ((range->low_bound - TYPE_LOW_BOUND (range_type)) -+ * TYPE_ARRAY_BYTE_STRIDE_VALUE (type)); -+ TYPE_LOW_BOUND (range_type) = range->low_bound; -+ TYPE_HIGH_BOUND (range_type) = range->high_bound; -+ if (range->f90_range_type == LOW_BOUND_DEFAULT -+ || range->f90_range_type == NONE_BOUND_DEFAULT) -+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 0; -+ -+ typep = &TYPE_TARGET_TYPE (type); -+ value_byte_offset += byte_offset; -+ type = TYPE_TARGET_TYPE (type); -+ } -+ break; -+ -+ case SUBSCRIPT_NUMBER: -+ { -+ CORE_ADDR byte_offset; -+ -+ if (index->number < TYPE_LOW_BOUND (range_type) -+ || (!TYPE_HIGH_BOUND_UNDEFINED (range_type) -+ && index->number > TYPE_HIGH_BOUND (range_type))) -+ error (_("no such vector element")); -+ -+ byte_offset = ((index->number - TYPE_LOW_BOUND (range_type)) -+ * TYPE_ARRAY_BYTE_STRIDE_VALUE (type)); -+ -+ type = TYPE_TARGET_TYPE (type); -+ *typep = type; -+ value_byte_offset += byte_offset; -+ } -+ break; -+ } -+ } -+ -+ type_last_target = type; -+ type_array = alloca (sizeof (*type_array) * nargs); -+ i = 0; -+ for (type = new_array_type; type != type_last_target; -+ type = TYPE_TARGET_TYPE (type)) -+ type_array[i++] = type; -+ while (i > 0) -+ { -+ struct type *type = type_array[--i]; -+ -+ /* Force TYPE_LENGTH (type) recalculation. */ -+ TYPE_TARGET_STUB (type) = 1; -+ check_typedef (type); -+ } -+ -+ saved_array = array; -+ array = allocate_value_lazy (new_array_type); -+ VALUE_LVAL (array) = VALUE_LVAL (saved_array); -+ if (VALUE_LVAL (saved_array) == lval_internalvar_component) -+ VALUE_LVAL (array) = lval_internalvar; - else -- high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); -+ VALUE_LVAL (array) = VALUE_LVAL (saved_array); -+ VALUE_FRAME_ID (array) = VALUE_FRAME_ID (saved_array); -+ if (VALUE_LVAL (array) != lval_internalvar) -+ set_value_address (array, value_byte_address + value_byte_offset); -+ -+ if (!value_lazy (saved_array)) -+ { -+ allocate_value_contents (array); -+ set_value_lazy (array, 0); - -- return value_slice (array, low_bound, high_bound - low_bound + 1); -+ memcpy (value_contents_writeable (array), -+ value_contents (saved_array) + value_byte_offset, -+ TYPE_LENGTH (new_array_type)); -+ } -+ -+ do_cleanups (old_chain); -+ return array; - } - - -@@ -818,6 +1009,7 @@ evaluate_subexp_standard (struct type *expect_type, - int save_pos1; - struct symbol *function = NULL; - char *function_name = NULL; -+ struct cleanup *old_chain; - - pc = (*pos)++; - op = exp->elts[pc].opcode; -@@ -1892,6 +2084,8 @@ evaluate_subexp_standard (struct type *expect_type, - - /* First determine the type code we are dealing with. */ - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); -+ old_chain = make_cleanup (null_cleanup, 0); -+ object_address_set (value_raw_address (arg1)); - type = check_typedef (value_type (arg1)); - code = TYPE_CODE (type); - -@@ -1912,23 +2106,13 @@ evaluate_subexp_standard (struct type *expect_type, - code = TYPE_CODE (type); - } - } -+ do_cleanups (old_chain); - - switch (code) - { - case TYPE_CODE_ARRAY: -- if (exp->elts[*pos].opcode == OP_F90_RANGE) -- return value_f90_subarray (arg1, exp, pos, noside); -- else -- goto multi_f77_subscript; -- - case TYPE_CODE_STRING: -- if (exp->elts[*pos].opcode == OP_F90_RANGE) -- return value_f90_subarray (arg1, exp, pos, noside); -- else -- { -- arg2 = evaluate_subexp_with_coercion (exp, pos, noside); -- return value_subscript (arg1, value_as_long (arg2)); -- } -+ return value_f90_subarray (arg1, exp, pos, nargs, noside); - - case TYPE_CODE_PTR: - case TYPE_CODE_FUNC: -@@ -2361,49 +2545,6 @@ evaluate_subexp_standard (struct type *expect_type, - } - return (arg1); - -- multi_f77_subscript: -- { -- LONGEST subscript_array[MAX_FORTRAN_DIMS]; -- int ndimensions = 1, i; -- struct value *array = arg1; -- -- if (nargs > MAX_FORTRAN_DIMS) -- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); -- -- ndimensions = calc_f77_array_dims (type); -- -- if (nargs != ndimensions) -- error (_("Wrong number of subscripts")); -- -- gdb_assert (nargs > 0); -- -- /* Now that we know we have a legal array subscript expression -- let us actually find out where this element exists in the array. */ -- -- /* Take array indices left to right. */ -- for (i = 0; i < nargs; i++) -- { -- /* Evaluate each subscript; it must be a legal integer in F77. */ -- arg2 = evaluate_subexp_with_coercion (exp, pos, noside); -- -- /* Fill in the subscript array. */ -- -- subscript_array[i] = value_as_long (arg2); -- } -- -- /* Internal type of array is arranged right to left. */ -- for (i = nargs; i > 0; i--) -- { -- struct type *array_type = check_typedef (value_type (array)); -- LONGEST index = subscript_array[i - 1]; -- -- lower = f77_get_lowerbound (array_type); -- array = value_subscripted_rvalue (array, index, lower); -- } -- -- return array; -- } -- - case BINOP_LOGICAL_AND: - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - if (noside == EVAL_SKIP) -@@ -2635,15 +2776,23 @@ evaluate_subexp_standard (struct type *expect_type, - if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) - expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); - arg1 = evaluate_subexp (expect_type, exp, pos, noside); -+ old_chain = make_cleanup (null_cleanup, 0); -+ object_address_set (value_raw_address (arg1)); - type = check_typedef (value_type (arg1)); - if (TYPE_CODE (type) == TYPE_CODE_METHODPTR - || TYPE_CODE (type) == TYPE_CODE_MEMBERPTR) - error (_("Attempt to dereference pointer " - "to member without an object")); - if (noside == EVAL_SKIP) -- goto nosideret; -+ { -+ do_cleanups (old_chain); -+ goto nosideret; -+ } - if (unop_user_defined_p (op, arg1)) -- return value_x_unop (arg1, op, noside); -+ { -+ do_cleanups (old_chain); -+ return value_x_unop (arg1, op, noside); -+ } - else if (noside == EVAL_AVOID_SIDE_EFFECTS) - { - type = check_typedef (value_type (arg1)); -@@ -2652,12 +2801,18 @@ evaluate_subexp_standard (struct type *expect_type, - /* In C you can dereference an array to get the 1st elt. */ - || TYPE_CODE (type) == TYPE_CODE_ARRAY - ) -- return value_zero (TYPE_TARGET_TYPE (type), -- lval_memory); -+ { -+ do_cleanups (old_chain); -+ return value_zero (TYPE_TARGET_TYPE (type), -+ lval_memory); -+ } - else if (TYPE_CODE (type) == TYPE_CODE_INT) -- /* GDB allows dereferencing an int. */ -- return value_zero (builtin_type (exp->gdbarch)->builtin_int, -- lval_memory); -+ { -+ do_cleanups (old_chain); -+ /* GDB allows dereferencing an int. */ -+ return value_zero (builtin_type (exp->gdbarch)->builtin_int, -+ lval_memory); -+ } - else - error (_("Attempt to take contents of a non-pointer value.")); - } -@@ -2667,9 +2822,14 @@ evaluate_subexp_standard (struct type *expect_type, - do. "long long" variables are rare enough that - BUILTIN_TYPE_LONGEST would seem to be a mistake. */ - if (TYPE_CODE (type) == TYPE_CODE_INT) -- return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int, -- (CORE_ADDR) value_as_address (arg1)); -- return value_ind (arg1); -+ { -+ do_cleanups (old_chain); -+ return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int, -+ (CORE_ADDR) value_as_address (arg1)); -+ } -+ arg1 = value_ind (arg1); -+ do_cleanups (old_chain); -+ return arg1; - - case UNOP_ADDR: - /* C++: check for and handle pointer to members. */ -@@ -3011,7 +3171,7 @@ evaluate_subexp_with_coercion (struct expression *exp, - { - enum exp_opcode op; - int pc; -- struct value *val; -+ struct value *val = NULL; - struct symbol *var; - struct type *type; - -@@ -3022,13 +3182,18 @@ evaluate_subexp_with_coercion (struct expression *exp, - { - case OP_VAR_VALUE: - var = exp->elts[pc + 2].symbol; -+ /* address_of_variable will call object_address_set for check_typedef. -+ Call it only if required as it can error-out on VAR in register. */ -+ if (TYPE_DYNAMIC (SYMBOL_TYPE (var))) -+ val = address_of_variable (var, exp->elts[pc + 1].block); - type = check_typedef (SYMBOL_TYPE (var)); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY - && !TYPE_VECTOR (type) - && CAST_IS_CONVERSION (exp->language_defn)) - { - (*pos) += 4; -- val = address_of_variable (var, exp->elts[pc + 1].block); -+ if (!val) -+ val = address_of_variable (var, exp->elts[pc + 1].block); - return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), - val); - } -@@ -3080,9 +3245,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) - - case OP_VAR_VALUE: - (*pos) += 4; -- type = check_typedef (SYMBOL_TYPE (exp->elts[pc + 2].symbol)); -- return -- value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type)); -+ /* We do not need to call read_var_value but the object evaluation may -+ need to have executed object_address_set which needs valid -+ SYMBOL_VALUE_ADDRESS of the symbol. Still VALUE returned by -+ read_var_value we left as lazy. */ -+ type = value_type (read_var_value (exp->elts[pc + 2].symbol, -+ deprecated_safe_get_selected_frame ())); -+ return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type)); - - default: - val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); -@@ -3113,18 +3282,25 @@ parse_and_eval_type (char *p, int length) - int - calc_f77_array_dims (struct type *array_type) - { -- int ndimen = 1; -- struct type *tmp_type; -+ switch (TYPE_CODE (array_type)) -+ { -+ case TYPE_CODE_STRING: -+ return 1; - -- if ((TYPE_CODE (array_type) != TYPE_CODE_ARRAY)) -- error (_("Can't get dimensions for a non-array type")); -+ case TYPE_CODE_ARRAY: -+ { -+ int ndimen = 1; - -- tmp_type = array_type; -+ while ((array_type = TYPE_TARGET_TYPE (array_type))) -+ { -+ if (TYPE_CODE (array_type) == TYPE_CODE_ARRAY) -+ ++ndimen; -+ } -+ return ndimen; -+ } - -- while ((tmp_type = TYPE_TARGET_TYPE (tmp_type))) -- { -- if (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY) -- ++ndimen; -+ default: -+ error (_("Can't get dimensions for a non-array/non-string type")); - } -- return ndimen; -+ - } -diff --git a/gdb/exec.c b/gdb/exec.c -index 6ba1986..e076609 100644 ---- a/gdb/exec.c -+++ b/gdb/exec.c -@@ -33,6 +33,7 @@ - #include "arch-utils.h" - #include "gdbthread.h" - #include "progspace.h" -+#include "gdb_bfd.h" - - #include - #include "readline/readline.h" -@@ -98,10 +99,8 @@ exec_close (void) - if (exec_bfd) - { - bfd *abfd = exec_bfd; -- char *name = bfd_get_filename (abfd); - -- gdb_bfd_close_or_warn (abfd); -- xfree (name); -+ gdb_bfd_unref (abfd); - - /* Removing target sections may close the exec_ops target. - Clear exec_bfd before doing so to prevent recursion. */ -@@ -128,17 +127,13 @@ exec_close_1 (int quitting) - vp = nxt; - nxt = vp->nxt; - -- /* if there is an objfile associated with this bfd, -- free_objfile() will do proper cleanup of objfile *and* bfd. */ -- - if (vp->objfile) - { - free_objfile (vp->objfile); - need_symtab_cleanup = 1; - } -- else if (vp->bfd != exec_bfd) -- /* FIXME-leak: We should be freeing vp->name too, I think. */ -- gdb_bfd_close_or_warn (vp->bfd); -+ -+ gdb_bfd_unref (vp->bfd); - - xfree (vp); - } -@@ -230,11 +225,14 @@ exec_file_attach (char *filename, int from_tty) - &scratch_pathname); - } - #endif -+ -+ cleanups = make_cleanup (xfree, scratch_pathname); -+ - if (scratch_chan < 0) - perror_with_name (filename); -- exec_bfd = bfd_fopen (scratch_pathname, gnutarget, -- write_files ? FOPEN_RUB : FOPEN_RB, -- scratch_chan); -+ exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget, -+ write_files ? FOPEN_RUB : FOPEN_RB, -+ scratch_chan); - - if (!exec_bfd) - { -@@ -242,13 +240,6 @@ exec_file_attach (char *filename, int from_tty) - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } - -- /* At this point, scratch_pathname and exec_bfd->name both point to the -- same malloc'd string. However exec_close() will attempt to free it -- via the exec_bfd->name pointer, so we need to make another copy and -- leave exec_bfd as the new owner of the original copy. */ -- scratch_pathname = xstrdup (scratch_pathname); -- cleanups = make_cleanup (xfree, scratch_pathname); -- - if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) - { - /* Make sure to close exec_bfd, or else "run" might try to use -@@ -554,6 +545,7 @@ map_vmap (bfd *abfd, bfd *arch) - memset ((char *) vp, '\0', sizeof (*vp)); - vp->nxt = 0; - vp->bfd = abfd; -+ gdb_bfd_ref (abfd); - vp->name = bfd_get_filename (arch ? arch : abfd); - vp->member = arch ? bfd_get_filename (abfd) : ""; - -diff --git a/gdb/f-exp.y b/gdb/f-exp.y -index 33c7418..4db1bfa 100644 ---- a/gdb/f-exp.y -+++ b/gdb/f-exp.y -@@ -298,7 +298,9 @@ arglist : subrange - { arglist_len = 1; } - ; - --arglist : arglist ',' exp %prec ABOVE_COMMA -+arglist : arglist ',' exp %prec ABOVE_COMMA -+ { arglist_len++; } -+ | arglist ',' subrange %prec ABOVE_COMMA - { arglist_len++; } - ; - -diff --git a/gdb/f-lang.h b/gdb/f-lang.h -index 4aae3c5..51a4e1e 100644 ---- a/gdb/f-lang.h -+++ b/gdb/f-lang.h -@@ -28,6 +28,10 @@ extern void f_error (char *); /* Defined in f-exp.y */ - extern void f_print_type (struct type *, const char *, struct ui_file *, int, - int); - -+extern const char *f_object_address_data_valid_print_to_stream -+ (struct type *type, struct ui_file *stream); -+extern void f_object_address_data_valid_or_error (struct type *type); -+ - extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, - struct ui_file *, int, - const struct value *, -diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c -index a95ef84..830917d 100644 ---- a/gdb/f-typeprint.c -+++ b/gdb/f-typeprint.c -@@ -31,7 +31,7 @@ - #include "gdbcore.h" - #include "target.h" - #include "f-lang.h" -- -+#include "dwarf2loc.h" - #include "gdb_string.h" - #include - -@@ -48,6 +48,34 @@ void f_type_print_varspec_prefix (struct type *, struct ui_file *, - void f_type_print_base (struct type *, struct ui_file *, int, int); - - -+const char * -+f_object_address_data_valid_print_to_stream (struct type *type, -+ struct ui_file *stream) -+{ -+ const char *msg; -+ -+ msg = object_address_data_not_valid (type); -+ if (msg != NULL) -+ { -+ /* Assuming the content printed to STREAM should not be localized. */ -+ fprintf_filtered (stream, "<%s>", msg); -+ } -+ -+ return msg; -+} -+ -+void -+f_object_address_data_valid_or_error (struct type *type) -+{ -+ const char *msg; -+ -+ msg = object_address_data_not_valid (type); -+ if (msg != NULL) -+ { -+ error (_("Cannot access it because the %s."), _(msg)); -+ } -+} -+ - /* LEVEL is the depth to indent lines by. */ - - void -@@ -57,6 +85,9 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, - enum type_code code; - int demangled_args; - -+ if (f_object_address_data_valid_print_to_stream (type, stream) != NULL) -+ return; -+ - f_type_print_base (type, stream, show, level); - code = TYPE_CODE (type); - if ((varstring != NULL && *varstring != '\0') -@@ -164,6 +195,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - - QUIT; - -+ if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF) -+ CHECK_TYPEDEF (type); -+ - switch (TYPE_CODE (type)) - { - case TYPE_CODE_ARRAY: -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 4359f6f..8ff834b 100644 ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c -@@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; - /* The following macro gives us the size of the nth dimension, Where - n is 1 based. */ - --#define F77_DIM_SIZE(n) (f77_array_offset_tbl[n][1]) -+#define F77_DIM_COUNT(n) (f77_array_offset_tbl[n][1]) - --/* The following gives us the offset for row n where n is 1-based. */ -+/* The following gives us the element size for row n where n is 1-based. */ - --#define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0]) -+#define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0]) - - int - f77_get_lowerbound (struct type *type) - { -+ f_object_address_data_valid_or_error (type); -+ - if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type)) - error (_("Lower bound may not be '*' in F77")); - -@@ -72,14 +74,17 @@ f77_get_lowerbound (struct type *type) - int - f77_get_upperbound (struct type *type) - { -+ f_object_address_data_valid_or_error (type); -+ - if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) - { -- /* We have an assumed size array on our hands. Assume that -- upper_bound == lower_bound so that we show at least 1 element. -- If the user wants to see more elements, let him manually ask for 'em -- and we'll subscript the array and show him. */ -+ /* We have an assumed size array on our hands. As type_length_get -+ already assumes a length zero of arrays with underfined bounds VALADDR -+ passed to the Fortran functions does not contained the real inferior -+ memory content. User should request printing of specific array -+ elements instead. */ - -- return f77_get_lowerbound (type); -+ return f77_get_lowerbound (type) - 1; - } - - return TYPE_ARRAY_UPPER_BOUND_VALUE (type); -@@ -135,24 +140,29 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) - upper = f77_get_upperbound (tmp_type); - lower = f77_get_lowerbound (tmp_type); - -- F77_DIM_SIZE (ndimen) = upper - lower + 1; -+ F77_DIM_COUNT (ndimen) = upper - lower + 1; -+ -+ F77_DIM_BYTE_STRIDE (ndimen) = -+ TYPE_ARRAY_BYTE_STRIDE_VALUE (tmp_type); - - tmp_type = TYPE_TARGET_TYPE (tmp_type); - ndimen++; - } - -- /* Now we multiply eltlen by all the offsets, so that later we -+ /* Now we multiply eltlen by all the BYTE_STRIDEs, so that later we - can print out array elements correctly. Up till now we -- know an offset to apply to get the item but we also -+ know an eltlen to apply to get the item but we also - have to know how much to add to get to the next item. */ - - ndimen--; - eltlen = TYPE_LENGTH (tmp_type); -- F77_DIM_OFFSET (ndimen) = eltlen; -+ if (F77_DIM_BYTE_STRIDE (ndimen) == 0) -+ F77_DIM_BYTE_STRIDE (ndimen) = eltlen; - while (--ndimen > 0) - { -- eltlen *= F77_DIM_SIZE (ndimen + 1); -- F77_DIM_OFFSET (ndimen) = eltlen; -+ eltlen *= F77_DIM_COUNT (ndimen + 1); -+ if (F77_DIM_BYTE_STRIDE (ndimen) == 0) -+ F77_DIM_BYTE_STRIDE (ndimen) = eltlen; - } - } - -@@ -174,37 +184,35 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, - - if (nss != ndimensions) - { -- for (i = 0; -- (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max); -- i++) -+ for (i = 0; (i < F77_DIM_COUNT (nss) && (*elts) < options->print_max); i++) - { - fprintf_filtered (stream, "( "); - f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type), - valaddr, -- embedded_offset + i * F77_DIM_OFFSET (nss), -+ embedded_offset + i * F77_DIM_BYTE_STRIDE (nss), - address, - stream, recurse, val, options, elts); - fprintf_filtered (stream, ") "); - } -- if (*elts >= options->print_max && i < F77_DIM_SIZE (nss)) -+ if (*elts >= options->print_max && i < F77_DIM_COUNT (nss)) - fprintf_filtered (stream, "..."); - } - else - { -- for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max; -+ for (i = 0; i < F77_DIM_COUNT (nss) && (*elts) < options->print_max; - i++, (*elts)++) - { - val_print (TYPE_TARGET_TYPE (type), - valaddr, -- embedded_offset + i * F77_DIM_OFFSET (ndimensions), -+ embedded_offset + i * F77_DIM_BYTE_STRIDE (ndimensions), - address, stream, recurse, - val, options, current_language); - -- if (i != (F77_DIM_SIZE (nss) - 1)) -+ if (i != (F77_DIM_COUNT (nss) - 1)) - fprintf_filtered (stream, ", "); - - if ((*elts == options->print_max - 1) -- && (i != (F77_DIM_SIZE (nss) - 1))) -+ && (i != (F77_DIM_COUNT (nss) - 1))) - fprintf_filtered (stream, "..."); - } - } -@@ -270,6 +278,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, - CORE_ADDR addr; - int index; - -+ if (f_object_address_data_valid_print_to_stream (type, stream) != NULL) -+ return; -+ - CHECK_TYPEDEF (type); - switch (TYPE_CODE (type)) - { -diff --git a/gdb/findvar.c b/gdb/findvar.c -index 66bcebe..e59e5f2 100644 ---- a/gdb/findvar.c -+++ b/gdb/findvar.c -@@ -35,6 +35,7 @@ - #include "block.h" - #include "objfiles.h" - #include "language.h" -+#include "dwarf2loc.h" - - /* Basic byte-swapping routines. All 'extract' functions return a - host-format integer from a target-format integer at ADDR which is -@@ -438,7 +439,10 @@ minsym_lookup_iterator_cb (struct objfile *objfile, void *cb_data) - } - - /* A default implementation for the "la_read_var_value" hook in -- the language vector which should work in most situations. */ -+ the language vector which should work in most situations. -+ We have to first find the address of the variable before allocating struct -+ value to return as its size may depend on DW_OP_PUSH_OBJECT_ADDRESS possibly -+ used by its type. */ - - struct value * - default_read_var_value (struct symbol *var, struct frame_info *frame) -@@ -446,16 +450,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - struct value *v; - struct type *type = SYMBOL_TYPE (var); - CORE_ADDR addr; -- int len; -- -- /* Call check_typedef on our type to make sure that, if TYPE is -- a TYPE_CODE_TYPEDEF, its length is set to the length of the target type -- instead of zero. However, we do not replace the typedef type by the -- target type, because we want to keep the typedef in order to be able to -- set the returned value type description correctly. */ -- check_typedef (type); -- -- len = TYPE_LENGTH (type); - - if (symbol_read_needs_frame (var)) - gdb_assert (frame); -@@ -465,7 +459,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - case LOC_CONST: - /* Put the constant back in target format. */ - v = allocate_value (type); -- store_signed_integer (value_contents_raw (v), len, -+ store_signed_integer (value_contents_raw (v), TYPE_LENGTH (type), - gdbarch_byte_order (get_type_arch (type)), - (LONGEST) SYMBOL_VALUE (var)); - VALUE_LVAL (v) = not_lval; -@@ -490,12 +484,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - - case LOC_CONST_BYTES: - v = allocate_value (type); -- memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), len); -+ memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), -+ TYPE_LENGTH (type)); - VALUE_LVAL (v) = not_lval; - return v; - - case LOC_STATIC: -- v = allocate_value_lazy (type); - if (overlay_debugging) - addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), - SYMBOL_OBJ_SECTION (var)); -@@ -509,7 +503,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - error (_("Unknown argument list address for `%s'."), - SYMBOL_PRINT_NAME (var)); - addr += SYMBOL_VALUE (var); -- v = allocate_value_lazy (type); - break; - - case LOC_REF_ARG: -@@ -524,14 +517,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - argref += SYMBOL_VALUE (var); - ref = value_at (lookup_pointer_type (type), argref); - addr = value_as_address (ref); -- v = allocate_value_lazy (type); - break; - } - - case LOC_LOCAL: - addr = get_frame_locals_address (frame); - addr += SYMBOL_VALUE (var); -- v = allocate_value_lazy (type); - break; - - case LOC_TYPEDEF: -@@ -540,7 +531,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - break; - - case LOC_BLOCK: -- v = allocate_value_lazy (type); - if (overlay_debugging) - addr = symbol_overlayed_address - (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var)); -@@ -566,7 +556,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - SYMBOL_PRINT_NAME (var)); - - addr = value_as_address (regval); -- v = allocate_value_lazy (type); - } - else - { -@@ -615,7 +604,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - if (obj_section - && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) - addr = target_translate_tls_address (obj_section->objfile, addr); -- v = allocate_value_lazy (type); - } - break; - -@@ -628,6 +616,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - break; - } - -+ /* ADDR is set here for ALLOCATE_VALUE's CHECK_TYPEDEF for -+ DW_OP_PUSH_OBJECT_ADDRESS. */ -+ object_address_set (addr); -+ v = allocate_value_lazy (type); - VALUE_LVAL (v) = lval_memory; - set_value_address (v, addr); - return v; -@@ -723,10 +715,11 @@ struct value * - value_from_register (struct type *type, int regnum, struct frame_info *frame) - { - struct gdbarch *gdbarch = get_frame_arch (frame); -- struct type *type1 = check_typedef (type); - struct value *v; - -- if (gdbarch_convert_register_p (gdbarch, regnum, type1)) -+ type = check_typedef (type); -+ -+ if (gdbarch_convert_register_p (gdbarch, regnum, type)) - { - int optim, unavail, ok; - -@@ -741,7 +734,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) - VALUE_LVAL (v) = lval_register; - VALUE_FRAME_ID (v) = get_frame_id (frame); - VALUE_REGNUM (v) = regnum; -- ok = gdbarch_register_to_value (gdbarch, frame, regnum, type1, -+ ok = gdbarch_register_to_value (gdbarch, frame, regnum, type, - value_contents_raw (v), &optim, - &unavail); - -diff --git a/gdb/gcore.c b/gdb/gcore.c -index aedda41..a45e787 100644 ---- a/gdb/gcore.c -+++ b/gdb/gcore.c -@@ -33,6 +33,7 @@ - #include - #include "regcache.h" - #include "regset.h" -+#include "gdb_bfd.h" - - /* The largest amount of memory to read from the target at once. We - must throttle it to limit the amount of memory used by GDB during -@@ -50,7 +51,7 @@ static int gcore_memory_sections (bfd *); - bfd * - create_gcore_bfd (char *filename) - { -- bfd *obfd = bfd_openw (filename, default_gcore_target ()); -+ bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ()); - - if (!obfd) - error (_("Failed to open '%s' for output."), filename); -@@ -110,7 +111,7 @@ do_bfd_delete_cleanup (void *arg) - bfd *obfd = arg; - const char *filename = obfd->filename; - -- bfd_close (arg); -+ gdb_bfd_unref (arg); - unlink (filename); - } - -@@ -154,7 +155,7 @@ gcore_command (char *args, int from_tty) - fprintf_filtered (gdb_stdout, "Saved corefile %s\n", corefilename); - - discard_cleanups (old_chain); -- bfd_close (obfd); -+ gdb_bfd_unref (obfd); - } - - static unsigned long -diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in -index ffb7f53..a2e7e94 100644 ---- a/gdb/gdb-gdb.gdb.in -+++ b/gdb/gdb-gdb.gdb.in -@@ -1,5 +1,15 @@ - echo Setting up the environment for debugging gdb.\n - -+# Set up the Python library and "require" command. -+python -+from os.path import abspath -+gdb.datadir = abspath ('@srcdir@/python/lib') -+gdb.pythonlibdir = gdb.datadir -+gdb.__path__ = [gdb.datadir + '/gdb'] -+sys.path.insert(0, gdb.datadir) -+end -+source @srcdir@/python/lib/gdb/__init__.py -+ - set complaints 1 - - b internal_error -diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c -new file mode 100644 -index 0000000..fac8776 ---- /dev/null -+++ b/gdb/gdb_bfd.c -@@ -0,0 +1,670 @@ -+/* Definitions for BFD wrappers used by GDB. -+ -+ Copyright (C) 2011, 2012 -+ 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 . */ -+ -+#include "defs.h" -+#include "gdb_bfd.h" -+#include "gdb_assert.h" -+#include "gdb_string.h" -+#include "ui-out.h" -+#include "gdbcmd.h" -+#include "hashtab.h" -+#ifdef HAVE_ZLIB_H -+#include -+#endif -+#ifdef HAVE_MMAP -+#include -+#ifndef MAP_FAILED -+#define MAP_FAILED ((void *) -1) -+#endif -+#endif -+ -+/* An object of this type is stored in the section's user data when -+ mapping a section. */ -+ -+struct gdb_bfd_section_data -+{ -+ /* Size of the data. */ -+ bfd_size_type size; -+ /* If the data was mmapped, this is the length of the map. */ -+ bfd_size_type map_len; -+ /* The data. If NULL, the section data has not been read. */ -+ void *data; -+ /* If the data was mmapped, this is the map address. */ -+ void *map_addr; -+}; -+ -+/* A hash table holding every BFD that gdb knows about. This is not -+ to be confused with 'gdb_bfd_cache', which is used for sharing -+ BFDs; in contrast, this hash is used just to implement -+ "maint info bfd". */ -+ -+static htab_t all_bfds; -+ -+/* See gdb_bfd.h. */ -+ -+void -+gdb_bfd_stash_filename (struct bfd *abfd) -+{ -+ char *name = bfd_get_filename (abfd); -+ char *data; -+ -+ data = bfd_alloc (abfd, strlen (name) + 1); -+ strcpy (data, name); -+ -+ /* Unwarranted chumminess with BFD. */ -+ abfd->filename = data; -+} -+ -+/* An object of this type is stored in each BFD's user data. */ -+ -+struct gdb_bfd_data -+{ -+ /* The reference count. */ -+ int refc; -+ -+ /* The mtime of the BFD at the point the cache entry was made. */ -+ time_t mtime; -+}; -+ -+/* A hash table storing all the BFDs maintained in the cache. */ -+ -+static htab_t gdb_bfd_cache; -+ -+/* The type of an object being looked up in gdb_bfd_cache. We use -+ htab's capability of storing one kind of object (BFD in this case) -+ and using a different sort of object for searching. */ -+ -+struct gdb_bfd_cache_search -+{ -+ /* The filename. */ -+ const char *filename; -+ /* The mtime. */ -+ time_t mtime; -+}; -+ -+/* A hash function for BFDs. */ -+ -+static hashval_t -+hash_bfd (const void *b) -+{ -+ const bfd *abfd = b; -+ -+ /* It is simplest to just hash the filename. */ -+ return htab_hash_string (bfd_get_filename (abfd)); -+} -+ -+/* An equality function for BFDs. Note that this expects the caller -+ to search using struct gdb_bfd_cache_search only, not BFDs. */ -+ -+static int -+eq_bfd (const void *a, const void *b) -+{ -+ const bfd *abfd = a; -+ const struct gdb_bfd_cache_search *s = b; -+ struct gdb_bfd_data *gdata = bfd_usrdata (abfd); -+ -+ return (gdata->mtime == s->mtime -+ && strcmp (bfd_get_filename (abfd), s->filename) == 0); -+} -+ -+/* See gdb_bfd.h. */ -+ -+struct bfd * -+gdb_bfd_open (const char *name, const char *target, int fd) -+{ -+ hashval_t hash; -+ void **slot; -+ bfd *abfd; -+ struct gdb_bfd_cache_search search; -+ struct stat st; -+ -+ if (gdb_bfd_cache == NULL) -+ gdb_bfd_cache = htab_create_alloc (1, hash_bfd, eq_bfd, NULL, -+ xcalloc, xfree); -+ -+ if (fd == -1) -+ { -+ fd = open (name, O_RDONLY | O_BINARY); -+ if (fd == -1) -+ { -+ bfd_set_error (bfd_error_system_call); -+ return NULL; -+ } -+ } -+ -+ search.filename = name; -+ if (fstat (fd, &st) < 0) -+ { -+ /* Weird situation here. */ -+ search.mtime = 0; -+ } -+ else -+ search.mtime = st.st_mtime; -+ -+ /* Note that this must compute the same result as hash_bfd. */ -+ hash = htab_hash_string (name); -+ /* Note that we cannot use htab_find_slot_with_hash here, because -+ opening the BFD may fail; and this would violate hashtab -+ invariants. */ -+ abfd = htab_find_with_hash (gdb_bfd_cache, &search, hash); -+ if (abfd != NULL) -+ { -+ close (fd); -+ gdb_bfd_ref (abfd); -+ return abfd; -+ } -+ -+ abfd = bfd_fopen (name, target, FOPEN_RB, fd); -+ if (abfd == NULL) -+ return NULL; -+ -+ slot = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash, INSERT); -+ gdb_assert (!*slot); -+ *slot = abfd; -+ -+ gdb_bfd_stash_filename (abfd); -+ gdb_bfd_ref (abfd); -+ return abfd; -+} -+ -+/* A helper function that releases any section data attached to the -+ BFD. */ -+ -+static void -+free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore) -+{ -+ struct gdb_bfd_section_data *sect = bfd_get_section_userdata (abfd, sectp); -+ -+ if (sect != NULL && sect->data != NULL) -+ { -+#ifdef HAVE_MMAP -+ if (sect->map_addr != NULL) -+ { -+ int res; -+ -+ res = munmap (sect->map_addr, sect->map_len); -+ gdb_assert (res == 0); -+ } -+ else -+#endif -+ xfree (sect->data); -+ } -+} -+ -+/* Close ABFD, and warn if that fails. */ -+ -+static int -+gdb_bfd_close_or_warn (struct bfd *abfd) -+{ -+ int ret; -+ char *name = bfd_get_filename (abfd); -+ -+ bfd_map_over_sections (abfd, free_one_bfd_section, NULL); -+ -+ ret = bfd_close (abfd); -+ -+ if (!ret) -+ warning (_("cannot close \"%s\": %s"), -+ name, bfd_errmsg (bfd_get_error ())); -+ -+ return ret; -+} -+ -+/* See gdb_bfd.h. */ -+ -+void -+gdb_bfd_ref (struct bfd *abfd) -+{ -+ struct gdb_bfd_data *gdata; -+ void **slot; -+ -+ if (abfd == NULL) -+ return; -+ -+ gdata = bfd_usrdata (abfd); -+ -+ if (gdata != NULL) -+ { -+ gdata->refc += 1; -+ return; -+ } -+ -+ gdata = bfd_zalloc (abfd, sizeof (struct gdb_bfd_data)); -+ gdata->refc = 1; -+ gdata->mtime = bfd_get_mtime (abfd); -+ bfd_usrdata (abfd) = gdata; -+ -+ /* This is the first we've seen it, so add it to the hash table. */ -+ slot = htab_find_slot (all_bfds, abfd, INSERT); -+ gdb_assert (slot && !*slot); -+ *slot = abfd; -+} -+ -+/* See gdb_bfd.h. */ -+ -+void -+gdb_bfd_unref (struct bfd *abfd) -+{ -+ struct gdb_bfd_data *gdata; -+ struct gdb_bfd_cache_search search; -+ void **slot; -+ -+ if (abfd == NULL) -+ return; -+ -+ gdata = bfd_usrdata (abfd); -+ gdb_assert (gdata->refc >= 1); -+ -+ gdata->refc -= 1; -+ if (gdata->refc > 0) -+ return; -+ -+ search.filename = bfd_get_filename (abfd); -+ -+ if (gdb_bfd_cache && search.filename) -+ { -+ hashval_t hash = htab_hash_string (search.filename); -+ void **slot; -+ -+ search.mtime = gdata->mtime; -+ slot = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash, -+ NO_INSERT); -+ -+ if (slot && *slot) -+ htab_clear_slot (gdb_bfd_cache, slot); -+ } -+ -+ bfd_usrdata (abfd) = NULL; /* Paranoia. */ -+ -+ htab_remove_elt (all_bfds, abfd); -+ -+ gdb_bfd_close_or_warn (abfd); -+} -+ -+/* A helper function that returns the section data descriptor -+ associated with SECTION. If no such descriptor exists, a new one -+ is allocated and cleared. */ -+ -+static struct gdb_bfd_section_data * -+get_section_descriptor (asection *section) -+{ -+ struct gdb_bfd_section_data *result; -+ -+ result = bfd_get_section_userdata (section->owner, section); -+ -+ if (result == NULL) -+ { -+ result = bfd_zalloc (section->owner, sizeof (*result)); -+ bfd_set_section_userdata (section->owner, section, result); -+ } -+ -+ return result; -+} -+ -+/* Decompress a section that was compressed using zlib. Store the -+ decompressed buffer, and its size, in DESCRIPTOR. */ -+ -+static void -+zlib_decompress_section (asection *sectp, -+ struct gdb_bfd_section_data *descriptor) -+{ -+ bfd *abfd = sectp->owner; -+#ifndef HAVE_ZLIB_H -+ error (_("Support for zlib-compressed data (from '%s', section '%s') " -+ "is disabled in this copy of GDB"), -+ bfd_get_filename (abfd), -+ bfd_get_section_name (sectp)); -+#else -+ bfd_size_type compressed_size = bfd_get_section_size (sectp); -+ gdb_byte *compressed_buffer = xmalloc (compressed_size); -+ struct cleanup *cleanup = make_cleanup (xfree, compressed_buffer); -+ struct cleanup *inner_cleanup; -+ bfd_size_type uncompressed_size; -+ gdb_byte *uncompressed_buffer; -+ z_stream strm; -+ int rc; -+ int header_size = 12; -+ struct dwarf2_per_bfd_section *section_data; -+ -+ if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 -+ || bfd_bread (compressed_buffer, -+ compressed_size, abfd) != compressed_size) -+ error (_("can't read data from '%s', section '%s'"), -+ bfd_get_filename (abfd), -+ bfd_get_section_name (abfd, sectp)); -+ -+ /* Read the zlib header. In this case, it should be "ZLIB" followed -+ by the uncompressed section size, 8 bytes in big-endian order. */ -+ if (compressed_size < header_size -+ || strncmp (compressed_buffer, "ZLIB", 4) != 0) -+ error (_("corrupt ZLIB header from '%s', section '%s'"), -+ bfd_get_filename (abfd), -+ bfd_get_section_name (abfd, sectp)); -+ uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8; -+ uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8; -+ uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8; -+ uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8; -+ uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8; -+ uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8; -+ uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8; -+ uncompressed_size += compressed_buffer[11]; -+ -+ /* It is possible the section consists of several compressed -+ buffers concatenated together, so we uncompress in a loop. */ -+ strm.zalloc = NULL; -+ strm.zfree = NULL; -+ strm.opaque = NULL; -+ strm.avail_in = compressed_size - header_size; -+ strm.next_in = (Bytef*) compressed_buffer + header_size; -+ strm.avail_out = uncompressed_size; -+ uncompressed_buffer = xmalloc (uncompressed_size); -+ inner_cleanup = make_cleanup (xfree, uncompressed_buffer); -+ rc = inflateInit (&strm); -+ while (strm.avail_in > 0) -+ { -+ if (rc != Z_OK) -+ error (_("setting up uncompression in '%s', section '%s': %d"), -+ bfd_get_filename (abfd), -+ bfd_get_section_name (abfd, sectp), -+ rc); -+ strm.next_out = ((Bytef*) uncompressed_buffer -+ + (uncompressed_size - strm.avail_out)); -+ rc = inflate (&strm, Z_FINISH); -+ if (rc != Z_STREAM_END) -+ error (_("zlib error uncompressing from '%s', section '%s': %d"), -+ bfd_get_filename (abfd), -+ bfd_get_section_name (abfd, sectp), -+ rc); -+ rc = inflateReset (&strm); -+ } -+ rc = inflateEnd (&strm); -+ if (rc != Z_OK -+ || strm.avail_out != 0) -+ error (_("concluding uncompression in '%s', section '%s': %d"), -+ bfd_get_filename (abfd), -+ bfd_get_section_name (abfd, sectp), -+ rc); -+ -+ discard_cleanups (inner_cleanup); -+ do_cleanups (cleanup); -+ -+ /* Attach the data to the BFD section. */ -+ descriptor->data = uncompressed_buffer; -+ descriptor->size = uncompressed_size; -+#endif -+} -+ -+/* See gdb_bfd.h. */ -+ -+const gdb_byte * -+gdb_bfd_map_section (asection *sectp, bfd_size_type *size) -+{ -+ bfd *abfd; -+ gdb_byte *buf, *retbuf; -+ unsigned char header[4]; -+ struct gdb_bfd_section_data *descriptor; -+ -+ gdb_assert ((sectp->flags & SEC_RELOC) == 0); -+ gdb_assert (size != NULL); -+ -+ abfd = sectp->owner; -+ -+ descriptor = get_section_descriptor (sectp); -+ -+ /* If the data was already read for this BFD, just reuse it. */ -+ if (descriptor->data != NULL) -+ goto done; -+ -+ /* Check if the file has a 4-byte header indicating compression. */ -+ if (bfd_get_section_size (sectp) > sizeof (header) -+ && bfd_seek (abfd, sectp->filepos, SEEK_SET) == 0 -+ && bfd_bread (header, sizeof (header), abfd) == sizeof (header)) -+ { -+ /* Upon decompression, update the buffer and its size. */ -+ if (strncmp (header, "ZLIB", sizeof (header)) == 0) -+ { -+ zlib_decompress_section (sectp, descriptor); -+ goto done; -+ } -+ } -+ -+#ifdef HAVE_MMAP -+ { -+ /* The page size, used when mmapping. */ -+ static int pagesize; -+ -+ if (pagesize == 0) -+ pagesize = getpagesize (); -+ -+ /* Only try to mmap sections which are large enough: we don't want -+ to waste space due to fragmentation. */ -+ -+ if (bfd_get_section_size (sectp) > 4 * pagesize) -+ { -+ descriptor->size = bfd_get_section_size (sectp); -+ descriptor->data = bfd_mmap (abfd, 0, descriptor->size, PROT_READ, -+ MAP_PRIVATE, sectp->filepos, -+ &descriptor->map_addr, -+ &descriptor->map_len); -+ -+ if ((caddr_t)descriptor->data != MAP_FAILED) -+ { -+#if HAVE_POSIX_MADVISE -+ posix_madvise (descriptor->map_addr, descriptor->map_len, -+ POSIX_MADV_WILLNEED); -+#endif -+ goto done; -+ } -+ -+ /* On failure, clear out the section data and try again. */ -+ memset (descriptor, 0, sizeof (*descriptor)); -+ } -+ } -+#endif /* HAVE_MMAP */ -+ -+ /* If we get here, we are a normal, not-compressed section. */ -+ -+ descriptor->size = bfd_get_section_size (sectp); -+ descriptor->data = xmalloc (descriptor->size); -+ -+ if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 -+ || bfd_bread (descriptor->data, bfd_get_section_size (sectp), -+ abfd) != bfd_get_section_size (sectp)) -+ { -+ xfree (descriptor->data); -+ descriptor->data = NULL; -+ error (_("Can't read data for section '%s'"), -+ bfd_get_filename (abfd)); -+ } -+ -+ done: -+ gdb_assert (descriptor->data != NULL); -+ *size = descriptor->size; -+ return descriptor->data; -+} -+ -+ -+ -+/* See gdb_bfd.h. */ -+ -+bfd * -+gdb_bfd_fopen (const char *filename, const char *target, const char *mode, -+ int fd) -+{ -+ bfd *result = bfd_fopen (filename, target, mode, fd); -+ -+ if (result) -+ { -+ gdb_bfd_stash_filename (result); -+ gdb_bfd_ref (result); -+ } -+ -+ return result; -+} -+ -+/* See gdb_bfd.h. */ -+ -+bfd * -+gdb_bfd_openr (const char *filename, const char *target) -+{ -+ bfd *result = bfd_openr (filename, target); -+ -+ if (result) -+ { -+ gdb_bfd_stash_filename (result); -+ gdb_bfd_ref (result); -+ } -+ -+ return result; -+} -+ -+/* See gdb_bfd.h. */ -+ -+bfd * -+gdb_bfd_openw (const char *filename, const char *target) -+{ -+ bfd *result = bfd_openw (filename, target); -+ -+ if (result) -+ { -+ gdb_bfd_stash_filename (result); -+ gdb_bfd_ref (result); -+ } -+ -+ return result; -+} -+ -+/* See gdb_bfd.h. */ -+ -+bfd * -+gdb_bfd_openr_iovec (const char *filename, const char *target, -+ void *(*open_func) (struct bfd *nbfd, -+ void *open_closure), -+ void *open_closure, -+ file_ptr (*pread_func) (struct bfd *nbfd, -+ void *stream, -+ void *buf, -+ file_ptr nbytes, -+ file_ptr offset), -+ int (*close_func) (struct bfd *nbfd, -+ void *stream), -+ int (*stat_func) (struct bfd *abfd, -+ void *stream, -+ struct stat *sb)) -+{ -+ bfd *result = bfd_openr_iovec (filename, target, -+ open_func, open_closure, -+ pread_func, close_func, stat_func); -+ -+ if (result) -+ { -+ gdb_bfd_ref (result); -+ gdb_bfd_stash_filename (result); -+ } -+ -+ return result; -+} -+ -+/* See gdb_bfd.h. */ -+ -+bfd * -+gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous) -+{ -+ bfd *result = bfd_openr_next_archived_file (archive, previous); -+ -+ if (result) -+ { -+ gdb_bfd_ref (result); -+ /* No need to stash the filename here. */ -+ } -+ -+ return result; -+} -+ -+/* See gdb_bfd.h. */ -+ -+bfd * -+gdb_bfd_fdopenr (const char *filename, const char *target, int fd) -+{ -+ bfd *result = bfd_fdopenr (filename, target, fd); -+ -+ if (result) -+ { -+ gdb_bfd_ref (result); -+ gdb_bfd_stash_filename (result); -+ } -+ -+ return result; -+} -+ -+ -+ -+/* A callback for htab_traverse that prints a single BFD. */ -+ -+static int -+print_one_bfd (void **slot, void *data) -+{ -+ bfd *abfd = *slot; -+ struct gdb_bfd_data *gdata = bfd_usrdata (abfd); -+ struct ui_out *uiout = data; -+ struct cleanup *inner; -+ -+ inner = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); -+ ui_out_field_int (uiout, "refcount", gdata->refc); -+ ui_out_field_string (uiout, "addr", host_address_to_string (abfd)); -+ ui_out_field_string (uiout, "filename", bfd_get_filename (abfd)); -+ ui_out_text (uiout, "\n"); -+ do_cleanups (inner); -+ -+ return 1; -+} -+ -+/* Implement the 'maint info bfd' command. */ -+ -+static void -+maintenance_info_bfds (char *arg, int from_tty) -+{ -+ struct cleanup *cleanup; -+ struct ui_out *uiout = current_uiout; -+ -+ cleanup = make_cleanup_ui_out_table_begin_end (uiout, 3, -1, "bfds"); -+ ui_out_table_header (uiout, 10, ui_left, "refcount", "Refcount"); -+ ui_out_table_header (uiout, 18, ui_left, "addr", "Address"); -+ ui_out_table_header (uiout, 40, ui_left, "filename", "Filename"); -+ -+ ui_out_table_body (uiout); -+ htab_traverse (all_bfds, print_one_bfd, uiout); -+ -+ do_cleanups (cleanup); -+} -+ -+/* -Wmissing-prototypes */ -+extern initialize_file_ftype _initialize_gdb_bfd; -+ -+void -+_initialize_gdb_bfd (void) -+{ -+ all_bfds = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer, -+ NULL, xcalloc, xfree); -+ -+ add_cmd ("bfds", class_maintenance, maintenance_info_bfds, _("\ -+List the BFDs that are currently open."), -+ &maintenanceinfolist); -+} -diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h -new file mode 100644 -index 0000000..f131ba7 ---- /dev/null -+++ b/gdb/gdb_bfd.h -@@ -0,0 +1,106 @@ -+/* Definitions for BFD wrappers used by GDB. -+ -+ Copyright (C) 2011, 2012 -+ 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 . */ -+ -+#ifndef GDB_BFD_H -+#define GDB_BFD_H -+ -+/* Make a copy ABFD's filename using bfd_alloc, and reassign it to the -+ BFD. This ensures that the BFD's filename has the same lifetime as -+ the BFD itself. */ -+ -+void gdb_bfd_stash_filename (struct bfd *abfd); -+ -+/* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen. -+ Returns NULL on error. On success, returns a new reference to the -+ BFD, which must be freed with gdb_bfd_unref. BFDs returned by this -+ call are shared among all callers opening the same file. If FD is -+ not -1, then after this call it is owned by BFD. */ -+ -+struct bfd *gdb_bfd_open (const char *name, const char *target, int fd); -+ -+/* Increment the reference count of ABFD. It is fine for ABFD to be -+ NULL; in this case the function does nothing. */ -+ -+void gdb_bfd_ref (struct bfd *abfd); -+ -+/* Decrement the reference count of ABFD. If this is the last -+ reference, ABFD will be freed. If ABFD is NULL, this function does -+ nothing. */ -+ -+void gdb_bfd_unref (struct bfd *abfd); -+ -+/* Try to read or map the contents of the section SECT. If -+ successful, the section data is returned and *SIZE is set to the -+ size of the section data; this may not be the same as the size -+ according to bfd_get_section_size if the section was compressed. -+ The returned section data is associated with the BFD and will be -+ destroyed when the BFD is destroyed. There is no other way to free -+ it; for temporary uses of section data, see -+ bfd_malloc_and_get_section. SECT may not have relocations. This -+ function will throw on error. */ -+ -+const gdb_byte *gdb_bfd_map_section (asection *section, bfd_size_type *size); -+ -+ -+ -+/* A wrapper for bfd_fopen that initializes the gdb-specific reference -+ count and calls gdb_bfd_stash_filename. */ -+ -+bfd *gdb_bfd_fopen (const char *, const char *, const char *, int); -+ -+/* A wrapper for bfd_openr that initializes the gdb-specific reference -+ count and calls gdb_bfd_stash_filename. */ -+ -+bfd *gdb_bfd_openr (const char *, const char *); -+ -+/* A wrapper for bfd_openw that initializes the gdb-specific reference -+ count and calls gdb_bfd_stash_filename. */ -+ -+bfd *gdb_bfd_openw (const char *, const char *); -+ -+/* A wrapper for bfd_openr_iovec that initializes the gdb-specific -+ reference count and calls gdb_bfd_stash_filename. */ -+ -+bfd *gdb_bfd_openr_iovec (const char *filename, const char *target, -+ void *(*open_func) (struct bfd *nbfd, -+ void *open_closure), -+ void *open_closure, -+ file_ptr (*pread_func) (struct bfd *nbfd, -+ void *stream, -+ void *buf, -+ file_ptr nbytes, -+ file_ptr offset), -+ int (*close_func) (struct bfd *nbfd, -+ void *stream), -+ int (*stat_func) (struct bfd *abfd, -+ void *stream, -+ struct stat *sb)); -+ -+/* A wrapper for bfd_openr_next_archived_file that initializes the -+ gdb-specific reference count and calls gdb_bfd_stash_filename. */ -+ -+bfd *gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous); -+ -+/* A wrapper for bfd_fdopenr that initializes the gdb-specific -+ reference count and calls gdb_bfd_stash_filename. */ -+ -+bfd *gdb_bfd_fdopenr (const char *filename, const char *target, int fd); -+ -+#endif /* GDB_BFD_H */ -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 8142ab9..a2953cc 100644 ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -37,6 +37,9 @@ - #include "gdb_assert.h" - #include "hashtab.h" - #include "exceptions.h" -+#include "observer.h" -+#include "dwarf2expr.h" -+#include "dwarf2loc.h" - - /* Initialize BADNESS constants. */ - -@@ -141,7 +144,16 @@ static void print_bit_vector (B_TYPE *, int); - static void print_arg_types (struct field *, int, int); - static void dump_fn_fieldlists (struct type *, int); - static void print_cplus_stuff (struct type *, int); -+static LONGEST type_length_get (struct type *type, struct type *target_type, -+ int full_span); - -+#if 0 -+/* The hash table holding all discardable `struct type *' references. */ -+static htab_t type_discardable_table; -+ -+/* Current type_discardable_check pass used for TYPE_DISCARDABLE_AGE. */ -+static int type_discardable_age_current; -+#endif - - /* Allocate a new OBJFILE-associated type structure and fill it - with some defaults. Space for the type structure is allocated -@@ -172,6 +184,43 @@ alloc_type (struct objfile *objfile) - return type; - } - -+#if 0 -+/* Declare TYPE as discardable on next garbage collection by free_all_types. -+ You must call type_mark_used during each free_all_types to protect TYPE from -+ being deallocated. */ -+ -+static void -+set_type_as_discardable (struct type *type) -+{ -+ void **slot; -+ -+ gdb_assert (!TYPE_DISCARDABLE (type)); -+ -+ TYPE_DISCARDABLE (type) = 1; -+ TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current; -+ -+ slot = htab_find_slot (type_discardable_table, type, INSERT); -+ gdb_assert (!*slot); -+ *slot = type; -+} -+#endif -+ -+/* Allocate a new type like alloc_type but preserve for it the discardability -+ state of PARENT_TYPE. */ -+ -+static struct type * -+alloc_type_as_parent (struct type *parent_type) -+{ -+ struct type *new_type = alloc_type_copy (parent_type); -+ -+#if 0 -+ if (TYPE_DISCARDABLE (parent_type)) -+ set_type_as_discardable (new_type); -+#endif -+ -+ return new_type; -+} -+ - /* Allocate a new GDBARCH-associated type structure and fill it - with some defaults. Space for the type structure is allocated - on the heap. */ -@@ -297,7 +346,7 @@ make_pointer_type (struct type *type, struct type **typeptr) - - if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ - { -- ntype = alloc_type_copy (type); -+ ntype = alloc_type_as_parent (type); - if (typeptr) - *typeptr = ntype; - } -@@ -374,7 +423,7 @@ make_reference_type (struct type *type, struct type **typeptr) - - if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ - { -- ntype = alloc_type_copy (type); -+ ntype = alloc_type_as_parent (type); - if (typeptr) - *typeptr = ntype; - } -@@ -784,6 +833,7 @@ create_range_type (struct type *result_type, struct type *index_type, - TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); - TYPE_LOW_BOUND (result_type) = low_bound; - TYPE_HIGH_BOUND (result_type) = high_bound; -+ TYPE_BYTE_STRIDE (result_type) = 0; - - if (low_bound >= 0) - TYPE_UNSIGNED (result_type) = 1; -@@ -927,26 +977,31 @@ create_array_type (struct type *result_type, - - TYPE_CODE (result_type) = TYPE_CODE_ARRAY; - TYPE_TARGET_TYPE (result_type) = element_type; -- if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) -- low_bound = high_bound = 0; -- CHECK_TYPEDEF (element_type); -- /* Be careful when setting the array length. Ada arrays can be -- empty arrays with the high_bound being smaller than the low_bound. -- In such cases, the array length should be zero. */ -- if (high_bound < low_bound) -- TYPE_LENGTH (result_type) = 0; -- else -- TYPE_LENGTH (result_type) = -- TYPE_LENGTH (element_type) * (high_bound - low_bound + 1); - TYPE_NFIELDS (result_type) = 1; - TYPE_FIELDS (result_type) = - (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field)); - TYPE_INDEX_TYPE (result_type) = range_type; - TYPE_VPTR_FIELDNO (result_type) = -1; - -- /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays. */ -+ /* DWARF blocks may depend on runtime information like -+ DW_OP_PUSH_OBJECT_ADDRESS not being available during the -+ CREATE_ARRAY_TYPE time. */ -+ if (TYPE_RANGE_DATA (range_type)->low.kind != RANGE_BOUND_KIND_CONSTANT -+ || TYPE_RANGE_DATA (range_type)->high.kind != RANGE_BOUND_KIND_CONSTANT -+ || TYPE_DYNAMIC (element_type)) -+ TYPE_LENGTH (result_type) = 0; -+ else -+ { -+ CHECK_TYPEDEF (element_type); -+ TYPE_LENGTH (result_type) = type_length_get (result_type, element_type, -+ 0); -+ } - if (TYPE_LENGTH (result_type) == 0) -- TYPE_TARGET_STUB (result_type) = 1; -+ { -+ /* The real size will be computed for specific instances by -+ CHECK_TYPEDEF. */ -+ TYPE_TARGET_STUB (result_type) = 1; -+ } - - return result_type; - } -@@ -1468,6 +1523,105 @@ stub_noname_complaint (void) - complaint (&symfile_complaints, _("stub type has NULL name")); - } - -+/* Calculate the memory length of array TYPE. -+ -+ TARGET_TYPE should be set to `check_typedef (TYPE_TARGET_TYPE (type))' as -+ a performance hint. Feel free to pass NULL. Set FULL_SPAN to return the -+ size incl. the possible padding of the last element - it may differ from the -+ cleared FULL_SPAN return value (the expected SIZEOF) for non-zero -+ TYPE_BYTE_STRIDE values. */ -+ -+static LONGEST -+type_length_get (struct type *type, struct type *target_type, int full_span) -+{ -+ struct type *range_type; -+ LONGEST byte_stride = 0; /* `= 0' for a false GCC warning. */ -+ LONGEST count, element_size, retval; -+ -+ if (TYPE_CODE (type) != TYPE_CODE_ARRAY -+ && TYPE_CODE (type) != TYPE_CODE_STRING) -+ return TYPE_LENGTH (type); -+ -+ /* Avoid executing TYPE_HIGH_BOUND for invalid (unallocated/unassociated) -+ Fortran arrays. The allocated data will never be used so they can be -+ zero-length. */ -+ if (object_address_data_not_valid (type)) -+ return 0; -+ -+ range_type = TYPE_INDEX_TYPE (type); -+ if (TYPE_LOW_BOUND_UNDEFINED (range_type) -+ || TYPE_HIGH_BOUND_UNDEFINED (range_type)) -+ return 0; -+ count = TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type) + 1; -+ /* It may happen for wrong DWARF annotations returning garbage data. */ -+ if (count < 0) -+ warning (_("Range for type %s has invalid bounds %s..%s"), -+ TYPE_ERROR_NAME (type), plongest (TYPE_LOW_BOUND (range_type)), -+ plongest (TYPE_HIGH_BOUND (range_type))); -+ /* The code below does not handle count == 0 right. */ -+ if (count <= 0) -+ return 0; -+ if (full_span || count > 1) -+ { -+ /* We do not use TYPE_ARRAY_BYTE_STRIDE_VALUE (type) here as we want to -+ force FULL_SPAN to 1. */ -+ byte_stride = TYPE_BYTE_STRIDE (range_type); -+ if (byte_stride == 0) -+ { -+ if (target_type == NULL) -+ target_type = check_typedef (TYPE_TARGET_TYPE (type)); -+ byte_stride = type_length_get (target_type, NULL, 1); -+ } -+ } -+ -+ /* For now, we conservatively take the array length to be 0 if its length -+ exceeds UINT_MAX. The code below assumes that for x < 0, -+ (ULONGEST) x == -x + ULONGEST_MAX + 1, which is technically not guaranteed -+ by C, but is usually true (because it would be true if x were unsigned -+ with its high-order bit on). It uses the fact that high_bound-low_bound is -+ always representable in ULONGEST and that if high_bound-low_bound+1 -+ overflows, it overflows to 0. We must change these tests if we decide to -+ increase the representation of TYPE_LENGTH from unsigned int to ULONGEST. -+ */ -+ -+ if (full_span) -+ { -+ retval = count * byte_stride; -+ if (count == 0 || retval / count != byte_stride || retval > UINT_MAX) -+ retval = 0; -+ return retval; -+ } -+ if (target_type == NULL) -+ target_type = check_typedef (TYPE_TARGET_TYPE (type)); -+ element_size = type_length_get (target_type, NULL, 1); -+ retval = (count - 1) * byte_stride + element_size; -+ if (retval < element_size -+ || (byte_stride != 0 -+ && (retval - element_size) / byte_stride != count - 1) -+ || retval > UINT_MAX) -+ retval = 0; -+ return retval; -+} -+ -+/* Prepare TYPE after being read in by the backend. Currently this function -+ only propagates the TYPE_DYNAMIC flag. */ -+ -+void -+finalize_type (struct type *type) -+{ -+ int i; -+ -+ for (i = 0; i < TYPE_NFIELDS (type); ++i) -+ if (TYPE_FIELD_TYPE (type, i) && TYPE_DYNAMIC (TYPE_FIELD_TYPE (type, i))) -+ break; -+ -+ /* FIXME: cplus_stuff is ignored here. */ -+ if (i < TYPE_NFIELDS (type) -+ || (TYPE_VPTR_BASETYPE (type) && TYPE_DYNAMIC (TYPE_VPTR_BASETYPE (type))) -+ || (TYPE_TARGET_TYPE (type) && TYPE_DYNAMIC (TYPE_TARGET_TYPE (type)))) -+ TYPE_DYNAMIC (type) = 1; -+} -+ - /* Find the real type of TYPE. This function returns the real type, - after removing all layers of typedefs, and completing opaque or stub - types. Completion changes the TYPE argument, but stripping of -@@ -1634,52 +1788,37 @@ check_typedef (struct type *type) - } - } - -- if (TYPE_TARGET_STUB (type)) -+ /* copy_type_recursive automatically makes the resulting type containing only -+ constant values expected by the callers of this function. */ -+ if (TYPE_DYNAMIC (type)) -+ { -+ htab_t copied_types; -+ -+ copied_types = create_copied_types_hash (NULL); -+ type = copy_type_recursive (type, copied_types); -+ htab_delete (copied_types); -+ -+ gdb_assert (TYPE_DYNAMIC (type) == 0); -+ /* Force TYPE_LENGTH (type) recalculation. */ -+ TYPE_DYNAMIC (type) = 1; -+ } -+ -+ if (TYPE_TARGET_STUB (type) || TYPE_DYNAMIC (type)) - { -- struct type *range_type; - struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); - -+ if (TYPE_DYNAMIC (type)) -+ TYPE_TARGET_TYPE (type) = target_type; - if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type)) - { - /* Nothing we can do. */ - } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY -- && TYPE_NFIELDS (type) == 1 -- && (TYPE_CODE (range_type = TYPE_INDEX_TYPE (type)) -- == TYPE_CODE_RANGE)) -+ || TYPE_CODE (type) == TYPE_CODE_STRING) - { - /* Now recompute the length of the array type, based on its -- number of elements and the target type's length. -- Watch out for Ada null Ada arrays where the high bound -- is smaller than the low bound. */ -- const LONGEST low_bound = TYPE_LOW_BOUND (range_type); -- const LONGEST high_bound = TYPE_HIGH_BOUND (range_type); -- ULONGEST len; -- -- if (high_bound < low_bound) -- len = 0; -- else -- { -- /* For now, we conservatively take the array length to be 0 -- if its length exceeds UINT_MAX. The code below assumes -- that for x < 0, (ULONGEST) x == -x + ULONGEST_MAX + 1, -- which is technically not guaranteed by C, but is usually true -- (because it would be true if x were unsigned with its -- high-order bit on). It uses the fact that -- high_bound-low_bound is always representable in -- ULONGEST and that if high_bound-low_bound+1 overflows, -- it overflows to 0. We must change these tests if we -- decide to increase the representation of TYPE_LENGTH -- from unsigned int to ULONGEST. */ -- ULONGEST ulow = low_bound, uhigh = high_bound; -- ULONGEST tlen = TYPE_LENGTH (target_type); -- -- len = tlen * (uhigh - ulow + 1); -- if (tlen == 0 || (len / tlen - 1 + ulow) != uhigh -- || len > UINT_MAX) -- len = 0; -- } -- TYPE_LENGTH (type) = len; -+ number of elements and the target type's length. */ -+ TYPE_LENGTH (type) = type_length_get (type, target_type, 0); - TYPE_TARGET_STUB (type) = 0; - } - else if (TYPE_CODE (type) == TYPE_CODE_RANGE) -@@ -1687,6 +1826,7 @@ check_typedef (struct type *type) - TYPE_LENGTH (type) = TYPE_LENGTH (target_type); - TYPE_TARGET_STUB (type) = 0; - } -+ TYPE_DYNAMIC (type) = 0; - } - - type = make_qualified_type (type, instance_flags, NULL); -@@ -3345,33 +3485,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) - } - - /* Allocate the hash table used by copy_type_recursive to walk -- types without duplicates. We use OBJFILE's obstack, because -- OBJFILE is about to be deleted. */ -+ types without duplicates. */ - - htab_t - create_copied_types_hash (struct objfile *objfile) - { -- return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq, -- NULL, &objfile->objfile_obstack, -- hashtab_obstack_allocate, -- dummy_obstack_deallocate); -+ if (objfile == NULL) -+ { -+ /* NULL OBJFILE is for TYPE_DYNAMIC types already contained in -+ OBJFILE_MALLOC memory, such as those from VALUE_HISTORY_CHAIN. Table -+ element entries get allocated by xmalloc - so use xfree. */ -+ return htab_create (1, type_pair_hash, type_pair_eq, xfree); -+ } -+ else -+ { -+ /* Use OBJFILE's obstack, because OBJFILE is about to be deleted. Table -+ element entries get allocated by xmalloc - so use xfree. */ -+ return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq, -+ xfree, &objfile->objfile_obstack, -+ hashtab_obstack_allocate, -+ dummy_obstack_deallocate); -+ } - } - --/* Recursively copy (deep copy) TYPE, if it is associated with -- OBJFILE. Return a new type allocated using malloc, a saved type if -- we have already visited TYPE (using COPIED_TYPES), or TYPE if it is -- not associated with OBJFILE. */ -+/* A helper for copy_type_recursive. This does all the work. OBJFILE is used -+ only for an assertion checking. */ - --struct type * --copy_type_recursive (struct objfile *objfile, -- struct type *type, -- htab_t copied_types) -+static struct type * -+copy_type_recursive_1 (struct objfile *objfile, -+ struct type *type, -+ htab_t copied_types) - { - struct type_pair *stored, pair; - void **slot; - struct type *new_type; - -- if (! TYPE_OBJFILE_OWNED (type)) -+ if (! TYPE_OBJFILE_OWNED (type) && !TYPE_DYNAMIC (type)) - return type; - - /* This type shouldn't be pointing to any types in other objfiles; -@@ -3386,9 +3535,10 @@ copy_type_recursive (struct objfile *objfile, - new_type = alloc_type_arch (get_type_arch (type)); - - /* We must add the new type to the hash table immediately, in case -- we encounter this type again during a recursive call below. */ -- stored -- = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type_pair)); -+ we encounter this type again during a recursive call below. Memory could -+ be allocated from OBJFILE in the case we will be removing OBJFILE, this -+ optimization is missed and xfree is called for it from COPIED_TYPES. */ -+ stored = xmalloc (sizeof (*stored)); - stored->old = type; - stored->new = new_type; - *slot = stored; -@@ -3399,6 +3549,21 @@ copy_type_recursive (struct objfile *objfile, - TYPE_OBJFILE_OWNED (new_type) = 0; - TYPE_OWNER (new_type).gdbarch = get_type_arch (type); - -+#if 0 -+ /* TYPE_MAIN_TYPE memory copy above rewrote the TYPE_DISCARDABLE flag so we -+ need to initialize it again. And even if TYPE was already discardable -+ NEW_TYPE so far is not registered in TYPE_DISCARDABLE_TABLE. */ -+ TYPE_DISCARDABLE (new_type) = 0; -+ set_type_as_discardable (new_type); -+#endif -+ -+ /* Pre-clear the fields processed by delete_main_type. If DWARF block -+ evaluations below call error we would leave an unfreeable TYPE. */ -+ TYPE_TARGET_TYPE (new_type) = NULL; -+ TYPE_VPTR_BASETYPE (new_type) = NULL; -+ TYPE_NFIELDS (new_type) = 0; -+ TYPE_FIELDS (new_type) = NULL; -+ - if (TYPE_NAME (type)) - TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); - if (TYPE_TAG_NAME (type)) -@@ -3407,12 +3572,48 @@ copy_type_recursive (struct objfile *objfile, - TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); - TYPE_LENGTH (new_type) = TYPE_LENGTH (type); - -+ if (TYPE_ALLOCATED (new_type)) -+ { -+ gdb_assert (!TYPE_NOT_ALLOCATED (new_type)); -+ -+ if (!dwarf_locexpr_baton_eval (TYPE_ALLOCATED (new_type))) -+ TYPE_NOT_ALLOCATED (new_type) = 1; -+ TYPE_ALLOCATED (new_type) = NULL; -+ } -+ -+ if (TYPE_ASSOCIATED (new_type)) -+ { -+ gdb_assert (!TYPE_NOT_ASSOCIATED (new_type)); -+ -+ if (!dwarf_locexpr_baton_eval (TYPE_ASSOCIATED (new_type))) -+ TYPE_NOT_ASSOCIATED (new_type) = 1; -+ TYPE_ASSOCIATED (new_type) = NULL; -+ } -+ -+ if (!TYPE_DATA_LOCATION_IS_ADDR (new_type) -+ && TYPE_DATA_LOCATION_DWARF_BLOCK (new_type)) -+ { -+ if (TYPE_NOT_ALLOCATED (new_type) -+ || TYPE_NOT_ASSOCIATED (new_type)) -+ TYPE_DATA_LOCATION_DWARF_BLOCK (new_type) = NULL; -+ else -+ { -+ TYPE_DATA_LOCATION_IS_ADDR (new_type) = 1; -+ TYPE_DATA_LOCATION_ADDR (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_DATA_LOCATION_DWARF_BLOCK (new_type)); -+ } -+ } -+ - /* Copy the fields. */ - if (TYPE_NFIELDS (type)) - { - int i, nfields; - -+ /* TYPE_CODE_RANGE uses TYPE_RANGE_DATA of the union with TYPE_FIELDS. */ -+ gdb_assert (TYPE_CODE (type) != TYPE_CODE_RANGE); -+ - nfields = TYPE_NFIELDS (type); -+ TYPE_NFIELDS (new_type) = nfields; - TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); - for (i = 0; i < nfields; i++) - { -@@ -3421,8 +3622,8 @@ copy_type_recursive (struct objfile *objfile, - TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); - if (TYPE_FIELD_TYPE (type, i)) - TYPE_FIELD_TYPE (new_type, i) -- = copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i), -- copied_types); -+ = copy_type_recursive_1 (objfile, TYPE_FIELD_TYPE (type, i), -+ copied_types); - if (TYPE_FIELD_NAME (type, i)) - TYPE_FIELD_NAME (new_type, i) = - xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -3453,24 +3654,184 @@ copy_type_recursive (struct objfile *objfile, - } - } - -+ /* Both FIELD_LOC_KIND_DWARF_BLOCK and TYPE_RANGE_HIGH_BOUND_IS_COUNT were -+ possibly converted. */ -+ TYPE_DYNAMIC (new_type) = 0; -+ - /* For range types, copy the bounds information. */ -- if (TYPE_CODE (type) == TYPE_CODE_RANGE) -+ if (TYPE_CODE (new_type) == TYPE_CODE_RANGE) - { - TYPE_RANGE_DATA (new_type) = xmalloc (sizeof (struct range_bounds)); - *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type); -+ -+ switch (TYPE_RANGE_DATA (new_type)->low.kind) -+ { -+ case RANGE_BOUND_KIND_CONSTANT: -+ break; -+ case RANGE_BOUND_KIND_DWARF_BLOCK: -+ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type) -+ || ! has_stack_frames ()) -+ { -+ /* We should set 1 for Fortran but how to find the language? */ -+ TYPE_LOW_BOUND (new_type) = 0; -+ TYPE_LOW_BOUND_UNDEFINED (new_type) = 1; -+ } -+ else -+ { -+ TYPE_LOW_BOUND (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_RANGE_DATA (new_type)->low.u.dwarf_block); -+ if (TYPE_LOW_BOUND (new_type) >= 0) -+ TYPE_UNSIGNED (new_type) = 1; -+ } -+ TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT; -+ break; -+ case RANGE_BOUND_KIND_DWARF_LOCLIST: -+ { -+ CORE_ADDR addr; -+ -+ /* `struct dwarf2_loclist_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (! TYPE_NOT_ALLOCATED (new_type) -+ && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames () -+ && dwarf_loclist_baton_eval -+ (TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.loclist, -+ TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.type, &addr)) -+ { -+ TYPE_LOW_BOUND (new_type) = addr; -+ if (TYPE_LOW_BOUND (new_type) >= 0) -+ TYPE_UNSIGNED (new_type) = 1; -+ } -+ else -+ { -+ /* We should set 1 for Fortran but how to find the language? */ -+ TYPE_LOW_BOUND (new_type) = 0; -+ TYPE_LOW_BOUND_UNDEFINED (new_type) = 1; -+ } -+ TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT; -+ } -+ break; -+ } -+ -+ switch (TYPE_RANGE_DATA (new_type)->high.kind) -+ { -+ case RANGE_BOUND_KIND_CONSTANT: -+ break; -+ case RANGE_BOUND_KIND_DWARF_BLOCK: -+ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type) -+ || ! has_stack_frames ()) -+ { -+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1; -+ TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1; -+ } -+ else -+ TYPE_HIGH_BOUND (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_RANGE_DATA (new_type)->high.u.dwarf_block); -+ TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT; -+ break; -+ case RANGE_BOUND_KIND_DWARF_LOCLIST: -+ { -+ CORE_ADDR addr; -+ -+ /* `struct dwarf2_loclist_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (! TYPE_NOT_ALLOCATED (new_type) -+ && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames () -+ && dwarf_loclist_baton_eval -+ (TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.loclist, -+ TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.type, -+ &addr)) -+ TYPE_HIGH_BOUND (new_type) = addr; -+ else -+ { -+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1; -+ TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1; -+ } -+ TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT; -+ } -+ break; -+ } -+ -+ switch (TYPE_RANGE_DATA (new_type)->byte_stride.kind) -+ { -+ case RANGE_BOUND_KIND_CONSTANT: -+ break; -+ case RANGE_BOUND_KIND_DWARF_BLOCK: -+ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type) -+ || ! has_stack_frames ()) -+ TYPE_BYTE_STRIDE (new_type) = 0; -+ else -+ TYPE_BYTE_STRIDE (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block); -+ TYPE_RANGE_DATA (new_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_CONSTANT; -+ break; -+ case RANGE_BOUND_KIND_DWARF_LOCLIST: -+ { -+ CORE_ADDR addr = 0; -+ -+ /* `struct dwarf2_loclist_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (! TYPE_NOT_ALLOCATED (new_type) -+ && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()) -+ dwarf_loclist_baton_eval -+ (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.loclist, -+ TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.type, -+ &addr); -+ TYPE_BYTE_STRIDE (new_type) = addr; -+ TYPE_RANGE_DATA (new_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_CONSTANT; -+ } -+ break; -+ } -+ -+ /* Convert TYPE_RANGE_HIGH_BOUND_IS_COUNT into a regular bound. */ -+ if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type)) -+ { -+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) -+ + TYPE_HIGH_BOUND (new_type) - 1; -+ TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type) = 0; -+ } - } - - /* Copy pointers to other types. */ - if (TYPE_TARGET_TYPE (type)) - TYPE_TARGET_TYPE (new_type) = -- copy_type_recursive (objfile, -- TYPE_TARGET_TYPE (type), -- copied_types); -+ copy_type_recursive_1 (objfile, -+ TYPE_TARGET_TYPE (type), -+ copied_types); - if (TYPE_VPTR_BASETYPE (type)) - TYPE_VPTR_BASETYPE (new_type) = -- copy_type_recursive (objfile, -- TYPE_VPTR_BASETYPE (type), -- copied_types); -+ copy_type_recursive_1 (objfile, -+ TYPE_VPTR_BASETYPE (type), -+ copied_types); -+ -+ if (TYPE_CODE (new_type) == TYPE_CODE_ARRAY) -+ { -+ struct type *new_index_type = TYPE_INDEX_TYPE (new_type); -+ -+ if (TYPE_BYTE_STRIDE (new_index_type) == 0) -+ TYPE_BYTE_STRIDE (new_index_type) -+ = TYPE_LENGTH (TYPE_TARGET_TYPE (new_type)); -+ } -+ - /* Maybe copy the type_specific bits. - - NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -3487,6 +3848,17 @@ copy_type_recursive (struct objfile *objfile, - return new_type; - } - -+/* Recursively copy (deep copy) TYPE. Return a new type allocated using -+ malloc, a saved type if we have already visited TYPE (using COPIED_TYPES), -+ or TYPE if it is not associated with OBJFILE. */ -+ -+struct type * -+copy_type_recursive (struct type *type, -+ htab_t copied_types) -+{ -+ return copy_type_recursive_1 (TYPE_OBJFILE (type), type, copied_types); -+} -+ - /* Make a copy of the given TYPE, except that the pointer & reference - types are not preserved. - -@@ -3509,6 +3881,201 @@ copy_type (const struct type *type) - return new_type; - } - -+#if 0 -+/* Callback type for main_type_crawl. */ -+typedef int (*main_type_crawl_iter) (struct type *type, void *data); -+ -+/* Iterate all main_type structures reachable through any `struct type *' from -+ TYPE. ITER will be called only for one type of each main_type, use -+ TYPE_CHAIN traversal to find all the type instances. ITER is being called -+ for each main_type found. ITER returns non-zero if main_type_crawl should -+ depth-first enter the specific type. ITER must provide some detection for -+ reentering the same main_type as this function would otherwise endlessly -+ loop. */ -+ -+static void -+main_type_crawl (struct type *type, main_type_crawl_iter iter, void *data) -+{ -+ struct type *type_iter; -+ int i; -+ -+ if (!type) -+ return; -+ -+ gdb_assert (TYPE_OBJFILE (type) == NULL); -+ -+ /* `struct cplus_struct_type' handling is unsupported by this function. */ -+ gdb_assert ((TYPE_CODE (type) != TYPE_CODE_STRUCT -+ && TYPE_CODE (type) != TYPE_CODE_UNION) -+ || !HAVE_CPLUS_STRUCT (type)); -+ -+ if (!(*iter) (type, data)) -+ return; -+ -+ /* Iterate all the type instances of this main_type. */ -+ type_iter = type; -+ do -+ { -+ gdb_assert (TYPE_MAIN_TYPE (type_iter) == TYPE_MAIN_TYPE (type)); -+ -+ main_type_crawl (TYPE_POINTER_TYPE (type), iter, data); -+ main_type_crawl (TYPE_REFERENCE_TYPE (type), iter, data); -+ -+ type_iter = TYPE_CHAIN (type_iter); -+ } -+ while (type_iter != type); -+ -+ for (i = 0; i < TYPE_NFIELDS (type); i++) -+ main_type_crawl (TYPE_FIELD_TYPE (type, i), iter, data); -+ -+ main_type_crawl (TYPE_TARGET_TYPE (type), iter, data); -+ main_type_crawl (TYPE_VPTR_BASETYPE (type), iter, data); -+} -+ -+/* A helper for delete_type which deletes a main_type and the things to which -+ it refers. TYPE is a type whose main_type we wish to destroy. */ -+ -+static void -+delete_main_type (struct type *type) -+{ -+ int i; -+ -+ gdb_assert (TYPE_DISCARDABLE (type)); -+ gdb_assert (TYPE_OBJFILE (type) == NULL); -+ -+ xfree (TYPE_NAME (type)); -+ xfree (TYPE_TAG_NAME (type)); -+ -+ for (i = 0; i < TYPE_NFIELDS (type); ++i) -+ { -+ xfree (TYPE_FIELD_NAME (type, i)); -+ -+ if (TYPE_FIELD_LOC_KIND (type, i) == FIELD_LOC_KIND_PHYSNAME) -+ xfree (TYPE_FIELD_STATIC_PHYSNAME (type, i)); -+ } -+ xfree (TYPE_FIELDS (type)); -+ -+ gdb_assert (!HAVE_CPLUS_STRUCT (type)); -+ -+ xfree (TYPE_MAIN_TYPE (type)); -+} -+ -+/* Delete all the instances on TYPE_CHAIN of TYPE, including their referenced -+ main_type. TYPE must be a reclaimable type - neither permanent nor objfile -+ associated. */ -+ -+static void -+delete_type_chain (struct type *type) -+{ -+ struct type *type_iter, *type_iter_to_free; -+ -+ gdb_assert (TYPE_DISCARDABLE (type)); -+ gdb_assert (TYPE_OBJFILE (type) == NULL); -+ -+ delete_main_type (type); -+ -+ type_iter = type; -+ do -+ { -+ type_iter_to_free = type_iter; -+ type_iter = TYPE_CHAIN (type_iter); -+ xfree (type_iter_to_free); -+ } -+ while (type_iter != type); -+} -+ -+/* Hash function for type_discardable_table. */ -+ -+static hashval_t -+type_discardable_hash (const void *p) -+{ -+ const struct type *type = p; -+ -+ return htab_hash_pointer (TYPE_MAIN_TYPE (type)); -+} -+ -+/* Equality function for type_discardable_table. */ -+ -+static int -+type_discardable_equal (const void *a, const void *b) -+{ -+ const struct type *left = a; -+ const struct type *right = b; -+ -+ return TYPE_MAIN_TYPE (left) == TYPE_MAIN_TYPE (right); -+} -+ -+/* A helper for type_mark_used. */ -+ -+static int -+type_mark_used_crawl (struct type *type, void *unused) -+{ -+ if (!TYPE_DISCARDABLE (type)) -+ return 0; -+ -+ if (TYPE_DISCARDABLE_AGE (type) == type_discardable_age_current) -+ return 0; -+ -+ TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current; -+ -+ /* Continue the traversal. */ -+ return 1; -+} -+ -+/* Mark TYPE and its connected types as used in this free_all_types pass. */ -+ -+void -+type_mark_used (struct type *type) -+{ -+ if (type == NULL) -+ return; -+ -+ if (!TYPE_DISCARDABLE (type)) -+ return; -+ -+ main_type_crawl (type, type_mark_used_crawl, NULL); -+} -+ -+/* A traverse callback for type_discardable_table which removes any -+ type_discardable whose reference count is now zero (unused link). */ -+ -+static int -+type_discardable_remove (void **slot, void *unused) -+{ -+ struct type *type = *slot; -+ -+ gdb_assert (TYPE_DISCARDABLE (type)); -+ -+ if (TYPE_DISCARDABLE_AGE (type) != type_discardable_age_current) -+ { -+ delete_type_chain (type); -+ -+ htab_clear_slot (type_discardable_table, slot); -+ } -+ -+ return 1; -+} -+ -+/* Free all the reclaimable types that have been allocated and that have -+ currently zero reference counter. -+ -+ This function is called after each command, successful or not. Use this -+ cleanup only in the GDB idle state as GDB only marks those types used by -+ globally tracked objects (with no autovariable references tracking). */ -+ -+void -+free_all_types (void) -+{ -+ /* Mark a new pass. As GDB checks all the entries were visited after each -+ pass there cannot be any stale entries already containing the changed -+ value. */ -+ type_discardable_age_current ^= 1; -+ -+ observer_notify_mark_used (); -+ -+ htab_traverse (type_discardable_table, type_discardable_remove, NULL); -+} -+#endif - - /* Helper functions to initialize architecture-specific types. */ - -@@ -4042,6 +4609,13 @@ void - _initialize_gdbtypes (void) - { - gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); -+ -+#if 0 -+ type_discardable_table = htab_create_alloc (20, type_discardable_hash, -+ type_discardable_equal, NULL, -+ xcalloc, xfree); -+#endif -+ - objfile_type_data = register_objfile_data (); - - add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 17bfbc5..72e9cc5 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -228,6 +228,11 @@ enum type_instance_flag_value - - #define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) - -+/* Type needs to be evaluated on each CHECK_TYPEDEF and its results must not be -+ sticky. */ -+ -+#define TYPE_DYNAMIC(t) (TYPE_MAIN_TYPE (t)->flag_dynamic) -+ - /* Static type. If this is set, the corresponding type had - a static modifier. - Note: This may be unnecessary, since static data members -@@ -311,6 +316,50 @@ enum type_instance_flag_value - - #define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum) - -+#if 0 -+/* Define this type as being reclaimable during free_all_types. Type is -+ required to be have TYPE_OBJFILE set to NULL. Setting this flag requires -+ initializing TYPE_DISCARDABLE_AGE, see alloc_type_discardable. */ -+ -+#define TYPE_DISCARDABLE(t) (TYPE_MAIN_TYPE (t)->flag_discardable) -+ -+/* Marker this type has been visited by the type_mark_used by this -+ mark-and-sweep types garbage collecting pass. Current pass is represented -+ by TYPE_DISCARDABLE_AGE_CURRENT. */ -+ -+#define TYPE_DISCARDABLE_AGE(t) (TYPE_MAIN_TYPE (t)->flag_discardable_age) -+#endif -+ -+/* Is HIGH_BOUND a low-bound relative count (1) or the high bound itself (0)? */ -+ -+#define TYPE_RANGE_HIGH_BOUND_IS_COUNT(range_type) \ -+ (TYPE_MAIN_TYPE (range_type)->flag_range_high_bound_is_count) -+ -+/* Not allocated. TYPE_ALLOCATED(t) must be NULL in such case. If this flag -+ is unset and TYPE_ALLOCATED(t) is NULL then the type is allocated. If this -+ flag is unset and TYPE_ALLOCATED(t) is not NULL then its DWARF block -+ determines the actual allocation state. */ -+ -+#define TYPE_NOT_ALLOCATED(t) (TYPE_MAIN_TYPE (t)->flag_not_allocated) -+ -+/* Not associated. TYPE_ASSOCIATED(t) must be NULL in such case. If this flag -+ is unset and TYPE_ASSOCIATED(t) is NULL then the type is associated. If -+ this flag is unset and TYPE_ASSOCIATED(t) is not NULL then its DWARF block -+ determines the actual association state. */ -+ -+#define TYPE_NOT_ASSOCIATED(t) (TYPE_MAIN_TYPE (t)->flag_not_associated) -+ -+/* Address of the actual data as for DW_AT_data_location. Its dwarf block must -+ not be evaluated unless both TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are -+ false. If TYPE_DATA_LOCATION_IS_ADDR set then TYPE_DATA_LOCATION_ADDR value -+ is the actual data address value. If unset and -+ TYPE_DATA_LOCATION_DWARF_BLOCK is NULL then the value is the normal -+ value_raw_address. If unset and TYPE_DATA_LOCATION_DWARF_BLOCK is not NULL -+ then its DWARF block determines the actual data address. */ -+ -+#define TYPE_DATA_LOCATION_IS_ADDR(t) \ -+ (TYPE_MAIN_TYPE (t)->flag_data_location_is_addr) -+ - /* Constant type. If this is set, the corresponding type has a - const modifier. */ - -@@ -421,6 +470,15 @@ struct main_type - /* True if this type was declared with "class" rather than - "struct". */ - unsigned int flag_declared_class : 1; -+#if 0 -+ unsigned int flag_discardable : 1; -+ unsigned int flag_discardable_age : 1; -+#endif -+ unsigned int flag_dynamic : 1; -+ unsigned int flag_range_high_bound_is_count : 1; -+ unsigned int flag_not_allocated : 1; -+ unsigned int flag_not_associated : 1; -+ unsigned int flag_data_location_is_addr : 1; - - /* True if this is an enum type with disjoint values. This affects - how the enum is printed. */ -@@ -501,6 +559,20 @@ struct main_type - - struct type *target_type; - -+ /* For DW_AT_data_location. */ -+ union -+ { -+ struct dwarf2_locexpr_baton *dwarf_block; -+ CORE_ADDR addr; -+ } -+ data_location; -+ -+ /* For DW_AT_allocated. */ -+ struct dwarf2_locexpr_baton *allocated; -+ -+ /* For DW_AT_associated. */ -+ struct dwarf2_locexpr_baton *associated; -+ - /* For structure and union types, a description of each field. - For set and pascal array types, there is one "field", - whose type is the domain type of the set or array. -@@ -583,13 +655,34 @@ struct main_type - - struct range_bounds - { -+ struct -+ { -+ union -+ { -+ LONGEST constant; -+ struct dwarf2_locexpr_baton *dwarf_block; -+ struct -+ { -+ struct dwarf2_loclist_baton *loclist; -+ struct type *type; -+ } -+ dwarf_loclist; -+ } -+ u; -+ enum range_bound_kind -+ { -+ RANGE_BOUND_KIND_CONSTANT, -+ RANGE_BOUND_KIND_DWARF_BLOCK, -+ RANGE_BOUND_KIND_DWARF_LOCLIST -+ } -+ kind; -+ } - /* Low bound of range. */ -- -- LONGEST low; -- -+ low, - /* High bound of range. */ -- -- LONGEST high; -+ high, -+ /* Byte stride of range. */ -+ byte_stride; - - /* Flags indicating whether the values of low and high are - valid. When true, the respective range value is -@@ -1054,9 +1147,9 @@ extern void allocate_gnat_aux_type (struct type *); - #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type - #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type - #define TYPE_CHAIN(thistype) (thistype)->chain --/* Note that if thistype is a TYPEDEF type, you have to call check_typedef. -- But check_typedef does set the TYPE_LENGTH of the TYPEDEF type, -- so you only have to call check_typedef once. Since allocate_value -+/* Note that if thistype is a TYPEDEF, ARRAY or STRING type, you have to call -+ check_typedef. But check_typedef does set the TYPE_LENGTH of the TYPEDEF -+ type, so you only have to call check_typedef once. Since allocate_value - calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ - #define TYPE_LENGTH(thistype) (thistype)->length - /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real -@@ -1064,11 +1157,16 @@ extern void allocate_gnat_aux_type (struct type *); - #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code - #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields - #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields -+#define TYPE_DATA_LOCATION_DWARF_BLOCK(thistype) TYPE_MAIN_TYPE (thistype)->data_location.dwarf_block -+#define TYPE_DATA_LOCATION_ADDR(thistype) TYPE_MAIN_TYPE (thistype)->data_location.addr -+#define TYPE_ALLOCATED(thistype) TYPE_MAIN_TYPE (thistype)->allocated -+#define TYPE_ASSOCIATED(thistype) TYPE_MAIN_TYPE (thistype)->associated - - #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0) - #define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds --#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low --#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high -+#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low.u.constant -+#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high.u.constant -+#define TYPE_BYTE_STRIDE(range_type) TYPE_RANGE_DATA(range_type)->byte_stride.u.constant - #define TYPE_LOW_BOUND_UNDEFINED(range_type) \ - TYPE_RANGE_DATA(range_type)->low_undefined - #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \ -@@ -1085,7 +1183,14 @@ extern void allocate_gnat_aux_type (struct type *); - (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) - - #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ -- (TYPE_LOW_BOUND(TYPE_INDEX_TYPE((arraytype)))) -+ TYPE_LOW_BOUND (TYPE_INDEX_TYPE (arraytype)) -+ -+/* TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) with a fallback to the -+ element size if no specific stride value is known. */ -+#define TYPE_ARRAY_BYTE_STRIDE_VALUE(arraytype) \ -+ (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) == 0 \ -+ ? TYPE_LENGTH (TYPE_TARGET_TYPE (arraytype)) \ -+ : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype))) - - /* C++ */ - -@@ -1531,6 +1636,18 @@ extern struct type *create_array_type (struct type *, struct type *, - struct type *); - extern struct type *lookup_array_range_type (struct type *, int, int); - -+extern CORE_ADDR type_range_any_field_internal (struct type *range_type, -+ int fieldno); -+ -+extern int type_range_high_bound_internal (struct type *range_type); -+ -+extern int type_range_count_bound_internal (struct type *range_type); -+ -+extern CORE_ADDR type_range_byte_stride_internal (struct type *range_type, -+ struct type *element_type); -+ -+extern void finalize_type (struct type *type); -+ - extern struct type *create_string_type (struct type *, struct type *, - struct type *); - extern struct type *lookup_string_range_type (struct type *, int, int); -@@ -1576,6 +1693,10 @@ extern int is_public_ancestor (struct type *, struct type *); - - extern int is_unique_ancestor (struct type *, struct value *); - -+#if 0 -+extern void type_mark_used (struct type *type); -+#endif -+ - /* Overload resolution */ - - #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1651,10 +1772,13 @@ extern void maintenance_print_type (char *, int); - - extern htab_t create_copied_types_hash (struct objfile *objfile); - --extern struct type *copy_type_recursive (struct objfile *objfile, -- struct type *type, -+extern struct type *copy_type_recursive (struct type *type, - htab_t copied_types); - - extern struct type *copy_type (const struct type *type); - -+#if 0 -+extern void free_all_types (void); -+#endif -+ - #endif /* GDBTYPES_H */ -diff --git a/gdb/jit.c b/gdb/jit.c -index 568d17b..cdd9f49 100644 ---- a/gdb/jit.c -+++ b/gdb/jit.c -@@ -38,6 +38,7 @@ - #include "gdb-dlfcn.h" - #include "gdb_stat.h" - #include "exceptions.h" -+#include "gdb_bfd.h" - - static const char *jit_reader_dir = NULL; - -@@ -132,17 +133,16 @@ mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb) - static struct bfd * - bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, char *target) - { -- const char *filename = xstrdup (""); - struct target_buffer *buffer = xmalloc (sizeof (struct target_buffer)); - - buffer->base = addr; - buffer->size = size; -- return bfd_openr_iovec (filename, target, -- mem_bfd_iovec_open, -- buffer, -- mem_bfd_iovec_pread, -- mem_bfd_iovec_close, -- mem_bfd_iovec_stat); -+ return gdb_bfd_openr_iovec ("", target, -+ mem_bfd_iovec_open, -+ buffer, -+ mem_bfd_iovec_pread, -+ mem_bfd_iovec_close, -+ mem_bfd_iovec_stat); - } - - /* One reader that has been loaded successfully, and can potentially be used to -@@ -868,7 +868,7 @@ jit_bfd_try_read_symtab (struct jit_code_entry *code_entry, - { - printf_unfiltered (_("\ - JITed symbol file is not an object file, ignoring it.\n")); -- bfd_close (nbfd); -+ gdb_bfd_unref (nbfd); - return; - } - -@@ -896,7 +896,8 @@ JITed symbol file is not an object file, ignoring it.\n")); - ++i; - } - -- /* This call takes ownership of NBFD. It does not take ownership of SAI. */ -+ /* This call does not take ownership of SAI. */ -+ make_cleanup_bfd_unref (nbfd); - objfile = symbol_file_add_from_bfd (nbfd, 0, sai, OBJF_SHARED, NULL); - - do_cleanups (old_cleanups); -diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c -index 76e4bf1..9a2f5aa 100644 ---- a/gdb/m32r-rom.c -+++ b/gdb/m32r-rom.c -@@ -40,6 +40,7 @@ - #include "inferior.h" - #include - #include "regcache.h" -+#include "gdb_bfd.h" - - /* - * All this stuff just to get my host computer's IP address! -@@ -124,13 +125,15 @@ m32r_load (char *filename, int from_tty) - bfd *abfd; - unsigned int data_count = 0; - struct timeval start_time, end_time; -+ struct cleanup *cleanup; - - if (filename == NULL || filename[0] == 0) - filename = get_exec_file (1); - -- abfd = bfd_openr (filename, 0); -+ abfd = gdb_bfd_openr (filename, 0); - if (!abfd) - error (_("Unable to open file %s."), filename); -+ cleanup = make_cleanup_bfd_unref (abfd); - if (bfd_check_format (abfd, bfd_object) == 0) - error (_("File is not an object file.")); - gettimeofday (&start_time, NULL); -@@ -188,6 +191,7 @@ m32r_load (char *filename, int from_tty) - confused... */ - - clear_symtab_users (0); -+ do_cleanups (cleanup); - } - - static void -@@ -434,6 +438,7 @@ m32r_upload_command (char *args, int from_tty) - char buf[1024]; - struct hostent *hostent; - struct in_addr inet_addr; -+ struct cleanup *cleanup; - - /* First check to see if there's an ethernet port! */ - monitor_printf ("ust\r"); -@@ -524,7 +529,8 @@ m32r_upload_command (char *args, int from_tty) - printf_filtered (" -- Ethernet load complete.\n"); - - gettimeofday (&end_time, NULL); -- abfd = bfd_openr (args, 0); -+ abfd = gdb_bfd_openr (args, 0); -+ cleanup = make_cleanup_bfd_unref (abfd); - if (abfd != NULL) - { /* Download is done -- print section statistics. */ - if (bfd_check_format (abfd, bfd_object) == 0) -@@ -565,6 +571,7 @@ m32r_upload_command (char *args, int from_tty) - confused... */ - - clear_symtab_users (0); -+ do_cleanups (cleanup); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -diff --git a/gdb/machoread.c b/gdb/machoread.c -index 22530ab..0d7578a 100644 ---- a/gdb/machoread.c -+++ b/gdb/machoread.c -@@ -454,6 +454,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, - asymbol **symp; - struct bfd_hash_table table; - int nbr_sections; -+ struct cleanup *cleanup; - - /* Per section flag to mark which section have been rebased. */ - unsigned char *sections_rebased; -@@ -466,14 +467,14 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, - { - warning (_("`%s': can't read symbols: %s."), oso->name, - bfd_errmsg (bfd_get_error ())); -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return; - } - - if (abfd->my_archive == NULL && oso->mtime != bfd_get_mtime (abfd)) - { - warning (_("`%s': file time stamp mismatch."), oso->name); -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return; - } - -@@ -482,7 +483,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, - oso->nbr_syms)) - { - warning (_("`%s': can't create hash table"), oso->name); -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return; - } - -@@ -629,18 +630,15 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, - - bfd_hash_table_free (&table); - -- /* Make sure that the filename was malloc'ed. The current filename comes -- either from an OSO symbol name or from an archive name. Memory for both -- is not managed by gdb. */ -- abfd->filename = xstrdup (abfd->filename); -- - /* We need to clear SYMFILE_MAINLINE to avoid interractive question - from symfile.c:symbol_file_add_with_addrs_or_offsets. */ -+ cleanup = make_cleanup_bfd_unref (abfd); - symbol_file_add_from_bfd - (abfd, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE), NULL, - main_objfile->flags & (OBJF_REORDERED | OBJF_SHARED - | OBJF_READNOW | OBJF_USERLOADED), - main_objfile); -+ do_cleanups (cleanup); - } - - /* Read symbols from the vector of oso files. */ -@@ -651,6 +649,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) - int ix; - VEC (oso_el) *vec; - oso_el *oso; -+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); - - vec = oso_vector; - oso_vector = NULL; -@@ -677,6 +676,8 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) - memcpy (archive_name, oso->name, pfx_len); - archive_name[pfx_len] = '\0'; - -+ make_cleanup (xfree, archive_name); -+ - /* Compute number of oso for this archive. */ - for (last_ix = ix; - VEC_iterate (oso_el, vec, last_ix, oso2); last_ix++) -@@ -686,7 +687,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) - } - - /* Open the archive and check the format. */ -- archive_bfd = bfd_openr (archive_name, gnutarget); -+ archive_bfd = gdb_bfd_openr (archive_name, gnutarget); - if (archive_bfd == NULL) - { - warning (_("Could not open OSO archive file \"%s\""), -@@ -698,17 +699,18 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) - { - warning (_("OSO archive file \"%s\" not an archive."), - archive_name); -- bfd_close (archive_bfd); -+ gdb_bfd_unref (archive_bfd); - ix = last_ix; - continue; - } -- member_bfd = bfd_openr_next_archived_file (archive_bfd, NULL); -+ -+ member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd, NULL); - - if (member_bfd == NULL) - { - warning (_("Could not read archive members out of " - "OSO archive \"%s\""), archive_name); -- bfd_close (archive_bfd); -+ gdb_bfd_unref (archive_bfd); - ix = last_ix; - continue; - } -@@ -738,12 +740,12 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) - } - - prev = member_bfd; -- member_bfd = bfd_openr_next_archived_file -- (archive_bfd, member_bfd); -+ member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd, -+ member_bfd); - - /* Free previous member if not referenced by an oso. */ - if (ix2 >= last_ix) -- bfd_close (prev); -+ gdb_bfd_unref (prev); - } - for (ix2 = ix; ix2 < last_ix; ix2++) - { -@@ -759,7 +761,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) - { - bfd *abfd; - -- abfd = bfd_openr (oso->name, gnutarget); -+ abfd = gdb_bfd_openr (oso->name, gnutarget); - if (!abfd) - warning (_("`%s': can't open to read symbols: %s."), oso->name, - bfd_errmsg (bfd_get_error ())); -@@ -771,6 +773,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) - } - - VEC_free (oso_el, vec); -+ do_cleanups (cleanup); - } - - /* DSYM (debug symbols) files contain the debug info of an executable. -@@ -808,20 +811,17 @@ macho_check_dsym (struct objfile *objfile) - warning (_("can't find UUID in %s"), objfile->name); - return NULL; - } -- dsym_filename = xstrdup (dsym_filename); -- dsym_bfd = bfd_openr (dsym_filename, gnutarget); -+ dsym_bfd = gdb_bfd_openr (dsym_filename, gnutarget); - if (dsym_bfd == NULL) - { - warning (_("can't open dsym file %s"), dsym_filename); -- xfree (dsym_filename); - return NULL; - } - - if (!bfd_check_format (dsym_bfd, bfd_object)) - { -- bfd_close (dsym_bfd); -+ gdb_bfd_unref (dsym_bfd); - warning (_("bad dsym file format: %s"), bfd_errmsg (bfd_get_error ())); -- xfree (dsym_filename); - return NULL; - } - -@@ -829,16 +829,14 @@ macho_check_dsym (struct objfile *objfile) - BFD_MACH_O_LC_UUID, &dsym_uuid) == 0) - { - warning (_("can't find UUID in %s"), dsym_filename); -- bfd_close (dsym_bfd); -- xfree (dsym_filename); -+ gdb_bfd_unref (dsym_bfd); - return NULL; - } - if (memcmp (dsym_uuid->command.uuid.uuid, main_uuid->command.uuid.uuid, - sizeof (main_uuid->command.uuid.uuid))) - { - warning (_("dsym file UUID doesn't match the one in %s"), objfile->name); -- bfd_close (dsym_bfd); -- xfree (dsym_filename); -+ gdb_bfd_unref (dsym_bfd); - return NULL; - } - return dsym_bfd; -@@ -902,6 +900,7 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags) - int ix; - oso_el *oso; - struct bfd_section *asect, *dsect; -+ struct cleanup *cleanup; - - if (mach_o_debug_level > 0) - printf_unfiltered (_("dsym file found\n")); -@@ -922,7 +921,9 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags) - } - - /* Add the dsym file as a separate file. */ -+ cleanup = make_cleanup_bfd_unref (dsym_bfd); - symbol_file_add_separate (dsym_bfd, symfile_flags, objfile); -+ do_cleanups (cleanup); - - /* Don't try to read dwarf2 from main file or shared libraries. */ - return; -diff --git a/gdb/main.c b/gdb/main.c -index d075694..e4da3f1 100644 ---- a/gdb/main.c -+++ b/gdb/main.c -@@ -37,6 +37,7 @@ - - #include "interps.h" - #include "main.h" -+#include "python/python.h" - #include "source.h" - #include "cli/cli-cmds.h" - #include "python/python.h" -@@ -283,6 +284,8 @@ captured_main (void *data) - char *cdarg = NULL; - char *ttyarg = NULL; - -+ int python_script = 0; -+ - /* These are static so that we can take their address in an - initializer. */ - static int print_help; -@@ -471,10 +474,14 @@ captured_main (void *data) - {"args", no_argument, &set_args, 1}, - {"l", required_argument, 0, 'l'}, - {"return-child-result", no_argument, &return_child_result, 1}, -+#if HAVE_PYTHON -+ {"python", no_argument, 0, 'P'}, -+ {"P", no_argument, 0, 'P'}, -+#endif - {0, no_argument, 0, 0} - }; - -- while (1) -+ while (!python_script) - { - int option_index; - -@@ -492,6 +499,9 @@ captured_main (void *data) - case 0: - /* Long option that just sets a flag. */ - break; -+ case 'P': -+ python_script = 1; -+ break; - case OPT_SE: - symarg = optarg; - execarg = optarg; -@@ -699,7 +709,31 @@ captured_main (void *data) - - /* Now that gdb_init has created the initial inferior, we're in - position to set args for that inferior. */ -- if (set_args) -+ if (python_script) -+ { -+ /* The first argument is a python script to evaluate, and -+ subsequent arguments are passed to the script for -+ processing there. */ -+ if (optind >= argc) -+ { -+ fprintf_unfiltered (gdb_stderr, -+ _("%s: Python script file name required\n"), -+ argv[0]); -+ exit (1); -+ } -+ -+ /* FIXME: should handle inferior I/O intelligently here. -+ E.g., should be possible to run gdb in pipeline and have -+ Python (and gdb) output go to stderr or file; and if a -+ prompt is needed, open the tty. */ -+ quiet = 1; -+ /* FIXME: should read .gdbinit if, and only if, a prompt is -+ requested by the script. Though... maybe this is not -+ ideal? */ -+ /* FIXME: likewise, reading in history. */ -+ inhibit_gdbinit = 1; -+ } -+ else if (set_args) - { - /* The remaining options are the command-line options for the - inferior. The first one is the sym/exec file, and the rest -@@ -979,7 +1013,8 @@ captured_main (void *data) - - /* Read in the old history after all the command files have been - read. */ -- init_history (); -+ if (!python_script) -+ init_history (); - - if (batch_flag) - { -@@ -990,13 +1025,25 @@ captured_main (void *data) - /* Show time and/or space usage. */ - do_cleanups (pre_stat_chain); - -- /* NOTE: cagney/1999-11-07: There is probably no reason for not -- moving this loop and the code found in captured_command_loop() -- into the command_loop() proper. The main thing holding back that -- change - SET_TOP_LEVEL() - has been eliminated. */ -- while (1) -+#if HAVE_PYTHON -+ if (python_script) - { -- catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); -+ extern int pagination_enabled; -+ pagination_enabled = 0; -+ run_python_script (argc - optind, &argv[optind]); -+ return 1; -+ } -+ else -+#endif -+ { -+ /* NOTE: cagney/1999-11-07: There is probably no reason for not -+ moving this loop and the code found in captured_command_loop() -+ into the command_loop() proper. The main thing holding back that -+ change - SET_TOP_LEVEL() - has been eliminated. */ -+ while (1) -+ { -+ catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); -+ } - } - /* No exit -- exit is through quit_command. */ - } -@@ -1028,7 +1075,12 @@ print_gdb_help (struct ui_file *stream) - fputs_unfiltered (_("\ - This is the GNU debugger. Usage:\n\n\ - gdb [options] [executable-file [core-file or process-id]]\n\ -- gdb [options] --args executable-file [inferior-arguments ...]\n\n\ -+ gdb [options] --args executable-file [inferior-arguments ...]\n"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream); -+#endif -+ fputs_unfiltered (_("\n\ - Options:\n\n\ - "), stream); - fputs_unfiltered (_("\ -@@ -1068,7 +1120,13 @@ Options:\n\n\ - --nw Do not use a window interface.\n\ - --nx Do not read "), stream); - fputs_unfiltered (gdbinit, stream); -- fputs_unfiltered (_(" file.\n\ -+ fputs_unfiltered (_(" file.\n"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ --python, -P Following argument is Python script file; remaining\n\ -+ arguments are passed to script.\n"), stream); -+#endif -+ fputs_unfiltered (_("\ - --quiet Do not print version number on startup.\n\ - --readnow Fully read symbol files on first access.\n\ - "), stream); -diff --git a/gdb/objfiles.c b/gdb/objfiles.c -index f5e5c75..411618f 100644 ---- a/gdb/objfiles.c -+++ b/gdb/objfiles.c -@@ -53,6 +53,7 @@ - #include "complaints.h" - #include "psymtab.h" - #include "solist.h" -+#include "gdb_bfd.h" - - /* Prototypes for local functions */ - -@@ -195,7 +196,8 @@ allocate_objfile (bfd *abfd, int flags) - that any data that is reference is saved in the per-objfile data - region. */ - -- objfile->obfd = gdb_bfd_ref (abfd); -+ objfile->obfd = abfd; -+ gdb_bfd_ref (abfd); - if (abfd != NULL) - { - /* Look up the gdbarch associated with the BFD. */ -@@ -1456,75 +1458,6 @@ objfiles_changed (void) - get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1; - } - --/* Close ABFD, and warn if that fails. */ -- --int --gdb_bfd_close_or_warn (struct bfd *abfd) --{ -- int ret; -- char *name = bfd_get_filename (abfd); -- -- ret = bfd_close (abfd); -- -- if (!ret) -- warning (_("cannot close \"%s\": %s"), -- name, bfd_errmsg (bfd_get_error ())); -- -- return ret; --} -- --/* Add reference to ABFD. Returns ABFD. */ --struct bfd * --gdb_bfd_ref (struct bfd *abfd) --{ -- int *p_refcount; -- -- if (abfd == NULL) -- return NULL; -- -- p_refcount = bfd_usrdata (abfd); -- -- if (p_refcount != NULL) -- { -- *p_refcount += 1; -- return abfd; -- } -- -- p_refcount = xmalloc (sizeof (*p_refcount)); -- *p_refcount = 1; -- bfd_usrdata (abfd) = p_refcount; -- -- return abfd; --} -- --/* Unreference and possibly close ABFD. */ --void --gdb_bfd_unref (struct bfd *abfd) --{ -- int *p_refcount; -- char *name; -- -- if (abfd == NULL) -- return; -- -- p_refcount = bfd_usrdata (abfd); -- -- /* Valid range for p_refcount: a pointer to int counter, which has a -- value of 1 (single owner) or 2 (shared). */ -- gdb_assert (*p_refcount == 1 || *p_refcount == 2); -- -- *p_refcount -= 1; -- if (*p_refcount > 0) -- return; -- -- xfree (p_refcount); -- bfd_usrdata (abfd) = NULL; /* Paranoia. */ -- -- name = bfd_get_filename (abfd); -- gdb_bfd_close_or_warn (abfd); -- xfree (name); --} -- - /* The default implementation for the "iterate_over_objfiles_in_search_order" - gdbarch method. It is equivalent to use the ALL_OBJFILES macro, - searching the objfiles in the order they are stored internally, -diff --git a/gdb/objfiles.h b/gdb/objfiles.h -index 01c3aea..0df5798 100644 ---- a/gdb/objfiles.h -+++ b/gdb/objfiles.h -@@ -522,10 +522,6 @@ extern void set_objfile_data (struct objfile *objfile, - extern void *objfile_data (struct objfile *objfile, - const struct objfile_data *data); - --extern struct bfd *gdb_bfd_ref (struct bfd *abfd); --extern void gdb_bfd_unref (struct bfd *abfd); --extern int gdb_bfd_close_or_warn (struct bfd *abfd); -- - extern void default_iterate_over_objfiles_in_search_order - (struct gdbarch *gdbarch, - iterate_over_objfiles_in_search_order_cb_ftype *cb, -diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c -index b8434ed..98a076d 100644 ---- a/gdb/p-valprint.c -+++ b/gdb/p-valprint.c -@@ -39,6 +39,7 @@ - #include "cp-abi.h" - #include "cp-support.h" - #include "exceptions.h" -+#include "dwarf2loc.h" - - - /* Decorations for Pascal. */ -@@ -74,8 +75,31 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - struct type *char_type; - CORE_ADDR addr; - int want_space = 0; -+ struct cleanup *back_to; -+ struct type *saved_type = type; -+ CORE_ADDR saved_address = address; -+ -+ back_to = make_cleanup (null_cleanup, 0); -+ address += embedded_offset; -+ type = object_address_get_data (type, &address); -+ if (type == NULL) -+ { -+ fputs_filtered (object_address_data_not_valid (saved_type), stream); -+ gdb_flush (stream); -+ do_cleanups (back_to); -+ return; -+ } -+ if (address != saved_address + embedded_offset) -+ { -+ size_t length = TYPE_LENGTH (type); - -- CHECK_TYPEDEF (type); -+ valaddr = xmalloc (length); -+ make_cleanup (xfree, (gdb_byte *) valaddr); -+ read_memory (address, (gdb_byte *) valaddr, length); -+ embedded_offset = 0; -+ } -+ else -+ address -= embedded_offset; - switch (TYPE_CODE (type)) - { - case TYPE_CODE_ARRAY: -@@ -131,8 +155,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - { - i = 0; - } -- val_print_array_elements (type, valaddr, embedded_offset, -- address, stream, recurse, -+ val_print_array_elements (saved_type, valaddr, embedded_offset, -+ saved_address, stream, recurse, - original_value, options, i); - fprintf_filtered (stream, "}"); - } -@@ -170,6 +194,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - { - /* Try to print what function it points to. */ - print_address_demangle (options, gdbarch, addr, stream, demangle); -+ do_cleanups (back_to); - return; - } - -@@ -271,6 +296,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - } - } - -+ do_cleanups (back_to); - return; - - case TYPE_CODE_REF: -@@ -421,6 +447,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - TYPE_CODE (type)); - } - gdb_flush (stream); -+ do_cleanups (back_to); - } - - void -diff --git a/gdb/parse.c b/gdb/parse.c -index 529c517..6326a01 100644 ---- a/gdb/parse.c -+++ b/gdb/parse.c -@@ -1708,6 +1708,7 @@ parser_fprintf (FILE *x, const char *y, ...) - - int - operator_check_standard (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, - void *data), - void *data) -@@ -1749,7 +1750,7 @@ operator_check_standard (struct expression *exp, int pos, - struct type *type = elts[pos + 2 + arg].type; - struct objfile *objfile = TYPE_OBJFILE (type); - -- if (objfile && (*objfile_func) (objfile, data)) -+ if (objfile && objfile_func && (*objfile_func) (objfile, data)) - return 1; - } - } -@@ -1767,7 +1768,8 @@ operator_check_standard (struct expression *exp, int pos, - - /* Check objfile where the variable itself is placed. - SYMBOL_OBJ_SECTION (symbol) may be NULL. */ -- if ((*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data)) -+ if (objfile_func -+ && (*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data)) - return 1; - - /* Check objfile where is placed the code touching the variable. */ -@@ -1780,24 +1782,27 @@ operator_check_standard (struct expression *exp, int pos, - - /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ - -- if (type && TYPE_OBJFILE (type) -+ if (type && type_func && (*type_func) (type, data)) -+ return 1; -+ if (type && TYPE_OBJFILE (type) && objfile_func - && (*objfile_func) (TYPE_OBJFILE (type), data)) - return 1; -- if (objfile && (*objfile_func) (objfile, data)) -+ if (objfile && objfile_func && (*objfile_func) (objfile, data)) - return 1; - - return 0; - } - --/* Call OBJFILE_FUNC for any TYPE and OBJFILE found being referenced by EXP. -- The functions are never called with NULL OBJFILE. Functions get passed an -- arbitrary caller supplied DATA pointer. If any of the functions returns -- non-zero value then (any other) non-zero value is immediately returned to -- the caller. Otherwise zero is returned after iterating through whole EXP. -- */ -+/* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being -+ referenced by EXP. The functions are never called with NULL TYPE or NULL -+ OBJFILE. Functions get passed an arbitrary caller supplied DATA pointer. -+ If any of the functions returns non-zero value then (any other) non-zero -+ value is immediately returned to the caller. Otherwise zero is returned -+ after iterating through whole EXP. */ - - static int - exp_iterate (struct expression *exp, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, void *data), - void *data) - { -@@ -1812,7 +1817,9 @@ exp_iterate (struct expression *exp, - - pos = endpos - oplen; - if (exp->language_defn->la_exp_desc->operator_check (exp, pos, -- objfile_func, data)) -+ type_func, -+ objfile_func, -+ data)) - return 1; - - endpos = pos; -@@ -1843,8 +1850,29 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) - { - gdb_assert (objfile->separate_debug_objfile_backlink == NULL); - -- return exp_iterate (exp, exp_uses_objfile_iter, objfile); -+ return exp_iterate (exp, NULL, exp_uses_objfile_iter, objfile); -+} -+ -+/* Helper for exp_types_mark_used. */ -+ -+#if 0 -+static int -+exp_types_mark_used_iter (struct type *type, void *unused) -+{ -+ type_mark_used (type); -+ -+ /* Continue the traversal. */ -+ return 0; -+} -+ -+/* Call type_mark_used for any type contained in EXP. */ -+ -+void -+exp_types_mark_used (struct expression *exp) -+{ -+ exp_iterate (exp, exp_types_mark_used_iter, NULL, NULL); - } -+#endif - - void - _initialize_parse (void) -diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h -index 86f3bdf..f908a61 100644 ---- a/gdb/parser-defs.h -+++ b/gdb/parser-defs.h -@@ -245,6 +245,8 @@ extern void operator_length_standard (const struct expression *, int, int *, - int *); - - extern int operator_check_standard (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, -+ void *data), - int (*objfile_func) - (struct objfile *objfile, void *data), - void *data); -@@ -331,6 +333,7 @@ struct exp_descriptor - value should be immediately returned to the caller. Otherwise zero - should be returned. */ - int (*operator_check) (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, - void *data), - void *data); -@@ -369,4 +372,10 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); - - extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); - -+extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); -+ -+#if 0 -+extern void exp_types_mark_used (struct expression *exp); -+#endif -+ - #endif /* PARSER_DEFS_H */ -diff --git a/gdb/printcmd.c b/gdb/printcmd.c -index d5b5b63..4bc2b5b 100644 ---- a/gdb/printcmd.c -+++ b/gdb/printcmd.c -@@ -50,6 +50,7 @@ - #include "arch-utils.h" - #include "cli/cli-utils.h" - #include "format.h" -+#include "dwarf2loc.h" - - #ifdef TUI - #include "tui/tui.h" /* For tui_active et al. */ -@@ -968,6 +969,11 @@ print_command_1 (char *exp, int inspect, int voidprint) - else - val = access_value_history (0); - -+ /* Do not try to OBJECT_ADDRESS_SET here anything. We are interested in the -+ source variable base addresses as found by READ_VAR_VALUE. The value here -+ can be already a calculated expression address inappropriate for -+ DW_OP_push_object_address. */ -+ - if (voidprint || (val && value_type (val) && - TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) - { -@@ -1056,6 +1062,9 @@ output_command (char *exp, int from_tty) - - val = evaluate_expression (expr); - -+ if (VALUE_LVAL (val) == lval_memory) -+ object_address_set (value_raw_address (val)); -+ - annotate_value_begin (value_type (val)); - - get_formatted_print_options (&opts, format); -@@ -1485,6 +1494,24 @@ x_command (char *exp, int from_tty) - set_internalvar (lookup_internalvar ("__"), last_examine_value); - } - } -+ -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+print_types_mark_used (void) -+{ -+ struct display *d; -+ -+ if (last_examine_value) -+ type_mark_used (value_type (last_examine_value)); -+ -+ for (d = display_chain; d; d = d->next) -+ if (d->exp) -+ exp_types_mark_used (d->exp); -+} -+#endif -+ - - - /* Add an expression to the auto-display chain. -@@ -1982,6 +2009,10 @@ print_variable_and_value (const char *name, struct symbol *var, - struct value_print_options opts; - - val = read_var_value (var, frame); -+ -+ make_cleanup_restore_selected_frame (); -+ select_frame (frame); -+ - get_user_print_options (&opts); - opts.deref_ref = 1; - common_val_print (val, stream, indent, &opts, current_language); -@@ -2626,4 +2657,8 @@ Show printing of source filename and line number with ."), NULL, - add_com ("eval", no_class, eval_command, _("\ - Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\ - a command line, and call it.")); -+ -+#if 0 -+ observer_attach_mark_used (print_types_mark_used); -+#endif - } -diff --git a/gdb/procfs.c b/gdb/procfs.c -index 774df2e..4409e5b 100644 ---- a/gdb/procfs.c -+++ b/gdb/procfs.c -@@ -3486,7 +3486,7 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) - long storage_needed; - CORE_ADDR sym_addr; - -- abfd = bfd_fdopenr ("unamed", 0, fd); -+ abfd = gdb_bfd_fdopenr ("unamed", 0, fd); - if (abfd == NULL) - { - warning (_("Failed to create a bfd: %s."), bfd_errmsg (bfd_get_error ())); -@@ -3497,7 +3497,7 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) - { - /* Not the correct format, so we can not possibly find the dbx_link - symbol in it. */ -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return 0; - } - -@@ -3511,14 +3511,14 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) - if (dbx_link_bpt == NULL) - { - warning (_("Failed to insert dbx_link breakpoint.")); -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return 0; - } -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return 1; - } - -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return 0; - } - -diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py -new file mode 100644 -index 0000000..5654546 ---- /dev/null -+++ b/gdb/python/lib/gdb/FrameIterator.py -@@ -0,0 +1,33 @@ -+# Iterator over frames. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+class FrameIterator: -+ """An iterator that iterates over frames.""" -+ -+ def __init__ (self, frame): -+ "Initialize a FrameIterator. FRAME is the starting frame." -+ self.frame = frame -+ -+ def __iter__ (self): -+ return self -+ -+ def next (self): -+ result = self.frame -+ if result is None: -+ raise StopIteration -+ self.frame = result.older () -+ return result -diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py -new file mode 100644 -index 0000000..b790a54 ---- /dev/null -+++ b/gdb/python/lib/gdb/FrameWrapper.py -@@ -0,0 +1,112 @@ -+# Wrapper API for frames. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+# FIXME: arguably all this should be on Frame somehow. -+class FrameWrapper: -+ def __init__ (self, frame): -+ self.frame = frame; -+ -+ def write_symbol (self, stream, sym, block): -+ if len (sym.linkage_name): -+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block) -+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER: -+ sym = nsym -+ -+ stream.write (sym.print_name + "=") -+ try: -+ val = self.read_var (sym) -+ if val != None: -+ val = str (val) -+ # FIXME: would be nice to have a more precise exception here. -+ except RuntimeError, text: -+ val = text -+ if val == None: -+ stream.write ("???") -+ else: -+ stream.write (str (val)) -+ -+ def print_frame_locals (self, stream, func): -+ if not func: -+ return -+ -+ first = True -+ block = func.value -+ -+ for sym in block: -+ if sym.is_argument: -+ continue; -+ -+ self.write_symbol (stream, sym, block) -+ stream.write ('\n') -+ -+ def print_frame_args (self, stream, func): -+ if not func: -+ return -+ -+ first = True -+ block = func.value -+ -+ for sym in block: -+ if not sym.is_argument: -+ continue; -+ -+ if not first: -+ stream.write (", ") -+ -+ self.write_symbol (stream, sym, block) -+ first = False -+ -+ # FIXME: this should probably just be a method on gdb.Frame. -+ # But then we need stream wrappers. -+ def describe (self, stream, full): -+ if self.type () == gdb.DUMMY_FRAME: -+ stream.write (" \n") -+ elif self.type () == gdb.SIGTRAMP_FRAME: -+ stream.write (" \n") -+ else: -+ sal = self.find_sal () -+ pc = self.pc () -+ name = self.name () -+ if not name: -+ name = "??" -+ if pc != sal.pc or not sal.symtab: -+ stream.write (" 0x%08x in" % pc) -+ stream.write (" " + name + " (") -+ -+ func = self.function () -+ self.print_frame_args (stream, func) -+ -+ stream.write (")") -+ -+ if sal.symtab and sal.symtab.filename: -+ stream.write (" at " + sal.symtab.filename) -+ stream.write (":" + str (sal.line)) -+ -+ if not self.name () or (not sal.symtab or not sal.symtab.filename): -+ lib = gdb.solib_address (pc) -+ if lib: -+ stream.write (" from " + lib) -+ -+ stream.write ("\n") -+ -+ if full: -+ self.print_frame_locals (stream, func) -+ -+ def __getattr__ (self, name): -+ return getattr (self.frame, name) -diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py -new file mode 100644 -index 0000000..6bb4fb1 ---- /dev/null -+++ b/gdb/python/lib/gdb/backtrace.py -@@ -0,0 +1,42 @@ -+# Filtering backtrace. -+ -+# Copyright (C) 2008, 2011 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import itertools -+ -+# Our only exports. -+__all__ = ['push_frame_filter', 'create_frame_filter'] -+ -+frame_filter = None -+ -+def push_frame_filter (constructor): -+ """Register a new backtrace filter class with the 'backtrace' command. -+The filter will be passed an iterator as an argument. The iterator -+will return gdb.Frame-like objects. The filter should in turn act as -+an iterator returning such objects.""" -+ global frame_filter -+ if frame_filter == None: -+ frame_filter = constructor -+ else: -+ frame_filter = lambda iterator, filter = frame_filter: constructor (filter (iterator)) -+ -+def create_frame_filter (iter): -+ global frame_filter -+ if frame_filter is None: -+ return iter -+ return frame_filter (iter) -+ -diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py -new file mode 100644 -index 0000000..eeea909 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/backtrace.py -@@ -0,0 +1,106 @@ -+# New backtrace command. -+ -+# Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import gdb.backtrace -+import itertools -+from gdb.FrameIterator import FrameIterator -+from gdb.FrameWrapper import FrameWrapper -+import sys -+ -+class ReverseBacktraceParameter (gdb.Parameter): -+ """The new-backtrace command can show backtraces in 'reverse' order. -+This means that the innermost frame will be printed last. -+Note that reverse backtraces are more expensive to compute.""" -+ -+ set_doc = "Enable or disable reverse backtraces." -+ show_doc = "Show whether backtraces will be printed in reverse order." -+ -+ def __init__(self): -+ gdb.Parameter.__init__ (self, "reverse-backtrace", -+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN) -+ # Default to compatibility with gdb. -+ self.value = False -+ -+class FilteringBacktrace (gdb.Command): -+ """Print backtrace of all stack frames, or innermost COUNT frames. -+With a negative argument, print outermost -COUNT frames. -+Use of the 'full' qualifier also prints the values of the local variables. -+Use of the 'raw' qualifier avoids any filtering by loadable modules. -+""" -+ -+ def __init__ (self): -+ # FIXME: this is not working quite well enough to replace -+ # "backtrace" yet. -+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK) -+ self.reverse = ReverseBacktraceParameter() -+ -+ def reverse_iter (self, iter): -+ result = [] -+ for item in iter: -+ result.append (item) -+ result.reverse() -+ return result -+ -+ def final_n (self, iter, x): -+ result = [] -+ for item in iter: -+ result.append (item) -+ return result[x:] -+ -+ def invoke (self, arg, from_tty): -+ i = 0 -+ count = 0 -+ filter = True -+ full = False -+ -+ for word in arg.split (" "): -+ if word == '': -+ continue -+ elif word == 'raw': -+ filter = False -+ elif word == 'full': -+ full = True -+ else: -+ count = int (word) -+ -+ # FIXME: provide option to start at selected frame -+ # However, should still number as if starting from newest -+ newest_frame = gdb.newest_frame() -+ iter = itertools.imap (FrameWrapper, -+ FrameIterator (newest_frame)) -+ if filter: -+ iter = gdb.backtrace.create_frame_filter (iter) -+ -+ # Now wrap in an iterator that numbers the frames. -+ iter = itertools.izip (itertools.count (0), iter) -+ -+ # Reverse if the user wanted that. -+ if self.reverse.value: -+ iter = self.reverse_iter (iter) -+ -+ # Extract sub-range user wants. -+ if count < 0: -+ iter = self.final_n (iter, count) -+ elif count > 0: -+ iter = itertools.islice (iter, 0, count) -+ -+ for pair in iter: -+ sys.stdout.write ("#%-2d" % pair[0]) -+ pair[1].describe (sys.stdout, full) -+ -+FilteringBacktrace() -diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py -new file mode 100644 -index 0000000..6fa48ff ---- /dev/null -+++ b/gdb/python/lib/gdb/command/ignore_errors.py -@@ -0,0 +1,37 @@ -+# Ignore errors in user commands. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class IgnoreErrorsCommand (gdb.Command): -+ """Execute a single command, ignoring all errors. -+Only one-line commands are supported. -+This is primarily useful in scripts.""" -+ -+ def __init__ (self): -+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors", -+ gdb.COMMAND_OBSCURE, -+ # FIXME... -+ gdb.COMPLETE_COMMAND) -+ -+ def invoke (self, arg, from_tty): -+ try: -+ gdb.execute (arg, from_tty) -+ except: -+ pass -+ -+IgnoreErrorsCommand () -diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py -new file mode 100644 -index 0000000..21a0bf0 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/pahole.py -@@ -0,0 +1,75 @@ -+# pahole command for gdb -+ -+# 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 . -+ -+import gdb -+ -+class Pahole (gdb.Command): -+ """Show the holes in a structure. -+This command takes a single argument, a type name. -+It prints the type and displays comments showing where holes are.""" -+ -+ def __init__ (self): -+ super (Pahole, self).__init__ ("pahole", gdb.COMMAND_NONE, -+ gdb.COMPLETE_SYMBOL) -+ -+ def pahole (self, type, level, name): -+ if name is None: -+ name = '' -+ tag = type.tag -+ if tag is None: -+ tag = '' -+ print '%sstruct %s {' % (' ' * (2 * level), tag) -+ bitpos = 0 -+ for field in type.fields (): -+ # Skip static fields. -+ if not hasattr (field, ('bitpos')): -+ continue -+ -+ ftype = field.type.strip_typedefs() -+ -+ if bitpos != field.bitpos: -+ hole = field.bitpos - bitpos -+ print ' /* XXX %d bit hole, try to pack */' % hole -+ bitpos = field.bitpos -+ if field.bitsize > 0: -+ fieldsize = field.bitsize -+ else: -+ # TARGET_CHAR_BIT here... -+ fieldsize = 8 * ftype.sizeof -+ -+ # TARGET_CHAR_BIT -+ print ' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)), -+ bitpos = bitpos + fieldsize -+ -+ if ftype.code == gdb.TYPE_CODE_STRUCT: -+ self.pahole (ftype, level + 1, field.name) -+ else: -+ print ' ' * (2 + 2 * level), -+ print '%s %s' % (str (ftype), field.name) -+ -+ print ' ' * (14 + 2 * level), -+ print '} %s' % name -+ -+ def invoke (self, arg, from_tty): -+ type = gdb.lookup_type (arg) -+ type = type.strip_typedefs () -+ if type.code != gdb.TYPE_CODE_STRUCT: -+ raise TypeError, '%s is not a struct type' % arg -+ print ' ' * 14, -+ self.pahole (type, 0, '') -+ -+Pahole() -diff --git a/gdb/python/lib/gdb/command/require.py b/gdb/python/lib/gdb/command/require.py -new file mode 100644 -index 0000000..1fbc1e8 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/require.py -@@ -0,0 +1,57 @@ -+# Demand-loading commands. -+ -+# 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 . -+ -+import gdb -+import os -+ -+class RequireCommand (gdb.Command): -+ """Prefix command for requiring features.""" -+ -+ def __init__ (self): -+ super (RequireCommand, self).__init__ ("require", -+ gdb.COMMAND_SUPPORT, -+ gdb.COMPLETE_NONE, -+ True) -+ -+class RequireSubcommand (gdb.Command): -+ """Demand-load a command by name.""" -+ -+ def __init__ (self, name): -+ self.__doc__ = "Demand-load a %s by name." % name -+ super (RequireSubcommand, self).__init__ ("require %s" % name, -+ gdb.COMMAND_SUPPORT) -+ self.name = name -+ -+ def invoke (self, arg, from_tty): -+ for cmd in arg.split(): -+ exec ('import gdb.' + self.name + '.' + cmd, globals ()) -+ -+ def complete (self, text, word): -+ dir = gdb.pythondir + '/gdb/' + self.name -+ result = [] -+ for file in os.listdir(dir): -+ if not file.startswith (word) or not file.endswith ('.py'): -+ continue -+ feature = file[0:-3] -+ if feature == 'require' or feature == '__init__': -+ continue -+ result.append (feature) -+ return result -+ -+RequireCommand() -+RequireSubcommand("command") -+RequireSubcommand("function") -diff --git a/gdb/python/lib/gdb/command/upto.py b/gdb/python/lib/gdb/command/upto.py -new file mode 100644 -index 0000000..faf54ed ---- /dev/null -+++ b/gdb/python/lib/gdb/command/upto.py -@@ -0,0 +1,129 @@ -+# upto command. -+ -+# Copyright (C) 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import re -+from gdb.FrameIterator import FrameIterator -+from gdb.FrameWrapper import FrameWrapper -+ -+class UptoPrefix (gdb.Command): -+ def __init__ (self): -+ super (UptoPrefix, self).__init__ ("upto", gdb.COMMAND_STACK, -+ prefix = True) -+ -+class UptoImplementation (gdb.Command): -+ def __init__ (self, subcommand): -+ super (UptoImplementation, self).__init__ ("upto " + subcommand, -+ gdb.COMMAND_STACK) -+ -+ def search (self): -+ saved = gdb.selected_frame () -+ iter = FrameIterator (saved) -+ found = False -+ try: -+ for frame in iter: -+ frame.select () -+ try: -+ if self.filter (frame): -+ wrapper = FrameWrapper (frame) -+ wrapper.describe (sys.stdout, False) -+ return -+ except: -+ pass -+ except: -+ pass -+ saved.select () -+ raise RuntimeError, 'Could not find a matching frame' -+ -+ def invoke (self, arg, from_tty): -+ self.rx = re.compile (arg) -+ self.search () -+ -+class UptoSymbolCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on symbol. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose symbol matches the regular -+expression.""" -+ -+ def __init__ (self): -+ super (UptoSymbolCommand, self).__init__ ("symbol") -+ -+ def filter (self, frame): -+ name = frame.name () -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoSourceCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on source file. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose source file name matches the -+regular expression.""" -+ -+ def __init__ (self): -+ super (UptoSourceCommand, self).__init__ ("source") -+ -+ def filter (self, frame): -+ name = frame.find_sal ().symtab.filename -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoObjectCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on object file. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose object file name matches the -+regular expression.""" -+ -+ def __init__ (self): -+ super (UptoObjectCommand, self).__init__ ("object") -+ -+ def filter (self, frame): -+ name = frame.find_sal ().symtab.objfile.filename -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoWhereCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on expression. -+The argument is an expression. This command moves up the stack, -+parsing and evaluating the expression in each frame. This stops when -+the expression evaluates to a non-zero (true) value.""" -+ -+ def __init__ (self): -+ super (UptoWhereCommand, self).__init__ ("where") -+ -+ def filter (self, frame): -+ try: -+ if gdb.parse_and_eval (self.expression): -+ return True -+ except: -+ pass -+ return False -+ -+ def invoke (self, arg, from_tty): -+ self.expression = arg -+ self.search () -+ -+UptoPrefix () -+UptoSymbolCommand () -+UptoSourceCommand () -+UptoObjectCommand () -+UptoWhereCommand () -diff --git a/gdb/python/lib/gdb/function/__init__.py b/gdb/python/lib/gdb/function/__init__.py -new file mode 100644 -index 0000000..8b13789 ---- /dev/null -+++ b/gdb/python/lib/gdb/function/__init__.py -@@ -0,0 +1 @@ -+ -diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py -new file mode 100644 -index 0000000..2b9c5c7 ---- /dev/null -+++ b/gdb/python/lib/gdb/function/caller_is.py -@@ -0,0 +1,58 @@ -+# Caller-is functions. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import re -+ -+class CallerIs (gdb.Function): -+ """Return True if the calling function's name is equal to a string. -+This function takes one or two arguments. -+The first argument is the name of a function; if the calling function's -+name is equal to this argument, this function returns True. -+The optional second argument tells this function how many stack frames -+to traverse to find the calling function. The default is 1.""" -+ -+ def __init__ (self): -+ super (CallerIs, self).__init__ ("caller_is") -+ -+ def invoke (self, name, nframes = 1): -+ frame = gdb.selected_frame () -+ while nframes > 0: -+ frame = frame.older () -+ nframes = nframes - 1 -+ return frame.name () == name.string () -+ -+class CallerMatches (gdb.Function): -+ """Return True if the calling function's name matches a string. -+This function takes one or two arguments. -+The first argument is a regular expression; if the calling function's -+name is matched by this argument, this function returns True. -+The optional second argument tells this function how many stack frames -+to traverse to find the calling function. The default is 1.""" -+ -+ def __init__ (self): -+ super (CallerMatches, self).__init__ ("caller_matches") -+ -+ def invoke (self, name, nframes = 1): -+ frame = gdb.selected_frame () -+ while nframes > 0: -+ frame = frame.older () -+ nframes = nframes - 1 -+ return re.match (name.string (), frame.name ()) is not None -+ -+CallerIs() -+CallerMatches() -diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py -new file mode 100644 -index 0000000..debb3bb ---- /dev/null -+++ b/gdb/python/lib/gdb/function/in_scope.py -@@ -0,0 +1,47 @@ -+# In-scope function. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class InScope (gdb.Function): -+ """Return True if all the given variables or macros are in scope. -+Takes one argument for each variable name to be checked.""" -+ -+ def __init__ (self): -+ super (InScope, self).__init__ ("in_scope") -+ -+ def invoke (self, *vars): -+ if len (vars) == 0: -+ raise TypeError, "in_scope takes at least one argument" -+ -+ # gdb.Value isn't hashable so it can't be put in a map. -+ # Convert to string first. -+ wanted = set (map (lambda x: x.string (), vars)) -+ found = set () -+ block = gdb.selected_frame ().block () -+ while block: -+ for sym in block: -+ if (sym.is_argument or sym.is_constant -+ or sym.is_function or sym.is_variable): -+ if sym.name in wanted: -+ found.add (sym.name) -+ -+ block = block.superblock -+ -+ return wanted == found -+ -+InScope () -diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c -index 98030a6..9870eec 100644 ---- a/gdb/python/py-type.c -+++ b/gdb/python/py-type.c -@@ -30,6 +30,8 @@ - #include "vec.h" - #include "bcache.h" - #include "dwarf2loc.h" -+#include "observer.h" -+#include "gdb_assert.h" - - typedef struct pyty_type_object - { -@@ -38,11 +40,19 @@ typedef struct pyty_type_object - - /* If a Type object is associated with an objfile, it is kept on a - doubly-linked list, rooted in the objfile. This lets us copy the -- underlying struct type when the objfile is deleted. */ -+ underlying struct type when the objfile is deleted. -+ -+ With NULL objfile Type still can be doubly-linked in the list -+ PYTY_OBJECTS_DISCARDABLE. */ - struct pyty_type_object *prev; - struct pyty_type_object *next; - } type_object; - -+#if 0 -+/* First element of a doubly-linked list of TYPE_DISCARDABLE Types. */ -+static type_object *pyty_objects_discardable; -+#endif -+ - static PyTypeObject type_object_type; - - /* A Field object. */ -@@ -1166,8 +1176,63 @@ typy_richcompare (PyObject *self, PyObject *other, int op) - - - -+/* Key associated with each objfile pointing to the first element of -+ a doubly-linked list of Types associated with this objfile. */ - static const struct objfile_data *typy_objfile_data_key; - -+/* Link TYPE_OBJ to its appropriate list. Either to its objfile associated one -+ or at least to the global list for TYPE_DISCARDABLE Types. Permanent types -+ do not get linked anywhere. */ -+static void -+typy_link (type_object *type_obj) -+{ -+ type_obj->prev = NULL; -+ -+ if (type_obj->type && TYPE_OBJFILE (type_obj->type)) -+ { -+ struct objfile *objfile = TYPE_OBJFILE (type_obj->type); -+ -+ type_obj->next = objfile_data (objfile, typy_objfile_data_key); -+ if (type_obj->next) -+ type_obj->next->prev = type_obj; -+ set_objfile_data (objfile, typy_objfile_data_key, type_obj); -+ } -+#if 0 -+ else if (type_obj->type && TYPE_DISCARDABLE (type_obj->type)) -+ { -+ type_obj->next = pyty_objects_discardable; -+ if (type_obj->next) -+ type_obj->next->prev = type_obj; -+ pyty_objects_discardable = type_obj; -+ } -+#endif -+ else -+ type_obj->next = NULL; -+} -+ -+/* Unlink TYPE_OBJ from its current list. Permanent types are not linked -+ anywhere and this function has no effect on them. */ -+static void -+typy_unlink (type_object *type_obj) -+{ -+ if (type_obj->prev) -+ type_obj->prev->next = type_obj->next; -+ else if (type_obj->type && TYPE_OBJFILE (type_obj->type)) -+ { -+ /* Must reset head of list. */ -+ struct objfile *objfile = TYPE_OBJFILE (type_obj->type); -+ -+ set_objfile_data (objfile, typy_objfile_data_key, type_obj->next); -+ } -+#if 0 -+ else if (pyty_objects_discardable == type_obj) -+ pyty_objects_discardable = type_obj->next; -+#endif -+ -+ if (type_obj->next) -+ type_obj->next->prev = type_obj->prev; -+} -+ - static void - save_objfile_types (struct objfile *objfile, void *datum) - { -@@ -1185,12 +1250,13 @@ save_objfile_types (struct objfile *objfile, void *datum) - { - type_object *next = obj->next; - -- htab_empty (copied_types); -+ gdb_assert (TYPE_OBJFILE (obj->type) == objfile); -+ typy_unlink (obj); - -- obj->type = copy_type_recursive (objfile, obj->type, copied_types); -+ obj->type = copy_type_recursive (obj->type, copied_types); - -- obj->next = NULL; -- obj->prev = NULL; -+ gdb_assert (TYPE_OBJFILE (obj->type) == NULL); -+ typy_link (obj); - - obj = next; - } -@@ -1201,43 +1267,28 @@ save_objfile_types (struct objfile *objfile, void *datum) - } - - static void --set_type (type_object *obj, struct type *type) -+typy_dealloc (PyObject *obj) - { -- obj->type = type; -- obj->prev = NULL; -- if (type && TYPE_OBJFILE (type)) -- { -- struct objfile *objfile = TYPE_OBJFILE (type); -+ type_object *type_obj = (type_object *) obj; - -- obj->next = objfile_data (objfile, typy_objfile_data_key); -- if (obj->next) -- obj->next->prev = obj; -- set_objfile_data (objfile, typy_objfile_data_key, obj); -- } -- else -- obj->next = NULL; -+ typy_unlink (type_obj); -+ -+ type_obj->ob_type->tp_free (obj); - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ - static void --typy_dealloc (PyObject *obj) -+typy_types_mark_used (void) - { -- type_object *type = (type_object *) obj; -- -- if (type->prev) -- type->prev->next = type->next; -- else if (type->type && TYPE_OBJFILE (type->type)) -- { -- /* Must reset head of list. */ -- struct objfile *objfile = TYPE_OBJFILE (type->type); -- -- if (objfile) -- set_objfile_data (objfile, typy_objfile_data_key, type->next); -- } -- if (type->next) -- type->next->prev = type->prev; -+ type_object *type_obj; - -- type->ob_type->tp_free (type); -+ for (type_obj = pyty_objects_discardable; -+ type_obj != NULL; -+ type_obj = type_obj->next) -+ type_mark_used (type_obj->type); - } -+#endif - - /* Return number of fields ("length" of the field dictionary). */ - -@@ -1457,7 +1508,10 @@ type_to_type_object (struct type *type) - - type_obj = PyObject_New (type_object, &type_object_type); - if (type_obj) -- set_type (type_obj, type); -+ { -+ type_obj->type = type; -+ typy_link (type_obj); -+ } - - return (PyObject *) type_obj; - } -@@ -1537,6 +1591,10 @@ gdbpy_initialize_types (void) - - Py_INCREF (&field_object_type); - PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type); -+ -+#if 0 -+ observer_attach_mark_used (typy_types_mark_used); -+#endif - } - - -diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c -index 6f67bdb..5ddd6bc 100644 ---- a/gdb/python/py-value.c -+++ b/gdb/python/py-value.c -@@ -29,6 +29,7 @@ - #include "expression.h" - #include "cp-abi.h" - #include "python.h" -+#include "observer.h" - - #ifdef HAVE_PYTHON - -@@ -1378,6 +1379,19 @@ gdbpy_is_value_object (PyObject *obj) - return PyObject_TypeCheck (obj, &value_object_type); - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+python_types_mark_used (void) -+{ -+ value_object *iter; -+ -+ for (iter = values_in_python; iter; iter = iter->next) -+ type_mark_used (value_type (iter->value)); -+} -+#endif -+ - void - gdbpy_initialize_values (void) - { -@@ -1388,6 +1402,10 @@ gdbpy_initialize_values (void) - PyModule_AddObject (gdb_module, "Value", (PyObject *) &value_object_type); - - values_in_python = NULL; -+ -+#if 0 -+ observer_attach_mark_used (python_types_mark_used); -+#endif - } - - -diff --git a/gdb/python/python.c b/gdb/python/python.c -index c66efe4..0211fcb 100644 ---- a/gdb/python/python.c -+++ b/gdb/python/python.c -@@ -66,10 +66,13 @@ static const char *gdbpy_should_print_stack = python_excp_message; - #include "linespec.h" - #include "source.h" - #include "version.h" -+#include "inferior.h" -+#include "gdbthread.h" - #include "target.h" - #include "gdbthread.h" - #include "observer.h" - #include "interps.h" -+#include "event-top.h" - - static PyMethodDef GdbMethods[]; - -@@ -979,6 +982,53 @@ gdbpy_print_stack (void) - - /* Return the current Progspace. - There always is one. */ -+/* True if 'gdb -P' was used, false otherwise. */ -+static int running_python_script; -+ -+/* True if we are currently in a call to 'gdb.cli', false otherwise. */ -+static int in_cli; -+ -+/* Enter the command loop. */ -+ -+static PyObject * -+gdbpy_cli (PyObject *unused1, PyObject *unused2) -+{ -+ if (! running_python_script || in_cli) -+ return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively"); -+ -+ in_cli = 1; -+ cli_command_loop (); -+ in_cli = 0; -+ -+ Py_RETURN_NONE; -+} -+ -+/* Set up the Python argument vector and evaluate a script. This is -+ used to implement 'gdb -P'. */ -+ -+void -+run_python_script (int argc, char **argv) -+{ -+ FILE *input; -+ -+ /* We never free this, since we plan to exit at the end. */ -+ ensure_python_env (get_current_arch (), current_language); -+ -+ running_python_script = 1; -+ PySys_SetArgv (argc - 1, argv + 1); -+ input = fopen (argv[0], "r"); -+ if (! input) -+ { -+ fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno)); -+ exit (1); -+ } -+ PyRun_SimpleFile (input, argv[0]); -+ fclose (input); -+ exit (0); -+} -+ -+ -+ - - static PyObject * - gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) -@@ -1420,6 +1470,8 @@ static PyMethodDef GdbMethods[] = - "Get a value from history" }, - { "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS, - "Execute a gdb command" }, -+ { "cli", gdbpy_cli, METH_NOARGS, -+ "Enter the gdb CLI" }, - { "parameter", gdbpy_parameter, METH_VARARGS, - "Return a gdb parameter's value" }, - -diff --git a/gdb/python/python.h b/gdb/python/python.h -index dd7066f..f0f6e90 100644 ---- a/gdb/python/python.h -+++ b/gdb/python/python.h -@@ -30,6 +30,8 @@ void eval_python_from_control_command (struct command_line *); - - void source_python_script (FILE *file, const char *filename); - -+void run_python_script (int argc, char **argv); -+ - int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, -diff --git a/gdb/record.c b/gdb/record.c -index bb0fe52..ec42aac 100644 ---- a/gdb/record.c -+++ b/gdb/record.c -@@ -32,6 +32,7 @@ - #include "gcore.h" - #include "event-loop.h" - #include "inf-loop.h" -+#include "gdb_bfd.h" - - #include - -@@ -2638,7 +2639,7 @@ record_save_cleanups (void *data) - bfd *obfd = data; - char *pathname = xstrdup (bfd_get_filename (obfd)); - -- bfd_close (obfd); -+ gdb_bfd_unref (obfd); - unlink (pathname); - xfree (pathname); - } -@@ -2854,7 +2855,7 @@ cmd_record_save (char *args, int from_tty) - } - - do_cleanups (set_cleanups); -- bfd_close (obfd); -+ gdb_bfd_unref (obfd); - discard_cleanups (old_cleanups); - - /* Succeeded. */ -diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c -index 47f4405..85268b6 100644 ---- a/gdb/remote-m32r-sdi.c -+++ b/gdb/remote-m32r-sdi.c -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include "gdb_bfd.h" - - - #include "serial.h" -@@ -1257,13 +1258,13 @@ m32r_load (char *args, int from_tty) - if (!filename) - filename = get_exec_file (1); - -- pbfd = bfd_openr (filename, gnutarget); -+ pbfd = gdb_bfd_openr (filename, gnutarget); - if (pbfd == NULL) - { - perror_with_name (filename); - return; - } -- old_chain = make_cleanup_bfd_close (pbfd); -+ old_chain = make_cleanup_bfd_unref (pbfd); - - if (!bfd_check_format (pbfd, bfd_object)) - error (_("\"%s\" is not an object file: %s"), filename, -diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c -index babbf19..db4381b 100644 ---- a/gdb/remote-mips.c -+++ b/gdb/remote-mips.c -@@ -36,6 +36,7 @@ - #include - #include "mips-tdep.h" - #include "gdbthread.h" -+#include "gdb_bfd.h" - - - /* Breakpoint types. Values 0, 1, and 2 must agree with the watch -@@ -2783,20 +2784,23 @@ mips_load_srec (char *args) - unsigned int i; - unsigned int srec_frame = 200; - int reclen; -+ struct cleanup *cleanup; - static int hashmark = 1; - - buffer = alloca (srec_frame * 2 + 256); - -- abfd = bfd_openr (args, 0); -+ abfd = gdb_bfd_openr (args, 0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n", args); - return; - } - -+ cleanup = make_cleanup_bfd_unref (abfd); - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered ("File is not an object file\n"); -+ do_cleanups (cleanup); - return; - } - -@@ -2850,6 +2854,7 @@ mips_load_srec (char *args) - send_srec (srec, reclen, abfd->start_address); - - serial_flush_input (mips_desc); -+ do_cleanups (cleanup); - } - - /* -@@ -3366,20 +3371,23 @@ pmon_load_fast (char *file) - int bintotal = 0; - int final = 0; - int finished = 0; -+ struct cleanup *cleanup; - - buffer = (char *) xmalloc (MAXRECSIZE + 1); - binbuf = (unsigned char *) xmalloc (BINCHUNK); - -- abfd = bfd_openr (file, 0); -+ abfd = gdb_bfd_openr (file, 0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n", file); - return; - } -+ cleanup = make_cleanup_bfd_unref (abfd); - - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered ("File is not an object file\n"); -+ do_cleanups (cleanup); - return; - } - -@@ -3503,6 +3511,7 @@ pmon_load_fast (char *file) - pmon_end_download (final, bintotal); - } - -+ do_cleanups (cleanup); - return; - } - -diff --git a/gdb/remote.c b/gdb/remote.c -index 1c9367d..f2b5e7b 100644 ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -42,6 +42,7 @@ - #include "cli/cli-decode.h" - #include "cli/cli-setshow.h" - #include "target-descriptions.h" -+#include "gdb_bfd.h" - - #include - #include -@@ -9823,11 +9824,13 @@ remote_filename_p (const char *filename) - bfd * - remote_bfd_open (const char *remote_file, const char *target) - { -- return bfd_openr_iovec (remote_file, target, -- remote_bfd_iovec_open, NULL, -- remote_bfd_iovec_pread, -- remote_bfd_iovec_close, -- remote_bfd_iovec_stat); -+ bfd *abfd = gdb_bfd_openr_iovec (remote_file, target, -+ remote_bfd_iovec_open, NULL, -+ remote_bfd_iovec_pread, -+ remote_bfd_iovec_close, -+ remote_bfd_iovec_stat); -+ -+ return abfd; - } - - void -diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c -index 0a2000a..9b8efd3 100644 ---- a/gdb/rs6000-nat.c -+++ b/gdb/rs6000-nat.c -@@ -730,7 +730,7 @@ static struct vmap * - add_vmap (LdInfo *ldi) - { - bfd *abfd, *last; -- char *mem, *objname, *filename; -+ char *mem, *filename; - struct objfile *obj; - struct vmap *vp; - int fd; -@@ -743,19 +743,18 @@ add_vmap (LdInfo *ldi) - filename = LDI_FILENAME (ldi, arch64); - mem = filename + strlen (filename) + 1; - mem = xstrdup (mem); -- objname = xstrdup (filename); - - fd = LDI_FD (ldi, arch64); - if (fd < 0) - /* Note that this opens it once for every member; a possible - enhancement would be to only open it once for every object. */ -- abfd = bfd_openr (objname, gnutarget); -+ abfd = gdb_bfd_openr (filename, gnutarget); - else -- abfd = bfd_fdopenr (objname, gnutarget, fd); -+ abfd = gdb_bfd_fdopenr (filename, gnutarget, fd); - if (!abfd) - { - warning (_("Could not open `%s' as an executable file: %s"), -- objname, bfd_errmsg (bfd_get_error ())); -+ filename, bfd_errmsg (bfd_get_error ())); - return NULL; - } - -@@ -766,35 +765,44 @@ add_vmap (LdInfo *ldi) - - else if (bfd_check_format (abfd, bfd_archive)) - { -- last = 0; -- /* FIXME??? am I tossing BFDs? bfd? */ -- while ((last = bfd_openr_next_archived_file (abfd, last))) -- if (strcmp (mem, last->filename) == 0) -- break; -+ last = gdb_bfd_openr_next_archived_file (abfd, NULL); -+ while (last != NULL) -+ { -+ bfd *next; -+ -+ if (strcmp (mem, last->filename) == 0) -+ break; -+ -+ next = gdb_bfd_openr_next_archived_file (abfd, last); -+ gdb_bfd_unref (last); -+ } - - if (!last) - { -- warning (_("\"%s\": member \"%s\" missing."), objname, mem); -- bfd_close (abfd); -+ warning (_("\"%s\": member \"%s\" missing."), filename, mem); -+ gdb_bfd_unref (abfd); - return NULL; - } - - if (!bfd_check_format (last, bfd_object)) - { - warning (_("\"%s\": member \"%s\" not in executable format: %s."), -- objname, mem, bfd_errmsg (bfd_get_error ())); -- bfd_close (last); -- bfd_close (abfd); -+ filename, mem, bfd_errmsg (bfd_get_error ())); -+ gdb_bfd_unref (last); -+ gdb_bfd_unref (abfd); - return NULL; - } - - vp = map_vmap (last, abfd); -+ /* map_vmap acquired a reference to LAST, so we can release -+ ours. */ -+ gdb_bfd_unref (last); - } - else - { - warning (_("\"%s\": not in executable format: %s."), -- objname, bfd_errmsg (bfd_get_error ())); -- bfd_close (abfd); -+ filename, bfd_errmsg (bfd_get_error ())); -+ gdb_bfd_unref (abfd); - return NULL; - } - obj = allocate_objfile (vp->bfd, 0); -@@ -803,6 +811,11 @@ add_vmap (LdInfo *ldi) - /* Always add symbols for the main objfile. */ - if (vp == vmap || auto_solib_add) - vmap_add_symbols (vp); -+ -+ /* Anything needing a reference to ABFD has already acquired it, so -+ release our local reference. */ -+ gdb_bfd_unref (abfd); -+ - return vp; - } - -diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c -index d52fb46..db8f187 100644 ---- a/gdb/solib-darwin.c -+++ b/gdb/solib-darwin.c -@@ -28,6 +28,7 @@ - #include "inferior.h" - #include "regcache.h" - #include "gdbthread.h" -+#include "gdb_bfd.h" - - #include "gdb_assert.h" - -@@ -356,6 +357,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) - gdb_byte *interp_name; - CORE_ADDR load_addr = 0; - bfd *dyld_bfd = NULL; -+ struct cleanup *cleanup; - - /* This method doesn't work with an attached process. */ - if (current_inferior ()->attach_flag) -@@ -366,24 +368,31 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) - if (!interp_name) - return; - -+ cleanup = make_cleanup (null_cleanup, NULL); -+ - /* Create a bfd for the interpreter. */ -- dyld_bfd = bfd_openr (interp_name, gnutarget); -+ dyld_bfd = gdb_bfd_openr (interp_name, gnutarget); - if (dyld_bfd) - { - bfd *sub; - -+ make_cleanup_bfd_unref (dyld_bfd); - sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object, - gdbarch_bfd_arch_info (target_gdbarch)); - if (sub) -- dyld_bfd = sub; -- else - { -- bfd_close (dyld_bfd); -- dyld_bfd = NULL; -+ dyld_bfd = sub; -+ gdb_bfd_ref (sub); -+ make_cleanup_bfd_unref (sub); - } -+ else -+ dyld_bfd = NULL; - } - if (!dyld_bfd) -- return; -+ { -+ do_cleanups (cleanup); -+ return; -+ } - - /* We find the dynamic linker's base address by examining - the current pc (which should point at the entry point for the -@@ -395,7 +404,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) - info->all_image_addr = - lookup_symbol_from_bfd (dyld_bfd, "_dyld_all_image_infos"); - -- bfd_close (dyld_bfd); -+ do_cleanups (cleanup); - - if (info->all_image_addr == 0) - return; -@@ -509,17 +518,10 @@ darwin_bfd_open (char *pathname) - gdbarch_bfd_arch_info (target_gdbarch)); - if (!res) - { -- bfd_close (abfd); -- make_cleanup (xfree, found_pathname); -+ make_cleanup_bfd_unref (abfd); - error (_("`%s': not a shared-library: %s"), -- found_pathname, bfd_errmsg (bfd_get_error ())); -+ bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); - } -- -- /* Make sure that the filename is malloc'ed. The current filename -- for fat-binaries BFDs is a name that was generated by BFD, usually -- a static string containing the name of the architecture. */ -- res->filename = xstrdup (pathname); -- - return res; - } - -diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c -index 2500c1f..fcc01a8 100644 ---- a/gdb/solib-dsbt.c -+++ b/gdb/solib-dsbt.c -@@ -30,6 +30,7 @@ - #include "gdbcmd.h" - #include "elf-bfd.h" - #include "exceptions.h" -+#include "gdb_bfd.h" - - #define GOT_MODULE_OFFSET 4 - -@@ -899,7 +900,7 @@ enable_break2 (void) - { - warning (_("Could not find symbol _dl_debug_addr in dynamic linker")); - enable_break_failure_warning (); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return 0; - } - -@@ -948,13 +949,13 @@ enable_break2 (void) - "(at address %s) from dynamic linker"), - hex_string_custom (addr + 8, 8)); - enable_break_failure_warning (); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return 0; - } - addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order); - - /* We're done with the temporary bfd. */ -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - - /* We're also done with the loadmap. */ - xfree (ldm); -diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c -index 2f2c8b0..0f59535 100644 ---- a/gdb/solib-frv.c -+++ b/gdb/solib-frv.c -@@ -31,6 +31,7 @@ - #include "gdbcmd.h" - #include "elf/frv.h" - #include "exceptions.h" -+#include "gdb_bfd.h" - - /* Flag which indicates whether internal debug messages should be printed. */ - static int solib_frv_debug; -@@ -574,7 +575,7 @@ enable_break2 (void) - { - warning (_("Unable to determine dynamic linker loadmap address.")); - enable_break_failure_warning (); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return 0; - } - -@@ -589,7 +590,7 @@ enable_break2 (void) - warning (_("Unable to load dynamic linker loadmap at address %s."), - hex_string_custom (interp_loadmap_addr, 8)); - enable_break_failure_warning (); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return 0; - } - -@@ -623,7 +624,7 @@ enable_break2 (void) - warning (_("Could not find symbol _dl_debug_addr " - "in dynamic linker")); - enable_break_failure_warning (); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return 0; - } - -@@ -674,7 +675,7 @@ enable_break2 (void) - "(at address %s) from dynamic linker"), - hex_string_custom (addr + 8, 8)); - enable_break_failure_warning (); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return 0; - } - addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order); -@@ -686,13 +687,13 @@ enable_break2 (void) - "(at address %s) from dynamic linker"), - hex_string_custom (addr, 8)); - enable_break_failure_warning (); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return 0; - } - addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order); - - /* We're done with the temporary bfd. */ -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - - /* We're also done with the loadmap. */ - xfree (ldm); -diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c -index 2b8d061..00ed8a5 100644 ---- a/gdb/solib-pa64.c -+++ b/gdb/solib-pa64.c -@@ -362,7 +362,7 @@ manpage for methods to privately map shared library text.")); - to find any magic formula to find it for Solaris (appears to - be trivial on GNU/Linux). Therefore, we have to try an alternate - mechanism to find the dynamic linker's base address. */ -- tmp_bfd = bfd_openr (buf, gnutarget); -+ tmp_bfd = gdb_bfd_openr (buf, gnutarget); - if (tmp_bfd == NULL) - return; - -@@ -371,7 +371,7 @@ manpage for methods to privately map shared library text.")); - { - warning (_("Unable to grok dynamic linker %s as an object file"), - buf); -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - return; - } - -@@ -401,7 +401,7 @@ manpage for methods to privately map shared library text.")); - } - - /* We're done with the temporary bfd. */ -- bfd_close (tmp_bfd); -+ gdb_bfd_unref (tmp_bfd); - } - } - -diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c -index b5454e7..f62d96c 100644 ---- a/gdb/solib-spu.c -+++ b/gdb/solib-spu.c -@@ -36,6 +36,7 @@ - #include "breakpoint.h" - #include "gdbthread.h" - #include "exceptions.h" -+#include "gdb_bfd.h" - - #include "spu-tdep.h" - -@@ -325,16 +326,16 @@ spu_bfd_fopen (char *name, CORE_ADDR addr) - CORE_ADDR *open_closure = xmalloc (sizeof (CORE_ADDR)); - *open_closure = addr; - -- nbfd = bfd_openr_iovec (xstrdup (name), "elf32-spu", -- spu_bfd_iovec_open, open_closure, -- spu_bfd_iovec_pread, spu_bfd_iovec_close, -- spu_bfd_iovec_stat); -+ nbfd = gdb_bfd_openr_iovec (name, "elf32-spu", -+ spu_bfd_iovec_open, open_closure, -+ spu_bfd_iovec_pread, spu_bfd_iovec_close, -+ spu_bfd_iovec_stat); - if (!nbfd) - return NULL; - - if (!bfd_check_format (nbfd, bfd_object)) - { -- bfd_close (nbfd); -+ gdb_bfd_unref (nbfd); - return NULL; - } - -diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c -index 307e483..76bd872 100644 ---- a/gdb/solib-svr4.c -+++ b/gdb/solib-svr4.c -@@ -46,6 +46,7 @@ - #include "exec.h" - #include "auxv.h" - #include "exceptions.h" -+#include "gdb_bfd.h" - - static struct link_map_offsets *svr4_fetch_link_map_offsets (void); - static int svr4_have_link_map_offsets (void); -@@ -1558,9 +1559,11 @@ enable_break (struct svr4_info *info, int from_tty) - goto bkpt_at_symbol; - - /* Now convert the TMP_BFD into a target. That way target, as -- well as BFD operations can be used. Note that closing the -- target will also close the underlying bfd. */ -+ well as BFD operations can be used. */ - tmp_bfd_target = target_bfd_reopen (tmp_bfd); -+ /* target_bfd_reopen acquired its own reference, so we can -+ release ours now. */ -+ gdb_bfd_unref (tmp_bfd); - - /* On a running target, we can get the dynamic linker's base - address from the shared library table. */ -@@ -1670,8 +1673,9 @@ enable_break (struct svr4_info *info, int from_tty) - sym_addr, - tmp_bfd_target); - -- /* We're done with both the temporary bfd and target. Remember, -- closing the target closes the underlying bfd. */ -+ /* We're done with both the temporary bfd and target. Closing -+ the target closes the underlying bfd, because it holds the -+ only remaining reference. */ - target_close (tmp_bfd_target, 0); - - if (sym_addr != 0) -diff --git a/gdb/solib.c b/gdb/solib.c -index 90439ba..73773f1 100644 ---- a/gdb/solib.c -+++ b/gdb/solib.c -@@ -46,6 +46,7 @@ - #include "solib.h" - #include "interps.h" - #include "filesystem.h" -+#include "gdb_bfd.h" - - /* Architecture-specific operations. */ - -@@ -360,9 +361,9 @@ solib_find (char *in_pathname, int *fd) - it is used as file handle to open the file. Throws an error if the file - could not be opened. Handles both local and remote file access. - -- PATHNAME must be malloc'ed by the caller. If successful, the new BFD's -- name will point to it. If unsuccessful, PATHNAME will be freed and the -- FD will be closed (unless FD was -1). */ -+ PATHNAME must be malloc'ed by the caller. It will be freed by this -+ function. If unsuccessful, the FD will be closed (unless FD was -+ -1). */ - - bfd * - solib_bfd_fopen (char *pathname, int fd) -@@ -376,7 +377,7 @@ solib_bfd_fopen (char *pathname, int fd) - } - else - { -- abfd = bfd_fopen (pathname, gnutarget, FOPEN_RB, fd); -+ abfd = gdb_bfd_fopen (pathname, gnutarget, FOPEN_RB, fd); - - if (abfd) - bfd_set_cacheable (abfd, 1); -@@ -389,6 +390,8 @@ solib_bfd_fopen (char *pathname, int fd) - pathname, bfd_errmsg (bfd_get_error ())); - } - -+ xfree (pathname); -+ - return abfd; - } - -@@ -420,17 +423,16 @@ solib_bfd_open (char *pathname) - /* Check bfd format. */ - if (!bfd_check_format (abfd, bfd_object)) - { -- bfd_close (abfd); -- make_cleanup (xfree, found_pathname); -+ make_cleanup_bfd_unref (abfd); - error (_("`%s': not in executable format: %s"), -- found_pathname, bfd_errmsg (bfd_get_error ())); -+ bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); - } - - /* Check bfd arch. */ - b = gdbarch_bfd_arch_info (target_gdbarch); - if (!b->compatible (b, bfd_get_arch_info (abfd))) - warning (_("`%s': Shared library architecture %s is not compatible " -- "with target architecture %s."), found_pathname, -+ "with target architecture %s."), bfd_get_filename (abfd), - bfd_get_arch_info (abfd)->printable_name, b->printable_name); - - return abfd; -@@ -466,7 +468,7 @@ solib_map_sections (struct so_list *so) - return 0; - - /* Leave bfd open, core_xfer_memory and "info files" need it. */ -- so->abfd = gdb_bfd_ref (abfd); -+ so->abfd = abfd; - - /* copy full path name into so_name, so that later symbol_file_add - can find it. */ -@@ -1233,7 +1235,7 @@ reload_shared_libraries_1 (int from_tty) - { - found_pathname = xstrdup (bfd_get_filename (abfd)); - make_cleanup (xfree, found_pathname); -- gdb_bfd_close_or_warn (abfd); -+ gdb_bfd_unref (abfd); - } - - /* If this shared library is no longer associated with its previous -diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c -index 2dfec8c..999f1ab 100644 ---- a/gdb/spu-linux-nat.c -+++ b/gdb/spu-linux-nat.c -@@ -315,16 +315,16 @@ spu_bfd_open (ULONGEST addr) - ULONGEST *open_closure = xmalloc (sizeof (ULONGEST)); - *open_closure = addr; - -- nbfd = bfd_openr_iovec (xstrdup (""), "elf32-spu", -- spu_bfd_iovec_open, open_closure, -- spu_bfd_iovec_pread, spu_bfd_iovec_close, -- spu_bfd_iovec_stat); -+ nbfd = gdb_bfd_openr_iovec ("", "elf32-spu", -+ spu_bfd_iovec_open, open_closure, -+ spu_bfd_iovec_pread, spu_bfd_iovec_close, -+ spu_bfd_iovec_stat); - if (!nbfd) - return NULL; - - if (!bfd_check_format (nbfd, bfd_object)) - { -- bfd_close (nbfd); -+ gdb_bfd_unref (nbfd); - return NULL; - } - -@@ -374,8 +374,13 @@ spu_symbol_file_add_from_memory (int inferior_fd) - /* Open BFD representing SPE executable and read its symbols. */ - nbfd = spu_bfd_open (addr); - if (nbfd) -- symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE, -- NULL, 0, NULL); -+ { -+ struct cleanup *cleanup = make_cleanup_bfd_unref (nbfd); -+ -+ symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE, -+ NULL, 0, NULL); -+ do_cleanups (cleanup); -+ } - } - - -diff --git a/gdb/stack.c b/gdb/stack.c -index 35d379d..04aab5e 100644 ---- a/gdb/stack.c -+++ b/gdb/stack.c -@@ -509,6 +509,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame, - stb = mem_fileopen (); - old_chain = make_cleanup_ui_file_delete (stb); - -+ /* Frame may be needed for check_typedef of TYPE_DYNAMIC. */ -+ make_cleanup_restore_selected_frame (); -+ select_frame (frame); -+ - if (func) - { - struct block *b = SYMBOL_BLOCK_VALUE (func); -diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c -index e80fd25..2e53be0 100644 ---- a/gdb/symfile-mem.c -+++ b/gdb/symfile-mem.c -@@ -54,6 +54,7 @@ - #include "observer.h" - #include "auxv.h" - #include "elf/common.h" -+#include "gdb_bfd.h" - - /* Verify parameters of target_read_memory_bfd and target_read_memory are - compatible. */ -@@ -100,23 +101,24 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name, - if (nbfd == NULL) - error (_("Failed to read a valid object file image from memory.")); - -+ gdb_bfd_ref (nbfd); - if (name == NULL) -- nbfd->filename = xstrdup ("shared object read from target memory"); -+ nbfd->filename = "shared object read from target memory"; - else -- nbfd->filename = name; -- -- if (!bfd_check_format (nbfd, bfd_object)) - { -- /* FIXME: should be checking for errors from bfd_close (for one thing, -- on error it does not free all the storage associated with the -- bfd). */ -- bfd_close (nbfd); -- error (_("Got object file from memory but can't read symbols: %s."), -- bfd_errmsg (bfd_get_error ())); -+ nbfd->filename = name; -+ gdb_bfd_stash_filename (nbfd); -+ xfree (name); - } - -+ cleanup = make_cleanup_bfd_unref (nbfd); -+ -+ if (!bfd_check_format (nbfd, bfd_object)) -+ error (_("Got object file from memory but can't read symbols: %s."), -+ bfd_errmsg (bfd_get_error ())); -+ - sai = alloc_section_addr_info (bfd_count_sections (nbfd)); -- cleanup = make_cleanup (xfree, sai); -+ make_cleanup (xfree, sai); - i = 0; - for (sec = nbfd->sections; sec != NULL; sec = sec->next) - if ((bfd_get_section_flags (nbfd, sec) & (SEC_ALLOC|SEC_LOAD)) != 0) -diff --git a/gdb/symfile.c b/gdb/symfile.c -index 01252e2..95ed480 100644 ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -55,6 +55,7 @@ - #include "solib.h" - #include "remote.h" - #include "stack.h" -+#include "gdb_bfd.h" - - #include - #include -@@ -1036,7 +1037,7 @@ new_symfile_objfile (struct objfile *objfile, int add_flags) - loaded file. - - ABFD is a BFD already open on the file, as from symfile_bfd_open. -- This BFD will be closed on error, and is always consumed by this function. -+ A new reference is acquired by this function. - - ADD_FLAGS encodes verbosity, whether this is main symbol file or - extra, such as dynamically loaded code, and what to do with breakpoins. -@@ -1060,7 +1061,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - int flags, struct objfile *parent) - { - struct objfile *objfile; -- struct cleanup *my_cleanups; - const char *name = bfd_get_filename (abfd); - const int from_tty = add_flags & SYMFILE_VERBOSE; - const int mainline = add_flags & SYMFILE_MAINLINE; -@@ -1074,8 +1074,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - add_flags &= ~SYMFILE_NO_READ; - } - -- my_cleanups = make_cleanup_bfd_close (abfd); -- - /* Give user a chance to burp if we'd be - interactively wiping out any existing symbols. */ - -@@ -1086,7 +1084,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - error (_("Not confirmed.")); - - objfile = allocate_objfile (abfd, flags | (mainline ? OBJF_MAINLINE : 0)); -- discard_cleanups (my_cleanups); - - if (parent) - add_separate_debug_objfile (objfile, parent); -@@ -1207,8 +1204,13 @@ struct objfile * - symbol_file_add (char *name, int add_flags, struct section_addr_info *addrs, - int flags) - { -- return symbol_file_add_from_bfd (symfile_bfd_open (name), add_flags, addrs, -- flags, NULL); -+ bfd *bfd = symfile_bfd_open (name); -+ struct cleanup *cleanup = make_cleanup_bfd_unref (bfd); -+ struct objfile *objf; -+ -+ objf = symbol_file_add_from_bfd (bfd, add_flags, addrs, flags, NULL); -+ do_cleanups (cleanup); -+ return objf; - } - - -@@ -1350,7 +1352,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, - if (filename_cmp (name, parent_objfile->name) == 0) - return 0; - -- abfd = bfd_open_maybe_remote (name); -+ abfd = gdb_bfd_open_maybe_remote (name); - - if (!abfd) - return 0; -@@ -1372,7 +1374,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, - if (abfd_stat.st_dev == parent_stat.st_dev - && abfd_stat.st_ino == parent_stat.st_ino) - { -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return 0; - } - verified_as_different = 1; -@@ -1382,7 +1384,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, - - file_crc_p = get_file_crc (abfd, &file_crc); - -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - - if (!file_crc_p) - return 0; -@@ -1690,15 +1692,20 @@ set_initial_language (void) - } - - /* If NAME is a remote name open the file using remote protocol, otherwise -- open it normally. */ -+ open it normally. Returns a new reference to the BFD. On error, -+ returns NULL with the BFD error set. */ - - bfd * --bfd_open_maybe_remote (const char *name) -+gdb_bfd_open_maybe_remote (const char *name) - { -+ bfd *result; -+ - if (remote_filename_p (name)) -- return remote_bfd_open (name, gnutarget); -+ result = remote_bfd_open (name, gnutarget); - else -- return bfd_openr (name, gnutarget); -+ result = gdb_bfd_openr (name, gnutarget); -+ -+ return result; - } - - -@@ -1716,19 +1723,14 @@ symfile_bfd_open (char *name) - - if (remote_filename_p (name)) - { -- name = xstrdup (name); - sym_bfd = remote_bfd_open (name, gnutarget); - if (!sym_bfd) -- { -- make_cleanup (xfree, name); -- error (_("`%s': can't open to read symbols: %s."), name, -- bfd_errmsg (bfd_get_error ())); -- } -+ error (_("`%s': can't open to read symbols: %s."), name, -+ bfd_errmsg (bfd_get_error ())); - - if (!bfd_check_format (sym_bfd, bfd_object)) - { -- bfd_close (sym_bfd); -- make_cleanup (xfree, name); -+ make_cleanup_bfd_unref (sym_bfd); - error (_("`%s': can't read symbols: %s."), name, - bfd_errmsg (bfd_get_error ())); - } -@@ -1757,12 +1759,11 @@ symfile_bfd_open (char *name) - perror_with_name (name); - } - -- /* Free 1st new malloc'd copy, but keep the 2nd malloc'd copy in -- bfd. It'll be freed in free_objfile(). */ - xfree (name); - name = absolute_name; -+ make_cleanup (xfree, name); - -- sym_bfd = bfd_fopen (name, gnutarget, FOPEN_RB, desc); -+ sym_bfd = gdb_bfd_fopen (name, gnutarget, FOPEN_RB, desc); - if (!sym_bfd) - { - make_cleanup (xfree, name); -@@ -1773,18 +1774,11 @@ symfile_bfd_open (char *name) - - if (!bfd_check_format (sym_bfd, bfd_object)) - { -- /* FIXME: should be checking for errors from bfd_close (for one -- thing, on error it does not free all the storage associated -- with the bfd). */ -- bfd_close (sym_bfd); /* This also closes desc. */ -- make_cleanup (xfree, name); -+ make_cleanup_bfd_unref (sym_bfd); - error (_("`%s': can't read symbols: %s."), name, - bfd_errmsg (bfd_get_error ())); - } - -- /* bfd_usrdata exists for applications and libbfd must not touch it. */ -- gdb_assert (bfd_usrdata (sym_bfd) == NULL); -- - return sym_bfd; - } - -@@ -2109,17 +2103,14 @@ generic_load (char *args, int from_tty) - } - - /* Open the file for loading. */ -- loadfile_bfd = bfd_openr (filename, gnutarget); -+ loadfile_bfd = gdb_bfd_openr (filename, gnutarget); - if (loadfile_bfd == NULL) - { - perror_with_name (filename); - return; - } - -- /* FIXME: should be checking for errors from bfd_close (for one thing, -- on error it does not free all the storage associated with the -- bfd). */ -- make_cleanup_bfd_close (loadfile_bfd); -+ make_cleanup_bfd_unref (loadfile_bfd); - - if (!bfd_check_format (loadfile_bfd, bfd_object)) - { -@@ -2518,15 +2509,18 @@ reread_symbols (void) - /* Clean up any state BFD has sitting around. We don't need - to close the descriptor but BFD lacks a way of closing the - BFD without closing the descriptor. */ -- obfd_filename = bfd_get_filename (objfile->obfd); -- if (!bfd_close (objfile->obfd)) -- error (_("Can't close BFD for %s: %s"), objfile->name, -- bfd_errmsg (bfd_get_error ())); -- objfile->obfd = bfd_open_maybe_remote (obfd_filename); -+ { -+ struct bfd *obfd = objfile->obfd; -+ -+ obfd_filename = bfd_get_filename (objfile->obfd); -+ /* Open the new BFD before freeing the old one, so that -+ the filename remains live. */ -+ objfile->obfd = gdb_bfd_open_maybe_remote (obfd_filename); -+ gdb_bfd_unref (obfd); -+ } -+ - if (objfile->obfd == NULL) - error (_("Can't open %s to read symbols."), objfile->name); -- else -- objfile->obfd = gdb_bfd_ref (objfile->obfd); - /* bfd_openr sets cacheable to true, which is what we want. */ - if (!bfd_check_format (objfile->obfd, bfd_object)) - error (_("Can't read symbols from %s: %s."), objfile->name, -diff --git a/gdb/symfile.h b/gdb/symfile.h -index aca7359..184a83e 100644 ---- a/gdb/symfile.h -+++ b/gdb/symfile.h -@@ -553,7 +553,7 @@ extern void find_lowest_section (bfd *, asection *, void *); - - extern bfd *symfile_bfd_open (char *); - --extern bfd *bfd_open_maybe_remote (const char *); -+extern bfd *gdb_bfd_open_maybe_remote (const char *); - - extern int get_section_index (struct objfile *, char *); - -diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp -index 678639c..47a2202 100644 ---- a/gdb/testsuite/gdb.ada/packed_array.exp -+++ b/gdb/testsuite/gdb.ada/packed_array.exp -@@ -60,5 +60,11 @@ gdb_test_multiple "$test" "$test" { - # are. Observed with (FSF GNU Ada 4.5.3 20110124). - xfail $test - } -+ -re "= \\(\\)\[\r\n\]+$gdb_prompt $" { -+ # archer-jankratochvil-vla resolves it as a dynamic type resolved as an -+ # empty array [0..-1]. -+ # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref) -+ xfail $test -+ } - } - -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S -new file mode 100644 -index 0000000..83faaf6 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S -@@ -0,0 +1,457 @@ -+ .file "x86_64-vla-pointer.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+.globl foo -+ .type foo, @function -+foo: -+.LFB2: -+ .file 1 "x86_64-vla-pointer.c" -+ .loc 1 22 0 -+ pushq %rbp -+.LCFI0: -+ movq %rsp, %rbp -+.LCFI1: -+ subq $64, %rsp -+.LCFI2: -+ movl %edi, -36(%rbp) -+ .loc 1 22 0 -+ movq %rsp, %rax -+ movq %rax, -48(%rbp) -+ .loc 1 23 0 -+ movl -36(%rbp), %edx -+ movslq %edx,%rax -+ subq $1, %rax -+ movq %rax, -24(%rbp) -+ .loc 1 24 0 -+ movslq %edx,%rax -+ addq $15, %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ subq %rax, %rsp -+ movq %rsp, -56(%rbp) -+ movq -56(%rbp), %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ movq %rax, -56(%rbp) -+ movq -56(%rbp), %rax -+ movq %rax, -16(%rbp) -+ .loc 1 27 0 -+ movl $0, -4(%rbp) -+ jmp .L2 -+.L3: -+ .loc 1 28 0 -+ movl -4(%rbp), %esi -+ movl -4(%rbp), %eax -+ movl %eax, %ecx -+ movq -16(%rbp), %rdx -+ movslq %esi,%rax -+ movb %cl, (%rdx,%rax) -+ .loc 1 27 0 -+ addl $1, -4(%rbp) -+.L2: -+ movl -4(%rbp), %eax -+ cmpl -36(%rbp), %eax -+ jl .L3 -+ .loc 1 30 0 -+ .globl break_here -+break_here: -+ movq -16(%rbp), %rax -+ movb $0, (%rax) -+ movq -48(%rbp), %rsp -+ .loc 1 31 0 -+ leave -+ ret -+.LFE2: -+ .size foo, .-foo -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 -+.LSCIE0: -+ .long 0xffffffff -+ .byte 0x1 -+ .string "" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 -+.LASFDE0: -+ .long .Lframe0 -+ .quad .LFB2 -+ .quad .LFE2-.LFB2 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE0: -+ .section .eh_frame,"a",@progbits -+.Lframe1: -+ .long .LECIE1-.LSCIE1 -+.LSCIE1: -+ .long 0x0 -+ .byte 0x1 -+ .string "zR" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .uleb128 0x1 -+ .byte 0x3 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE1: -+.LSFDE1: -+ .long .LEFDE1-.LASFDE1 -+.LASFDE1: -+ .long .LASFDE1-.Lframe1 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .uleb128 0x0 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE1: -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .quad .LFB2-.Ltext0 -+ .quad .LCFI0-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 8 -+ .quad .LCFI0-.Ltext0 -+ .quad .LCFI1-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 16 -+ .quad .LCFI1-.Ltext0 -+ .quad .LFE2-.Ltext0 -+ .value 0x2 -+ .byte 0x76 -+ .sleb128 16 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_info -+.Ldebug_relative: -+ .long .Ldebug_end - .Ldebug_start -+.Ldebug_start: -+ .value 0x2 -+ .long .Ldebug_abbrev0 -+ .byte 0x8 -+ .uleb128 0x1 -+ .long .LASF2 -+ .byte 0x1 -+ .long .LASF3 -+ .long .LASF4 -+ .quad .Ltext0 -+ .quad .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .byte 0x1 -+ .string "foo" -+ .byte 0x1 -+ .byte 0x16 -+ .byte 0x1 -+ .quad .LFB2 -+ .quad .LFE2 -+ .long .LLST0 -+ .long .Ltype_int - .Ldebug_relative -+ .uleb128 0x3 -+ .long .LASF5 -+ .byte 0x1 -+ .byte 0x15 -+ .long .Ltype_int - .Ldebug_relative -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -52 -+.Ltag_pointer: -+ .uleb128 0x4 -+ .byte 0x8 /* DW_AT_byte_size */ -+ .long .Ltag_array_type - .debug_info /* DW_AT_type */ -+ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */ -+ .long .LASF0 -+ .byte 0x1 -+ .byte 0x18 -+#if 1 -+ .long .Ltag_pointer - .debug_info -+#else -+ /* Debugging only: Skip the typedef indirection. */ -+ .long .Ltag_array_type - .debug_info -+#endif -+ /* DW_AT_location: DW_FORM_block1: start */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -32 -+#if 0 -+ .byte 0x6 /* DW_OP_deref */ -+#else -+ .byte 0x96 /* DW_OP_nop */ -+#endif -+ /* DW_AT_location: DW_FORM_block1: end */ -+ .uleb128 0x6 -+ .string "i" -+ .byte 0x1 -+ .byte 0x19 -+ .long .Ltype_int - .Ldebug_relative -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -20 -+ .byte 0x0 -+.Ltype_int: -+ .uleb128 0x7 -+ .byte 0x4 -+ .byte 0x5 -+ .string "int" -+.Ltag_array_type: -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .long .Ltype_char - .Ldebug_relative -+ .long .Ltype_ulong - .Ldebug_relative /* DW_AT_sibling: DW_FORM_ref4 */ -+1: /* DW_AT_data_location: DW_FORM_block1: start */ -+ .byte 2f - 3f /* length */ -+3: -+ .byte 0x97 /* DW_OP_push_object_address */ -+#if 1 -+ .byte 0x6 /* DW_OP_deref */ -+#else -+ .byte 0x96 /* DW_OP_nop */ -+#endif -+2: /* DW_AT_data_location: DW_FORM_block1: end */ -+ .uleb128 0x9 -+ .long .Ltype_char - .Ldebug_relative /* DW_AT_type: DW_FORM_ref4 */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -40 -+ .byte 0x6 -+ .byte 0x0 -+.Ltype_ulong: -+ .uleb128 0xa -+ .byte 0x8 -+ .byte 0x7 -+.Ltype_char: -+ .uleb128 0xb -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF1 -+ .byte 0x0 -+.Ldebug_end: -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0xe -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x1b -+ .uleb128 0xe -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x27 -+ .uleb128 0xc -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0x6 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 /* .Ltag_pointer abbrev */ -+ .uleb128 0x0f /* DW_TAG_pointer_type */ -+ .byte 0x0 -+ .uleb128 0x0b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .uleb128 0x1 -+ .byte 0x1 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x1 /* DW_AT_sibling */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x50 /* DW_AT_data_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 -+ .uleb128 0x21 -+ .byte 0x0 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2f -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xa -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x16 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0xa8 -+ .long 0x2d -+ .string "foo" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x8 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .quad .Ltext0 -+ .quad .Letext0-.Ltext0 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF0: -+ .string "array" -+.LASF5: -+ .string "size" -+.LASF3: -+ .string "x86_64-vla-pointer.c" -+.LASF6: -+ .string "array_t" -+.LASF1: -+ .string "char" -+.LASF4: -+ .string "gdb.arch" -+.LASF2: -+ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c -new file mode 100644 -index 0000000..fe2c8f7 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c -@@ -0,0 +1,43 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#if 0 -+ -+void -+foo (int size) -+{ -+ typedef char array_t[size]; -+ array_t array; -+ int i; -+ -+ for (i = 0; i < size; i++) -+ array[i] = i; -+ -+ array[0] = 0; /* break-here */ -+} -+ -+#else -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -+ -+#endif -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp -new file mode 100644 -index 0000000..d243cf1 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp -@@ -0,0 +1,66 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if ![istarget "x86_64-*-*"] then { -+ verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64." -+ return -+} -+ -+set testfile x86_64-vla-pointer -+set srcasmfile ${testfile}-foo.S -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set binobjfile ${objdir}/${subdir}/${testfile}-foo.o -+if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested x86_64-vla-pointer -+ return -1 -+} -+ -+gdb_breakpoint "break_here" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "first: whatis array" -+gdb_test "ptype array" "type = char \\(\\*\\)\\\[26\\\]" "first: ptype array" -+ -+gdb_test "whatis *array" "type = char \\\[26\\\]" "first: whatis *array" -+gdb_test "ptype *array" "type = char \\\[26\\\]" "first: ptype *array" -+ -+gdb_test "p (*array)\[1\]" "\\$\[0-9\] = 1 '\\\\001'" -+gdb_test "p (*array)\[2\]" "\\$\[0-9\] = 2 '\\\\002'" -+gdb_test "p (*array)\[3\]" "\\$\[0-9\] = 3 '\\\\003'" -+gdb_test "p (*array)\[4\]" "\\$\[0-9\] = 4 '\\\\004'" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "second: whatis array" -+gdb_test "ptype array" "type = char \\(\\*\\)\\\[78\\\]" "second: ptype array" -+ -+gdb_test "whatis *array" "type = char \\\[78\\\]" "second: whatis *array" -+gdb_test "ptype *array" "type = char \\\[78\\\]" "second: ptype *array" -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S -new file mode 100644 -index 0000000..66f7a39 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S -@@ -0,0 +1,455 @@ -+ .file "x86_64-vla-typedef.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+.globl foo -+ .type foo, @function -+foo: -+.LFB2: -+ .file 1 "x86_64-vla-typedef.c" -+ .loc 1 22 0 -+ pushq %rbp -+.LCFI0: -+ movq %rsp, %rbp -+.LCFI1: -+ subq $64, %rsp -+.LCFI2: -+ movl %edi, -36(%rbp) -+ .loc 1 22 0 -+ movq %rsp, %rax -+ movq %rax, -48(%rbp) -+ .loc 1 23 0 -+ movl -36(%rbp), %edx -+ movslq %edx,%rax -+ subq $1, %rax -+ movq %rax, -24(%rbp) -+ .loc 1 24 0 -+ movslq %edx,%rax -+ addq $15, %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ subq %rax, %rsp -+ movq %rsp, -56(%rbp) -+ movq -56(%rbp), %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ movq %rax, -56(%rbp) -+ movq -56(%rbp), %rax -+ movq %rax, -16(%rbp) -+ .loc 1 27 0 -+ movl $0, -4(%rbp) -+ jmp .L2 -+.L3: -+ .loc 1 28 0 -+ movl -4(%rbp), %esi -+ movl -4(%rbp), %eax -+ movl %eax, %ecx -+ movq -16(%rbp), %rdx -+ movslq %esi,%rax -+ movb %cl, (%rdx,%rax) -+ .loc 1 27 0 -+ addl $1, -4(%rbp) -+.L2: -+ movl -4(%rbp), %eax -+ cmpl -36(%rbp), %eax -+ jl .L3 -+ .loc 1 30 0 -+ .globl break_here -+break_here: -+ movq -16(%rbp), %rax -+ movb $0, (%rax) -+ movq -48(%rbp), %rsp -+ .loc 1 31 0 -+ leave -+ ret -+.LFE2: -+ .size foo, .-foo -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 -+.LSCIE0: -+ .long 0xffffffff -+ .byte 0x1 -+ .string "" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 -+.LASFDE0: -+ .long .Lframe0 -+ .quad .LFB2 -+ .quad .LFE2-.LFB2 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE0: -+ .section .eh_frame,"a",@progbits -+.Lframe1: -+ .long .LECIE1-.LSCIE1 -+.LSCIE1: -+ .long 0x0 -+ .byte 0x1 -+ .string "zR" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .uleb128 0x1 -+ .byte 0x3 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE1: -+.LSFDE1: -+ .long .LEFDE1-.LASFDE1 -+.LASFDE1: -+ .long .LASFDE1-.Lframe1 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .uleb128 0x0 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE1: -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .quad .LFB2-.Ltext0 -+ .quad .LCFI0-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 8 -+ .quad .LCFI0-.Ltext0 -+ .quad .LCFI1-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 16 -+ .quad .LCFI1-.Ltext0 -+ .quad .LFE2-.Ltext0 -+ .value 0x2 -+ .byte 0x76 -+ .sleb128 16 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_info -+ .long .Ldebug_end - .Ldebug_start -+.Ldebug_start: -+ .value 0x2 -+ .long .Ldebug_abbrev0 -+ .byte 0x8 -+ .uleb128 0x1 -+ .long .LASF2 -+ .byte 0x1 -+ .long .LASF3 -+ .long .LASF4 -+ .quad .Ltext0 -+ .quad .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .byte 0x1 -+ .string "foo" -+ .byte 0x1 -+ .byte 0x16 -+ .byte 0x1 -+ .quad .LFB2 -+ .quad .LFE2 -+ .long .LLST0 -+ .long 0x83 -+ .uleb128 0x3 -+ .long .LASF5 -+ .byte 0x1 -+ .byte 0x15 -+ .long 0x83 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -52 -+.Ltag_typedef: -+ .uleb128 0x4 -+ .long .LASF6 -+ .byte 0x1 -+ .byte 0x17 -+ .long .Ltag_array_type - .debug_info -+ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */ -+ .long .LASF0 -+ .byte 0x1 -+ .byte 0x18 -+#if 1 -+ .long .Ltag_typedef - .debug_info -+#else -+ /* Debugging only: Skip the typedef indirection. */ -+ .long .Ltag_array_type - .debug_info -+#endif -+ /* DW_AT_location: DW_FORM_block1: start */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -32 -+#if 0 -+ .byte 0x6 /* DW_OP_deref */ -+#else -+ .byte 0x96 /* DW_OP_nop */ -+#endif -+ /* DW_AT_location: DW_FORM_block1: end */ -+ .uleb128 0x6 -+ .string "i" -+ .byte 0x1 -+ .byte 0x19 -+ .long 0x83 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -20 -+ .byte 0x0 -+ .uleb128 0x7 -+ .byte 0x4 -+ .byte 0x5 -+ .string "int" -+.Ltag_array_type: -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .long 0xa0 + (2f - 1f) /* DW_AT_type: DW_FORM_ref4 */ -+ .long 0x9d + (2f - 1f) /* DW_AT_sibling: DW_FORM_ref4 */ -+1: /* DW_AT_data_location: DW_FORM_block1: start */ -+ .byte 2f - 3f /* length */ -+3: -+ .byte 0x97 /* DW_OP_push_object_address */ -+ .byte 0x6 /* DW_OP_deref */ -+2: /* DW_AT_data_location: DW_FORM_block1: end */ -+ .uleb128 0x9 -+ .long 0x9d + (2b - 1b) /* DW_AT_type: DW_FORM_ref4 */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -40 -+ .byte 0x6 -+ .byte 0x0 -+ .uleb128 0xa -+ .byte 0x8 -+ .byte 0x7 -+ .uleb128 0xb -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF1 -+ .byte 0x0 -+.Ldebug_end: -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0xe -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x1b -+ .uleb128 0xe -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x27 -+ .uleb128 0xc -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0x6 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 -+ .uleb128 0x16 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .uleb128 0x1 -+ .byte 0x1 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x1 /* DW_AT_sibling */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x50 /* DW_AT_data_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 -+ .uleb128 0x21 -+ .byte 0x0 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2f -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xa -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x16 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0xa8 -+ .long 0x2d -+ .string "foo" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x8 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .quad .Ltext0 -+ .quad .Letext0-.Ltext0 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF0: -+ .string "array" -+.LASF5: -+ .string "size" -+.LASF3: -+ .string "x86_64-vla-typedef.c" -+.LASF6: -+ .string "array_t" -+.LASF1: -+ .string "char" -+.LASF4: -+ .string "gdb.arch" -+.LASF2: -+ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c -new file mode 100644 -index 0000000..b809c4e ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c -@@ -0,0 +1,43 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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 . */ -+ -+#if 0 -+ -+void -+foo (int size) -+{ -+ typedef char array_t[size]; -+ array_t array; -+ int i; -+ -+ for (i = 0; i < size; i++) -+ array[i] = i; -+ -+ array[0] = 0; /* break-here */ -+} -+ -+#else -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -+ -+#endif -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp -new file mode 100644 -index 0000000..b05411e ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp -@@ -0,0 +1,64 @@ -+# 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 . -+ -+# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate. -+ -+if ![istarget "x86_64-*-*"] then { -+ verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64." -+ return -+} -+ -+set testfile x86_64-vla-typedef -+set srcasmfile ${testfile}-foo.S -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set binobjfile ${objdir}/${subdir}/${testfile}-foo.o -+if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested x86_64-vla-typedef -+ return -1 -+} -+ -+gdb_breakpoint "break_here" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = array_t" "first: whatis array" -+ -+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array" -+ -+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'" -+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'" -+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'" -+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = array_t" "second: whatis array" -+ -+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array" -diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c -index a99137e..c3dc2d9 100644 ---- a/gdb/testsuite/gdb.base/arrayidx.c -+++ b/gdb/testsuite/gdb.base/arrayidx.c -@@ -17,6 +17,13 @@ - - int array[] = {1, 2, 3, 4}; - -+#ifdef __GNUC__ -+struct -+ { -+ int a[0]; -+ } unbound; -+#endif -+ - int - main (void) - { -diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp -index cba0024..0dc0e46 100644 ---- a/gdb/testsuite/gdb.base/arrayidx.exp -+++ b/gdb/testsuite/gdb.base/arrayidx.exp -@@ -53,4 +53,12 @@ gdb_test "print array" \ - "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ - "Print array with array-indexes on" - -- -+set test "p unbound.a == &unbound.a\[0\]" -+gdb_test_multiple $test $test { -+ -re " = 1\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" { -+ unsupported "$test (no GCC)" -+ } -+} -diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c -new file mode 100644 -index 0000000..eeb7b85 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/internal-var-field-address.c -@@ -0,0 +1,20 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+struct { -+ int field; -+} staticstruct = { 1 }; -diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.exp b/gdb/testsuite/gdb.base/internal-var-field-address.exp -new file mode 100644 -index 0000000..6d82e73 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/internal-var-field-address.exp -@@ -0,0 +1,26 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set test internal-var-field-address -+set binfile ${test}.x -+if { [gdb_compile "${srcdir}/${subdir}/${test}.c" "${objdir}/${subdir}/${binfile}" object {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+clean_restart $binfile -+ -+gdb_test {set $varstruct = staticstruct} -+gdb_test {p $varstruct.field} " = 1" -diff --git a/gdb/testsuite/gdb.base/vla-frame.c b/gdb/testsuite/gdb.base/vla-frame.c -new file mode 100644 -index 0000000..5750f68 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.c -@@ -0,0 +1,31 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2011 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+int -+main (int argc, char **argv) -+{ -+ char s[2 + argc]; -+ void (*f) (char *) = 0; -+ -+ memset (s, 0, sizeof (s)); -+ s[0] = 'X'; -+ -+ f (s); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla-frame.exp b/gdb/testsuite/gdb.base/vla-frame.exp -new file mode 100644 -index 0000000..47736c7 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.exp -@@ -0,0 +1,38 @@ -+# Copyright 2011 Free Software Foundation, Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile vla-frame -+set executable ${testfile} -+ -+if { [prepare_for_testing ${testfile}.exp ${executable}] } { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+set test "continue" -+gdb_test_multiple $test $test { -+ -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ untested ${testfile}.exp -+ return -+ } -+} -+ -+gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*" -diff --git a/gdb/testsuite/gdb.base/vla-overflow.c b/gdb/testsuite/gdb.base/vla-overflow.c -new file mode 100644 -index 0000000..c5d5ee0 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-overflow.c -@@ -0,0 +1,30 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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 . */ -+ -+#include -+ -+int -+main (int argc, char **argv) -+{ -+ int array[argc]; -+ -+ array[0] = array[0]; -+ -+ abort (); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp -new file mode 100644 -index 0000000..24a608f ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-overflow.exp -@@ -0,0 +1,109 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# We could crash in: -+# #0 block_linkage_function (bl=0x0) at ../../gdb/block.c:69 -+# #1 in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97 -+# 97 framefunc = block_linkage_function (get_frame_block (frame, NULL)); -+# #2 in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496 -+# #3 in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156 -+# #4 dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206 -+# #5 in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430 -+# #6 in create_array_type (...) at ../../gdb/gdbtypes.c:840 -+# ... -+# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292 -+# ... -+# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273 -+ -+set testfile vla-overflow -+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh -+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 -+} -+ -+set f [open "|getconf PAGESIZE" "r"] -+gets $f pagesize -+close $f -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+if { [runto_main] < 0 } { -+ untested vla-overflow -+ return -1 -+} -+ -+# Get the GDB memory size when we stay at main. -+ -+proc memory_v_pages_get {} { -+ global pid_of_gdb pagesize -+ set fd [open "/proc/$pid_of_gdb/statm"] -+ gets $fd line -+ close $fd -+ # number of pages of virtual memory -+ scan $line "%d" drs -+ return $drs -+} -+ -+set pages_found [memory_v_pages_get] -+ -+# s390x with glibc-debuginfo.s390x installed used approx. 16MB. -+set mb_reserve 40 -+verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve" -+set kb_found [expr $pages_found * $pagesize / 1024] -+set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024] -+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit" -+ -+# Create the ulimit wrapper. -+set f [open $shfile "w"] -+puts $f "#! /bin/sh" -+puts $f "ulimit -v $kb_permit" -+puts $f "exec $GDB \"\$@\"" -+close $f -+remote_exec host "chmod +x $shfile" -+ -+gdb_exit -+set GDBold $GDB -+set GDB "$shfile" -+gdb_start -+set GDB $GDBold -+ -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+# Check the size again after the second run. -+# We must not stop in main as it would cache `array' and never crash later. -+ -+gdb_run_cmd -+ -+verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()" -+ -+verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+# `abort' can get expressed as `*__GI_abort'. -+gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()" -+ -+verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -diff --git a/gdb/testsuite/gdb.base/vla.c b/gdb/testsuite/gdb.base/vla.c -new file mode 100644 -index 0000000..e1f3ed1 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla.c -@@ -0,0 +1,55 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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 . */ -+ -+#include -+ -+void -+marker (void) -+{ -+} -+ -+void -+bar (char *a, char *b, char *c, int size) -+{ -+ memset (a, '1', size); -+ memset (b, '2', size); -+ memset (c, '3', 48); -+} -+ -+void -+foo (int size) -+{ -+ char temp1[size]; -+ char temp3[48]; -+ -+ temp1[size - 1] = '\0'; -+ { -+ char temp2[size]; -+ -+ bar (temp1, temp2, temp3, size); -+ -+ marker (); /* break-here */ -+ } -+} -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla.exp b/gdb/testsuite/gdb.base/vla.exp -new file mode 100644 -index 0000000..5da7378 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla.exp -@@ -0,0 +1,62 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile vla -+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 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested vla -+ return -1 -+} -+ -+gdb_breakpoint [gdb_get_line_number "break-here"] -+ -+gdb_continue_to_breakpoint "break-here" -+ -+gdb_test "whatis temp1" "type = char \\\[variable\\\]" "first: whatis temp1" -+gdb_test "whatis temp2" "type = char \\\[variable\\\]" "first: whatis temp2" -+gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3" -+ -+gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1" -+gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2" -+gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3" -+ -+gdb_test "p temp1" " = '1' " "first: print temp1" -+gdb_test "p temp2" " = '2' " "first: print temp2" -+gdb_test "p temp3" " = '3' " "first: print temp3" -+ -+gdb_continue_to_breakpoint "break-here" -+ -+gdb_test "whatis temp1" "type = char \\\[variable\\\]" "second: whatis temp1" -+gdb_test "whatis temp2" "type = char \\\[variable\\\]" "second: whatis temp2" -+gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3" -+ -+gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1" -+gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2" -+gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3" -+ -+gdb_test "p temp1" " = '1' " "second: print temp1" -+gdb_test "p temp2" " = '2' " "second: print temp2" -+gdb_test "p temp3" " = '3' " "second: print temp3" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -new file mode 100644 -index 0000000..aac3baa ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -@@ -0,0 +1,246 @@ -+/* 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 . */ -+ -+/* Debug information */ -+ -+/* We will `break *main' at the very first instruction. */ -+#define main_length 1 -+ -+ .section .data -+vardata: -+ /* See DW_OP_lit3 + 1 (0-based). */ -+ .string "seennotseen" -+ -+ .section .debug_info -+.Lcu1_begin: -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 4 /* Pointer Size (in bytes) */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .4byte .Lproducer /* DW_AT_producer */ -+ /* Use C++ to exploit a bug in parsing DW_AT_name "". */ -+ .byte 4 /* DW_AT_language (C++) - */ -+ .4byte main /* DW_AT_low_pc */ -+ .byte main_length /* DW_AT_high_pc */ -+ -+.Larray_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */ -+ .byte 0 /* End of children of die */ -+ -+ /* DW_AT_upper_bound is referencing an optimized-out variable. */ -+.Larrayb_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */ -+ .byte 0 /* End of children of die */ -+ -+ /* DW_AT_upper_bound is referencing register. */ -+.Larrayreg_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type with block */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .byte 2f - 1f /* DW_AT_upper_bound */ -+1: .byte 0x50 /* DW_OP_reg0 */ -+2: -+ .byte 0 /* End of children of die */ -+ -+.Luint_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .4byte .Luint_str /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ .byte 7 /* DW_AT_encoding */ -+ -+.Lchar_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .4byte .Lchar_str /* DW_AT_name */ -+ .byte 1 /* DW_AT_byte_size */ -+ .byte 6 /* DW_AT_encoding */ -+ -+.Llen_var: -+ .uleb128 5 /* Abbrev: DW_TAG_variable artificial */ -+ .byte 1 /* DW_AT_artificial */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .4byte .Llen_loclist-.Lloclist /* DW_AT_location */ -+ -+ /* optimized-out variable for b_string. */ -+.Llenb_var: -+ .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */ -+ .byte 1 /* DW_AT_artificial */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "a_string" /* DW_AT_name */ -+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ /* DW_AT_upper_bound is referencing an optimized-out variable. */ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "b_string" /* DW_AT_name */ -+ .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ /* DW_AT_upper_bound is referencing register. */ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "reg_string" /* DW_AT_name */ -+ .4byte .Larrayreg_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ .byte 0 /* End of children of CU */ -+.Lcu1_end: -+ -+ .section .debug_loc -+.Lloclist: -+.Llen_loclist: -+ .4byte 0 # Location list begin address -+ .4byte main_length # Location list end address -+ .value 2f-1f # Location expression size -+1: .byte 0x33 # DW_OP_lit3 -+ .byte 0x9f # DW_OP_stack_value -+2: -+ .quad 0x0 # Location list terminator begin (*.LLST2) -+ .quad 0x0 # Location list terminator end (*.LLST2) -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 0x1 /* has_children */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x1 /* TAG: DW_TAG_array_type */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 5 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0x0c /* DW_FORM_flag */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x02 /* DW_AT_location */ -+ .uleb128 0x06 /* DW_FORM_data4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 7 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0x0c /* DW_FORM_flag */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 8 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type with block */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ -+/* String table */ -+ .section .debug_str -+.Lproducer: -+ .string "GNU C 3.3.3" -+.Lchar_str: -+ .string "char" -+.Luint_str: -+ .string "unsigned int" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -new file mode 100644 -index 0000000..815ed93 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -@@ -0,0 +1,54 @@ -+# 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 . -+ -+# Test printing variable with dynamic bounds which reference a different -+# (artificial in the GCC case) variable containing loclist as its location. -+# This testcase uses value (not address) of the referenced variable: -+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762 -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile dw2-bound-loclist -+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } { -+ return -1 -+} -+ -+# Verify it behaves at least as an unbound array without inferior. -+ -+gdb_test "p a_string" { = 0x[0-9a-f]+ "seennotseen"} -+gdb_test "ptype a_string" {type = char \[\]} -+ -+# Not runto_main as dw2-bound-loclist.S handles only the first byte of main. -+if ![runto "*main"] { -+ return -1 -+} -+ -+gdb_test "p a_string" { = "seen"} -+gdb_test "ptype a_string" {type = char \[4\]} -+ -+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"} -+gdb_test "ptype b_string" {type = char \[\]} -+ -+# The register contains unpredictable value - the array size. -+gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c -new file mode 100644 -index 0000000..1f02d90 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c -@@ -0,0 +1,42 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004 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. */ -+ -+ -+/* The function `func1' traced into must have debug info on offset > 0; -+ (DW_UNSND (attr)). This is the reason of `func0' existence. */ -+ -+void -+func0(int a, int b) -+{ -+} -+ -+/* `func1' being traced into must have some arguments to dump. */ -+ -+void -+func1(int a, int b) -+{ -+ func0 (a,b); -+} -+ -+int -+main(void) -+{ -+ func1 (1, 2); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp -new file mode 100644 -index 0000000..1c6e84a ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp -@@ -0,0 +1,79 @@ -+# Copyright 2006 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Minimal DWARF-2 unit test -+ -+# This test can only be run on targets which support DWARF-2. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-stripped" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile}.x -+ -+remote_exec build "rm -f ${binfile}" -+ -+# get the value of gcc_compiled -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+# This test can only be run on gcc as we use additional_flags=FIXME -+if {$gcc_compiled == 0} { -+ return 0 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } { -+ return -1 -+} -+ -+remote_exec build "objcopy -R .debug_loc ${binfile}" -+set strip_output [remote_exec build "objdump -h ${binfile}"] -+ -+set test "stripping test file preservation" -+if [ regexp ".debug_info " $strip_output] { -+ pass "$test (.debug_info preserved)" -+} else { -+ fail "$test (.debug_info got also stripped)" -+} -+ -+set test "stripping test file functionality" -+if [ regexp ".debug_loc " $strip_output] { -+ fail "$test (.debug_loc still present)" -+} else { -+ pass "$test (.debug_loc stripped)" -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# For C programs, "start" should stop in main(). -+ -+gdb_test "start" \ -+ ".*main \\(\\) at .*" \ -+ "start" -+gdb_test "step" \ -+ "func.* \\(.*\\) at .*" \ -+ "step" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S -new file mode 100644 -index 0000000..5fcdd84 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S -@@ -0,0 +1,83 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Debug information */ -+ -+ .section .debug_info -+.Lcu1_begin: -+ /* CU header */ -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "dw2-struct-member-data-location.c\0" /* DW_AT_name */ -+ .ascii "GNU C 4.3.2\0" /* DW_AT_producer */ -+ .byte 1 /* DW_AT_language (C) */ -+ -+.Ltype_uchar: -+ .uleb128 2 /* Abbrev: DW_TAG_structure_type */ -+ .ascii "some_struct\0" /* DW_AT_name */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_member */ -+ .ascii "field\0" /* DW_AT_name */ -+ .byte 0 /* DW_AT_data_member_location */ -+ -+ .byte 0 /* End of children of some_struct */ -+ -+ .byte 0 /* End of children of CU */ -+ -+.Lcu1_end: -+ -+/* Abbrev table */ -+ .section .debug_abbrev -+.Labbrev1_begin: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x13 /* DW_TAG_structure_type */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x0d /* DW_TAG_member */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x38 /* DW_AT_data_member_location */ -+ .uleb128 0x0b /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp -new file mode 100644 -index 0000000..c41151c ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp -@@ -0,0 +1,37 @@ -+# 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 . -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-struct-member-data-location" -+set srcfile ${testfile}.S -+set binfile ${testfile}.x -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${binfile}" object {nodebug}] != "" } { -+ return -1 -+} -+ -+clean_restart $binfile -+ -+gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S -new file mode 100644 -index 0000000..9dbbf3c ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S -@@ -0,0 +1,121 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+/* Debug information */ -+ -+ .section .data -+vardata: -+ .rept 129 -+ .ascii "x" -+ .endr -+ .ascii "UNSEEN\0" -+ -+ .section .debug_info -+.Lcu1_begin: -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 4 /* Pointer Size (in bytes) */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 2 /* DW_AT_language (C) - */ -+ -+.Larray_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .byte 128 /* DW_AT_upper_bound */ -+ -+ .byte 0 /* End of children of die */ -+ -+.Lchar_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .ascii "char\0" /* DW_AT_name */ -+ .byte 1 /* DW_AT_byte_size */ -+ .byte 6 /* DW_AT_encoding */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .ascii "notype_string\0" /* DW_AT_name */ -+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ .byte 0 /* End of children of CU */ -+.Lcu1_end: -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 0x1 /* has_children */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x1 /* TAG: DW_TAG_array_type */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 8 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp -new file mode 100644 -index 0000000..a13e346 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp -@@ -0,0 +1,39 @@ -+# Copyright 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 . -+load_lib dwarf.exp -+ -+# https://bugzilla.redhat.com/show_bug.cgi?id=806920 -+# read_subrange_type reinitialization -+# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without -+# specified DW_AT_type, present only in XLF produced code. -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ return 0 -+} -+ -+set testfile dw2-subrange-no-type -+set srcfile ${testfile}.S -+set executable ${testfile}.x -+set binfile ${objdir}/${subdir}/${executable} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } { -+ return -1 -+} -+ -+clean_restart $executable -+ -+gdb_test "ptype notype_string" {type = char \[129\]} -+gdb_test "p notype_string" " = 'x' " -diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp -new file mode 100644 -index 0000000..d7b8bea ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.exp -@@ -0,0 +1,42 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. Array element stride must not be -+# specified in the number of elements but in a number of bytes instead. -+# Original problem: -+# (gdb) p c40pt(1) -+# $1 = '0-hello', ' ' -+# (gdb) p c40pt(2) -+# warning: Fortran array stride not divisible by the element size -+ -+set testfile dwarf-stride -+set srcfile ${testfile}.f90 -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } { -+ return -1 -+} -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_breakpoint [gdb_get_line_number "break-here"] -+gdb_continue_to_breakpoint "break-here" ".*break-here.*" -+gdb_test "p c40pt(1)" " = '0-hello.*" -+gdb_test "p c40pt(2)" " = '1-hello.*" -diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.f90 b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 -new file mode 100644 -index 0000000..e492b3a ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 -@@ -0,0 +1,40 @@ -+! Copyright 2009 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 2 of the License, or -+! (at your option) any later version. -+! -+! This program is distributed in the hope that it will be useful, -+! but WITHOUT ANY WARRANTY; without even the implied warranty of -+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+! GNU General Public License for more details. -+! -+! You should have received a copy of the GNU General Public License -+! along with this program; if not, write to the Free Software -+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+! -+! File written by Alan Matsuoka. -+ -+program repro -+ -+ type small_stride -+ character*40 long_string -+ integer small_pad -+ end type small_stride -+ -+ type(small_stride), dimension (20), target :: unpleasant -+ character*40, pointer, dimension(:):: c40pt -+ -+ integer i -+ -+ do i = 0,19 -+ unpleasant(i+1)%small_pad = i+1 -+ unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello' -+ end do -+ -+ c40pt => unpleasant%long_string -+ -+ print *, c40pt ! break-here -+ -+end program repro -diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 -new file mode 100644 -index 0000000..261ce17 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 -@@ -0,0 +1,24 @@ -+! Copyright 2010 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 2 of the License, or -+! (at your option) any later version. -+! -+! This program is distributed in the hope that it will be useful, -+! but WITHOUT ANY WARRANTY; without even the implied warranty of -+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+! GNU General Public License for more details. -+! -+! You should have received a copy of the GNU General Public License -+! along with this program; if not, write to the Free Software -+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+! -+! Ihis file is the Fortran source file for dynamic.exp. -+! Original file written by Jakub Jelinek . -+! Modified for the GDB testcase by Jan Kratochvil . -+ -+subroutine bar -+ real :: dummy -+ dummy = 1 -+end subroutine bar -diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp -new file mode 100644 -index 0000000..fa41b80 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp -@@ -0,0 +1,37 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+set testfile "dynamic-other-frame" -+set srcfile1 ${testfile}.f90 -+set srcfile2 ${testfile}-stub.f90 -+set objfile2 ${objdir}/${subdir}/${testfile}-stub.o -+set executable ${testfile} -+set binfile ${objdir}/${subdir}/${executable} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != "" -+ || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } { -+ untested "Couldn't compile ${srcfile1} or ${srcfile2}" -+ return -1 -+} -+ -+clean_restart ${executable} -+ -+if ![runto bar_] then { -+ perror "couldn't run to bar_" -+ continue -+} -+ -+gdb_test "bt" {foo \(string='hello'.*} -diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 -new file mode 100644 -index 0000000..2bc637d ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 -@@ -0,0 +1,36 @@ -+! Copyright 2010 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 2 of the License, or -+! (at your option) any later version. -+! -+! This program is distributed in the hope that it will be useful, -+! but WITHOUT ANY WARRANTY; without even the implied warranty of -+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+! GNU General Public License for more details. -+! -+! You should have received a copy of the GNU General Public License -+! along with this program; if not, write to the Free Software -+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+! -+! Ihis file is the Fortran source file for dynamic.exp. -+! Original file written by Jakub Jelinek . -+! Modified for the GDB testcase by Jan Kratochvil . -+ -+subroutine foo (string) -+ interface -+ subroutine bar -+ end subroutine -+ end interface -+ character string*(*) -+ call bar ! stop-here -+end subroutine foo -+program test -+ interface -+ subroutine foo (string) -+ character string*(*) -+ end subroutine -+ end interface -+ call foo ('hello') -+end -diff --git a/gdb/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp -new file mode 100644 -index 0000000..e79e94a ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic.exp -@@ -0,0 +1,152 @@ -+# 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. It contains tests for dynamically -+# allocated Fortran arrays. -+# It depends on the GCC dynamic Fortran arrays DWARF support: -+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244 -+ -+set testfile "dynamic" -+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 "varx-init"] -+gdb_continue_to_breakpoint "varx-init" -+gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx unallocated" -+gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx unallocated" -+gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) unallocated" -+gdb_test "p varx(1,5,17)=1" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17)=1 unallocated" -+gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) unallocated" -+ -+gdb_breakpoint [gdb_get_line_number "varx-allocated"] -+gdb_continue_to_breakpoint "varx-allocated" -+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...) -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated" -+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. -+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated" -+ -+gdb_breakpoint [gdb_get_line_number "varx-filled"] -+gdb_continue_to_breakpoint "varx-filled" -+gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6" -+gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7" -+gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8" -+gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9" -+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. -+gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv unassociated" -+gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv unassociated" -+ -+set test "output varx" -+gdb_test_multiple $test $test { -+ -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+gdb_breakpoint [gdb_get_line_number "varv-associated"] -+gdb_continue_to_breakpoint "varv-associated" -+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated" -+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated" -+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. -+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated" -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated" -+# Intel Fortran Compiler 10.1.008 uses the pointer type. -+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated" -+ -+gdb_breakpoint [gdb_get_line_number "varv-filled"] -+gdb_continue_to_breakpoint "varv-filled" -+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled" -+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled" -+ -+gdb_breakpoint [gdb_get_line_number "varv-deassociated"] -+gdb_continue_to_breakpoint "varv-deassociated" -+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. -+gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated" -+gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv deassociated" -+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated" -+gdb_test "p varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\." -+gdb_test "ptype varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\." -+ -+gdb_breakpoint [gdb_get_line_number "varx-deallocated"] -+gdb_continue_to_breakpoint "varx-deallocated" -+gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx deallocated" -+gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx deallocated" -+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated" -+gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) deallocated" -+gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) deallocated" -+ -+gdb_breakpoint [gdb_get_line_number "vary-passed"] -+gdb_continue_to_breakpoint "vary-passed" -+# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...) -+gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)" -+ -+gdb_breakpoint [gdb_get_line_number "vary-filled"] -+gdb_continue_to_breakpoint "vary-filled" -+gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)" -+gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8" -+gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9" -+gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10" -+# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...) -+gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)" -+ -+gdb_breakpoint [gdb_get_line_number "varw-almostfilled"] -+gdb_continue_to_breakpoint "varw-almostfilled" -+gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)" -+gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1" -+# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...) -+gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled" -+# "up" works with GCC but other Fortran compilers may copy the values into the -+# outer function only on the exit of the inner function. -+# We need both variants as depending on the arch we optionally may still be -+# executing the caller line or not after `finish'. -+gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))" -+gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3" -+gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6" -+gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5" -+gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1" -+ -+gdb_breakpoint [gdb_get_line_number "varz-almostfilled"] -+gdb_continue_to_breakpoint "varz-almostfilled" -+# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not. -+gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" -+# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7) -+# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7. -+gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?" -+gdb_test "p varz" "\\$\[0-9\]* = \\(\\)" -+gdb_test "p vart" "\\$\[0-9\]* = \\(\\)" -+gdb_test "p varz(3)" "\\$\[0-9\]* = 4" -+# maps to foo::vary(1,1) -+gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8" -+# maps to foo::vary(2,2) -+gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9" -+# maps to foo::vary(1,3) -+gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10" -diff --git a/gdb/testsuite/gdb.fortran/dynamic.f90 b/gdb/testsuite/gdb.fortran/dynamic.f90 -new file mode 100644 -index 0000000..0f43564 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic.f90 -@@ -0,0 +1,98 @@ -+! 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. -+! -+! Ihis file is the Fortran source file for dynamic.exp. -+! Original file written by Jakub Jelinek . -+! Modified for the GDB testcase by Jan Kratochvil . -+ -+subroutine baz -+ real, target, allocatable :: varx (:, :, :) -+ real, pointer :: varv (:, :, :) -+ real, target :: varu (1, 2, 3) -+ logical :: l -+ allocate (varx (1:6, 5:15, 17:28)) ! varx-init -+ l = allocated (varx) -+ varx(:, :, :) = 6 ! varx-allocated -+ varx(1, 5, 17) = 7 -+ varx(2, 6, 18) = 8 -+ varx(6, 15, 28) = 9 -+ varv => varx ! varx-filled -+ l = associated (varv) -+ varv(3, 7, 19) = 10 ! varv-associated -+ varv => null () ! varv-filled -+ l = associated (varv) -+ deallocate (varx) ! varv-deassociated -+ l = allocated (varx) -+ varu(:, :, :) = 10 ! varx-deallocated -+ allocate (varv (1:6, 5:15, 17:28)) -+ l = associated (varv) -+ varv(:, :, :) = 6 -+ varv(1, 5, 17) = 7 -+ varv(2, 6, 18) = 8 -+ varv(6, 15, 28) = 9 -+ deallocate (varv) -+ l = associated (varv) -+ varv => varu -+ varv(1, 1, 1) = 6 -+ varv(1, 2, 3) = 7 -+ l = associated (varv) -+end subroutine baz -+subroutine foo (vary, varw) -+ real :: vary (:, :) -+ real :: varw (:, :, :) -+ vary(:, :) = 4 ! vary-passed -+ vary(1, 1) = 8 -+ vary(2, 2) = 9 -+ vary(1, 3) = 10 -+ varw(:, :, :) = 5 ! vary-filled -+ varw(1, 1, 1) = 6 -+ varw(2, 2, 2) = 7 ! varw-almostfilled -+end subroutine foo -+subroutine bar (varz, vart) -+ real :: varz (*) -+ real :: vart (2:11, 7:*) -+ varz(1:3) = 4 -+ varz(2) = 5 ! varz-almostfilled -+ vart(2,7) = vart(2,7) -+end subroutine bar -+program test -+ interface -+ subroutine foo (vary, varw) -+ real :: vary (:, :) -+ real :: varw (:, :, :) -+ end subroutine -+ end interface -+ interface -+ subroutine bar (varz, vart) -+ real :: varz (*) -+ real :: vart (2:11, 7:*) -+ end subroutine -+ end interface -+ real :: x (10, 10), y (5), z(8, 8, 8) -+ x(:,:) = 1 -+ y(:) = 2 -+ z(:,:,:) = 3 -+ call baz -+ call foo (x, z(2:6, 4:7, 6:8)) -+ call bar (y, x) -+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort -+ if (x (1, 3) .ne. 10) call abort -+ if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort -+ if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort -+ call foo (transpose (x), z) -+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort -+ if (x (3, 1) .ne. 10) call abort -+end -diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp -new file mode 100644 -index 0000000..39de2c4 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/string.exp -@@ -0,0 +1,59 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. It contains tests for Fortran -+# strings with dynamic length. -+ -+set testfile "string" -+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 "var-init"] -+gdb_continue_to_breakpoint "var-init" -+gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)" -+gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)" -+gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)" -+gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)" -+gdb_test "ptype *e" "Attempt to take contents of a non-pointer value." -+gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)" -+gdb_test "p c" "\\$\[0-9\]* = 'c'" -+gdb_test "p d" "\\$\[0-9\]* = 'd '" -+gdb_test "p e" "\\$\[0-9\]* = 'g '" -+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\)" -+gdb_test "p *e" "Attempt to take contents of a non-pointer value." -+gdb_test "p *f" "Attempt to take contents of a non-pointer value." -+ -+gdb_breakpoint [gdb_get_line_number "var-finish"] -+gdb_continue_to_breakpoint "var-finish" -+gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set" -+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set" -diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90 -new file mode 100644 -index 0000000..226dc5d ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/string.f90 -@@ -0,0 +1,37 @@ -+! 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 . -+! Modified for the GDB testcase by Jan Kratochvil . -+ -+subroutine foo (e, f) -+ character (len=1) :: c -+ character (len=8) :: d -+ character (len=*) :: e -+ character (len=*) :: f (1:7, 8:10) -+ c = 'c' -+ d = 'd' -+ e = 'e' ! var-init -+ f = 'f' -+ f(1,9) = 'f2' -+ c = 'c' ! var-finish -+end subroutine foo -+ character (len=4) :: g, h (1:7, 8:10) -+ g = 'g' -+ h = 'h' -+ call foo (g, h) -+end -diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp -new file mode 100644 -index 0000000..c819e23 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/subrange.exp -@@ -0,0 +1,60 @@ -+# Copyright 2011 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if { [skip_fortran_tests] } { return -1 } -+ -+set testfile "subrange" -+set srcfile ${testfile}.f90 -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } { -+ return -1 -+} -+ -+if ![runto MAIN__] { -+ perror "Couldn't run to MAIN__" -+ continue -+} -+ -+# Depending on the compiler version being used, the name of the 4-byte integer -+# and real types can be printed differently. For instance, gfortran-4.1 uses -+# "int4" whereas gfortran-4.3 uses "int(kind=4)". -+set int4 "(int4|integer\\(kind=4\\))" -+ -+gdb_breakpoint [gdb_get_line_number "break-static"] -+gdb_continue_to_breakpoint "break-static" ".*break-static.*" -+ -+foreach var {a alloc ptr} { -+ global pf_prefix -+ set old_prefix $pf_prefix -+ lappend pf_prefix "$var:" -+ -+ gdb_test "p $var (2, 2:3)" { = \(22, 32\)} -+ gdb_test "p $var (2:3, 3)" { = \(32, 33\)} -+ gdb_test "p $var (1, 2:)" { = \(21, 31\)} -+ gdb_test "p $var (2, :2)" { = \(12, 22\)} -+ gdb_test "p $var (3, 2:2)" { = \(23\)} -+ gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)" -+ gdb_test "p $var (4, :)" { = \(14, 24, 34\)} -+ gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)} -+ gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)" -+ gdb_test "p $var (:)" "Wrong number of subscripts" -+ gdb_test "p $var (:, :, :)" "Wrong number of subscripts" -+ -+ set pf_prefix $old_prefix -+} -+ -+gdb_test_no_output {set $a=a} -+delete_breakpoints -+gdb_unload -+gdb_test {p $a (3, 2:2)} { = \(23\)} -diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90 -new file mode 100644 -index 0000000..4747ea9 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/subrange.f90 -@@ -0,0 +1,28 @@ -+! Copyright 2011 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 3 of the License, or -+! (at your option) any later version. -+! -+! This program is distributed in the hope that it will be useful, -+! but WITHOUT ANY WARRANTY; without even the implied warranty of -+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+! GNU General Public License for more details. -+! -+! You should have received a copy of the GNU General Public License -+! along with this program. If not, see . -+ -+program test -+ integer, target :: a (4, 3) -+ integer, allocatable :: alloc (:, :) -+ integer, pointer :: ptr (:, :) -+ do 1 i = 1, 4 -+ do 1 j = 1, 3 -+ a (i, j) = j * 10 + i -+1 continue -+ allocate (alloc (4, 3)) -+ alloc = a -+ ptr => a -+ write (*,*) a ! break-static -+end -diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index 7645caf..f4f9c1f 100644 ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -92,6 +92,10 @@ proc do_steps_and_nexts {} { - set description "step over cmdarg_vec initialization" - set command "step" - } -+ -re ".*python_script = 0.*$gdb_prompt $" { -+ set description "step over python_script initialization" -+ set command "step" -+ } - -re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" { - set description "next over make_command_stats_cleanup and everything it calls" - set command "next" -diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.c b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c -new file mode 100644 -index 0000000..ebced3c ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c -@@ -0,0 +1,26 @@ -+/* Copyright 2011 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 . */ -+ -+int -+main (int argc, char **argv) -+{ -+ char vla[argc]; -+ -+ vla[0] = 0; /* break-here */ -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp -new file mode 100644 -index 0000000..74a104e ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp -@@ -0,0 +1,57 @@ -+# Copyright 2011 Free Software Foundation, Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+load_lib mi-support.exp -+set MIFLAGS "-i=mi2" -+ -+gdb_exit -+if [mi_gdb_start] { -+ continue -+} -+ -+set testfile "mi2-var-stale-type" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} { -+ return -1 -+} -+ -+mi_delete_breakpoints -+mi_gdb_reinitialize_dir $srcdir/$subdir -+mi_gdb_load ${binfile} -+ -+mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \ -+ {\^done} \ -+ "maintenance set internal-error quit yes" -+ -+mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \ -+ {\^done} \ -+ "maintenance set internal-error corefile yes" -+ -+set line [gdb_get_line_number "break-here"] -+set func "main" -+ -+mi_gdb_test "-break-insert -t $srcfile:$line" \ -+ "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",line=\"$line\",times=\"0\",original-location=\".*\"\}" \ -+ "breakpoint at $func" -+ -+if { [mi_run_cmd] < 0 } { -+ return -1 -+} -+mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla" -+ -+mi_create_varobj "vla" "vla" "create local variable vla" -+ -+mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *" -diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c -new file mode 100644 -index 0000000..729f457 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register-func.c -@@ -0,0 +1,22 @@ -+/* This file is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+int -+func (int *arr) -+{ -+ return arr[0]; -+} -diff --git a/gdb/testsuite/gdb.opt/array-from-register.c b/gdb/testsuite/gdb.opt/array-from-register.c -new file mode 100644 -index 0000000..3090e7e ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register.c -@@ -0,0 +1,28 @@ -+/* This file is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+extern int func (int *arr); -+ -+int -+main (void) -+{ -+ int arr[] = { 42 }; -+ -+ func (arr); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.opt/array-from-register.exp b/gdb/testsuite/gdb.opt/array-from-register.exp -new file mode 100644 -index 0000000..f2de718 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register.exp -@@ -0,0 +1,33 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+# -+# This file is part of the gdb testsuite. -+ -+if { [prepare_for_testing array-from-register.exp "array-from-register" \ -+ {array-from-register.c array-from-register-func.c} \ -+ {debug optimize=-O2}] } { -+ return -1 -+} -+ -+if ![runto func] then { -+ return -1 -+} -+ -+gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+" -+ -+# Seen regression: -+# Address requested for identifier "arr" which is in register $rdi -+gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42" -diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp -new file mode 100644 -index 0000000..ccc6e1e ---- /dev/null -+++ b/gdb/testsuite/gdb.pascal/arrays.exp -@@ -0,0 +1,104 @@ -+# Copyright 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 . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+load_lib "pascal.exp" -+ -+set testfile "arrays" -+set srcfile ${testfile}.pas -+set binfile ${objdir}/${subdir}/${testfile}$EXEEXT -+ -+# These tests only work with fpc, using the -gw3 compile-option -+pascal_init -+if { $pascal_compiler_is_fpc != 1 } { -+ return -1 -+} -+ -+# Detect if the fpc version is below 2.3.0 -+set fpc_generates_dwarf_for_dynamic_arrays 1 -+if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))} { -+ set fpc_generates_dwarf_for_dynamic_arrays 0 -+} -+ -+ -+if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] -+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] -+ -+ -+if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { -+ pass "setting breakpoint 1" -+} -+if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { -+ pass "setting breakpoint 2" -+} -+ -+# Verify that "start" lands inside the right procedure. -+if { [gdb_start_cmd] < 0 } { -+ untested start -+ return -1 -+} -+ -+gdb_test "" ".* at .*${srcfile}.*" "start" -+ -+gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint" -+ -+gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type" -+gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer" -+ -+gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint" -+ -+gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char" -+gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type" -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char" -+ -diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas -new file mode 100644 -index 0000000..295602d ---- /dev/null -+++ b/gdb/testsuite/gdb.pascal/arrays.pas -@@ -0,0 +1,82 @@ -+{ -+ Copyright 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 . -+} -+ -+program arrays; -+ -+{$mode objfpc}{$h+} -+ -+uses sysutils; -+ -+type TStatArrInt= array[0..11] of integer; -+ TDynArrInt= array of integer; -+ TStatArrStr= array[0..12] of string; -+ TDynArrStr= array of string; -+ TDynArrChar = array of char; -+ TStatArrChar = array [0..11] of char; -+ -+ TStat2dArrInt = array[0..11,0..4] of integer; -+ -+var StatArrInt: TStatArrInt; -+ StatArrInt_: Array[0..11] of integer; -+ DynArrInt: TDynArrInt; -+ DynArrInt_: Array of integer; -+ StatArrStr: TStatArrStr; -+ DynArrStr: TDynArrStr; -+ StatArrChar: TStatArrChar; -+ DynArrChar: TDynArrChar; -+ -+ Stat2dArrInt: TStat2dArrInt; -+ -+ s: string; -+ -+ i,j : integer; -+ -+begin -+ for i := 0 to 11 do -+ begin -+ StatArrInt[i]:= i+50; -+ StatArrInt_[i]:= i+50; -+ StatArrChar[i]:= chr(ord('a')+i); -+ for j := 0 to 4 do -+ Stat2dArrInt[i,j]:=i+j; -+ end; -+ writeln(StatArrInt_[0]); -+ writeln(StatArrInt[0]); { set breakpoint 1 here } -+ writeln(StatArrChar[0]); -+ writeln(Stat2dArrInt[0,0]); -+ -+ setlength(DynArrInt,13); -+ setlength(DynArrInt_,13); -+ setlength(DynArrStr,13); -+ setlength(DynArrChar,13); -+ for i := 0 to 12 do -+ begin -+ DynArrInt[i]:= i+50; -+ DynArrInt_[i]:= i+50; -+ DynArrChar[i]:= chr(ord('a')+i); -+ StatArrStr[i]:='str'+inttostr(i); -+ DynArrStr[i]:='dstr'+inttostr(i); -+ end; -+ writeln(DynArrInt_[1]); -+ writeln(DynArrInt[1]); -+ writeln(DynArrStr[1]); -+ writeln(StatArrStr[1]); -+ writeln(DynArrChar[1]); -+ -+ s := 'test'#0'string'; -+ writeln(s); { set breakpoint 2 here } -+end. -diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp -index 993e774..52dbd17 100644 ---- a/gdb/testsuite/gdb.python/py-frame.exp -+++ b/gdb/testsuite/gdb.python/py-frame.exp -@@ -74,8 +74,6 @@ gdb_test "python print bframe == gdb.newest_frame()" True \ - - gdb_test "python print 'result =', f0 == f1" " = False" "test equality comparison (false)" - gdb_test "python print 'result =', f0 == f0" " = True" "test equality comparison (true)" --gdb_test "python print 'result =', f0 != f1" " = True" "test inequality comparison (true)" --gdb_test "python print 'result =', f0 != f0" " = False" "test inequality comparison (false)" - gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_valid" - gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name" - gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type" -@@ -90,3 +88,5 @@ gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_ex - gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success" - - gdb_test "python print 'result =', gdb.selected_frame () == f1" " = True" "test gdb.selected_frame" -+ -+gdb_test "python print 'result =', f0.block ()" "" "test Frame.block" -diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp -index acfd89b..c77d9c2 100644 ---- a/gdb/testsuite/gdb.python/py-value.exp -+++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -358,6 +358,15 @@ proc test_value_after_death {} { - "print value's type" - } - -+# Regression test for a cast failure. The bug was that if we cast a -+# value to its own type, gdb could crash. This happened because we -+# could end up double-freeing a struct value. -+proc test_cast_regression {} { -+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test" -+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test" -+ gdb_test "python print v" "5" "print value for cast test" -+} -+ - # Regression test for invalid subscript operations. The bug was that - # the type of the value was not being checked before allowing a - # subscript operation to proceed. -@@ -494,6 +503,7 @@ test_value_in_inferior - test_inferior_function_call - test_lazy_strings - test_value_after_death -+test_cast_regression - - # Test either C or C++ values. - test_subscript_regression "${binfile}" "c" -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 4f2b7c9..0daef25 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -142,6 +142,11 @@ proc gdb_unload {} { - send_gdb "y\n" - exp_continue - } -+ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\ -+ { send_gdb "y\n" -+ verbose "\t\tUnloading symbols for program being debugged" -+ exp_continue -+ } - -re "Discard symbol table from .*y or n.*$" { - send_gdb "y\n" - exp_continue -diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp -index dd18d37..f973485 100644 ---- a/gdb/testsuite/lib/pascal.exp -+++ b/gdb/testsuite/lib/pascal.exp -@@ -37,6 +37,9 @@ proc pascal_init {} { - global pascal_compiler_is_fpc - global gpc_compiler - global fpc_compiler -+ global fpcversion_major -+ global fpcversion_minor -+ global fpcversion_release - global env - - if { $pascal_init_done == 1 } { -@@ -64,6 +67,20 @@ proc pascal_init {} { - set pascal_compiler_is_fpc 1 - verbose -log "Free Pascal compiler found" - } -+ -+ # Detect the fpc-version -+ if { $pascal_compiler_is_fpc == 1 } { -+ set fpcversion_major 1 -+ set fpcversion_minor 0 -+ set fpcversion_release 0 -+ set fpcversion [ remote_exec host $fpc_compiler "-iV" ] -+ if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] { -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release -+ } -+ verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release" -+ } - } - set pascal_init_done 1 - } -diff --git a/gdb/top.c b/gdb/top.c -index 061ad48..d615cfc 100644 ---- a/gdb/top.c -+++ b/gdb/top.c -@@ -352,6 +352,9 @@ prepare_execute_command (void) - - mark = value_mark (); - cleanup = make_cleanup_value_free_to_mark (mark); -+#if 0 -+ free_all_types (); -+#endif - - /* With multiple threads running while the one we're examining is - stopped, the dcache can get stale without us being able to detect -diff --git a/gdb/typeprint.c b/gdb/typeprint.c -index c25e705..498958a 100644 ---- a/gdb/typeprint.c -+++ b/gdb/typeprint.c -@@ -35,6 +35,7 @@ - #include "gdb_string.h" - #include "exceptions.h" - #include "valprint.h" -+#include "dwarf2loc.h" - #include - - extern void _initialize_typeprint (void); -@@ -76,6 +77,9 @@ void - type_print (struct type *type, const char *varstring, struct ui_file *stream, - int show) - { -+ if (show >= 0 && current_language->la_language != language_ada) -+ type = check_typedef (type); -+ - LA_PRINT_TYPE (type, varstring, stream, show, 0); - } - -@@ -114,7 +118,8 @@ whatis_exp (char *exp, int show) - { - struct expression *expr; - struct value *val; -- struct cleanup *old_chain = NULL; -+ /* Required at least for the object_address_set call. */ -+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); - struct type *real_type = NULL; - struct type *type; - int full = 0; -@@ -125,12 +130,13 @@ whatis_exp (char *exp, int show) - if (exp) - { - expr = parse_expression (exp); -- old_chain = make_cleanup (free_current_contents, &expr); -+ make_cleanup (free_current_contents, &expr); - val = evaluate_type (expr); - } - else - val = access_value_history (0); - -+ object_address_set (value_raw_address (val)); - type = value_type (val); - - get_user_print_options (&opts); -@@ -158,8 +164,7 @@ whatis_exp (char *exp, int show) - type_print (type, "", gdb_stdout, show); - printf_filtered ("\n"); - -- if (exp) -- do_cleanups (old_chain); -+ do_cleanups (old_chain); - } - - static void -diff --git a/gdb/utils.c b/gdb/utils.c -index 5566149..6e1aa34 100644 ---- a/gdb/utils.c -+++ b/gdb/utils.c -@@ -27,6 +27,7 @@ - #include "exceptions.h" - #include "gdbthread.h" - #include "fnmatch.h" -+#include "gdb_bfd.h" - #ifdef HAVE_SYS_RESOURCE_H - #include - #endif /* HAVE_SYS_RESOURCE_H */ -@@ -198,11 +199,11 @@ make_cleanup_dyn_string_delete (dyn_string_t arg) - static void - do_bfd_close_cleanup (void *arg) - { -- bfd_close (arg); -+ gdb_bfd_unref (arg); - } - - struct cleanup * --make_cleanup_bfd_close (bfd *abfd) -+make_cleanup_bfd_unref (bfd *abfd) - { - return make_cleanup (do_bfd_close_cleanup, abfd); - } -@@ -1738,6 +1739,36 @@ set_batch_flag_and_make_cleanup_restore_page_info (void) - return back_to; - } - -+/* Helper for make_cleanup_restore_page_info. */ -+ -+static void -+do_restore_selected_frame_cleanup (void *arg) -+{ -+ struct frame_id *frame_idp = arg; -+ -+ select_frame (frame_find_by_id (*frame_idp)); -+ -+ xfree (frame_idp); -+} -+ -+/* Provide cleanup for restoring currently selected frame. Use frame_id for -+ the case the current frame becomes stale in the meantime. */ -+ -+struct cleanup * -+make_cleanup_restore_selected_frame (void) -+{ -+ struct frame_id *frame_idp; -+ -+ /* get_selected_frame->get_current_frame would error otherwise. */ -+ if (!has_stack_frames ()) -+ return make_cleanup (null_cleanup, NULL); -+ -+ frame_idp = xmalloc (sizeof (*frame_idp)); -+ *frame_idp = get_frame_id (get_selected_frame (NULL)); -+ -+ return make_cleanup (do_restore_selected_frame_cleanup, frame_idp); -+} -+ - /* Set the screen size based on LINES_PER_PAGE and CHARS_PER_LINE. */ - - static void -diff --git a/gdb/valarith.c b/gdb/valarith.c -index 96d5411..37bd464 100644 ---- a/gdb/valarith.c -+++ b/gdb/valarith.c -@@ -197,7 +197,10 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) - struct type *array_type = check_typedef (value_type (array)); - struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); - unsigned int elt_size = TYPE_LENGTH (elt_type); -- unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound); -+ unsigned int elt_stride -+ = (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type)) == 0 -+ ? elt_size : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type))); -+ unsigned int elt_offs = elt_stride * longest_to_int (index - lowerbound); - struct value *v; - - if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) -@@ -297,6 +300,10 @@ int - binop_user_defined_p (enum exp_opcode op, - struct value *arg1, struct value *arg2) - { -+ /* FIXME: We should support user defined ops for dynamic types. */ -+ if (TYPE_DYNAMIC (value_type (arg1)) || TYPE_DYNAMIC (value_type (arg2))) -+ return 0; -+ - return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2)); - } - -diff --git a/gdb/valops.c b/gdb/valops.c -index 97d889b..6ae77b8 100644 ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -45,6 +45,7 @@ - #include "objfiles.h" - #include "symtab.h" - #include "exceptions.h" -+#include "dwarf2loc.h" - - extern int overload_debug; - /* Local functions. */ -@@ -919,6 +920,65 @@ value_one (struct type *type) - return val; - } - -+/* object_address_set must be already called before this function. */ -+ -+const char * -+object_address_data_not_valid (struct type *type) -+{ -+ /* Attributes are present only at the target type of a typedef. Make the -+ call conditional as it would otherwise loop through type_length_get. */ -+ if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) -+ CHECK_TYPEDEF (type); -+ -+ /* DW_AT_associated has a preference over DW_AT_allocated. */ -+ if (TYPE_NOT_ASSOCIATED (type) -+ || (TYPE_ASSOCIATED (type) != NULL -+ && 0 == dwarf_locexpr_baton_eval (TYPE_ASSOCIATED (type)))) -+ return N_("object is not associated"); -+ -+ if (TYPE_NOT_ALLOCATED (type) -+ || (TYPE_ALLOCATED (type) != NULL -+ && 0 == dwarf_locexpr_baton_eval (TYPE_ALLOCATED (type)))) -+ return N_("object is not allocated"); -+ -+ return NULL; -+} -+ -+/* Return non-NULL check_typedef result on TYPE if the variable is valid. If -+ it is valid the function may store the data address (DW_AT_DATA_LOCATION) of -+ TYPE at *ADDRESS_RETURN. You must set *ADDRESS_RETURN from -+ value_raw_address (VAL) before calling this function. If no -+ DW_AT_DATA_LOCATION is present for TYPE the address at *ADDRESS_RETURN is -+ left unchanged. ADDRESS_RETURN must not be NULL, use -+ object_address_data_not_valid () for just the data validity check. */ -+ -+struct type * -+object_address_get_data (struct type *type, CORE_ADDR *address_return) -+{ -+ gdb_assert (address_return != NULL); -+ -+ object_address_set (*address_return); -+ -+ /* TYPE_DATA_LOCATION_DWARF_BLOCK / TYPE_DATA_LOCATION_ADDR are present only -+ at the target type of a typedef. */ -+ CHECK_TYPEDEF (type); -+ -+ if (object_address_data_not_valid (type) != NULL) -+ { -+ /* Do not try to evaluate DW_AT_data_location as it may even crash -+ (it would just return the value zero in the gfortran case). */ -+ return NULL; -+ } -+ -+ if (TYPE_DATA_LOCATION_IS_ADDR (type)) -+ *address_return = TYPE_DATA_LOCATION_ADDR (type); -+ else if (TYPE_DATA_LOCATION_DWARF_BLOCK (type) != NULL) -+ *address_return -+ = dwarf_locexpr_baton_eval (TYPE_DATA_LOCATION_DWARF_BLOCK (type)); -+ -+ return type; -+} -+ - /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */ - - static struct value * -@@ -981,7 +1041,8 @@ int - value_fetch_lazy (struct value *val) - { - gdb_assert (value_lazy (val)); -- allocate_value_contents (val); -+ if (VALUE_LVAL (val) != lval_memory) -+ allocate_value_contents (val); - if (value_bitsize (val)) - { - /* To read a lazy bitfield, read the entire enclosing value. This -@@ -1015,12 +1076,24 @@ value_fetch_lazy (struct value *val) - } - else if (VALUE_LVAL (val) == lval_memory) - { -- CORE_ADDR addr = value_address (val); -- int length = TYPE_LENGTH (check_typedef (value_enclosing_type (val))); -+ CORE_ADDR addr = value_raw_address (val); - -- if (length) -- read_value_memory (val, 0, value_stack (val), -- addr, value_contents_all_raw (val), length); -+ if (object_address_get_data (value_type (val), &addr)) -+ { -+ struct type *type = value_enclosing_type (val); -+ int length = TYPE_LENGTH (check_typedef (type)); -+ -+ if (length) -+ { -+ /* Delay it after object_address_get_data above. */ -+ allocate_value_contents (val); -+ addr += value_offset (val); -+ read_value_memory (val, 0, value_stack (val), -+ addr, value_contents_all_raw (val), length); -+ } -+ } -+ /* Just to be sure it has been called. */ -+ allocate_value_contents (val); - } - else if (VALUE_LVAL (val) == lval_register) - { -@@ -1530,7 +1603,18 @@ address_of_variable (struct symbol *var, struct block *b) - if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) - || TYPE_CODE (type) == TYPE_CODE_FUNC) - { -- CORE_ADDR addr = value_address (val); -+ CORE_ADDR addr; -+ -+ if (VALUE_LVAL (val) == lval_memory) -+ { -+ addr = value_raw_address (val); -+ if (!object_address_get_data (type, &addr)) -+ error (_("Can't take address of memory lvalue \"%s\"."), -+ SYMBOL_PRINT_NAME (var)); -+ set_value_address (val, addr); -+ } -+ -+ addr = value_address (val); - - return value_from_pointer (lookup_pointer_type (type), addr); - } -@@ -1637,6 +1721,7 @@ struct value * - value_coerce_array (struct value *arg1) - { - struct type *type = check_typedef (value_type (arg1)); -+ CORE_ADDR address; - - /* If the user tries to do something requiring a pointer with an - array that has not yet been pushed to the target, then this would -@@ -1646,8 +1731,12 @@ value_coerce_array (struct value *arg1) - if (VALUE_LVAL (arg1) != lval_memory) - error (_("Attempt to take address of value not located in memory.")); - -+ address = value_raw_address (arg1); -+ if (!object_address_get_data (type, &address)) -+ error (_("Attempt to take address of non-valid value.")); -+ - return value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), -- value_address (arg1)); -+ address + value_offset (arg1)); - } - - /* Given a value which is a function, return a value which is a pointer -@@ -3769,6 +3858,8 @@ value_slice (struct value *array, int lowbound, int length) - TYPE_TARGET_TYPE (range_type), - lowbound, - lowbound + length - 1); -+ TYPE_BYTE_STRIDE (slice_range_type) = TYPE_BYTE_STRIDE (range_type); -+ - if (TYPE_CODE (array_type) == TYPE_CODE_BITSTRING) - { - int i; -diff --git a/gdb/valprint.c b/gdb/valprint.c -index fc5942d..8333eb4 100644 ---- a/gdb/valprint.c -+++ b/gdb/valprint.c -@@ -37,6 +37,7 @@ - #include "gdb_obstack.h" - #include "charset.h" - #include -+#include "dwarf2loc.h" - - #include - -@@ -251,7 +252,6 @@ scalar_type_p (struct type *type) - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_SET: -- case TYPE_CODE_STRING: - case TYPE_CODE_BITSTRING: - return 0; - default: -@@ -1570,6 +1570,7 @@ val_print_array_elements (struct type *type, - { - unsigned int things_printed = 0; - unsigned len; -+ struct type *saved_type = type; - struct type *elttype, *index_type; - unsigned eltlen; - /* Position of the array element we are examining to see -@@ -1578,9 +1579,33 @@ val_print_array_elements (struct type *type, - /* Number of repetitions we have detected so far. */ - unsigned int reps; - LONGEST low_bound, high_bound; -+ struct cleanup *back_to; -+ CORE_ADDR saved_address = address; -+ -+ back_to = make_cleanup (null_cleanup, 0); -+ type = object_address_get_data (type, &address); -+ if (!type) -+ { -+ fputs_filtered (object_address_data_not_valid (type), stream); -+ do_cleanups (back_to); -+ return; -+ } -+ if (address != saved_address) -+ { -+ size_t length = TYPE_LENGTH (type); - -- elttype = TYPE_TARGET_TYPE (type); -- eltlen = TYPE_LENGTH (check_typedef (elttype)); -+ valaddr = xmalloc (length); -+ make_cleanup (xfree, (gdb_byte *) valaddr); -+ read_memory (address, (gdb_byte *) valaddr, length); -+ } -+ -+ /* Skip typedefs but do not resolve TYPE_DYNAMIC. */ -+ elttype = saved_type; -+ while (TYPE_CODE (elttype) == TYPE_CODE_TYPEDEF) -+ elttype = TYPE_TARGET_TYPE (elttype); -+ elttype = TYPE_TARGET_TYPE (elttype); -+ -+ eltlen = TYPE_ARRAY_BYTE_STRIDE_VALUE (type); - index_type = TYPE_INDEX_TYPE (type); - - if (get_array_bounds (type, &low_bound, &high_bound)) -@@ -1667,6 +1692,8 @@ val_print_array_elements (struct type *type, - { - fprintf_filtered (stream, "..."); - } -+ -+ do_cleanups (back_to); - } - - /* Read LEN bytes of target memory at address MEMADDR, placing the -diff --git a/gdb/value.c b/gdb/value.c -index a6bb718..7b08d1f 100644 ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -42,6 +42,7 @@ - #include - #include "tracepoint.h" - #include "cp-abi.h" -+#include "observer.h" - - /* Prototypes for exported functions. */ - -@@ -1437,12 +1438,15 @@ void - set_value_component_location (struct value *component, - const struct value *whole) - { -+ CORE_ADDR addr; -+ - if (whole->lval == lval_internalvar) - VALUE_LVAL (component) = lval_internalvar_component; - else - VALUE_LVAL (component) = whole->lval; - - component->location = whole->location; -+ - if (whole->lval == lval_computed) - { - const struct lval_funcs *funcs = whole->location.computed.funcs; -@@ -1450,6 +1454,12 @@ set_value_component_location (struct value *component, - if (funcs->copy_closure) - component->location.computed.closure = funcs->copy_closure (whole); - } -+ -+ addr = value_raw_address (component); -+ object_address_get_data (value_type (whole), &addr); -+ if (component->lval != lval_internalvar -+ && component->lval != lval_internalvar_component) -+ set_value_address (component, addr); - } - - -@@ -1583,6 +1593,31 @@ show_values (char *num_exp, int from_tty) - num_exp[1] = '\0'; - } - } -+ -+/* Sanity check for memory leaks and proper types reference counting. */ -+ -+static void -+value_history_cleanup (void *unused) -+{ -+ while (value_history_chain) -+ { -+ struct value_history_chunk *chunk = value_history_chain; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE (chunk->values); i++) -+ value_free (chunk->values[i]); -+ -+ value_history_chain = chunk->next; -+ xfree (chunk); -+ } -+ value_history_count = 0; -+ -+ /* Free the unreferenced types above. */ -+ free_all_values (); -+#if 0 -+ free_all_types (); -+#endif -+} - - /* Internal variables. These are variables within the debugger - that hold values assigned by debugger commands. -@@ -2118,6 +2153,38 @@ call_internal_function (struct gdbarch *gdbarch, - return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+value_types_mark_used (void) -+{ -+ struct internalvar *var; -+ struct value_history_chunk *chunk; -+ -+ for (var = internalvars; var != NULL; var = var->next) -+ switch (var->kind) -+ { -+ case INTERNALVAR_VALUE: -+ type_mark_used (value_type (var->u.value)); -+ break; -+ -+ case INTERNALVAR_INTEGER: -+ type_mark_used (var->u.integer.type); -+ break; -+ } -+ -+ for (chunk = value_history_chain; chunk != NULL; chunk = chunk->next) -+ { -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE (chunk->values); i++) -+ if (chunk->values[i]) -+ type_mark_used (value_type (chunk->values[i])); -+ } -+} -+#endif -+ - /* The 'function' command. This does nothing -- it is just a - placeholder to let "help function NAME" work. This is also used as - the implementation of the sub-command that is created when -@@ -2165,11 +2232,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, - htab_t copied_types) - { - if (TYPE_OBJFILE (value->type) == objfile) -- value->type = copy_type_recursive (objfile, value->type, copied_types); -+ value->type = copy_type_recursive (value->type, copied_types); - - if (TYPE_OBJFILE (value->enclosing_type) == objfile) -- value->enclosing_type = copy_type_recursive (objfile, -- value->enclosing_type, -+ value->enclosing_type = copy_type_recursive (value->enclosing_type, - copied_types); - } - -@@ -2184,7 +2250,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, - case INTERNALVAR_INTEGER: - if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile) - var->u.integer.type -- = copy_type_recursive (objfile, var->u.integer.type, copied_types); -+ = copy_type_recursive (var->u.integer.type, copied_types); - break; - - case INTERNALVAR_VALUE: -@@ -3276,10 +3342,27 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type, - struct value * - coerce_ref (struct value *arg) - { -- struct type *value_type_arg_tmp = check_typedef (value_type (arg)); -+ struct type *value_type_arg_tmp; - struct value *retval; - struct type *enc_type; - -+ if (TYPE_DYNAMIC (value_type (arg))) -+ { -+ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); -+ CORE_ADDR address; -+ -+ value_type_arg_tmp = value_type (arg); -+ address = value_raw_address (arg); -+ value_type_arg_tmp = object_address_get_data (value_type_arg_tmp, -+ &address); -+ if (! value_type_arg_tmp) -+ error (_("Attempt to coerce non-valid value.")); -+ arg = value_at_lazy (value_type_arg_tmp, address); -+ do_cleanups (cleanups); -+ } -+ else -+ value_type_arg_tmp = check_typedef (value_type (arg)); -+ - retval = coerce_ref_if_computed (arg); - if (retval) - return retval; -@@ -3386,4 +3469,10 @@ VARIABLE is already initialized.")); - add_prefix_cmd ("function", no_class, function_command, _("\ - Placeholder command for showing help on convenience functions."), - &functionlist, "function ", 0, &cmdlist); -+ -+ make_final_cleanup (value_history_cleanup, NULL); -+ -+#if 0 -+ observer_attach_mark_used (value_types_mark_used); -+#endif - } -diff --git a/gdb/value.h b/gdb/value.h -index d8b157f..f49e827 100644 ---- a/gdb/value.h -+++ b/gdb/value.h -@@ -533,6 +533,10 @@ extern struct value *value_from_decfloat (struct type *type, - const gdb_byte *decbytes); - extern struct value *value_from_history_ref (char *, char **); - -+extern const char *object_address_data_not_valid (struct type *type); -+extern struct type *object_address_get_data (struct type *type, -+ CORE_ADDR *address_return); -+ - extern struct value *value_at (struct type *type, CORE_ADDR addr); - extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); - -diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c -index f16588a..afef615 100644 ---- a/gdb/windows-nat.c -+++ b/gdb/windows-nat.c -@@ -752,7 +752,7 @@ windows_make_so (const char *name, LPVOID load_addr) - asection *text = NULL; - CORE_ADDR text_vma; - -- abfd = bfd_openr (so->so_name, "pei-i386"); -+ abfd = gdb_bfd_openr (so->so_name, "pei-i386"); - - if (!abfd) - return so; -@@ -762,7 +762,7 @@ windows_make_so (const char *name, LPVOID load_addr) - - if (!text) - { -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - return so; - } - -@@ -773,7 +773,7 @@ windows_make_so (const char *name, LPVOID load_addr) - load_addr + 0x1000); - cygwin_load_end = cygwin_load_start + bfd_section_size (abfd, text); - -- bfd_close (abfd); -+ gdb_bfd_unref (abfd); - } - #endif - diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch deleted file mode 100644 index 71711f0..0000000 --- a/gdb-attach-fail-reasons-5of5.patch +++ /dev/null @@ -1,244 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html -Subject: [patch 3/3] attach-fail-reasons: SELinux deny_ptrace - -Hi, - -and here is the last bit for new SELinux 'deny_ptrace': - https://bugzilla.redhat.com/show_bug.cgi?id=786878 - -As even PTRACE_TRACEME fails in such case it needs to install hook for even -that event. - - -Thanks, -Jan - - -gdb/ -2012-03-06 Jan Kratochvil - - * common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include - selinux/selinux.h. - (linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings. - (linux_ptrace_create_warnings): New. - * common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration. - * config.in: Regenerate. - * configure: Regenerate. - * configure.ac: Check selinux/selinux.h and the selinux library. - * inf-ptrace.c (inf_ptrace_me): Check the ptrace result. - * linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap - to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings. - -gdb/gdbserver/ - * config.in: Regenerate. - * configure: Regenerate. - * configure.ac: Check selinux/selinux.h and the selinux library. - * linux-low.c (linux_traceme): New function. - (linux_create_inferior, linux_tracefork_child): Call it instead of - direct ptrace. - -Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.c 2012-09-17 20:28:14.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.c 2012-09-26 19:13:53.508780239 +0200 -@@ -28,6 +28,10 @@ - #include "buffer.h" - #include "gdb_assert.h" - -+#ifdef HAVE_SELINUX_SELINUX_H -+# include -+#endif /* HAVE_SELINUX_SELINUX_H */ -+ - /* Find all possible reasons we could fail to attach PID and append these - newline terminated reason strings to initialized BUFFER. '\0' termination - of BUFFER must be done by the caller. */ -@@ -47,6 +51,8 @@ linux_ptrace_attach_warnings (pid_t pid, - buffer_xml_printf (buffer, _("warning: process %d is a zombie " - "- the process has already terminated\n"), - (int) pid); -+ -+ linux_ptrace_create_warnings (buffer); - } - - #if defined __i386__ || defined __x86_64__ -@@ -242,3 +248,19 @@ linux_ptrace_init_warnings (void) - - linux_ptrace_test_ret_to_nx (); - } -+ -+/* Print all possible reasons we could fail to create a traced process. */ -+ -+void -+linux_ptrace_create_warnings (struct buffer *buffer) -+{ -+#ifdef HAVE_LIBSELINUX -+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is -+ forbidden. */ -+ if (security_get_boolean_active ("deny_ptrace") == 1) -+ buffer_xml_printf (buffer, -+ _("the SELinux boolean 'deny_ptrace' is enabled, " -+ "you can disable this process attach protection by: " -+ "(gdb) shell sudo setsebool deny_ptrace=0")); -+#endif /* HAVE_LIBSELINUX */ -+} -Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.h -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.h 2012-07-07 14:13:56.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.h 2012-09-26 19:13:28.358765406 +0200 -@@ -69,5 +69,6 @@ struct buffer; - - extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer); - extern void linux_ptrace_init_warnings (void); -+extern void linux_ptrace_create_warnings (struct buffer *buffer); - - #endif /* COMMON_LINUX_PTRACE_H */ -Index: gdb-7.5.0.20120926/gdb/configure.ac -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/configure.ac 2012-09-26 19:13:24.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/configure.ac 2012-09-26 19:13:28.410765451 +0200 -@@ -2008,6 +2008,10 @@ then - [Define if you support the personality syscall.]) - fi - -+dnl Check security_get_boolean_active availability. -+AC_CHECK_HEADERS(selinux/selinux.h) -+AC_CHECK_LIB(selinux, security_get_boolean_active) -+ - dnl Handle optional features that can be enabled. - - # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, -Index: gdb-7.5.0.20120926/gdb/gdbserver/configure.ac -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/gdbserver/configure.ac 2012-04-19 21:34:51.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/gdbserver/configure.ac 2012-09-26 19:13:28.446765428 +0200 -@@ -438,6 +438,10 @@ if $want_ipa ; then - fi - fi - -+dnl Check security_get_boolean_active availability. -+AC_CHECK_HEADERS(selinux/selinux.h) -+AC_CHECK_LIB(selinux, security_get_boolean_active) -+ - AC_SUBST(GDBSERVER_DEPFILES) - AC_SUBST(GDBSERVER_LIBS) - AC_SUBST(USE_THREAD_DB) -Index: gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/gdbserver/linux-low.c 2012-07-07 14:13:57.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c 2012-09-26 19:13:28.453765471 +0200 -@@ -601,6 +601,28 @@ add_lwp (ptid_t ptid) - return lwp; - } - -+/* Execute PTRACE_TRACEME with error checking. */ -+ -+static void -+linux_traceme (const char *program) -+{ -+ int save_errno; -+ struct buffer buffer; -+ -+ errno = 0; -+ if (ptrace (PTRACE_TRACEME, 0, NULL, NULL) == 0) -+ return; -+ -+ save_errno = errno; -+ buffer_init (&buffer); -+ linux_ptrace_create_warnings (&buffer); -+ buffer_grow_str0 (&buffer, ""); -+ fprintf (stderr, _("%sCannot trace created process %s: %s.\n"), -+ buffer_finish (&buffer), program, strerror (save_errno)); -+ fflush (stderr); -+ _exit (0177); -+} -+ - /* Start an inferior process and returns its pid. - ALLARGS is a vector of program-name and args. */ - -@@ -641,7 +663,7 @@ linux_create_inferior (char *program, ch - - if (pid == 0) - { -- ptrace (PTRACE_TRACEME, 0, 0, 0); -+ linux_traceme (program); - - #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */ - signal (__SIGRTMIN + 1, SIG_DFL); -@@ -4572,7 +4594,7 @@ linux_tracefork_grandchild (void *arg) - static int - linux_tracefork_child (void *arg) - { -- ptrace (PTRACE_TRACEME, 0, 0, 0); -+ linux_traceme ("PTRACE_O_TRACEFORK test"); - kill (getpid (), SIGSTOP); - - #if !(defined(__UCLIBC__) && defined(HAS_NOMMU)) -Index: gdb-7.5.0.20120926/gdb/inf-ptrace.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/inf-ptrace.c 2012-05-24 18:51:34.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/inf-ptrace.c 2012-09-26 19:13:28.458765461 +0200 -@@ -105,7 +105,15 @@ static void - inf_ptrace_me (void) - { - /* "Trace me, Dr. Memory!" */ -+ errno = 0; - ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0); -+ if (errno != 0) -+ { -+ fprintf_unfiltered (gdb_stderr, _("Cannot create process: %s\n"), -+ safe_strerror (errno)); -+ gdb_flush (gdb_stderr); -+ _exit (0177); -+ } - } - - /* Start a new inferior Unix child process. EXEC_FILE is the file to -Index: gdb-7.5.0.20120926/gdb/linux-nat.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/linux-nat.c 2012-09-26 19:13:22.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/linux-nat.c 2012-09-26 19:13:28.468765469 +0200 -@@ -1574,6 +1574,7 @@ linux_nat_create_inferior (struct target - #ifdef HAVE_PERSONALITY - int personality_orig = 0, personality_set = 0; - #endif /* HAVE_PERSONALITY */ -+ volatile struct gdb_exception ex; - - /* The fork_child mechanism is synchronous and calls target_wait, so - we have to mask the async mode. */ -@@ -1598,7 +1599,10 @@ linux_nat_create_inferior (struct target - /* Make sure we report all signals during startup. */ - linux_nat_pass_signals (0, NULL); - -- linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty); -+ TRY_CATCH (ex, RETURN_MASK_ERROR) -+ { -+ linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty); -+ } - - #ifdef HAVE_PERSONALITY - if (personality_set) -@@ -1610,6 +1614,24 @@ linux_nat_create_inferior (struct target - safe_strerror (errno)); - } - #endif /* HAVE_PERSONALITY */ -+ -+ if (ex.reason < 0) -+ { -+ struct buffer buffer; -+ char *message, *buffer_s; -+ -+ message = xstrdup (ex.message); -+ make_cleanup (xfree, message); -+ -+ buffer_init (&buffer); -+ linux_ptrace_create_warnings (&buffer); -+ -+ buffer_grow_str0 (&buffer, ""); -+ buffer_s = buffer_finish (&buffer); -+ make_cleanup (xfree, buffer_s); -+ -+ throw_error (ex.error, "%s%s", buffer_s, message); -+ } - } - - static void diff --git a/gdb-attach-fail-reasons-5of5configure.patch b/gdb-attach-fail-reasons-5of5configure.patch deleted file mode 100644 index 6098645..0000000 --- a/gdb-attach-fail-reasons-5of5configure.patch +++ /dev/null @@ -1,186 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/config.in -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/config.in 2012-06-02 21:49:26.147399232 +0200 -+++ gdb-7.4.50.20120602/gdb/config.in 2012-06-02 21:49:27.206398845 +0200 -@@ -222,6 +222,9 @@ - /* Define if librpm library is being used. */ - #undef HAVE_LIBRPM - -+/* Define to 1 if you have the `selinux' library (-lselinux). */ -+#undef HAVE_LIBSELINUX -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_LIBUNWIND_IA64_H - -@@ -363,6 +366,9 @@ - /* Define to 1 if you have the `sbrk' function. */ - #undef HAVE_SBRK - -+/* Define to 1 if you have the header file. */ -+#undef HAVE_SELINUX_SELINUX_H -+ - /* Define to 1 if you have the `setlocale' function. */ - #undef HAVE_SETLOCALE - -Index: gdb-7.4.50.20120602/gdb/configure -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/configure 2012-06-02 21:49:27.139398869 +0200 -+++ gdb-7.4.50.20120602/gdb/configure 2012-06-02 21:49:50.890390179 +0200 -@@ -12745,6 +12745,64 @@ $as_echo "#define HAVE_PERSONALITY 1" >> - - fi - -+for ac_header in selinux/selinux.h -+do : -+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" -+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_SELINUX_SELINUX_H 1 -+_ACEOF -+ -+fi -+ -+done -+ -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5 -+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; } -+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lselinux $LIBS" -+cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+/* Override any GCC internal prototype to avoid an error. -+ Use char because int might match the return type of a GCC -+ builtin and then its argument prototype would still apply. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+char security_get_boolean_active (); -+int -+main () -+{ -+return security_get_boolean_active (); -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ ac_cv_lib_selinux_security_get_boolean_active=yes -+else -+ ac_cv_lib_selinux_security_get_boolean_active=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5 -+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; } -+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_LIBSELINUX 1 -+_ACEOF -+ -+ LIBS="-lselinux $LIBS" -+ -+fi -+ -+ - - # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, - # except that the argument to --with-sysroot is optional. -Index: gdb-7.4.50.20120602/gdb/gdbserver/config.in -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/gdbserver/config.in 2012-04-19 21:34:51.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/gdbserver/config.in 2012-06-02 21:49:55.945388329 +0200 -@@ -69,6 +69,9 @@ - /* Define to 1 if you have the `dl' library (-ldl). */ - #undef HAVE_LIBDL - -+/* Define to 1 if you have the `selinux' library (-lselinux). */ -+#undef HAVE_LIBSELINUX -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_LINUX_ELF_H - -@@ -130,6 +133,9 @@ - /* Define to 1 if you have the `readlink' function. */ - #undef HAVE_READLINK - -+/* Define to 1 if you have the header file. */ -+#undef HAVE_SELINUX_SELINUX_H -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_SGTTY_H - -Index: gdb-7.4.50.20120602/gdb/gdbserver/configure -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure 2012-04-20 19:58:49.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/gdbserver/configure 2012-06-02 21:49:54.485388864 +0200 -@@ -5532,6 +5532,64 @@ if $want_ipa ; then - fi - fi - -+for ac_header in selinux/selinux.h -+do : -+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" -+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_SELINUX_SELINUX_H 1 -+_ACEOF -+ -+fi -+ -+done -+ -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5 -+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; } -+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lselinux $LIBS" -+cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+/* Override any GCC internal prototype to avoid an error. -+ Use char because int might match the return type of a GCC -+ builtin and then its argument prototype would still apply. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+char security_get_boolean_active (); -+int -+main () -+{ -+return security_get_boolean_active (); -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ ac_cv_lib_selinux_security_get_boolean_active=yes -+else -+ ac_cv_lib_selinux_security_get_boolean_active=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5 -+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; } -+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_LIBSELINUX 1 -+_ACEOF -+ -+ LIBS="-lselinux $LIBS" -+ -+fi -+ -+ - - - diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch deleted file mode 100644 index 2cddac3..0000000 --- a/gdb-bz533176-fortran-omp-step.patch +++ /dev/null @@ -1,121 +0,0 @@ -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 . -+ -+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 . -+ -+ 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-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch deleted file mode 100644 index 74604ba..0000000 --- a/gdb-bz541866-rwatch-before-run.patch +++ /dev/null @@ -1,151 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/config/i386/linux64.mh -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/config/i386/linux64.mh 2012-03-13 16:00:34.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/config/i386/linux64.mh 2012-06-02 19:56:03.196172503 +0200 -@@ -4,7 +4,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \ - 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 -Index: gdb-7.4.50.20120602/gdb/config/i386/linux.mh -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/config/i386/linux.mh 2012-03-13 16:00:33.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/config/i386/linux.mh 2012-06-02 19:55:42.418178412 +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 \ -Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h 2012-06-02 19:55:42.433178408 +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 . */ -+ -+#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 */ -Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h 2012-06-02 19:55:42.434178407 +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 . */ -+ -+#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 */ -Index: gdb-7.4.50.20120602/gdb/target.h -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/target.h 2012-06-01 18:37:59.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/target.h 2012-06-02 19:55:42.436178407 +0200 -@@ -1470,8 +1470,10 @@ extern char *target_thread_name (struct - bp_hardware_breakpoint. CNT is the number of such watchpoints used so far - (including this one?). OTHERTYPE is who knows what... */ - -+#ifndef target_can_use_hardware_watchpoint - #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \ - (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE); -+#endif - - /* Returns the number of debug registers needed to watch the given - memory region, or zero if not supported. */ -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2012-06-02 19:55:42.442178406 +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 . -+ -+# 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/gdb-bz568248-oom-is-error.patch b/gdb-bz568248-oom-is-error.patch deleted file mode 100644 index 045d34e..0000000 --- a/gdb-bz568248-oom-is-error.patch +++ /dev/null @@ -1,68 +0,0 @@ -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 - Tom Tromey - - * 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-bz601887-dwarf4-rh-test.patch b/gdb-bz601887-dwarf4-rh-test.patch deleted file mode 100644 index 4774bda..0000000 --- a/gdb-bz601887-dwarf4-rh-test.patch +++ /dev/null @@ -1,240 +0,0 @@ ---- /dev/null 2010-06-08 20:35:46.800278452 +0200 -+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S 2010-06-09 15:22:57.000000000 +0200 -@@ -0,0 +1,167 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+ .file "rh-dwarf4-x86_64.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+.globl main -+ .type main, @function -+main: -+.LFB0: -+ .file 1 "gdb.dwarf2/rh-dwarf4-x86_64.c" -+ # gdb.dwarf2/rh-dwarf4-x86_64.c:20 -+ .loc 1 20 0 -+ .cfi_startproc -+ # basic block 2 -+ pushq %rbp -+ .cfi_def_cfa_offset 16 -+ movq %rsp, %rbp -+ .cfi_offset 6, -16 -+ .cfi_def_cfa_register 6 -+ # gdb.dwarf2/rh-dwarf4-x86_64.c:21 -+ .loc 1 21 0 -+ movl $0, %eax -+ # gdb.dwarf2/rh-dwarf4-x86_64.c:22 -+ .loc 1 22 0 -+ leave -+ .cfi_def_cfa 7, 8 -+ ret -+ .cfi_endproc -+.LFE0: -+ .size main, .-main -+.Letext0: -+ .section .debug_info -+ .long 0x4e # Length of Compilation Unit Info -+ .value 0x4 # DWARF version number -+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section -+ .byte 0x8 # Pointer Size (in bytes) -+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) -+ .long .LASF0 # DW_AT_producer: "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)" -+ .byte 0x1 # DW_AT_language -+ .long .LASF1 # DW_AT_name: "gdb.dwarf2/rh-dwarf4-x86_64.c" -+ .long .LASF2 # DW_AT_comp_dir -+ .quad .Ltext0 # DW_AT_low_pc -+ .quad .Letext0 # DW_AT_high_pc -+ .long .Ldebug_line0 # DW_AT_stmt_list -+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) -+ # DW_AT_external -+ .long .LASF3 # DW_AT_name: "main" -+ .byte 0x1 # DW_AT_decl_file (gdb.dwarf2/rh-dwarf4-x86_64.c) -+ .byte 0x13 # DW_AT_decl_line -+ # DW_AT_prototyped -+ .long 0x4a # DW_AT_type -+ .quad .LFB0 # DW_AT_low_pc -+ .quad .LFE0 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ .uleb128 0x3 # (DIE (0x4a) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x5 # DW_AT_encoding -+ .ascii "int\0" # DW_AT_name -+ .byte 0x0 # end of children of DIE 0xb -+ .section .debug_abbrev -+ .uleb128 0x1 # (abbrev code) -+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x25 # (DW_AT_producer) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x13 # (DW_AT_language) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x1b # (DW_AT_comp_dir) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x10 # (DW_AT_stmt_list) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x0 # DW_children_no -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0x0 # DW_children_no -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3e # (DW_AT_encoding) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x17 # Length of Public Names Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .long 0x52 # Compilation Unit Length -+ .long 0x2d # DIE offset -+ .ascii "main\0" # external name -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c # Length of Address Ranges Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .byte 0x8 # Size of Address -+ .byte 0x0 # Size of Segment Descriptor -+ .value 0x0 # Pad to 16 byte boundary -+ .value 0x0 -+ .quad .Ltext0 # Address -+ .quad .Letext0-.Ltext0 # Length -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF2: -+ .string "." -+.LASF0: -+ .string "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)" -+.LASF1: -+ .string "gdb.dwarf2/rh-dwarf4-x86_64.c" -+.LASF3: -+ .string "main" -+ .ident "GCC: (GNU) 4.4.4 20100503 (Red Hat 4.4.4-2)" -+ .section .note.GNU-stack,"",@progbits ---- /dev/null 2010-06-08 20:35:46.800278452 +0200 -+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c 2010-06-09 15:21:35.000000000 +0200 -@@ -0,0 +1,22 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+int -+main (void) -+{ -+ return 0; -+} ---- /dev/null 2010-06-08 20:35:46.800278452 +0200 -+++ gdb-7.1/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp 2010-06-09 15:26:21.000000000 +0200 -@@ -0,0 +1,42 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+if {![istarget x86_64-*]} { -+ return 0 -+} -+ -+set testfile "rh-dwarf4-x86_64" -+set srcfile ${testfile}.S -+set executable ${testfile}.x -+set binfile ${objdir}/${subdir}/${executable} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } { -+ return -1 -+} -+ -+clean_restart $executable -+ -+gdb_test "ptype main" {type = int \(void\)} diff --git a/gdb-bz623749-gcore-relro.patch b/gdb-bz623749-gcore-relro.patch deleted file mode 100644 index 4015a7a..0000000 --- a/gdb-bz623749-gcore-relro.patch +++ /dev/null @@ -1,169 +0,0 @@ -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 - - 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 . */ -+ -+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 . */ -+ -+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 . -+ -+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-bz634108-solib_address.patch b/gdb-bz634108-solib_address.patch deleted file mode 100644 index a555872..0000000 --- a/gdb-bz634108-solib_address.patch +++ /dev/null @@ -1,31 +0,0 @@ -Fix gdb.solib_address (fix by Phil Muldoon). - -s/solib_address/solib_name/ during upstreaming. - ---- /dev/null -+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp -@@ -0,0 +1,24 @@ -+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# https://bugzilla.redhat.com/show_bug.cgi?id=634108 -+ -+gdb_exit -+gdb_start -+ -+# Skip all tests if Python scripting is not enabled. -+if { [skip_python_tests] } { continue } -+ -+gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists" diff --git a/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch deleted file mode 100644 index 1e5ebe1..0000000 --- a/gdb-ccache-workaround.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/gdb/testsuite/gdb.base/macscp.exp -+++ b/gdb/testsuite/gdb.base/macscp.exp -@@ -33,6 +33,14 @@ if [test_compiler_info gcc*] { - lappend options additional_flags=-g3 - } - -+# Workaround ccache making lineno non-zero for command-line definitions. -+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} { -+ set result [catch "exec which gcc" output] -+ if {$result == 0 && [string first "/ccache/" $output] > -1} { -+ lappend options "compiler=/usr/bin/gcc" -+ } -+} -+ - # Generate the intermediate object file. This is required by Darwin to - # have access to the .debug_macinfo section. - if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \ diff --git a/gdb-check-type.patch b/gdb-check-type.patch deleted file mode 100644 index fb44065..0000000 --- a/gdb-check-type.patch +++ /dev/null @@ -1,1002 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2012-08/msg00133.html - -### src/gdb/ChangeLog 2012/08/17 03:06:10 1.14599 -### src/gdb/ChangeLog 2012/08/17 17:36:56 1.14600 -## -1,3 +1,48 @@ -+2012-08-17 Keith Seitz -+ -+ PR c++/13356 -+ * gdbtypes.c (strict_type_checking): New variable. -+ (show_strict_type_checking): New function. -+ (rank_one_type): Return NS_POINTER_INTEGER_CONVERSION_BADNESS -+ if strict type checking is disabled. -+ (_initialize_gdbtypes): Add "check type" subcommand. -+ * gdbtypes.h (NS_INTEGER_POINTER_CONVERSION_BADNESS): New struct. -+ -+2012-08-17 Keith Seitz -+ -+ * language.h (type_mode): Remove. -+ (type_check): Remove. -+ (struct language_defn): Remove la_type_check. -+ (STRICT_TYPE): Remove unused macro. -+ (type_error): Remove. -+ * language.c (set_type_range_case): Renamed to ... -+ (set_range_case): ... this. Update all callers. -+ Remove type_mode/type_check. -+ (type_mode): Remove. -+ (type_check): Remove. -+ (show_type_command): Remove. -+ (set_type_command): Remove. -+ (language_info): Remove type checking output. -+ (type_error): Remove unused function. -+ (range_error): Update comment. -+ (unknown_language_defn): Remove la_type_check. -+ (auto_language_defn): Likewise. -+ (local_language_defn): Likewise. -+ (_initialize_language): Remove "check type" subcommand. -+ * ada-lang.c (ada_language_defn): Remove la_type_check. -+ * c-lang.c (c_language_defn): Likewise. -+ (cplus_language_defn): Likewise. -+ (asm_language_defn): Likewise. -+ (minimal_language_defn): Likewise. -+ * d-lang.c (d_language_defn): Likewise. -+ * f-lang.c (f_language_defn): Likewise. -+ * go-lang.c (go_language_defn): Likewise. -+ * jv-lang.c (java_language_defn): Likewise. -+ * m2-lang.c (m2_language_defn): Likewise. -+ * objc-lang.c (objc_language_defn): Likewise. -+ * opencl-lang.c (opencl_language_defn): Likewise. -+ * p-lang.c (pascal_language_defn): Likewise. -+ - 2012-08-16 Mike Frysinger - - * infcmd.c (_initialize_infcmd): Remove trailing ) in next help text. -Index: gdb-7.5.0.20120926/gdb/gdbtypes.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/gdbtypes.c 2012-09-27 22:14:21.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/gdbtypes.c 2012-09-27 22:15:05.807706105 +0200 -@@ -62,6 +62,7 @@ const struct rank BASE_CONVERSION_BADNES - const struct rank REFERENCE_CONVERSION_BADNESS = {2,0}; - const struct rank NULL_POINTER_CONVERSION_BADNESS = {2,0}; - const struct rank NS_POINTER_CONVERSION_BADNESS = {10,0}; -+const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS = {3,0}; - - /* Floatformat pairs. */ - const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN] = { -@@ -134,6 +135,19 @@ show_overload_debug (struct ui_file *fil - value); - } - -+/* A flag to enable strict type checking. */ -+ -+static int strict_type_checking = 1; -+ -+/* A function to show the status of strict type checking. */ -+ -+static void -+show_strict_type_checking (struct ui_file *file, int from_tty, -+ struct cmd_list_element *c, const char *value) -+{ -+ fprintf_filtered (file, _("Strict type checking is %s.\n"), value); -+} -+ - struct extra - { - char str[128]; -@@ -2649,12 +2663,20 @@ rank_one_type (struct type *parm, struct - case TYPE_CODE_FUNC: - return rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL); - case TYPE_CODE_INT: -- if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT -- && value_as_long (value) == 0) -+ if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT) - { -- /* Null pointer conversion: allow it to be cast to a pointer. -- [4.10.1 of C++ standard draft n3290] */ -- return NULL_POINTER_CONVERSION_BADNESS; -+ if (value_as_long (value) == 0) -+ { -+ /* Null pointer conversion: allow it to be cast to a pointer. -+ [4.10.1 of C++ standard draft n3290] */ -+ return NULL_POINTER_CONVERSION_BADNESS; -+ } -+ else -+ { -+ /* If type checking is disabled, allow the conversion. */ -+ if (!strict_type_checking) -+ return NS_INTEGER_POINTER_CONVERSION_BADNESS; -+ } - } - /* fall through */ - case TYPE_CODE_ENUM: -@@ -4637,4 +4659,13 @@ _initialize_gdbtypes (void) - NULL, NULL, - show_opaque_type_resolution, - &setlist, &showlist); -+ -+ /* Add an option to permit non-strict type checking. */ -+ add_setshow_boolean_cmd ("type", class_support, -+ &strict_type_checking, -+ _("Set strict type checking."), -+ _("Show strict type checking."), -+ NULL, NULL, -+ show_strict_type_checking, -+ &setchecklist, &showchecklist); - } -Index: gdb-7.5.0.20120926/gdb/gdbtypes.h -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/gdbtypes.h 2012-09-27 22:14:23.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/gdbtypes.h 2012-09-27 22:14:40.690695059 +0200 -@@ -1745,6 +1745,9 @@ extern const struct rank NULL_POINTER_CO - /* Converting a pointer to an int is usually OK. */ - extern const struct rank NS_POINTER_CONVERSION_BADNESS; - -+/* Badness of converting a (non-zero) integer constant -+ to a pointer. */ -+extern const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS; - - extern struct rank sum_ranks (struct rank a, struct rank b); - extern int compare_ranks (struct rank a, struct rank b); -Index: gdb-7.5.0.20120926/gdb/language.h -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/language.h 2012-06-13 17:47:14.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/language.h 2012-09-27 22:14:40.834695121 +0200 -@@ -55,27 +55,6 @@ extern enum range_check - } - range_check; - --/* type_mode == -- type_mode_auto: type_check set automatically to default of language. -- type_mode_manual: type_check set manually by user. */ -- --extern enum type_mode -- { -- type_mode_auto, type_mode_manual -- } --type_mode; -- --/* type_check == -- type_check_on: Types are checked in GDB expressions, producing errors. -- type_check_warn: Types are checked, producing warnings. -- type_check_off: Types are not checked in GDB expressions. */ -- --extern enum type_check -- { -- type_check_off, type_check_warn, type_check_on -- } --type_check; -- - /* case_mode == - case_mode_auto: case_sensitivity set upon selection of scope. - case_mode_manual: case_sensitivity set only by user. */ -@@ -162,10 +141,6 @@ struct language_defn - - enum range_check la_range_check; - -- /* Default type checking. */ -- -- enum type_check la_type_check; -- - /* Default case sensitivity. */ - enum case_sensitivity la_case_sensitivity; - -@@ -422,9 +397,6 @@ struct type *language_lookup_primitive_t - /* These macros define the behaviour of the expression - evaluator. */ - --/* Should we strictly type check expressions? */ --#define STRICT_TYPE (type_check != type_check_off) -- - /* Should we range check values against the domain of their type? */ - #define RANGE_CHECK (range_check != range_check_off) - -@@ -496,8 +468,6 @@ extern void binop_type_check (struct val - - /* Error messages */ - --extern void type_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2); -- - extern void range_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2); - - /* Data: Does this value represent "truth" to the current language? */ -Index: gdb-7.5.0.20120926/gdb/language.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/language.c 2012-03-02 20:29:01.000000000 +0100 -+++ gdb-7.5.0.20120926/gdb/language.c 2012-09-27 22:14:40.922695162 +0200 -@@ -55,7 +55,7 @@ static void show_check (char *, int); - - static void set_check (char *, int); - --static void set_type_range_case (void); -+static void set_range_case (void); - - static void unk_lang_emit_char (int c, struct type *type, - struct ui_file *stream, int quoter); -@@ -81,8 +81,6 @@ extern const struct language_defn unknow - - enum range_mode range_mode = range_mode_auto; - enum range_check range_check = range_check_off; --enum type_mode type_mode = type_mode_auto; --enum type_check type_check = type_check_off; - enum case_mode case_mode = case_mode_auto; - enum case_sensitivity case_sensitivity = case_sensitive_on; - -@@ -174,7 +172,7 @@ set_language_command (char *ignore, int - /* Enter manual mode. Set the specified language. */ - language_mode = language_mode_manual; - current_language = languages[i]; -- set_type_range_case (); -+ set_range_case (); - expected_language = current_language; - return; - } -@@ -186,79 +184,6 @@ set_language_command (char *ignore, int - language); - } - --/* Show command. Display a warning if the type setting does -- not match the current language. */ --static void --show_type_command (struct ui_file *file, int from_tty, -- struct cmd_list_element *c, const char *value) --{ -- if (type_mode == type_mode_auto) -- { -- char *tmp = NULL; -- -- switch (type_check) -- { -- case type_check_on: -- tmp = "on"; -- break; -- case type_check_off: -- tmp = "off"; -- break; -- case type_check_warn: -- tmp = "warn"; -- break; -- default: -- internal_error (__FILE__, __LINE__, -- "Unrecognized type check setting."); -- } -- -- fprintf_filtered (gdb_stdout, -- _("Type checking is \"auto; currently %s\".\n"), -- tmp); -- } -- else -- fprintf_filtered (gdb_stdout, _("Type checking is \"%s\".\n"), -- value); -- -- if (type_check != current_language->la_type_check) -- warning (_("the current type check setting" -- " does not match the language.\n")); --} -- --/* Set command. Change the setting for type checking. */ --static void --set_type_command (char *ignore, int from_tty, struct cmd_list_element *c) --{ -- if (strcmp (type, "on") == 0) -- { -- type_check = type_check_on; -- type_mode = type_mode_manual; -- } -- else if (strcmp (type, "warn") == 0) -- { -- type_check = type_check_warn; -- type_mode = type_mode_manual; -- } -- else if (strcmp (type, "off") == 0) -- { -- type_check = type_check_off; -- type_mode = type_mode_manual; -- } -- else if (strcmp (type, "auto") == 0) -- { -- type_mode = type_mode_auto; -- set_type_range_case (); -- return; -- } -- else -- internal_error (__FILE__, __LINE__, -- _("Unrecognized type check setting: \"%s\""), type); -- -- if (type_check != current_language->la_type_check) -- warning (_("the current type check setting" -- " does not match the language.\n")); --} -- - /* Show command. Display a warning if the range setting does - not match the current language. */ - static void -@@ -320,7 +245,7 @@ set_range_command (char *ignore, int fro - else if (strcmp (range, "auto") == 0) - { - range_mode = range_mode_auto; -- set_type_range_case (); -+ set_range_case (); - return; - } - else -@@ -389,7 +314,7 @@ set_case_command (char *ignore, int from - else if (strcmp (case_sensitive, "auto") == 0) - { - case_mode = case_mode_auto; -- set_type_range_case (); -+ set_range_case (); - return; - } - else -@@ -409,14 +334,11 @@ set_case_command (char *ignore, int from - If SHOW is non-zero, then print out the current language, - type and range checking status. */ - static void --set_type_range_case (void) -+set_range_case (void) - { - if (range_mode == range_mode_auto) - range_check = current_language->la_range_check; - -- if (type_mode == type_mode_auto) -- type_check = current_language->la_type_check; -- - if (case_mode == case_mode_auto) - case_sensitivity = current_language->la_case_sensitivity; - } -@@ -437,7 +359,7 @@ set_language (enum language lang) - if (languages[i]->la_language == lang) - { - current_language = languages[i]; -- set_type_range_case (); -+ set_range_case (); - break; - } - } -@@ -461,8 +383,6 @@ language_info (int quietly) - - if (!quietly) - { -- printf_unfiltered (_("Type checking: %s\n"), type); -- show_type_command (NULL, 1, NULL, NULL); - printf_unfiltered (_("Range checking: %s\n"), range); - show_range_command (NULL, 1, NULL, NULL); - printf_unfiltered (_("Case sensitivity: %s\n"), case_sensitive); -@@ -500,38 +420,11 @@ value_true (struct value *val) - error messages that occur during type- and range- - checking. */ - --/* These are called when a language fails a type- or range-check. The -+/* This is called when a language fails a range-check. The - first argument should be a printf()-style format string, and the -- rest of the arguments should be its arguments. If -- [type|range]_check is [type|range]_check_on, an error is printed; -- if [type|range]_check_warn, a warning; otherwise just the -- message. */ -- --void --type_error (const char *string,...) --{ -- va_list args; -- -- va_start (args, string); -- switch (type_check) -- { -- case type_check_warn: -- vwarning (string, args); -- break; -- case type_check_on: -- verror (string, args); -- break; -- case type_check_off: -- /* FIXME: cagney/2002-01-30: Should this function print anything -- when type error is off? */ -- vfprintf_filtered (gdb_stderr, string, args); -- fprintf_filtered (gdb_stderr, "\n"); -- break; -- default: -- internal_error (__FILE__, __LINE__, _("bad switch")); -- } -- va_end (args); --} -+ rest of the arguments should be its arguments. If range_check is -+ range_check_on, an error is printed; if range_check_warn, a warning; -+ otherwise just the message. */ - - void - range_error (const char *string,...) -@@ -902,7 +795,6 @@ const struct language_defn unknown_langu - "unknown", - language_unknown, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_no, -@@ -946,7 +838,6 @@ const struct language_defn auto_language - "auto", - language_auto, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_no, -@@ -988,7 +879,6 @@ const struct language_defn local_languag - "local", - language_auto, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_no, -@@ -1135,13 +1025,6 @@ _initialize_language (void) - add_alias_cmd ("c", "check", no_class, 1, &showlist); - add_alias_cmd ("ch", "check", no_class, 1, &showlist); - -- add_setshow_enum_cmd ("type", class_support, type_or_range_names, &type, -- _("Set type checking. (on/warn/off/auto)"), -- _("Show type checking. (on/warn/off/auto)"), -- NULL, set_type_command, -- show_type_command, -- &setchecklist, &showchecklist); -- - add_setshow_enum_cmd ("range", class_support, type_or_range_names, - &range, - _("Set range checking. (on/warn/off/auto)"), -Index: gdb-7.5.0.20120926/gdb/ada-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/ada-lang.c 2012-09-27 22:14:17.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/ada-lang.c 2012-09-27 22:14:41.112695245 +0200 -@@ -12503,7 +12503,6 @@ const struct language_defn ada_language_ - "ada", /* Language name */ - language_ada, - range_check_off, -- type_check_off, - case_sensitive_on, /* Yes, Ada is case-insensitive, but - that's not quite what this means. */ - array_row_major, -Index: gdb-7.5.0.20120926/gdb/c-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/c-lang.c 2012-07-06 07:46:04.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/c-lang.c 2012-09-27 22:14:41.141695257 +0200 -@@ -831,7 +831,6 @@ const struct language_defn c_language_de - "c", /* Language name */ - language_c, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_c, -@@ -955,7 +954,6 @@ const struct language_defn cplus_languag - "c++", /* Language name */ - language_cplus, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_c, -@@ -997,7 +995,6 @@ const struct language_defn asm_language_ - "asm", /* Language name */ - language_asm, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_c, -@@ -1044,7 +1041,6 @@ const struct language_defn minimal_langu - "minimal", /* Language name */ - language_minimal, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_c, -Index: gdb-7.5.0.20120926/gdb/d-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/d-lang.c 2012-03-15 15:06:20.000000000 +0100 -+++ gdb-7.5.0.20120926/gdb/d-lang.c 2012-09-27 22:14:41.143695257 +0200 -@@ -240,7 +240,6 @@ static const struct language_defn d_lang - "d", - language_d, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_c, -Index: gdb-7.5.0.20120926/gdb/f-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/f-lang.c 2012-09-27 22:14:23.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/f-lang.c 2012-09-27 22:14:41.151695260 +0200 -@@ -260,7 +260,6 @@ const struct language_defn f_language_de - "fortran", - language_fortran, - range_check_on, -- type_check_on, - case_sensitive_off, - array_column_major, - macro_expansion_no, -Index: gdb-7.5.0.20120926/gdb/go-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/go-lang.c 2012-04-25 16:07:20.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/go-lang.c 2012-09-27 22:14:41.152695261 +0200 -@@ -562,7 +562,6 @@ static const struct language_defn go_lan - "go", - language_go, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_no, -Index: gdb-7.5.0.20120926/gdb/jv-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/jv-lang.c 2012-09-27 22:14:23.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/jv-lang.c 2012-09-27 22:14:41.154695263 +0200 -@@ -1169,7 +1169,6 @@ const struct language_defn java_language - "java", /* Language name */ - language_java, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_no, -Index: gdb-7.5.0.20120926/gdb/m2-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/m2-lang.c 2012-03-02 20:29:01.000000000 +0100 -+++ gdb-7.5.0.20120926/gdb/m2-lang.c 2012-09-27 22:14:41.161695266 +0200 -@@ -370,7 +370,6 @@ const struct language_defn m2_language_d - "modula-2", - language_m2, - range_check_on, -- type_check_on, - case_sensitive_on, - array_row_major, - macro_expansion_no, -Index: gdb-7.5.0.20120926/gdb/objc-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/objc-lang.c 2012-03-02 20:29:01.000000000 +0100 -+++ gdb-7.5.0.20120926/gdb/objc-lang.c 2012-09-27 22:14:41.163695268 +0200 -@@ -509,7 +509,6 @@ const struct language_defn objc_language - "objective-c", /* Language name */ - language_objc, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_c, -Index: gdb-7.5.0.20120926/gdb/opencl-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/opencl-lang.c 2012-03-02 20:29:01.000000000 +0100 -+++ gdb-7.5.0.20120926/gdb/opencl-lang.c 2012-09-27 22:14:41.165695268 +0200 -@@ -993,7 +993,6 @@ const struct language_defn opencl_langua - "opencl", /* Language name */ - language_opencl, - range_check_off, -- type_check_off, - case_sensitive_on, - array_row_major, - macro_expansion_c, -Index: gdb-7.5.0.20120926/gdb/p-lang.c -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/p-lang.c 2012-03-02 20:29:01.000000000 +0100 -+++ gdb-7.5.0.20120926/gdb/p-lang.c 2012-09-27 22:14:41.170695270 +0200 -@@ -429,7 +429,6 @@ const struct language_defn pascal_langua - "pascal", /* Language name */ - language_pascal, - range_check_on, -- type_check_on, - case_sensitive_on, - array_row_major, - macro_expansion_no, -Index: gdb-7.5.0.20120926/gdb/doc/gdb.texinfo -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/doc/gdb.texinfo 2012-09-27 22:14:23.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/doc/gdb.texinfo 2012-09-27 22:14:41.188695279 +0200 -@@ -12648,29 +12648,18 @@ List all the filename extensions and the - @node Checks - @section Type and Range Checking - --@quotation --@emph{Warning:} In this release, the @value{GDBN} commands for type and range --checking are included, but they do not yet have any effect. This --section documents the intended facilities. --@end quotation --@c FIXME remove warning when type/range code added -- - Some languages are designed to guard you against making seemingly common - errors through a series of compile- and run-time checks. These include --checking the type of arguments to functions and operators, and making -+checking the type of arguments to functions and operators and making - sure mathematical overflows are caught at run time. Checks such as - these help to ensure a program's correctness once it has been compiled --by eliminating type mismatches, and providing active checks for range -+by eliminating type mismatches and providing active checks for range - errors when your program is running. - --@value{GDBN} can check for conditions like the above if you wish. --Although @value{GDBN} does not check the statements in your program, --it can check expressions entered directly into @value{GDBN} for --evaluation via the @code{print} command, for example. As with the --working language, @value{GDBN} can also decide whether or not to check --automatically based on your program's source language. --@xref{Supported Languages, ,Supported Languages}, for the default --settings of supported languages. -+By default @value{GDBN} checks for these errors according to the -+rules of the current source language. Although @value{GDBN} does not check -+the statements in your program, it can check expressions entered directly -+into @value{GDBN} for evaluation via the @code{print} command, for example. - - @menu - * Type Checking:: An overview of type checking -@@ -12682,69 +12671,51 @@ settings of supported languages. - @node Type Checking - @subsection An Overview of Type Checking - --Some languages, such as Modula-2, are strongly typed, meaning that the -+Some languages, such as C and C@t{++}, are strongly typed, meaning that the - arguments to operators and functions have to be of the correct type, - otherwise an error occurs. These checks prevent type mismatch - errors from ever causing any run-time problems. For example, - - @smallexample --1 + 2 @result{} 3 -+int klass::my_method(char *b) @{ return b ? 1 : 2; @} -+ -+(@value{GDBP}) print obj.my_method (0) -+$1 = 2 - @exdent but --@error{} 1 + 2.3 -+(@value{GDBP}) print obj.my_method (0x1234) -+Cannot resolve method klass::my_method to any overloaded instance - @end smallexample - --The second example fails because the @code{CARDINAL} 1 is not --type-compatible with the @code{REAL} 2.3. -+The second example fails because in C@t{++} the integer constant -+@samp{0x1234} is not type-compatible with the pointer parameter type. - --For the expressions you use in @value{GDBN} commands, you can tell the --@value{GDBN} type checker to skip checking; -+For the expressions you use in @value{GDBN} commands, you can tell -+@value{GDBN} to not enforce strict type checking or - to treat any mismatches as errors and abandon the expression; --or to only issue warnings when type mismatches occur, --but evaluate the expression anyway. When you choose the last of --these, @value{GDBN} evaluates expressions like the second example above, but --also issues a warning. -+When type checking is disabled, @value{GDBN} successfully evaluates -+expressions like the second example above. - --Even if you turn type checking off, there may be other reasons -+Even if type checking is off, there may be other reasons - related to type that prevent @value{GDBN} from evaluating an expression. - For instance, @value{GDBN} does not know how to add an @code{int} and - a @code{struct foo}. These particular type errors have nothing to do --with the language in use, and usually arise from expressions, such as --the one described above, which make little sense to evaluate anyway. -- --Each language defines to what degree it is strict about type. For --instance, both Modula-2 and C require the arguments to arithmetical --operators to be numbers. In C, enumerated types and pointers can be --represented as numbers, so that they are valid arguments to mathematical --operators. @xref{Supported Languages, ,Supported Languages}, for further --details on specific languages. -+with the language in use and usually arise from expressions which make -+little sense to evaluate anyway. - --@value{GDBN} provides some additional commands for controlling the type checker: -+@value{GDBN} provides some additional commands for controlling type checking: - - @kindex set check type - @kindex show check type - @table @code --@item set check type auto --Set type checking on or off based on the current working language. --@xref{Supported Languages, ,Supported Languages}, for the default settings for --each language. -- - @item set check type on - @itemx set check type off --Set type checking on or off, overriding the default setting for the --current working language. Issue a warning if the setting does not --match the language default. If any type mismatches occur in -+Set strict type checking on or off. If any type mismatches occur in - evaluating an expression while type checking is on, @value{GDBN} prints a - message and aborts evaluation of the expression. - --@item set check type warn --Cause the type checker to issue warnings, but to always attempt to --evaluate the expression. Evaluating the expression may still --be impossible for other reasons. For example, @value{GDBN} cannot add --numbers and structures. -- --@item show type --Show the current setting of the type checker, and whether or not @value{GDBN} --is setting it automatically. -+@item show check type -+Show the current setting of type checking and whether @value{GDBN} -+is enforcing strict type checking rules. - @end table - - @cindex range checking -@@ -13195,8 +13166,8 @@ specification. - - @cindex C and C@t{++} defaults - --If you allow @value{GDBN} to set type and range checking automatically, they --both default to @code{off} whenever the working language changes to -+If you allow @value{GDBN} to set range checking automatically, it -+defaults to @code{off} whenever the working language changes to - C or C@t{++}. This happens regardless of whether you or @value{GDBN} - selects the working language. - -@@ -13207,37 +13178,15 @@ these files, it sets the working languag - @xref{Automatically, ,Having @value{GDBN} Infer the Source Language}, - for further details. - --@c Type checking is (a) primarily motivated by Modula-2, and (b) --@c unimplemented. If (b) changes, it might make sense to let this node --@c appear even if Mod-2 does not, but meanwhile ignore it. roland 16jul93. -- - @node C Checks - @subsubsection C and C@t{++} Type and Range Checks - - @cindex C and C@t{++} checks - --By default, when @value{GDBN} parses C or C@t{++} expressions, type checking --is not used. However, if you turn type checking on, @value{GDBN} --considers two variables type equivalent if: -- --@itemize @bullet --@item --The two variables are structured and have the same structure, union, or --enumerated tag. -- --@item --The two variables have the same type name, or types that have been --declared equivalent through @code{typedef}. -- --@ignore --@c leaving this out because neither J Gilmore nor R Pesch understand it. --@c FIXME--beers? --@item --The two @code{struct}, @code{union}, or @code{enum} variables are --declared in the same declaration. (Note: this may not be true for all C --compilers.) --@end ignore --@end itemize -+By default, when @value{GDBN} parses C or C@t{++} expressions, strict type -+checking is used. However, if you turn type checking off, @value{GDBN} -+will allow certain non-standard conversions, such as promoting integer -+constants to pointers. - - Range checking, if turned on, is done on mathematical operations. Array - indices are not checked, since they are often used to index a pointer -Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/default.exp -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/default.exp 2012-04-27 22:52:06.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/default.exp 2012-09-27 22:14:41.312695333 +0200 -@@ -495,12 +495,13 @@ gdb_test "section" "Must specify section - gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate" - #test set args - gdb_test_no_output "set args" "set args" --#test set check "c" abbreviation --gdb_test "set c" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"c\" abbreviation" --#test set check "ch" abbreviation --gdb_test "set ch" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"ch\" abbreviation" --#test set check --gdb_test "set check" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check" -+ -+# Test set check abbreviations -+foreach x {"c" "ch" "check"} { -+ gdb_test "set $x" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \ -+ "set check \"$x\" abbreviation" -+} -+ - #test set check range - gdb_test "set check range" ".*" "set check range" - #test set check type -@@ -577,16 +578,17 @@ gdb_test "shell echo Hi dad!" "Hi dad!" - gdb_test "show annotate" "Annotation_level is 0." "show annotate" - #test show args - gdb_test "show args" "Argument list to give program being debugged when it is started is \"\"." "show args" --#test show check "c" abbreviation --gdb_test "show c" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\".*" "show check \"c\" abbreviation" --#test show check "ch" abbreviation --gdb_test "show ch" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\"." "show check \"ch\" abbreviation" --#test show check --gdb_test "show check" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\"." "show check" -+ -+# test show check abbreviations -+foreach x {"c" "ch" "check"} { -+ gdb_test "show $x" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Strict type checking is on\..*" \ -+ "show check \"$x\" abbreviation" -+} -+ - #test show check range - gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range" - #test show check type --gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type" -+gdb_test "show check type" "Strict type checking is on\." "show check type" - #test show commands - gdb_test "show commands" ".*" "show commands" - #test show complaints -Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/help.exp -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/help.exp 2012-07-02 19:53:19.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/help.exp 2012-09-27 22:14:41.315695333 +0200 -@@ -376,22 +376,26 @@ gdb_test "help section" "Change the base - gdb_test "help set annotate" "Set annotation_level\.\[\r\n\]+0 == normal; 1 == fullname \\(for use when running under emacs\\)\[\r\n\]+2 == output annotated suitably for use by programs that control GDB\." "help set annotate" - # test help set args - gdb_test "help set args" "Set argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\." --# test help set check "c" abbreviation --test_prefix_command_help {"set c" "set check"} { -- "Set the status of the type/range checker\.\[\r\n\]+" --} "help set check \"c\" abbreviation" --# test help set check "ch" abbreviation --test_prefix_command_help {"set ch" "set check"} { -- "Set the status of the type/range checker\.\[\r\n\]+" --} "help set check \"ch\" abbreviation" --# test help set check -+ -+# Test help set check abbreviations -+foreach x {"c" "ch"} { -+ test_prefix_command_help [list "set $x" "set check"] { -+ "Set the status of the type/range checker\.\[\r\n\]+" -+ } "help set check \"$x\" abbreviation" -+} -+ -+# Test help set check - test_prefix_command_help {"set check"} { - "Set the status of the type/range checker\.\[\r\n\]+" - } -+ - # test help set check range - gdb_test "help set check range" "Set range checking\. \\(on/warn/off/auto\\)" "help set check range" --# test help set check type --gdb_test "help set check type" "Set type checking\. \\(on/warn/off/auto\\)." "help set check type" -+ -+# Test help set check type -+gdb_test "help set check type" "Set strict type checking\." \ -+ "help set check type" -+ - # test help set complaints - gdb_test "help set complaints" "Set max number of complaints about incorrect symbols\." "help set complaints" - # test help set confirm -@@ -487,18 +491,25 @@ gdb_test "help shell" "Execute the rest - gdb_test "help show annotate" "Show annotation_level\.\[\r\n\]+0 == normal; 1 == fullname \\(for use when running under emacs\\)\[\r\n\]+2 == output annotated suitably for use by programs that control GDB\." "help show annotate" - # test help show args - gdb_test "help show args" "Show argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\." --# test help show check "c" abbreviation --test_prefix_command_help {"show c" "show check"} { -- "Show the status of the type/range checker\.\[\r\n\]+" --} "help show check \"c\" abbreviation" -+ -+# Test help show check abbreviations -+foreach x {"c" "check"} { -+ test_prefix_command_help [list "show $x" "show check"] { -+ "Show the status of the type/range checker\.\[\r\n\]+" -+ } "help show check \"$x\" abbreviation" -+} -+ - # test help show check - test_prefix_command_help {"show check"} { - "Show the status of the type/range checker\.\[\r\n\]+" - } - # test help show check range - gdb_test "help show check range" "Show range checking\. \\(on/warn/off/auto\\)" "help show check range" -+ - # test help show check type --gdb_test "help show check type" "Show type checking\. \\(on/warn/off/auto\\)" "help show check type" -+gdb_test "help show check type" "Show strict type checking\." \ -+ "help show check type" -+ - # test help show commands - gdb_test "help show commands" "Show the history of commands you typed\.\[\r\n\]+You can supply a command number to start with, or a `\[+\]' to start after\[\r\n\]+the previous command number shown\." "help show commands" - # test help show complaints -Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/setshow.exp -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/setshow.exp 2012-03-13 22:02:40.000000000 +0100 -+++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/setshow.exp 2012-09-27 22:14:41.320695336 +0200 -@@ -110,19 +110,22 @@ gdb_test "show check range" "Range check - #test set check range auto - gdb_test_no_output "set check range auto" "set check range auto" - #test show check range auto --gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)" --#test set check type on --gdb_test "set check type on" ".*" "set check type on" --#test show check type on --gdb_test "show check type" "Type checking is \"on\"..*" "show check type (on)" --#test set check type off with trailing space --gdb_test_no_output "set check type off " "set check type off" --#test show check type off --gdb_test "show check type" "Type checking is \"off\"..*" "show check type (off)" --#test set check type auto --gdb_test_no_output "set check type auto" "set check type auto" --#test show check type --gdb_test "show check type" "Type checking is \"auto; currently .*" "show check type (auto)" -+gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)" -+ -+# Test set check type on -+gdb_test "set check type on" ".*" "set check type on" -+ -+# Test show check type on -+gdb_test "show check type" "Strict type checking is on\..*" \ -+ "show check type (on)" -+ -+# Test set check type off with trailing space -+gdb_test_no_output "set check type off " "set check type off" -+ -+# Test show check type off -+gdb_test "show check type" "Strict type checking is off\..*" \ -+ "show check type (off)" -+ - #test set complaints 100 - gdb_test_no_output "set complaints 100" "set complaints 100" - #test show complaints 100 -Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.exp -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.cp/converts.exp 2012-07-10 17:18:18.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.exp 2012-09-27 22:14:41.321695337 +0200 -@@ -70,9 +70,37 @@ gdb_test_multiple "p foo3_1 (0, 0)" $t { - pass $t - } - } -+ - gdb_test "p foo3_1 (0, 1)" \ - "Cannot resolve function foo3_1 to any overloaded instance" - gdb_test "p foo3_1 (0, (const char**) 1)" " = 31" - gdb_test "p foo3_2 (0, 0)" "= 32" - gdb_test "p foo3_2 (0, (char const**) 0)" " = 320" - -+# Test for strict type checking -+set error_str "Cannot resolve function %s to any overloaded instance" -+gdb_test "show check type" "Strict type checking is on\." -+gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"] -+gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"] -+gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"] -+gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"] -+gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"] -+gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"] -+gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"] -+gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"] -+gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"] -+gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"] -+ -+gdb_test_no_output "set check type off" -+gdb_test "show check type" "Strict type checking is off\." -+gdb_test "p foo1_type_check (123)" " = 1000" -+gdb_test "p foo2_type_check (0, 1)" " = 1001" -+gdb_test "p foo2_type_check (1, 0)" " = 1001" -+gdb_test "p foo2_type_check (1, 1)" " = 1001" -+gdb_test "p foo3_type_check (0, 0, 1)" " = 1002" -+gdb_test "p foo3_type_check (0, 1, 0)" " = 1002" -+gdb_test "p foo3_type_check (1, 0, 0)" " = 1002" -+gdb_test "p foo3_type_check (0, 1, 1)" " = 1002" -+gdb_test "p foo3_type_check (1, 1, 0)" " = 1002" -+gdb_test "p foo3_type_check (1, 1, 1)" " = 1002" -+gdb_test "p foo3_2 (1,1)" " = 32" -Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.cc -=================================================================== ---- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.cp/converts.cc 2011-10-14 22:22:50.000000000 +0200 -+++ gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.cc 2012-09-27 22:14:41.322695337 +0200 -@@ -27,6 +27,10 @@ int foo3_1 (int a, const char **b) { ret - int foo3_2 (int a, int b) { return 32; } - int foo3_2 (int a, const char **b) { return 320; } - -+int foo1_type_check (char *a) { return 1000; } -+int foo2_type_check (char *a, char *b) { return 1001; } -+int foo3_type_check (char *a, char *b, char *c) { return 1002; } -+ - int main() - { - -@@ -62,5 +66,9 @@ int main() - foo3_2 (0, static_cast (0)); - foo3_2 (0, 0); - -+ foo1_type_check (a); -+ foo2_type_check (a, a); -+ foo3_type_check (a, a, a); -+ - return 0; // end of main - } diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch deleted file mode 100644 index b835657..0000000 --- a/gdb-core-open-vdso-warning.patch +++ /dev/null @@ -1,131 +0,0 @@ -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. - -[ New patch variant. ] - -Index: gdb-7.4.50.20120703/gdb/solib-svr4.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c 2012-07-06 15:39:57.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/solib-svr4.c 2012-07-06 15:40:01.124816148 +0200 -@@ -1221,8 +1221,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.20120703/gdb/solib.c -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/solib.c 2012-07-06 15:38:39.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/solib.c 2012-07-06 15:40:01.125816147 +0200 -@@ -672,7 +672,7 @@ solib_used (const struct so_list *const - processes we've just attached to, so that's okay. */ - - static void --update_solib_list (int from_tty, struct target_ops *target) -+update_solib_list_1 (int from_tty, struct target_ops *target) - { - struct target_so_ops *ops = solib_ops (target_gdbarch); - struct so_list *inferior = ops->current_sos(); -@@ -843,6 +843,21 @@ Do you need \"set solib-search-path\" or - } - } - -+/* Wrapper for Fedora: gdb-core-open-vdso-warning.patch */ -+ -+static void -+update_solib_list (int from_tty, struct target_ops *target) -+{ -+ struct so_list *saved_so_list_head = so_list_head; -+ -+ update_solib_list_1 (from_tty, target); -+ -+ /* 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) -+ update_solib_list_1 (from_tty, target); -+} - - /* Return non-zero if NAME is the libpthread shared library. - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:39:41.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:40:10.322805539 +0200 -@@ -286,3 +286,19 @@ if {$buildid == ""} { - gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" - pass $wholetest - } -+ -+ -+# Test Linux specific vDSO warning: -+# warning: Can't read pathname for load map: Input/output error. -+ -+clean_restart ${testfile} -+ -+set test "core-file vdso warning" -+gdb_test_multiple "core-file $corefile" $test { -+ -re "warning: Can't read pathname for load map: Input/output error\\.\r\n.*\r\n$gdb_prompt $" { -+ fail $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:38:39.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:40:01.127816145 +0200 -@@ -27,7 +27,8 @@ set lib_flags [list debug ldflags=-Wl,-B - # Binary file. - set testfile "solib-symbol-main" - set srcfile ${srcdir}/${subdir}/${testfile}.c --set binfile ${objdir}/${subdir}/${testfile} -+set executable ${testfile} -+set binfile ${objdir}/${subdir}/${executable} - set bin_flags [list debug shlib=${binfile_lib}] - - if [get_compiler_info] { -@@ -72,8 +73,26 @@ gdb_test "br foo2" \ - "Breakpoint.*: foo2. .2 locations..*" \ - "foo2 in mdlib" - --gdb_exit -+# Test GDB warns for shared libraris which have not been found. - --return 0 -+gdb_test "info sharedlibrary" "/${libname}.*" - -+clean_restart ${executable} -+gdb_breakpoint "main" -+gdb_run_cmd -+set test "no warning for missing libraries" -+gdb_test_multiple "" $test { -+ -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" { -+ fail $test -+ } -+ -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" { -+ pass $test -+ } -+} - -+clean_restart ${executable} -+gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST" -+gdb_breakpoint "main" -+gdb_run_cmd -+gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \ -+ "warning for missing libraries" diff --git a/gdb-dlopen-stap-probe-1of7.patch b/gdb-dlopen-stap-probe-1of7.patch deleted file mode 100644 index 1891fb3..0000000 --- a/gdb-dlopen-stap-probe-1of7.patch +++ /dev/null @@ -1,795 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2012-07/msg00123.html - -### src/gdb/ChangeLog 2012/07/18 04:36:15 1.14473 -### src/gdb/ChangeLog 2012/07/18 16:12:15 1.14474 -## -1,3 +1,37 @@ -+2012-07-18 Sergio Durigan Junior -+ -+ * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. -+ (elf_compile_to_ax): Likewise. -+ * infrun.c (insert_exception_resume_from_probe): Likewise. -+ (check_exception_resume): Remove `objfile' variable. -+ * probe.c (find_probe_by_pc): Remove `objfile' argument. -+ (struct probe_and_objfile, probe_and_objfile_s): Delete. -+ (collect_probes): Adjust return value to `VEC (probe_p) *'. -+ (compare_entries): Rename to... -+ (compare_probes): ...this. Adjust function to work with -+ `struct probe *'. Rename variables `ea' and `eb' to `pa' and `pb' -+ respectively. -+ (gen_ui_out_table_header_info): Adjust `probes' argument to be -+ `VEC (probe_p) *'. -+ (print_ui_out_info): Adjust argument to be `struct probe *'. -+ (info_probes_for_ops): Adjust internal computations to use -+ `VEC (probe_p) *'. -+ (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore. -+ * probe.h (struct probe_ops) : Remove `objfile' argument. -+ (struct probe) : New field. -+ (find_probe_by_pc): Remove `objfile' argument. -+ * stap-probe.c (stap_parse_probe_arguments): Likewise. -+ (stap_get_probe_argument_count): Likewise. -+ (stap_get_arg): Likewise. -+ (stap_evaluate_probe_argument): Likewise. -+ (stap_compile_to_ax): Likewise. -+ (compile_probe_arg): Refactor not to pass `objfile' anymore. -+ (handle_stap_probe): Fill `objfile' field from `struct probe'. -+ (stap_gen_info_probes_table_header): Remove `objfile' argument. -+ * symfile.h (struct sym_probe_fns) : Likewise. -+ - 2012-07-18 Terry Guo - - PR 14329 ---- src/gdb/elfread.c 2012/06/26 20:14:01 1.133 -+++ src/gdb/elfread.c 2012/07/18 16:12:15 1.134 -@@ -1635,33 +1635,29 @@ - symfile.h. */ - - static unsigned --elf_get_probe_argument_count (struct objfile *objfile, -- struct probe *probe) -+elf_get_probe_argument_count (struct probe *probe) - { -- return probe->pops->get_probe_argument_count (probe, objfile); -+ return probe->pops->get_probe_argument_count (probe); - } - - /* Implementation of `sym_evaluate_probe_argument', as documented in - symfile.h. */ - - static struct value * --elf_evaluate_probe_argument (struct objfile *objfile, -- struct probe *probe, -- unsigned n) -+elf_evaluate_probe_argument (struct probe *probe, unsigned n) - { -- return probe->pops->evaluate_probe_argument (probe, objfile, n); -+ return probe->pops->evaluate_probe_argument (probe, n); - } - - /* Implementation of `sym_compile_to_ax', as documented in symfile.h. */ - - static void --elf_compile_to_ax (struct objfile *objfile, -- struct probe *probe, -+elf_compile_to_ax (struct probe *probe, - struct agent_expr *expr, - struct axs_value *value, - unsigned n) - { -- probe->pops->compile_to_ax (probe, objfile, expr, value, n); -+ probe->pops->compile_to_ax (probe, expr, value, n); - } - - /* Implementation of `sym_relocate_probe', as documented in symfile.h. */ ---- src/gdb/infrun.c 2012/07/01 10:37:04 1.549 -+++ src/gdb/infrun.c 2012/07/18 16:12:16 1.550 -@@ -5518,7 +5518,6 @@ - static void - insert_exception_resume_from_probe (struct thread_info *tp, - const struct probe *probe, -- struct objfile *objfile, - struct frame_info *frame) - { - struct value *arg_value; -@@ -5534,7 +5533,7 @@ - if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, - "infrun: exception resume at %s\n", -- paddress (get_objfile_arch (objfile), -+ paddress (get_objfile_arch (probe->objfile), - handler)); - - bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), -@@ -5552,7 +5551,6 @@ - struct frame_info *frame) - { - volatile struct gdb_exception e; -- struct objfile *objfile; - const struct probe *probe; - struct symbol *func; - -@@ -5560,11 +5558,10 @@ - SystemTap probe point. If so, the probe has two arguments: the - CFA and the HANDLER. We ignore the CFA, extract the handler, and - set a breakpoint there. */ -- probe = find_probe_by_pc (get_frame_pc (frame), &objfile); -+ probe = find_probe_by_pc (get_frame_pc (frame)); - if (probe) - { -- insert_exception_resume_from_probe (ecs->event_thread, probe, -- objfile, frame); -+ insert_exception_resume_from_probe (ecs->event_thread, probe, frame); - return; - } - ---- src/gdb/probe.c 2012/05/08 01:35:34 1.3 -+++ src/gdb/probe.c 2012/07/18 16:12:17 1.4 -@@ -204,7 +204,7 @@ - /* See definition in probe.h. */ - - struct probe * --find_probe_by_pc (CORE_ADDR pc, struct objfile **objfile_out) -+find_probe_by_pc (CORE_ADDR pc) - { - struct objfile *objfile; - -@@ -221,10 +221,7 @@ - probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++) - if (probe->address == pc) -- { -- *objfile_out = objfile; -- return probe; -- } -+ return probe; - } - - return NULL; -@@ -232,21 +229,6 @@ - - - --/* A utility structure. A VEC of these is built when handling "info -- probes". */ -- --struct probe_and_objfile --{ -- /* The probe. */ -- struct probe *probe; -- -- /* The probe's objfile. */ -- struct objfile *objfile; --}; -- --typedef struct probe_and_objfile probe_and_objfile_s; --DEF_VEC_O (probe_and_objfile_s); -- - /* A helper function for collect_probes that compiles a regexp and - throws an exception on error. This installs a cleanup to free the - resulting pattern on success. If RX is NULL, this does nothing. */ -@@ -275,16 +257,16 @@ - If POPS is not NULL, only probes of this certain probe_ops will match. - Each argument is a regexp, or NULL, which matches anything. */ - --static VEC (probe_and_objfile_s) * -+static VEC (probe_p) * - collect_probes (char *objname, char *provider, char *probe_name, - const struct probe_ops *pops) - { - struct objfile *objfile; -- VEC (probe_and_objfile_s) *result = NULL; -+ VEC (probe_p) *result = NULL; - struct cleanup *cleanup, *cleanup_temps; - regex_t obj_pat, prov_pat, probe_pat; - -- cleanup = make_cleanup (VEC_cleanup (probe_and_objfile_s), &result); -+ cleanup = make_cleanup (VEC_cleanup (probe_p), &result); - - cleanup_temps = make_cleanup (null_cleanup, NULL); - compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp")); -@@ -310,8 +292,6 @@ - - for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++) - { -- probe_and_objfile_s entry; -- - if (pops != NULL && probe->pops != pops) - continue; - -@@ -323,9 +303,7 @@ - && regexec (&probe_pat, probe->name, 0, NULL, 0) != 0) - continue; - -- entry.probe = probe; -- entry.objfile = objfile; -- VEC_safe_push (probe_and_objfile_s, result, &entry); -+ VEC_safe_push (probe_p, result, probe); - } - } - -@@ -334,36 +312,36 @@ - return result; - } - --/* A qsort comparison function for probe_and_objfile_s objects. */ -+/* A qsort comparison function for probe_p objects. */ - - static int --compare_entries (const void *a, const void *b) -+compare_probes (const void *a, const void *b) - { -- const probe_and_objfile_s *ea = a; -- const probe_and_objfile_s *eb = b; -+ const struct probe *pa = *((const struct probe **) a); -+ const struct probe *pb = *((const struct probe **) b); - int v; - -- v = strcmp (ea->probe->provider, eb->probe->provider); -+ v = strcmp (pa->provider, pb->provider); - if (v) - return v; - -- v = strcmp (ea->probe->name, eb->probe->name); -+ v = strcmp (pa->name, pb->name); - if (v) - return v; - -- if (ea->probe->address < eb->probe->address) -+ if (pa->address < pb->address) - return -1; -- if (ea->probe->address > eb->probe->address) -+ if (pa->address > pb->address) - return 1; - -- return strcmp (ea->objfile->name, eb->objfile->name); -+ return strcmp (pa->objfile->name, pb->objfile->name); - } - - /* Helper function that generate entries in the ui_out table being - crafted by `info_probes_for_ops'. */ - - static void --gen_ui_out_table_header_info (VEC (probe_and_objfile_s) *probes, -+gen_ui_out_table_header_info (VEC (probe_p) *probes, - const struct probe_ops *p) - { - /* `headings' refers to the names of the columns when printing `info -@@ -392,11 +370,11 @@ - VEC_iterate (info_probe_column_s, headings, ix, column); - ++ix) - { -- probe_and_objfile_s *entry; -+ struct probe *probe; - int jx; - size_t size_max = strlen (column->print_name); - -- for (jx = 0; VEC_iterate (probe_and_objfile_s, probes, jx, entry); ++jx) -+ for (jx = 0; VEC_iterate (probe_p, probes, jx, probe); ++jx) - { - /* `probe_fields' refers to the values of each new field that this - probe will display. */ -@@ -405,12 +383,11 @@ - const char *val; - int kx; - -- if (entry->probe->pops != p) -+ if (probe->pops != p) - continue; - - c2 = make_cleanup (VEC_cleanup (const_char_ptr), &probe_fields); -- p->gen_info_probes_table_values (entry->probe, entry->objfile, -- &probe_fields); -+ p->gen_info_probes_table_values (probe, &probe_fields); - - gdb_assert (VEC_length (const_char_ptr, probe_fields) - == headings_size); -@@ -437,10 +414,10 @@ - } - - /* Helper function to print extra information about a probe and an objfile -- represented by ENTRY. */ -+ represented by PROBE. */ - - static void --print_ui_out_info (probe_and_objfile_s *entry) -+print_ui_out_info (struct probe *probe) - { - int ix; - int j = 0; -@@ -451,23 +428,21 @@ - info_probe_column_s *column; - struct cleanup *c; - -- gdb_assert (entry != NULL); -- gdb_assert (entry->probe != NULL); -- gdb_assert (entry->probe->pops != NULL); -+ gdb_assert (probe != NULL); -+ gdb_assert (probe->pops != NULL); - -- if (entry->probe->pops->gen_info_probes_table_header == NULL -- && entry->probe->pops->gen_info_probes_table_values == NULL) -+ if (probe->pops->gen_info_probes_table_header == NULL -+ && probe->pops->gen_info_probes_table_values == NULL) - return; - -- gdb_assert (entry->probe->pops->gen_info_probes_table_header != NULL -- && entry->probe->pops->gen_info_probes_table_values != NULL); -+ gdb_assert (probe->pops->gen_info_probes_table_header != NULL -+ && probe->pops->gen_info_probes_table_values != NULL); - - c = make_cleanup (VEC_cleanup (info_probe_column_s), &headings); - make_cleanup (VEC_cleanup (const_char_ptr), &values); - -- entry->probe->pops->gen_info_probes_table_header (&headings); -- entry->probe->pops->gen_info_probes_table_values (entry->probe, -- entry->objfile, &values); -+ probe->pops->gen_info_probes_table_header (&headings); -+ probe->pops->gen_info_probes_table_values (probe, &values); - - gdb_assert (VEC_length (info_probe_column_s, headings) - == VEC_length (const_char_ptr, values)); -@@ -515,16 +490,16 @@ - void - info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops) - { -- char *provider, *probe = NULL, *objname = NULL; -+ char *provider, *probe_name = NULL, *objname = NULL; - struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); -- VEC (probe_and_objfile_s) *items; -+ VEC (probe_p) *probes; - int i, any_found; - int ui_out_extra_fields = 0; - size_t size_addr; - size_t size_name = strlen ("Name"); - size_t size_objname = strlen ("Object"); - size_t size_provider = strlen ("Provider"); -- probe_and_objfile_s *entry; -+ struct probe *probe; - struct gdbarch *gdbarch = get_current_arch (); - - /* Do we have a `provider:probe:objfile' style of linespec? */ -@@ -533,10 +508,10 @@ - { - make_cleanup (xfree, provider); - -- probe = extract_arg (&arg); -- if (probe) -+ probe_name = extract_arg (&arg); -+ if (probe_name) - { -- make_cleanup (xfree, probe); -+ make_cleanup (xfree, probe_name); - - objname = extract_arg (&arg); - if (objname) -@@ -564,28 +539,27 @@ - else - ui_out_extra_fields = get_number_extra_fields (pops); - -- items = collect_probes (objname, provider, probe, pops); -- make_cleanup (VEC_cleanup (probe_and_objfile_s), &items); -+ probes = collect_probes (objname, provider, probe_name, pops); -+ make_cleanup (VEC_cleanup (probe_p), &probes); - make_cleanup_ui_out_table_begin_end (current_uiout, - 4 + ui_out_extra_fields, -- VEC_length (probe_and_objfile_s, items), -+ VEC_length (probe_p, probes), - "StaticProbes"); - -- if (!VEC_empty (probe_and_objfile_s, items)) -- qsort (VEC_address (probe_and_objfile_s, items), -- VEC_length (probe_and_objfile_s, items), -- sizeof (probe_and_objfile_s), compare_entries); -+ if (!VEC_empty (probe_p, probes)) -+ qsort (VEC_address (probe_p, probes), VEC_length (probe_p, probes), -+ sizeof (probe_p), compare_probes); - - /* What's the size of an address in our architecture? */ - size_addr = gdbarch_addr_bit (gdbarch) == 64 ? 18 : 10; - - /* Determining the maximum size of each field (`provider', `name' and - `objname'). */ -- for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i) -+ for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i) - { -- size_name = max (strlen (entry->probe->name), size_name); -- size_provider = max (strlen (entry->probe->provider), size_provider); -- size_objname = max (strlen (entry->objfile->name), size_objname); -+ size_name = max (strlen (probe->name), size_name); -+ size_provider = max (strlen (probe->provider), size_provider); -+ size_objname = max (strlen (probe->objfile->name), size_objname); - } - - ui_out_table_header (current_uiout, size_provider, ui_left, "provider", -@@ -601,26 +575,26 @@ - /* We have to generate the table header for each new probe type that we - will print. */ - for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po); ++ix) -- gen_ui_out_table_header_info (items, po); -+ gen_ui_out_table_header_info (probes, po); - } - else -- gen_ui_out_table_header_info (items, pops); -+ gen_ui_out_table_header_info (probes, pops); - - ui_out_table_header (current_uiout, size_objname, ui_left, "object", - _("Object")); - ui_out_table_body (current_uiout); - -- for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i) -+ for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i) - { - struct cleanup *inner; - - inner = make_cleanup_ui_out_tuple_begin_end (current_uiout, "probe"); - -- ui_out_field_string (current_uiout, "provider", entry->probe->provider); -- ui_out_field_string (current_uiout, "name", entry->probe->name); -+ ui_out_field_string (current_uiout, "provider", probe->provider); -+ ui_out_field_string (current_uiout, "name", probe->name); - ui_out_field_core_addr (current_uiout, "addr", -- get_objfile_arch (entry->objfile), -- entry->probe->address); -+ get_objfile_arch (probe->objfile), -+ probe->address); - - if (pops == NULL) - { -@@ -629,19 +603,19 @@ - - for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po); - ++ix) -- if (entry->probe->pops == po) -- print_ui_out_info (entry); -+ if (probe->pops == po) -+ print_ui_out_info (probe); - } - else -- print_ui_out_info (entry); -+ print_ui_out_info (probe); - -- ui_out_field_string (current_uiout, "object", entry->objfile->name); -+ ui_out_field_string (current_uiout, "object", probe->objfile->name); - ui_out_text (current_uiout, "\n"); - - do_cleanups (inner); - } - -- any_found = !VEC_empty (probe_and_objfile_s, items); -+ any_found = !VEC_empty (probe_p, probes); - do_cleanups (cleanup); - - if (!any_found) -@@ -662,23 +636,24 @@ - probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n) - { - struct probe *probe; -- struct objfile *objfile; -+ const struct sym_probe_fns *probe_fns; - unsigned n_probes; - -- probe = find_probe_by_pc (get_frame_pc (frame), &objfile); -+ probe = find_probe_by_pc (get_frame_pc (frame)); - if (!probe) - return NULL; -- gdb_assert (objfile->sf && objfile->sf->sym_probe_fns); - -- n_probes -- = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, -- probe); -+ gdb_assert (probe->objfile != NULL); -+ gdb_assert (probe->objfile->sf != NULL); -+ gdb_assert (probe->objfile->sf->sym_probe_fns != NULL); -+ -+ probe_fns = probe->objfile->sf->sym_probe_fns; -+ n_probes = probe_fns->sym_get_probe_argument_count (probe); -+ - if (n >= n_probes) - return NULL; - -- return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile, -- probe, -- n); -+ return probe_fns->sym_evaluate_probe_argument (probe, n); - } - - /* See comment in probe.h. */ ---- src/gdb/probe.h 2012/04/27 20:47:55 1.1 -+++ src/gdb/probe.h 2012/07/18 16:12:17 1.2 -@@ -66,21 +66,18 @@ - - /* Return the number of arguments of PROBE. */ - -- unsigned (*get_probe_argument_count) (struct probe *probe, -- struct objfile *objfile); -+ unsigned (*get_probe_argument_count) (struct probe *probe); - - /* Evaluate the Nth argument from the PROBE, returning a value - corresponding to it. The argument number is represented N. */ - - struct value *(*evaluate_probe_argument) (struct probe *probe, -- struct objfile *objfile, - unsigned n); - - /* Compile the Nth argument of the PROBE to an agent expression. - The argument number is represented by N. */ - -- void (*compile_to_ax) (struct probe *probe, struct objfile *objfile, -- struct agent_expr *aexpr, -+ void (*compile_to_ax) (struct probe *probe, struct agent_expr *aexpr, - struct axs_value *axs_value, unsigned n); - - /* Set the semaphore associated with the PROBE. This function only makes -@@ -108,8 +105,8 @@ - void (*gen_info_probes_table_header) (VEC (info_probe_column_s) **heads); - - /* Function that will fill VALUES with the values of the extra fields -- to be printed for PROBE and OBJFILE. If the backend implements -- the `gen_ui_out_table_header' method, then it should implement -+ to be printed for PROBE. If the backend implements the -+ `gen_ui_out_table_header' method, then it should implement - this method as well. The backend should also guarantee that the - order and the number of values in the vector is exactly the same - as the order of the extra fields provided in the method -@@ -118,7 +115,6 @@ - position in the vector. */ - - void (*gen_info_probes_table_values) (struct probe *probe, -- struct objfile *objfile, - VEC (const_char_ptr) **values); - }; - -@@ -157,6 +153,11 @@ - /* The operations associated with this probe. */ - const struct probe_ops *pops; - -+ /* The objfile which contains this probe. Even if the probe is also -+ present in a separate debug objfile, this variable always points to -+ the non-separate debug objfile. */ -+ struct objfile *objfile; -+ - /* The name of the probe. */ - const char *name; - -@@ -181,11 +182,9 @@ - extern void register_probe_ops (struct probe *probe); - - /* Given a PC, find an associated probe with type PTYPE. If a probe is -- found, set *OBJFILE_OUT to the probe's objfile, and return the -- probe. If no probe is found, return NULL. */ -+ found, return it. If no probe is found, return NULL. */ - --extern struct probe *find_probe_by_pc (CORE_ADDR pc, -- struct objfile **objfile_out); -+extern struct probe *find_probe_by_pc (CORE_ADDR pc); - - /* Search OBJFILE for a probe with the given PROVIDER, NAME and PTYPE. - Return a VEC of all probes that were found. If no matching probe ---- src/gdb/stap-probe.c 2012/05/08 01:35:35 1.4 -+++ src/gdb/stap-probe.c 2012/07/18 16:12:17 1.5 -@@ -903,10 +903,10 @@ - this information. */ - - static void --stap_parse_probe_arguments (struct stap_probe *probe, struct objfile *objfile) -+stap_parse_probe_arguments (struct stap_probe *probe) - { - const char *cur; -- struct gdbarch *gdbarch = get_objfile_arch (objfile); -+ struct gdbarch *gdbarch = get_objfile_arch (probe->p.objfile); - - gdb_assert (!probe->args_parsed); - cur = probe->args_u.text; -@@ -991,15 +991,14 @@ - argument string. */ - - static unsigned --stap_get_probe_argument_count (struct probe *probe_generic, -- struct objfile *objfile) -+stap_get_probe_argument_count (struct probe *probe_generic) - { - struct stap_probe *probe = (struct stap_probe *) probe_generic; - - gdb_assert (probe_generic->pops == &stap_probe_ops); - - if (!probe->args_parsed) -- stap_parse_probe_arguments (probe, objfile); -+ stap_parse_probe_arguments (probe); - - gdb_assert (probe->args_parsed); - return VEC_length (stap_probe_arg_s, probe->args_u.vec); -@@ -1042,10 +1041,10 @@ - } - - static struct stap_probe_arg * --stap_get_arg (struct stap_probe *probe, struct objfile *objfile, unsigned n) -+stap_get_arg (struct stap_probe *probe, unsigned n) - { - if (!probe->args_parsed) -- stap_parse_probe_arguments (probe, objfile); -+ stap_parse_probe_arguments (probe); - - return VEC_index (stap_probe_arg_s, probe->args_u.vec, n); - } -@@ -1054,8 +1053,7 @@ - corresponding to it. Assertion is thrown if N does not exist. */ - - static struct value * --stap_evaluate_probe_argument (struct probe *probe_generic, -- struct objfile *objfile, unsigned n) -+stap_evaluate_probe_argument (struct probe *probe_generic, unsigned n) - { - struct stap_probe *stap_probe = (struct stap_probe *) probe_generic; - struct stap_probe_arg *arg; -@@ -1063,7 +1061,7 @@ - - gdb_assert (probe_generic->pops == &stap_probe_ops); - -- arg = stap_get_arg (stap_probe, objfile, n); -+ arg = stap_get_arg (stap_probe, n); - return evaluate_subexp_standard (arg->atype, arg->aexpr, &pos, EVAL_NORMAL); - } - -@@ -1071,9 +1069,8 @@ - Assertion is thrown if N does not exist. */ - - static void --stap_compile_to_ax (struct probe *probe_generic, struct objfile *objfile, -- struct agent_expr *expr, struct axs_value *value, -- unsigned n) -+stap_compile_to_ax (struct probe *probe_generic, struct agent_expr *expr, -+ struct axs_value *value, unsigned n) - { - struct stap_probe *stap_probe = (struct stap_probe *) probe_generic; - struct stap_probe_arg *arg; -@@ -1081,7 +1078,7 @@ - - gdb_assert (probe_generic->pops == &stap_probe_ops); - -- arg = stap_get_arg (stap_probe, objfile, n); -+ arg = stap_get_arg (stap_probe, n); - - pc = arg->aexpr->elts; - gen_expr (arg->aexpr, &pc, expr, value); -@@ -1124,20 +1121,24 @@ - struct frame_info *frame = get_selected_frame (_("No frame selected")); - CORE_ADDR pc = get_frame_pc (frame); - int sel = (int) (uintptr_t) data; -- struct objfile *objfile; - struct probe *pc_probe; -+ const struct sym_probe_fns *pc_probe_fns; - unsigned n_args; - - /* SEL == -1 means "_probe_argc". */ - gdb_assert (sel >= -1); - -- pc_probe = find_probe_by_pc (pc, &objfile); -+ pc_probe = find_probe_by_pc (pc); - if (pc_probe == NULL) - error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc)); - -- n_args -- = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, -- pc_probe); -+ gdb_assert (pc_probe->objfile != NULL); -+ gdb_assert (pc_probe->objfile->sf != NULL); -+ gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL); -+ -+ pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns; -+ -+ n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe); - if (sel == -1) - return value_from_longest (builtin_type (arch)->builtin_int, n_args); - -@@ -1145,9 +1146,7 @@ - error (_("Invalid probe argument %d -- probe has %u arguments available"), - sel, n_args); - -- return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile, -- pc_probe, -- sel); -+ return pc_probe_fns->sym_evaluate_probe_argument (pc_probe, sel); - } - - /* This is called to compile one of the $_probe_arg* convenience -@@ -1159,20 +1158,25 @@ - { - CORE_ADDR pc = expr->scope; - int sel = (int) (uintptr_t) data; -- struct objfile *objfile; - struct probe *pc_probe; -+ const struct sym_probe_fns *pc_probe_fns; - int n_probes; - - /* SEL == -1 means "_probe_argc". */ - gdb_assert (sel >= -1); - -- pc_probe = find_probe_by_pc (pc, &objfile); -+ pc_probe = find_probe_by_pc (pc); - if (pc_probe == NULL) - error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc)); - -- n_probes -- = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, -- pc_probe); -+ gdb_assert (pc_probe->objfile != NULL); -+ gdb_assert (pc_probe->objfile->sf != NULL); -+ gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL); -+ -+ pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns; -+ -+ n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe); -+ - if (sel == -1) - { - value->kind = axs_rvalue; -@@ -1186,8 +1190,7 @@ - error (_("Invalid probe argument %d -- probe has %d arguments available"), - sel, n_probes); - -- objfile->sf->sym_probe_fns->sym_compile_to_ax (objfile, pc_probe, -- expr, value, sel); -+ pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel); - } - - -@@ -1297,6 +1300,7 @@ - - ret = obstack_alloc (&objfile->objfile_obstack, sizeof (*ret)); - ret->p.pops = &stap_probe_ops; -+ ret->p.objfile = objfile; - - /* Provider and the name of the probe. */ - ret->p.provider = &el->data[3 * size]; -@@ -1481,15 +1485,16 @@ - - static void - stap_gen_info_probes_table_values (struct probe *probe_generic, -- struct objfile *objfile, - VEC (const_char_ptr) **ret) - { - struct stap_probe *probe = (struct stap_probe *) probe_generic; -- struct gdbarch *gdbarch = get_objfile_arch (objfile); -+ struct gdbarch *gdbarch; - const char *val = NULL; - - gdb_assert (probe_generic->pops == &stap_probe_ops); - -+ gdbarch = get_objfile_arch (probe->p.objfile); -+ - if (probe->sem_addr) - val = print_core_address (gdbarch, probe->sem_addr); - ---- src/gdb/symfile.h 2012/05/24 22:14:35 1.109 -+++ src/gdb/symfile.h 2012/07/18 16:12:17 1.110 -@@ -320,8 +320,7 @@ - have come from a call to this objfile's sym_get_probes method. - If you provide an implementation of sym_get_probes, you must - implement this method as well. */ -- unsigned (*sym_get_probe_argument_count) (struct objfile *objfile, -- struct probe *probe); -+ unsigned (*sym_get_probe_argument_count) (struct probe *probe); - - /* Evaluate the Nth argument available to PROBE. PROBE will have - come from a call to this objfile's sym_get_probes method. N will -@@ -330,8 +329,7 @@ - PC will match the address of the probe. If you provide an - implementation of sym_get_probes, you must implement this method - as well. */ -- struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile, -- struct probe *probe, -+ struct value *(*sym_evaluate_probe_argument) (struct probe *probe, - unsigned n); - - /* Compile the Nth probe argument to an agent expression. PROBE -@@ -339,8 +337,7 @@ - method. N will be between 0 and the number of arguments - available to this probe. EXPR and VALUE are the agent expression - that is being updated. */ -- void (*sym_compile_to_ax) (struct objfile *objfile, -- struct probe *probe, -+ void (*sym_compile_to_ax) (struct probe *probe, - struct agent_expr *expr, - struct axs_value *value, - unsigned n); diff --git a/gdb-dlopen-stap-probe-2of7.patch b/gdb-dlopen-stap-probe-2of7.patch deleted file mode 100644 index 81b35e9..0000000 --- a/gdb-dlopen-stap-probe-2of7.patch +++ /dev/null @@ -1,74 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2012-07/msg00124.html - -### src/gdb/ChangeLog 2012/07/18 16:12:15 1.14474 -### src/gdb/ChangeLog 2012/07/18 16:20:36 1.14475 -## -1,5 +1,10 @@ - 2012-07-18 Sergio Durigan Junior - -+ * probe.c (probe_safe_evaluate_at_pc): Rename variable `n_probes'. -+ * stap-probe.c (compile_probe_arg): Likewise. -+ -+2012-07-18 Sergio Durigan Junior -+ - * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. - (elf_compile_to_ax): Likewise. - * infrun.c (insert_exception_resume_from_probe): Likewise. ---- src/gdb/probe.c 2012/07/18 16:12:17 1.4 -+++ src/gdb/probe.c 2012/07/18 16:20:43 1.5 -@@ -637,7 +637,7 @@ - { - struct probe *probe; - const struct sym_probe_fns *probe_fns; -- unsigned n_probes; -+ unsigned n_args; - - probe = find_probe_by_pc (get_frame_pc (frame)); - if (!probe) -@@ -648,9 +648,9 @@ - gdb_assert (probe->objfile->sf->sym_probe_fns != NULL); - - probe_fns = probe->objfile->sf->sym_probe_fns; -- n_probes = probe_fns->sym_get_probe_argument_count (probe); -+ n_args = probe_fns->sym_get_probe_argument_count (probe); - -- if (n >= n_probes) -+ if (n >= n_args) - return NULL; - - return probe_fns->sym_evaluate_probe_argument (probe, n); ---- src/gdb/stap-probe.c 2012/07/18 16:12:17 1.5 -+++ src/gdb/stap-probe.c 2012/07/18 16:20:43 1.6 -@@ -1160,7 +1160,7 @@ - int sel = (int) (uintptr_t) data; - struct probe *pc_probe; - const struct sym_probe_fns *pc_probe_fns; -- int n_probes; -+ int n_args; - - /* SEL == -1 means "_probe_argc". */ - gdb_assert (sel >= -1); -@@ -1175,20 +1175,20 @@ - - pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns; - -- n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe); -+ n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe); - - if (sel == -1) - { - value->kind = axs_rvalue; - value->type = builtin_type (expr->gdbarch)->builtin_int; -- ax_const_l (expr, n_probes); -+ ax_const_l (expr, n_args); - return; - } - - gdb_assert (sel >= 0); -- if (sel >= n_probes) -+ if (sel >= n_args) - error (_("Invalid probe argument %d -- probe has %d arguments available"), -- sel, n_probes); -+ sel, n_args); - - pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel); - } diff --git a/gdb-dlopen-stap-probe-3of7.patch b/gdb-dlopen-stap-probe-3of7.patch deleted file mode 100644 index 2337ded..0000000 --- a/gdb-dlopen-stap-probe-3of7.patch +++ /dev/null @@ -1,98 +0,0 @@ -2012-07-19 Gary Benson - - * probe.h (get_probe_argument_count): New declaration. - (evaluate_probe_argument): Likewise. - * probe.c (get_probe_argument_count): New function. - (evaluate_probe_argument): Likewise. - (probe_safe_evaluate_at_pc): Use the above new functions. - -diff --git a/gdb/probe.h b/gdb/probe.h -index 8d44ca2..1d29b87 100644 ---- a/gdb/probe.h -+++ b/gdb/probe.h -@@ -214,6 +214,16 @@ extern void info_probes_for_ops (char *arg, int from_tty, - - extern struct cmd_list_element **info_probes_cmdlist_get (void); - -+/* Return the argument count of the specified probe. */ -+ -+extern unsigned get_probe_argument_count (struct probe *probe); -+ -+/* Evaluate argument N of the specified probe. N must be between 0 -+ inclusive and get_probe_argument_count exclusive. */ -+ -+extern struct value *evaluate_probe_argument (struct probe *probe, -+ unsigned n); -+ - /* A convenience function that finds a probe at the PC in FRAME and - evaluates argument N, with 0 <= N < number_of_args. If there is no - probe at that location, or if the probe does not have enough arguments, -diff --git a/gdb/probe.c b/gdb/probe.c -index 77f3b13..a61f4ea 100644 ---- a/gdb/probe.c -+++ b/gdb/probe.c -@@ -632,28 +632,55 @@ info_probes_command (char *arg, int from_tty) - - /* See comments in probe.h. */ - -+unsigned -+get_probe_argument_count (struct probe *probe) -+{ -+ const struct sym_probe_fns *probe_fns; -+ -+ gdb_assert (probe->objfile != NULL); -+ gdb_assert (probe->objfile->sf != NULL); -+ -+ probe_fns = probe->objfile->sf->sym_probe_fns; -+ -+ gdb_assert (probe_fns != NULL); -+ -+ return probe_fns->sym_get_probe_argument_count (probe); -+} -+ -+/* See comments in probe.h. */ -+ -+struct value * -+evaluate_probe_argument (struct probe *probe, unsigned n) -+{ -+ const struct sym_probe_fns *probe_fns; -+ -+ gdb_assert (probe->objfile != NULL); -+ gdb_assert (probe->objfile->sf != NULL); -+ -+ probe_fns = probe->objfile->sf->sym_probe_fns; -+ -+ gdb_assert (probe_fns != NULL); -+ -+ return probe_fns->sym_evaluate_probe_argument (probe, n); -+} -+ -+/* See comments in probe.h. */ -+ - struct value * - probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n) - { - struct probe *probe; -- const struct sym_probe_fns *probe_fns; - unsigned n_args; - - probe = find_probe_by_pc (get_frame_pc (frame)); - if (!probe) - return NULL; - -- gdb_assert (probe->objfile != NULL); -- gdb_assert (probe->objfile->sf != NULL); -- gdb_assert (probe->objfile->sf->sym_probe_fns != NULL); -- -- probe_fns = probe->objfile->sf->sym_probe_fns; -- n_args = probe_fns->sym_get_probe_argument_count (probe); -- -+ n_args = get_probe_argument_count (probe); - if (n >= n_args) - return NULL; - -- return probe_fns->sym_evaluate_probe_argument (probe, n); -+ return evaluate_probe_argument (probe, n); - } - - /* See comment in probe.h. */ diff --git a/gdb-dlopen-stap-probe-4of7.patch b/gdb-dlopen-stap-probe-4of7.patch deleted file mode 100644 index 299931a..0000000 --- a/gdb-dlopen-stap-probe-4of7.patch +++ /dev/null @@ -1,131 +0,0 @@ -2012-07-19 Gary Benson - - * solib-svr4.c (svr4_info): Move earlier. - (solib_svr4_pspace_data): Likewise. - (svr4_pspace_data_cleanup): Likewise. - (get_svr4_info): Likewise. - -diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c -index 307e483..c88b9cb 100644 ---- a/gdb/solib-svr4.c -+++ b/gdb/solib-svr4.c -@@ -106,6 +106,59 @@ static const char * const main_name_list[] = - NULL - }; - -+/* Per pspace SVR4 specific data. */ -+ -+struct svr4_info -+{ -+ CORE_ADDR debug_base; /* Base of dynamic linker structures. */ -+ -+ /* Validity flag for debug_loader_offset. */ -+ int debug_loader_offset_p; -+ -+ /* Load address for the dynamic linker, inferred. */ -+ CORE_ADDR debug_loader_offset; -+ -+ /* Name of the dynamic linker, valid if debug_loader_offset_p. */ -+ char *debug_loader_name; -+ -+ /* Load map address for the main executable. */ -+ CORE_ADDR main_lm_addr; -+ -+ CORE_ADDR interp_text_sect_low; -+ CORE_ADDR interp_text_sect_high; -+ CORE_ADDR interp_plt_sect_low; -+ CORE_ADDR interp_plt_sect_high; -+}; -+ -+/* Per-program-space data key. */ -+static const struct program_space_data *solib_svr4_pspace_data; -+ -+static void -+svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) -+{ -+ struct svr4_info *info; -+ -+ info = program_space_data (pspace, solib_svr4_pspace_data); -+ xfree (info); -+} -+ -+/* Get the current svr4 data. If none is found yet, add it now. This -+ function always returns a valid object. */ -+ -+static struct svr4_info * -+get_svr4_info (void) -+{ -+ struct svr4_info *info; -+ -+ info = program_space_data (current_program_space, solib_svr4_pspace_data); -+ if (info != NULL) -+ return info; -+ -+ info = XZALLOC (struct svr4_info); -+ set_program_space_data (current_program_space, solib_svr4_pspace_data, info); -+ return info; -+} -+ - /* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent - the same shared library. */ - -@@ -291,59 +344,6 @@ lm_addr_check (struct so_list *so, bfd *abfd) - return so->lm_info->l_addr; - } - --/* Per pspace SVR4 specific data. */ -- --struct svr4_info --{ -- CORE_ADDR debug_base; /* Base of dynamic linker structures. */ -- -- /* Validity flag for debug_loader_offset. */ -- int debug_loader_offset_p; -- -- /* Load address for the dynamic linker, inferred. */ -- CORE_ADDR debug_loader_offset; -- -- /* Name of the dynamic linker, valid if debug_loader_offset_p. */ -- char *debug_loader_name; -- -- /* Load map address for the main executable. */ -- CORE_ADDR main_lm_addr; -- -- CORE_ADDR interp_text_sect_low; -- CORE_ADDR interp_text_sect_high; -- CORE_ADDR interp_plt_sect_low; -- CORE_ADDR interp_plt_sect_high; --}; -- --/* Per-program-space data key. */ --static const struct program_space_data *solib_svr4_pspace_data; -- --static void --svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) --{ -- struct svr4_info *info; -- -- info = program_space_data (pspace, solib_svr4_pspace_data); -- xfree (info); --} -- --/* Get the current svr4 data. If none is found yet, add it now. This -- function always returns a valid object. */ -- --static struct svr4_info * --get_svr4_info (void) --{ -- struct svr4_info *info; -- -- info = program_space_data (current_program_space, solib_svr4_pspace_data); -- if (info != NULL) -- return info; -- -- info = XZALLOC (struct svr4_info); -- set_program_space_data (current_program_space, solib_svr4_pspace_data, info); -- return info; --} -- - /* Local function prototypes */ - - static int match_main (const char *); diff --git a/gdb-dlopen-stap-probe-5of7.patch b/gdb-dlopen-stap-probe-5of7.patch deleted file mode 100644 index cb18cd6..0000000 --- a/gdb-dlopen-stap-probe-5of7.patch +++ /dev/null @@ -1,17 +0,0 @@ -2012-07-19 Gary Benson - - * solib-svr4.c (svr4_info): Made debug_loader_offset_p a bitfield. - -diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c -index c88b9cb..8e41f19 100644 ---- a/gdb/solib-svr4.c -+++ b/gdb/solib-svr4.c -@@ -113,7 +113,7 @@ struct svr4_info - CORE_ADDR debug_base; /* Base of dynamic linker structures. */ - - /* Validity flag for debug_loader_offset. */ -- int debug_loader_offset_p; -+ unsigned int debug_loader_offset_p : 1; - - /* Load address for the dynamic linker, inferred. */ - CORE_ADDR debug_loader_offset; diff --git a/gdb-dlopen-stap-probe-6of7.patch b/gdb-dlopen-stap-probe-6of7.patch deleted file mode 100644 index 574150e..0000000 --- a/gdb-dlopen-stap-probe-6of7.patch +++ /dev/null @@ -1,1989 +0,0 @@ -gdb/ -2012-07-30 Gary Benson - - * breakpoint.h (handle_solib_event): Moved function definition - to solib.h, and added a new parameter. - * breakpoint.c (handle_solib_event): Moved function to solib.c - and added a new parameter. - (bpstat_stop_status): Pass new argument to handle_solib_event. - * solib.h (breakpoint.h): New include. - (handle_solib_event): Moved function definition from breakpoint.h - and added a new parameter. - (update_solib_breakpoints): New function definition. - * solib.c (handle_solib_event): Moved function from breakpoint.c - and added a new parameter. - (update_solib_breakpoints): New function. - * solist.h (breakpoint.h): New include. - (target_so_ops): New fields "handle_solib_event" and - "update_breakpoints". - * infrun.c (set_stop_on_solib_events): New function. - (_initialize_infrun): Use the above for "set stop-on-solib-events". - (handle_inferior_event): Pass new argument to handle_solib_event. - * solib-svr4.c (probe.h): New include. - (namespace_table_flatten): New forward declaration. - (lm_info): New fields "lmid" and "in_initial_ns". - (probe_action): New enum. - (probe_info): New struct. - (probe_info): New static variable. - (NUM_PROBES): New definition. - (svr4_info): New fields "using_probes", "probes" and - "namespace_table". - (free_probes): New function. - (free_namespace_table): Likewise. - (svr4_pspace_data_cleanup): Free probes and namespace table. - (svr4_same): Also compare namespaces if using probes. - (lm_addr_check): Only print .dynamic section at wrong address - warning for initial namespace if using probes. - (r_map_from_debug_base): New function. - (solib_svr4_r_map): Call the above. - (svr4_read_so_list): New parameter "prev_lm". - Changed return type from void to int. - Return nonzero on success, zero on error. - (svr4_current_sos_from_debug_base): New function. - (svr4_current_sos): Create result from namespace table if available. - Use svr4_current_sos_from_debug_base to generate list otherwise. - (probe_and_info): New struct. - (solib_event_probe_at): New function. - (solib_event_probe_action): Likewise. - (namespace): New struct. - (hash_namespace): New function. - (equal_namespace): Likewise. - (free_namespace): Likewise. - (namespace_update_full): Likewise. - (namespace_update_incremental): Likewise. - (svr4_handle_solib_event): Likewise. - (namespace_table_flatten_helper): Likewise. - (namespace_table_flatten): Likewise. - (svr4_update_solib_event_breakpoint): Likewise. - (svr4_update_solib_event_breakpoints): Likewise. - (svr4_create_solib_event_breakpoints): Likewise. - (enable_break): Free probes before creating breakpoints. - Use svr4_create_solib_event_breakpoints to create breakpoints. - (svr4_solib_create_inferior_hook): Free the namespace table. - (_initialize_svr4_solib): Initialise svr4_so_ops.handle_solib_event - and svr4_so_ops.update_breakpoints. - -gdb/testsuite -2012-07-30 Gary Benson - - * gdb.base/break-interp.exp (solib_bp): New constant. - (reach_1): Use the above instead of "_dl_debug_state". - (test_attach): Likewise. - (test_ld): Likewise. - * gdb.base/break-probes.exp: New file. - * gdb.base/break-probes.c: Likewise. - * gdb.base/break-probes-solib.c: Likewise. - * gdb.base/info-shared.exp: New file. - * gdb.base/info-shared.c: Likewise. - * gdb.base/info-shared-solib1.c: Likewise. - * gdb.base/info-shared-solib2.c: Likewise. - * gdb.base/break-dlmopen.exp: Likewise. - * gdb.base/break-dlmopen.c: Likewise. - * gdb.base/break-dlmopen-solib.c: Likewise. - -Index: gdb-7.4.91.20120814/gdb/breakpoint.h -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/breakpoint.h 2012-08-14 17:31:37.050984427 +0200 -+++ gdb-7.4.91.20120814/gdb/breakpoint.h 2012-08-14 17:34:44.203746601 +0200 -@@ -1515,8 +1515,6 @@ extern int user_breakpoint_p (struct bre - /* Attempt to determine architecture of location identified by SAL. */ - extern struct gdbarch *get_sal_arch (struct symtab_and_line sal); - --extern void handle_solib_event (void); -- - extern void breakpoints_relocate (struct objfile *objfile, - struct section_offsets *delta); - -Index: gdb-7.4.91.20120814/gdb/breakpoint.c -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/breakpoint.c 2012-08-14 17:31:37.128984404 +0200 -+++ gdb-7.4.91.20120814/gdb/breakpoint.c 2012-08-14 17:34:44.211746597 +0200 -@@ -5205,7 +5205,7 @@ bpstat_stop_status (struct address_space - { - if (bs->breakpoint_at && bs->breakpoint_at->type == bp_shlib_event) - { -- handle_solib_event (); -+ handle_solib_event (bs); - break; - } - } -@@ -5301,25 +5301,6 @@ handle_jit_event (void) - target_terminal_inferior (); - } - --/* Handle an solib event by calling solib_add. */ -- --void --handle_solib_event (void) --{ -- clear_program_space_solib_cache (current_inferior ()->pspace); -- -- /* Check for any newly added shared libraries if we're supposed to -- be adding them automatically. Switch terminal for any messages -- produced by breakpoint_re_set. */ -- target_terminal_ours_for_output (); --#ifdef SOLIB_ADD -- SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); --#else -- solib_add (NULL, 0, ¤t_target, auto_solib_add); --#endif -- target_terminal_inferior (); --} -- - /* Prepare WHAT final decision for infrun. */ - - /* Decide what infrun needs to do with this bpstat. */ -Index: gdb-7.4.91.20120814/gdb/solib.h -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/solib.h 2012-02-03 16:19:37.000000000 +0100 -+++ gdb-7.4.91.20120814/gdb/solib.h 2012-08-14 17:34:44.257746587 +0200 -@@ -21,6 +21,9 @@ - #ifndef SOLIB_H - #define SOLIB_H - -+/* For bpstat. */ -+#include "breakpoint.h" -+ - /* Forward decl's for prototypes */ - struct so_list; - struct target_ops; -@@ -91,4 +94,15 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_f - void *), - void *data); - -+/* Handle an solib event by calling solib_add. Targets which handle -+ solib events using breakpoints must pass a valid bpstat. Targets -+ which handle solib events using some other mechanism should pass -+ NULL. */ -+ -+extern void handle_solib_event (bpstat bs); -+ -+/* Enable or disable optional solib event breakpoints as appropriate. */ -+ -+extern void update_solib_breakpoints (void); -+ - #endif /* SOLIB_H */ -Index: gdb-7.4.91.20120814/gdb/solib.c -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/solib.c 2012-08-14 17:31:36.832984492 +0200 -+++ gdb-7.4.91.20120814/gdb/solib.c 2012-08-14 17:34:44.272746583 +0200 -@@ -1226,6 +1226,42 @@ no_shared_libraries (char *ignored, int - objfile_purge_solibs (); - } - -+/* See solib.h. */ -+ -+void -+handle_solib_event (bpstat bs) -+{ -+ struct target_so_ops *ops = solib_ops (target_gdbarch); -+ -+ if (ops->handle_solib_event != NULL) -+ ops->handle_solib_event (bs); -+ -+ clear_program_space_solib_cache (current_inferior ()->pspace); -+ -+ /* Check for any newly added shared libraries if we're supposed to -+ be adding them automatically. Switch terminal for any messages -+ produced by breakpoint_re_set. */ -+ target_terminal_ours_for_output (); -+#ifdef SOLIB_ADD -+ SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); -+#else -+ solib_add (NULL, 0, ¤t_target, auto_solib_add); -+#endif -+ target_terminal_inferior (); -+} -+ -+/* See solib.h. */ -+ -+void -+update_solib_breakpoints (void) -+{ -+ struct target_so_ops *ops = solib_ops (target_gdbarch); -+ -+ if (ops->update_breakpoints != NULL) -+ ops->update_breakpoints (); -+} -+ -+ - /* Reload shared libraries, but avoid reloading the same symbol file - we already have loaded. */ - -Index: gdb-7.4.91.20120814/gdb/solist.h -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/solist.h 2012-01-04 09:17:11.000000000 +0100 -+++ gdb-7.4.91.20120814/gdb/solist.h 2012-08-14 17:34:44.273746584 +0200 -@@ -23,6 +23,8 @@ - #define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */ - /* For domain_enum domain. */ - #include "symtab.h" -+/* For bpstat. */ -+#include "breakpoint.h" - - /* Forward declaration for target specific link map information. This - struct is opaque to all but the target specific file. */ -@@ -149,6 +151,20 @@ struct target_so_ops - core file (in particular, for readonly sections). */ - int (*keep_data_in_core) (CORE_ADDR vaddr, - unsigned long size); -+ -+ /* Target-specific handling of solib events. For targets which -+ handle solib events using breakpoints a valid bpstat must be -+ passed. Targets which handle solib events using some other -+ mechanism should pass NULL. This pointer can be NULL, in which -+ case no specific handling is necessary for this target. */ -+ void (*handle_solib_event) (bpstat bs); -+ -+ /* Enable or disable optional solib event breakpoints as -+ appropriate. This should be called whenever -+ stop_on_solib_events is changed. This pointer can be -+ NULL, in which case no enabling or disabling is necessary -+ for this target. */ -+ void (*update_breakpoints) (void); - }; - - /* Free the memory associated with a (so_list *). */ -Index: gdb-7.4.91.20120814/gdb/infrun.c -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/infrun.c 2012-08-14 17:33:16.249955007 +0200 -+++ gdb-7.4.91.20120814/gdb/infrun.c 2012-08-14 17:34:44.276746583 +0200 -@@ -361,6 +361,16 @@ static struct symbol *step_start_functio - /* Nonzero if we want to give control to the user when we're notified - of shared library events by the dynamic linker. */ - int stop_on_solib_events; -+ -+/* Enable or disable optional shared library event breakpoints -+ as appropriate when the above flag is changed. */ -+ -+static void -+set_stop_on_solib_events (char *args, int from_tty, struct cmd_list_element *c) -+{ -+ update_solib_breakpoints (); -+} -+ - static void - show_stop_on_solib_events (struct ui_file *file, int from_tty, - struct cmd_list_element *c, const char *value) -@@ -3321,7 +3331,7 @@ handle_inferior_event (struct execution_ - context_switch (ecs->ptid); - regcache = get_thread_regcache (ecs->ptid); - -- handle_solib_event (); -+ handle_solib_event (NULL); - - ecs->event_thread->control.stop_bpstat - = bpstat_stop_status (get_regcache_aspace (regcache), -@@ -7226,7 +7236,7 @@ Show stopping for shared library events. - If nonzero, gdb will give control to the user when the dynamic linker\n\ - notifies gdb of shared library events. The most common event of interest\n\ - to the user would be loading/unloading of a new library."), -- NULL, -+ set_stop_on_solib_events, - show_stop_on_solib_events, - &setlist, &showlist); - -Index: gdb-7.4.91.20120814/gdb/solib-svr4.c -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/solib-svr4.c 2012-08-14 17:34:39.346752840 +0200 -+++ gdb-7.4.91.20120814/gdb/solib-svr4.c 2012-08-14 17:35:42.635732596 +0200 -@@ -47,10 +47,12 @@ - #include "auxv.h" - #include "exceptions.h" - #include "gdb_bfd.h" -+#include "probe.h" - - static struct link_map_offsets *svr4_fetch_link_map_offsets (void); - static int svr4_have_link_map_offsets (void); - static void svr4_relocate_main_executable (void); -+static struct so_list *namespace_table_flatten (htab_t namespace_table); - - /* Link map info to include in an allocated so_list entry. */ - -@@ -71,6 +73,16 @@ struct lm_info - - /* Values read in from inferior's fields of the same name. */ - CORE_ADDR l_ld, l_next, l_prev, l_name; -+ -+ /* Numeric link-map ID of the namespace this object is loaded -+ into. This value is only valid when using the probes-based -+ interface. */ -+ LONGEST lmid; -+ -+ /* Nonzero if the namespace list this object is loaded into is the -+ application's initial namespace (LM_ID_BASE). This value is -+ only valid when using the probes-based interface. */ -+ unsigned int in_initial_ns : 1; - }; - - /* On SVR4 systems, a list of symbols in the dynamic linker where -@@ -107,6 +119,53 @@ static const char * const main_name_lis - NULL - }; - -+/* What to do with the namespace table when a probe stop occurs. */ -+ -+enum probe_action -+ { -+ /* Something went seriously wrong. Stop using probes and -+ revert to using the older interface. */ -+ NAMESPACE_TABLE_INVALIDATE, -+ -+ /* No action is required. This namespace is still valid. */ -+ NAMESPACE_NO_ACTION, -+ -+ /* This namespace should be reloaded entirely. */ -+ NAMESPACE_RELOAD, -+ -+ /* Attempt to incrementally update this namespace. If the -+ update fails or is not possible, fall back to reloading -+ the namespace in full. */ -+ NAMESPACE_UPDATE_OR_RELOAD, -+ }; -+ -+/* A probe's name and its associated action. */ -+ -+struct probe_info -+{ -+ /* The name of the probe. */ -+ const char *name; -+ -+ /* What to do with the namespace table when a probe stop occurs. */ -+ enum probe_action action; -+}; -+ -+/* A list of named probes and their associated actions. If all -+ probes are present in the dynamic linker then the probes-based -+ interface will be used. */ -+ -+static const struct probe_info probe_info[] = -+{ -+ { "init_start", NAMESPACE_NO_ACTION }, -+ { "init_complete", NAMESPACE_RELOAD }, -+ { "map_start", NAMESPACE_NO_ACTION }, -+ { "reloc_complete", NAMESPACE_UPDATE_OR_RELOAD }, -+ { "unmap_start", NAMESPACE_NO_ACTION }, -+ { "unmap_complete", NAMESPACE_RELOAD }, -+}; -+ -+#define NUM_PROBES ARRAY_SIZE (probe_info) -+ - /* Per pspace SVR4 specific data. */ - - struct svr4_info -@@ -129,17 +188,58 @@ struct svr4_info - CORE_ADDR interp_text_sect_high; - CORE_ADDR interp_plt_sect_low; - CORE_ADDR interp_plt_sect_high; -+ -+ /* Nonzero if we are using the probes-based interface. */ -+ unsigned int using_probes : 1; -+ -+ /* Named probes in the dynamic linker. */ -+ VEC (probe_p) *probes[NUM_PROBES]; -+ -+ /* Table of dynamic linker namespaces, used by the probes-based -+ interface. */ -+ htab_t namespace_table; - }; - - /* Per-program-space data key. */ - static const struct program_space_data *solib_svr4_pspace_data; - -+/* Free any allocated probe vectors. */ -+ -+static void -+free_probes (struct svr4_info *info) -+{ -+ int i; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ VEC_free (probe_p, info->probes[i]); -+ -+ memset (info->probes, 0, sizeof (info->probes)); -+} -+ -+/* Free the namespace table. */ -+ -+static void -+free_namespace_table (struct svr4_info *info) -+{ -+ if (info->namespace_table == NULL) -+ return; -+ -+ htab_delete (info->namespace_table); -+ info->namespace_table = NULL; -+} -+ - static void - svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) - { - struct svr4_info *info; - - info = program_space_data (pspace, solib_svr4_pspace_data); -+ if (info == NULL) -+ return; -+ -+ free_probes (info); -+ free_namespace_table (info); -+ - xfree (info); - } - -@@ -188,10 +288,21 @@ svr4_same_1 (const char *gdb_so_name, co - return 0; - } - -+/* Return non-zero if GDB and INFERIOR represent the same shared -+ library. */ -+ - static int - svr4_same (struct so_list *gdb, struct so_list *inferior) - { -- return (svr4_same_1 (gdb->so_original_name, inferior->so_original_name)); -+ struct svr4_info *info = get_svr4_info (); -+ -+ if (info->using_probes) -+ { -+ if (gdb->lm_info->lmid != inferior->lm_info->lmid) -+ return 0; -+ } -+ -+ return svr4_same_1 (gdb->so_original_name, inferior->so_original_name); - } - - static struct lm_info * -@@ -322,18 +433,26 @@ lm_addr_check (struct so_list *so, bfd * - } - else - { -- /* There is no way to verify the library file matches. prelink -- can during prelinking of an unprelinked file (or unprelinking -- of a prelinked file) shift the DYNAMIC segment by arbitrary -- offset without any page size alignment. There is no way to -- find out the ELF header and/or Program Headers for a limited -- verification if it they match. One could do a verification -- of the DYNAMIC segment. Still the found address is the best -- one GDB could find. */ -- -- warning (_(".dynamic section for \"%s\" " -- "is not at the expected address " -- "(wrong library or version mismatch?)"), so->so_name); -+ struct svr4_info *info = get_svr4_info (); -+ -+ if (!info->using_probes || so->lm_info->in_initial_ns) -+ { -+ /* There is no way to verify the library file -+ matches. prelink can during prelinking of an -+ unprelinked file (or unprelinking of a prelinked -+ file) shift the DYNAMIC segment by arbitrary -+ offset without any page size alignment. There is -+ no way to find out the ELF header and/or Program -+ Headers for a limited verification if it they -+ match. One could do a verification of the -+ DYNAMIC segment. Still the found address is the -+ best one GDB could find. */ -+ -+ warning (_(".dynamic section for \"%s\" " -+ "is not at the expected address " -+ "(wrong library or version mismatch?)"), -+ so->so_name); -+ } - } - } - -@@ -775,16 +894,10 @@ locate_base (struct svr4_info *info) - return info->debug_base; - } - --/* Find the first element in the inferior's dynamic link map, and -- return its address in the inferior. Return zero if the address -- could not be determined. -- -- FIXME: Perhaps we should validate the info somehow, perhaps by -- checking r_version for a known version number, or r_state for -- RT_CONSISTENT. */ -+/* Read the r_map field from the supplied r_debug structure. */ - - static CORE_ADDR --solib_svr4_r_map (struct svr4_info *info) -+r_map_from_debug_base (CORE_ADDR debug_base) - { - struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); - struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; -@@ -793,13 +906,27 @@ solib_svr4_r_map (struct svr4_info *info - - TRY_CATCH (ex, RETURN_MASK_ERROR) - { -- addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset, -+ addr = read_memory_typed_address (debug_base + lmo->r_map_offset, - ptr_type); - } - exception_print (gdb_stderr, ex); - return addr; - } - -+/* Find the first element in the inferior's dynamic link map, and -+ return its address in the inferior. Return zero if the address -+ could not be determined. -+ -+ FIXME: Perhaps we should validate the info somehow, perhaps by -+ checking r_version for a known version number, or r_state for -+ RT_CONSISTENT. */ -+ -+static CORE_ADDR -+solib_svr4_r_map (struct svr4_info *info) -+{ -+ return r_map_from_debug_base (info->debug_base); -+} -+ - /* Find r_brk from the inferior's debug base. */ - - static CORE_ADDR -@@ -1164,15 +1291,17 @@ svr4_default_sos (void) - return new; - } - --/* Read the whole inferior libraries chain starting at address LM. Add the -- entries to the tail referenced by LINK_PTR_PTR. Ignore the first entry if -- IGNORE_FIRST and set global MAIN_LM_ADDR according to it. */ -+/* Read the whole inferior libraries chain starting at address LM. -+ Expect the first entry in the chain's previous entry to be PREV_LM. -+ Add the entries to the tail referenced by LINK_PTR_PTR. Ignore the -+ first entry if IGNORE_FIRST and set global MAIN_LM_ADDR according -+ to it. Returns nonzero upon success. */ - --static void --svr4_read_so_list (CORE_ADDR lm, struct so_list ***link_ptr_ptr, -- int ignore_first) -+static int -+svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, -+ struct so_list ***link_ptr_ptr, int ignore_first) - { -- CORE_ADDR prev_lm = 0, next_lm; -+ CORE_ADDR next_lm; - - for (; lm != 0; prev_lm = lm, lm = next_lm) - { -@@ -1189,7 +1318,7 @@ svr4_read_so_list (CORE_ADDR lm, struct - if (new->lm_info == NULL) - { - do_cleanups (old_chain); -- break; -+ return 0; - } - - next_lm = new->lm_info->l_next; -@@ -1200,7 +1329,7 @@ svr4_read_so_list (CORE_ADDR lm, struct - paddress (target_gdbarch, prev_lm), - paddress (target_gdbarch, new->lm_info->l_prev)); - do_cleanups (old_chain); -- break; -+ return 0; - } - - /* For SVR4 versions, the first entry in the link map is for the -@@ -1295,20 +1424,61 @@ svr4_read_so_list (CORE_ADDR lm, struct - **link_ptr_ptr = new; - *link_ptr_ptr = &new->next; - } -+ -+ return 1; - } - --/* Implement the "current_sos" target_so_ops method. */ -+/* Read the list of loaded libraries from the dynamic linker's base -+ structure. */ - - static struct so_list * --svr4_current_sos (void) -+svr4_current_sos_from_debug_base (void) - { -+ struct svr4_info *info = get_svr4_info (); - CORE_ADDR lm; - struct so_list *head = NULL; - struct so_list **link_ptr = &head; -- struct svr4_info *info; - struct cleanup *back_to; - int ignore_first; -+ -+ gdb_assert (info->debug_base); -+ -+ /* Assume that everything is a library if the dynamic loader was loaded -+ late by a static executable. */ -+ if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) -+ ignore_first = 0; -+ else -+ ignore_first = 1; -+ -+ back_to = make_cleanup (svr4_free_library_list, &head); -+ -+ /* Walk the inferior's link map list, and build our list of -+ `struct so_list' nodes. */ -+ lm = solib_svr4_r_map (info); -+ if (lm) -+ svr4_read_so_list (lm, 0, &link_ptr, ignore_first); -+ -+ /* On Solaris, the dynamic linker is not in the normal list of -+ shared objects, so make sure we pick it up too. Having -+ symbol information for the dynamic linker is quite crucial -+ for skipping dynamic linker resolver code. */ -+ lm = solib_svr4_r_ldsomap (info); -+ if (lm) -+ svr4_read_so_list (lm, 0, &link_ptr, 0); -+ -+ discard_cleanups (back_to); -+ -+ return head; -+} -+ -+/* Implement the "current_sos" target_so_ops method. */ -+ -+static struct so_list * -+svr4_current_sos (void) -+{ -+ struct svr4_info *info; - struct svr4_library_list library_list; -+ struct so_list *result; - - /* Fall back to manual examination of the target if the packet is not - supported or gdbserver failed to find DT_DEBUG. gdb.server/solib-list.exp -@@ -1331,6 +1501,10 @@ svr4_current_sos (void) - - info = get_svr4_info (); - -+ /* If we have a namespace table then return a flattened copy. */ -+ if (info->namespace_table != NULL) -+ return namespace_table_flatten (info->namespace_table); -+ - /* Always locate the debug struct, in case it has moved. */ - info->debug_base = 0; - locate_base (info); -@@ -1340,35 +1514,12 @@ svr4_current_sos (void) - if (! info->debug_base) - return svr4_default_sos (); - -- /* Assume that everything is a library if the dynamic loader was loaded -- late by a static executable. */ -- if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) -- ignore_first = 0; -- else -- ignore_first = 1; -- -- back_to = make_cleanup (svr4_free_library_list, &head); -- -- /* Walk the inferior's link map list, and build our list of -- `struct so_list' nodes. */ -- lm = solib_svr4_r_map (info); -- if (lm) -- svr4_read_so_list (lm, &link_ptr, ignore_first); -- -- /* On Solaris, the dynamic linker is not in the normal list of -- shared objects, so make sure we pick it up too. Having -- symbol information for the dynamic linker is quite crucial -- for skipping dynamic linker resolver code. */ -- lm = solib_svr4_r_ldsomap (info); -- if (lm) -- svr4_read_so_list (lm, &link_ptr, 0); -- -- discard_cleanups (back_to); -+ result = svr4_current_sos_from_debug_base (); - -- if (head == NULL) -+ if (result == NULL) - return svr4_default_sos (); - -- return head; -+ return result; - } - - /* Get the address of the link_map for a given OBJFILE. */ -@@ -1450,6 +1601,498 @@ exec_entry_point (struct bfd *abfd, stru - targ); - } - -+/* A probe and its associated information structure. */ -+ -+struct probe_and_info -+{ -+ /* The probe. */ -+ struct probe *probe; -+ -+ /* The probe_info from which the probe was created. */ -+ const struct probe_info *info; -+}; -+ -+/* Get the solib event probe at the specified location, and the -+ probe_info the probe was created with. Fills in RESULT and -+ returns nonzero if a solib event probe was found at the -+ specified location. Returns zero if no solib event probe -+ was found. */ -+ -+static int -+solib_event_probe_at (struct svr4_info *info, struct bp_location *loc, -+ struct probe_and_info *result) -+{ -+ int i; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ { -+ struct probe *probe; -+ int ix; -+ -+ for (ix = 0; VEC_iterate (probe_p, info->probes[i], ix, probe); ++ix) -+ { -+ if (loc->pspace == current_program_space -+ && loc->address == probe->address) -+ { -+ result->info = &probe_info[i]; -+ result->probe = probe; -+ -+ return 1; -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+/* Decide what action to take when the specified solib event probe is -+ hit. */ -+ -+static enum probe_action -+solib_event_probe_action (struct probe_and_info *pi) -+{ -+ enum probe_action action; -+ unsigned probe_argc; -+ -+ action = pi->info->action; -+ if (action == NAMESPACE_NO_ACTION || action == NAMESPACE_TABLE_INVALIDATE) -+ return action; -+ -+ gdb_assert (action == NAMESPACE_RELOAD -+ || action == NAMESPACE_UPDATE_OR_RELOAD); -+ -+ /* Check that an appropriate number of arguments has been supplied. -+ We expect: -+ arg0: Lmid_t lmid (mandatory) -+ arg1: struct r_debug *debug_base (mandatory) -+ arg2: struct link_map *new (optional, for incremental updates) */ -+ probe_argc = get_probe_argument_count (pi->probe); -+ if (probe_argc == 2) -+ action = NAMESPACE_RELOAD; -+ else if (probe_argc < 2) -+ action = NAMESPACE_TABLE_INVALIDATE; -+ -+ return action; -+} -+ -+/* A namespace in the dynamic linker. */ -+ -+struct namespace -+{ -+ /* Numeric link-map ID of the namespace. */ -+ LONGEST lmid; -+ -+ /* List of objects loaded into the namespace. */ -+ struct so_list *solist; -+}; -+ -+/* Returns a hash code for the namespace referenced by p. */ -+ -+static hashval_t -+hash_namespace (const void *p) -+{ -+ const struct namespace *ns = p; -+ -+ return (hashval_t) ns->lmid; -+} -+ -+/* Returns non-zero if the namespaces referenced by p1 and p2 -+ are equal. */ -+ -+static int -+equal_namespace (const void *p1, const void *p2) -+{ -+ const struct namespace *ns1 = p1; -+ const struct namespace *ns2 = p2; -+ -+ return ns1->lmid == ns2->lmid; -+} -+ -+/* Free a namespace. */ -+ -+static void -+free_namespace (void *p) -+{ -+ struct namespace *ns = p; -+ -+ svr4_free_library_list (ns->solist); -+ xfree (ns); -+} -+ -+/* Populate this namespace by reading the entire list of shared -+ objects from the inferior. Returns nonzero on success. */ -+ -+static int -+namespace_update_full (struct svr4_info *info, LONGEST lmid, -+ CORE_ADDR debug_base, int is_initial_ns) -+{ -+ struct so_list *result = NULL, *so; -+ struct namespace lookup, *ns; -+ void **slot; -+ -+ /* Read the list of shared objects from the inferior. The -+ initial namespace requires extra processing and is handled -+ separately. */ -+ if (is_initial_ns) -+ { -+ result = svr4_current_sos_from_debug_base (); -+ } -+ else -+ { -+ CORE_ADDR lm = r_map_from_debug_base (debug_base); -+ struct so_list **link_ptr = &result; -+ -+ if (!svr4_read_so_list (lm, 0, &link_ptr, 0)) -+ return 0; -+ } -+ -+ /* If the namespace is empty then delete it from the table. */ -+ if (result == NULL) -+ { -+ if (info->namespace_table != NULL) -+ { -+ lookup.lmid = lmid; -+ htab_remove_elt (info->namespace_table, &lookup); -+ } -+ -+ return 1; -+ } -+ -+ /* Fill in the link-map IDs and initial namespace flags. */ -+ for (so = result; so; so = so->next) -+ { -+ so->lm_info->lmid = lmid; -+ so->lm_info->in_initial_ns = is_initial_ns; -+ } -+ -+ /* Create the namespace table, if necessary. */ -+ if (info->namespace_table == NULL) -+ { -+ info->namespace_table = htab_create_alloc (1, hash_namespace, -+ equal_namespace, -+ free_namespace, -+ xcalloc, xfree); -+ } -+ -+ /* Update the namespace table with our new list. */ -+ lookup.lmid = lmid; -+ slot = htab_find_slot (info->namespace_table, &lookup, INSERT); -+ if (*slot == HTAB_EMPTY_ENTRY) -+ { -+ ns = XCNEW (struct namespace); -+ ns->lmid = lmid; -+ *slot = ns; -+ } -+ else -+ { -+ ns = *slot; -+ svr4_free_library_list (ns->solist); -+ } -+ ns->solist = result; -+ -+ return 1; -+} -+ -+/* Update this namespace starting from the link-map entry passed by -+ the linker in the probe's third argument. Returns nonzero if the -+ list was successfully updated, or zero to indicate failure. */ -+ -+static int -+namespace_update_incremental (struct svr4_info *info, LONGEST lmid, -+ CORE_ADDR lm, int is_initial_ns) -+{ -+ struct namespace lookup, *ns; -+ struct so_list *tail, **link, *so; -+ struct value *val; -+ -+ /* Find our namespace in the table. */ -+ if (info->namespace_table == NULL) -+ return 0; -+ -+ lookup.lmid = lmid; -+ ns = htab_find (info->namespace_table, &lookup); -+ if (ns == NULL) -+ return 0; -+ -+ /* Walk to the end of the list. */ -+ tail = ns->solist; -+ if (tail == NULL) -+ return 0; -+ -+ while (tail->next) -+ tail = tail->next; -+ link = &tail->next; -+ -+ /* Read the new objects. */ -+ if (!svr4_read_so_list (lm, tail->lm_info->lm_addr, &link, 0)) -+ return 0; -+ -+ /* Fill in the link-map IDs and initial namespace flags. */ -+ for (so = tail; so; so = so->next) -+ { -+ so->lm_info->lmid = lmid; -+ so->lm_info->in_initial_ns = is_initial_ns; -+ } -+ -+ return 1; -+} -+ -+/* Update the namespace table as appropriate when using the -+ probes-based linker interface. Do nothing if using the -+ standard interface. */ -+ -+static void -+svr4_handle_solib_event (bpstat bs) -+{ -+ struct svr4_info *info = get_svr4_info (); -+ struct probe_and_info buf, *pi = &buf; -+ enum probe_action action; -+ struct value *val; -+ LONGEST lmid; -+ CORE_ADDR debug_base, lm = 0; -+ int is_initial_ns; -+ -+ /* It is possible that this function will be called incorrectly -+ by the handle_solib_event in handle_inferior_event if GDB goes -+ fully multi-target. */ -+ gdb_assert (bs != NULL); -+ -+ if (!info->using_probes) -+ return; -+ -+ if (!solib_event_probe_at (info, bs->bp_location_at, pi)) -+ goto error; -+ -+ action = solib_event_probe_action (pi); -+ if (action == NAMESPACE_TABLE_INVALIDATE) -+ goto error; -+ -+ if (action == NAMESPACE_NO_ACTION) -+ return; -+ -+ val = evaluate_probe_argument (pi->probe, 0); -+ if (val == NULL) -+ goto error; -+ -+ lmid = value_as_long (val); -+ -+ val = evaluate_probe_argument (pi->probe, 1); -+ if (val == NULL) -+ goto error; -+ -+ debug_base = value_as_address (val); -+ if (debug_base == 0) -+ goto error; -+ -+ /* Always locate the debug struct, in case it moved. */ -+ info->debug_base = 0; -+ if (locate_base (info) == 0) -+ goto error; -+ -+ is_initial_ns = (debug_base == info->debug_base); -+ -+ if (action == NAMESPACE_UPDATE_OR_RELOAD) -+ { -+ val = evaluate_probe_argument (pi->probe, 2); -+ if (val != NULL) -+ lm = value_as_address (val); -+ -+ if (lm == 0) -+ action = NAMESPACE_RELOAD; -+ } -+ -+ if (action == NAMESPACE_UPDATE_OR_RELOAD) -+ { -+ if (namespace_update_incremental (info, lmid, lm, is_initial_ns)) -+ return; -+ -+ action = NAMESPACE_RELOAD; -+ } -+ -+ gdb_assert (action == NAMESPACE_RELOAD); -+ -+ if (namespace_update_full (info, lmid, debug_base, is_initial_ns)) -+ return; -+ -+ error: -+ -+ /* We should never reach here, but if we do we disable the -+ probes interface and revert to the original interface. -+ We don't reset the breakpoints as the ones we've set up -+ are adequate. */ -+ warning (_("Probes-based dynamic linker interface failed.\n" -+ "Reverting to original interface.\n")); -+ -+ free_namespace_table (info); -+ free_probes (info); -+ info->using_probes = 0; -+} -+ -+/* Helper function for namespace_table_flatten. */ -+ -+static int -+namespace_table_flatten_helper (void **slot, void *arg) -+{ -+ struct namespace *ns = (struct namespace *) *slot; -+ struct so_list *src = ns->solist; -+ struct so_list **link = (struct so_list **) arg; -+ -+ while (*link) -+ link = &(*link)->next; -+ -+ while (src != NULL) -+ { -+ struct so_list *dst; -+ -+ dst = xmalloc (sizeof (struct so_list)); -+ memcpy (dst, src, sizeof (struct so_list)); -+ -+ dst->lm_info = xmalloc (sizeof (struct lm_info)); -+ memcpy (dst->lm_info, src->lm_info, sizeof (struct lm_info)); -+ -+ *link = dst; -+ link = &dst->next; -+ -+ src = src->next; -+ } -+ -+ *link = NULL; -+ -+ return 1; /* Continue traversal. */ -+} -+ -+/* Flatten the namespace table into a single list. */ -+ -+static struct so_list * -+namespace_table_flatten (htab_t namespace_table) -+{ -+ struct so_list *dst = NULL; -+ -+ htab_traverse (namespace_table, namespace_table_flatten_helper, &dst); -+ -+ return dst; -+} -+ -+/* Helper function for svr4_update_solib_event_breakpoints. */ -+ -+static int -+svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg) -+{ -+ struct svr4_info *info = get_svr4_info (); -+ struct bp_location *loc; -+ -+ if (b->type != bp_shlib_event) -+ return 0; /* Continue iterating. */ -+ -+ for (loc = b->loc; loc; loc = loc->next) -+ { -+ struct probe_and_info buf, *pi = &buf; -+ -+ if (solib_event_probe_at (info, loc, pi)) -+ { -+ if (pi->info->action == NAMESPACE_NO_ACTION) -+ b->enable_state = (stop_on_solib_events -+ ? bp_enabled : bp_disabled); -+ -+ return 0; /* Continue iterating. */ -+ } -+ } -+ -+ return 0; /* Continue iterating. */ -+} -+ -+/* Enable or disable optional solib event breakpoints as appropriate. -+ Called whenever stop_on_solib_events is changed. */ -+ -+static void -+svr4_update_solib_event_breakpoints (void) -+{ -+ struct svr4_info *info = get_svr4_info (); -+ -+ if (info->using_probes) -+ iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL); -+} -+ -+/* Both the SunOS and the SVR4 dynamic linkers call a marker function -+ before and after mapping and unmapping shared libraries. The sole -+ purpose of this method is to allow debuggers to set a breakpoint so -+ they can track these changes. -+ -+ Some versions of the glibc dynamic linker contain named probes -+ to allow more fine grained stopping. Given the address of the -+ original marker function, this function attempts to find these -+ probes, and if found, sets breakpoints on those instead. If the -+ probes aren't found, a single breakpoint is set on the original -+ marker function. */ -+ -+static void -+svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch, -+ CORE_ADDR address) -+{ -+ struct svr4_info *info = get_svr4_info (); -+ struct obj_section *os; -+ -+ os = find_pc_section (address); -+ if (os != NULL) -+ { -+ int with_prefix; -+ -+ for (with_prefix = 0; with_prefix <= 1; with_prefix++) -+ { -+ int all_probes_found = 1; -+ int i; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ { -+ char name[32] = { '\0' }; -+ -+ /* Fedora 17, RHEL 6.2, and RHEL 6.3 shipped with an -+ early version of the probes code in which the probes' -+ names were prefixed with "rtld_". The locations and -+ arguments of the probes are otherwise the same, so we -+ check for the prefixed version if the unprefixed -+ probes are not found. */ -+ -+ if (with_prefix) -+ strncat (name, "rtld_", sizeof (name)); -+ -+ strncat (name, probe_info[i].name, sizeof (name) - sizeof ("rtld_")); -+ -+ info->probes[i] = find_probes_in_objfile (os->objfile, "rtld", -+ name); -+ -+ if (!VEC_length (probe_p, info->probes[i])) -+ { -+ free_probes (info); -+ all_probes_found = 0; -+ break; -+ } -+ } -+ -+ if (all_probes_found) -+ { -+ info->using_probes = 1; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ { -+ struct probe *probe; -+ int ix; -+ -+ for (ix = 0; -+ VEC_iterate (probe_p, info->probes[i], ix, probe); -+ ++ix) -+ create_solib_event_breakpoint (gdbarch, probe->address); -+ } -+ -+ svr4_update_solib_event_breakpoints (); -+ return; -+ } -+ } -+ } -+ -+ create_solib_event_breakpoint (gdbarch, address); -+} -+ - /* Helper function for gdb_bfd_lookup_symbol. */ - - static int -@@ -1502,6 +2145,9 @@ enable_break (struct svr4_info *info, in - info->interp_text_sect_low = info->interp_text_sect_high = 0; - info->interp_plt_sect_low = info->interp_plt_sect_high = 0; - -+ free_probes (info); -+ info->using_probes = 0; -+ - /* If we already have a shared library list in the target, and - r_debug contains r_brk, set the breakpoint there - this should - mean r_brk has already been relocated. Assume the dynamic linker -@@ -1533,7 +2179,7 @@ enable_break (struct svr4_info *info, in - That knowledge is encoded in the address, if it's Thumb the low bit - is 1. However, we've stripped that info above and it's not clear - what all the consequences are of passing a non-addr_bits_remove'd -- address to create_solib_event_breakpoint. The call to -+ address to svr4_create_solib_event_breakpoints. The call to - find_pc_section verifies we know about the address and have some - hope of computing the right kind of breakpoint to use (via - symbol info). It does mean that GDB needs to be pointed at a -@@ -1571,7 +2217,7 @@ enable_break (struct svr4_info *info, in - + bfd_section_size (tmp_bfd, interp_sect); - } - -- create_solib_event_breakpoint (target_gdbarch, sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); - return 1; - } - } -@@ -1729,7 +2375,8 @@ enable_break (struct svr4_info *info, in - - if (sym_addr != 0) - { -- create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, -+ load_addr + sym_addr); - xfree (interp_name); - return 1; - } -@@ -1755,7 +2402,7 @@ enable_break (struct svr4_info *info, in - sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, - sym_addr, - ¤t_target); -- create_solib_event_breakpoint (target_gdbarch, sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); - return 1; - } - } -@@ -1771,7 +2418,7 @@ enable_break (struct svr4_info *info, in - sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, - sym_addr, - ¤t_target); -- create_solib_event_breakpoint (target_gdbarch, sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); - return 1; - } - } -@@ -2281,6 +2928,9 @@ svr4_solib_create_inferior_hook (int fro - - info = get_svr4_info (); - -+ /* Free the probes-based interface's namespace table. */ -+ free_namespace_table (info); -+ - /* Relocate the main executable if necessary. */ - svr4_relocate_main_executable (); - -@@ -2547,4 +3197,6 @@ _initialize_svr4_solib (void) - svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol; - svr4_so_ops.same = svr4_same; - svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core; -+ svr4_so_ops.handle_solib_event = svr4_handle_solib_event; -+ svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints; - } -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen-solib.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen-solib.c 2012-08-14 17:34:44.330746591 +0200 -@@ -0,0 +1,24 @@ -+/* Copyright 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 . */ -+ -+#include -+ -+int -+foo (int n) -+{ -+ printf ("foo %d\n", n); -+ -+ return 0; -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.c 2012-08-14 17:34:44.339746576 +0200 -@@ -0,0 +1,58 @@ -+/* Copyright 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 . */ -+ -+#define _GNU_SOURCE -+#include -+ -+void -+stop () -+{ -+} -+ -+int -+main () -+{ -+ void *handle1, *handle2, *handle3; -+ void (*func)(int); -+ -+ handle1 = dlmopen (LM_ID_NEWLM, SHLIB_NAME, RTLD_LAZY); -+ stop (); -+ -+ func = (void (*)(int)) dlsym (handle1, "foo"); -+ func (1); -+ -+ handle2 = dlmopen (LM_ID_NEWLM, SHLIB_NAME, RTLD_LAZY); -+ stop (); -+ -+ func = (void (*)(int)) dlsym (handle2, "foo"); -+ func (2); -+ -+ handle3 = dlopen (SHLIB_NAME, RTLD_LAZY); -+ stop (); -+ -+ func = (void (*)(int)) dlsym (handle3, "foo"); -+ func (3); -+ -+ dlclose (handle1); -+ stop (); -+ -+ dlclose (handle2); -+ stop (); -+ -+ dlclose (handle3); -+ stop (); -+ -+ return 0; -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.exp 2012-08-14 17:34:44.343746563 +0200 -@@ -0,0 +1,125 @@ -+# Copyright 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 . -+ -+if { [skip_shlib_tests] || [is_remote target] } { -+ return 0 -+} -+ -+standard_testfile -+ -+set libname $testfile-solib -+set srcfile_lib $srcdir/$subdir/$libname.c -+set binfile_lib [standard_output_file $libname.so] -+ -+set normal_bp "_dl_debug_state" -+set probes_bp "dl_main" -+ -+if { [gdb_compile_shlib $srcfile_lib $binfile_lib \ -+ [list additional_flags=-fPIC]] != "" } { -+ untested "Could not compile $binfile_lib." -+ return -1 -+} -+ -+if { [prepare_for_testing $testfile.exp $testfile $srcfile \ -+ [list additional_flags=-DSHLIB_NAME\=\"$binfile_lib\" libs=-ldl]] } { -+ return -1 -+} -+ -+# Run "info sharedlibrary" and check our library is shown the expected -+# number of times. -+proc check_info_shared { test expect } { -+ global libname -+ global gdb_prompt -+ -+ set actual 0 -+ -+ gdb_test_multiple "info sharedlibrary" $test { -+ -re $libname { -+ incr actual 1 -+ exp_continue -+ } -+ -re "\r\n$gdb_prompt $" { -+ if { $actual == $expect } { -+ pass $test -+ } else { -+ fail $test -+ } -+ } -+ } -+} -+ -+# Enable stop-on-solib-events -+gdb_test_no_output "set stop-on-solib-events 1" -+ -+# Run to the first stop -+gdb_test "run" ".*Stopped due to shared library event.*" -+ -+# XFAIL if we are not using probes -+set test "ensure using probes" -+set using_probes 0 -+gdb_test_multiple "bt" $test { -+ -re "#0 +\[^\r\n\]*\\m(__GI_)?$normal_bp\\M.*$gdb_prompt $" { -+ xfail $test -+ } -+ -re "#0 +\[^\r\n\]*\\m(__GI_)?$probes_bp\\M.*$gdb_prompt $" { -+ pass $test -+ set using_probes 1 -+ } -+} -+ -+if { $using_probes } { -+ # Set up breakpoints. -+ gdb_test_no_output "set stop-on-solib-events 0" -+ gdb_test "break stop" {Breakpoint [0-9]+ at .*} -+ gdb_test_no_output "set breakpoint pending on" -+ gdb_test "break foo" {Breakpoint [0-9]+ \(foo\) pending\.} -+ -+ # Check our library isn't loaded. -+ check_info_shared "info sharedlibrary #1" 0 -+ -+ # Run to the first stop and check our library loaded. -+ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+ check_info_shared "info sharedlibrary #2" 1 -+ -+ # The next stop should be the function in the library. -+ gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} -+ -+ # Run to the next stop and check our library is now loaded twice. -+ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+ check_info_shared "info sharedlibrary #3" 2 -+ -+ # The next stop should be the function in the library. -+ gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} -+ -+ # Run to the next stop and check our library is now loaded three -+ # times. -+ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+ check_info_shared "info sharedlibrary #4" 3 -+ -+ # The next stop should be the function in the library. -+ gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} -+ -+ # Run to the next stop and check our library is now loaded twice. -+ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+ check_info_shared "info sharedlibrary #5" 2 -+ -+ # Run to the next stop and check our library is now loaded once. -+ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+ check_info_shared "info sharedlibrary #6" 1 -+ -+ # Run to the next stop and check our library is not loaded. -+ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+ check_info_shared "info sharedlibrary #7" 0 -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-interp.exp -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/testsuite/gdb.base/break-interp.exp 2012-06-21 22:46:21.000000000 +0200 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-interp.exp 2012-08-14 17:34:44.344746565 +0200 -@@ -109,12 +109,19 @@ proc strip_debug {dest} { - } - } - -+# The marker function for the standard runtime linker interface is -+# _dl_debug_state. The probes-based interface has no specific marker -+# function; the probe we will stop on (init_start) is in dl_main so we -+# check for that. -+ -+set solib_bp {(_dl_debug_state|dl_main)} -+ - # Implementation of reach. - - proc reach_1 {func command displacement} { -- global gdb_prompt expect_out -+ global gdb_prompt expect_out solib_bp - -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - # Breakpoint on _dl_debug_state can have problems due to its overlap - # with the existing internal breakpoint from GDB. - gdb_test_no_output "set stop-on-solib-events 1" -@@ -142,21 +149,21 @@ proc reach_1 {func command displacement} - exp_continue - } - -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" { -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - fail $test - } else { - pass $test - } - } - -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" { -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - fail $test - } else { - pass $test - } - } - -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" { -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - if {$debug_state_count == 0} { - # First stop does not yet relocate the _start function - # descriptor on ppc64. -@@ -175,7 +182,7 @@ proc reach_1 {func command displacement} - fail $test_displacement - } - -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - gdb_test_no_output "set stop-on-solib-events 0" - } - } -@@ -357,7 +364,7 @@ proc test_attach {file displacement {rel - } - - proc test_ld {file ifmain trynosym displacement} { -- global srcdir subdir gdb_prompt expect_out inferior_exited_re -+ global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp - - # First test normal `file'-command loaded $FILE with symbols. - -@@ -385,9 +392,9 @@ proc test_ld {file ifmain trynosym displ - gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test" - } - -- reach "_dl_debug_state" "run" $displacement -+ reach $solib_bp "run" $displacement - -- gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?_dl_debug_state\\M.*" "dl bt" -+ gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt" - - if $ifmain { - reach "main" continue "NONE" -@@ -399,7 +406,7 @@ proc test_ld {file ifmain trynosym displ - - # Try re-run if the new PIE displacement takes effect. - gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y" -- reach "_dl_debug_state" "run" $displacement -+ reach $solib_bp "run" $displacement - - if $ifmain { - test_core $file $displacement -@@ -431,7 +438,7 @@ proc test_ld {file ifmain trynosym displ - gdb_test "exec-file $file" "exec-file $escapedfile" "load" - - if $ifmain { -- reach "_dl_debug_state" run $displacement -+ reach $solib_bp run $displacement - - # Use two separate gdb_test_multiple statements to avoid timeouts due - # to slow processing of wildcard capturing long output -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes-solib.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes-solib.c 2012-08-14 17:34:44.355746561 +0200 -@@ -0,0 +1,24 @@ -+/* Copyright 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 . */ -+ -+#include -+ -+int -+foo (int n) -+{ -+ printf ("foo %d\n", n); -+ -+ return 0; -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.c 2012-08-14 17:34:44.362746561 +0200 -@@ -0,0 +1,26 @@ -+/* Copyright 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 . */ -+ -+#include -+ -+int -+main () -+{ -+ void *handle = dlopen (SHLIB_NAME, RTLD_LAZY); -+ -+ dlclose (handle); -+ -+ return 0; -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.exp 2012-08-14 17:34:44.363746561 +0200 -@@ -0,0 +1,76 @@ -+# Copyright 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 . -+ -+if { [skip_shlib_tests] || [is_remote target] } { -+ return 0 -+} -+ -+standard_testfile -+ -+set libname $testfile-solib -+set srcfile_lib $srcdir/$subdir/$libname.c -+set binfile_lib [standard_output_file $libname.so] -+ -+set normal_bp "_dl_debug_state" -+set probes_bp "dl_main" -+ -+if { [gdb_compile_shlib $srcfile_lib $binfile_lib \ -+ [list additional_flags=-fPIC]] != "" } { -+ untested "Could not compile $binfile_lib." -+ return -1 -+} -+ -+if { [prepare_for_testing $testfile.exp $testfile $srcfile \ -+ [list additional_flags=-DSHLIB_NAME\=\"$binfile_lib\" libs=-ldl]] } { -+ return -1 -+} -+ -+# Enable stop-on-solib-events -+gdb_test_no_output "set stop-on-solib-events 1" -+ -+# Run to the first stop -+gdb_test "run" ".*Stopped due to shared library event.*" -+ -+# XFAIL if we are not using probes -+set test "ensure using probes" -+set using_probes 0 -+gdb_test_multiple "bt" $test { -+ -re "#0 +\[^\r\n\]*\\m(__GI_)?$normal_bp\\M.*$gdb_prompt $" { -+ xfail $test -+ } -+ -re "#0 +\[^\r\n\]*\\m(__GI_)?$probes_bp\\M.*$gdb_prompt $" { -+ pass $test -+ set using_probes 1 -+ } -+} -+ -+if { $using_probes } { -+ # Run til it loads our library -+ set test "run til our library loads" -+ set loaded_library 0 -+ while { !$loaded_library } { -+ gdb_test_multiple "c" $test { -+ -re "Inferior loaded $binfile_lib\\M.*$gdb_prompt $" { -+ pass $test -+ set loaded_library 1 -+ } -+ -re "Stopped due to shared library event\\M.*$gdb_prompt $" { -+ } -+ } -+ } -+ -+ # Call something to ensure that relocation occurred -+ gdb_test "call foo(23)" "foo 23.*\\\$.* = .*" -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib1.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib1.c 2012-08-14 17:34:44.365746561 +0200 -@@ -0,0 +1,24 @@ -+/* Copyright 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 . */ -+ -+#include -+ -+int -+foo (int n) -+{ -+ printf ("foo %d\n", n); -+ -+ return 0; -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib2.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib2.c 2012-08-14 17:34:44.365746561 +0200 -@@ -0,0 +1,24 @@ -+/* Copyright 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 . */ -+ -+#include -+ -+int -+bar (int n) -+{ -+ printf ("bar %d\n", n); -+ -+ return 0; -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.c 2012-08-14 17:34:44.366746561 +0200 -@@ -0,0 +1,48 @@ -+/* Copyright 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 . */ -+ -+#include -+ -+void -+stop () -+{ -+} -+ -+int -+main () -+{ -+ void *handle1, *handle2; -+ void (*func)(int); -+ -+ handle1 = dlopen (SHLIB1_NAME, RTLD_LAZY); -+ stop (); -+ -+ handle2 = dlopen (SHLIB2_NAME, RTLD_LAZY); -+ stop (); -+ -+ func = (void (*)(int)) dlsym (handle1, "foo"); -+ func (1); -+ -+ func = (void (*)(int)) dlsym (handle2, "bar"); -+ func (2); -+ -+ dlclose (handle1); -+ stop (); -+ -+ dlclose (handle2); -+ stop (); -+ -+ return 0; -+} -Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.exp 2012-08-14 17:34:44.367746561 +0200 -@@ -0,0 +1,139 @@ -+# Copyright 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 . -+ -+if { [skip_shlib_tests] || [is_remote target] } { -+ return 0 -+} -+ -+standard_testfile -+ -+set lib1name $testfile-solib1 -+set srcfile_lib1 $srcdir/$subdir/$lib1name.c -+set binfile_lib1 [standard_output_file $lib1name.so] -+set define1 -DSHLIB1_NAME\=\"$binfile_lib1\" -+ -+set lib2name $testfile-solib2 -+set srcfile_lib2 $srcdir/$subdir/$lib2name.c -+set binfile_lib2 [standard_output_file $lib2name.so] -+set define2 -DSHLIB2_NAME\=\"$binfile_lib2\" -+ -+if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \ -+ [list additional_flags=-fPIC]] != "" } { -+ untested "Could not compile $binfile_lib1." -+ return -1 -+} -+ -+if { [gdb_compile_shlib $srcfile_lib2 $binfile_lib2 \ -+ [list additional_flags=-fPIC]] != "" } { -+ untested "Could not compile $binfile_lib2." -+ return -1 -+} -+ -+set cflags "$define1 $define2" -+if { [prepare_for_testing $testfile.exp $testfile $srcfile \ -+ [list additional_flags=$cflags libs=-ldl]] } { -+ return -1 -+} -+ -+# Run "info sharedlibrary" and check for the presence or absence of -+# our libraries. -+proc check_info_shared { test expect1 expect2 } { -+ global lib1name -+ global lib2name -+ global gdb_prompt -+ -+ set actual1 0 -+ set actual2 0 -+ -+ gdb_test_multiple "info sharedlibrary" $test { -+ -re $lib1name { -+ set actual1 1 -+ exp_continue -+ } -+ -re $lib2name { -+ set actual2 1 -+ exp_continue -+ } -+ -re "\r\n$gdb_prompt $" { -+ if { $actual1 == $expect1 && $actual2 == $expect2 } { -+ pass $test -+ } else { -+ fail $test -+ } -+ } -+ } -+} -+ -+# Set up breakpoints. -+gdb_test "break stop" {Breakpoint [0-9]+ at .*} -+gdb_test_no_output "set breakpoint pending on" -+gdb_test "break foo" {Breakpoint [0-9]+ \(foo\) pending\.} -+gdb_test "break bar" {Breakpoint [0-9]+ \(bar\) pending\.} -+ -+# Check neither of the libraries are loaded at the start. -+gdb_test "start" {Temporary breakpoint [0-9]+, .* in main \(\)} -+check_info_shared "info sharedlibrary #1" 0 0 -+ -+# Run to the first stop and check that only the first library is loaded. -+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+check_info_shared "info sharedlibrary #2" 1 0 -+ -+# Run to the second stop and check that both libraries are loaded. -+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+check_info_shared "info sharedlibrary #3" 1 1 -+ -+# Check that the next stop is in foo. -+gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} -+ -+# Check that the next stop is in bar. -+gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*} -+ -+# Restart the inferior and make sure there are no breakpoint reset -+# errors. These can happen with the probes-based runtime linker -+# interface if the cache is not cleared correctly. -+set test "restart" -+gdb_test_multiple "run" $test { -+ -re {Start it from the beginning\? \(y or n\) } { -+ send_gdb "y\n" -+ exp_continue -+ } -+ -re {Error in re-setting breakpoint} { -+ fail $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+# We're at the first stop. Check that only the first library is loaded. -+check_info_shared "info sharedlibrary #4" 1 0 -+ -+# Run to the second stop and check that both libraries are loaded. -+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+check_info_shared "info sharedlibrary #5" 1 1 -+ -+# Check that the next stop is in foo. -+gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} -+ -+# Check that the next stop is in bar. -+gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*} -+ -+# Run to the next stop and check that the first library has been unloaded. -+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+check_info_shared "info sharedlibrary #6" 0 1 -+ -+# Run to the last stop and check that both libraries are gone. -+gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} -+check_info_shared "info sharedlibrary #7" 0 0 diff --git a/gdb-dlopen-stap-probe-7of7.patch b/gdb-dlopen-stap-probe-7of7.patch deleted file mode 100644 index 074db24..0000000 --- a/gdb-dlopen-stap-probe-7of7.patch +++ /dev/null @@ -1,147 +0,0 @@ -2012-07-30 Gary Benson - - * objfiles.h (inhibit_section_map_updates): New function - declaration. - (resume_section_map_updates): Likewise. - (resume_section_map_updates_cleanup): Likewise. - * objfiles.c (objfile_pspace_info): New field "inhibit_updates". - (find_pc_section): Do not update the section map if - inhibit_updates is set. - (inhibit_section_map_updates): New function. - (resume_section_map_updates): Likewise. - (resume_section_map_updates_cleanup): Likewise. - * solib-svr4.c (svr4_handle_solib_event): Inhibit section map - updates for calls to evaluate_probe_argument. - -Index: gdb-7.4.91.20120814/gdb/objfiles.h -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/objfiles.h 2012-08-14 17:16:54.000000000 +0200 -+++ gdb-7.4.91.20120814/gdb/objfiles.h 2012-08-14 17:20:55.913174609 +0200 -@@ -526,6 +526,22 @@ extern void set_objfile_data (struct obj - extern void *objfile_data (struct objfile *objfile, - const struct objfile_data *data); - -+/* In normal use, the section map will be rebuilt by FIND_PC_SECTION -+ if objfiles have been added, removed or relocated since it was last -+ called. Calling INHIBIT_SECTION_MAP_UPDATES will inhibit this -+ behavior until RESUME_SECTION_MAP_UPDATES is called. If you call -+ INHIBIT_SECTION_MAP_UPDATES you must ensure that every call to -+ FIND_PC_SECTION in the inhibited region relates to a section that -+ is already in the section map and has not since been removed or -+ relocated. */ -+extern void inhibit_section_map_updates (void); -+ -+/* Resume automatically rebuilding the section map as required. */ -+extern void resume_section_map_updates (void); -+ -+/* Version of the above suitable for use as a cleanup. */ -+extern void resume_section_map_updates_cleanup (void *arg); -+ - extern void default_iterate_over_objfiles_in_search_order - (struct gdbarch *gdbarch, - iterate_over_objfiles_in_search_order_cb_ftype *cb, -Index: gdb-7.4.91.20120814/gdb/objfiles.c -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/objfiles.c 2012-08-14 17:16:55.000000000 +0200 -+++ gdb-7.4.91.20120814/gdb/objfiles.c 2012-08-14 17:20:55.915174609 +0200 -@@ -70,6 +70,9 @@ struct objfile_pspace_info - int objfiles_changed_p; - struct obj_section **sections; - int num_sections; -+ -+ /* Nonzero if section map updates should be inhibited. */ -+ int inhibit_updates; - }; - - /* Per-program-space data key. */ -@@ -1295,7 +1298,7 @@ find_pc_section (CORE_ADDR pc) - return s; - - pspace_info = get_objfile_pspace_data (current_program_space); -- if (pspace_info->objfiles_changed_p != 0) -+ if (pspace_info->objfiles_changed_p && !pspace_info->inhibit_updates) - { - update_section_map (current_program_space, - &pspace_info->sections, -@@ -1463,6 +1466,30 @@ objfiles_changed (void) - get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1; - } - -+/* See comments in objfiles.h. */ -+ -+void -+inhibit_section_map_updates (void) -+{ -+ get_objfile_pspace_data (current_program_space)->inhibit_updates = 1; -+} -+ -+/* See comments in objfiles.h. */ -+ -+void -+resume_section_map_updates (void) -+{ -+ get_objfile_pspace_data (current_program_space)->inhibit_updates = 0; -+} -+ -+/* See comments in objfiles.h. */ -+ -+void -+resume_section_map_updates_cleanup (void *arg) -+{ -+ resume_section_map_updates (); -+} -+ - /* The default implementation for the "iterate_over_objfiles_in_search_order" - gdbarch method. It is equivalent to use the ALL_OBJFILES macro, - searching the objfiles in the order they are stored internally, -Index: gdb-7.4.91.20120814/gdb/solib-svr4.c -=================================================================== ---- gdb-7.4.91.20120814.orig/gdb/solib-svr4.c 2012-08-14 17:20:42.000000000 +0200 -+++ gdb-7.4.91.20120814/gdb/solib-svr4.c 2012-08-14 17:21:14.090169216 +0200 -@@ -1847,6 +1847,7 @@ svr4_handle_solib_event (bpstat bs) - struct svr4_info *info = get_svr4_info (); - struct probe_and_info buf, *pi = &buf; - enum probe_action action; -+ struct cleanup *cleanups = NULL; - struct value *val; - LONGEST lmid; - CORE_ADDR debug_base, lm = 0; -@@ -1870,6 +1871,19 @@ svr4_handle_solib_event (bpstat bs) - if (action == NAMESPACE_NO_ACTION) - return; - -+ /* EVALUATE_PROBE_ARGUMENT looks up symbols in the dynamic linker -+ using FIND_PC_SECTION. FIND_PC_SECTION is accelerated by a cache -+ called the section map. The section map is invalidated every -+ time a shared library is loaded or unloaded, and if the inferior -+ is generating a lot of shared library events then the section map -+ will be updated every time SVR4_HANDLE_SOLIB_EVENT is called. -+ We called FIND_PC_SECTION in SVR4_CREATE_SOLIB_EVENT_BREAKPOINTS, -+ so we can guarantee that the dynamic linker's sections are in the -+ section map. We can therefore inhibit section map updates across -+ these calls to EVALUATE_PROBE_ARGUMENT and save a lot of time. */ -+ inhibit_section_map_updates (); -+ cleanups = make_cleanup (resume_section_map_updates_cleanup, NULL); -+ - val = evaluate_probe_argument (pi->probe, 0); - if (val == NULL) - goto error; -@@ -1901,6 +1915,9 @@ svr4_handle_solib_event (bpstat bs) - action = NAMESPACE_RELOAD; - } - -+ do_cleanups (cleanups); -+ cleanups = NULL; -+ - if (action == NAMESPACE_UPDATE_OR_RELOAD) - { - if (namespace_update_incremental (info, lmid, lm, is_initial_ns)) -@@ -1923,6 +1940,8 @@ svr4_handle_solib_event (bpstat bs) - warning (_("Probes-based dynamic linker interface failed.\n" - "Reverting to original interface.\n")); - -+ if (cleanups != NULL) -+ do_cleanups (cleanups); - free_namespace_table (info); - free_probes (info); - info->using_probes = 0; diff --git a/gdb-dlopen-stap-probe-test.patch b/gdb-dlopen-stap-probe-test.patch deleted file mode 100644 index fb2ebd1..0000000 --- a/gdb-dlopen-stap-probe-test.patch +++ /dev/null @@ -1,307 +0,0 @@ -commit 5bfdc32cd3bf373c3b02e1fd864ed8ceab0292b2 -Author: Jan Kratochvil -Date: Mon Aug 8 12:08:53 2011 +0200 - - +testcase - -Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2012-07-15 08:51:38.238701282 +0200 -@@ -0,0 +1,40 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2011 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+#include -+ -+static void * -+tfunc (void *arg) -+{ -+ void (*notifyp) (void) = arg; -+ -+ notifyp (); -+} -+ -+void -+f (void (*notifyp) (void)) -+{ -+ pthread_t t; -+ int i; -+ -+ i = pthread_create (&t, NULL, tfunc, notifyp); -+ assert (i == 0); -+ -+ i = pthread_join (t, NULL); -+ assert (i == 0); -+} -Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2012-07-15 08:51:38.239701277 +0200 -@@ -0,0 +1,46 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2011 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+#include -+#include -+ -+static const char *volatile filename; -+ -+static void -+notify (void) -+{ -+ filename = NULL; /* notify-here */ -+} -+ -+int -+main (void) -+{ -+ void *h; -+ void (*fp) (void (*) (void)); -+ -+ assert (filename != NULL); -+ h = dlopen (filename, RTLD_LAZY); -+ assert (h != NULL); -+ -+ fp = dlsym (h, "f"); -+ assert (fp != NULL); -+ -+ fp (notify); -+ -+ return 0; -+} -Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2012-07-15 09:08:01.760258588 +0200 -@@ -0,0 +1,74 @@ -+# Copyright 2011 Free Software Foundation, Inc. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if {![istarget *-linux*] || [skip_shlib_tests]} { -+ return 0 -+} -+ -+load_lib prelink-support.exp -+ -+set testfile "dlopen-libpthread" -+set srcmainfile ${testfile}.c -+set srclibfile ${testfile}-lib.c -+set executable ${testfile} -+set binfile_lib ${objdir}/${subdir}/${executable}.so -+set binfile ${objdir}/${subdir}/${executable} -+set lib_dlopen [shlib_target_file ${executable}.so] -+ -+# Use build_executable_own_libs as prelinked libpthread.so can produce false -+# PASS - it is OK if GDB processes it still before relocation. -+ -+set relink_args [build_executable_own_libs ${testfile}.exp ${executable}.so $srclibfile {debug shlib_pthreads} no] -+if {$relink_args == "" || ![prelink_no $relink_args] -+ || [prepare_for_testing ${testfile}.exp ${executable} ${srcmainfile} {debug shlib_load}] } { -+ return -1 -+} -+gdb_load_shlibs $binfile_lib -+ -+if { ![runto_main] } { -+ return -1 -+} -+ -+set test "info probes all rtld rtld_map_complete" -+gdb_test_multiple $test $test { -+ -re "\[ \t\]rtld_map_complete\[ \t\]+0x\[0-9a-f\]+.*\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "No probes matched\\.\r\n$gdb_prompt $" { -+ xfail $test -+ untested ${testfile}.exp -+ return -+ } -+} -+ -+set test "libpthread.so not found" -+gdb_test_multiple "info sharedlibrary" $test { -+ -re "/libpthread\\.so.*\r\n$gdb_prompt $" { -+ fail $test -+ } -+ -re "/libc\\.so.*\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+gdb_test "set variable filename=\"$lib_dlopen\"" -+ -+gdb_breakpoint "notify" -+ -+# The error was: -+# Cannot find new threads: generic error -+gdb_continue_to_breakpoint "notify" ".* notify-here .*" -+ -+gdb_test "info sharedlibrary" {/libpthread\.so.*} "libpthread.so found" -Index: gdb-7.4.50.20120714/gdb/testsuite/lib/gdb.exp -=================================================================== ---- gdb-7.4.50.20120714.orig/gdb/testsuite/lib/gdb.exp 2012-07-15 08:51:36.803709222 +0200 -+++ gdb-7.4.50.20120714/gdb/testsuite/lib/gdb.exp 2012-07-15 09:02:41.983028197 +0200 -@@ -3774,22 +3774,6 @@ proc build_executable_from_specs {testna - - set binfile [standard_output_file $executable] - -- set objects {} -- set i 0 -- foreach {s local_options} $args { -- if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } { -- untested $testname -- return -1 -- } -- lappend objects "${binfile}${i}.o" -- incr i -- } -- -- if { [gdb_compile $objects "${binfile}" executable $options] != "" } { -- untested $testname -- return -1 -- } -- - set info_options "" - if { [lsearch -exact $options "c++"] >= 0 } { - set info_options "c++" -@@ -3797,6 +3781,42 @@ proc build_executable_from_specs {testna - if [get_compiler_info ${info_options}] { - return -1 - } -+ -+ set binfile [standard_output_file $executable] -+ -+ set func gdb_compile -+ set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}] -+ if {$func_index != -1} { -+ set func "${func}_[lindex $options $func_index]" -+ } -+ -+ # gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd -+ # parameter. They also requires $sources while gdb_compile and -+ # gdb_compile_pthreads require $objects. Moreover they ignore any options. -+ if [string match gdb_compile_shlib* $func] { -+ set sources_path {} -+ foreach {s local_options} $args { -+ lappend sources_path "${srcdir}/${subdir}/${s}" -+ } -+ set ret [$func $sources_path "${binfile}" $options] -+ } else { -+ set objects {} -+ set i 0 -+ foreach {s local_options} $args { -+ if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } { -+ untested $testname -+ return -1 -+ } -+ lappend objects "${binfile}${i}.o" -+ incr i -+ } -+ set ret [$func $objects "${binfile}" executable $options] -+ } -+ if { $ret != "" } { -+ untested $testname -+ return -1 -+ } -+ - return 0 - } - -Index: gdb-7.4.50.20120714/gdb/testsuite/lib/prelink-support.exp -=================================================================== ---- gdb-7.4.50.20120714.orig/gdb/testsuite/lib/prelink-support.exp 2012-01-04 09:27:56.000000000 +0100 -+++ gdb-7.4.50.20120714/gdb/testsuite/lib/prelink-support.exp 2012-07-15 08:51:38.243701254 +0200 -@@ -95,8 +95,9 @@ proc file_copy {src dest} { - # Wrap function build_executable so that the resulting executable is fully - # self-sufficient (without dependencies on system libraries). Parameter - # INTERP may be used to specify a loader (ld.so) to be used that is --# different from the default system one. Libraries on which the executable --# depends are copied into directory DIR. Default DIR value to -+# different from the default system one. INTERP can be set to "no" if no ld.so -+# copy should be made. Libraries on which the executable depends are copied -+# into directory DIR. Default DIR value to - # `${objdir}/${subdir}/${EXECUTABLE}.d'. - # - # In case of success, return a string containing the arguments to be used -@@ -151,8 +152,15 @@ proc build_executable_own_libs {testname - - if {$interp == ""} { - set interp_system [section_get $binfile .interp] -- set interp ${dir}/[file tail $interp_system] -- file_copy $interp_system $interp -+ if {$interp_system == ""} { -+ fail "$test could not find .interp" -+ } else { -+ set interp ${dir}/[file tail $interp_system] -+ file_copy $interp_system $interp -+ } -+ } -+ if {$interp == "no"} { -+ set interp "" - } - - set dests {} -@@ -164,13 +172,19 @@ proc build_executable_own_libs {testname - - # Do not lappend it so that "-rpath $dir" overrides any possible "-rpath"s - # specified by the caller to be able to link it for ldd" above. -- set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp,-rpath,$dir"] -+ set options [linsert $options 0 "ldflags=-Wl,-rpath,$dir"] -+ if {$interp != ""} { -+ set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp"] -+ } - - if {[build_executable $testname $executable $sources $options] == -1} { - return "" - } - -- set prelink_args "--dynamic-linker=$interp --ld-library-path=$dir $binfile $interp [concat $dests]" -+ set prelink_args "--ld-library-path=$dir $binfile [concat $dests]" -+ if {$interp != ""} { -+ set prelink_args "--dynamic-linker=$interp $prelink_args $interp" -+ } - return $prelink_args - } - diff --git a/gdb-dlopen-stap-probe-test2.patch b/gdb-dlopen-stap-probe-test2.patch deleted file mode 100644 index 9ca4f6b..0000000 --- a/gdb-dlopen-stap-probe-test2.patch +++ /dev/null @@ -1,69 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-08/msg00500.html -Subject: [patch] testsuite: Make solib-corrupted.exp untested for probes [Re: [RFA 0/4 take 2] Improved linker-debugger interface] - -On Fri, 17 Aug 2012 22:53:53 +0200, Jan Kratochvil wrote: -> It regresses with glibc-debuginfo installed: -> -> info sharedlibrary^M -> From To Syms Read Shared Object Library^M -> 0x00007ffff7ddcb20 0x00007ffff7df63d9 Yes /lib64/ld-linux-x86-64.so.2^M -> 0x00007ffff7ae05b0 0x00007ffff7b4ad78 Yes /lib64/libm.so.6^M -> 0x00007ffff77431a0 0x00007ffff7883cf0 Yes /lib64/libc.so.6^M -> (gdb) FAIL: gdb.base/solib-corrupted.exp: corrupted list -> -> But I guess there is no longer a way to test it with probes so it should just -> run some 'info probes' and make this test UNTESTED if rtld probes are -> available. - -I had to implement it for Fedora already anyway. - - -Regards, -Jan - - -gdb/testsuite/ -2012-08-18 Jan Kratochvil - - * gdb.base/solib-corrupted.exp: New variable probes. - (info probes): New test. - -diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp -index 84b3b0c..c9f55d6 100644 ---- a/gdb/testsuite/gdb.base/solib-corrupted.exp -+++ b/gdb/testsuite/gdb.base/solib-corrupted.exp -@@ -36,6 +36,33 @@ if ![runto_main] { - return - } - -+# With probes interface GDB no longer scans the inferior library list so its -+# corruption cannot be tested. There is no way to disable the probes -+# interface. -+ -+set probes { init_start init_complete map_start reloc_complete unmap_start -+ unmap_complete } -+set test "info probes" -+gdb_test_multiple $test $test { -+ -re "^rtld\[ \t\]+(?:rtld_)?(\[a-z_\]+)\[ \t\]" { -+ set idx [lsearch -exact $probes $expect_out(1,string)] -+ if { $idx >= 0 } { -+ set probes [lreplace $probes $idx $idx] -+ } -+ exp_continue -+ } -+ -re "^\[^\r\n\]*\r\n" { -+ exp_continue -+ } -+ -re "^$gdb_prompt $" { -+ } -+} -+if { [llength $probes] == 0 } { -+ xfail $test -+ untested "GDB is using probes" -+ return -+} -+ - gdb_test "info sharedlibrary" "From * To .*" "normal list" - - # GDB checks there for matching L_PREV. - diff --git a/gdb-entryval-inlined.patch b/gdb-entryval-inlined.patch deleted file mode 100644 index 3cbe84b..0000000 --- a/gdb-entryval-inlined.patch +++ /dev/null @@ -1,888 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-10/msg00095.html -Subject: [patch] entry values: Fix resolving in inlined frames - -Hi, - -Breakpoint 1, fn2 (y=, x=6) at gdb.arch/amd64-entry-value-inline.c:32 -32 y = -2 + x; /* break-here */ -(gdb) info addr y -(gdb) bt -#0 fn2 (y=, x=6) at gdb.arch/amd64-entry-value-inline.c:32 -#1 fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42 -#2 0x00000000004004af in main () at gdb.arch/amd64-entry-value-inline.c:48 -(gdb) info frame -Stack level 0, frame at 0x7fffffffdb68: - rip = 0x4005bc in fn2 (gdb.arch/amd64-entry-value-inline.c:32); saved rip 0x4004af - inlined into frame 1 -[...] -(gdb) set debug entry-values 1 -(gdb) p y -DW_OP_GNU_entry_value resolving expects callee fn1 at 0x4005a0 but the called frame is for fn3 at 0x4005b0 - -FAIL: ------ -$1 = -PASS: ------ -$1 = 25 - -(gdb) p/x $pc -$2 = 0x4005bc -(gdb) up -#1 fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42 -(gdb) p/x $pc -$3 = 0x4005bc - -The problem is that DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value binding -exists between DW_TAG_subprogram, nor DW_TAG_inlined_subroutine as described -by Jakub Jelinek. This makes sense, when we look at DW_TAG_GNU_call_site and -we just unwind the current inlined frame we get the same PC - this is no new -information. - -TAILCALL_FRAME is a different case, while also an artificial frame the -sequence cannot be determined at compile time and the binding -DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value exists also for -TAILCALL_FRAMEs. - -I will check it in. - -No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu. - - -Thanks, -Jan - - -gdb/ -2012-10-05 Jan Kratochvil - - Fix entry values resolving in inlined frames. - * dwarf2loc.c (dwarf_expr_reg_to_entry_parameter): Move func_addr, - gdbarch and caller_frame initialization later. Skip INLINE_FRAME - entries of FRAME. - -gdb/testsuite/ -2012-10-05 Jan Kratochvil - - Fix entry values resolving in inlined frames. - * gdb.arch/amd64-entry-value-inline.S: New file. - * gdb.arch/amd64-entry-value-inline.c: New file. - * gdb.arch/amd64-entry-value-inline.exp: New file. - -diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index e8d39fe..0bdc042 100644 ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c -@@ -980,16 +980,27 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame, - union call_site_parameter_u kind_u, - struct dwarf2_per_cu_data **per_cu_return) - { -- CORE_ADDR func_addr = get_frame_func (frame); -- CORE_ADDR caller_pc; -- struct gdbarch *gdbarch = get_frame_arch (frame); -- struct frame_info *caller_frame = get_prev_frame (frame); -+ CORE_ADDR func_addr, caller_pc; -+ struct gdbarch *gdbarch; -+ struct frame_info *caller_frame; - struct call_site *call_site; - int iparams; - /* Initialize it just to avoid a GCC false warning. */ - struct call_site_parameter *parameter = NULL; - CORE_ADDR target_addr; - -+ /* Skip any inlined frames, entry value call sites work between real -+ functions. They do not make sense between inline functions as even PC -+ does not change there. */ -+ while (get_frame_type (frame) == INLINE_FRAME) -+ { -+ frame = get_prev_frame (frame); -+ gdb_assert (frame != NULL); -+ } -+ -+ func_addr = get_frame_func (frame); -+ gdbarch = get_frame_arch (frame); -+ caller_frame = get_prev_frame (frame); - if (gdbarch != frame_unwind_arch (frame)) - { - struct minimal_symbol *msym = lookup_minimal_symbol_by_pc (func_addr); -diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S -new file mode 100644 -index 0000000..5f353f5 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S -@@ -0,0 +1,672 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+/* This file is compiled from gdb.arch/amd64-entry-value-inline.c -+ using -g -dA -S -O2. */ -+ -+ .file "amd64-entry-value-inline.c" -+ .text -+.Ltext0: -+ .p2align 4,,15 -+ .type fn1, @function -+fn1: -+.LFB0: -+ .file 1 "gdb.arch/amd64-entry-value-inline.c" -+ # gdb.arch/amd64-entry-value-inline.c:22 -+ .loc 1 22 0 -+ .cfi_startproc -+.LVL0: -+# BLOCK 2 freq:10000 seq:0 -+# PRED: ENTRY [100.0%] (FALLTHRU) -+ # gdb.arch/amd64-entry-value-inline.c:23 -+ .loc 1 23 0 -+ movl v(%rip), %eax -+ addl $1, %eax -+ movl %eax, v(%rip) -+# SUCC: EXIT [100.0%] -+ ret -+ .cfi_endproc -+.LFE0: -+ .size fn1, .-fn1 -+ .p2align 4,,15 -+ .globl fn3 -+ .type fn3, @function -+fn3: -+.LFB2: -+ # gdb.arch/amd64-entry-value-inline.c:41 -+ .loc 1 41 0 -+ .cfi_startproc -+.LVL1: -+# BLOCK 2 freq:10000 seq:0 -+# PRED: ENTRY [100.0%] (FALLTHRU) -+.LBB4: -+.LBB5: -+ # gdb.arch/amd64-entry-value-inline.c:29 -+ .loc 1 29 0 -+ testl %esi, %esi -+.LBE5: -+.LBE4: -+ # gdb.arch/amd64-entry-value-inline.c:41 -+ .loc 1 41 0 -+ pushq %rbx -+ .cfi_def_cfa_offset 16 -+ .cfi_offset 3, -16 -+ # gdb.arch/amd64-entry-value-inline.c:41 -+ .loc 1 41 0 -+ movl %edi, %ebx -+.LBB7: -+.LBB6: -+# SUCC: 3 [39.0%] (FALLTHRU,CAN_FALLTHRU) 4 [61.0%] (CAN_FALLTHRU) -+ # gdb.arch/amd64-entry-value-inline.c:29 -+ .loc 1 29 0 -+ je .L3 -+# BLOCK 3 freq:3898 seq:1 -+# PRED: 2 [39.0%] (FALLTHRU,CAN_FALLTHRU) -+ # gdb.arch/amd64-entry-value-inline.c:31 -+ .loc 1 31 0 -+ call fn1 -+.LVL2: -+ # gdb.arch/amd64-entry-value-inline.c:32 -+ .loc 1 32 0 -+ leal -2(%rbx), %eax -+.LVL3: -+ # gdb.arch/amd64-entry-value-inline.c:33 -+ .loc 1 33 0 -+ movl %eax, %edi -+ imull %eax, %edi -+ addl $1, %edi -+.LVL4: -+ imull %edi, %eax -+.LVL5: -+ # gdb.arch/amd64-entry-value-inline.c:34 -+ .loc 1 34 0 -+ leal (%rbx,%rax), %edi -+ call fn1 -+.LVL6: -+# SUCC: 4 [100.0%] (FALLTHRU,CAN_FALLTHRU) -+# BLOCK 4 freq:10000 seq:2 -+# PRED: 2 [61.0%] (CAN_FALLTHRU) 3 [100.0%] (FALLTHRU,CAN_FALLTHRU) -+.L3: -+.LBE6: -+.LBE7: -+ # gdb.arch/amd64-entry-value-inline.c:43 -+ .loc 1 43 0 -+ movl %ebx, %eax -+ popq %rbx -+ .cfi_def_cfa_offset 8 -+.LVL7: -+# SUCC: EXIT [100.0%] -+ ret -+ .cfi_endproc -+.LFE2: -+ .size fn3, .-fn3 -+ .section .text.startup,"ax",@progbits -+ .p2align 4,,15 -+ .globl main -+ .type main, @function -+main: -+.LFB3: -+ # gdb.arch/amd64-entry-value-inline.c:47 -+ .loc 1 47 0 -+ .cfi_startproc -+# BLOCK 2 freq:10000 seq:0 -+# PRED: ENTRY [100.0%] (FALLTHRU) -+ # gdb.arch/amd64-entry-value-inline.c:48 -+ .loc 1 48 0 -+ movl $25, %esi -+ movl $6, %edi -+ call fn3 -+.LVL8: -+ # gdb.arch/amd64-entry-value-inline.c:50 -+ .loc 1 50 0 -+ xorl %eax, %eax -+# SUCC: EXIT [100.0%] -+ ret -+ .cfi_endproc -+.LFE3: -+ .size main, .-main -+ .local v -+ .comm v,4,4 -+ .text -+.Letext0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .long 0x164 # Length of Compilation Unit Info -+ .value 0x4 # DWARF version number -+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section -+ .byte 0x8 # Pointer Size (in bytes) -+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) -+ .long .LASF0 # DW_AT_producer: "GNU C 4.8.0 20121005 (experimental) -mtune=generic -march=x86-64 -g -O2" -+ .byte 0x1 # DW_AT_language -+ .long .LASF1 # DW_AT_name: "gdb.arch/amd64-entry-value-inline.c" -+ .long .LASF2 # DW_AT_comp_dir: "" -+ .long .Ldebug_ranges0+0x30 # DW_AT_ranges -+ .quad 0 # DW_AT_low_pc -+ .long .Ldebug_line0 # DW_AT_stmt_list -+ .uleb128 0x2 # (DIE (0x29) DW_TAG_subprogram) -+ .ascii "fn1\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x15 # DW_AT_decl_line -+ # DW_AT_prototyped -+ .quad .LFB0 # DW_AT_low_pc -+ .quad .LFE0-.LFB0 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ # DW_AT_GNU_all_call_sites -+ .long 0x52 # DW_AT_sibling -+ .uleb128 0x3 # (DIE (0x46) DW_TAG_formal_parameter) -+ .ascii "x\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x15 # DW_AT_decl_line -+ .long 0x52 # DW_AT_type -+ .uleb128 0x1 # DW_AT_location -+ .byte 0x55 # DW_OP_reg5 -+ .byte 0 # end of children of DIE 0x29 -+ .uleb128 0x4 # (DIE (0x52) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x5 # DW_AT_encoding -+ .ascii "int\0" # DW_AT_name -+ .uleb128 0x5 # (DIE (0x59) DW_TAG_subprogram) -+ .ascii "fn2\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x1b # DW_AT_decl_line -+ # DW_AT_prototyped -+ .long 0x52 # DW_AT_type -+ .byte 0x1 # DW_AT_inline -+ .long 0x7c # DW_AT_sibling -+ .uleb128 0x6 # (DIE (0x69) DW_TAG_formal_parameter) -+ .ascii "x\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x1b # DW_AT_decl_line -+ .long 0x52 # DW_AT_type -+ .uleb128 0x6 # (DIE (0x72) DW_TAG_formal_parameter) -+ .ascii "y\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x1b # DW_AT_decl_line -+ .long 0x52 # DW_AT_type -+ .byte 0 # end of children of DIE 0x59 -+ .uleb128 0x7 # (DIE (0x7c) DW_TAG_subprogram) -+ # DW_AT_external -+ .ascii "fn3\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x28 # DW_AT_decl_line -+ # DW_AT_prototyped -+ .long 0x52 # DW_AT_type -+ .quad .LFB2 # DW_AT_low_pc -+ .quad .LFE2-.LFB2 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ # DW_AT_GNU_all_call_sites -+ .long 0x115 # DW_AT_sibling -+ .uleb128 0x8 # (DIE (0x9d) DW_TAG_formal_parameter) -+ .ascii "x\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x28 # DW_AT_decl_line -+ .long 0x52 # DW_AT_type -+ .long .LLST0 # DW_AT_location -+ .uleb128 0x8 # (DIE (0xaa) DW_TAG_formal_parameter) -+ .ascii "y\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x28 # DW_AT_decl_line -+ .long 0x52 # DW_AT_type -+ .long .LLST1 # DW_AT_location -+ .uleb128 0x9 # (DIE (0xb7) DW_TAG_inlined_subroutine) -+ .long 0x59 # DW_AT_abstract_origin -+ .quad .LBB4 # DW_AT_entry_pc -+ .long .Ldebug_ranges0+0 # DW_AT_ranges -+ .byte 0x1 # DW_AT_call_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x2a # DW_AT_call_line -+ .uleb128 0xa # (DIE (0xca) DW_TAG_formal_parameter) -+ .long 0x72 # DW_AT_abstract_origin -+ .long .LLST2 # DW_AT_location -+ .uleb128 0xa # (DIE (0xd3) DW_TAG_formal_parameter) -+ .long 0x69 # DW_AT_abstract_origin -+ .long .LLST0 # DW_AT_location -+ .uleb128 0xb # (DIE (0xdc) DW_TAG_GNU_call_site) -+ .quad .LVL2 # DW_AT_low_pc -+ .long 0x29 # DW_AT_abstract_origin -+ .long 0xf4 # DW_AT_sibling -+ .uleb128 0xc # (DIE (0xed) DW_TAG_GNU_call_site_parameter) -+ .uleb128 0x1 # DW_AT_location -+ .byte 0x55 # DW_OP_reg5 -+ .uleb128 0x2 # DW_AT_GNU_call_site_value -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 0 -+ .byte 0 # end of children of DIE 0xdc -+ .uleb128 0xd # (DIE (0xf4) DW_TAG_GNU_call_site) -+ .quad .LVL6 # DW_AT_low_pc -+ .long 0x29 # DW_AT_abstract_origin -+ .uleb128 0xc # (DIE (0x101) DW_TAG_GNU_call_site_parameter) -+ .uleb128 0x1 # DW_AT_location -+ .byte 0x55 # DW_OP_reg5 -+ .uleb128 0xd # DW_AT_GNU_call_site_value -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 -2 -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 -2 -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 -2 -+ .byte 0x1e # DW_OP_mul -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x1 -+ .byte 0x1e # DW_OP_mul -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 0 -+ .byte 0x22 # DW_OP_plus -+ .byte 0 # end of children of DIE 0xf4 -+ .byte 0 # end of children of DIE 0xb7 -+ .byte 0 # end of children of DIE 0x7c -+ .uleb128 0xe # (DIE (0x115) DW_TAG_subprogram) -+ # DW_AT_external -+ .long .LASF3 # DW_AT_name: "main" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x2e # DW_AT_decl_line -+ .long 0x52 # DW_AT_type -+ .quad .LFB3 # DW_AT_low_pc -+ .quad .LFE3-.LFB3 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ # DW_AT_GNU_all_call_sites -+ .long 0x14f # DW_AT_sibling -+ .uleb128 0xd # (DIE (0x136) DW_TAG_GNU_call_site) -+ .quad .LVL8 # DW_AT_low_pc -+ .long 0x7c # DW_AT_abstract_origin -+ .uleb128 0xc # (DIE (0x143) DW_TAG_GNU_call_site_parameter) -+ .uleb128 0x1 # DW_AT_location -+ .byte 0x55 # DW_OP_reg5 -+ .uleb128 0x1 # DW_AT_GNU_call_site_value -+ .byte 0x36 # DW_OP_lit6 -+ .uleb128 0xc # (DIE (0x148) DW_TAG_GNU_call_site_parameter) -+ .uleb128 0x1 # DW_AT_location -+ .byte 0x54 # DW_OP_reg4 -+ .uleb128 0x1 # DW_AT_GNU_call_site_value -+ .byte 0x49 # DW_OP_lit25 -+ .byte 0 # end of children of DIE 0x136 -+ .byte 0 # end of children of DIE 0x115 -+ .uleb128 0xf # (DIE (0x14f) DW_TAG_variable) -+ .ascii "v\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) -+ .byte 0x12 # DW_AT_decl_line -+ .long 0x162 # DW_AT_type -+ .uleb128 0x9 # DW_AT_location -+ .byte 0x3 # DW_OP_addr -+ .quad v -+ .uleb128 0x10 # (DIE (0x162) DW_TAG_volatile_type) -+ .long 0x52 # DW_AT_type -+ .byte 0 # end of children of DIE 0xb -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .uleb128 0x1 # (abbrev code) -+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x25 # (DW_AT_producer) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x13 # (DW_AT_language) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x1b # (DW_AT_comp_dir) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x55 # (DW_AT_ranges) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x10 # (DW_AT_stmt_list) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x2 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x7 # (DW_FORM_data8) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x3 # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x4 # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0 # DW_children_no -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3e # (DW_AT_encoding) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x5 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x20 # (DW_AT_inline) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x6 # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x7 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x7 # (DW_FORM_data8) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x8 # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x9 # (abbrev code) -+ .uleb128 0x1d # (TAG: DW_TAG_inlined_subroutine) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x31 # (DW_AT_abstract_origin) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x52 # (DW_AT_entry_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x55 # (DW_AT_ranges) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .uleb128 0x58 # (DW_AT_call_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x59 # (DW_AT_call_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xa # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x31 # (DW_AT_abstract_origin) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xb # (abbrev code) -+ .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x31 # (DW_AT_abstract_origin) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xc # (abbrev code) -+ .uleb128 0x410a # (TAG: DW_TAG_GNU_call_site_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2111 # (DW_AT_GNU_call_site_value) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xd # (abbrev code) -+ .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x31 # (DW_AT_abstract_origin) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xe # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x7 # (DW_FORM_data8) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xf # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x10 # (abbrev code) -+ .uleb128 0x35 # (TAG: DW_TAG_volatile_type) -+ .byte 0 # DW_children_no -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .quad .LVL1 # Location list begin address (*.LLST0) -+ .quad .LVL2-1 # Location list end address (*.LLST0) -+ .value 0x1 # Location expression size -+ .byte 0x55 # DW_OP_reg5 -+ .quad .LVL2-1 # Location list begin address (*.LLST0) -+ .quad .LVL7 # Location list end address (*.LLST0) -+ .value 0x1 # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .quad .LVL7 # Location list begin address (*.LLST0) -+ .quad .LFE2 # Location list end address (*.LLST0) -+ .value 0x1 # Location expression size -+ .byte 0x50 # DW_OP_reg0 -+ .quad 0 # Location list terminator begin (*.LLST0) -+ .quad 0 # Location list terminator end (*.LLST0) -+.LLST1: -+ .quad .LVL1 # Location list begin address (*.LLST1) -+ .quad .LVL2-1 # Location list end address (*.LLST1) -+ .value 0x1 # Location expression size -+ .byte 0x54 # DW_OP_reg4 -+ .quad .LVL2-1 # Location list begin address (*.LLST1) -+ .quad .LFE2 # Location list end address (*.LLST1) -+ .value 0x4 # Location expression size -+ .byte 0xf3 # DW_OP_GNU_entry_value -+ .uleb128 0x1 -+ .byte 0x54 # DW_OP_reg4 -+ .byte 0x9f # DW_OP_stack_value -+ .quad 0 # Location list terminator begin (*.LLST1) -+ .quad 0 # Location list terminator end (*.LLST1) -+.LLST2: -+ .quad .LVL1 # Location list begin address (*.LLST2) -+ .quad .LVL2-1 # Location list end address (*.LLST2) -+ .value 0x1 # Location expression size -+ .byte 0x54 # DW_OP_reg4 -+ .quad .LVL2-1 # Location list begin address (*.LLST2) -+ .quad .LVL3 # Location list end address (*.LLST2) -+ .value 0x4 # Location expression size -+ .byte 0xf3 # DW_OP_GNU_entry_value -+ .uleb128 0x1 -+ .byte 0x54 # DW_OP_reg4 -+ .byte 0x9f # DW_OP_stack_value -+ .quad .LVL3 # Location list begin address (*.LLST2) -+ .quad .LVL4 # Location list end address (*.LLST2) -+ .value 0x1 # Location expression size -+ .byte 0x50 # DW_OP_reg0 -+ .quad .LVL4 # Location list begin address (*.LLST2) -+ .quad .LVL5 # Location list end address (*.LLST2) -+ .value 0x6 # Location expression size -+ .byte 0x70 # DW_OP_breg0 -+ .sleb128 0 -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 0 -+ .byte 0x1e # DW_OP_mul -+ .byte 0x9f # DW_OP_stack_value -+ .quad .LVL5 # Location list begin address (*.LLST2) -+ .quad .LVL6-1 # Location list end address (*.LLST2) -+ .value 0x1 # Location expression size -+ .byte 0x50 # DW_OP_reg0 -+ .quad .LVL6-1 # Location list begin address (*.LLST2) -+ .quad .LVL6 # Location list end address (*.LLST2) -+ .value 0xb # Location expression size -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 -2 -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 -2 -+ .byte 0x73 # DW_OP_breg3 -+ .sleb128 -2 -+ .byte 0x1e # DW_OP_mul -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x1 -+ .byte 0x1e # DW_OP_mul -+ .byte 0x9f # DW_OP_stack_value -+ .quad 0 # Location list terminator begin (*.LLST2) -+ .quad 0 # Location list terminator end (*.LLST2) -+ .section .debug_aranges,"",@progbits -+ .long 0x3c # Length of Address Ranges Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .byte 0x8 # Size of Address -+ .byte 0 # Size of Segment Descriptor -+ .value 0 # Pad to 16 byte boundary -+ .value 0 -+ .quad .Ltext0 # Address -+ .quad .Letext0-.Ltext0 # Length -+ .quad .LFB3 # Address -+ .quad .LFE3-.LFB3 # Length -+ .quad 0 -+ .quad 0 -+ .section .debug_ranges,"",@progbits -+.Ldebug_ranges0: -+ .quad .LBB4 # Offset 0 -+ .quad .LBE4 -+ .quad .LBB7 -+ .quad .LBE7 -+ .quad 0 -+ .quad 0 -+ .quad .Ltext0 # Offset 0x30 -+ .quad .Letext0 -+ .quad .LFB3 # Offset 0x40 -+ .quad .LFE3 -+ .quad 0 -+ .quad 0 -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .section .debug_str,"MS",@progbits,1 -+.LASF0: -+ .string "GNU C 4.8.0 20121005+patches (experimental) -mtune=generic -march=x86-64 -g -O2" -+.LASF1: -+ .string "gdb.arch/amd64-entry-value-inline.c" -+.LASF2: -+ .string "" -+.LASF3: -+ .string "main" -+ .ident "GCC: (GNU) 4.8.0 20121005 (experimental)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c -new file mode 100644 -index 0000000..f7fefb8 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c -@@ -0,0 +1,50 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+static volatile int v; -+ -+static __attribute__((noinline, noclone)) void -+fn1 (int x) -+{ -+ v++; -+} -+ -+static int -+fn2 (int x, int y) -+{ -+ if (y) -+ { -+ fn1 (x); -+ y = -2 + x; /* break-here */ -+ y = y * y * y + y; -+ fn1 (x + y); -+ } -+ return x; -+} -+ -+__attribute__((noinline, noclone)) int -+fn3 (int x, int y) -+{ -+ return fn2 (x, y); -+} -+ -+int -+main () -+{ -+ fn3 (6, 25); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp -new file mode 100644 -index 0000000..6aa92c1 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp -@@ -0,0 +1,40 @@ -+# 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 . -+ -+set opts {} -+standard_testfile .S -+ -+if [info exists COMPILE] { -+ # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1" -+ standard_testfile -+ lappend opts debug optimize=-O2 -+} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } { -+ verbose "Skipping ${testfile}." -+ return -+} -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} $opts] } { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+set srcfile $testfile.c -+gdb_breakpoint [gdb_get_line_number "break-here"] -+ -+gdb_continue_to_breakpoint "break-here" ".* break-here .*" -+gdb_test "p y" " = 25" - diff --git a/gdb-follow-child-stale-parent.patch b/gdb-follow-child-stale-parent.patch deleted file mode 100644 index 336790c..0000000 --- a/gdb-follow-child-stale-parent.patch +++ /dev/null @@ -1,27 +0,0 @@ -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-fortran-common-reduce.patch b/gdb-fortran-common-reduce.patch deleted file mode 100644 index 238b355..0000000 --- a/gdb-fortran-common-reduce.patch +++ /dev/null @@ -1,508 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/f-lang.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/f-lang.c 2012-03-02 20:29:00.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/f-lang.c 2012-06-02 19:13:31.520050654 +0200 -@@ -59,20 +59,6 @@ typedef struct saved_bf_symnum SAVED_BF, - /* 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 @@ _initialize_f_language (void) - 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 @@ find_common_for_function (const char *na - } - 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 -Index: gdb-7.4.50.20120602/gdb/f-lang.h -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/f-lang.h 2012-06-02 19:11:54.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/f-lang.h 2012-06-02 19:13:55.345317970 +0200 -@@ -76,15 +76,10 @@ typedef struct saved_f77_common SAVED_F7 - 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 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 */ -Index: gdb-7.4.50.20120602/gdb/f-valprint.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/f-valprint.c 2012-06-02 19:11:54.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/f-valprint.c 2012-06-02 19:14:11.625313432 +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 *); -@@ -535,67 +531,6 @@ info_common_command (char *comname, int - 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/gdb-fortran-common.patch b/gdb-fortran-common.patch deleted file mode 100644 index e072133..0000000 --- a/gdb-fortran-common.patch +++ /dev/null @@ -1,598 +0,0 @@ -Index: gdb-7.4.91.20120801/gdb/dwarf2read.c -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/dwarf2read.c 2012-08-01 18:36:51.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/dwarf2read.c 2012-08-01 18:38:54.201540500 +0200 -@@ -11073,12 +11073,14 @@ read_set_type (struct die_info *die, str - 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; -@@ -11103,20 +11105,67 @@ read_common_block (struct die_info *die, - } - 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) = ""; -+ -+ 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); - } - } - -@@ -15155,6 +15204,13 @@ new_symbol_full (struct die_info *die, s - { - 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) -@@ -15319,6 +15375,11 @@ new_symbol_full (struct die_info *die, s - 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 -Index: gdb-7.4.91.20120801/gdb/f-lang.c -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/f-lang.c 2012-08-01 18:38:24.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/f-lang.c 2012-08-01 18:38:54.202540495 +0200 -@@ -370,27 +370,3 @@ _initialize_f_language (void) - - 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); --} -Index: gdb-7.4.91.20120801/gdb/f-lang.h -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/f-lang.h 2012-08-01 18:38:24.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/f-lang.h 2012-08-01 18:38:54.203540489 +0200 -@@ -52,37 +52,8 @@ enum f90_range_type - 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 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 -Index: gdb-7.4.91.20120801/gdb/f-valprint.c -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/f-valprint.c 2012-08-01 18:38:24.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/f-valprint.c 2012-08-01 18:41:26.411698186 +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 *); -@@ -420,22 +421,53 @@ f_val_print (struct type *type, const gd - gdb_flush (stream); - } - --static void --list_all_visible_commons (const char *funname) -+static int -+info_common_command_for_block (struct block *block, const char *comname) - { -- SAVED_F77_COMMON_PTR tmp; -- -- tmp = head_common_list; -+ struct block_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 -@@ -445,11 +477,9 @@ list_all_visible_commons (const char *fu - 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 -@@ -461,87 +491,31 @@ info_common_command (char *comname, int - /* The following is generally ripped off from stack.c's routine - print_frame_info(). */ - -- func = find_pc_function (get_frame_pc (fi)); -- if (func) -+ block = get_frame_block (fi, 0); -+ if (block == NULL) - { -- /* 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 -- { -- 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, 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) - { -- struct frame_id frame_id = get_frame_id (fi); -- -- 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) -- { -- fi = frame_find_by_id (frame_id); -- if (fi == NULL) -- { -- warning (_("Unable to restore previously selected frame.")); -- break; -- } -- -- print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0); -- -- /* print_variable_and_value invalidates FI. */ -- fi = NULL; -- -- 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 -Index: gdb-7.4.91.20120801/gdb/stack.c -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/stack.c 2012-08-01 18:36:51.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/stack.c 2012-08-01 18:38:54.206540471 +0200 -@@ -1851,6 +1851,8 @@ iterate_over_block_locals (struct block - 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; - -Index: gdb-7.4.91.20120801/gdb/symtab.h -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/symtab.h 2012-06-30 00:46:46.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/symtab.h 2012-08-01 18:38:54.206540471 +0200 -@@ -394,7 +394,10 @@ typedef enum domain_enum_tag - - /* 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 -Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp 2012-08-01 18:38:54.207540465 +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 . -+ -+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" -Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90 2012-08-01 18:38:54.207540465 +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 . -+! Modified for the GDB testcase by Jan Kratochvil . -+ -+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/gdb-gdb-add-index-script.patch b/gdb-gdb-add-index-script.patch deleted file mode 100644 index c15df68..0000000 --- a/gdb-gdb-add-index-script.patch +++ /dev/null @@ -1,118 +0,0 @@ -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 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 - - * Makefile.in (install-only): Install gdb-add-index. - * gdb-add-index: New file. - -2010-07-09 Tom Tromey - - * gdb.texinfo (Index Files): Mention gdb-add-index. - ->From 30714fe719e61baea03d0dc5793eb0d564faebb7 Mon Sep 17 00:00:00 2001 -From: Tom Tromey -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. - -+@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: -+ -+@smallexample -+$ gdb-add-index symfile -+@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 . -+ -+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-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch deleted file mode 100644 index 308b359..0000000 --- a/gdb-glibc-strstr-workaround.patch +++ /dev/null @@ -1,137 +0,0 @@ -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 53100c5..e7586ac 100644 ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -13306,6 +13306,25 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, - /* Cache this symbol's name and the name's demangled form (if any). */ - SYMBOL_SET_LANGUAGE (sym, cu->language); - linkagename = dwarf2_physname (name, die, cu); -+ -+ /* Workaround for: -+ * invalid IFUNC DW_AT_linkage_name: memmove strstr time -+ * http://sourceware.org/bugzilla/show_bug.cgi?id=14166 */ -+ if (strcmp (linkagename, "strstr") == 0 -+ && strstr (objfile->name, "/libc") != NULL) -+ { -+ struct objfile *objfile_msym; -+ struct minimal_symbol *msym; -+ -+ if (objfile->separate_debug_objfile_backlink) -+ objfile_msym = objfile->separate_debug_objfile_backlink; -+ else -+ objfile_msym = objfile; -+ msym = lookup_minimal_symbol ("strstr", NULL, objfile_msym); -+ if (msym && MSYMBOL_TYPE (msym) == mst_text_gnu_ifunc) -+ linkagename = "__strstr"; -+ } -+ - SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile); - - /* Fortran does not have mangling standard and the mangling does differ -diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp -new file mode 100644 -index 0000000..575071f ---- /dev/null -+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp -@@ -0,0 +1,101 @@ -+# 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 . -+ -+# Workaround for: -+# invalid IFUNC DW_AT_linkage_name: memmove strstr time -+# http://sourceware.org/bugzilla/show_bug.cgi?id=14166 -+ -+if {[skip_shlib_tests]} { -+ return 0 -+} -+ -+set testfile "gnu-ifunc-strstr-workaround" -+set executable ${testfile} -+set srcfile start.c -+set binfile ${objdir}/${subdir}/${executable} -+ -+if [prepare_for_testing ${testfile}.exp $executable $srcfile] { -+ return -1 -+} -+ -+if ![runto_main] { -+ return 0 -+} -+ -+set test "ptype atoi" -+gdb_test_multiple $test $test { -+ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "type = int \\(\\)\r\n$gdb_prompt $" { -+ untested "$test (no DWARF)" -+ return 0 -+ } -+} -+ -+set addr "" -+set test "print strstr" -+gdb_test_multiple $test $test { -+ -re " = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" { -+ set addr $expect_out(1,string) -+ pass $test -+ } -+ -re " = {} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" { -+ set addr $expect_out(1,string) -+ pass "$test (GDB workaround or future fixed glibc)" -+ } -+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { -+ untested "$test (gnu-ifunc not in use by glibc)" -+ return 0 -+ } -+} -+ -+set test "info sym" -+gdb_test_multiple "info sym $addr" $test { -+ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { -+ # unexpected -+ xfail "$test (not in libc.so.6)" -+ return 0 -+ } -+} -+ -+set test "info addr strstr" -+gdb_test_multiple $test $test { -+ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" { -+ fail "$test (DWARF for strstr)" -+ } -+ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" { -+ pass "$test" -+ } -+} -+ -+set test "print strstr second time" -+gdb_test_multiple "print strstr" $test { -+ -re " = {} $addr \r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re " = {} $addr <__strstr>\r\n$gdb_prompt $" { -+ pass "$test (GDB workaround or future fixed glibc)" -+ } -+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { -+ fail $test -+ } -+} -+ -+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} -+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"} diff --git a/gdb-glibc-vdso-workaround.patch b/gdb-glibc-vdso-workaround.patch deleted file mode 100644 index 48646d7..0000000 --- a/gdb-glibc-vdso-workaround.patch +++ /dev/null @@ -1,30 +0,0 @@ -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 - - 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-lineno-makeup-test.patch b/gdb-lineno-makeup-test.patch deleted file mode 100644 index 073662a..0000000 --- a/gdb-lineno-makeup-test.patch +++ /dev/null @@ -1,151 +0,0 @@ -New testcase for: -https://bugzilla.redhat.com/show_bug.cgi?id=466222 - (for the first / customer recommended fix) -and the upstream fix: -http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html - [rfc] Do not make up line information -http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html - ---- /dev/null -+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c -@@ -0,0 +1,21 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+void -+func (void) -+{ -+} ---- /dev/null -+++ b/gdb/testsuite/gdb.base/lineno-makeup.c -@@ -0,0 +1,35 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number -+ information (.debug_line) so we cannot use an external object file. -+ -+ It must not be just a label as it would alias on the next function even for -+ correct GDB. Therefore some stub data must be placed there. -+ -+ We need to provide a real stub function body as at least s390 -+ (s390_analyze_prologue) would skip the whole body till reaching `main'. */ -+ -+extern void func (void); -+asm ("func: .incbin \"gdb.base/lineno-makeup-func.bin\""); -+ -+int -+main (void) -+{ -+ func (); -+ return 0; -+} ---- /dev/null -+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp -@@ -0,0 +1,78 @@ -+# 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 . -+ -+set testfile "lineno-makeup" -+set srcfuncfile ${testfile}-func.c -+set srcfile ${testfile}.c -+set objfuncfile ${objdir}/${subdir}/${testfile}-func.o -+set binfuncfile ${objdir}/${subdir}/${testfile}-func.bin -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output] -+verbose -log "objcopy=$objcopy: $output" -+if { $objcopy != 0 } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+set binfuncfilesize [file size $binfuncfile] -+verbose -log "file size $binfuncfile = $binfuncfilesize" -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set b_addr "" -+set test "break func" -+gdb_test_multiple $test $test { -+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { -+ set b_addr $expect_out(1,string) -+ pass $test -+ } -+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" { -+ set b_addr $expect_out(1,string) -+ fail $test -+ } -+} -+verbose -log "b_addr=<$b_addr>" -+ -+set p_addr "" -+set test "print func" -+gdb_test_multiple $test $test { -+ -re "\\$\[0-9\]+ = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" { -+ set p_addr $expect_out(1,string) -+ pass $test -+ } -+} -+verbose -log "p_addr=<$p_addr>" -+ -+set test "break address belongs to func" -+if {$b_addr == $p_addr} { -+ pass "$test (exact match)" -+} else { -+ set skip [expr $b_addr - $p_addr] -+ if {$skip > 0 && $skip < $binfuncfilesize} { -+ pass "$test (prologue skip by $skip bytes)" -+ } else { -+ fail $test -+ } -+} diff --git a/gdb-minidebuginfo.patch b/gdb-minidebuginfo.patch deleted file mode 100644 index d6e6f7e..0000000 --- a/gdb-minidebuginfo.patch +++ /dev/null @@ -1,1056 +0,0 @@ -http://fedoraproject.org/wiki/Features/MiniDebugInfo -https://bugzilla.redhat.com/show_bug.cgi?id=834068 - -Patch by Alexander Larsson. -Review/modifications and testfile by Jan Kratochvil. - -Index: gdb-7.4.91.20120801/gdb/Makefile.in -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/Makefile.in 2012-08-01 18:44:51.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/Makefile.in 2012-08-01 18:47:05.701820594 +0200 -@@ -151,6 +151,9 @@ READLINE_CFLAGS = @READLINE_CFLAGS@ - # Where is expat? This will be empty if expat was not available. - LIBEXPAT = @LIBEXPAT@ - -+# Where is lzma? This will be empty if lzma was not available. -+LIBLZMA = @LIBLZMA@ -+ - WARN_CFLAGS = @WARN_CFLAGS@ - WERROR_CFLAGS = @WERROR_CFLAGS@ - GDB_WARN_CFLAGS = $(WARN_CFLAGS) -@@ -467,7 +470,7 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CF - # LIBIBERTY appears twice on purpose. - CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \ - $(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ @PYTHON_LIBS@ \ -- $(LIBEXPAT) \ -+ $(LIBEXPAT) $(LIBLZMA) \ - $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) - CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \ - $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) -Index: gdb-7.4.91.20120801/gdb/config.in -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/config.in 2012-08-01 18:45:21.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/config.in 2012-08-01 18:47:05.701820594 +0200 -@@ -198,6 +198,9 @@ - /* Define to 1 if you have the `libiconvlist' function. */ - #undef HAVE_LIBICONVLIST - -+/* Define if you have the lzma library. */ -+#undef HAVE_LIBLZMA -+ - /* Define to 1 if you have the `m' library (-lm). */ - #undef HAVE_LIBM - -Index: gdb-7.4.91.20120801/gdb/configure -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/configure 2012-08-01 18:45:21.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/configure 2012-08-01 18:47:05.703820583 +0200 -@@ -641,6 +641,9 @@ TCL_VERSION - WIN32LDAPP - GUI_CFLAGS_X - LIBGUI -+LTLIBLZMA -+LIBLZMA -+HAVE_LIBLZMA - WIN32LIBS - SER_HARDWIRE - WERROR_CFLAGS -@@ -813,6 +816,8 @@ with_system_gdbinit - enable_werror - enable_build_warnings - enable_gdb_build_warnings -+with_lzma -+with_liblzma_prefix - with_tcl - with_tk - with_x -@@ -1532,6 +1537,9 @@ Optional Packages: - --with-sysroot[=DIR] search for usr/lib et al within DIR - --with-system-gdbinit=PATH - automatically load a system-wide gdbinit file -+ --with-lzma support lzma compression (auto/yes/no) -+ --with-liblzma-prefix[=DIR] search for liblzma in DIR/include and DIR/lib -+ --without-liblzma-prefix don't search for liblzma in includedir and libdir - --with-tcl directory containing tcl configuration (tclConfig.sh) - --with-tk directory containing tk configuration (tkConfig.sh) - --with-x use the X Window System -@@ -13151,6 +13159,494 @@ LIBS=$OLD_LIBS - # Add any host-specific objects to GDB. - CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}" - -+# If building on ELF, look for lzma support for embedded compressed debug info. -+if test $gdb_cv_var_elf = yes; then -+ -+# Check whether --with-lzma was given. -+if test "${with_lzma+set}" = set; then : -+ withval=$with_lzma; -+else -+ with_lzma=auto -+fi -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use lzma" >&5 -+$as_echo_n "checking whether to use lzma... " >&6; } -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_lzma" >&5 -+$as_echo "$with_lzma" >&6; } -+ -+ if test "${with_lzma}" != no; then -+ -+ -+ -+ -+ -+ -+ -+ -+ use_additional=yes -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ -+ eval additional_includedir=\"$includedir\" -+ eval additional_libdir=\"$libdir\" -+ -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ -+# Check whether --with-liblzma-prefix was given. -+if test "${with_liblzma_prefix+set}" = set; then : -+ withval=$with_liblzma_prefix; -+ if test "X$withval" = "Xno"; then -+ use_additional=no -+ else -+ if test "X$withval" = "X"; then -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ -+ eval additional_includedir=\"$includedir\" -+ eval additional_libdir=\"$libdir\" -+ -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ else -+ additional_includedir="$withval/include" -+ additional_libdir="$withval/lib" -+ fi -+ fi -+ -+fi -+ -+ LIBLZMA= -+ LTLIBLZMA= -+ INCLZMA= -+ rpathdirs= -+ ltrpathdirs= -+ names_already_handled= -+ names_next_round='lzma ' -+ while test -n "$names_next_round"; do -+ names_this_round="$names_next_round" -+ names_next_round= -+ for name in $names_this_round; do -+ already_handled= -+ for n in $names_already_handled; do -+ if test "$n" = "$name"; then -+ already_handled=yes -+ break -+ fi -+ done -+ if test -z "$already_handled"; then -+ names_already_handled="$names_already_handled $name" -+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` -+ eval value=\"\$HAVE_LIB$uppername\" -+ if test -n "$value"; then -+ if test "$value" = yes; then -+ eval value=\"\$LIB$uppername\" -+ test -z "$value" || LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$value" -+ eval value=\"\$LTLIB$uppername\" -+ test -z "$value" || LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }$value" -+ else -+ : -+ fi -+ else -+ found_dir= -+ found_la= -+ found_so= -+ found_a= -+ if test $use_additional = yes; then -+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then -+ found_dir="$additional_libdir" -+ found_so="$additional_libdir/lib$name.$shlibext" -+ if test -f "$additional_libdir/lib$name.la"; then -+ found_la="$additional_libdir/lib$name.la" -+ fi -+ else -+ if test -f "$additional_libdir/lib$name.$libext"; then -+ found_dir="$additional_libdir" -+ found_a="$additional_libdir/lib$name.$libext" -+ if test -f "$additional_libdir/lib$name.la"; then -+ found_la="$additional_libdir/lib$name.la" -+ fi -+ fi -+ fi -+ fi -+ if test "X$found_dir" = "X"; then -+ for x in $LDFLAGS $LTLIBLZMA; do -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ eval x=\"$x\" -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ case "$x" in -+ -L*) -+ dir=`echo "X$x" | sed -e 's/^X-L//'` -+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then -+ found_dir="$dir" -+ found_so="$dir/lib$name.$shlibext" -+ if test -f "$dir/lib$name.la"; then -+ found_la="$dir/lib$name.la" -+ fi -+ else -+ if test -f "$dir/lib$name.$libext"; then -+ found_dir="$dir" -+ found_a="$dir/lib$name.$libext" -+ if test -f "$dir/lib$name.la"; then -+ found_la="$dir/lib$name.la" -+ fi -+ fi -+ fi -+ ;; -+ esac -+ if test "X$found_dir" != "X"; then -+ break -+ fi -+ done -+ fi -+ if test "X$found_dir" != "X"; then -+ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-L$found_dir -l$name" -+ if test "X$found_so" != "X"; then -+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" -+ else -+ haveit= -+ for x in $ltrpathdirs; do -+ if test "X$x" = "X$found_dir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ ltrpathdirs="$ltrpathdirs $found_dir" -+ fi -+ if test "$hardcode_direct" = yes; then -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" -+ else -+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" -+ haveit= -+ for x in $rpathdirs; do -+ if test "X$x" = "X$found_dir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ rpathdirs="$rpathdirs $found_dir" -+ fi -+ else -+ haveit= -+ for x in $LDFLAGS $LIBLZMA; do -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ eval x=\"$x\" -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ if test "X$x" = "X-L$found_dir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$found_dir" -+ fi -+ if test "$hardcode_minus_L" != no; then -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" -+ else -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-l$name" -+ fi -+ fi -+ fi -+ fi -+ else -+ if test "X$found_a" != "X"; then -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_a" -+ else -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$found_dir -l$name" -+ fi -+ fi -+ additional_includedir= -+ case "$found_dir" in -+ */lib | */lib/) -+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` -+ additional_includedir="$basedir/include" -+ ;; -+ esac -+ if test "X$additional_includedir" != "X"; then -+ if test "X$additional_includedir" != "X/usr/include"; then -+ haveit= -+ if test "X$additional_includedir" = "X/usr/local/include"; then -+ if test -n "$GCC"; then -+ case $host_os in -+ linux*) haveit=yes;; -+ esac -+ fi -+ fi -+ if test -z "$haveit"; then -+ for x in $CPPFLAGS $INCLZMA; do -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ eval x=\"$x\" -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ if test "X$x" = "X-I$additional_includedir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ if test -d "$additional_includedir"; then -+ INCLZMA="${INCLZMA}${INCLZMA:+ }-I$additional_includedir" -+ fi -+ fi -+ fi -+ fi -+ fi -+ if test -n "$found_la"; then -+ save_libdir="$libdir" -+ case "$found_la" in -+ */* | *\\*) . "$found_la" ;; -+ *) . "./$found_la" ;; -+ esac -+ libdir="$save_libdir" -+ for dep in $dependency_libs; do -+ case "$dep" in -+ -L*) -+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` -+ if test "X$additional_libdir" != "X/usr/lib"; then -+ haveit= -+ if test "X$additional_libdir" = "X/usr/local/lib"; then -+ if test -n "$GCC"; then -+ case $host_os in -+ linux*) haveit=yes;; -+ esac -+ fi -+ fi -+ if test -z "$haveit"; then -+ haveit= -+ for x in $LDFLAGS $LIBLZMA; do -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ eval x=\"$x\" -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ if test "X$x" = "X-L$additional_libdir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ if test -d "$additional_libdir"; then -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$additional_libdir" -+ fi -+ fi -+ haveit= -+ for x in $LDFLAGS $LTLIBLZMA; do -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ eval x=\"$x\" -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ if test "X$x" = "X-L$additional_libdir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ if test -d "$additional_libdir"; then -+ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-L$additional_libdir" -+ fi -+ fi -+ fi -+ fi -+ ;; -+ -R*) -+ dir=`echo "X$dep" | sed -e 's/^X-R//'` -+ if test "$enable_rpath" != no; then -+ haveit= -+ for x in $rpathdirs; do -+ if test "X$x" = "X$dir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ rpathdirs="$rpathdirs $dir" -+ fi -+ haveit= -+ for x in $ltrpathdirs; do -+ if test "X$x" = "X$dir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ ltrpathdirs="$ltrpathdirs $dir" -+ fi -+ fi -+ ;; -+ -l*) -+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` -+ ;; -+ *.la) -+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` -+ ;; -+ *) -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$dep" -+ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }$dep" -+ ;; -+ esac -+ done -+ fi -+ else -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-l$name" -+ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-l$name" -+ fi -+ fi -+ fi -+ done -+ done -+ if test "X$rpathdirs" != "X"; then -+ if test -n "$hardcode_libdir_separator"; then -+ alldirs= -+ for found_dir in $rpathdirs; do -+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" -+ done -+ acl_save_libdir="$libdir" -+ libdir="$alldirs" -+ eval flag=\"$hardcode_libdir_flag_spec\" -+ libdir="$acl_save_libdir" -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$flag" -+ else -+ for found_dir in $rpathdirs; do -+ acl_save_libdir="$libdir" -+ libdir="$found_dir" -+ eval flag=\"$hardcode_libdir_flag_spec\" -+ libdir="$acl_save_libdir" -+ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$flag" -+ done -+ fi -+ fi -+ if test "X$ltrpathdirs" != "X"; then -+ for found_dir in $ltrpathdirs; do -+ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-R$found_dir" -+ done -+ fi -+ -+ -+ ac_save_CPPFLAGS="$CPPFLAGS" -+ -+ for element in $INCLZMA; do -+ haveit= -+ for x in $CPPFLAGS; do -+ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ eval x=\"$x\" -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+ -+ if test "X$x" = "X$element"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" -+ fi -+ done -+ -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for liblzma" >&5 -+$as_echo_n "checking for liblzma... " >&6; } -+if test "${ac_cv_liblzma+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ -+ ac_save_LIBS="$LIBS" -+ LIBS="$LIBS $LIBLZMA" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#include "lzma.h" -+int -+main () -+{ -+lzma_index_iter iter; -+ lzma_index_iter_init (&iter, 0); -+ lzma_mf_is_supported (LZMA_MF_HC3); -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ ac_cv_liblzma=yes -+else -+ ac_cv_liblzma=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LIBS="$ac_save_LIBS" -+ -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_liblzma" >&5 -+$as_echo "$ac_cv_liblzma" >&6; } -+ if test "$ac_cv_liblzma" = yes; then -+ HAVE_LIBLZMA=yes -+ -+$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with liblzma" >&5 -+$as_echo_n "checking how to link with liblzma... " >&6; } -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBLZMA" >&5 -+$as_echo "$LIBLZMA" >&6; } -+ else -+ HAVE_LIBLZMA=no -+ CPPFLAGS="$ac_save_CPPFLAGS" -+ LIBLZMA= -+ LTLIBLZMA= -+ fi -+ -+ -+ -+ -+ -+ -+ if test "$HAVE_LIBLZMA" != yes; then -+ if test "$with_lzma" = yes; then -+ as_fn_error "missing liblzma for --with-lzma" "$LINENO" 5 -+ fi -+ fi -+ fi -+fi -+ - LIBGUI="../libgui/src/libgui.a" - GUI_CFLAGS_X="-I${srcdir}/../libgui/src" - -Index: gdb-7.4.91.20120801/gdb/configure.ac -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/configure.ac 2012-08-01 18:45:21.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/configure.ac 2012-08-01 18:47:05.704820577 +0200 -@@ -2196,6 +2196,27 @@ LIBS=$OLD_LIBS - # Add any host-specific objects to GDB. - CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}" - -+# If building on ELF, look for lzma support for embedded compressed debug info. -+if test $gdb_cv_var_elf = yes; then -+ AC_ARG_WITH(lzma, -+ AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]), -+ [], [with_lzma=auto]) -+ AC_MSG_CHECKING([whether to use lzma]) -+ AC_MSG_RESULT([$with_lzma]) -+ -+ if test "${with_lzma}" != no; then -+ AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include "lzma.h"], -+ [lzma_index_iter iter; -+ lzma_index_iter_init (&iter, 0); -+ lzma_mf_is_supported (LZMA_MF_HC3);]) -+ if test "$HAVE_LIBLZMA" != yes; then -+ if test "$with_lzma" = yes; then -+ AC_MSG_ERROR([missing liblzma for --with-lzma]) -+ fi -+ fi -+ fi -+fi -+ - LIBGUI="../libgui/src/libgui.a" - GUI_CFLAGS_X="-I${srcdir}/../libgui/src" - AC_SUBST(LIBGUI) -Index: gdb-7.4.91.20120801/gdb/elfread.c -=================================================================== ---- gdb-7.4.91.20120801.orig/gdb/elfread.c 2012-08-01 18:44:51.000000000 +0200 -+++ gdb-7.4.91.20120801/gdb/elfread.c 2012-08-01 18:57:59.528202398 +0200 -@@ -51,6 +51,10 @@ - #include "observer.h" - #include "elf/external.h" - #include -+#include "gdbcore.h" -+#ifdef HAVE_LIBLZMA -+# include -+#endif - - extern void _initialize_elfread (void); - -@@ -2210,6 +2214,262 @@ find_separate_debug_file_by_buildid (str - return NULL; - } - -+#ifdef HAVE_LIBLZMA -+ -+/* Custom lzma_allocator.alloc so they use the gdb ones. */ -+ -+static void * -+alloc_lzma (void *opaque, size_t nmemb, size_t size) -+{ -+ return xmalloc (nmemb * size); -+} -+ -+/* Custom lzma_allocator.free so they use the gdb ones. */ -+ -+static void -+free_lzma (void *opaque, void *ptr) -+{ -+ xfree (ptr); -+} -+ -+/* It cannot be const due to the lzma library function prototypes. */ -+ -+static lzma_allocator gdb_lzma_allocator = { alloc_lzma, free_lzma, NULL}; -+ -+/* Custom bfd_openr_iovec implementation to read compressed data from a -+ section. This keeps only the last decompressed block in memory to -+ allow larger data without using to much memory. */ -+ -+struct lzma_stream -+{ -+ /* Section of input BFD we are decoding data from. */ -+ asection *section; -+ -+ /* lzma library decompression state. */ -+ lzma_index *index; -+ -+ /* Currently decoded block. */ -+ bfd_size_type data_start; -+ bfd_size_type data_end; -+ gdb_byte *data; -+}; -+ -+/* bfd_openr_iovec OPEN_P implementation for -+ find_separate_debug_file_in_section. OPEN_CLOSURE is 'asection *' of the -+ section to decompress. -+ -+ Return 'struct lzma_stream *' must be freed by caller by xfree, together -+ with its INDEX lzma data. */ -+ -+static void * -+lzma_open (struct bfd *nbfd, void *open_closure) -+{ -+ asection *section = open_closure; -+ bfd_size_type size, offset; -+ lzma_stream_flags options; -+ gdb_byte footer[LZMA_STREAM_HEADER_SIZE]; -+ gdb_byte *indexdata; -+ lzma_index *index; -+ int ret; -+ uint64_t memlimit = UINT64_MAX; -+ struct lzma_stream *lstream; -+ size_t pos; -+ -+ size = bfd_get_section_size (section); -+ offset = section->filepos + size - LZMA_STREAM_HEADER_SIZE; -+ if (size < LZMA_STREAM_HEADER_SIZE -+ || bfd_seek (section->owner, offset, SEEK_SET) != 0 -+ || bfd_bread (footer, LZMA_STREAM_HEADER_SIZE, section->owner) -+ != LZMA_STREAM_HEADER_SIZE -+ || lzma_stream_footer_decode (&options, footer) != LZMA_OK -+ || offset < options.backward_size) -+ { -+ bfd_set_error (bfd_error_wrong_format); -+ return NULL; -+ } -+ -+ offset -= options.backward_size; -+ indexdata = xmalloc (options.backward_size); -+ index = NULL; -+ pos = 0; -+ if (bfd_seek (section->owner, offset, SEEK_SET) != 0 -+ || bfd_bread (indexdata, options.backward_size, section->owner) -+ != options.backward_size -+ || lzma_index_buffer_decode (&index, &memlimit, &gdb_lzma_allocator, -+ indexdata, &pos, options.backward_size) -+ != LZMA_OK -+ || lzma_index_size (index) != options.backward_size) -+ { -+ xfree (indexdata); -+ bfd_set_error (bfd_error_wrong_format); -+ return NULL; -+ } -+ xfree (indexdata); -+ -+ lstream = xzalloc (sizeof (struct lzma_stream)); -+ lstream->section = section; -+ lstream->index = index; -+ -+ return lstream; -+} -+ -+/* bfd_openr_iovec PREAD_P implementation for -+ find_separate_debug_file_in_section. Passed STREAM -+ is 'struct lzma_stream *'. */ -+ -+static file_ptr -+lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes, -+ file_ptr offset) -+{ -+ struct lzma_stream *lstream = stream; -+ bfd_size_type chunk_size; -+ lzma_index_iter iter; -+ gdb_byte *compressed, *uncompressed; -+ file_ptr block_offset; -+ lzma_filter filters[LZMA_FILTERS_MAX + 1]; -+ lzma_block block; -+ size_t compressed_pos, uncompressed_pos; -+ file_ptr res; -+ -+ res = 0; -+ while (nbytes > 0) -+ { -+ if (lstream->data == NULL -+ || lstream->data_start > offset || offset >= lstream->data_end) -+ { -+ asection *section = lstream->section; -+ -+ lzma_index_iter_init (&iter, lstream->index); -+ if (lzma_index_iter_locate (&iter, offset)) -+ break; -+ -+ compressed = xmalloc (iter.block.total_size); -+ block_offset = section->filepos + iter.block.compressed_file_offset; -+ if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0 -+ || bfd_bread (compressed, iter.block.total_size, section->owner) -+ != iter.block.total_size) -+ { -+ xfree (compressed); -+ break; -+ } -+ -+ uncompressed = xmalloc (iter.block.uncompressed_size); -+ -+ memset (&block, 0, sizeof (block)); -+ block.filters = filters; -+ block.header_size = lzma_block_header_size_decode (compressed[0]); -+ if (lzma_block_header_decode (&block, &gdb_lzma_allocator, compressed) -+ != LZMA_OK) -+ { -+ xfree (compressed); -+ xfree (uncompressed); -+ break; -+ } -+ -+ compressed_pos = block.header_size; -+ uncompressed_pos = 0; -+ if (lzma_block_buffer_decode (&block, &gdb_lzma_allocator, -+ compressed, &compressed_pos, -+ iter.block.total_size, -+ uncompressed, &uncompressed_pos, -+ iter.block.uncompressed_size) -+ != LZMA_OK) -+ { -+ xfree (compressed); -+ xfree (uncompressed); -+ break; -+ } -+ -+ xfree (compressed); -+ -+ xfree (lstream->data); -+ lstream->data = uncompressed; -+ lstream->data_start = iter.block.uncompressed_file_offset; -+ lstream->data_end = (iter.block.uncompressed_file_offset -+ + iter.block.uncompressed_size); -+ } -+ -+ chunk_size = min (nbytes, lstream->data_end - offset); -+ memcpy (buf, lstream->data + offset - lstream->data_start, chunk_size); -+ buf = (gdb_byte *) buf + chunk_size; -+ offset += chunk_size; -+ nbytes -= chunk_size; -+ res += chunk_size; -+ } -+ -+ return res; -+} -+ -+/* bfd_openr_iovec CLOSE_P implementation for -+ find_separate_debug_file_in_section. Passed STREAM -+ is 'struct lzma_stream *'. */ -+ -+static int -+lzma_close (struct bfd *nbfd, -+ void *stream) -+{ -+ struct lzma_stream *lstream = stream; -+ -+ lzma_index_end (lstream->index, &gdb_lzma_allocator); -+ xfree (lstream->data); -+ xfree (lstream); -+ return 0; -+} -+ -+/* bfd_openr_iovec STAT_P implementation for -+ find_separate_debug_file_in_section. Passed STREAM -+ is 'struct lzma_stream *'. */ -+ -+static int -+lzma_stat (struct bfd *abfd, -+ void *stream, -+ struct stat *sb) -+{ -+ struct lzma_stream *lstream = stream; -+ -+ sb->st_size = lzma_index_uncompressed_size (lstream->index); -+ return 0; -+} -+ -+/* This looks for a xz compressed separate debug info object file embedded -+ in a section called .gnu_debugdata. If we find one we create a iovec -+ based bfd that decompresses the object data on demand. */ -+ -+static bfd * -+find_separate_debug_file_in_section (struct objfile *objfile) -+{ -+ asection *section; -+ bfd *abfd; -+ -+ section = bfd_get_section_by_name (objfile->obfd, ".gnu_debugdata"); -+ if (section == NULL) -+ return NULL; -+ -+ /* objfile->NAME lifetime is longer than the ABFD's lifetime. */ -+ abfd = gdb_bfd_openr_iovec (objfile->name, gnutarget, lzma_open, section, -+ lzma_pread, lzma_close, lzma_stat); -+ if (abfd == NULL) -+ return NULL; -+ -+ if (!bfd_check_format (abfd, bfd_object)) -+ { -+ gdb_bfd_unref (abfd); -+ return NULL; -+ } -+ -+ return abfd; -+} -+ -+#else /* !HAVE_LIBLZMA */ -+ -+static bfd * -+find_separate_debug_file_in_section (struct objfile *objfile) -+{ -+ return NULL; -+} -+ -+#endif /* !HAVE_LIBLZMA */ -+ - /* Scan and build partial symbols for a symbol file. - We have been initialized by a call to elf_symfile_init, which - currently does nothing. -@@ -2433,6 +2693,8 @@ elf_symfile_read (struct objfile *objfil - else if (!objfile_has_partial_symbols (objfile)) - { - char *debugfile, *build_id_filename; -+ bfd *abfd = NULL; -+ struct cleanup *cleanup; - - debugfile = find_separate_debug_file_by_buildid (objfile, - &build_id_filename); -@@ -2440,14 +2702,11 @@ elf_symfile_read (struct objfile *objfil - if (debugfile == NULL) - debugfile = find_separate_debug_file_by_debuglink (objfile); - -+ cleanup = make_cleanup (xfree, debugfile); - if (debugfile) - { -- struct cleanup *cleanup = make_cleanup (xfree, debugfile); -- bfd *abfd = symfile_bfd_open (debugfile); -- -+ abfd = symfile_bfd_open (debugfile); - make_cleanup_bfd_unref (abfd); -- symbol_file_add_separate (abfd, symfile_flags, objfile); -- do_cleanups (cleanup); - } - /* Check if any separate debug info has been extracted out. */ - else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") -@@ -2455,6 +2714,17 @@ elf_symfile_read (struct objfile *objfil - debug_print_missing (objfile->name, build_id_filename); - - xfree (build_id_filename); -+ -+ if (abfd == NULL) -+ { -+ abfd = find_separate_debug_file_in_section (objfile); -+ make_cleanup_bfd_unref (abfd); -+ } -+ -+ if (abfd != NULL) -+ symbol_file_add_separate (abfd, symfile_flags, objfile); -+ -+ do_cleanups (cleanup); - } - - if (symtab_create_debug) -Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.c 2012-08-01 18:47:05.705820572 +0200 -@@ -0,0 +1,30 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+#include -+ -+static int -+debugdata_function (void) -+{ -+ return raise (SIGSEGV) + 1; -+} -+ -+int -+main (void) -+{ -+ return debugdata_function () + 1; -+} -Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.exp 2012-08-01 18:47:05.705820572 +0200 -@@ -0,0 +1,91 @@ -+# Copyright 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 . -+ -+standard_testfile -+ -+load_lib dwarf.exp -+if ![dwarf2_support] { -+ return 0 -+} -+ -+if [build_executable ${testfile}.exp $testfile] { -+ return -1 -+} -+ -+proc run { test cmdline } { -+ verbose "cmdline is $cmdline" -+ set result [catch "exec $cmdline" output] -+ verbose "result is $result" -+ verbose "output is $output" -+ if {$result == 0} { -+ pass $test -+ return 0 -+ } else { -+ fail $test -+ return -1 -+ } -+} -+ -+set strip_program [transform strip] -+set nm_program [transform nm] -+ -+# Extract the dynamic symbols from the main binary, there is no need to also have these -+# in the normal symbol table -+file delete -- ${binfile}.dynsyms -+if [run "nm -D" "[transform nm] -D ${binfile} --format=posix --defined-only | awk \\{print\\ \\\$1\\} | sort > ${binfile}.dynsyms"] { -+ return -1 -+} -+ -+# Extract all the text (i.e. function) symbols from the debuginfo -+file delete -- ${binfile}.funcsyms -+if [run "nm" "[transform nm] ${binfile} --format=posix --defined-only | awk \\{if(\\\$2==\"T\"||\\\$2==\"t\")print\\ \\\$1\\} | sort > ${binfile}.funcsyms"] { -+ return -1 -+} -+ -+# Keep all the function symbols not already in the dynamic symbol table -+file delete -- ${binfile}.keep_symbols -+if [run "comm" "comm -13 ${binfile}.dynsyms ${binfile}.funcsyms > ${binfile}.keep_symbols"] { -+ return -1 -+} -+ -+# Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections -+file delete -- ${binfile}.mini_debuginfo -+if [run "objcopy 1" "[transform objcopy] -S --remove-section .gdb_index --remove-section .comment --keep-symbols=${binfile}.keep_symbols ${binfile} ${binfile}.mini_debuginfo"] { -+ return -1 -+} -+ -+# GDB specific - we do not have split executable in advance. -+file delete -- ${binfile}.strip -+if [run "strip" "[transform strip] --strip-all -o ${binfile}.strip ${binfile}"] { -+ return -1 -+} -+ -+# Inject the compressed data into the .gnu_debugdata section of the original binary -+file delete -- ${binfile}.mini_debuginfo.xz -+if [run "xz" "xz ${binfile}.mini_debuginfo"] { -+ return -1 -+} -+file delete -- ${binfile}.test -+if [run "objcopy 2" "[transform objcopy] --add-section .gnu_debugdata=${binfile}.mini_debuginfo.xz ${binfile}.strip ${binfile}.test"] { -+ return -1 -+} -+ -+clean_restart "$testfile.strip" -+ -+gdb_test "p debugdata_function" {No symbol table is loaded\. Use the "file" command\.} "no symtab" -+ -+clean_restart "$testfile.test" -+ -+gdb_test "p debugdata_function" { = {} 0x[0-9a-f]+ } "have symtab" diff --git a/gdb-moribund-utrace-workaround.patch b/gdb-moribund-utrace-workaround.patch deleted file mode 100644 index 6b50a8e..0000000 --- a/gdb-moribund-utrace-workaround.patch +++ /dev/null @@ -1,16 +0,0 @@ -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-ppc-power7-test.patch b/gdb-ppc-power7-test.patch deleted file mode 100644 index 4d4772a..0000000 --- a/gdb-ppc-power7-test.patch +++ /dev/null @@ -1,295 +0,0 @@ ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp -@@ -0,0 +1,182 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Test PowerPC Power7 instructions disassembly. -+ -+if {![istarget "powerpc*-*-*"]} then { -+ verbose "Skipping PowerPC Power7 instructions disassembly." -+ return -+} -+ -+set testfile "powerpc-power7" -+set srcfile ${testfile}.s -+set objfile ${objdir}/${subdir}/${testfile}.o -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } { -+ untested "PowerPC Power7 instructions disassembly" -+ return -1 -+} -+ -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${objfile} -+ -+ -+# Disassemble the function. -+ -+set test "disass func" -+gdb_test_multiple $test $test { -+ -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" { -+ set func $expect_out(1,string) -+ pass $test -+ } -+} -+ -+proc instr_to_patt {offset instr} { -+ # 0x0000000000000018 : stxvd2x vs43,r4,r5 -+ return ".*\r\n\[ \t\]*[string map {0x 0x0*} $offset] <(func)?\\+?\[0-9\]*>:\[ \t\]*[string map [list { } "\[ \t\]+" . {\.}] $instr]\[ \t\]*\r\n.*" -+} -+ -+# KFAIL strings would not exist if -Many would print the same as -Mpower7. -+# That means the power7 form should be the preferred one. -+# http://sourceware.org/ml/gdb-patches/2009-03/threads.html#00020 -+ -+proc func_check {offset instr {kfail ""}} { -+ global func -+ -+ set test "Found $offset: $instr" -+ if [regexp -nocase -line [instr_to_patt $offset $instr] $func] { -+ pass $test -+ } elseif {$kfail != "" && [regexp -nocase -line [instr_to_patt $offset $kfail] $func]} { -+ kfail gdb/NNNN $test -+ } else { -+ fail $test -+ } -+} -+ -+func_check 0x0 "lxvd2x vs3,r4,r5" -+# [PATCH] Remove support for POWER7 VSX load/store with update instructions -+# http://sourceware.org/ml/binutils/2009-09/msg00680.html -+# http://sourceware.org/ml/binutils-cvs/2009-09/msg00331.html -+# lxvd2ux vs3,r4,r5 -+func_check 0x4 ".long 0x7c642ed8" -+func_check 0x8 "lxvd2x vs43,r4,r5" -+# lxvd2ux vs43,r4,r5 -+func_check 0xc ".long 0x7d642ed9" -+func_check 0x10 "stxvd2x vs3,r4,r5" -+# stxvd2ux vs3,r4,r5 -+func_check 0x14 ".long 0x7c642fd8" -+func_check 0x18 "stxvd2x vs43,r4,r5" -+# stxvd2ux vs43,r4,r5 -+func_check 0x1c ".long 0x7d642fd9" -+func_check 0x20 "xxmrghd vs3,vs4,vs5" -+func_check 0x24 "xxmrghd vs43,vs44,vs45" -+func_check 0x28 "xxmrgld vs3,vs4,vs5" -+func_check 0x2c "xxmrgld vs43,vs44,vs45" -+func_check 0x30 "xxmrghd vs3,vs4,vs5" -+func_check 0x34 "xxmrghd vs43,vs44,vs45" -+func_check 0x38 "xxmrgld vs3,vs4,vs5" -+func_check 0x3c "xxmrgld vs43,vs44,vs45" -+func_check 0x40 "xxpermdi vs3,vs4,vs5,1" -+func_check 0x44 "xxpermdi vs43,vs44,vs45,1" -+func_check 0x48 "xxpermdi vs3,vs4,vs5,2" -+func_check 0x4c "xxpermdi vs43,vs44,vs45,2" -+func_check 0x50 "xvmovdp vs3,vs4" -+func_check 0x54 "xvmovdp vs43,vs44" -+func_check 0x58 "xvmovdp vs3,vs4" -+func_check 0x5c "xvmovdp vs43,vs44" -+func_check 0x60 "xvcpsgndp vs3,vs4,vs5" -+func_check 0x64 "xvcpsgndp vs43,vs44,vs45" -+func_check 0x68 "wait" -+func_check 0x6c "wait" -+func_check 0x70 "waitrsv" -+func_check 0x74 "waitrsv" -+func_check 0x78 "waitimpl" -+func_check 0x7c "waitimpl" -+func_check 0x80 "doze" -+func_check 0x84 "nap" -+func_check 0x88 "sleep" -+func_check 0x8c "rvwinkle" -+func_check 0x90 "prtyw r3,r4" -+func_check 0x94 "prtyd r13,r14" -+func_check 0x98 "mfcfar r10" "mfspr r10,28" -+func_check 0x9c "mtcfar r11" "mtspr 28,r11" -+func_check 0xa0 "cmpb r3,r4,r5" -+func_check 0xa4 "lwzcix r10,r11,r12" -+func_check 0xa8 "dadd f16,f17,f18" -+func_check 0xac "daddq f20,f22,f24" -+func_check 0xb0 "dss 3" -+func_check 0xb4 "dssall" -+func_check 0xb8 "dst r5,r4,1" -+func_check 0xbc "dstt r8,r7,0" -+func_check 0xc0 "dstst r5,r6,3" -+func_check 0xc4 "dststt r4,r5,2" -+func_check 0xc8 "divwe r10,r11,r12" -+func_check 0xcc "divwe. r11,r12,r13" -+func_check 0xd0 "divweo r12,r13,r14" -+func_check 0xd4 "divweo. r13,r14,r15" -+func_check 0xd8 "divweu r10,r11,r12" -+func_check 0xdc "divweu. r11,r12,r13" -+func_check 0xe0 "divweuo r12,r13,r14" -+func_check 0xe4 "divweuo. r13,r14,r15" -+func_check 0xe8 "bpermd r7,r17,r27" -+func_check 0xec "popcntw r10,r20" -+func_check 0xf0 "popcntd r10,r20" -+func_check 0xf4 "ldbrx r20,r21,r22" -+func_check 0xf8 "stdbrx r20,r21,r22" -+func_check 0xfc "lfiwzx f10,0,r10" -+func_check 0x100 "lfiwzx f10,r9,r10" -+func_check 0x104 "fcfids f4,f5" -+func_check 0x108 "fcfids. f4,f5" -+func_check 0x10c "fcfidus f4,f5" -+func_check 0x110 "fcfidus. f4,f5" -+func_check 0x114 "fctiwu f4,f5" -+func_check 0x118 "fctiwu. f4,f5" -+func_check 0x11c "fctiwuz f4,f5" -+func_check 0x120 "fctiwuz. f4,f5" -+func_check 0x124 "fctidu f4,f5" -+func_check 0x128 "fctidu. f4,f5" -+func_check 0x12c "fctiduz f4,f5" -+func_check 0x130 "fctiduz. f4,f5" -+func_check 0x134 "fcfidu f4,f5" -+func_check 0x138 "fcfidu. f4,f5" -+func_check 0x13c "ftdiv cr0,f10,f11" -+func_check 0x140 "ftdiv cr7,f10,f11" -+func_check 0x144 "ftsqrt cr0,f10" -+func_check 0x148 "ftsqrt cr7,f10" -+func_check 0x14c "dcbtt r8,r9" "dcbt 16,r8,r9" -+func_check 0x150 "dcbtstt r8,r9" "dcbtst 16,r8,r9" -+func_check 0x154 "dcffix f10,f12" -+func_check 0x158 "dcffix. f20,f22" -+func_check 0x15c "lbarx r10,r11,r12" -+func_check 0x160 "lbarx r10,r11,r12" -+func_check 0x164 "lbarx r10,r11,r12,1" -+func_check 0x168 "lharx r20,r21,r22" -+func_check 0x16c "lharx r20,r21,r22" -+func_check 0x170 "lharx r20,r21,r22,1" -+func_check 0x174 "stbcx. r10,r11,r12" -+func_check 0x178 "sthcx. r10,r11,r12" -+func_check 0x17c "fre f14,f15" -+func_check 0x180 "fre. f14,f15" -+func_check 0x184 "fres f14,f15" -+func_check 0x188 "fres. f14,f15" -+func_check 0x18c "frsqrte f14,f15" -+func_check 0x190 "frsqrte. f14,f15" -+func_check 0x194 "frsqrtes f14,f15" -+func_check 0x198 "frsqrtes. f14,f15" -+func_check 0x19c "isel r2,r3,r4,28" ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/powerpc-power7.s -@@ -0,0 +1,107 @@ -+ .text -+ .globl func -+func: -+ .long 0x7c642e98 /* 0: lxvd2x vs3,r4,r5 */ -+ .long 0x7c642ed8 /* 4: lxvd2ux vs3,r4,r5 */ -+ .long 0x7d642e99 /* 8: lxvd2x vs43,r4,r5 */ -+ .long 0x7d642ed9 /* c: lxvd2ux vs43,r4,r5 */ -+ .long 0x7c642f98 /* 10: stxvd2x vs3,r4,r5 */ -+ .long 0x7c642fd8 /* 14: stxvd2ux vs3,r4,r5 */ -+ .long 0x7d642f99 /* 18: stxvd2x vs43,r4,r5 */ -+ .long 0x7d642fd9 /* 1c: stxvd2ux vs43,r4,r5 */ -+ .long 0xf0642850 /* 20: xxmrghd vs3,vs4,vs5 */ -+ .long 0xf16c6857 /* 24: xxmrghd vs43,vs44,vs45 */ -+ .long 0xf0642b50 /* 28: xxmrgld vs3,vs4,vs5 */ -+ .long 0xf16c6b57 /* 2c: xxmrgld vs43,vs44,vs45 */ -+ .long 0xf0642850 /* 30: xxmrghd vs3,vs4,vs5 */ -+ .long 0xf16c6857 /* 34: xxmrghd vs43,vs44,vs45 */ -+ .long 0xf0642b50 /* 38: xxmrgld vs3,vs4,vs5 */ -+ .long 0xf16c6b57 /* 3c: xxmrgld vs43,vs44,vs45 */ -+ .long 0xf0642950 /* 40: xxpermdi vs3,vs4,vs5,1 */ -+ .long 0xf16c6957 /* 44: xxpermdi vs43,vs44,vs45,1 */ -+ .long 0xf0642a50 /* 48: xxpermdi vs3,vs4,vs5,2 */ -+ .long 0xf16c6a57 /* 4c: xxpermdi vs43,vs44,vs45,2 */ -+ .long 0xf0642780 /* 50: xvmovdp vs3,vs4 */ -+ .long 0xf16c6787 /* 54: xvmovdp vs43,vs44 */ -+ .long 0xf0642780 /* 58: xvmovdp vs3,vs4 */ -+ .long 0xf16c6787 /* 5c: xvmovdp vs43,vs44 */ -+ .long 0xf0642f80 /* 60: xvcpsgndp vs3,vs4,vs5 */ -+ .long 0xf16c6f87 /* 64: xvcpsgndp vs43,vs44,vs45 */ -+ .long 0x7c00007c /* 68: wait */ -+ .long 0x7c00007c /* 6c: wait */ -+ .long 0x7c20007c /* 70: waitrsv */ -+ .long 0x7c20007c /* 74: waitrsv */ -+ .long 0x7c40007c /* 78: waitimpl */ -+ .long 0x7c40007c /* 7c: waitimpl */ -+ .long 0x4c000324 /* 80: doze */ -+ .long 0x4c000364 /* 84: nap */ -+ .long 0x4c0003a4 /* 88: sleep */ -+ .long 0x4c0003e4 /* 8c: rvwinkle */ -+ .long 0x7c830134 /* 90: prtyw r3,r4 */ -+ .long 0x7dcd0174 /* 94: prtyd r13,r14 */ -+ .long 0x7d5c02a6 /* 98: mfcfar r10 */ -+ .long 0x7d7c03a6 /* 9c: mtcfar r11 */ -+ .long 0x7c832bf8 /* a0: cmpb r3,r4,r5 */ -+ .long 0x7d4b662a /* a4: lwzcix r10,r11,r12 */ -+ .long 0xee119004 /* a8: dadd f16,f17,f18 */ -+ .long 0xfe96c004 /* ac: daddq f20,f22,f24 */ -+ .long 0x7c60066c /* b0: dss 3 */ -+ .long 0x7e00066c /* b4: dssall */ -+ .long 0x7c2522ac /* b8: dst r5,r4,1 */ -+ .long 0x7e083aac /* bc: dstt r8,r7,0 */ -+ .long 0x7c6532ec /* c0: dstst r5,r6,3 */ -+ .long 0x7e442aec /* c4: dststt r4,r5,2 */ -+ .long 0x7d4b6356 /* c8: divwe r10,r11,r12 */ -+ .long 0x7d6c6b57 /* cc: divwe. r11,r12,r13 */ -+ .long 0x7d8d7756 /* d0: divweo r12,r13,r14 */ -+ .long 0x7dae7f57 /* d4: divweo. r13,r14,r15 */ -+ .long 0x7d4b6316 /* d8: divweu r10,r11,r12 */ -+ .long 0x7d6c6b17 /* dc: divweu. r11,r12,r13 */ -+ .long 0x7d8d7716 /* e0: divweuo r12,r13,r14 */ -+ .long 0x7dae7f17 /* e4: divweuo. r13,r14,r15 */ -+ .long 0x7e27d9f8 /* e8: bpermd r7,r17,r27 */ -+ .long 0x7e8a02f4 /* ec: popcntw r10,r20 */ -+ .long 0x7e8a03f4 /* f0: popcntd r10,r20 */ -+ .long 0x7e95b428 /* f4: ldbrx r20,r21,r22 */ -+ .long 0x7e95b528 /* f8: stdbrx r20,r21,r22 */ -+ .long 0x7d4056ee /* fc: lfiwzx f10,0,r10 */ -+ .long 0x7d4956ee /* 100: lfiwzx f10,r9,r10 */ -+ .long 0xec802e9c /* 104: fcfids f4,f5 */ -+ .long 0xec802e9d /* 108: fcfids. f4,f5 */ -+ .long 0xec802f9c /* 10c: fcfidus f4,f5 */ -+ .long 0xec802f9d /* 110: fcfidus. f4,f5 */ -+ .long 0xfc80291c /* 114: fctiwu f4,f5 */ -+ .long 0xfc80291d /* 118: fctiwu. f4,f5 */ -+ .long 0xfc80291e /* 11c: fctiwuz f4,f5 */ -+ .long 0xfc80291f /* 120: fctiwuz. f4,f5 */ -+ .long 0xfc802f5c /* 124: fctidu f4,f5 */ -+ .long 0xfc802f5d /* 128: fctidu. f4,f5 */ -+ .long 0xfc802f5e /* 12c: fctiduz f4,f5 */ -+ .long 0xfc802f5f /* 130: fctiduz. f4,f5 */ -+ .long 0xfc802f9c /* 134: fcfidu f4,f5 */ -+ .long 0xfc802f9d /* 138: fcfidu. f4,f5 */ -+ .long 0xfc0a5900 /* 13c: ftdiv cr0,f10,f11 */ -+ .long 0xff8a5900 /* 140: ftdiv cr7,f10,f11 */ -+ .long 0xfc005140 /* 144: ftsqrt cr0,f10 */ -+ .long 0xff805140 /* 148: ftsqrt cr7,f10 */ -+ .long 0x7e084a2c /* 14c: dcbtt r8,r9 */ -+ .long 0x7e0849ec /* 150: dcbtstt r8,r9 */ -+ .long 0xed406644 /* 154: dcffix f10,f12 */ -+ .long 0xee80b645 /* 158: dcffix. f20,f22 */ -+ .long 0x7d4b6068 /* 15c: lbarx r10,r11,r12 */ -+ .long 0x7d4b6068 /* 160: lbarx r10,r11,r12 */ -+ .long 0x7d4b6069 /* 164: lbarx r10,r11,r12,1 */ -+ .long 0x7e95b0e8 /* 168: lharx r20,r21,r22 */ -+ .long 0x7e95b0e8 /* 16c: lharx r20,r21,r22 */ -+ .long 0x7e95b0e9 /* 170: lharx r20,r21,r22,1 */ -+ .long 0x7d4b656d /* 174: stbcx. r10,r11,r12 */ -+ .long 0x7d4b65ad /* 178: sthcx. r10,r11,r12 */ -+ .long 0xfdc07830 /* 17c: fre f14,f15 */ -+ .long 0xfdc07831 /* 180: fre. f14,f15 */ -+ .long 0xedc07830 /* 184: fres f14,f15 */ -+ .long 0xedc07831 /* 188: fres. f14,f15 */ -+ .long 0xfdc07834 /* 18c: frsqrte f14,f15 */ -+ .long 0xfdc07835 /* 190: frsqrte. f14,f15 */ -+ .long 0xedc07834 /* 194: frsqrtes f14,f15 */ -+ .long 0xedc07835 /* 198: frsqrtes. f14,f15 */ -+ .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */ diff --git a/gdb-pr12028-double-free.patch b/gdb-pr12028-double-free.patch deleted file mode 100644 index deb2115..0000000 --- a/gdb-pr12028-double-free.patch +++ /dev/null @@ -1,99 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00321.html -Subject: [patch] PR 12028 "GDB crashes on a double free during overload resolution" - -old_cleanups was being set twice making the later call to -discard_cleanups ignore the first 'make_cleanup' request. - -The patch is proposed for both head and the 7.2 branch. - -This has been regression tested on x8664 with gcc-4.4.4-10.fc13 - - -Fix PR 12028: "GDB crashes on a double free during overload resolution " - -2010-09-16 Sami Wagiaalla - - PR C++/12028 - * valops.c (find_oload_champ_namespace_loop): removed incorrect - 'old_cleanups' reassignment. - -2010-09-16 Sami Wagiaalla - - * gdb.cp/pr12028.cc: New. - * gdb.cp/pr12028.exp: New. - -diff --git a/gdb/testsuite/gdb.cp/pr12028.cc b/gdb/testsuite/gdb.cp/pr12028.cc -new file mode 100644 -index 0000000..0fcab6b ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/pr12028.cc -@@ -0,0 +1,21 @@ -+class A{}; -+class B{}; -+class C: public B {}; -+ -+namespace D{ -+ int foo (A) { return 11; } -+ int foo (C) { return 12; } -+} -+ -+int main() -+{ -+ A a; -+ B b; -+ C c; -+ -+ D::foo (a); -+ // D::foo (b); -+ D::foo (c); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp -new file mode 100644 -index 0000000..746c6b5 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/pr12028.exp -@@ -0,0 +1,29 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile pr12028 -+set srcfile ${testfile}.cc -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } { -+ return -1 -+} -+ -+############################################ -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_test "p D::foo(b)" "Cannot resolve function foo to any overloaded instance" -diff --git a/gdb/valops.c b/gdb/valops.c -index 7fbad10..4e83a04 100644 ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -2715,7 +2715,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs, - function symbol to start off with.) */ - - old_cleanups = make_cleanup (xfree, *oload_syms); -- old_cleanups = make_cleanup (xfree, *oload_champ_bv); -+ make_cleanup (xfree, *oload_champ_bv); - new_namespace = alloca (namespace_len + 1); - strncpy (new_namespace, qualified_name, namespace_len); - new_namespace[namespace_len] = '\0'; diff --git a/gdb-print-class.patch b/gdb-print-class.patch deleted file mode 100644 index 4f18381..0000000 --- a/gdb-print-class.patch +++ /dev/null @@ -1,110 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2012-09/msg00169.html - -### src/gdb/ChangeLog 2012/09/27 12:53:57 1.14718 -### src/gdb/ChangeLog 2012/09/27 16:04:18 1.14719 -## -1,3 +1,8 @@ -+2012-09-27 Tom Tromey -+ -+ Fix https://bugzilla.redhat.com/show_bug.cgi?id=849357 -+ * cp-valprint.c (cp_print_value_fields): Use get_vptr_fieldno. -+ - 2012-09-27 Joel Brobecker - - * sol-thread.c (sol_thread_fetch_registers) ---- src/gdb/cp-valprint.c 2012/07/06 05:36:07 1.85 -+++ src/gdb/cp-valprint.c 2012/09/27 16:04:22 1.86 -@@ -210,7 +210,9 @@ - { - int statmem_obstack_initial_size = 0; - int stat_array_obstack_initial_size = 0; -- -+ struct type *vptr_basetype = NULL; -+ int vptr_fieldno; -+ - if (dont_print_statmem == 0) - { - statmem_obstack_initial_size = -@@ -225,6 +227,7 @@ - } - } - -+ vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype); - for (i = n_baseclasses; i < len; i++) - { - /* If requested, skip printing of static fields. */ -@@ -358,7 +361,7 @@ - v, stream, recurse + 1, - options); - } -- else if (i == TYPE_VPTR_FIELDNO (type)) -+ else if (i == vptr_fieldno && type == vptr_basetype) - { - int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; - struct type *i_type = TYPE_FIELD_TYPE (type, i); -### src/gdb/testsuite/ChangeLog 2012/09/26 19:50:12 1.3396 -### src/gdb/testsuite/ChangeLog 2012/09/27 16:04:22 1.3397 -## -1,3 +1,10 @@ -+2012-09-27 Tom Tromey -+ -+ * gdb.cp/derivation.exp: Add regression test. -+ * gdb.cp/derivation.cc (class V_base, class V_inter, class -+ V_derived): New. -+ (vderived): New global. -+ - 2012-09-26 Tom Tromey - - * gdb.dwarf2/dw2-common-block.S: New file. ---- src/gdb/testsuite/gdb.cp/derivation.cc 2011/12/13 17:22:08 1.2 -+++ src/gdb/testsuite/gdb.cp/derivation.cc 2012/09/27 16:04:23 1.3 -@@ -118,8 +118,37 @@ - - }; - -+class V_base -+{ -+public: -+ virtual void m(); -+ int base; -+}; - -+void -+V_base::m() -+{ -+} -+ -+class V_inter : public virtual V_base -+{ -+public: -+ virtual void f(); -+ int inter; -+}; -+ -+void -+V_inter::f() -+{ -+} -+ -+class V_derived : public V_inter -+{ -+public: -+ double x; -+}; - -+V_derived vderived; - - int A::afoo() { - return 1; ---- src/gdb/testsuite/gdb.cp/derivation.exp 2012/07/10 15:18:18 1.19 -+++ src/gdb/testsuite/gdb.cp/derivation.exp 2012/09/27 16:04:23 1.20 -@@ -176,3 +176,11 @@ - - gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.bfoo()" - gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.cfoo()" -+ -+# This is a regression test for a bug that caused a crash when trying -+# to print the vtbl pointer. We don't care about the output so much -+# here (it is tested elsewhere), just that gdb doesn't crash. We test -+# "ptype" first because, before the gdb fix, that was the only code -+# path calling get_vptr_fieldno. -+gdb_test "ptype vderived" "type = .*" -+gdb_test "print vderived" " = {.* inter = 0.*x = 0}" diff --git a/gdb-python-rdynamic.patch b/gdb-python-rdynamic.patch deleted file mode 100644 index a576b72..0000000 --- a/gdb-python-rdynamic.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/gdb/configure -+++ b/gdb/configure -@@ -14631,6 +14631,10 @@ rm -f core conftest.err conftest.$ac_objext \ - # Problem does not happen for the recommended libpythonX.Y.so linkage. - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PYTHON_CFLAGS" -+ old_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" -+ old_LIBS="$LIBS" -+ LIBS="$LIBS $PYTHON_LIBS" - if test "$cross_compiling" = yes; then : - true - else -@@ -14657,6 +14661,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - fi - - CFLAGS="$old_CFLAGS" -+ CPPFLAGS="$old_CPPFLAGS" -+ LIBS="$old_LIBS" - fi - LDFLAGS="$old_LDFLAGS" - fi ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -1576,6 +1576,10 @@ if test "${gdb_native}" = yes; then - # Problem does not happen for the recommended libpythonX.Y.so linkage. - old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PYTHON_CFLAGS" -+ old_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" -+ old_LIBS="$LIBS" -+ LIBS="$LIBS $PYTHON_LIBS" - AC_RUN_IFELSE( - AC_LANG_PROGRAM( - [#include "]${have_libpython}[/Python.h"], -@@ -1586,6 +1590,8 @@ if test "${gdb_native}" = yes; then - return err == 0 ? 0 : 1;]), - [dynamic_list=true], [], [true]) - CFLAGS="$old_CFLAGS" -+ CPPFLAGS="$old_CPPFLAGS" -+ LIBS="$old_LIBS" - fi - LDFLAGS="$old_LDFLAGS" - fi diff --git a/gdb-readline62-ask-more-rh.patch b/gdb-readline62-ask-more-rh.patch deleted file mode 100644 index 6f110be..0000000 --- a/gdb-readline62-ask-more-rh.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- gdb-7.4.50.20120103-orig/gdb/event-top.c 2012-01-11 15:14:01.426206439 +0100 -+++ gdb-7.4.50.20120103/gdb/event-top.c 2012-01-11 15:18:29.766577551 +0100 -@@ -982,6 +982,11 @@ set_async_editing_command (char *args, i - void - gdb_setup_readline (void) - { -+ /* 6.2 regression: no longed asks for --more-- -+ gdb.base/readline-ask.exp -+ https://bugzilla.redhat.com/show_bug.cgi?id=701131 */ -+ RL_SETSTATE (RL_STATE_FEDORA_GDB); -+ - /* This function is a noop for the sync case. The assumption is - that the sync setup is ALL done in gdb_init, and we would only - mess it up here. The sync stuff should really go away over diff --git a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch deleted file mode 100644 index 446709d..0000000 --- a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +++ /dev/null @@ -1,75 +0,0 @@ -Index: gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c -=================================================================== ---- /dev/null -+++ gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c -@@ -0,0 +1,26 @@ -+/* Copyright (C) 2012 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 . */ -+ -+#include -+#include -+ -+int -+main (int argc, char *argv[]) -+{ -+ printf ("Hello, World.\n"); -+ abort (); -+} -Index: gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp -=================================================================== ---- /dev/null -+++ gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp -@@ -0,0 +1,39 @@ -+# Copyright 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 . -+ -+set testfile "set-solib-absolute-prefix" -+set srcfile ${testfile}.c -+ -+# It is necessary to verify if the binary is 32-bit, so that the system -+# call `__kernel_vsyscall' originates from vDSO. -+ -+if { ![is_ilp32_target] } { -+ return -1 -+} -+ -+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { -+ return -1 -+} -+ -+if { ![runto_main] } { -+ return -1 -+} -+ -+gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \ -+ "continue until abort" -+gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \ -+ ".*warning: Unable to find dynamic linker breakpoint function.*" \ -+ "set solib-absolute-prefix" -+gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall" diff --git a/gdb-rhel5-compat.patch b/gdb-rhel5-compat.patch deleted file mode 100644 index 2b947d3..0000000 --- a/gdb-rhel5-compat.patch +++ /dev/null @@ -1,29 +0,0 @@ -Index: gdb-7.4.50.20120602/gdb/linux-nat.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 20:54:30.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 20:56:03.966493352 +0200 -@@ -1816,8 +1816,22 @@ get_pending_status (struct lwp_info *lp, - gdb_signal_to_string (signo)); - } - -- if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped) -- *status = W_STOPCODE (SIGSTOP); -+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that -+ many TIDs are left unstopped). See RH Bug 496732. */ -+ if (GET_PID (lp->ptid) == pid_was_stopped) -+ { -+ int err; -+ -+ errno = 0; -+ err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP); -+ if (debug_linux_nat) -+ { -+ fprintf_unfiltered (gdb_stdlog, -+ "SC: lwp kill %d %s\n", -+ err, -+ errno ? safe_strerror (errno) : "ERRNO-OK"); -+ } -+ } - - return 0; - } diff --git a/gdb-rhel5-gcc44.patch b/gdb-rhel5-gcc44.patch deleted file mode 100644 index 241795a..0000000 --- a/gdb-rhel5-gcc44.patch +++ /dev/null @@ -1,430 +0,0 @@ -Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as -the default gcc and gfortran binaries are from gcc-4.1. - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/vla.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/vla.exp 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/vla.exp 2012-07-03 17:50:57.999207540 +0200 -@@ -16,7 +16,25 @@ - set testfile vla - set srcfile ${testfile}.c - set binfile ${objdir}/${subdir}/${testfile} --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+# Temporarily provide compiler=gcc44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists compiler] { -+ set old_compiler [board_info $board compiler] -+ unset_board_info compiler -+} elseif [info exists old_compiler] { -+ unset old_compiler -+} -+set_board_info compiler gcc44 -+ -+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug quiet}] -+ -+unset_board_info compiler -+if [info exists old_compiler] { -+ set_board_info compiler $old_compiler -+} -+ -+if { $err != "" } { - untested "Couldn't compile test program" - return -1 - } -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/break-interp.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/break-interp.exp 2012-07-03 17:44:45.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/break-interp.exp 2012-07-03 17:50:58.000207539 +0200 -@@ -34,9 +34,29 @@ if [get_compiler_info] { - return -1 - } - -+# Temporarily provide compiler=gcc44 saving the original value around. -+# RHEL-5 workaround of its: -+# gcc: -soname: linker input file unused because linking not done -+ -+set board [target_info name] -+if [board_info $board exists compiler] { -+ set old_compiler [board_info $board compiler] -+ unset_board_info compiler -+} elseif [info exists old_compiler] { -+ unset old_compiler -+} -+set_board_info compiler gcc44 -+ - # Use -soname so that the new library gets copied by build_executable_own_libs. - --if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug ldflags=-Wl,-soname,${test}.so]] != ""} { -+set err [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug ldflags=-Wl,-soname,${test}.so]] -+ -+unset_board_info compiler -+if [info exists old_compiler] { -+ set_board_info compiler $old_compiler -+} -+ -+if { $err != "" } { - return -1 - } - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/common-block.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/common-block.exp 2012-07-03 17:36:21.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/common-block.exp 2012-07-03 17:50:58.001207537 +0200 -@@ -20,7 +20,25 @@ set testfile "common-block" - set srcfile ${testfile}.f90 - set binfile ${objdir}/${subdir}/${testfile} - --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if { $err != "" } { - untested "Couldn't compile ${srcfile}" - return -1 - } -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dwarf-stride.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2012-07-03 17:50:58.002207535 +0200 -@@ -27,7 +27,25 @@ - set testfile dwarf-stride - set srcfile ${testfile}.f90 - --if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } { -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if $err { - return -1 - } - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dynamic.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dynamic.exp 2012-07-03 17:50:58.002207535 +0200 -@@ -25,7 +25,25 @@ set testfile "dynamic" - set srcfile ${testfile}.f90 - set binfile ${objdir}/${subdir}/${testfile} - --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if { $err != "" } { - untested "Couldn't compile ${srcfile}" - return -1 - } -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/library-module.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/library-module.exp 2012-06-25 22:51:35.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/library-module.exp 2012-07-03 17:52:57.666062981 +0200 -@@ -23,16 +23,34 @@ if [get_compiler_info] { - return -1 - } - --if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $libfile {debug f90}] != "" } { -- untested "Couldn't compile ${srclibfile}" -- return -1 -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler - } -+set_board_info f90compiler gfortran44 - - # prepare_for_testing cannot be used as linking with $libfile cannot be passed - # just for the linking phase (and not the source compilation phase). And any - # warnings on ignored $libfile abort the process. - --if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug f90 shlib=$libfile]] != "" } { -+set err1 [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $libfile {debug f90}] -+set err2 [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug f90 shlib=$libfile]] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if { $err1 != "" } { -+ untested "Couldn't compile ${srclibfile}" -+ return -1 -+} -+if { $err2 != "" } { - untested "Couldn't compile ${srcfile}" - return -1 - } -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/module.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/module.exp 2012-06-25 22:51:35.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/module.exp 2012-07-03 17:53:56.464992086 +0200 -@@ -15,7 +15,25 @@ - - standard_testfile .f90 - --if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } { -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if $err { - return -1 - } - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/string.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/string.exp 2012-07-03 17:30:07.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/string.exp 2012-07-03 17:50:58.005207532 +0200 -@@ -23,7 +23,25 @@ set testfile "string" - set srcfile ${testfile}.f90 - set binfile ${objdir}/${subdir}/${testfile} - --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if { $err != "" } { - untested "Couldn't compile ${srcfile}" - return -1 - } -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/omp-step.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2012-07-03 17:36:21.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/omp-step.exp 2012-07-03 17:50:58.006207531 +0200 -@@ -15,7 +15,26 @@ - - set testfile "omp-step" - set srcfile ${testfile}.f90 --if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90 additional_flags=-fopenmp}] } { -+ -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90 additional_flags=-fopenmp}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if $err { - return -1 - } - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/derived-type.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2012-06-25 22:51:35.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/derived-type.exp 2012-07-03 17:55:46.583858849 +0200 -@@ -22,7 +22,25 @@ if { [skip_fortran_tests] } { return -1 - - standard_testfile .f90 - --if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} { -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if $err { - return -1 - } - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/subarray.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/subarray.exp 2012-06-25 22:51:35.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/subarray.exp 2012-07-03 17:56:20.454818198 +0200 -@@ -22,7 +22,25 @@ if { [skip_fortran_tests] } { return -1 - - standard_testfile .f - --if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} { -+# Temporarily provide f90compiler=gfortran44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists f90compiler] { -+ set old_f90compiler [board_info $board f90compiler] -+ unset_board_info f90compiler -+} elseif [info exists old_f90compiler] { -+ unset old_f90compiler -+} -+set_board_info f90compiler gfortran44 -+ -+set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] -+ -+unset_board_info f90compiler -+if [info exists old_f90compiler] { -+ set_board_info f90compiler $old_f90compiler -+} -+ -+if $err { - return -1 - } - -Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/tls-sepdebug.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2012-07-03 17:32:05.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2012-07-03 17:50:58.007207530 +0200 -@@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi - - # FIXME: gcc dependency (-Wl,-soname). - --if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } { -+# Temporarily provide compiler=gcc44 saving the original value around. -+ -+set board [target_info name] -+if [board_info $board exists compiler] { -+ set old_compiler [board_info $board compiler] -+ unset_board_info compiler -+} elseif [info exists old_compiler] { -+ unset old_compiler -+} -+set_board_info compiler gcc44 -+ -+set err [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] -+ -+unset_board_info compiler -+if [info exists old_compiler] { -+ set_board_info compiler $old_compiler -+} -+ -+if { $err != "" } { - untested "Couldn't compile test library" - return -1 - } -Index: gdb-7.4.50.20120703/gdb/testsuite/lib/prelink-support.exp -=================================================================== ---- gdb-7.4.50.20120703.orig/gdb/testsuite/lib/prelink-support.exp 2012-07-03 17:44:45.000000000 +0200 -+++ gdb-7.4.50.20120703/gdb/testsuite/lib/prelink-support.exp 2012-07-03 17:50:58.008207529 +0200 -@@ -119,9 +119,31 @@ proc file_copy {src dest} { - proc build_executable_own_libs {testname executable sources options {interp ""} {dir ""}} { - global objdir subdir - -- if {[build_executable $testname $executable $sources $options] == -1} { -- return "" -+ # Temporarily provide compiler=gcc44 saving the original value around. -+ # RHEL-5 workaround of its: -+ # gcc: -rpath: linker input file unused because linking not done -+ # gcc: --dynamic-linker: linker input file unused because linking not done -+ -+ set board [target_info name] -+ if [board_info $board exists compiler] { -+ set old_compiler [board_info $board compiler] -+ unset_board_info compiler -+ } elseif [info exists old_compiler] { -+ unset old_compiler -+ } -+ set_board_info compiler gcc44 -+ -+ set err [build_executable $testname $executable $sources $options] -+ -+ unset_board_info compiler -+ if [info exists old_compiler] { -+ set_board_info compiler $old_compiler - } -+ -+ if { $err == -1 } { -+ return "" -+ } -+ - set binfile ${objdir}/${subdir}/${executable} - - set command "ldd $binfile" diff --git a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch deleted file mode 100644 index 27e49dd..0000000 --- a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +++ /dev/null @@ -1,723 +0,0 @@ -Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.S -=================================================================== ---- /dev/null -+++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.S -@@ -0,0 +1,638 @@ -+/* Copyright (C) 2012 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 . */ -+ -+/* This file has been generated from the file named `xlf-variable.f', which -+ should be present in this directory. The command used to generate this -+ file was: -+ -+ xlf -qnoopt -g9 -S xlf-variable.f -o xlf-variable.S -+ -+ After issuing this command, you must hand-edit this file and remove the -+ mentions for `_xlfExit', since it is only present in XLF-specific -+ libraries. You must also make sure to remove the file named `mod1.mod' -+ which will be created in the compilation directory. -+ -+ In order to generated this file, the following XLF package was used: -+ -+ xlf.14.1.0.0.linux.eval.tar.gz -+ -+ These instructions may be different for different versions of the XLF -+ compiler. */ -+ -+.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4 -+.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 -+.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 -+.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 -+.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 -+.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 -+.set r30,30; .set r31,31 -+.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4 -+.set fp5,5; .set fp6,6; .set fp7,7; .set fp8,8; .set fp9,9 -+.set fp10,10; .set fp11,11; .set fp12,12; .set fp13,13; .set fp14,14 -+.set fp15,15; .set fp16,16; .set fp17,17; .set fp18,18; .set fp19,19 -+.set fp20,20; .set fp21,21; .set fp22,22; .set fp23,23; .set fp24,24 -+.set fp25,25; .set fp26,26; .set fp27,27; .set fp28,28; .set fp29,29 -+.set fp30,30; .set fp31,31 -+.set v0,0; .set v1,1; .set v2,2; .set v3,3; .set v4,4 -+.set v5,5; .set v6,6; .set v7,7; .set v8,8; .set v9,9 -+.set v10,10; .set v11,11; .set v12,12; .set v13,13; .set v14,14 -+.set v15,15; .set v16,16; .set v17,17; .set v18,18; .set v19,19 -+.set v20,20; .set v21,21; .set v22,22; .set v23,23; .set v24,24 -+.set v25,25; .set v26,26; .set v27,27; .set v28,28; .set v29,29 -+.set v30,30; .set v31,31 -+.set q0,0; .set q1,1; .set q2,2; .set q3,3; .set q4,4 -+.set q5,5; .set q6,6; .set q7,7; .set q8,8; .set q9,9 -+.set q10,10; .set q11,11; .set q12,12; .set q13,13; .set q14,14 -+.set q15,15; .set q16,16; .set q17,17; .set q18,18; .set q19,19 -+.set q20,20; .set q21,21; .set q22,22; .set q23,23; .set q24,24 -+.set q25,25; .set q26,26; .set q27,27; .set q28,28; .set q29,29 -+.set q30,30; .set q31,31 -+.set MQ,0; .set XER,1; .set FROM_RTCU,4; .set FROM_RTCL,5; .set FROM_DEC,6 -+.set LR,8; .set CTR,9; .set TID,17; .set DSISR,18; .set DAR,19; .set TO_RTCU,20 -+.set TO_RTCL,21; .set TO_DEC,22; .set SDR_0,24; .set SDR_1,25; .set SRR_0,26 -+.set SRR_1,27 -+.set BO_dCTR_NZERO_AND_NOT,0; .set BO_dCTR_NZERO_AND_NOT_1,1 -+.set BO_dCTR_ZERO_AND_NOT,2; .set BO_dCTR_ZERO_AND_NOT_1,3 -+.set BO_IF_NOT,4; .set BO_IF_NOT_1,5; .set BO_IF_NOT_2,6 -+.set BO_IF_NOT_3,7; .set BO_dCTR_NZERO_AND,8; .set BO_dCTR_NZERO_AND_1,9 -+.set BO_dCTR_ZERO_AND,10; .set BO_dCTR_ZERO_AND_1,11; .set BO_IF,12 -+.set BO_IF_1,13; .set BO_IF_2,14; .set BO_IF_3,15; .set BO_dCTR_NZERO,16 -+.set BO_dCTR_NZERO_1,17; .set BO_dCTR_ZERO,18; .set BO_dCTR_ZERO_1,19 -+.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22 -+.set BO_ALWAYS_3,23; .set BO_dCTR_NZERO_8,24; .set BO_dCTR_NZERO_9,25 -+.set BO_dCTR_ZERO_8,26; .set BO_dCTR_ZERO_9,27; .set BO_ALWAYS_8,28 -+.set BO_ALWAYS_9,29; .set BO_ALWAYS_10,30; .set BO_ALWAYS_11,31 -+.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3 -+.set CR1_FX,4; .set CR1_FEX,5; .set CR1_VX,6; .set CR1_OX,7 -+.set CR2_LT,8; .set CR2_GT,9; .set CR2_EQ,10; .set CR2_SO,11 -+.set CR3_LT,12; .set CR3_GT,13; .set CR3_EQ,14; .set CR3_SO,15 -+.set CR4_LT,16; .set CR4_GT,17; .set CR4_EQ,18; .set CR4_SO,19 -+.set CR5_LT,20; .set CR5_GT,21; .set CR5_EQ,22; .set CR5_SO,23 -+.set CR6_LT,24; .set CR6_GT,25; .set CR6_EQ,26; .set CR6_SO,27 -+.set CR7_LT,28; .set CR7_GT,29; .set CR7_EQ,30; .set CR7_SO,31 -+.set TO_LT,16; .set TO_GT,8; .set TO_EQ,4; .set TO_LLT,2; .set TO_LGT,1 -+ -+ .file "xlf-variable.f" -+ .globl __mod1_NMOD_____mod1 -+ .type __mod1_NMOD_____mod1,@function -+ .size __mod1_NMOD_____mod1,32 -+ .globl main -+ .type main,@function -+ .size main,68 -+ .globl __mod1_NMOD_sub1 -+ .type __mod1_NMOD_sub1,@function -+ .size __mod1_NMOD_sub1,136 -+ .globl _main -+ .type _main,@function -+ .size _main,68 -+ -+ .section ".text" -+ .align 7 -+.LC.text: -+__mod1_NMOD_____mod1: -+ stwu SP,-32(SP) -+ stw r31,28(SP) -+ or r31,SP,SP -+ b $+0x4 -+ addi r11,r31,32 -+ lwz r31,-4(r11) -+ or SP,r11,r11 -+ bclr BO_ALWAYS,CR0_LT -+.LC.text32: -+ -+__mod1_NMOD_sub1: -+ stwu SP,-32(SP) -+ stw r31,28(SP) -+ stw r30,24(SP) -+ or r31,SP,SP -+ addis r30,r0,.const_dr@ha -+ addi r30,r30,.const_dr@l -+ addis r3,r0,__N_mod1@ha -+ addi r3,r3,__N_mod1@l -+ addi r0,r0,1 -+ stb r0,4(r3) -+ addi r4,r0,14 -+ stb r4,5(r3) -+ stb r0,7(r3) -+ addis r5,r0,__N__mod1@ha -+ addi r5,r5,__N__mod1@l -+ stw r5,0(r3) -+ lbz r5,6(r3) -+ rlwinm r5,r5,0,25,25 -+ ori r5,r5,0x0040 -+ stb r5,6(r3) -+ lwz r5,0(r3) -+ lfs fp0,0(r30) -+ stfs fp0,0(r5) -+ stb r0,4(r3) -+ stb r4,5(r3) -+ addi r4,r0,0 -+ stb r4,6(r3) -+ stb r0,7(r3) -+ b $+0x4 -+ addi r11,r31,32 -+ lwz r30,-8(r11) -+ lwz r31,-4(r11) -+ or SP,r11,r11 -+ bclr BO_ALWAYS,CR0_LT -+.LC.text168: -+ .long 0 -+ .skip 0x54 -+.LC.text256: -+ -+main: -+_main: -+ mfspr r0,LR -+ stwu SP,-32(SP) -+ stw r31,28(SP) -+ stw r0,36(SP) -+ or r31,SP,SP -+ bl __mod1_NMOD_sub1 -+ addi r3,r0,0 -+.LC.text288: -+ -+ tw TO_EQ,r14,r14 -+ addi r3,r0,0 -+ b $+0x4 -+ addi r11,r31,32 -+ lwz r31,-4(r11) -+ lwz r0,4(r11) -+ mtspr LR,r0 -+ or SP,r11,r11 -+ bclr BO_ALWAYS,CR0_LT -+.LC.text324: -+ -+ -+ .section ".rodata","a" -+ .align 2 -+.LC.rodata: -+ .type .const_dr,@object -+ .size .const_dr,4 -+.const_dr: -+ .long 0x40400000 -+ -+ .section ".eh_frame","wa" -+ .align 2 -+.LC.eh_frame: -+ .long 0x0000000c -+ .long 0x00000000 -+ .long 0x0100047c -+ .long 0x410c0100 -+ .long 0x0000001c -+ .long 0x00000014 -+ .long .LC.text -+ .long 0x00000020 -+ .long 0x410e2041 -+ .long 0x9f01410d -+ .long 0x1f410a42 -+ .long 0xdf420b00 -+ .long 0x00000020 -+ .long 0x00000034 -+ .long .LC.text32 -+ .long 0x00000088 -+ .long 0x410e2041 -+ .long 0x9f01419e -+ .long 0x02410d1f -+ .long 0x590a42de -+ .long 0x41df420b -+ .long 0x0000000c -+ .long 0x00000000 -+ .long 0x0100047c -+ .long 0x410c0100 -+ .long 0x00000020 -+ .long 0x00000014 -+ .long .LC.text256 -+ .long 0x00000044 -+ .long 0x420e2041 -+ .long 0x9f014111 -+ .long 0x417f410d -+ .long 0x1f460a42 -+ .long 0xdf440b00 -+ -+ .section ".data","wa" -+ .align 4 -+.LC.data: -+ .globl __N_mod1 -+ .type __N_mod1,@object -+ .size __N_mod1,8 -+__N_mod1: -+ .long 0x00000000 -+ .long 0x01000001 -+ -+ .section ".except.1","wa" -+ .align 1 -+.LC.except.1: -+ .long .LC.text288 -+ .byte 0x01 -+ .byte 0x09 -+ -+ .ident "Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000.Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000." -+ -+ .section ".debug_aranges" -+ .align 0 -+.LC.debug_aranges: -+ .long 0x0000001c -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_info -+ .long 0x04000000 -+ .byte 0x00 -+ .byte 0x00 -+ .long .LC.text -+ .long 0x000000a8 -+ .long 0x00000000 -+ .long 0x00000000 -+ .long 0x0000001c -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_info273 -+ .long 0x04000000 -+ .byte 0x00 -+ .byte 0x00 -+ .long .LC.text256 -+ .long 0x00000044 -+ .long 0x00000000 -+ .long 0x00000000 -+ -+ .section ".debug_pubnames" -+ .align 0 -+.LC.debug_pubnames: -+ .long 0x0000002f -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_info -+ .long 0x00000111 -+ .long 0x000000dc -+ .long 0x79000000 -+ .long 0x00ec7a00 -+ .long 0x000000fc -+ .long 0x5f5f6d6f -+ .long 0x64315f4e -+ .long 0x4d4f445f -+ .long 0x73756231 -+ .long 0x00000000 -+ .long 0x00000000 -+ .byte 0x18 -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_info273 -+ .long 0x00000127 -+ .long 0x0000010f -+ .long 0x5f6d6169 -+ .long 0x6e000000 -+ .byte 0x00 -+ .byte 0x00 -+ -+ .section ".debug_info" -+ .align 0 -+.LC.debug_info: -+ .long 0x0000010d -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_abbrev -+ .long 0x0401786c -+ .long 0x662d7661 -+ .long 0x72696162 -+ .long 0x6c652e66 -+ .byte 0x00 -+ .long .LC.debug_line -+ .long .LC.text -+ .long .LC.text168 -+ .long 0x082f726f -+ .long 0x6f742f73 -+ .long 0x65726769 -+ .long 0x6f646a2f -+ .long 0x6764622d -+ .long 0x372e302e -+ .long 0x312d3432 -+ .long 0x2e656c35 -+ .long 0x2f676462 -+ .long 0x2d372e30 -+ .long 0x2e312f67 -+ .long 0x64622f74 -+ .long 0x65737473 -+ .long 0x75697465 -+ .long 0x2f676462 -+ .long 0x2e666f72 -+ .long 0x7472616e -+ .long 0x0049424d -+ .long 0x20584c20 -+ .long 0x466f7274 -+ .long 0x72616e20 -+ .long 0x666f7220 -+ .long 0x4c696e75 -+ .long 0x782c2056 -+ .long 0x31342e31 -+ .long 0x20283537 -+ .long 0x36352d4a -+ .long 0x30352c20 -+ .long 0x35373235 -+ .long 0x2d433735 -+ .long 0x29205665 -+ .long 0x7273696f -+ .long 0x6e203134 -+ .long 0x2e30312e -+ .long 0x30303030 -+ .long 0x2e303030 -+ .long 0x30000249 -+ .long 0x4e544547 -+ .long 0x45520004 -+ .long 0x05030005 -+ .long 0x02524541 -+ .long 0x4c000404 -+ .long 0x04050000 -+ .long 0x0000c706 -+ .long 0x6d6f6431 -+ .long 0x00070503 -+ .long __N_mod1 -+ .long 0x79000100 -+ .long 0x01000000 -+ .long 0xd0070503 -+ .long __N__mod1 -+ .long 0x7a000100 -+ .long 0x01000000 -+ .long 0xc7087375 -+ .byte 0x62 -+ .byte 0x31 -+ .byte 0x00 -+ .long .LC.text32 -+ .long .LC.text168 -+ .long 0x01180101 -+ .byte 0x6f -+ .byte 0x00 -+ .byte 0x00 -+.LC.debug_info273: -+ .long 0x00000123 -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_abbrev97 -+ .long 0x0401786c -+ .long 0x662d7661 -+ .long 0x72696162 -+ .long 0x6c652e66 -+ .byte 0x00 -+ .long .LC.debug_line98 -+ .long .LC.text256 -+ .long .LC.text324 -+ .long 0x082f726f -+ .long 0x6f742f73 -+ .long 0x65726769 -+ .long 0x6f646a2f -+ .long 0x6764622d -+ .long 0x372e302e -+ .long 0x312d3432 -+ .long 0x2e656c35 -+ .long 0x2f676462 -+ .long 0x2d372e30 -+ .long 0x2e312f67 -+ .long 0x64622f74 -+ .long 0x65737473 -+ .long 0x75697465 -+ .long 0x2f676462 -+ .long 0x2e666f72 -+ .long 0x7472616e -+ .long 0x0049424d -+ .long 0x20584c20 -+ .long 0x466f7274 -+ .long 0x72616e20 -+ .long 0x666f7220 -+ .long 0x4c696e75 -+ .long 0x782c2056 -+ .long 0x31342e31 -+ .long 0x20283537 -+ .long 0x36352d4a -+ .long 0x30352c20 -+ .long 0x35373235 -+ .long 0x2d433735 -+ .long 0x29205665 -+ .long 0x7273696f -+ .long 0x6e203134 -+ .long 0x2e30312e -+ .long 0x30303030 -+ .long 0x2e303030 -+ .long 0x30000249 -+ .long 0x4e544547 -+ .long 0x45520004 -+ .long 0x05030005 -+ .long 0x02524541 -+ .long 0x4c000404 -+ .long 0x04000000 -+ .long 0xb9050000 -+ .long 0x0000c706 -+ .long 0x000000f4 -+ .long 0x26264e26 -+ .long 0x6d6f6431 -+ .long 0x00080779 -+ .long 0x00022300 -+ .long 0x000000d4 -+ .long 0x00060000 -+ .long 0x010f2626 -+ .long 0x4e26266d -+ .long 0x6f643100 -+ .long 0x04077a00 -+ .long 0x02230000 -+ .long 0x0000c700 -+ .long 0x085f6d61 -+ .byte 0x69 -+ .byte 0x6e -+ .byte 0x00 -+ .long .LC.text256 -+ .long .LC.text324 -+ .long 0x0201016f -+ .long 0x000000b9 -+ .byte 0x00 -+ -+ .section ".debug_abbrev" -+ .align 0 -+.LC.debug_abbrev: -+ .long 0x01110103 -+ .long 0x08100611 -+ .long 0x01120113 -+ .long 0x0b1b0825 -+ .long 0x08000002 -+ .long 0x24000308 -+ .long 0x0b0b3e0b -+ .long 0x00000324 -+ .long 0x000b0b3e -+ .long 0x0b000004 -+ .long 0x15000000 -+ .long 0x050f0033 -+ .long 0x0b491300 -+ .long 0x00061e01 -+ .long 0x03080000 -+ .long 0x07340002 -+ .long 0x0a03083a -+ .long 0x0b3b0b3f -+ .long 0x0c491300 -+ .long 0x00082e00 -+ .long 0x03081101 -+ .long 0x12013a0b -+ .long 0x3b0b3f0c -+ .long 0x400a0000 -+ .byte 0x00 -+.LC.debug_abbrev97: -+ .long 0x01110103 -+ .long 0x08100611 -+ .long 0x01120113 -+ .long 0x0b1b0825 -+ .long 0x08000002 -+ .long 0x24000308 -+ .long 0x0b0b3e0b -+ .long 0x00000324 -+ .long 0x000b0b3e -+ .long 0x0b000004 -+ .long 0x15004913 -+ .long 0x0000050f -+ .long 0x00330b49 -+ .long 0x13000006 -+ .long 0x13010113 -+ .long 0x03080b0b -+ .long 0x0000070d -+ .long 0x00030838 -+ .long 0x0a491300 -+ .long 0x00082e00 -+ .long 0x03081101 -+ .long 0x1201360b -+ .long 0x3f0c400a -+ .long 0x49130000 -+ .byte 0x00 -+ -+ .section ".debug_line" -+ .align 0 -+.LC.debug_line: -+ .long 0x0000005e -+ .long 0x00020000 -+ .long 0x00220101 -+ .long 0x9cdc0a00 -+ .long 0x01010101 -+ .long 0x00000001 -+ .long 0x00786c66 -+ .long 0x2d766172 -+ .long 0x6961626c -+ .long 0x652e6600 -+ .long 0x00000000 -+ .long 0x04010005 -+ .byte 0x02 -+ .long .LC.text -+ .long 0x03130109 -+ .long 0x000c0309 -+ .long 0x01090014 -+ .long 0x037b0109 -+ .long 0x00180301 -+ .long 0x01090038 -+ .long 0x03010109 -+ .long 0x000c0301 -+ .long 0x01090014 -+ .long 0x03010109 -+ .long 0x00180001 -+ .byte 0x01 -+.LC.debug_line98: -+ .long 0x00000046 -+ .long 0x00020000 -+ .long 0x00220101 -+ .long 0x9cdc0a00 -+ .long 0x01010101 -+ .long 0x00000001 -+ .long 0x00786c66 -+ .long 0x2d766172 -+ .long 0x6961626c -+ .long 0x652e6600 -+ .long 0x00000000 -+ .long 0x04010005 -+ .byte 0x02 -+ .long .LC.text256 -+ .long 0x031f0109 -+ .long 0x00140300 -+ .long 0x01090004 -+ .long 0x03010109 -+ .long 0x002c0001 -+ .byte 0x01 -+ -+ .section ".debug_frame" -+ .align 0 -+.LC.debug_frame: -+ .long 0x0000000c -+ .long 0xffffffff -+ .long 0x0100047c -+ .long 0x410c0100 -+ .long 0x0000001c -+ .long .LC.debug_frame -+ .long .LC.text -+ .long 0x00000020 -+ .long 0x410e2041 -+ .long 0x9f01410d -+ .long 0x1f410a42 -+ .long 0xdf420b00 -+ .long 0x00000020 -+ .long .LC.debug_frame -+ .long .LC.text32 -+ .long 0x00000088 -+ .long 0x410e2041 -+ .long 0x9f01419e -+ .long 0x02410d1f -+ .long 0x590a42de -+ .long 0x41df420b -+.LC.debug_frame84: -+ .long 0x0000000c -+ .long 0xffffffff -+ .long 0x0100047c -+ .long 0x410c0100 -+ .long 0x00000020 -+ .long .LC.debug_frame84 -+ .long .LC.text256 -+ .long 0x00000044 -+ .long 0x420e2041 -+ .long 0x9f014111 -+ .long 0x417f410d -+ .long 0x1f460a42 -+ .long 0xdf440b00 -+ -+ .section ".debug_pubtypes" -+ .align 0 -+.LC.debug_pubtypes: -+ .long 0x00000023 -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_info -+ .long 0x00000111 -+ .long 0x000000b9 -+ .long 0x494e5445 -+ .long 0x47455200 -+ .long 0x000000c7 -+ .long 0x5245414c -+ .long 0x00000000 -+ .long 0x00000000 -+ .byte 0x3e -+ .byte 0x00 -+ .byte 0x02 -+ .long .LC.debug_info273 -+ .long 0x00000127 -+ .long 0x000000b9 -+ .long 0x494e5445 -+ .long 0x47455200 -+ .long 0x000000c7 -+ .long 0x5245414c -+ .long 0x00000000 -+ .long 0xda26264e -+ .long 0x266d6f64 -+ .long 0x31000000 -+ .long 0x00f42626 -+ .long 0x4e26266d -+ .long 0x6f643100 -+ .long 0x00000000 -+ -+ .comm __N__mod1,4,16 -Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.exp -=================================================================== ---- /dev/null -+++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.exp -@@ -0,0 +1,37 @@ -+# Copyright 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 . -+ -+# This test can only be run on PPC64 machines. -+ -+if { ![istarget powerpc64-*] || ![is_ilp32_target] } { -+ return -1 -+} -+ -+set testfile "xlf-variable" -+set srcfile ${testfile}.S -+ -+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { -+ return -1 -+} -+ -+if { ![runto_main] } { -+ return -1 -+} -+ -+gdb_test "step" ".*y => z.*" "y => z" -+gdb_test "step" ".*y = 3\.0.*" "y = 3.0" -+gdb_test "step" ".*nullify \\(y\\).*" "nullify (y)" -+gdb_test "print z" "= 3" "z = 3" -+gdb_test "ptype z" "= REAL" "z is REAL" -Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.f -=================================================================== ---- /dev/null -+++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.f -@@ -0,0 +1,33 @@ -+c Copyright 2012 Free Software Foundation, Inc. -+c -+c This program is free software; you can redistribute it and/or modify -+c it under the terms of the GNU General Public License as published by -+c the Free Software Foundation; either version 3 of the License, or -+c (at your option) any later version. -+c -+c This program is distributed in the hope that it will be useful, -+c but WITHOUT ANY WARRANTY; without even the implied warranty of -+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+c GNU General Public License for more details. -+c -+c You should have received a copy of the GNU General Public License -+c along with this program. If not, see . -+ -+c This file is the Fortran source file for xlf-variable.f. -+c It was used to generate the assembly output called xlf-variable.S, -+c which was generated using IBM's XLF compiler. -+ -+ module mod1 -+ real, pointer :: y -+ real, target :: z -+ contains -+ subroutine sub1 -+ y => z -+ y = 3.0 -+ nullify (y) -+ end subroutine -+ end module -+ -+ use mod1 -+ call sub1 -+ end diff --git a/gdb-runtest-pie-override.patch b/gdb-runtest-pie-override.patch deleted file mode 100644 index ab45237..0000000 --- a/gdb-runtest-pie-override.patch +++ /dev/null @@ -1,40 +0,0 @@ -make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp - -gcc -fpic -c -fPIE -pie -o x.o x.c -/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/Scrt1.o: In function `_start': -(.text+0x20): undefined reference to `main' - -=> Change the order for overrides. - -One has to also use -fPIC rather than -fPIE, -fPIC is stronger. - -The correct way would be: -make check//unix RUNTESTFLAGS='CC_FOR_TARGET=gcc\ -fPIC\ -pie CXX_FOR_TARGET=g++\ -fPIC\ -pie solib-display.exp' - -But there is a problem with testsuite.unix non-unique subdir name and also -a problem with make -j parallelization of the testsuite. - ---- gdb-7.3.50.20110722/gdb/testsuite/lib/future.exp 2011-10-11 16:44:05.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/lib/future.exp 2011-10-11 16:44:10.000000000 +0200 -@@ -77,6 +77,10 @@ proc gdb_default_target_compile {source - set ldflags "" - set dest [target_info name] - -+ if {[board_info $dest exists multilib_flags]} { -+ append add_flags " [board_info $dest multilib_flags]" -+ } -+ - if {[info exists CFLAGS_FOR_TARGET]} { - append add_flags " $CFLAGS_FOR_TARGET" - } -@@ -333,10 +337,6 @@ proc gdb_default_target_compile {source - } - } - -- if {[board_info $dest exists multilib_flags]} { -- append add_flags " [board_info $dest multilib_flags]" -- } -- - verbose "doing compile" - - set sources "" diff --git a/gdb-simultaneous-step-resume-breakpoint-test.patch b/gdb-simultaneous-step-resume-breakpoint-test.patch deleted file mode 100644 index e6e53bb..0000000 --- a/gdb-simultaneous-step-resume-breakpoint-test.patch +++ /dev/null @@ -1,150 +0,0 @@ ---- /dev/null 2009-09-25 12:44:54.497650251 +0200 -+++ ./gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp 2009-09-25 17:27:12.000000000 +0200 -@@ -0,0 +1,65 @@ -+# Copyright (C) 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . */ -+ -+# Test multiple threads stepping into a .debug_line-less function with -+# a breakpoint placed on its return-to-caller point. -+ -+set testfile simultaneous-step-resume-breakpoint -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+# Ensure we have no debuginfo for the `sleep' call itself (=for libc). -+gdb_test "set debug-file-directory /DoesNotExist" -+ -+gdb_load ${binfile} -+if ![runto_main] { -+ return -1 -+} -+ -+# Red Hat vendor patch does set it to "step" by default. -+gdb_test "set scheduler-locking off" -+ -+gdb_breakpoint [gdb_get_line_number "final-exit"] -+ -+gdb_breakpoint [gdb_get_line_number "sleep-call"] -+gdb_continue_to_breakpoint "sleep-call" -+ -+gdb_test "step" "sleep-call.*" "step thread 1" -+gdb_test "step" "sleep-call.*" "step thread 2" -+gdb_test "step" "sleep-after.*" "step thread 3" -+ -+set test "first continue" -+gdb_test_multiple "continue" $test { -+ -re "final-exit.*$gdb_prompt $" { -+ # gdb-7.0. -+ pass $test -+ return -+ } -+ -re "sleep-after.*$gdb_prompt $" { -+ # Fedora/RHEL branch. -+ pass $test -+ } -+} -+ -+gdb_test "continue" "sleep-after.*" "second continue" -+gdb_test "continue" "final-exit.*" "third continue" ---- /dev/null 2009-09-25 12:44:54.497650251 +0200 -+++ ./gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c 2009-09-25 17:29:42.000000000 +0200 -@@ -0,0 +1,79 @@ -+/* Copyright 2009 Free Software Foundation, Inc. -+ -+ Written by Fred Fish of Cygnus Support -+ Contributed by Cygnus Support -+ -+ 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 . */ -+ -+/* Test multiple threads stepping into a .debug_line-less function with -+ a breakpoint placed on its return-to-caller point. */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define THREADS 3 -+ -+static void * -+func (void *unused) -+{ -+ int i; -+ -+ errno = 0; -+ i = 0xdeadf00d; -+ i = sleep (THREADS); /* sleep-call */ -+ if (errno != 0) /* sleep-after */ -+ perror ("sleep"); -+ -+ /* The GDB bug with forgotten step-resume breakpoint could leave stale -+ breakpoint on the I assignment making it a nop. */ -+ if (i == 0xdeadf00d) -+ assert (0); -+ -+ assert (i == 0); -+ -+ pthread_exit (NULL); -+} -+ -+int -+main (void) -+{ -+ pthread_t threads[THREADS]; -+ int threadi; -+ -+ for (threadi = 0; threadi < THREADS; threadi++) -+ { -+ int i; -+ -+ i = pthread_create (&threads[threadi], NULL, func, NULL); -+ assert (i == 0); -+ -+ i = sleep (1); -+ assert (i == 0); -+ } -+ -+ for (threadi = 0; threadi < THREADS; threadi++) -+ { -+ int i; -+ -+ i = pthread_join (threads[threadi], NULL); -+ assert (i == 0); -+ } -+ -+ return 0; /* final-exit */ -+} diff --git a/gdb-stale-frame_info.patch b/gdb-stale-frame_info.patch deleted file mode 100644 index 59f8ea1..0000000 --- a/gdb-stale-frame_info.patch +++ /dev/null @@ -1,174 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-04/msg00058.html -Subject: [downstream patch FYI] workaround stale frame_info * (PR 13866) - -Hi, - -I did not look at which commit caused this regression but apparently it was -introduced at least with multi-inferiors. - -I understand this fix is not right fix of the crash; but in most GDB cases one -does not use multi-inferior so why to regress single-inferior by it. -Some more simple solutions still fix the single-inferior mode but they -regressed the multi-inferior mode - gdb.threads/no-unwaited-for-left.exp - gdb.multi/base.exp -so I had to put there that sorting magic. - -With proper C++ sanity check of stale live frame_info references the testcase -would be simple without the "frame_garbage_collection" reproducer below. -It is also reproducible just with valgrind but regularly running the whole -testsuite under valgrind I did not find feasible. - -No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu. - - -Thanks, -Jan - - -gdb/ -2012-04-04 Jan Kratochvil - - Workaround PR backtrace/13866. - * progspace.c (switch_to_program_space_and_thread): Try not to call - switch_to_thread. - ---- a/gdb/progspace.c -+++ b/gdb/progspace.c -@@ -481,17 +481,28 @@ save_current_space_and_thread (void) - void - switch_to_program_space_and_thread (struct program_space *pspace) - { -- struct inferior *inf; -+ struct inferior *inf = current_inferior (); - -- inf = find_inferior_for_program_space (pspace); -+ if (inf->pspace != pspace) -+ inf = find_inferior_for_program_space (pspace); - if (inf != NULL) - { -- struct thread_info *tp; -+ struct thread_info *tp, *current_tp = NULL; -+ -+ if (ptid_get_pid (inferior_ptid) == inf->pid) -+ current_tp = find_thread_ptid (inferior_ptid); - - tp = any_live_thread_of_process (inf->pid); - if (tp != NULL) - { -- switch_to_thread (tp->ptid); -+ /* Prefer primarily thread not THREAD_EXITED and secondarily thread -+ not EXECUTING. */ -+ if (current_tp == NULL -+ || (tp->state != THREAD_EXITED -+ && current_tp->state == THREAD_EXITED) -+ || (!tp->executing && current_tp->executing)) -+ switch_to_thread (tp->ptid); -+ - /* Switching thread switches pspace implicitly. We're - done. */ - return; - - -Reproducer with: -./gdb -nx ~/t/thread -ex 'b 24' -ex r -ex 'until 25' -Breakpoint 1, main () at /home/jkratoch/t/thread.c:24 -24 v++; -Segmentation fault (core dumped) - -#include -#include -#include - -static int v; - -static void *start (void *arg) -{ - v++; - v++; - v++; - v++; - sleep (100); - return arg; -} - -int main (void) -{ - pthread_t thread1; - int i; - - i = pthread_create (&thread1, NULL, start, NULL); - assert (i == 0); - v++; - v++; - v++; - v++; - i = pthread_join (thread1, NULL); - assert (i == 0); - - return 0; -} -### --- a/gdb/frame.c -### +++ b/gdb/frame.c -### @@ -1522,12 +1522,30 @@ frame_observer_target_changed (struct target_ops *target) -### reinit_frame_cache (); -### } -### -### +typedef struct obstack obstack_s; -### +DEF_VEC_O (obstack_s); -### +static VEC (obstack_s) *frame_poison_vec; -### + -### +void frame_garbage_collection (void); -### +void -### +frame_garbage_collection (void) -### +{ -### + struct obstack *obstack_p; -### + int ix; -### + -### + for (ix = 0; VEC_iterate (obstack_s, frame_poison_vec, ix, obstack_p); ix++) -### + obstack_free (obstack_p, 0); -### + -### + VEC_free (obstack_s, frame_poison_vec); -### + frame_poison_vec = NULL; -### +} -### + -### /* Flush the entire frame cache. */ -### -### void -### reinit_frame_cache (void) -### { -### - struct frame_info *fi; -### + struct frame_info *fi, *fi_prev; -### -### /* Tear down all frame caches. */ -### for (fi = current_frame; fi != NULL; fi = fi->prev) -### @@ -1538,8 +1556,14 @@ reinit_frame_cache (void) -### fi->base->unwind->dealloc_cache (fi, fi->base_cache); -### } -### -### + for (fi = current_frame; fi != NULL; fi = fi_prev) -### + { -### + fi_prev = fi->prev; -### + memset (fi, 0, sizeof (*fi)); -### + } -### + VEC_safe_push (obstack_s, frame_poison_vec, &frame_cache_obstack); -### + -### /* Since we can't really be sure what the first object allocated was. */ -### - obstack_free (&frame_cache_obstack, 0); -### obstack_init (&frame_cache_obstack); -### -### if (current_frame != NULL) -### --- a/gdb/top.c -### +++ b/gdb/top.c -### @@ -359,6 +359,11 @@ prepare_execute_command (void) -### if (non_stop) -### target_dcache_invalidate (); -### -### + { -### + extern void frame_garbage_collection (void); -### + frame_garbage_collection (); -### + } -### + -### return cleanup; -### } -### diff --git a/gdb-step-symless.patch b/gdb-step-symless.patch deleted file mode 100644 index 5bca453..0000000 --- a/gdb-step-symless.patch +++ /dev/null @@ -1,160 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-09/msg00598.html -Subject: [patch+7.5] Fix ppc32 7.5 stepping crash regression - -Hello, - -since - [PATCH] PowerPC 32 with Secure PLT - http://sourceware.org/ml/gdb-patches/2012-01/msg00655.html - http://sourceware.org/ml/gdb-patches/2012-01/msg00656.html - commit 4d19ed66762845cdcce95f8b1daaceb97cf90c71 - Author: eager - Date: Mon Jan 30 17:09:37 2012 +0000 - Support stepping through PPC PLT with securePLT. - -(gdb) step -Single stepping until exit from function main, -which has no line number information. - -Program received signal SIGSEGV, Segmentation fault. -0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651 -651 if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0) -(gdb) p sym -$1 = (struct minimal_symbol *) 0x0 -(gdb) bt -#0 0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651 -#1 0x00000000103fdf44 in in_solib_dynsym_resolve_code (pc=268436636) at solib.c:1185 -#2 0x000000001025d848 in handle_inferior_event (ecs=0xfffffbbdcf0) at infrun.c:4737 -[...] - -I will check it in. - -Not regression tested. - - -Regards, -Jan - - -gdb/ -2012-09-26 Jan Kratochvil - - Fix crash during stepping on ppc32. - * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Test NULL - SYM. - -gdb/testsuite/ -2012-09-26 Jan Kratochvil - - Fix crash during stepping on ppc32. - * gdb.base/step-symless.c: New file. - * gdb.base/step-symless.exp: New file. - -diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c -index c7b70db..ccded83 100644 ---- a/gdb/ppc-linux-tdep.c -+++ b/gdb/ppc-linux-tdep.c -@@ -648,8 +648,9 @@ powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc) - - /* Check if we are in the resolver. */ - sym = lookup_minimal_symbol_by_pc (pc); -- if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0) -- || (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0)) -+ if (sym != NULL -+ && (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0 -+ || strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0)) - return 1; - - return 0; -diff --git a/gdb/testsuite/gdb.base/step-symless.c b/gdb/testsuite/gdb.base/step-symless.c -new file mode 100644 -index 0000000..97eaf5e ---- /dev/null -+++ b/gdb/testsuite/gdb.base/step-symless.c -@@ -0,0 +1,38 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+static volatile int v; -+ -+static void -+symful (void) -+{ -+ v++; -+} -+ -+static void -+symless (void) -+{ -+ v++; -+} -+ -+int -+main (void) -+{ -+ symless (); -+ symful (); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/step-symless.exp b/gdb/testsuite/gdb.base/step-symless.exp -new file mode 100644 -index 0000000..d79edb2 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/step-symless.exp -@@ -0,0 +1,41 @@ -+# 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 . -+ -+standard_testfile -+if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {nodebug}] == -1} { -+ return -1 -+} -+ -+# We need those symbols global to access them from the .S file. -+set test "strip stub symbols" -+set objcopy_program [transform objcopy] -+set result [catch "exec $objcopy_program -N symless ${binfile}" output] -+verbose "result is $result" -+verbose "output is $output" -+if {$result != 0} { -+ fail $test -+ return -+} -+pass $test -+ -+clean_restart $testfile -+ -+if ![runto_main] { -+ return -1 -+} -+ -+gdb_breakpoint symful -+ -+gdb_test "step" "Single stepping until exit.*no line number information.*\r\nBreakpoint \[^\r\n\]* in \\.?symful \\(\\)" - diff --git a/gdb-test-bt-cfi-without-die.patch b/gdb-test-bt-cfi-without-die.patch deleted file mode 100644 index 5f1f967..0000000 --- a/gdb-test-bt-cfi-without-die.patch +++ /dev/null @@ -1,220 +0,0 @@ -http://sourceware.org/ml/archer/2010-q3/msg00028.html -Subject: [delayed-symfile] [commit] Fix a regression on CFI without DIE [Re: - -On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote: -> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5 -> -> There was a regression on gdb.base/savedregs.exp. -> -> quick_addrmap/require_partial_symbols should be used even for the unwind debug -> info checking as its load has been also delayed by this branch. -[...] -> --- a/gdb/dwarf2-frame.c -> +++ b/gdb/dwarf2-frame.c -[...] -> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) -> struct dwarf2_fde *fde; -> CORE_ADDR offset; -> -> + if (objfile->quick_addrmap) -> + { -> + if (!addrmap_find (objfile->quick_addrmap, *pc)) -> + continue; -> + } -> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */ -> + require_partial_symbols (objfile); -> + - -but this has caused a different regression (as discussed in the confcall). - -QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing -built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have -DWARF at all while they can feature CFIs (.eh_frame or .debug_frame). -It has been described by Daniel Jacobowitz at: - Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs - http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html - -Sorry for this regression by me (in that fix of a different regression). - -Fixed it the "slow way" as this branch is now obsoleted by .gdb-index. - -No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. - -Checked-in. - - -Thanks, -Jan - - -eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb - -Test CFI is parsed even for range (function) not described by any DIE. - -https://bugzilla.redhat.com/show_bug.cgi?id=614028 - -gdb/ - * dwarf2-frame.c (dwarf2_frame_find_fde): Remove the - OBJFILE->QUICK_ADDRMAP check. New comment why. - -gdb/testsuite/ - * gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c, - gdb.base/cfi-without-die-caller.c: New files. ---- - gdb/dwarf2-frame.c | 8 +-- - gdb/testsuite/gdb.base/cfi-without-die-caller.c | 28 ++++++++++ - gdb/testsuite/gdb.base/cfi-without-die-main.c | 32 +++++++++++ - gdb/testsuite/gdb.base/cfi-without-die.exp | 67 +++++++++++++++++++++++ - 4 files changed, 130 insertions(+), 5 deletions(-) - create mode 100644 gdb/testsuite/gdb.base/cfi-without-die-caller.c - create mode 100644 gdb/testsuite/gdb.base/cfi-without-die-main.c - create mode 100644 gdb/testsuite/gdb.base/cfi-without-die.exp - -diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c -new file mode 100644 -index 0000000..afdfd53 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/cfi-without-die-caller.c -@@ -0,0 +1,28 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+typedef int (*callback_t) (void); -+ -+int -+caller (callback_t callback) -+{ -+ /* Ensure some frame content to push away the return address. */ -+ volatile const long one = 1; -+ -+ /* Modify the return value to prevent any tail-call optimization. */ -+ return (*callback) () - one; -+} -diff --git a/gdb/testsuite/gdb.base/cfi-without-die-main.c b/gdb/testsuite/gdb.base/cfi-without-die-main.c -new file mode 100644 -index 0000000..8451c4b ---- /dev/null -+++ b/gdb/testsuite/gdb.base/cfi-without-die-main.c -@@ -0,0 +1,32 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+typedef int (*callback_t) (void); -+ -+extern int caller (callback_t callback); -+ -+int -+callback (void) -+{ -+ return 1; -+} -+ -+int -+main (void) -+{ -+ return caller (callback); -+} -diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp -new file mode 100644 -index 0000000..db6d248 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/cfi-without-die.exp -@@ -0,0 +1,67 @@ -+# 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 . -+ -+# Test CFI is parsed even for range (function) not described by any DIE. -+ -+set testfile cfi-without-die -+set srcmainfile ${testfile}-main.c -+set srccallerfile ${testfile}-caller.c -+set executable ${testfile} -+set objmainfile ${objdir}/${subdir}/${testfile}-main.o -+set objcallerfile ${objdir}/${subdir}/${testfile}-caller.o -+set binfile ${objdir}/${subdir}/${executable} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ -+ object [list {additional_flags=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables}]] != "" -+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != "" -+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } { -+ untested ${testfile}.exp -+ return -1 -+} -+ -+clean_restart $executable -+ -+if ![runto callback] then { -+ fail "verify unwinding: Can't run to callback" -+ return 0 -+} -+set test "verify unwinding breaks without CFI" -+gdb_test_multiple "bt" $test { -+ -re " in main .*\r\n$gdb_prompt $" { -+ fail $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ -+ object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != "" -+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != "" -+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } { -+ untested ${testfile}.exp -+ return -1 -+} -+ -+clean_restart $executable -+ -+if ![runto callback] then { -+ fail "test CFI without DIEs: Can't run to callback" -+ return 0 -+} -+# #0 callback () at ... -+# #1 0x00000000004004e9 in caller () -+# #2 0x00000000004004cd in main () at ... -+gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs" --- -1.7.1.1 - diff --git a/gdb-test-dw2-aranges.patch b/gdb-test-dw2-aranges.patch deleted file mode 100644 index 5ddcf9d..0000000 --- a/gdb-test-dw2-aranges.patch +++ /dev/null @@ -1,214 +0,0 @@ -[archer-tromey-delayed-symfile] - -commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d -Author: Jan Kratochvil -Date: Sat Aug 15 15:05:54 2009 +0200 - - Test for "handle incorrect aranges". - - readelf: - Contents of the .debug_aranges section: - - Length: 8 - Version: 2 - Offset into .debug_info: 0x0 - Pointer Size: 0 - Segment Size: 0 - - Address Length - Floating point exception - - * gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files. - -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S -new file mode 100644 -index 0000000..d5b9ca5a ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S -@@ -0,0 +1,140 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004, 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 . */ -+ -+/* Test .debug_aranges containing zero address_size. */ -+ -+/* Dummy function to provide debug information for. */ -+ -+ .text -+.Lbegin_text1: -+ .globl main -+ .type main, %function -+main: -+.Lbegin_main: -+ .int 0 -+.Lend_main: -+ .size main, .-main -+.Lend_text1: -+ -+/* Debug information */ -+ -+ .section .debug_info -+.Lcu1_begin: -+ /* CU header */ -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .4byte .Lend_text1 /* DW_AT_high_pc */ -+ .4byte .Lbegin_text1 /* DW_AT_low_pc */ -+ .ascii "file1.txt\0" /* DW_AT_name */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 1 /* DW_AT_language (C) */ -+ -+ /* main */ -+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */ -+ .byte 1 /* DW_AT_external */ -+ .byte 1 /* DW_AT_decl_file */ -+ .byte 2 /* DW_AT_decl_line */ -+ .ascii "main\0" /* DW_AT_name */ -+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */ -+ .4byte .Lbegin_main /* DW_AT_low_pc */ -+ .4byte .Lend_main /* DW_AT_high_pc */ -+ .byte 1 /* DW_AT_frame_base: length */ -+ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */ -+ -+.Ltype_int: -+ .uleb128 3 /* Abbrev: DW_TAG_base_type */ -+ .ascii "int\0" /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ .byte 5 /* DW_AT_encoding */ -+ -+ .byte 0 /* End of children of CU */ -+ -+.Lcu1_end: -+ -+/* Abbrev table */ -+ .section .debug_abbrev -+.Labbrev1_begin: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3a /* DW_AT_decl_file */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3b /* DW_AT_decl_line */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x40 /* DW_AT_frame_base */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+/* aranges table */ -+ .section .debug_aranges -+ .long .Laranges_end - 1f -+1: -+ .2byte 2 /* aranges Version */ -+ .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */ -+ /* The GDB crasher is this zero value. */ -+ .byte 0 /* aranges address_size */ -+ .byte 0 /* aranges segment_size */ -+ -+.Laranges_end: -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp -new file mode 100644 -index 0000000..39632d5 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp -@@ -0,0 +1,40 @@ -+# Copyright 2004, 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 . -+ -+# Test .debug_aranges containing zero address_size. -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-aranges" -+set srcfile ${testfile}.S -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } { -+ return -1 -+} -+ -+clean_restart $testfile -+ -+# Failed gdb_load would abort the testcase execution earlier. -+pass "file loaded" diff --git a/gdb-test-expr-cumulative-archer.patch b/gdb-test-expr-cumulative-archer.patch deleted file mode 100644 index 232a527..0000000 --- a/gdb-test-expr-cumulative-archer.patch +++ /dev/null @@ -1,207 +0,0 @@ -archer archer-keiths-expr-cumulative -b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc - ---- /dev/null 2011-01-12 06:28:36.282000001 +0100 -+++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.cc 2009-09-25 06:50:38.000000000 +0200 -@@ -0,0 +1,36 @@ -+namespace A -+{ -+ namespace B -+ { -+ int ab = 11; -+ } -+} -+ -+namespace C -+{ -+ namespace D -+ { -+ using namespace A::B; -+ -+ int -+ second() -+ { -+ ab; -+ return 0; -+ } -+ } -+ -+ int -+ first() -+ { -+ //ab; -+ return D::second(); -+ } -+} -+ -+int -+main() -+{ -+ //ab; -+ return C::first(); -+} ---- /dev/null 2011-01-12 06:28:36.282000001 +0100 -+++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.exp 2009-09-25 06:50:38.000000000 +0200 -@@ -0,0 +1,50 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile namespace-nested-imports -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+############################################ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_test "print ab" "No symbol .* in current context." -+ -+############################################ -+gdb_breakpoint C::first -+gdb_continue_to_breakpoint "C::first" -+ -+gdb_test "print ab" "No symbol .* in current context." -+gdb_test "print C::D::ab" "= 11" -+ -+############################################ -+gdb_breakpoint C::D::second -+gdb_continue_to_breakpoint "C::D::second" -+ -+gdb_test "print ab" "= 11" ---- /dev/null 2011-01-12 06:28:36.282000001 +0100 -+++ ./gdb/testsuite/gdb.cp/namespace-no-imports.cc 2009-09-25 06:50:38.000000000 +0200 -@@ -0,0 +1,37 @@ -+ -+namespace A -+{ -+ int _a = 11; -+ -+ namespace B{ -+ -+ int ab = 22; -+ -+ namespace C{ -+ -+ int abc = 33; -+ -+ int second(){ -+ return 0; -+ } -+ -+ } -+ -+ int first(){ -+ _a; -+ ab; -+ C::abc; -+ return C::second(); -+ } -+ } -+} -+ -+ -+int -+main() -+{ -+ A::_a; -+ A::B::ab; -+ A::B::C::abc; -+ return A::B::first(); -+} ---- /dev/null 2011-01-12 06:28:36.282000001 +0100 -+++ ./gdb/testsuite/gdb.cp/namespace-no-imports.exp 2009-09-25 06:50:38.000000000 +0200 -@@ -0,0 +1,69 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile namespace-no-imports -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+############################################ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_test "print A::_a" "= 11" -+gdb_test "print A::B::ab" "= 22" -+gdb_test "print A::B::C::abc" "= 33" -+ -+gdb_test "print _a" "No symbol .* in current context." -+gdb_test "print ab" "No symbol .* in current context." -+gdb_test "print abc" "No symbol .* in current context." -+ -+############################################ -+gdb_breakpoint A::B::first -+gdb_continue_to_breakpoint "A::B::first" -+ -+gdb_test "print A::_a" "= 11" -+gdb_test "print A::B::ab" "= 22" -+gdb_test "print A::B::C::abc" "= 33" -+ -+gdb_test "print _a" "= 11" -+gdb_test "print ab" "= 22" -+gdb_test "print C::abc" "= 33" -+ -+gdb_test "print abc" "No symbol .* in current context." -+ -+############################################ -+gdb_breakpoint A::B::C::second -+gdb_continue_to_breakpoint "A::B::C::second" -+ -+gdb_test "print A::_a" "= 11" -+gdb_test "print A::B::ab" "= 22" -+gdb_test "print A::B::C::abc" "= 33" -+ -+gdb_test "print _a" "= 11" -+gdb_test "print ab" "= 22" -+gdb_test "print abc" "= 33" diff --git a/gdb-test-pid0-core.patch b/gdb-test-pid0-core.patch deleted file mode 100644 index 1bc221b..0000000 --- a/gdb-test-pid0-core.patch +++ /dev/null @@ -1,80 +0,0 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=611435 - -Fix: -Re: [RFA]corelow.c: Add tid to add_to_thread_list -http://sourceware.org/ml/gdb-patches/2010-08/msg00085.html -http://sourceware.org/ml/gdb-cvs/2010-08/msg00026.html -2e5bcfdef1ec3883d48c3f87a4be5c0dff25e17e - ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu -@@ -0,0 +1,20 @@ -+begin 600 x86_64-pid0-core.core.bz2 -+M0EIH.3%!629362,CA>P!$/'_____^*#EZ-A!SP36P&_:G0#=14``04A&8,'U -+M2*9`>$$)P`*RN"#*;#4R()IJ8C$TT&FC3$&@`T`#:C1H8C0T,@,FC,D"4T2! -+M"/2CU'B90]31ZAD#U`&AZF@/4:``!HT&F@!H<`#0-`-#0``#3$-&F@```#0R -+M``#")2FD]2>4]0TTT-!HTT--,0,"#$`R!I@AD`#1H,3&GZT.4TO$#H40/`0C -+M2$IRXS,<55!8T,&&,R.Z441"?J9I%G6GUA2!.[]Z"C5S[&19,%VS7E6[3"60 -+M@`-*2G)QEQ(;?0Y<=MK]/U?Q)LB%+F37TJ9BI*46)H'*Z@V"`"$"P7]&XZ:JE0E<*:#1M$P3G]>VCI)(A!O$64`5$4`E$$-.``7&(09`8HO`B6K!Q^& -+M562%N)2+0@*HB@%D@5$%!*0!L1&0D4D6\:-$A`)`+<6D82PP*H(J(H!?F;0$ -+M%PXB7N!2D4!44`W7"ADEQM6O9TBO5,_]1) -+M($Q2))#),UE,QQK)E$,3D\W.>!4)QO8A_@^Z_SXS4;Q8=HV6[:&$@2$@$R29IBW)K%3"O` -+M9^Y0YJ&BXY1U2HTZ5)2H-V\_(.DZHWE+C#WS($(!I"3CUH2#(+(OWUV"*<<9 -+MJ%A!J[%O.P&V%GI.`L7<1@0>,^1F\MY=V5UT,&NOG%7TTZ[03!@BHB@&)P` -+` -+end ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp -@@ -0,0 +1,46 @@ -+# 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 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. -+ -+# Some kernel core files have PID 0 - for the idle task. -+ -+if ![istarget "x86_64-*-*"] { -+ verbose "Skipping x86_64-pid0-core test." -+ return -+} -+ -+set testfile "x86_64-pid0-core" -+set corebz2uufile ${srcdir}/${subdir}/${testfile}.core.bz2.uu -+set corefile ${objdir}/${subdir}/${testfile}.core -+ -+if {[catch "system \"uudecode -o - ${corebz2uufile} | bzip2 -dc >${corefile}\""] != 0} { -+ untested "failed uudecode or bzip2" -+ return -1 -+} -+file stat ${corefile} corestat -+if {$corestat(size) != 8798208} { -+ untested "uudecode or bzip2 produce invalid result" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+# Former crash was: -+# thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed. -+gdb_test "core-file ${corefile}" "Program terminated with signal 11, Segmentation fault\\.\r\n.*" diff --git a/gdb-x86_64-i386-syscall-restart.patch b/gdb-x86_64-i386-syscall-restart.patch deleted file mode 100644 index d5d6b10..0000000 --- a/gdb-x86_64-i386-syscall-restart.patch +++ /dev/null @@ -1,121 +0,0 @@ -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 - -: -/* - * 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 - - * 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/std_section.patch b/std_section.patch deleted file mode 100644 index a0eddfb..0000000 --- a/std_section.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- gdb-7.5/bfd/section.c 2012-06-29 16:46:03.000000000 +0200 -+++ gdb-7.6/bfd/section.c 2013-01-26 03:08:01.000000000 +0100 -@@ -545,7 +545,7 @@ - .{* These sections are global, and are managed by BFD. The application - . and target back end are not permitted to change the values in - . these sections. *} --.extern asection std_section[4]; -+.extern asection _bfd_std_section[4]; - . - .#define BFD_ABS_SECTION_NAME "*ABS*" - .#define BFD_UND_SECTION_NAME "*UND*" -@@ -553,13 +553,13 @@ - .#define BFD_IND_SECTION_NAME "*IND*" - . - .{* Pointer to the common section. *} --.#define bfd_com_section_ptr (&std_section[0]) -+.#define bfd_com_section_ptr (&_bfd_std_section[0]) - .{* Pointer to the undefined section. *} --.#define bfd_und_section_ptr (&std_section[1]) -+.#define bfd_und_section_ptr (&_bfd_std_section[1]) - .{* Pointer to the absolute section. *} --.#define bfd_abs_section_ptr (&std_section[2]) -+.#define bfd_abs_section_ptr (&_bfd_std_section[2]) - .{* Pointer to the indirect section. *} --.#define bfd_ind_section_ptr (&std_section[3]) -+.#define bfd_ind_section_ptr (&_bfd_std_section[3]) - . - .#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) - .#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) -@@ -725,9 +725,9 @@ - }; - - #define STD_SECTION(NAME, IDX, FLAGS) \ -- BFD_FAKE_SECTION(std_section[IDX], FLAGS, &global_syms[IDX], NAME, IDX) -+ BFD_FAKE_SECTION(_bfd_std_section[IDX], FLAGS, &global_syms[IDX], NAME, IDX) - --asection std_section[] = { -+asection _bfd_std_section[] = { - STD_SECTION (BFD_COM_SECTION_NAME, 0, SEC_IS_COMMON), - STD_SECTION (BFD_UND_SECTION_NAME, 1, 0), - STD_SECTION (BFD_ABS_SECTION_NAME, 2, 0), ---- gdb-7.5.0.20120926/bfd/bfd-in2.h 2012-07-13 17:47:23.000000000 +0200 -+++ gdb-7.6/bfd/bfd-in2.h 2013-02-27 22:39:18.000000000 +0100 -@@ -1547,7 +1575,7 @@ - /* These sections are global, and are managed by BFD. The application - and target back end are not permitted to change the values in - these sections. */ --extern asection std_section[4]; -+extern asection _bfd_std_section[4]; - - #define BFD_ABS_SECTION_NAME "*ABS*" - #define BFD_UND_SECTION_NAME "*UND*" -@@ -1555,13 +1583,13 @@ - #define BFD_IND_SECTION_NAME "*IND*" - - /* Pointer to the common section. */ --#define bfd_com_section_ptr (&std_section[0]) -+#define bfd_com_section_ptr (&_bfd_std_section[0]) - /* Pointer to the undefined section. */ --#define bfd_und_section_ptr (&std_section[1]) -+#define bfd_und_section_ptr (&_bfd_std_section[1]) - /* Pointer to the absolute section. */ --#define bfd_abs_section_ptr (&std_section[2]) -+#define bfd_abs_section_ptr (&_bfd_std_section[2]) - /* Pointer to the indirect section. */ --#define bfd_ind_section_ptr (&std_section[3]) -+#define bfd_ind_section_ptr (&_bfd_std_section[3]) - - #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) - #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) diff --git a/texinfo.patch b/texinfo.patch deleted file mode 100644 index 0a63831..0000000 --- a/texinfo.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- gdb-7.5.0.20120926/bfd/doc/bfd.texinfo~ 2010-10-28 13:40:25.000000000 +0200 -+++ gdb-7.5.0.20120926/bfd/doc/bfd.texinfo 2013-07-30 22:12:05.761876536 +0200 -@@ -322,7 +322,7 @@ - @printindex cp - - @tex --% I think something like @colophon should be in texinfo. In the -+% I think something like @@colophon should be in texinfo. In the - % meantime: - \long\def\colophon{\hbox to0pt{}\vfill - \centerline{The body of this manual is set in} -@@ -333,7 +333,7 @@ - \centerline{{\sl\fontname\tensl\/}} - \centerline{are used for emphasis.}\vfill} - \page\colophon --% Blame: doc@cygnus.com, 28mar91. -+% Blame: doc@@cygnus.com, 28mar91. - @end tex - - @bye